From 45365322a7ab1a7ce8b9a1bba54f9cacfb9e5e85 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 3 Mar 2025 12:31:11 +1100 Subject: [PATCH] * companion: RESP_CODE_DEVICE_INFO format change. --- examples/companion_radio/main.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 95034110..a3168a44 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -96,8 +96,15 @@ static uint32_t _atoi(const char* sp) { /*------------ Frame Protocol --------------*/ -#define FIRMWARE_VER_CODE 1 -#define FIRMWARE_BUILD_DATE "19 Feb 2025" +#define FIRMWARE_VER_CODE 2 + +#ifndef FIRMWARE_BUILD_DATE + #define FIRMWARE_BUILD_DATE "3 Mar 2025" +#endif + +#ifndef FIRMWARE_VERSION + #define FIRMWARE_VERSION "v1.0.0" +#endif #define CMD_APP_START 1 #define CMD_SEND_TXT_MSG 2 @@ -656,11 +663,9 @@ public: out_frame[i++] = FIRMWARE_VER_CODE; memset(&out_frame[i], 0, 6); i += 6; // reserved memset(&out_frame[i], 0, 12); - strcpy((char *) &out_frame[i], FIRMWARE_BUILD_DATE); - i += 12; - const char* name = board.getManufacturerName(); - int tlen = strlen(name); - memcpy(&out_frame[i], name, tlen); i += tlen; + strcpy((char *) &out_frame[i], FIRMWARE_BUILD_DATE); i += 12; + StrHelper::strzcpy((char *) &out_frame[i], board.getManufacturerName(), 40); i += 40; + StrHelper::strzcpy((char *) &out_frame[i], FIRMWARE_VERSION, 20); i += 20; _serial->writeFrame(out_frame, i); } else if (cmd_frame[0] == CMD_APP_START && len >= 8) { // sent when app establishes connection, respond with node ID // cmd_frame[1..7] reserved future