Skip to content

Commit

Permalink
Font
Browse files Browse the repository at this point in the history
  • Loading branch information
FredM67 committed May 31, 2024
1 parent 2a7e8fc commit 539b708
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 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 @@ -88,7 +88,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,
inline constexpr TemperatureSensing temperatureSensing{ 4,
{ { 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
3 changes: 3 additions & 0 deletions Mk2_3phase_RFdatalog_temp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ void setup()
tft.initR(INITR_MINI160x80_PLUGIN); // Init ST7735S mini display
tft.fillScreen(ST77XX_BLACK);
tft.setRotation(3);
tft.setTextWrap(false);
tft.setFont(&FreeSansBold24pt7b);
tft.setTextSize(1);

DBUG(F(">>free RAM = "));
DBUGLN(freeRam()); // a useful value to keep an eye on
Expand Down
26 changes: 12 additions & 14 deletions Mk2_3phase_RFdatalog_temp/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#include <Fonts/FreeSansBold24pt7b.h>

#define TFT_CS 10
#define TFT_RST 8
Expand Down Expand Up @@ -261,26 +262,12 @@ 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 @@ -318,6 +305,17 @@ 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"));

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

0 comments on commit 539b708

Please sign in to comment.