Add status led

This commit is contained in:
Carsten Schmiemann 2022-11-09 02:34:27 +01:00
parent 73c25b2351
commit 8689fd728c
2 changed files with 8 additions and 1 deletions

View file

@ -110,6 +110,9 @@ void callback(char* topic, byte* message, unsigned int length) {
logPrintlnD("Message: ");
String messageTemp;
//Status LED flash on receive
digitalWrite(STATUS_LED, !digitalRead(STATUS_LED));
for (byte i = 0; i < length; i++) {
char tmp = char(message[i]);
messageTemp += tmp;
@ -271,6 +274,7 @@ void setup() {
Serial.println("Booting...");
pinMode(BUTTON_ROTATION, INPUT_PULLUP);
pinMode(BUTTON_SETUP, INPUT_PULLUP);
pinMode(STATUS_LED, OUTPUT);
display_begin();
Serial.println("Display init...");
display_init(VERSION);
@ -485,6 +489,7 @@ void loop() {
//Refresh display values
if(millis() - lastDispRefreshTime >= DISPLAY_REFRESH_INTERVAL)
{
digitalWrite(STATUS_LED, LOW); //Turn Status LED ON again
lastDispRefreshTime += DISPLAY_REFRESH_INTERVAL;
if (display_screen == 0) {
display_screen_0(pv_v, pv_w, batt_v, pv_i, pv_kwh);

View file

@ -27,5 +27,7 @@
#define LCD_RW_SI 13
#define LCD_CS 15
#define STATUS_LED 2
#define BUTTON_ROTATION 3
#define BUTTON_SETUP 4