From 5e39b5c7c0bbff7317576e72b591754192f98e23 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 1 Jan 2023 18:47:10 +0300 Subject: relayctl: make blinking optional, set default fw version to 7 --- platformio/relayctl/src/config.def.h.example | 3 ++- platformio/relayctl/src/main.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'platformio') 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) -- cgit v1.2.3