mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-02 15:37:42 +00:00
process Backlog commands without minimum delay
This commit is contained in:
parent
22dbe597a2
commit
5d60a43939
@ -124,7 +124,7 @@ const uint16_t MIN_MESSZ = 893; // Min number of characters in MQTT
|
|||||||
const uint8_t SENSOR_MAX_MISS = 5; // Max number of missed sensor reads before deciding it's offline
|
const uint8_t SENSOR_MAX_MISS = 5; // Max number of missed sensor reads before deciding it's offline
|
||||||
|
|
||||||
const uint8_t MAX_BACKLOG = 30; // Max number of commands in backlog
|
const uint8_t MAX_BACKLOG = 30; // Max number of commands in backlog
|
||||||
const uint32_t MIN_BACKLOG_DELAY = 2; // Minimal backlog delay in 0.1 seconds
|
const uint32_t MIN_BACKLOG_DELAY = 0; // Minimal backlog delay in 0.1 seconds
|
||||||
|
|
||||||
const uint32_t SOFT_BAUDRATE = 9600; // Default software serial baudrate
|
const uint32_t SOFT_BAUDRATE = 9600; // Default software serial baudrate
|
||||||
const uint32_t APP_BAUDRATE = 115200; // Default serial baudrate
|
const uint32_t APP_BAUDRATE = 115200; // Default serial baudrate
|
||||||
|
@ -869,21 +869,6 @@ void Every100mSeconds(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backlog
|
|
||||||
if (TimeReached(backlog_delay)) {
|
|
||||||
if (!BACKLOG_EMPTY && !backlog_mutex) {
|
|
||||||
backlog_mutex = true;
|
|
||||||
#ifdef SUPPORT_IF_STATEMENT
|
|
||||||
ExecuteCommand((char*)backlog.shift().c_str(), SRC_BACKLOG);
|
|
||||||
#else
|
|
||||||
ExecuteCommand((char*)backlog[backlog_pointer].c_str(), SRC_BACKLOG);
|
|
||||||
backlog_pointer++;
|
|
||||||
if (backlog_pointer >= MAX_BACKLOG) { backlog_pointer = 0; }
|
|
||||||
#endif
|
|
||||||
backlog_mutex = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------------------------------*\
|
||||||
@ -1674,6 +1659,23 @@ void setup(void)
|
|||||||
XsnsCall(FUNC_INIT);
|
XsnsCall(FUNC_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void BacklogLoop()
|
||||||
|
{
|
||||||
|
if (TimeReached(backlog_delay)) {
|
||||||
|
if (!BACKLOG_EMPTY && !backlog_mutex) {
|
||||||
|
backlog_mutex = true;
|
||||||
|
#ifdef SUPPORT_IF_STATEMENT
|
||||||
|
ExecuteCommand((char*)backlog.shift().c_str(), SRC_BACKLOG);
|
||||||
|
#else
|
||||||
|
ExecuteCommand((char*)backlog[backlog_pointer].c_str(), SRC_BACKLOG);
|
||||||
|
backlog_pointer++;
|
||||||
|
if (backlog_pointer >= MAX_BACKLOG) { backlog_pointer = 0; }
|
||||||
|
#endif
|
||||||
|
backlog_mutex = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void loop(void)
|
void loop(void)
|
||||||
{
|
{
|
||||||
uint32_t my_sleep = millis();
|
uint32_t my_sleep = millis();
|
||||||
@ -1685,6 +1687,7 @@ void loop(void)
|
|||||||
|
|
||||||
ButtonLoop();
|
ButtonLoop();
|
||||||
SwitchLoop();
|
SwitchLoop();
|
||||||
|
BacklogLoop();
|
||||||
#ifdef ROTARY_V1
|
#ifdef ROTARY_V1
|
||||||
RotaryLoop();
|
RotaryLoop();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user