Skip to content

Commit

Permalink
Final with options
Browse files Browse the repository at this point in the history
  • Loading branch information
FredM67 committed Jun 2, 2024
1 parent 539b708 commit 9d4fae9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
8 changes: 4 additions & 4 deletions Mk2_3phase_RFdatalog_temp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ inline constexpr RotationModes PRIORITY_ROTATION{ RotationModes::PIN }; /**< man
inline constexpr bool OVERRIDE_PIN_PRESENT{ true }; /**< managed through EmonESP */
#else
inline constexpr bool EMONESP_CONTROL{ false };
inline constexpr bool DIVERSION_PIN_PRESENT{ false }; /**< set it to 'true' if you want to control diversion ON/OFF */
inline constexpr bool DIVERSION_PIN_PRESENT{ true }; /**< set it to 'true' if you want to control diversion ON/OFF */
inline constexpr RotationModes PRIORITY_ROTATION{ RotationModes::OFF }; /**< set it to 'OFF/AUTO/PIN' if you want manual/automatic rotation of priorities */
inline constexpr bool OVERRIDE_PIN_PRESENT{ false }; /**< set it to 'true' if there's a override pin */
inline constexpr bool OVERRIDE_PIN_PRESENT{ true }; /**< set it to 'true' if there's a override pin */
#endif

inline constexpr bool WATCHDOG_PIN_PRESENT{ false }; /**< set it to 'true' if there's a watch led */
Expand Down Expand Up @@ -76,9 +76,9 @@ inline constexpr uint8_t loadPrioritiesAtStartup[NO_OF_DUMPLOADS]{ 0, 1 }; /**<

// Set the value to 0xff when the pin is not needed (feature deactivated)
inline constexpr uint8_t dualTariffPin{ 0xff }; /**< for 3-phase PCB, off-peak trigger */
inline constexpr uint8_t diversionPin{ 0xff }; /**< if LOW, set diversion on standby */
inline constexpr uint8_t diversionPin{ 2 }; /**< if LOW, set diversion on standby */
inline constexpr uint8_t rotationPin{ 0xff }; /**< if LOW, trigger a load priority rotation */
inline constexpr uint8_t forcePin{ 0xff }; /**< for 3-phase PCB, force pin */
inline constexpr uint8_t forcePin{ 3 }; /**< for 3-phase PCB, force pin */
inline constexpr uint8_t watchDogPin{ 0xff }; /**< watch dog LED */

inline constexpr RelayEngine relays{ { { 7, 1000, 200, 1, 1 } } }; /**< config for relay diversion, see class definition for defaults and advanced options */
Expand Down
11 changes: 7 additions & 4 deletions Mk2_3phase_RFdatalog_temp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,13 @@ bool proceedLoadPrioritiesAndOverriding(const int16_t currentTemperature_x100)
{
const auto pinState{ getPinState(forcePin) };

for (auto &bOverrideLoad : b_overrideLoadOn)
{
bOverrideLoad = !pinState;
}
// for (auto &bOverrideLoad : b_overrideLoadOn)
// {
// bOverrideLoad = !pinState;
// }

// Override only load #1
b_overrideLoadOn[0] = !pinState;
}

return false;
Expand Down
11 changes: 6 additions & 5 deletions Mk2_3phase_RFdatalog_temp/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ monitor_filters =
log2file ; Log data to a file “platformio-device-monitor-*.log” located in the current working directory

[env:basic]
build_src_flags =
-DTEMP_ENABLED
lib_deps =
paulstoffregen/OneWire @ ^2.3.8
adafruit/Adafruit ST7735 and ST7789 Library@^1.10.4

[env:basic_debug]
build_type = debug
Expand All @@ -42,11 +47,7 @@ build_type = debug
build_src_flags =
-DTEMP_ENABLED
lib_deps =
paulstoffregen/OneWire @ ^2.3.7
adafruit/Adafruit BusIO@^1.16.1
adafruit/Adafruit GFX Library@^1.11.9
adafruit/Adafruit seesaw Library@^1.7.7
arduino-libraries/SD@^1.2.4
paulstoffregen/OneWire @ ^2.3.8
adafruit/Adafruit ST7735 and ST7789 Library@^1.10.4

[env:emonesp]
Expand Down
25 changes: 15 additions & 10 deletions Mk2_3phase_RFdatalog_temp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,21 @@ inline void printForSerialText()
continue;
}

tft.fillScreen(ST77XX_BLACK);

tft.setTextColor(tx_data.temperature_x100[0] > 4500 ? ST77XX_GREEN : ST7735_RED);
tft.setCursor(10, 52);
tft.print(tx_data.temperature_x100[0] * 0.01F, 1);
const auto curr_x = tft.getCursorX();
const auto curr_y = tft.getCursorY();
tft.drawCircle(curr_x + 6, curr_y - 28, 4, ST7735_WHITE);
tft.setTextColor(ST7735_WHITE);
tft.print(F(" C"));
static int16_t temp_previous{ 0 };

if (temp_previous != tx_data.temperature_x100[0])
{
// Skip refresh if the temp didn't change
tft.fillScreen(ST77XX_BLACK);

tft.setTextColor(tx_data.temperature_x100[0] > 5500 ? ST77XX_GREEN : ST7735_RED);
tft.setCursor(10, 52);
tft.print(tx_data.temperature_x100[0] * 0.01F, 1);
tft.drawCircle(tft.getCursorX() + 6, tft.getCursorY() - 28, 4, ST7735_WHITE);
tft.setTextColor(ST7735_WHITE);
tft.print(F(" C"));
temp_previous = tx_data.temperature_x100[0];
}

Serial.print(F(", T"));
Serial.print(idx + 1);
Expand Down

0 comments on commit 9d4fae9

Please sign in to comment.