simulator: fix off by one error in USB ack calculations

The sim's printout of the number of expected USB acks was off by one.
Since the sim queue is not registered for broadcasts, it will not
receive an ack message and does not need to account for itself when
determining the number of acks to expect, unlike the USB code.

Change-Id: I6715039c05c1ea95099716c5251d401e37f5b085
This commit is contained in:
Aidan MacDonald 2022-05-22 14:45:17 +01:00
parent 5ee9a45126
commit 85232fadbb

View file

@ -92,7 +92,9 @@ void sim_thread(void)
last_broadcast_tick = current_tick; last_broadcast_tick = current_tick;
} }
num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0) - 1; /* NOTE: Unlike the USB code, we do not subtract one here
* because the sim_queue is not registered for broadcasts! */
num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0);
DEBUGF("USB inserted. Waiting for %d acks...\n", DEBUGF("USB inserted. Waiting for %d acks...\n",
num_acks_to_expect); num_acks_to_expect);
break; break;