From 9276bb310f3ac65423c6f753b5af691da6f0731d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Mon, 26 Apr 2021 18:08:01 +0100 Subject: [PATCH] Revert "Rework of WireProtocol (#1884)" (#1897) --- targets/ChibiOS/_common/WireProtocol_ReceiverThread.c | 9 ++++++--- targets/FreeRTOS/_common/WireProtocol_ReceiverThread.c | 2 -- .../ESP32_WROOM_32/common/WireProtocol_ReceiverThread.c | 2 -- .../TI-SimpleLink/_common/WireProtocol_ReceiverThread.c | 7 ++++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/targets/ChibiOS/_common/WireProtocol_ReceiverThread.c b/targets/ChibiOS/_common/WireProtocol_ReceiverThread.c index e9a139b652..900830f08f 100644 --- a/targets/ChibiOS/_common/WireProtocol_ReceiverThread.c +++ b/targets/ChibiOS/_common/WireProtocol_ReceiverThread.c @@ -8,6 +8,8 @@ #include #include +extern WP_Message inboundMessage; + #if (HAL_USE_SERIAL_USB == TRUE) extern SerialUSBDriver SDU1; #endif @@ -21,8 +23,6 @@ __attribute__((noreturn)) void ReceiverThread(void const *argument) osDelay(500); - WP_Message_PrepareReception(); - // loop until thread receives a request to terminate while (1) { @@ -33,7 +33,10 @@ __attribute__((noreturn)) void ReceiverThread(void const *argument) { #endif - WP_Message_Process(); + WP_Message_Initialize(&inboundMessage); + WP_Message_PrepareReception(&inboundMessage); + + WP_Message_Process(&inboundMessage); #if (HAL_USE_SERIAL_USB == TRUE) // pass control to the OS diff --git a/targets/FreeRTOS/_common/WireProtocol_ReceiverThread.c b/targets/FreeRTOS/_common/WireProtocol_ReceiverThread.c index 02082be613..3522fc5997 100644 --- a/targets/FreeRTOS/_common/WireProtocol_ReceiverThread.c +++ b/targets/FreeRTOS/_common/WireProtocol_ReceiverThread.c @@ -14,8 +14,6 @@ void ReceiverThread(void *argument) { (void)argument; - WP_Message_PrepareReception(); - // loop forever while (1) { diff --git a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/common/WireProtocol_ReceiverThread.c b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/common/WireProtocol_ReceiverThread.c index b5d8cf1082..7e4e714c1a 100644 --- a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/common/WireProtocol_ReceiverThread.c +++ b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/common/WireProtocol_ReceiverThread.c @@ -13,8 +13,6 @@ void ReceiverThread(void const *argument) { (void)argument; - WP_Message_PrepareReception(); - // loop forever while (1) { diff --git a/targets/TI-SimpleLink/_common/WireProtocol_ReceiverThread.c b/targets/TI-SimpleLink/_common/WireProtocol_ReceiverThread.c index 1d809a634e..74bf724364 100644 --- a/targets/TI-SimpleLink/_common/WireProtocol_ReceiverThread.c +++ b/targets/TI-SimpleLink/_common/WireProtocol_ReceiverThread.c @@ -15,12 +15,13 @@ void ReceiverThread(UArg arg0, UArg arg1) (void)arg0; (void)arg1; - WP_Message_PrepareReception(); - // loop forever while (1) { - WP_Message_Process(); + WP_Message_Initialize(&inboundMessage); + WP_Message_PrepareReception(&inboundMessage); + + WP_Message_Process(&inboundMessage); // Allow other tasks a chance to run Task_yield();