Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 918becf
Author: Frédéric Metrich <[email protected]>
Date:   Sun Dec 1 22:03:43 2024 +0100

    Fix for old PCBs

commit 51a68bb
Author: Frédéric Metrich <[email protected]>
Date:   Fri Nov 29 17:58:34 2024 +0100

    Refactor code formatting in processing.cpp and utils_display.h for improved readability

commit a043d62
Author: Frédéric Metrich <[email protected]>
Date:   Fri Nov 29 17:33:37 2024 +0100

    Update configuration and pin assignments for improved functionality and clarity
  • Loading branch information
FredM67 committed Dec 1, 2024
1 parent 59ebd57 commit 162808c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Mk2_fasterControl_Full/calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ inline constexpr float powerCal_diverted{ 0.0435F }; // for CT2

inline constexpr float f_voltageCal{ 0.8151F }; /**< compared with Sentron PAC 4200 */

inline constexpr float lpf_gain{ 8 }; /**< setting this to 0 disables this extra processing */
inline constexpr float lpf_gain{ 0 }; /**< setting this to 0 disables this extra processing */
inline constexpr float alpha{ 0.002 };

//--------------------------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion Mk2_fasterControl_Full/utils_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ void configureValueForDisplay(const bool _EDD_isActive, const uint16_t _ValueToD
}
}


/**
* @brief Refreshes the display by updating the active digit and its segments.
*
Expand Down
43 changes: 41 additions & 2 deletions Mk2_fasterControl_Full/utils_oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <Arduino.h>
#include <U8g2lib.h>

#include "type_traits.hpp"
#include "FastDivision.h"
#include "types.h"

Expand All @@ -24,9 +25,47 @@
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32

U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/U8X8_PIN_NONE); /**< The OLED display object */
/**
* @brief This is a fake class in case there's no OLED display
*
* When declaring a variable with the real OLED class, even it's not used, it is
* loaded and partially initialized.
* This leads to "break" the ADC measurement on old boards and
* consumes memory on any board.
* This is to avoid the use of "#ifdef" in the code to activate/deactivate
* portions of code.
*
*/
class u8x8_fake
{
public:
u8x8_fake(uint8_t) {}

bool begin()
{
return true;
}
void clearDisplay() {}
void noInverse() {}
uint8_t getCols()
{
return 0;
}
uint8_t getRows()
{
return 0;
}

void setFont(const uint8_t *) {}
void drawString(uint8_t, uint8_t, const char *) {}
void drawGlyph(uint8_t, uint8_t, uint8_t) {}

void drawTile(uint8_t, uint8_t, uint8_t, uint8_t *) {}
};

conditional< TYPE_OF_DISPLAY == DisplayType::OLED, U8X8_SSD1306_128X64_NONAME_HW_I2C, u8x8_fake >::type u8x8(/* reset=*/U8X8_PIN_NONE); /**< The OLED display object */

inline constexpr uint8_t LOGO_WIDTH{ 72 }; /**< The widthof the object, in pixel */
inline constexpr uint8_t LOGO_WIDTH{ 72 }; /**< The width of the object, in pixel */
inline constexpr uint8_t LOGO_HEIGHT{ 64 }; /**< The Height of the object, in pixel */

const unsigned char logo_xbm[] U8X8_PROGMEM = {
Expand Down
3 changes: 2 additions & 1 deletion PVRouter-1-phase.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"settings": {
"files.associations": {
"xtr1common": "cpp",
"new": "cpp"
"new": "cpp",
"initializer_list": "cpp"
}
}
}

0 comments on commit 162808c

Please sign in to comment.