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:
parent
3329281bd2
commit
2d178a399c
|
@ -176,7 +176,7 @@
|
||||||
|
|
||||||
#ifndef VARIANT_TRANSPOTTER
|
#ifndef VARIANT_TRANSPOTTER
|
||||||
//#define DEBUG_SERIAL_SERVOTERM
|
//#define DEBUG_SERIAL_SERVOTERM
|
||||||
//#define DEBUG_SERIAL_ASCII
|
#define DEBUG_SERIAL_ASCII
|
||||||
#endif
|
#endif
|
||||||
// ########################### END OF DEBUG SERIAL ############################
|
// ########################### END OF DEBUG SERIAL ############################
|
||||||
|
|
||||||
|
|
|
@ -550,6 +550,7 @@ int main(void) {
|
||||||
if (main_loop_counter % 25 == 0 && command.start != IBUS_LENGTH && command.start != 0xFF) {
|
if (main_loop_counter % 25 == 0 && command.start != IBUS_LENGTH && command.start != 0xFF) {
|
||||||
HAL_UART_DMAStop(&huart);
|
HAL_UART_DMAStop(&huart);
|
||||||
HAL_UART_Receive_DMA(&huart, (uint8_t *)&command, sizeof(command));
|
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
|
#else
|
||||||
|
@ -572,6 +573,7 @@ int main(void) {
|
||||||
if (main_loop_counter % 25 == 0 && command.start != START_FRAME && command.start != 0xFFFF) {
|
if (main_loop_counter % 25 == 0 && command.start != START_FRAME && command.start != 0xFFFF) {
|
||||||
HAL_UART_DMAStop(&huart);
|
HAL_UART_DMAStop(&huart);
|
||||||
HAL_UART_Receive_DMA(&huart, (uint8_t *)&command, sizeof(command));
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue