Add teleperiod data on empty teleperiod command if set to zero

Add teleperiod data on empty teleperiod command if set to zero (#12023)
This commit is contained in:
Theo Arends 2021-05-05 14:59:31 +02:00
parent 572fddef73
commit 94485913e5
2 changed files with 5 additions and 4 deletions

View File

@ -1857,10 +1857,11 @@ void CmndTeleperiod(void)
{ {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 3601)) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 3601)) {
Settings.tele_period = (1 == XdrvMailbox.payload) ? TELE_PERIOD : XdrvMailbox.payload; Settings.tele_period = (1 == XdrvMailbox.payload) ? TELE_PERIOD : XdrvMailbox.payload;
if ((Settings.tele_period > 0) && (Settings.tele_period < 10)) Settings.tele_period = 10; // Do not allow periods < 10 seconds if ((Settings.tele_period > 0) && (Settings.tele_period < 10)) {
// TasmotaGlobal.tele_period = Settings.tele_period; Settings.tele_period = 10; // Do not allow periods < 10 seconds
}
} }
TasmotaGlobal.tele_period = Settings.tele_period; // Show teleperiod data also on empty command TasmotaGlobal.tele_period = (Settings.tele_period) ? Settings.tele_period : 3601; // Show teleperiod data also on empty command
ResponseCmndNumber(Settings.tele_period); ResponseCmndNumber(Settings.tele_period);
} }

View File

@ -929,7 +929,7 @@ void PerformEverySecond(void)
ResetGlobalValues(); ResetGlobalValues();
if (Settings.tele_period) { if (Settings.tele_period || (3601 == TasmotaGlobal.tele_period)) {
if (TasmotaGlobal.tele_period >= 9999) { if (TasmotaGlobal.tele_period >= 9999) {
if (!TasmotaGlobal.global_state.network_down) { if (!TasmotaGlobal.global_state.network_down) {
TasmotaGlobal.tele_period = 0; // Allow teleperiod once wifi is connected TasmotaGlobal.tele_period = 0; // Allow teleperiod once wifi is connected