diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-01-01 18:47:10 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-01-01 18:47:10 +0300 |
commit | 5e39b5c7c0bbff7317576e72b591754192f98e23 (patch) | |
tree | 65119baa51b2f6916aed7a4da4ea32b19294e070 /platformio | |
parent | d2a5d8c6c2a2ae27e650ec26183e7b9881b939c7 (diff) |
relayctl: make blinking optional, set default fw version to 7
Diffstat (limited to 'platformio')
-rw-r--r-- | platformio/relayctl/src/config.def.h.example | 3 | ||||
-rw-r--r-- | platformio/relayctl/src/main.cpp | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/platformio/relayctl/src/config.def.h.example b/platformio/relayctl/src/config.def.h.example index dd3d89b..52de4f7 100644 --- a/platformio/relayctl/src/config.def.h.example +++ b/platformio/relayctl/src/config.def.h.example @@ -1,6 +1,6 @@ #pragma once -#define FW_VERSION 3 +#define FW_VERSION 7 #define DEFAULT_WIFI_AP_SSID "" #define DEFAULT_WIFI_STA_SSID "" @@ -28,5 +28,6 @@ // 12 bytes string #define HOME_SECRET_SIZE 12 #define HOME_SECRET "" +#define MQTT_BLINK 1 #define ARRAY_SIZE(X) sizeof((X))/sizeof((X)[0])
\ No newline at end of file diff --git a/platformio/relayctl/src/main.cpp b/platformio/relayctl/src/main.cpp index 0c4d469..8c3a0cb 100644 --- a/platformio/relayctl/src/main.cpp +++ b/platformio/relayctl/src/main.cpp @@ -34,7 +34,9 @@ static volatile enum WiFiConnectionState wifi_state = WiFiConnectionState::WAITI static void* service = nullptr; static WiFiEventHandler wifiConnectHandler, wifiDisconnectHandler; static Ticker wifiTimer; +#if MQTT_BLINK static StopWatch blinkStopWatch; +#endif static DNSServer* dnsServer = nullptr; @@ -127,7 +129,9 @@ void loop() { service = new mqtt::MQTT(); ((mqtt::MQTT*)service)->connect(); +#if MQTT_BLINK blinkStopWatch.save(); +#endif } auto mqtt = (mqtt::MQTT*)service; @@ -140,12 +144,13 @@ void loop() { mqtt->sendStat(); } +#if MQTT_BLINK // periodically blink board led if (blinkStopWatch.elapsed(5000)) { - // PRINTF("free heap: %d\n", ESP.getFreeHeap()); board_led.blink(1, 10); blinkStopWatch.save(); } +#endif } } else { if (dnsServer != nullptr) |