From 8c9144f78592145451d12f1c0284dd1d2779663d Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Tue, 4 Feb 2025 22:09:46 +1100 Subject: [PATCH 1/3] * added companion radio targets for T3S3 board --- examples/companion_radio/main.cpp | 2 +- platformio.ini | 29 ++++++++++++++++++++++++++++ src/helpers/ArduinoSerialInterface.h | 8 ++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index d2ce72ff..4f6c0ddc 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -64,7 +64,7 @@ #include #include static XiaoC3Board board; -#elif defined(SEEED_XIAO_S3) +#elif defined(SEEED_XIAO_S3) || defined(LILYGO_T3S3) #include #include static ESP32Board board; diff --git a/platformio.ini b/platformio.ini index 83f56fa5..68b8ebd8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -297,6 +297,35 @@ lib_deps = adafruit/RTClib @ ^2.1.3 densaugeo/base64 @ ~1.4.0 +[env:LilyGo_T3S3_sx1262_companion_radio_usb] +extends = LilyGo_T3S3_sx1262 +build_flags = + ${LilyGo_T3S3_sx1262.build_flags} + -D MAX_CONTACTS=100 + -D MAX_GROUP_CHANNELS=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${LilyGo_T3S3_sx1262.build_src_filter} +<../examples/companion_radio/main.cpp> +lib_deps = + ${LilyGo_T3S3_sx1262.lib_deps} + adafruit/RTClib @ ^2.1.3 + densaugeo/base64 @ ~1.4.0 + +[env:LilyGo_T3S3_sx1262_companion_radio_ble] +extends = LilyGo_T3S3_sx1262 +build_flags = + ${LilyGo_T3S3_sx1262.build_flags} + -D MAX_CONTACTS=100 + -D MAX_GROUP_CHANNELS=1 + -D BLE_PIN_CODE=123456 + -D BLE_DEBUG_LOGGING=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${LilyGo_T3S3_sx1262.build_src_filter} + +<../examples/companion_radio/main.cpp> +lib_deps = + ${LilyGo_T3S3_sx1262.lib_deps} + adafruit/RTClib @ ^2.1.3 + densaugeo/base64 @ ~1.4.0 ; ----------------- NRF52 --------------------- [nrf52_base] diff --git a/src/helpers/ArduinoSerialInterface.h b/src/helpers/ArduinoSerialInterface.h index e7794ee0..bef7bdf2 100644 --- a/src/helpers/ArduinoSerialInterface.h +++ b/src/helpers/ArduinoSerialInterface.h @@ -8,13 +8,21 @@ class ArduinoSerialInterface : public BaseSerialInterface { uint8_t _state; uint16_t _frame_len; uint16_t rx_len; +#ifdef LILYGO_T3S3 + HWCDC* _serial; +#else HardwareSerial* _serial; +#endif uint8_t rx_buf[MAX_FRAME_SIZE]; public: ArduinoSerialInterface() { _isEnabled = false; _state = 0; } +#ifdef LILYGO_T3S3 + void begin(HWCDC& serial) { _serial = &serial; } +#else void begin(HardwareSerial& serial) { _serial = &serial; } +#endif // BaseSerialInterface methods void enable() override; From f4229bb185ff2edecf30b84fca24dd5d40a84856 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Wed, 5 Feb 2025 10:42:40 +1100 Subject: [PATCH 2/3] * companion radio bug fix --- examples/companion_radio/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 4f6c0ddc..93192783 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -174,9 +174,9 @@ class MyMesh : public BaseChatMesh { success = success && (file.read((uint8_t *) &c.out_path_len, 1) == 1); success = success && (file.read((uint8_t *) &c.last_advert_timestamp, 4) == 4); success = success && (file.read(c.out_path, 64) == 64); - success = success && (file.read((uint8_t *) c.lastmod, 4) == 4); - success = success && (file.read((uint8_t *) c.gps_lat, 4) == 4); - success = success && (file.read((uint8_t *) c.gps_lon, 4) == 4); + success = success && (file.read((uint8_t *) &c.lastmod, 4) == 4); + success = success && (file.read((uint8_t *) &c.gps_lat, 4) == 4); + success = success && (file.read((uint8_t *) &c.gps_lon, 4) == 4); if (!success) break; // EOF From 4e8d6de7d7e63492e694a890337fe7a462bb79b8 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Wed, 5 Feb 2025 11:13:39 +1100 Subject: [PATCH 3/3] * companion radio: CMD_GET_DEVICE_TIME now responds with RESP_CODE_CURR_TIME(9) instead of RESP_CODE_OK --- examples/companion_radio/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 93192783..9444e4f4 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -110,6 +110,7 @@ static uint32_t _atoi(const char* sp) { #define RESP_CODE_SENT 6 // reply to CMD_SEND_TXT_MSG #define RESP_CODE_CONTACT_MSG_RECV 7 // a reply to CMD_SYNC_NEXT_MESSAGE #define RESP_CODE_CHANNEL_MSG_RECV 8 // a reply to CMD_SYNC_NEXT_MESSAGE +#define RESP_CODE_CURR_TIME 9 // a reply to CMD_GET_DEVICE_TIME // these are _pushed_ to client app at any time #define PUSH_CODE_ADVERT 0x80 @@ -562,7 +563,7 @@ public: writeOKFrame(); } else if (cmd_frame[0] == CMD_GET_DEVICE_TIME) { uint8_t reply[5]; - reply[0] = RESP_CODE_OK; + reply[0] = RESP_CODE_CURR_TIME; uint32_t now = getRTCClock()->getCurrentTime(); memcpy(&reply[1], &now, 4); _serial->writeFrame(reply, 5);