From 9050203960c7348aad85b3aa7238290490ffd34e Mon Sep 17 00:00:00 2001 From: mycprotein <51121231+mycprotein@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:21:19 +0800 Subject: [PATCH 1/3] Update ZgatewaySERIAL.ino Fix tx issues The serial gateway can only receive serial data and publish via mqtt, but can not convert mqtt into serial data. It is because the receiverReady is not handled correctly for the tx part. A quick work around is to set receiverReady to true. (it seems not used) --- main/ZgatewaySERIAL.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/ZgatewaySERIAL.ino b/main/ZgatewaySERIAL.ino index 422e21dfd0..fec15511eb 100644 --- a/main/ZgatewaySERIAL.ino +++ b/main/ZgatewaySERIAL.ino @@ -53,7 +53,7 @@ const TickType_t semaphoreTimeout = pdMS_TO_TICKS(1000); // 1 second timeout Stream* SERIALStream = NULL; //unsigned long msgCount = 0; -bool receiverReady = false; +bool receiverReady = true; unsigned long lastHeartbeatReceived = 0; unsigned long lastHeartbeatAckReceived = 0; unsigned long lastHeartbeatSent = 0; @@ -372,4 +372,4 @@ void handleHeartbeat() { sendHeartbeatAck(); } } -#endif \ No newline at end of file +#endif From 135b06e574c5eb4d86584df735621a33e21deb3b Mon Sep 17 00:00:00 2001 From: mycprotein Date: Tue, 7 Jan 2025 20:40:20 +0800 Subject: [PATCH 2/3] Update ZgatewaySERIAL.ino to conditionally set receiverReady based on heartbeat configuration --- main/ZgatewaySERIAL.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/ZgatewaySERIAL.ino b/main/ZgatewaySERIAL.ino index fec15511eb..46407c6856 100644 --- a/main/ZgatewaySERIAL.ino +++ b/main/ZgatewaySERIAL.ino @@ -48,12 +48,17 @@ const TickType_t semaphoreTimeout = pdMS_TO_TICKS(1000); // 1 second timeout # define SEMAPHORE_SERIAL_GIVE # endif +# ifdef SENDER_SERIAL_HEARTBEAT + bool receiverReady = false; +# else + bool receiverReady = true; +# endif + // use pointer to stream class for serial communication to make code // compatible with both softwareSerial as hardwareSerial. Stream* SERIALStream = NULL; //unsigned long msgCount = 0; -bool receiverReady = true; unsigned long lastHeartbeatReceived = 0; unsigned long lastHeartbeatAckReceived = 0; unsigned long lastHeartbeatSent = 0; From dd9f2ee8fe434acecd05642115e7ca1006c9c831 Mon Sep 17 00:00:00 2001 From: mycprotein Date: Tue, 7 Jan 2025 20:48:00 +0800 Subject: [PATCH 3/3] update format --- main/ZgatewaySERIAL.ino | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main/ZgatewaySERIAL.ino b/main/ZgatewaySERIAL.ino index 46407c6856..b3cd156787 100644 --- a/main/ZgatewaySERIAL.ino +++ b/main/ZgatewaySERIAL.ino @@ -48,11 +48,11 @@ const TickType_t semaphoreTimeout = pdMS_TO_TICKS(1000); // 1 second timeout # define SEMAPHORE_SERIAL_GIVE # endif -# ifdef SENDER_SERIAL_HEARTBEAT - bool receiverReady = false; -# else - bool receiverReady = true; -# endif +# ifdef SENDER_SERIAL_HEARTBEAT +bool receiverReady = false; +# else +bool receiverReady = true; +# endif // use pointer to stream class for serial communication to make code // compatible with both softwareSerial as hardwareSerial.