mirror of https://github.com/arendst/Tasmota.git
Fix possible teleperiod misses
This commit is contained in:
parent
4bc52c5bfa
commit
76d17bd198
|
@ -116,8 +116,6 @@ const uint16_t SYSLOG_TIMER = 600; // Seconds to restore syslog_level
|
|||
const uint16_t SERIALLOG_TIMER = 600; // Seconds to disable SerialLog
|
||||
const uint8_t OTA_ATTEMPTS = 5; // Number of times to try fetching the new firmware
|
||||
|
||||
const uint16_t TELE_PERIOD_START = 10000; // Initial tele_period until wifi connected
|
||||
|
||||
const uint16_t INPUT_BUFFER_SIZE = 520; // Max number of characters in (serial and http) command buffer
|
||||
const uint16_t FLOATSZ = 16; // Max number of characters in float result from dtostrfd (max 32)
|
||||
const uint16_t CMDSZ = 24; // Max number of characters in command
|
||||
|
|
|
@ -113,7 +113,7 @@ float global_temperature = 9999; // Provide a global temperature to b
|
|||
float global_humidity = 0; // Provide a global humidity to be used by some sensors
|
||||
float global_pressure = 0; // Provide a global pressure to be used by some sensors
|
||||
char *ota_url; // OTA url string pointer
|
||||
uint16_t tele_period = TELE_PERIOD_START; // Tele period timer
|
||||
uint16_t tele_period = 9999; // Tele period timer
|
||||
uint16_t mqtt_cmnd_publish = 0; // ignore flag for publish command
|
||||
uint16_t blink_counter = 0; // Number of blink cycles
|
||||
uint16_t seriallog_timer = 0; // Timer to disable Seriallog
|
||||
|
@ -846,13 +846,13 @@ void PerformEverySecond(void)
|
|||
ResetGlobalValues();
|
||||
|
||||
if (Settings.tele_period) {
|
||||
if (tele_period >= TELE_PERIOD_START) {
|
||||
if (tele_period >= 9999) {
|
||||
if (!global_state.wifi_down) {
|
||||
tele_period = 0; // Allow teleperiod once wifi is connected
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tele_period++;
|
||||
if (tele_period == Settings.tele_period) {
|
||||
if (tele_period >= Settings.tele_period) {
|
||||
tele_period = 0;
|
||||
|
||||
MqttPublishTeleState();
|
||||
|
@ -869,6 +869,7 @@ void PerformEverySecond(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* State loops
|
||||
|
|
|
@ -169,6 +169,11 @@ void CmndDeepsleepTime(void)
|
|||
Settings.deepsleep = XdrvMailbox.payload;
|
||||
RtcSettings.nextwakeup = 0;
|
||||
deepsleep_flag = (0 == XdrvMailbox.payload) ? 0 : 4;
|
||||
if (deepsleep_flag) {
|
||||
if (!Settings.tele_period) {
|
||||
Settings.tele_period = TELE_PERIOD; // Need teleperiod to go back to sleep
|
||||
}
|
||||
}
|
||||
}
|
||||
Response_P(S_JSON_COMMAND_NVALUE, XdrvMailbox.command, Settings.deepsleep);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue