Embeded IF statement in backlog did not been processed

The backlog_mutex blocked the execution of IF statement during call ExecuteCommand(), because all IF statement need to use backlog to perform commands.
This commit is contained in:
Laurent Dong 2019-12-06 10:12:13 -05:00
parent 00fd7f2f7c
commit ee37c258e6

View File

@ -349,15 +349,18 @@ void BacklogLoop(void)
{ {
if (TimeReached(backlog_delay)) { if (TimeReached(backlog_delay)) {
if (!BACKLOG_EMPTY && !backlog_mutex) { if (!BACKLOG_EMPTY && !backlog_mutex) {
backlog_mutex = true;
#ifdef SUPPORT_IF_STATEMENT #ifdef SUPPORT_IF_STATEMENT
ExecuteCommand((char*)backlog.shift().c_str(), SRC_BACKLOG); backlog_mutex = true;
String cmd = backlog.shift();
backlog_mutex = false;
ExecuteCommand((char*)cmd.c_str(), SRC_BACKLOG);
#else #else
backlog_mutex = true;
ExecuteCommand((char*)backlog[backlog_pointer].c_str(), SRC_BACKLOG); ExecuteCommand((char*)backlog[backlog_pointer].c_str(), SRC_BACKLOG);
backlog_pointer++; backlog_pointer++;
if (backlog_pointer >= MAX_BACKLOG) { backlog_pointer = 0; } if (backlog_pointer >= MAX_BACKLOG) { backlog_pointer = 0; }
#endif
backlog_mutex = false; backlog_mutex = false;
#endif
} }
} }
} }