diff --git a/firmware/controllers/system/event_queue.cpp b/firmware/controllers/system/event_queue.cpp index f3fda84bce..aa25507595 100644 --- a/firmware/controllers/system/event_queue.cpp +++ b/firmware/controllers/system/event_queue.cpp @@ -111,6 +111,7 @@ int EventQueue::executeAll(efitime_t now) { scheduling_s * current, *tmp; scheduling_s * executionList = NULL; + scheduling_s * lastInExecutionList = NULL; int listIterationCounter = 0; int executionCounter = 0; @@ -127,7 +128,13 @@ int EventQueue::executeAll(efitime_t now) { efiAssert(head == current, "removing from head", -1); //LL_DELETE(head, current); head = head->next; - LL_PREPEND(executionList, current); + if (executionList == NULL) { + lastInExecutionList = executionList = current; + } else { + lastInExecutionList->next = current; + lastInExecutionList = current; + } + current->next = NULL; } else { /** * The list is sorted. Once we find one action in the future, all the remaining ones diff --git a/unit_tests/test_signal_executor.cpp b/unit_tests/test_signal_executor.cpp index a18982ac3c..4bac1fbc07 100644 --- a/unit_tests/test_signal_executor.cpp +++ b/unit_tests/test_signal_executor.cpp @@ -85,13 +85,13 @@ static void testSignalExecutor2(void) { } -static int prevValue = 5; +static long prevValue = -1; static void orderCallback(void *a) { - int value = (int)a; + long value = (long)a; printf("value=%d prevValue=%d\r\n", value, prevValue); - assertTrueM("orderCallback", value < prevValue); + assertTrueM("orderCallback", value > prevValue); prevValue = value; }