Skip to content

Commit

Permalink
Fix wrong callback being executed when an error was received
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyrkan committed Apr 16, 2024
1 parent 8e10266 commit adcffb1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Grbl/grbl_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ static void grbl_process_ack() {

// Notify the TX task that its previous message has been acknowledged
if (grbl_tx_task_handle != NULL) {
xTaskNotifyIndexed(grbl_tx_task_handle, GRBL_TASK_NOTIFY_ACK_INDEX, GRBL_TASK_NOTIFY_ACK_SUCCESS, eNoAction);
xTaskNotifyIndexed(
grbl_tx_task_handle,
GRBL_TASK_NOTIFY_ACK_INDEX,
GRBL_TASK_NOTIFY_ACK_SUCCESS,
eSetValueWithOverwrite);
}
}

Expand All @@ -55,9 +59,12 @@ static void grbl_process_error(const char *error_code) {
ui_overlay_add_flash_message(FLASH_LEVEL_DANGER, error_description);

// Notify the TX task that its previous message has been acknowledged
// TODO Differenciate acks from errors in the TX task
if (grbl_tx_task_handle != NULL) {
xTaskNotifyIndexed(grbl_tx_task_handle, GRBL_TASK_NOTIFY_ACK_INDEX, GRBL_TASK_NOTIFY_ACK_ERROR, eNoAction);
xTaskNotifyIndexed(
grbl_tx_task_handle,
GRBL_TASK_NOTIFY_ACK_INDEX,
GRBL_TASK_NOTIFY_ACK_ERROR,
eSetValueWithOverwrite);
}
}

Expand Down

0 comments on commit adcffb1

Please sign in to comment.