Skip to content

Commit

Permalink
fix(servo): when acting as king, set own base number
Browse files Browse the repository at this point in the history
Not setting the base number causes the logic when receiving message to
set the node to listen-only mode.
  • Loading branch information
hashemmm96 committed Sep 20, 2023
1 parent a247d84 commit 71b7ee3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/servo/src/freertos-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ void king(void *unused) {
xTimerStart(timer, portMAX_DELAY);
ulTaskNotifyTake(pdTRUE, portMAX_DELAY); // Wait for timer

// Default letter was received. We don't need to act as king.
// There is already traffic on the CAN bus, so don't act as king.
// TODO: how to handle traffic that is not detected due to incorrect bitrate?
if (ck_get_comm_mode() == CK_COMM_MODE_LISTEN_ONLY) {
print("Someone else is king. Suspending king task.\r\n");
vTaskSuspend(king_task);
Expand All @@ -134,6 +135,9 @@ void king(void *unused) {
send_base_number();
vTaskDelay(pdMS_TO_TICKS(50)); // Give cities time to respond

// Set our own base number
ck_set_base_number(ROVER_BASE_NUMBER, false);

assign_envelopes();
start_communication();

Expand Down

0 comments on commit 71b7ee3

Please sign in to comment.