mirror of
https://github.com/lucysrausch/hoverboard-firmware-hack.git
synced 2025-06-24 22:41:32 +02:00
a periodic usart reset works much better
tying the usart buffer clear to the 25*5 ms system tick makes sense
This commit is contained in:
@ -225,8 +225,11 @@ int main(void) {
|
||||
cmd1 = CLAMP((int16_t)command.steer, -1000, 1000);
|
||||
cmd2 = CLAMP((int16_t)command.speed, -1000, 1000);
|
||||
} else { // restart DMA to hopefully get back in sync
|
||||
HAL_UART_DMAStop(&huart2);
|
||||
HAL_UART_Receive_DMA(&huart2, (uint8_t *)&command, sizeof(command));
|
||||
// Try a periodic reset
|
||||
if (main_loop_counter % 25 == 0) {
|
||||
HAL_UART_DMAStop(&huart2);
|
||||
HAL_UART_Receive_DMA(&huart2, (uint8_t *)&command, sizeof(command));
|
||||
}
|
||||
}
|
||||
timeout = 0;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user