Add command ``Delay -1``

Add command ``Delay -1`` to wait until next second (#18984)
This commit is contained in:
Theo Arends 2023-06-28 11:53:23 +02:00
parent a542122eb1
commit 504b51a9b4
3 changed files with 11 additions and 3 deletions

View File

@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## [13.0.0.1]
### Added
- Command ``Delay -1`` to wait until next second (#18984)
### Breaking Changed
- Berry `bool( [] )` and `bool( {} )` now evaluate as `false` (#18986)

View File

@ -112,6 +112,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
## Changelog v13.0.0.1
### Added
- Command ``Delay -1`` to wait until next second [#18984](https://github.com/arendst/Tasmota/issues/18984)
### Breaking Changed
- Berry `bool( [] )` and `bool( {} )` now evaluate as `false` [#18986](https://github.com/arendst/Tasmota/issues/18986)

View File

@ -651,9 +651,15 @@ void CmndJson(void) {
}
}
void CmndDelay(void)
{
if ((XdrvMailbox.payload >= (MIN_BACKLOG_DELAY / 100)) && (XdrvMailbox.payload <= 3600)) {
void CmndDelay(void) {
// Delay -1 - Wait until next second
// Delay 1 - Wait default time (200ms)
// Delay 2 - Wait 2 x 100ms
// Delay 10 - Wait 10 x 100ms
if (XdrvMailbox.payload == -1) {
TasmotaGlobal.backlog_timer = millis() + (1000 - RtcMillis()); // Next second (#18984)
}
else if ((XdrvMailbox.payload >= (MIN_BACKLOG_DELAY / 100)) && (XdrvMailbox.payload <= 3600)) {
TasmotaGlobal.backlog_timer = millis() + (100 * XdrvMailbox.payload);
}
uint32_t bl_delay = 0;