Skip to content

Commit

Permalink
Test display
Browse files Browse the repository at this point in the history
  • Loading branch information
FredM67 committed May 30, 2024
1 parent e7c7f51 commit 2a7e8fc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Mk2_3phase_RFdatalog_temp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
4 changes: 4 additions & 0 deletions Mk2_3phase_RFdatalog_temp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("----"));
Expand Down
27 changes: 26 additions & 1 deletion Mk2_3phase_RFdatalog_temp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
#include "utils_rf.h"
#include "utils_temp.h"

#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>

#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
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2a7e8fc

Please sign in to comment.