From 462e6392701cd874c08eb4c0fd80ad6b7d34e298 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Tue, 4 Aug 2026 00:47:17 -0700 Subject: [PATCH] Fix release matrix build failures --- examples/simple_repeater/MyMesh.cpp | 45 ++++++++++++++++------ src/Dispatcher.cpp | 11 ++++++ src/helpers/CommonCLI.cpp | 14 +++---- src/helpers/UserGpioPinPolicy.h | 12 ++++++ src/helpers/radiolib/CustomLLCC68Wrapper.h | 2 + src/helpers/radiolib/CustomLR1110Wrapper.h | 3 ++ src/helpers/radiolib/CustomSX1262Wrapper.h | 3 +- src/helpers/radiolib/CustomSX1268Wrapper.h | 2 + src/helpers/radiolib/CustomSX1276Wrapper.h | 2 + src/helpers/radiolib/RadioLibWrappers.cpp | 2 +- src/helpers/radiolib/RadioLibWrappers.h | 3 +- variants/ikoka_nano_nrf/platformio.ini | 2 +- variants/thinknode_m7/pins_arduino.h | 6 ++- variants/wio-e5-dev/platformio.ini | 8 ++++ 14 files changed, 89 insertions(+), 26 deletions(-) diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index b26106967..e9e7613ea 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -942,7 +942,7 @@ const char *MyMesh::getLogDateTime() { } void MyMesh::logRxRaw(float snr, float rssi, const uint8_t raw[], int len) { -#if MESH_PACKET_LOGGING +#if MESH_PACKET_LOGGING && !defined(MESH_COMPACT_PACKET_LOGGING) // Logging builds prefer backpressure over silently losing a packet record. Serial.print(getLogDateTime()); Serial.print(" RAW: "); @@ -7936,20 +7936,41 @@ static void formatPathReply(const uint8_t* path, uint8_t path_len, char* out, si out[pos] = 0; } -static bool isClientPathCommand(const char* command) { - return strcmp(command, "get outpath") == 0 - || strcmp(command, "set outpath") == 0 - || strncmp(command, "set outpath ", 12) == 0 - || strcmp(command, "get altpath") == 0 - || strcmp(command, "set altpath") == 0 - || strncmp(command, "set altpath ", 12) == 0; +enum ClientPathCommand : uint8_t { + CLIENT_PATH_NONE = 0, + CLIENT_PATH_VALID = 1, + CLIENT_PATH_SET = 2, + CLIENT_PATH_ALT = 4, +}; + +static __attribute__((always_inline)) ClientPathCommand classifyClientPathCommand(const char* command) { + uint8_t result = CLIENT_PATH_VALID; + bool is_get = strncmp(command, "get ", 4) == 0; + if (!is_get) { + if (strncmp(command, "set ", 4) != 0) return CLIENT_PATH_NONE; + result |= CLIENT_PATH_SET; + } + + const char* path = command + 4; + if (strncmp(path, "outpath", 7) != 0) { + if (strncmp(path, "altpath", 7) != 0) return CLIENT_PATH_NONE; + result |= CLIENT_PATH_ALT; + } + + if (is_get) { + if (path[7] != 0) return CLIENT_PATH_NONE; + } else if (path[7] != 0 && path[7] != ' ') { + return CLIENT_PATH_NONE; + } + return (ClientPathCommand)result; } bool MyMesh::handleClientPathCommand(ClientInfo* sender, char* command, char* reply) { - if (!isClientPathCommand(command)) return false; + const ClientPathCommand path_command = classifyClientPathCommand(command); + if (path_command == CLIENT_PATH_NONE) return false; - bool is_get = strncmp(command, "get ", 4) == 0; - bool is_alt = strncmp(command + 4, "altpath", 7) == 0; + bool is_get = (path_command & CLIENT_PATH_SET) == 0; + bool is_alt = (path_command & CLIENT_PATH_ALT) != 0; if (sender == NULL) { strcpy(reply, "Err - command needs remote client context"); return true; @@ -8143,7 +8164,7 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, ClientInfo* sender, char * // Reply-path overrides are core remote-client routing controls. Keep them // available before the portable observer hands the remaining commands to // its reduced CommonCLI parser. - if (isClientPathCommand(command)) { + if (classifyClientPathCommand(command) != CLIENT_PATH_NONE) { if (sender && !sender->isAdmin()) { bool allowed = (sender->isRegionMgr() || sender->isFilterMgr()) && isCommonManagerReadOnlyAllowed(command); diff --git a/src/Dispatcher.cpp b/src/Dispatcher.cpp index eb6cdbb26..83ebf855f 100644 --- a/src/Dispatcher.cpp +++ b/src/Dispatcher.cpp @@ -103,13 +103,21 @@ uint32_t Dispatcher::getCADFailMaxDuration() const { #if MESH_PACKET_LOGGING void Dispatcher::logPacketStart(const char* direction, const Packet* packet, int len) { +#if defined(MESH_COMPACT_PACKET_LOGGING) + (void)packet; + Serial.printf("%s %d\n", direction, len); +#else Serial.print(getLogDateTime()); Serial.printf(": %s, len=%d (type=%d, route=%s, payload_len=%d)", direction, len, packet->getPayloadType(), packet->isRouteDirect() ? "D" : "F", packet->payload_len); +#endif } void Dispatcher::logPacketEnd(const Packet* packet) { +#if defined(MESH_COMPACT_PACKET_LOGGING) + (void)packet; +#else const uint8_t type = packet->getPayloadType(); if (packet->payload_len >= 2 && (type == PAYLOAD_TYPE_PATH || type == PAYLOAD_TYPE_REQ @@ -119,6 +127,7 @@ void Dispatcher::logPacketEnd(const Packet* packet) { } else { Serial.write((uint8_t)'\n'); } +#endif } #endif @@ -442,6 +451,7 @@ void Dispatcher::checkRecv() { if (pkt) { #if MESH_PACKET_LOGGING logPacketStart("RX", pkt, pkt->getRawLength()); +#if !defined(MESH_COMPACT_PACKET_LOGGING) Serial.printf(" SNR=%d RSSI=%d score=%d time=%d", (int)pkt->getSNR(), (int)rssi, (int)(score * 1000), air_time); @@ -450,6 +460,7 @@ void Dispatcher::checkRecv() { Serial.print(" hash="); mesh::Utils::printHex(Serial, packet_hash, MAX_HASH_SIZE); logPacketEnd(pkt); +#endif #endif logRx(pkt, pkt->getRawLength(), score); // hook for custom logging diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index 36796562c..01454737a 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -134,6 +134,7 @@ static bool isValidName(const char *n) { return true; } +#if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL) static bool isGpioConfig(const char* config) { static const char expected[] = "gpio"; for (size_t i = 0; i < sizeof(expected) - 1; i++) { @@ -141,6 +142,7 @@ static bool isGpioConfig(const char* config) { } return config[sizeof(expected) - 1] == '\0' || config[sizeof(expected) - 1] == ' '; } +#endif void CommonCLI::loop() { #if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL) @@ -3029,8 +3031,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* reply) { const char* config = &command[4]; - if (isGpioConfig(config)) { #if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL) + if (isGpioConfig(config)) { const UserGpio::SetResult result = _user_gpio.handleSet( config + 4, reply, 160, sender_timestamp, _callbacks->getUserGpioRequestSource()); @@ -3040,11 +3042,9 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep result.cancelled_timer) { _callbacks->onUserGpioTimerCancelled(result.pin); } -#else - strcpy(reply, "Error: GPIO control unsupported on this build"); -#endif return; } +#endif #if defined(ESP_PLATFORM) && defined(ADMIN_PASSWORD) && !defined(WEBCONFIG_DISABLED) if (memcmp(config, "webui ", 6) == 0) { @@ -4161,14 +4161,12 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* reply) { const char* config = &command[4]; - if (isGpioConfig(config)) { #if defined(ESP32_PLATFORM) || defined(USER_GPIO_CONTROL) + if (isGpioConfig(config)) { _user_gpio.handleGet(config + 4, reply, 160); -#else - strcpy(reply, "Error: GPIO control unsupported on this build"); -#endif return; } +#endif #if defined(ESP_PLATFORM) && defined(ADMIN_PASSWORD) && !defined(WEBCONFIG_DISABLED) if (strcmp(config, "webui") == 0) { diff --git a/src/helpers/UserGpioPinPolicy.h b/src/helpers/UserGpioPinPolicy.h index 7e7df2a38..517c5c048 100644 --- a/src/helpers/UserGpioPinPolicy.h +++ b/src/helpers/UserGpioPinPolicy.h @@ -3,6 +3,13 @@ #include #include +// Simulator targets do not include RadioLib, but board pin macros can still +// use its sentinel value. Keep the fallback local to this header. +#ifndef RADIOLIB_NC +#define RADIOLIB_NC (-1) +#define USER_GPIO_PIN_POLICY_UNDEF_RADIOLIB_NC +#endif + // This header is intentionally included only after target.h. The target's // build-time pin definitions are the authoritative list of GPIOs claimed by // the firmware in that particular image. @@ -589,3 +596,8 @@ inline bool isFirmwareReserved(uint8_t pin) { } } // namespace UserGpioPinPolicy + +#ifdef USER_GPIO_PIN_POLICY_UNDEF_RADIOLIB_NC +#undef RADIOLIB_NC +#undef USER_GPIO_PIN_POLICY_UNDEF_RADIOLIB_NC +#endif diff --git a/src/helpers/radiolib/CustomLLCC68Wrapper.h b/src/helpers/radiolib/CustomLLCC68Wrapper.h index 6c278bb29..ae3b73983 100644 --- a/src/helpers/radiolib/CustomLLCC68Wrapper.h +++ b/src/helpers/radiolib/CustomLLCC68Wrapper.h @@ -8,6 +8,8 @@ class CustomLLCC68Wrapper : public RadioLibWrapper { public: CustomLLCC68Wrapper(CustomLLCC68& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { } + void powerOff() { _radio->standby(); _radio->sleep(); } + protected: bool applyParams(float freq, float bw, uint8_t sf, uint8_t cr) override { bool success = ((CustomLLCC68 *)_radio)->setFrequency(freq) == RADIOLIB_ERR_NONE diff --git a/src/helpers/radiolib/CustomLR1110Wrapper.h b/src/helpers/radiolib/CustomLR1110Wrapper.h index 36c22611b..67e2cf969 100644 --- a/src/helpers/radiolib/CustomLR1110Wrapper.h +++ b/src/helpers/radiolib/CustomLR1110Wrapper.h @@ -12,6 +12,8 @@ class CustomLR1110Wrapper : public RadioLibWrapper { public: CustomLR1110Wrapper(CustomLR1110& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { } + void powerOff() { _radio->standby(); _radio->sleep(); } + protected: bool applyParams(float freq, float bw, uint8_t sf, uint8_t cr) override { bool success = ((CustomLR1110 *)_radio)->setFrequency(freq) == RADIOLIB_ERR_NONE @@ -56,6 +58,7 @@ public: } bool supportsRxPowerSaving() const override { return true; } + void onReceiveProcessed() override { finishReceiveProcessing(); } protected: bool isPacketReady() override { diff --git a/src/helpers/radiolib/CustomSX1262Wrapper.h b/src/helpers/radiolib/CustomSX1262Wrapper.h index 3d23a33a4..ec7a2a5ae 100644 --- a/src/helpers/radiolib/CustomSX1262Wrapper.h +++ b/src/helpers/radiolib/CustomSX1262Wrapper.h @@ -47,12 +47,13 @@ public: return packetScoreInt(snr, sf, packet_len); } uint8_t getSpreadingFactor() const override { return ((CustomSX1262 *)_radio)->spreadingFactor; } - virtual void powerOff() override { + void powerOff() { ((CustomSX1262 *)_radio)->standby(); ((CustomSX1262 *)_radio)->sleep(false); } bool supportsRxPowerSaving() const override { return true; } + void onReceiveProcessed() override { finishReceiveProcessing(); } protected: int startReceiveMode() override { diff --git a/src/helpers/radiolib/CustomSX1268Wrapper.h b/src/helpers/radiolib/CustomSX1268Wrapper.h index ff8f26e17..34b145d13 100644 --- a/src/helpers/radiolib/CustomSX1268Wrapper.h +++ b/src/helpers/radiolib/CustomSX1268Wrapper.h @@ -12,6 +12,8 @@ class CustomSX1268Wrapper : public RadioLibWrapper { public: CustomSX1268Wrapper(CustomSX1268& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { } + void powerOff() { _radio->standby(); _radio->sleep(); } + protected: bool applyParams(float freq, float bw, uint8_t sf, uint8_t cr) override { bool success = ((CustomSX1268 *)_radio)->setFrequency(freq) == RADIOLIB_ERR_NONE diff --git a/src/helpers/radiolib/CustomSX1276Wrapper.h b/src/helpers/radiolib/CustomSX1276Wrapper.h index 68409dc6a..ddb094319 100644 --- a/src/helpers/radiolib/CustomSX1276Wrapper.h +++ b/src/helpers/radiolib/CustomSX1276Wrapper.h @@ -11,6 +11,8 @@ class CustomSX1276Wrapper : public RadioLibWrapper { public: CustomSX1276Wrapper(CustomSX1276& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { } + void powerOff() { _radio->standby(); _radio->sleep(); } + protected: bool applyParams(float freq, float bw, uint8_t sf, uint8_t cr) override { return ((CustomSX1276 *)_radio)->setFrequency(freq) == RADIOLIB_ERR_NONE diff --git a/src/helpers/radiolib/RadioLibWrappers.cpp b/src/helpers/radiolib/RadioLibWrappers.cpp index e32daf415..ac8eae03b 100644 --- a/src/helpers/radiolib/RadioLibWrappers.cpp +++ b/src/helpers/radiolib/RadioLibWrappers.cpp @@ -606,7 +606,7 @@ int RadioLibWrapper::recvRaw(uint8_t* bytes, int sz) { return len; } -void RadioLibWrapper::onReceiveProcessed() { +void RadioLibWrapper::finishReceiveProcessing() { if (!_rx_hold_continuous) return; if ((state & ~STATE_INT_READY) == STATE_TX_WAIT) { diff --git a/src/helpers/radiolib/RadioLibWrappers.h b/src/helpers/radiolib/RadioLibWrappers.h index 649020e4b..b5a2861ab 100644 --- a/src/helpers/radiolib/RadioLibWrappers.h +++ b/src/helpers/radiolib/RadioLibWrappers.h @@ -79,6 +79,7 @@ protected: void requestNoiseFloorRefresh(); void noiseFloorCalibCheck(unsigned long now); void endNoiseFloorCalib(unsigned long now); + void finishReceiveProcessing(); void cacheParams(float freq, float bw, uint8_t sf, uint8_t cr) { _cur_freq = freq; _cur_bw = bw; _cur_sf = sf; _cur_cr = cr; _params_valid = true; } @@ -127,9 +128,7 @@ public: } void begin() override; - virtual void powerOff() { _radio->standby(); _radio->sleep(); } int recvRaw(uint8_t* bytes, int sz) override; - void onReceiveProcessed() override; uint32_t getEstAirtimeFor(int len_bytes) override; bool startSendRaw(const uint8_t* bytes, int len) override; bool isSendComplete() override; diff --git a/variants/ikoka_nano_nrf/platformio.ini b/variants/ikoka_nano_nrf/platformio.ini index dab4351ea..7e9437851 100644 --- a/variants/ikoka_nano_nrf/platformio.ini +++ b/variants/ikoka_nano_nrf/platformio.ini @@ -31,7 +31,7 @@ debug_tool = jlink upload_protocol = nrfutil lib_deps = ${rak4631_hw.lib_deps} ${sensor_base.lib_deps} -build_src_filter = ${nrf52_base.build_src_filter} +build_src_filter = ${rak4631_hw.build_src_filter} + [ikoka_nano_nrf_e22_22dbm] diff --git a/variants/thinknode_m7/pins_arduino.h b/variants/thinknode_m7/pins_arduino.h index 845a8db1d..46f31891c 100644 --- a/variants/thinknode_m7/pins_arduino.h +++ b/variants/thinknode_m7/pins_arduino.h @@ -16,4 +16,8 @@ static const uint8_t MOSI = 10; static const uint8_t MISO = 9; static const uint8_t SCK = 11; -#endif /* Pins_Arduino_h */ \ No newline at end of file +// Default ESP32-S3 UART0 pins used by HardwareSerial. +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +#endif /* Pins_Arduino_h */ diff --git a/variants/wio-e5-dev/platformio.ini b/variants/wio-e5-dev/platformio.ini index 8204cf17b..a469fb95b 100644 --- a/variants/wio-e5-dev/platformio.ini +++ b/variants/wio-e5-dev/platformio.ini @@ -40,6 +40,11 @@ build_flags = ${lora_e5.build_flags} -flto -fno-inline-small-functions ; reduce flash without moving the deployed filesystem boundary -fipa-pta + -fmerge-all-constants + -fno-ipa-cp-clone + -fno-partial-inlining + -fno-jump-tables + -fno-tree-switch-conversion -fno-semantic-interposition -fno-unwind-tables -fno-asynchronous-unwind-tables @@ -49,6 +54,9 @@ build_flags = ${lora_e5.build_flags} -D ADVERT_NAME='"WIO-E5 Repeater"' -D ADMIN_PASSWORD='"password"' -D MAX_NEIGHBOURS=50 + -D FLOOD_PACKET_FILTER_SLOTS=8 + -D FLOOD_CHANNEL_SCOPE_SLOTS=7 + -D MESH_COMPACT_PACKET_LOGGING=1 -D ENABLE_HWSERIAL2 -D WITH_RS232_BRIDGE=Serial2 -D WITH_RS232_BRIDGE_RX=PA3