diff --git a/include/display.h b/include/display.h index b70ab70..2b8876c 100644 --- a/include/display.h +++ b/include/display.h @@ -5,7 +5,8 @@ #include "ntp_time.h" #define DISPLAY_ADDRESS 0x70 -#define BRIGHTNESS 1 +#define BRIGHTNESS 0 +#define BRIGHTNESS_STEP 1 namespace Display { @@ -36,7 +37,7 @@ namespace Display { } void changeBrightness(bool increase) { - increase ? brightness = (brightness + 2) % 15 : brightness = (brightness - 2) % 15; + increase ? brightness = (brightness + BRIGHTNESS_STEP) % 15 : brightness = (brightness - BRIGHTNESS_STEP) % 15; clockDisplay.setBrightness(brightness); } @@ -44,7 +45,7 @@ namespace Display { if (currentHour > 8 && currentHour < 17) { brightness = 11; } else { - brightness = 1; + brightness = BRIGHTNESS; } clockDisplay.setBrightness(brightness); } @@ -72,6 +73,7 @@ namespace Display { void displayValue(int value) { clockDisplay.print(value, HEX); + clockDisplay.writeDisplay(); } void setup() { diff --git a/include/ir.h b/include/ir.h index d1938bb..f81317c 100644 --- a/include/ir.h +++ b/include/ir.h @@ -21,7 +21,7 @@ namespace Ir { bool readCommand() { bool newCommand = false; if (irrecv.decode(&results)) { - if (results.decode_type == NEC) { + if (results.decode_type == NEC && results.command != 0) { Serial.print(F(" C=0x")); Serial.print(results.command, HEX); Serial.println(); @@ -40,7 +40,6 @@ namespace Ir { void loop() { if (readCommand()) { - Display::displayValue(lastCommand); switch (lastCommand) { case 0x9F: diff --git a/include/mqtt.h b/include/mqtt.h index f219753..d806042 100644 --- a/include/mqtt.h +++ b/include/mqtt.h @@ -44,9 +44,11 @@ namespace Mqtt { void setup() { client.onConnect([](bool sessionPresent) { tPublish.enableDelayed(); + Serial.println("Connected to MQTT"); }); client.onDisconnect([](AsyncMqttClientDisconnectReason reason) { tPublish.disable(); + Serial.println("Disconnected from MQTT"); }); client.setServer(MQTT_HOST, MQTT_PORT); Serial.println("Connecting to MQTT..."); diff --git a/platformio.ini b/platformio.ini index b8e069d..22936ca 100644 --- a/platformio.ini +++ b/platformio.ini @@ -26,9 +26,9 @@ lib_deps = build_flags = -D IR=1 [env:laptop_home] -build_flags = -D IR=0 +build_flags = -D IR=1 [env:ota_home] -build_flags = -D IR=0 +build_flags = -D IR=1 upload_port = 192.168.5.191 upload_protocol = espota