mirror of
https://github.com/lucysrausch/hoverboard-firmware-hack.git
synced 2025-07-30 07:37:16 +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);
|
cmd1 = CLAMP((int16_t)command.steer, -1000, 1000);
|
||||||
cmd2 = CLAMP((int16_t)command.speed, -1000, 1000);
|
cmd2 = CLAMP((int16_t)command.speed, -1000, 1000);
|
||||||
} else { // restart DMA to hopefully get back in sync
|
} else { // restart DMA to hopefully get back in sync
|
||||||
HAL_UART_DMAStop(&huart2);
|
// Try a periodic reset
|
||||||
HAL_UART_Receive_DMA(&huart2, (uint8_t *)&command, sizeof(command));
|
if (main_loop_counter % 25 == 0) {
|
||||||
|
HAL_UART_DMAStop(&huart2);
|
||||||
|
HAL_UART_Receive_DMA(&huart2, (uint8_t *)&command, sizeof(command));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user