From 951cc77dfb70449524ff55bbe45283367df60d1d Mon Sep 17 00:00:00 2001 From: Martins Ierags Date: Sat, 12 Jan 2019 12:29:45 +0200 Subject: [PATCH] Fixes regarding @xoseperez comments --- code/espurna/config/general.h | 2 +- code/espurna/system.ino | 6 ++---- code/html/index.html | 19 ++++++++----------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 7b5d23fd..0fd2d7f6 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -181,7 +181,7 @@ #endif #ifndef HEARTBEAT_INTERVAL -#define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms) +#define HEARTBEAT_INTERVAL 300 // Interval between heartbeat messages (in sec) #endif #define UPTIME_OVERFLOW 4294967295 // Uptime overflow value diff --git a/code/espurna/system.ino b/code/espurna/system.ino index 7d015bb8..27b2d4dd 100644 --- a/code/espurna/system.ino +++ b/code/espurna/system.ino @@ -82,8 +82,6 @@ unsigned long systemLoadAverage() { } void _systemSetupHeartbeat() { - if (getSetting("hbMode").length() == 0) setSetting("hbMode", HEARTBEAT_MODE); - if (getSetting("hbInterval").length() == 0) setSetting("hbInterval", HEARTBEAT_INTERVAL); _heartbeat_mode = getSetting("hbMode", HEARTBEAT_MODE).toInt(); _heartbeat_interval = getSetting("hbInterval", HEARTBEAT_INTERVAL).toInt(); } @@ -116,9 +114,9 @@ void systemLoop() { } else if (_heartbeat_mode == HEARTBEAT_REPEAT || _heartbeat_mode == HEARTBEAT_REPEAT_STATUS) { static unsigned long last_hbeat = 0; #if NTP_SUPPORT - if ((_system_send_heartbeat && ntpSynced()) || (millis() - last_hbeat > _heartbeat_interval)) { + if ((_system_send_heartbeat && ntpSynced()) || (millis() - last_hbeat > _heartbeat_interval * 1000)) { #else - if (_system_send_heartbeat || (millis() - last_hbeat > _heartbeat_interval)) { + if (_system_send_heartbeat || (millis() - last_hbeat > _heartbeat_interval * 1000)) { #endif last_hbeat = millis(); heartbeat(); diff --git a/code/html/index.html b/code/html/index.html index 9d8f6ede..349ebfcb 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -621,30 +621,27 @@
- +
- HEARTBEAT_NONE: no heartbeat at all, never.
- HEARTBEAT_ONCE: only on device startup.
- HEARTBEAT_REPEAT: on device startup and after HEARTBEAT_INTERVAL.
- HEARTBEAT_REPEAT_STATUS: on device startup full heartbeat information and after HEARTBEAT_INTERVAL only STATUS report. + Define when heartbeat message will be sent.
- +
- This is the interval in ms how often to send the heartbeat message. + This is the interval in seconds how often to send the heartbeat message.