Add status led
This commit is contained in:
parent
73c25b2351
commit
8689fd728c
2 changed files with 8 additions and 1 deletions
|
@ -110,6 +110,9 @@ void callback(char* topic, byte* message, unsigned int length) {
|
||||||
logPrintlnD("Message: ");
|
logPrintlnD("Message: ");
|
||||||
String messageTemp;
|
String messageTemp;
|
||||||
|
|
||||||
|
//Status LED flash on receive
|
||||||
|
digitalWrite(STATUS_LED, !digitalRead(STATUS_LED));
|
||||||
|
|
||||||
for (byte i = 0; i < length; i++) {
|
for (byte i = 0; i < length; i++) {
|
||||||
char tmp = char(message[i]);
|
char tmp = char(message[i]);
|
||||||
messageTemp += tmp;
|
messageTemp += tmp;
|
||||||
|
@ -271,6 +274,7 @@ void setup() {
|
||||||
Serial.println("Booting...");
|
Serial.println("Booting...");
|
||||||
pinMode(BUTTON_ROTATION, INPUT_PULLUP);
|
pinMode(BUTTON_ROTATION, INPUT_PULLUP);
|
||||||
pinMode(BUTTON_SETUP, INPUT_PULLUP);
|
pinMode(BUTTON_SETUP, INPUT_PULLUP);
|
||||||
|
pinMode(STATUS_LED, OUTPUT);
|
||||||
display_begin();
|
display_begin();
|
||||||
Serial.println("Display init...");
|
Serial.println("Display init...");
|
||||||
display_init(VERSION);
|
display_init(VERSION);
|
||||||
|
@ -485,6 +489,7 @@ void loop() {
|
||||||
//Refresh display values
|
//Refresh display values
|
||||||
if(millis() - lastDispRefreshTime >= DISPLAY_REFRESH_INTERVAL)
|
if(millis() - lastDispRefreshTime >= DISPLAY_REFRESH_INTERVAL)
|
||||||
{
|
{
|
||||||
|
digitalWrite(STATUS_LED, LOW); //Turn Status LED ON again
|
||||||
lastDispRefreshTime += DISPLAY_REFRESH_INTERVAL;
|
lastDispRefreshTime += DISPLAY_REFRESH_INTERVAL;
|
||||||
if (display_screen == 0) {
|
if (display_screen == 0) {
|
||||||
display_screen_0(pv_v, pv_w, batt_v, pv_i, pv_kwh);
|
display_screen_0(pv_v, pv_w, batt_v, pv_i, pv_kwh);
|
||||||
|
|
|
@ -27,5 +27,7 @@
|
||||||
#define LCD_RW_SI 13
|
#define LCD_RW_SI 13
|
||||||
#define LCD_CS 15
|
#define LCD_CS 15
|
||||||
|
|
||||||
|
#define STATUS_LED 2
|
||||||
|
|
||||||
#define BUTTON_ROTATION 3
|
#define BUTTON_ROTATION 3
|
||||||
#define BUTTON_SETUP 4
|
#define BUTTON_SETUP 4
|
Loading…
Reference in a new issue