diff --git a/Mk2_3phase_RFdatalog_temp/config.h b/Mk2_3phase_RFdatalog_temp/config.h index c47602e..a248ce6 100644 --- a/Mk2_3phase_RFdatalog_temp/config.h +++ b/Mk2_3phase_RFdatalog_temp/config.h @@ -89,7 +89,7 @@ inline constexpr pairForceLoad rg_ForceLoad[NO_OF_DUMPLOADS]{ { -3, 2 } }; /**< inline constexpr int16_t iTemperatureThreshold{ 100 }; /**< the temperature threshold to stop overriding in °C */ inline constexpr TemperatureSensing temperatureSensing{ 12, - { { 0x28, 0xBE, 0x41, 0x6B, 0x09, 0x00, 0x00, 0xA4 } } }; /**< list of temperature sensor Addresses */ + { { 0x28, 0xAA, 0x16, 0xA7, 0x16, 0x13, 0x02, 0xDC } } }; /**< list of temperature sensor Addresses */ inline constexpr uint32_t ROTATION_AFTER_CYCLES{ 8UL * 3600UL * SUPPLY_FREQUENCY }; /**< rotates load priorities after this period of inactivity */ diff --git a/Mk2_3phase_RFdatalog_temp/main.cpp b/Mk2_3phase_RFdatalog_temp/main.cpp index ba3bdfb..8390a4a 100644 --- a/Mk2_3phase_RFdatalog_temp/main.cpp +++ b/Mk2_3phase_RFdatalog_temp/main.cpp @@ -339,6 +339,10 @@ void setup() temperatureSensing.initTemperatureSensors(); } + tft.initR(INITR_MINI160x80_PLUGIN); // Init ST7735S mini display + tft.fillScreen(ST77XX_BLACK); + tft.setRotation(3); + DBUG(F(">>free RAM = ")); DBUGLN(freeRam()); // a useful value to keep an eye on DBUGLN(F("----")); diff --git a/Mk2_3phase_RFdatalog_temp/utils.h b/Mk2_3phase_RFdatalog_temp/utils.h index f168e97..5d5c29b 100644 --- a/Mk2_3phase_RFdatalog_temp/utils.h +++ b/Mk2_3phase_RFdatalog_temp/utils.h @@ -20,6 +20,17 @@ #include "utils_rf.h" #include "utils_temp.h" +#include // Core graphics library +#include // Hardware-specific library for ST7735 +#include // Hardware-specific library for ST7789 +#include + +#define TFT_CS 10 +#define TFT_RST 8 +#define TFT_DC 9 + +inline Adafruit_ST7735 tft{ TFT_CS, TFT_DC, TFT_RST }; + /** * @brief Print the configuration during start * @@ -250,12 +261,26 @@ inline void printForSerialJson() Serial.println(F(")")); } +void testdrawtext(char *text, uint16_t color) +{ + tft.setCursor(0, 0); + tft.setTextColor(color); + tft.setTextWrap(true); + tft.print(text); +} + /** * @brief Prints data logs to the Serial output in text format * */ inline void printForSerialText() { + tft.fillScreen(ST77XX_BLACK); + tft.setCursor(0, 0); + tft.setTextSize(3); + tft.print(tx_data.Vrms_L_x100[0] * 0.01F); + //testdrawtext("35\xF8\x43", ST77XX_WHITE); + uint8_t phase{ 0 }; Serial.print(copyOf_energyInBucket_main * invSUPPLY_FREQUENCY); @@ -356,7 +381,7 @@ inline void logLoadPriorities() #ifdef ENABLE_DEBUG DBUGLN(F("Load Priorities: ")); - for (const auto& loadPrioAndState : loadPrioritiesAndState) + for (const auto &loadPrioAndState : loadPrioritiesAndState) { DBUG(F("\tload ")); DBUGLN(loadPrioAndState);