Improved Serial Timeout

- added condition to avoid restarting DMA repeatedly if no data is received
- enabled DEBUG_SERIAL_ASCII for all Variants except VARIANT_TRANSPOTTER
This commit is contained in:
EmanuelFeru 2020-02-06 21:53:38 +01:00
parent 3329281bd2
commit 2d178a399c
2 changed files with 3 additions and 1 deletions

View File

@ -176,7 +176,7 @@
#ifndef VARIANT_TRANSPOTTER
//#define DEBUG_SERIAL_SERVOTERM
//#define DEBUG_SERIAL_ASCII
#define DEBUG_SERIAL_ASCII
#endif
// ########################### END OF DEBUG SERIAL ############################

View File

@ -550,6 +550,7 @@ int main(void) {
if (main_loop_counter % 25 == 0 && command.start != IBUS_LENGTH && command.start != 0xFF) {
HAL_UART_DMAStop(&huart);
HAL_UART_Receive_DMA(&huart, (uint8_t *)&command, sizeof(command));
command.start = 0xFF; // Change the Start Frame to avoid entering again here if no data is received
}
}
#else
@ -572,6 +573,7 @@ int main(void) {
if (main_loop_counter % 25 == 0 && command.start != START_FRAME && command.start != 0xFFFF) {
HAL_UART_DMAStop(&huart);
HAL_UART_Receive_DMA(&huart, (uint8_t *)&command, sizeof(command));
command.start = 0xFFFF; // Change the Start Frame to avoid entering again here if no data is received
}
}
#endif