Skip to content

Commit

Permalink
Exit MULTI_MODE_DRIVE if inputs are not calibrated
Browse files Browse the repository at this point in the history
- Timeout: 3 seconds
  • Loading branch information
EFeru committed Jan 8, 2023
1 parent e5f7e94 commit efb438b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,11 @@ int main(void) {
while(HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) { HAL_Delay(10); }

#ifdef MULTI_MODE_DRIVE
// Wait until triggers are released
while((adc_buffer.l_rx2 + adc_buffer.l_tx2) >= (input1[0].min + input2[0].min)) { HAL_Delay(10); }
// Wait until triggers are released. Exit if timeout elapses (to unblock if the inputs are not calibrated)
int iTimeout = 0;
while((adc_buffer.l_rx2 + adc_buffer.l_tx2) >= (input1[0].min + input2[0].min) && iTimeout++ < 300) {
HAL_Delay(10);
}
#endif

while(1) {
Expand Down

0 comments on commit efb438b

Please sign in to comment.