From bd6bd065ac435ca8d2e62d6dae100d92819d9aa7 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Fri, 15 Aug 2025 15:54:24 +0800 Subject: [PATCH 01/51] Add heltec_vision_master_t190 board. --- boards/heltec_vision_master_t190.json | 44 ++++++++++ src/helpers/ui/ST7789Display.cpp | 13 ++- src/helpers/ui/ST7789Display.h | 5 +- .../HeltecT190Board.cpp | 69 +++++++++++++++ .../HeltecT190Board.h | 30 +++++++ .../heltec_vision_master_t190/pins_arduino.h | 61 +++++++++++++ .../heltec_vision_master_t190/platformio.ini | 85 +++++++++++++++++++ variants/heltec_vision_master_t190/target.cpp | 53 ++++++++++++ variants/heltec_vision_master_t190/target.h | 27 ++++++ 9 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 boards/heltec_vision_master_t190.json create mode 100644 variants/heltec_vision_master_t190/HeltecT190Board.cpp create mode 100644 variants/heltec_vision_master_t190/HeltecT190Board.h create mode 100644 variants/heltec_vision_master_t190/pins_arduino.h create mode 100644 variants/heltec_vision_master_t190/platformio.ini create mode 100644 variants/heltec_vision_master_t190/target.cpp create mode 100644 variants/heltec_vision_master_t190/target.h diff --git a/boards/heltec_vision_master_t190.json b/boards/heltec_vision_master_t190.json new file mode 100644 index 00000000..6aa674fc --- /dev/null +++ b/boards/heltec_vision_master_t190.json @@ -0,0 +1,44 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_16MB.csv", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_MODE=0", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "opi", + "hwids": [ + ["0x303A", "0x1001"], + ["0x303A", "0x0002"] + ], + "mcu": "esp32s3", + "variant": "heltec_vision_master_t190" + }, + "connectivity": ["wifi", "bluetooth", "lora"], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino", "espidf"], + "name": "Heltec Vision Master T190", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 8388608, + "maximum_size": 16777216, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 921600 + }, + "url": "https://heltec.org/project/vision-master-t190/", + "vendor": "Heltec" +} diff --git a/src/helpers/ui/ST7789Display.cpp b/src/helpers/ui/ST7789Display.cpp index 9e71e6bd..6a91457a 100644 --- a/src/helpers/ui/ST7789Display.cpp +++ b/src/helpers/ui/ST7789Display.cpp @@ -18,7 +18,11 @@ bool ST7789Display::begin() { pinMode(PIN_TFT_VDD_CTL, OUTPUT); pinMode(PIN_TFT_LEDA_CTL, OUTPUT); digitalWrite(PIN_TFT_VDD_CTL, LOW); + #ifdef PIN_TFT_LEDA_CTL_ACTIVE + digitalWrite(PIN_TFT_LEDA_CTL, PIN_TFT_LEDA_CTL_ACTIVE); + #else digitalWrite(PIN_TFT_LEDA_CTL, LOW); + #endif digitalWrite(PIN_TFT_RST, HIGH); display.init(); @@ -43,15 +47,22 @@ void ST7789Display::turnOn() { delay(20); // Now turn on the backlight + #ifdef PIN_TFT_LEDA_CTL_ACTIVE + digitalWrite(PIN_TFT_LEDA_CTL, PIN_TFT_LEDA_CTL_ACTIVE); + #else digitalWrite(PIN_TFT_LEDA_CTL, LOW); - + #endif _isOn = true; } } void ST7789Display::turnOff() { digitalWrite(PIN_TFT_VDD_CTL, HIGH); +#ifdef PIN_TFT_LEDA_CTL_ACTIVE + digitalWrite(PIN_TFT_LEDA_CTL, !PIN_TFT_LEDA_CTL_ACTIVE); +#else digitalWrite(PIN_TFT_LEDA_CTL, HIGH); +#endif digitalWrite(PIN_TFT_RST, LOW); _isOn = false; } diff --git a/src/helpers/ui/ST7789Display.h b/src/helpers/ui/ST7789Display.h index b267a2cb..0f7ff71b 100644 --- a/src/helpers/ui/ST7789Display.h +++ b/src/helpers/ui/ST7789Display.h @@ -14,8 +14,11 @@ class ST7789Display : public DisplayDriver { bool i2c_probe(TwoWire& wire, uint8_t addr); public: +#ifdef HELTEC_VISION_MASTER_T190 + ST7789Display() : DisplayDriver(128, 64), display(&SPI, PIN_TFT_RST, PIN_TFT_DC, PIN_TFT_CS, GEOMETRY_RAWMODE, 320, 170,PIN_TFT_SDA,-1,PIN_TFT_SCL) {_isOn = false;} +#else ST7789Display() : DisplayDriver(128, 64), display(&SPI1, PIN_TFT_RST, PIN_TFT_DC, PIN_TFT_CS, GEOMETRY_RAWMODE, 240, 135) {_isOn = false;} - +#endif bool begin(); bool isOn() override { return _isOn; } diff --git a/variants/heltec_vision_master_t190/HeltecT190Board.cpp b/variants/heltec_vision_master_t190/HeltecT190Board.cpp new file mode 100644 index 00000000..c5b03bc8 --- /dev/null +++ b/variants/heltec_vision_master_t190/HeltecT190Board.cpp @@ -0,0 +1,69 @@ +#include "HeltecT190Board.h" + +void HeltecT190Board::begin() { + ESP32Board::begin(); + + pinMode(PIN_ADC_CTRL, OUTPUT); + digitalWrite(PIN_ADC_CTRL, LOW); // Initially inactive + + periph_power.begin(); + + esp_reset_reason_t reason = esp_reset_reason(); + if (reason == ESP_RST_DEEPSLEEP) { + long wakeup_source = esp_sleep_get_ext1_wakeup_status(); + if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep) + startup_reason = BD_STARTUP_RX_PACKET; + } + + rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS); + rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1); + } + } + + void HeltecT190Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) { + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); + + // Make sure the DIO1 and NSS GPIOs are hold on required levels during deep sleep + rtc_gpio_set_direction((gpio_num_t)P_LORA_DIO_1, RTC_GPIO_MODE_INPUT_ONLY); + rtc_gpio_pulldown_en((gpio_num_t)P_LORA_DIO_1); + + rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS); + + if (pin_wake_btn < 0) { + esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet + } else { + esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1) | (1L << pin_wake_btn), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet OR wake btn + } + + if (secs > 0) { + esp_sleep_enable_timer_wakeup(secs * 1000000); + } + + // Finally set ESP32 into sleep + esp_deep_sleep_start(); // CPU halts here and never returns! + } + + void HeltecT190Board::powerOff() { + // TODO: re-enable this when there is a definite wake-up source pin: + // enterDeepSleep(0); + } + + uint16_t HeltecT190Board::getBattMilliVolts() { + analogReadResolution(10); + digitalWrite(PIN_ADC_CTRL, HIGH); + delay(10); + uint32_t raw = 0; + for (int i = 0; i < 8; i++) { + raw += analogRead(PIN_VBAT_READ); + } + raw = raw / 8; + + digitalWrite(PIN_ADC_CTRL, LOW); + + return (5.42 * (3.3 / 1024.0) * raw) * 1000; + } + + const char* HeltecT190Board::getManufacturerName() const { + return "Heltec T190"; + } + diff --git a/variants/heltec_vision_master_t190/HeltecT190Board.h b/variants/heltec_vision_master_t190/HeltecT190Board.h new file mode 100644 index 00000000..96c09c1c --- /dev/null +++ b/variants/heltec_vision_master_t190/HeltecT190Board.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include +#include +#include + +// LoRa radio module pins for heltec_vision_master_e290 +#define P_LORA_DIO_1 14 +#define P_LORA_NSS 8 +#define P_LORA_RESET 12 +#define P_LORA_BUSY 13 +#define P_LORA_SCLK 9 +#define P_LORA_MISO 11 +#define P_LORA_MOSI 10 + +class HeltecT190Board : public ESP32Board { + +public: + RefCountedDigitalPin periph_power; + + HeltecT190Board() : periph_power(PIN_VEXT_EN,PIN_VEXT_EN_ACTIVE) { } + + void begin(); + void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1); + void powerOff() override; + uint16_t getBattMilliVolts() override; + const char* getManufacturerName() const override ; + +}; diff --git a/variants/heltec_vision_master_t190/pins_arduino.h b/variants/heltec_vision_master_t190/pins_arduino.h new file mode 100644 index 00000000..56856106 --- /dev/null +++ b/variants/heltec_vision_master_t190/pins_arduino.h @@ -0,0 +1,61 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t LED_BUILTIN = 45; // LED is not populated on earliest board variant +#define BUILTIN_LED LED_BUILTIN // Backward compatibility +#define LED_BUILTIN LED_BUILTIN + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t SDA = 2; +static const uint8_t SCL = 1; + +static const uint8_t SS = 8; +static const uint8_t MOSI = 10; +static const uint8_t MISO = 11; +static const uint8_t SCK = 9; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A13 = 14; +static const uint8_t A14 = 15; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; +static const uint8_t A18 = 19; +static const uint8_t A19 = 20; + +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T4 = 4; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; +static const uint8_t T14 = 14; + +static const uint8_t RST_LoRa = 12; +static const uint8_t BUSY_LoRa = 13; +static const uint8_t DIO1 = 14; + +#endif /* Pins_Arduino_h */ diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini new file mode 100644 index 00000000..026e1e18 --- /dev/null +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -0,0 +1,85 @@ +[Heltec_Vision_Master_T190_base] +extends = esp32_base +board = heltec_vision_master_t190 +build_flags = + ${esp32_base.build_flags} + -I variants/heltec_vision_master_t190 + -I src/helpers/ui + -D HELTEC_VISION_MASTER_T190 + -D RADIO_CLASS=CustomSX1262 + -D WRAPPER_CLASS=CustomSX1262Wrapper + -D LORA_TX_POWER=22 + -D PIN_USER_BTN=0 + -D PIN_VEXT_EN=5 + -D PIN_VEXT_EN_ACTIVE=HIGH + -D PIN_VBAT_READ=6 + -D PIN_ADC_CTRL=46 + -D SX126X_DIO2_AS_RF_SWITCH=true + -D SX126X_DIO3_TCXO_VOLTAGE=1.8 + -D SX126X_CURRENT_LIMIT=140 + -D SX126X_RX_BOOSTED_GAIN=1 + -D PIN_BOARD_SDA=2 + -D PIN_BOARD_SCL=1 + -D PIN_TFT_SCL=38 + -D PIN_TFT_SDA=48 + -D PIN_TFT_RST=40 + -D PIN_TFT_VDD_CTL=7 + -D PIN_TFT_LEDA_CTL=17 + -D PIN_TFT_LEDA_CTL_ACTIVE=HIGH + -D PIN_TFT_CS=39 + -D PIN_TFT_DC=47 + -D ST7789 + -D DISPLAY_CLASS=ST7789Display +build_src_filter = ${esp32_base.build_src_filter} + +<../variants/heltec_vision_master_t190> + + + + + + + + +lib_deps = + ${esp32_base.lib_deps} + adafruit/Adafruit GFX Library @ ^1.12.1 + +[env:Heltec_Vision_Master_T190_radio_ble] +extends = Heltec_Vision_Master_T190_base +build_flags = + ${Heltec_Vision_Master_T190_base.build_flags} + -D MAX_CONTACTS=100 + -D MAX_GROUP_CHANNELS=8 + -D BLE_PIN_CODE=123456 ; dynamic, random PIN + -D BLE_DEBUG_LOGGING=1 + -D OFFLINE_QUEUE_SIZE=256 +build_src_filter = ${Heltec_Vision_Master_T190_base.build_src_filter} + + + +<../examples/companion_radio> +lib_deps = + ${Heltec_Vision_Master_T190_base.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Heltec_Vision_Master_T190_repeater] +extends = Heltec_Vision_Master_T190_base +build_flags = + ${Heltec_Vision_Master_T190_base.build_flags} + -D ADVERT_NAME='"Heltec T190 Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 +build_src_filter = ${Heltec_Vision_Master_T190_base.build_src_filter} + +<../examples/simple_repeater> +lib_deps = + ${Heltec_Vision_Master_T190_base.lib_deps} + ${esp32_ota.lib_deps} + +[env:Heltec_Vision_Master_T190_room_server] +extends = Heltec_Vision_Master_T190_base +build_flags = + ${Heltec_Vision_Master_T190_base.build_flags} + -D ADVERT_NAME='"Heltec T190 Room"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D ROOM_PASSWORD='"hello"' +build_src_filter = ${Heltec_Vision_Master_T190_base.build_src_filter} + +<../examples/simple_room_server> +lib_deps = + ${Heltec_Vision_Master_T190_base.lib_deps} + ${esp32_ota.lib_deps} diff --git a/variants/heltec_vision_master_t190/target.cpp b/variants/heltec_vision_master_t190/target.cpp new file mode 100644 index 00000000..9e13d36b --- /dev/null +++ b/variants/heltec_vision_master_t190/target.cpp @@ -0,0 +1,53 @@ +#include "target.h" +#include + +HeltecT190Board board; + +#if defined(P_LORA_SCLK) + static SPIClass spi(FSPI); + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); +#else + RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); +#endif + +WRAPPER_CLASS radio_driver(radio, board); + +ESP32RTCClock fallback_clock; +AutoDiscoverRTCClock rtc_clock(fallback_clock); + +SensorManager sensors; + +#ifdef DISPLAY_CLASS +DISPLAY_CLASS display; +#endif + +bool radio_init() { + fallback_clock.begin(); + rtc_clock.begin(Wire); + +#if defined(P_LORA_SCLK) + return radio.std_init(&spi); +#else + return radio.std_init(); +#endif +} + +uint32_t radio_get_rng_seed() { + return radio.random(0x7FFFFFFF); +} + +void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) { + radio.setFrequency(freq); + radio.setSpreadingFactor(sf); + radio.setBandwidth(bw); + radio.setCodingRate(cr); +} + +void radio_set_tx_power(uint8_t dbm) { + radio.setOutputPower(dbm); +} + +mesh::LocalIdentity radio_new_identity() { + RadioNoiseListener rng(radio); + return mesh::LocalIdentity(&rng); // create new random identity +} diff --git a/variants/heltec_vision_master_t190/target.h b/variants/heltec_vision_master_t190/target.h new file mode 100644 index 00000000..9dfab3d8 --- /dev/null +++ b/variants/heltec_vision_master_t190/target.h @@ -0,0 +1,27 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 +#include +#include +#include +#include +#include +#include +#ifdef DISPLAY_CLASS +#include +#endif + +extern HeltecT190Board board; +extern WRAPPER_CLASS radio_driver; +extern AutoDiscoverRTCClock rtc_clock; +extern SensorManager sensors; + +#ifdef DISPLAY_CLASS +extern DISPLAY_CLASS display; +#endif + +bool radio_init(); +uint32_t radio_get_rng_seed(); +void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); +void radio_set_tx_power(uint8_t dbm); +mesh::LocalIdentity radio_new_identity(); \ No newline at end of file From cb96503b92e31e88617d8e7dd58c5b4f3e6f5c9e Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sat, 23 Aug 2025 14:45:18 +1000 Subject: [PATCH 02/51] * Companion: new-ui, power off now labelled "hibernate" --- examples/companion_radio/ui-new/UITask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index f3ad28c6..1920dd26 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -213,10 +213,10 @@ public: display.setColor(DisplayDriver::GREEN); display.setTextSize(1); if (_shutdown_init) { - display.drawTextCentered(display.width() / 2, 34, "shutting down..."); + display.drawTextCentered(display.width() / 2, 34, "hibernating..."); } else { display.drawXbm((display.width() - 32) / 2, 18, power_icon, 32, 32); - display.drawTextCentered(display.width() / 2, 64 - 11, "off: " PRESS_LABEL); + display.drawTextCentered(display.width() / 2, 64 - 11, "hibernate: " PRESS_LABEL); } } return 5000; // next render after 5000 ms From dedef4931581b58bb3cf70971476d18eac4750eb Mon Sep 17 00:00:00 2001 From: kelsey hudson Date: Fri, 22 Aug 2025 23:29:28 -0700 Subject: [PATCH 03/51] Ikoka Stick: Adding variant support for Ebyte S22 modules The Ebyte S22 module comes in three variants, 22dBm, 30dBm, and 33dBm. Each requires a different TX power max setting to avoid frying the PA frontend. Breaks out variants and roles by module type. --- .../ikoka_stick_nrf/ikoka_stick_nrf_board.h | 18 +- variants/ikoka_stick_nrf/platformio.ini | 228 ++++++++++++++++-- 2 files changed, 206 insertions(+), 40 deletions(-) diff --git a/variants/ikoka_stick_nrf/ikoka_stick_nrf_board.h b/variants/ikoka_stick_nrf/ikoka_stick_nrf_board.h index 1bd8b31d..c66f4827 100644 --- a/variants/ikoka_stick_nrf/ikoka_stick_nrf_board.h +++ b/variants/ikoka_stick_nrf/ikoka_stick_nrf_board.h @@ -5,20 +5,6 @@ #ifdef XIAO_NRF52 -// redefine lora pins if using the S3 variant of SX1262 board -#ifdef SX1262_XIAO_S3_VARIANT - #undef P_LORA_DIO_1 - #undef P_LORA_BUSY - #undef P_LORA_RESET - #undef P_LORA_NSS - #undef SX126X_RXEN - #define P_LORA_DIO_1 D0 - #define P_LORA_BUSY D1 - #define P_LORA_RESET D2 - #define P_LORA_NSS D3 - #define SX126X_RXEN D4 -#endif - class ikoka_stick_nrf_board : public mesh::MainBoard { protected: uint8_t startup_reason; @@ -29,10 +15,10 @@ public: #if defined(P_LORA_TX_LED) void onBeforeTransmit() override { - digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on + digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED on } void onAfterTransmit() override { - digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off + digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED off } #endif diff --git a/variants/ikoka_stick_nrf/platformio.ini b/variants/ikoka_stick_nrf/platformio.ini index e78bc058..6e6ae101 100644 --- a/variants/ikoka_stick_nrf/platformio.ini +++ b/variants/ikoka_stick_nrf/platformio.ini @@ -19,11 +19,10 @@ lib_deps = adafruit/Adafruit INA3221 Library @ ^1.0.1 adafruit/Adafruit INA219 @ ^1.2.3 adafruit/Adafruit AHTX0 @ ^2.0.5 - adafruit/Adafruit BME280 Library @ ^2.3.0 + adafruit/Adafruit BME280 Library @ ^2.3.0 adafruit/Adafruit SSD1306 @ ^2.5.13 - -[ikoka_stick_nrf] +[ikoka_stick_nrf_baseboard] extends = nrf52840_xiao ;board_build.ldscript = boards/nrf52840_s140_v7.ld build_flags = ${nrf52840_xiao.build_flags} @@ -34,7 +33,6 @@ build_flags = ${nrf52840_xiao.build_flags} -D DISPLAY_ROTATION=2 -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper - -D LORA_TX_POWER=9 -D P_LORA_DIO_1=D1 -D P_LORA_RESET=D2 -D P_LORA_BUSY=D3 @@ -52,19 +50,59 @@ build_flags = ${nrf52840_xiao.build_flags} -D ENV_INCLUDE_BME280=1 -D ENV_INCLUDE_INA3221=1 -D ENV_INCLUDE_INA219=1 +debug_tool = jlink +upload_protocol = nrfutil + + +;;; abstracted hardware variants + +[ikoka_stick_nrf_e22_22dbm] +extends = ikoka_stick_nrf_baseboard +; No PA in this model, full 22dBm +build_flags = + ${ikoka_stick_nrf_baseboard.build_flags} + -D LORA_TX_POWER=22 build_src_filter = ${nrf52840_xiao.build_src_filter} + + + + +<../variants/ikoka_stick_nrf> -debug_tool = jlink -upload_protocol = nrfutil -[env:ikoka_stick_nrf_companion_radio_ble] -extends = ikoka_stick_nrf +[ikoka_stick_nrf_e22_30dbm] +extends = ikoka_stick_nrf_baseboard +; limit txpower to 20dBm on E22-900M30S. Anything higher will +; cause distortion in the PA output. 20dBm in -> 30dBm out build_flags = - ${ikoka_stick_nrf.build_flags} + ${ikoka_stick_nrf_baseboard.build_flags} + -D LORA_TX_POWER=20 +build_src_filter = ${nrf52840_xiao.build_src_filter} + + + + + + + + + +<../variants/ikoka_stick_nrf> + +[ikoka_stick_nrf_e22_33dbm] +extends = ikoka_stick_nrf_baseboard +; limit txpower to 9dBm on E22-900M33S to avoid hardware damage +; to the rf amplifier frontend. 9dBm in -> 33dBm out +build_flags = + ${ikoka_stick_nrf_baseboard.build_flags} + -D LORA_TX_POWER=9 +build_src_filter = ${nrf52840_xiao.build_src_filter} + + + + + + + + + +<../variants/ikoka_stick_nrf> + +;;; abstracted firmware roles + +[ikoka_stick_nrf_companion_radio_ble] +extends = ikoka_stick_nrf_baseboard +build_flags = + ${ikoka_stick_nrf_baseboard.build_flags} -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 @@ -73,35 +111,35 @@ build_flags = ; -D BLE_DEBUG_LOGGING=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 -build_src_filter = ${ikoka_stick_nrf.build_src_filter} +build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter} + +<../examples/companion_radio/*.cpp> +<../examples/companion_radio/ui-new/*.cpp> lib_deps = - ${ikoka_stick_nrf.lib_deps} + ${ikoka_stick_nrf_baseboard.lib_deps} densaugeo/base64 @ ~1.4.0 -[env:ikoka_stick_nrf_companion_radio_usb] -extends = ikoka_stick_nrf +[ikoka_stick_nrf_companion_radio_usb] +extends = ikoka_stick_nrf_baseboard build_flags = - ${ikoka_stick_nrf.build_flags} + ${ikoka_stick_nrf_baseboard.build_flags} -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -I examples/companion_radio/ui-new ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 -build_src_filter = ${ikoka_stick_nrf.build_src_filter} +build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter} + +<../examples/companion_radio/*.cpp> +<../examples/companion_radio/ui-new/*.cpp> lib_deps = - ${ikoka_stick_nrf.lib_deps} + ${ikoka_stick_nrf_baseboard.lib_deps} densaugeo/base64 @ ~1.4.0 -[env:ikoka_stick_nrf_repeater] -extends = ikoka_stick_nrf +[ikoka_stick_nrf_repeater] +extends = ikoka_stick_nrf_baseboard build_flags = - ${ikoka_stick_nrf.build_flags} + ${ikoka_stick_nrf_baseboard.build_flags} -D ADVERT_NAME='"Ikoka Stick Repeater"' -D ADVERT_LAT=0.0 -D ADVERT_LON=0.0 @@ -109,19 +147,161 @@ build_flags = -D MAX_NEIGHBOURS=8 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 -build_src_filter = ${ikoka_stick_nrf.build_src_filter} +build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter} + +<../examples/simple_repeater/*.cpp> -[env:ikoka_stick_nrf_room_server] -extends = ikoka_stick_nrf +[ikoka_stick_nrf_room_server] +extends = ikoka_stick_nrf_baseboard build_flags = - ${ikoka_stick_nrf.build_flags} + ${ikoka_stick_nrf_baseboard.build_flags} -D ADVERT_NAME='"Ikoka Stick Room"' -D ADVERT_LAT=0.0 -D ADVERT_LON=0.0 -D ADMIN_PASSWORD='"password"' ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 -build_src_filter = ${ikoka_stick_nrf.build_src_filter} +build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter} +<../examples/simple_room_server/*.cpp> + +;;; hardware + firmware variants + +;;; 22dBm EBYTE E22-900M22 variants + +[env:ikoka_stick_nrf_22dbm_companion_radio_usb] +extends = + ikoka_stick_nrf_e22_22dbm + ikoka_stick_nrf_companion_radio_usb +build_flags = + ${ikoka_stick_nrf_companion_radio_usb.build_flags} + ${ikoka_stick_nrf_e22_22dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_companion_radio_usb.build_src_filter} + ${ikoka_stick_nrf_e22_22dbm.build_src_filter} + +[env:ikoka_stick_nrf_22dbm_companion_radio_ble] +extends = + ikoka_stick_nrf_e22_22dbm + ikoka_stick_nrf_companion_radio_ble +build_flags = + ${ikoka_stick_nrf_companion_radio_ble.build_flags} + ${ikoka_stick_nrf_e22_22dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_companion_radio_ble.build_src_filter} + ${ikoka_stick_nrf_e22_22dbm.build_src_filter} + +[env:ikoka_stick_nrf_22dbm_repeater] +extends = + ikoka_stick_nrf_e22_22dbm + ikoka_stick_nrf_repeater +build_flags = + ${ikoka_stick_nrf_repeater.build_flags} + ${ikoka_stick_nrf_e22_22dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_repeater.build_src_filter} + ${ikoka_stick_nrf_e22_22dbm.build_src_filter} + +[env:ikoka_stick_nrf_22dbm_room_server] +extends = + ikoka_stick_nrf_e22_22dbm + ikoka_stick_nrf_room_server +build_flags = + ${ikoka_stick_nrf_room_server.build_flags} + ${ikoka_stick_nrf_e22_22dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_room_server.build_src_filter} + ${ikoka_stick_nrf_e22_22dbm.build_src_filter} + + +;;; 30dBm EBYTE E22-900M30 variants + +[env:ikoka_stick_nrf_30dbm_companion_radio_usb] +extends = + ikoka_stick_nrf_e22_30dbm + ikoka_stick_nrf_companion_radio_usb +build_flags = + ${ikoka_stick_nrf_companion_radio_usb.build_flags} + ${ikoka_stick_nrf_e22_30dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_companion_radio_usb.build_src_filter} + ${ikoka_stick_nrf_e22_30dbm.build_src_filter} + +[env:ikoka_stick_nrf_30dbm_companion_radio_ble] +extends = + ikoka_stick_nrf_e22_30dbm + ikoka_stick_nrf_companion_radio_ble +build_flags = + ${ikoka_stick_nrf_companion_radio_ble.build_flags} + ${ikoka_stick_nrf_e22_30dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_companion_radio_ble.build_src_filter} + ${ikoka_stick_nrf_e22_30dbm.build_src_filter} + +[env:ikoka_stick_nrf_30dbm_repeater] +extends = + ikoka_stick_nrf_e22_30dbm + ikoka_stick_nrf_repeater +build_flags = + ${ikoka_stick_nrf_repeater.build_flags} + ${ikoka_stick_nrf_e22_30dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_repeater.build_src_filter} + ${ikoka_stick_nrf_e22_30dbm.build_src_filter} + +[env:ikoka_stick_nrf_30dbm_room_server] +extends = + ikoka_stick_nrf_e22_30dbm + ikoka_stick_nrf_room_server +build_flags = + ${ikoka_stick_nrf_room_server.build_flags} + ${ikoka_stick_nrf_e22_30dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_room_server.build_src_filter} + ${ikoka_stick_nrf_e22_30dbm.build_src_filter} + + +;;; 33dBm EBYTE E22-900M33 variants + +[env:ikoka_stick_nrf_33dbm_companion_radio_usb] +extends = + ikoka_stick_nrf_e22_33dbm + ikoka_stick_nrf_companion_radio_usb +build_flags = + ${ikoka_stick_nrf_companion_radio_usb.build_flags} + ${ikoka_stick_nrf_e22_33dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_companion_radio_usb.build_src_filter} + ${ikoka_stick_nrf_e22_33dbm.build_src_filter} + +[env:ikoka_stick_nrf_33dbm_companion_radio_ble] +extends = + ikoka_stick_nrf_e22_33dbm + ikoka_stick_nrf_companion_radio_ble +build_flags = + ${ikoka_stick_nrf_companion_radio_ble.build_flags} + ${ikoka_stick_nrf_e22_33dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_companion_radio_ble.build_src_filter} + ${ikoka_stick_nrf_e22_33dbm.build_src_filter} + +[env:ikoka_stick_nrf_33dbm_repeater] +extends = + ikoka_stick_nrf_e22_33dbm + ikoka_stick_nrf_repeater +build_flags = + ${ikoka_stick_nrf_repeater.build_flags} + ${ikoka_stick_nrf_e22_33dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_repeater.build_src_filter} + ${ikoka_stick_nrf_e22_33dbm.build_src_filter} + +[env:ikoka_stick_nrf_33dbm_room_server] +extends = + ikoka_stick_nrf_e22_33dbm + ikoka_stick_nrf_room_server +build_flags = + ${ikoka_stick_nrf_room_server.build_flags} + ${ikoka_stick_nrf_e22_33dbm.build_flags} +build_src_filter = + ${ikoka_stick_nrf_room_server.build_src_filter} + ${ikoka_stick_nrf_e22_33dbm.build_src_filter} From 685f75234b3669c6d07ae6ff5f659e36b11edc14 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 24 Aug 2025 13:06:19 +0200 Subject: [PATCH 04/51] let users compile their projects against meshcore as a lib --- build_as_lib.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ library.json | 16 +++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 build_as_lib.py create mode 100644 library.json diff --git a/build_as_lib.py b/build_as_lib.py new file mode 100644 index 00000000..93593cdb --- /dev/null +++ b/build_as_lib.py @@ -0,0 +1,53 @@ +from os.path import join, realpath, exists +import shutil, os + +Import("env") + +platform_stm32=False +platform_esp32=False +platform_nrf52=False +platform_rp2040=False + +src_filter = [] +src_filter.append("+<*>") +src_filter.append("-") # don't build with ui for now ... + +for item in env.get("CPPDEFINES", []): + if isinstance(item, str) and item == "STM32_PLATFORM": + # add STM32 specific sources + env.Append(CPPPATH=[realpath("src/helpers/stm32")]) + platform_stm32=True + env.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) + elif isinstance(item, str) and item == "ESP32": + platform_esp32=True + env.Append(CPPPATH=[realpath("src/helpers/esp32")]) + env.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) + elif isinstance(item, str) and item == "WIO_E5_DEV_VARIANT": + env.Append(BUILD_FLAGS=["-I variants/wio-e5-dev"]) + src_filter.append("+<../variants/wio-e5-dev>") + elif isinstance(item, str) and item == "RAK_3X72_VARIANT": + env.Append(BUILD_FLAGS=["-I variants/rak3x72"]) + src_filter.append("+<../variants/rak3x72>") + elif isinstance(item, str) and item == "XIAO_S3_WIO_VARIANT": + env.Append(BUILD_FLAGS=["-I variants/xiao_s3_wio"]) + src_filter.append("+<../variants/xiao_s3_wio>") + elif isinstance(item, str) and item == "XIAO_C6_VARIANT": + env.Append(BUILD_FLAGS=["-I variants/xiao_c6"]) + src_filter.append("+<../variants/xiao_c6>") + elif isinstance(item, str) and item == "GENERIC_ESPNOW_VARIANT": + env.Append(BUILD_FLAGS=["-I variants/generic_espnow"]) + src_filter.append("+<../variants/generic_espnow>") + src_filter.append("+") + +if not platform_stm32: + src_filter.append("-") +if not platform_esp32: + src_filter.append("-") +if not platform_nrf52: + src_filter.append("-") +if not platform_rp2040: + src_filter.append("-") + +env.Replace(SRC_FILTER=src_filter) + +print (env.Dump()) diff --git a/library.json b/library.json new file mode 100644 index 00000000..982983a3 --- /dev/null +++ b/library.json @@ -0,0 +1,16 @@ +{ + "name": "MeshCore", + "version" : "1.7.4", + "dependencies": { + "SPI": "*", + "Wire": "*", + "jgromes/RadioLib": "^7.1.2", + "rweather/Crypto": "^0.4.0", + "adafruit/RTClib": "^2.1.3", + "melopero/Melopero RV3028": "^1.1.0", + "electroniccats/CayenneLPP": "1.4.0" + }, + "build": { + "extraScript": "build_as_lib.py" + } +} \ No newline at end of file From 228bac0add4f3cf175fee950a7e9b76ff006a7b6 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 24 Aug 2025 13:09:55 +0200 Subject: [PATCH 05/51] simplify src_filter creation --- build_as_lib.py | 67 ++++++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/build_as_lib.py b/build_as_lib.py index 93593cdb..f3410625 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -1,53 +1,30 @@ -from os.path import join, realpath, exists -import shutil, os +from os.path import realpath -Import("env") +Import("env") # type: ignore +menv=env # type: ignore -platform_stm32=False -platform_esp32=False -platform_nrf52=False -platform_rp2040=False +src_filter = [ + '+<*.cpp>', + '+', + '+', + '+', +] -src_filter = [] -src_filter.append("+<*>") -src_filter.append("-") # don't build with ui for now ... - -for item in env.get("CPPDEFINES", []): +for item in menv.get("CPPDEFINES", []): if isinstance(item, str) and item == "STM32_PLATFORM": # add STM32 specific sources - env.Append(CPPPATH=[realpath("src/helpers/stm32")]) - platform_stm32=True - env.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) + menv.Append(CPPPATH=[realpath("src/helpers/stm32")]) + menv.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) + src_filter.append("+") elif isinstance(item, str) and item == "ESP32": - platform_esp32=True - env.Append(CPPPATH=[realpath("src/helpers/esp32")]) - env.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) - elif isinstance(item, str) and item == "WIO_E5_DEV_VARIANT": - env.Append(BUILD_FLAGS=["-I variants/wio-e5-dev"]) - src_filter.append("+<../variants/wio-e5-dev>") - elif isinstance(item, str) and item == "RAK_3X72_VARIANT": - env.Append(BUILD_FLAGS=["-I variants/rak3x72"]) - src_filter.append("+<../variants/rak3x72>") - elif isinstance(item, str) and item == "XIAO_S3_WIO_VARIANT": - env.Append(BUILD_FLAGS=["-I variants/xiao_s3_wio"]) - src_filter.append("+<../variants/xiao_s3_wio>") - elif isinstance(item, str) and item == "XIAO_C6_VARIANT": - env.Append(BUILD_FLAGS=["-I variants/xiao_c6"]) - src_filter.append("+<../variants/xiao_c6>") - elif isinstance(item, str) and item == "GENERIC_ESPNOW_VARIANT": - env.Append(BUILD_FLAGS=["-I variants/generic_espnow"]) - src_filter.append("+<../variants/generic_espnow>") - src_filter.append("+") + menv.Append(CPPPATH=[realpath("src/helpers/esp32")]) + menv.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) + src_filter.append("+") + elif isinstance(item, tuple) and item[0] == "MC_VARIANT": + variant_name = item[1] + menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) + src_filter.append(f"+<../variants/{variant_name}>") -if not platform_stm32: - src_filter.append("-") -if not platform_esp32: - src_filter.append("-") -if not platform_nrf52: - src_filter.append("-") -if not platform_rp2040: - src_filter.append("-") +menv.Replace(SRC_FILTER=src_filter) -env.Replace(SRC_FILTER=src_filter) - -print (env.Dump()) +#print (menv.Dump()) From b88a360adab85851cfab4bdcc732ee82f7b521be Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 24 Aug 2025 14:47:03 +0200 Subject: [PATCH 06/51] lib_build: add nrf52 and RP2040 --- build_as_lib.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/build_as_lib.py b/build_as_lib.py index f3410625..da4337c0 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -6,20 +6,39 @@ menv=env # type: ignore src_filter = [ '+<*.cpp>', '+', + '+' '+', '+', ] +# add build and include dirs according to CPPDEFINES for item in menv.get("CPPDEFINES", []): + + # STM32 if isinstance(item, str) and item == "STM32_PLATFORM": - # add STM32 specific sources menv.Append(CPPPATH=[realpath("src/helpers/stm32")]) menv.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) src_filter.append("+") + + # ESP32 elif isinstance(item, str) and item == "ESP32": menv.Append(CPPPATH=[realpath("src/helpers/esp32")]) menv.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) src_filter.append("+") + + # NRF52 + elif isinstance(item, str) and item == "NRF52_PLATFORM": + menv.Append(CPPPATH=[realpath("src/helpers/nrf52")]) + menv.Append(BUILD_FLAGS=["-I src/helpers/nrf52"]) + src_filter.append("+") + + # RP2040 + elif isinstance(item, str) and item == "RP2040_PLATFORM": + menv.Append(CPPPATH=[realpath("src/helpers/rp2040")]) + menv.Append(BUILD_FLAGS=["-I src/helpers/rp2040"]) + src_filter.append("+") + + # VARIANTS HANDLING elif isinstance(item, tuple) and item[0] == "MC_VARIANT": variant_name = item[1] menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) From bbee057b03ac74dfbbd8f77a6c7f98504efd4a77 Mon Sep 17 00:00:00 2001 From: kelsey hudson Date: Sun, 24 Aug 2025 15:54:05 -0700 Subject: [PATCH 07/51] Station G2: Adds repeater variant with packet logging on Adds a variant to Station G2 which turns on mesh packet logging to serial. Useful for telemetry logging. Sites such as map.w0z.is depend on this functionality. --- variants/station_g2/platformio.ini | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/variants/station_g2/platformio.ini b/variants/station_g2/platformio.ini index 3ed73f43..756ff5f3 100644 --- a/variants/station_g2/platformio.ini +++ b/variants/station_g2/platformio.ini @@ -45,6 +45,25 @@ lib_deps = ${Station_G2.lib_deps} ${esp32_ota.lib_deps} +[env:Station_G2_logging_repeater] +extends = Station_G2 +build_flags = + ${Station_G2.build_flags} + -D ADVERT_NAME='"Station G2 Logging Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=8 + -D MESH_PACKET_LOGGING=1 + -D SX126X_RX_BOOSTED_GAIN=1 +; https://wiki.uniteng.com/en/meshtastic/station-g2#impact-of-lora-node-dense-areashigh-noise-environments-on-rf-performance +; -D MESH_DEBUG=1 +build_src_filter = ${Station_G2.build_src_filter} + +<../examples/simple_repeater> +lib_deps = + ${Station_G2.lib_deps} + ${esp32_ota.lib_deps} + [env:Station_G2_room_server] extends = Station_G2 build_src_filter = ${Station_G2.build_src_filter} From d0fb8d2f30c43ce415c68094d454a5d3f0ef0201 Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 25 Aug 2025 12:11:39 +0200 Subject: [PATCH 08/51] lib_build: support display --- build_as_lib.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build_as_lib.py b/build_as_lib.py index da4337c0..43e06fdd 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -6,11 +6,13 @@ menv=env # type: ignore src_filter = [ '+<*.cpp>', '+', - '+' + '+', '+', '+', ] +use_display = False + # add build and include dirs according to CPPDEFINES for item in menv.get("CPPDEFINES", []): @@ -38,12 +40,25 @@ for item in menv.get("CPPDEFINES", []): menv.Append(BUILD_FLAGS=["-I src/helpers/rp2040"]) src_filter.append("+") + # DISPLAY HANDLING + elif isinstance(item, tuple) and item[0] == "DISPLAY_CLASS": + display_class = item[1] + use_display = True + src_filter.append(f"+") + if (display_class == "ST7789Display") : + src_filter.append(f"+") + src_filter.append(f"+") + # VARIANTS HANDLING elif isinstance(item, tuple) and item[0] == "MC_VARIANT": variant_name = item[1] menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) src_filter.append(f"+<../variants/{variant_name}>") +if use_display : + menv.Append(CPPPATH=[realpath("src/helpers/ui")]) + menv.Append(BUILD_FLAGS=["-I src/helpers/ui"]) + menv.Replace(SRC_FILTER=src_filter) #print (menv.Dump()) From 2d5016bac3f2871cff8af730f3ff46998b1518a9 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Mon, 25 Aug 2025 23:45:50 +1200 Subject: [PATCH 09/51] add ability to remove neighbour via cli --- examples/simple_repeater/main.cpp | 11 +++++++++++ src/helpers/CommonCLI.cpp | 11 +++++++++++ src/helpers/CommonCLI.h | 1 + 3 files changed, 23 insertions(+) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 622a0554..ea3f7de6 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -719,6 +719,17 @@ public: *dp = 0; // null terminator } + void removeNeighbor(const uint8_t* pubkey, int key_len) override { +#if MAX_NEIGHBOURS + for (int i = 0; i < MAX_NEIGHBOURS; i++) { + NeighbourInfo* neighbour = &neighbours[i]; + if(memcmp(neighbour->id.pub_key, pubkey, key_len) == 0){ + neighbours[i] = {}; // clear neighbour entry + } + } +#endif + } + mesh::LocalIdentity& getSelfId() override { return self_id; } void clearStats() override { diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index 2abb4f7c..083fe2b7 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -165,6 +165,17 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch } } else if (memcmp(command, "neighbors", 9) == 0) { _callbacks->formatNeighborsReply(reply); + } else if (memcmp(command, "neighbor.remove ", 16) == 0) { + const char* hex = &command[16]; + uint8_t pubkey[PUB_KEY_SIZE]; + int hex_len = min(strlen(hex), PUB_KEY_SIZE*2); + int pubkey_len = hex_len / 2; + if (mesh::Utils::fromHex(pubkey, pubkey_len, hex)) { + _callbacks->removeNeighbor(pubkey, pubkey_len); + strcpy(reply, "OK"); + } else { + strcpy(reply, "ERR: bad pubkey"); + } } else if (memcmp(command, "tempradio ", 10) == 0) { strcpy(tmp, &command[10]); const char *parts[5]; diff --git a/src/helpers/CommonCLI.h b/src/helpers/CommonCLI.h index 92deb718..3bf71b5a 100644 --- a/src/helpers/CommonCLI.h +++ b/src/helpers/CommonCLI.h @@ -43,6 +43,7 @@ public: virtual void dumpLogFile() = 0; virtual void setTxPower(uint8_t power_dbm) = 0; virtual void formatNeighborsReply(char *reply) = 0; + virtual void removeNeighbor(const uint8_t* pubkey, int key_len) = 0; virtual mesh::LocalIdentity& getSelfId() = 0; virtual void clearStats() = 0; virtual void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) = 0; From 033706adcfbb89e138d35e1fb9fbdb4011eecdcd Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 25 Aug 2025 16:21:23 +0200 Subject: [PATCH 10/51] lib_build: fix ST7789 so we don't have to add helpers/ui in INC_DIRS --- build_as_lib.py | 8 +------- src/helpers/ui/ST7789Display.h | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/build_as_lib.py b/build_as_lib.py index 43e06fdd..59091556 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -9,10 +9,9 @@ src_filter = [ '+', '+', '+', + '+', ] -use_display = False - # add build and include dirs according to CPPDEFINES for item in menv.get("CPPDEFINES", []): @@ -43,7 +42,6 @@ for item in menv.get("CPPDEFINES", []): # DISPLAY HANDLING elif isinstance(item, tuple) and item[0] == "DISPLAY_CLASS": display_class = item[1] - use_display = True src_filter.append(f"+") if (display_class == "ST7789Display") : src_filter.append(f"+") @@ -55,10 +53,6 @@ for item in menv.get("CPPDEFINES", []): menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) src_filter.append(f"+<../variants/{variant_name}>") -if use_display : - menv.Append(CPPPATH=[realpath("src/helpers/ui")]) - menv.Append(BUILD_FLAGS=["-I src/helpers/ui"]) - menv.Replace(SRC_FILTER=src_filter) #print (menv.Dump()) diff --git a/src/helpers/ui/ST7789Display.h b/src/helpers/ui/ST7789Display.h index 8056de81..0f06da4c 100644 --- a/src/helpers/ui/ST7789Display.h +++ b/src/helpers/ui/ST7789Display.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include "ST7789Spi.h" class ST7789Display : public DisplayDriver { ST7789Spi display; From 15249bb8d5edde15ada5710cb4b6bd34711e3cc6 Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 25 Aug 2025 17:50:48 +0200 Subject: [PATCH 11/51] lib_build: include example code in build --- build_as_lib.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_as_lib.py b/build_as_lib.py index 59091556..910c58fe 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -52,6 +52,11 @@ for item in menv.get("CPPDEFINES", []): variant_name = item[1] menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) src_filter.append(f"+<../variants/{variant_name}>") + + # INCLUDE EXAMPLE CODE IN BUILD (to provide your own support files without touching the tree) + elif isinstance(item, tuple) and item[0] == "BUILD_EXAMPLE": + example_name = item[1] + src_filter.append(f"+<../examples/{example_name}>") menv.Replace(SRC_FILTER=src_filter) From df18dfb48105fd71efd4ee26525aec6af46f5cc5 Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 25 Aug 2025 18:34:50 +0200 Subject: [PATCH 12/51] lib_build: exclude file from example --- build_as_lib.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_as_lib.py b/build_as_lib.py index 910c58fe..4e8eea57 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -58,6 +58,11 @@ for item in menv.get("CPPDEFINES", []): example_name = item[1] src_filter.append(f"+<../examples/{example_name}>") + # EXCLUDE A SOURCE FILE FROM AN EXAMPLE (must be placed after example name or boom) + elif isinstance(item, tuple) and item[0] == "EXCLUDE_FROM_EXAMPLE": + exclude_name = item[1] + src_filter.append(f"-<../examples/{example_name}/{exclude_name}>") + menv.Replace(SRC_FILTER=src_filter) #print (menv.Dump()) From 78fcb704bc30f43046af0ecfb31dfaf2dbafa8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Br=C3=A1zio?= Date: Mon, 25 Aug 2025 17:44:14 +0100 Subject: [PATCH 13/51] Increase power limit for Heltec v3 433 MHz --- variants/heltec_v3/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index b9193431..24bc0bf0 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -17,7 +17,7 @@ build_flags = -D PIN_VEXT_EN=36 -D SX126X_DIO2_AS_RF_SWITCH=true -D SX126X_DIO3_TCXO_VOLTAGE=1.8 - -D SX126X_CURRENT_LIMIT=140 + -D SX126X_CURRENT_LIMIT=160 -D SX126X_RX_BOOSTED_GAIN=1 -D PIN_GPS_RX=47 -D PIN_GPS_TX=48 From a16e011bd21cf3070f04b3513d562add0d090838 Mon Sep 17 00:00:00 2001 From: Laura J Date: Mon, 25 Aug 2025 22:10:18 -0700 Subject: [PATCH 14/51] modified T114 code to disable many unused peripherals, and set up the LOWPWR power mode. all changes should be quite safe, but testing for a couple days just in case. --- src/helpers/nrf52/T114Board.cpp | 39 +++++++++++++++++++++++++++++++++ src/helpers/nrf52/T114Board.h | 5 +++++ 2 files changed, 44 insertions(+) diff --git a/src/helpers/nrf52/T114Board.cpp b/src/helpers/nrf52/T114Board.cpp index 1f8c5854..78c21b33 100644 --- a/src/helpers/nrf52/T114Board.cpp +++ b/src/helpers/nrf52/T114Board.cpp @@ -26,6 +26,45 @@ void T114Board::begin() { pinMode(PIN_VBAT_READ, INPUT); + // Enable SoftDevice low-power mode + sd_power_mode_set(NRF_POWER_MODE_LOWPWR); + + // Enable DC/DC converter for better efficiency (REG1 stage) + NRF_POWER->DCDCEN = 1; + + // Power down unused communication peripherals + // UART1 - Not used on T114 + NRF_UARTE1->ENABLE = 0; + + // SPIM2/SPIS2 - Not used (SPI is on SPIM0) + NRF_SPIM2->ENABLE = 0; + NRF_SPIS2->ENABLE = 0; + + // TWI1 (I2C1) - Not used (I2C is on TWI0) + NRF_TWIM1->ENABLE = 0; + NRF_TWIS1->ENABLE = 0; + + // PWM modules - Not used for standard T114 functions + NRF_PWM1->ENABLE = 0; + NRF_PWM2->ENABLE = 0; + NRF_PWM3->ENABLE = 0; + + // PDM (Digital Microphone Interface) - Not used + NRF_PDM->ENABLE = 0; + + // I2S - Not used + NRF_I2S->ENABLE = 0; + + // QSPI - Not used (no external flash) + NRF_QSPI->ENABLE = 0; + + // Disable unused analog peripherals + // SAADC channels - only keep what's needed for battery monitoring + NRF_SAADC->ENABLE = 0; // Re-enable only when needed for measurements + + // COMP - Comparator not used + NRF_COMP->ENABLE = 0; + #if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL) Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL); #endif diff --git a/src/helpers/nrf52/T114Board.h b/src/helpers/nrf52/T114Board.h index cd58134d..cf345937 100644 --- a/src/helpers/nrf52/T114Board.h +++ b/src/helpers/nrf52/T114Board.h @@ -40,6 +40,9 @@ public: uint16_t getBattMilliVolts() override { int adcvalue = 0; + + NRF_SAADC->ENABLE = 1; + analogReadResolution(12); analogReference(AR_INTERNAL_3_0); pinMode(PIN_BAT_CTL, OUTPUT); // battery adc can be read only ctrl pin 6 set to high @@ -49,6 +52,8 @@ public: adcvalue = analogRead(PIN_VBAT_READ); digitalWrite(6, 0); + NRF_SAADC->ENABLE = 0; + return (uint16_t)((float)adcvalue * MV_LSB * 4.9); } From 0959e64d1133ee99e863c789a5cc15a43ea126d2 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 26 Aug 2025 13:28:42 +0200 Subject: [PATCH 15/51] lib_build: add UI_FLAVOR and some cleanup --- build_as_lib.py | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/build_as_lib.py b/build_as_lib.py index 4e8eea57..d8e95378 100644 --- a/build_as_lib.py +++ b/build_as_lib.py @@ -15,28 +15,14 @@ src_filter = [ # add build and include dirs according to CPPDEFINES for item in menv.get("CPPDEFINES", []): - # STM32 - if isinstance(item, str) and item == "STM32_PLATFORM": - menv.Append(CPPPATH=[realpath("src/helpers/stm32")]) - menv.Append(BUILD_FLAGS=["-I src/helpers/stm32"]) + # PLATFORM HANDLING + if item == "STM32_PLATFORM": src_filter.append("+") - - # ESP32 - elif isinstance(item, str) and item == "ESP32": - menv.Append(CPPPATH=[realpath("src/helpers/esp32")]) - menv.Append(BUILD_FLAGS=["-I src/helpers/esp32"]) + elif item == "ESP32": src_filter.append("+") - - # NRF52 - elif isinstance(item, str) and item == "NRF52_PLATFORM": - menv.Append(CPPPATH=[realpath("src/helpers/nrf52")]) - menv.Append(BUILD_FLAGS=["-I src/helpers/nrf52"]) + elif item == "NRF52_PLATFORM": src_filter.append("+") - - # RP2040 - elif isinstance(item, str) and item == "RP2040_PLATFORM": - menv.Append(CPPPATH=[realpath("src/helpers/rp2040")]) - menv.Append(BUILD_FLAGS=["-I src/helpers/rp2040"]) + elif item == "RP2040_PLATFORM": src_filter.append("+") # DISPLAY HANDLING @@ -50,19 +36,29 @@ for item in menv.get("CPPDEFINES", []): # VARIANTS HANDLING elif isinstance(item, tuple) and item[0] == "MC_VARIANT": variant_name = item[1] - menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"]) src_filter.append(f"+<../variants/{variant_name}>") # INCLUDE EXAMPLE CODE IN BUILD (to provide your own support files without touching the tree) elif isinstance(item, tuple) and item[0] == "BUILD_EXAMPLE": example_name = item[1] - src_filter.append(f"+<../examples/{example_name}>") + src_filter.append(f"+<../examples/{example_name}/*.cpp>") # EXCLUDE A SOURCE FILE FROM AN EXAMPLE (must be placed after example name or boom) elif isinstance(item, tuple) and item[0] == "EXCLUDE_FROM_EXAMPLE": exclude_name = item[1] + if example_name is None: + print("***** PLEASE DEFINE EXAMPLE FIRST *****") + break src_filter.append(f"-<../examples/{example_name}/{exclude_name}>") + # DEAL WITH UI VARIANT FOR AN EXAMPLE + elif isinstance(item, tuple) and item[0] == "MC_UI_FLAVOR": + ui_flavor = item[1] + if example_name is None: + print("***** PLEASE DEFINE EXAMPLE FIRST *****") + break + src_filter.append(f"+<../examples/{example_name}/{ui_flavor}/*.cpp>") + menv.Replace(SRC_FILTER=src_filter) #print (menv.Dump()) From 6536e9931d82faaf129bfd716777c951a45b9a6e Mon Sep 17 00:00:00 2001 From: ave Date: Tue, 26 Aug 2025 21:30:56 +0200 Subject: [PATCH 16/51] add why2025 badge as a target --- variants/xiao_c6/platformio.ini | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/variants/xiao_c6/platformio.ini b/variants/xiao_c6/platformio.ini index fdf0f337..602bd6ae 100644 --- a/variants/xiao_c6/platformio.ini +++ b/variants/xiao_c6/platformio.ini @@ -121,3 +121,65 @@ build_src_filter = ${Meshimi.build_src_filter} lib_deps = ${Meshimi.lib_deps} densaugeo/base64 @ ~1.4.0 + +; WHY2025 badge variant +; requires soldering 2 pins between the esp32-C6 and the lora chip as shown here: https://wiki.why2025.org/Project:Meshtastic_on_the_WHY2025_badge +; also requires wiping the esp32-P4 +[WHY2025_badge] +extends = Xiao_C6 +board_build.partitions = default_8MB.csv +board_upload.flash_size = 8MB +board_upload.maximum_size = 8388608 +build_flags = + ${Xiao_C6.build_flags} + -D P_LORA_SCLK=6 + -D P_LORA_MISO=2 + -D P_LORA_MOSI=7 + -D P_LORA_NSS=4 + -D P_LORA_DIO_1=5 + -D P_LORA_BUSY=11 + -D P_LORA_RESET=1 + -D SX126X_TXEN=3 + -UPIN_BOARD_SDA + -UPIN_BOARD_SCL + -UP_LORA_TX_LED + -USX126X_RXEN + -USX126X_DIO2_AS_RF_SWITCH + -USX126X_DIO3_TCXO_VOLTAGE + +[env:WHY2025_badge_Repeater] +extends = WHY2025_badge +build_src_filter = ${WHY2025_badge.build_src_filter} + +<../examples/simple_repeater/main.cpp> +build_flags = + ${WHY2025_badge.build_flags} + -D ADVERT_NAME='"WHY2025 Badge Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=8 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +lib_deps = + ${WHY2025_badge.lib_deps} +; ${esp32_ota.lib_deps} + +[env:WHY2025_badge_companion_radio_ble] +extends = WHY2025_badge +build_flags = ${WHY2025_badge.build_flags} + -D MAX_CONTACTS=100 + -D MAX_GROUP_CHANNELS=8 + -D BLE_PIN_CODE=123456 + -D BLE_DEBUG_LOGGING=1 + -D OFFLINE_QUEUE_SIZE=256 + -D ENABLE_PRIVATE_KEY_IMPORT=1 + -D ENABLE_PRIVATE_KEY_EXPORT=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${WHY2025_badge.build_src_filter} + + + - + +<../examples/companion_radio/*.cpp> +lib_deps = + ${WHY2025_badge.lib_deps} + densaugeo/base64 @ ~1.4.0 From c10b387e6338c0dfb9439b00c0d7d442a39e7542 Mon Sep 17 00:00:00 2001 From: 446564 Date: Wed, 27 Aug 2025 10:30:56 -0700 Subject: [PATCH 17/51] add remaining roles to t1000e usb companion, repeater and room server --- variants/t1000-e/platformio.ini | 63 ++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/variants/t1000-e/platformio.ini b/variants/t1000-e/platformio.ini index 2811e243..c555a735 100644 --- a/variants/t1000-e/platformio.ini +++ b/variants/t1000-e/platformio.ini @@ -34,6 +34,67 @@ build_src_filter = ${nrf52840_t1000e.build_src_filter} debug_tool = jlink upload_protocol = nrfutil +[env:t1000e_repeater] +extends = t1000-e +build_flags = ${t1000-e.build_flags} + -I examples/companion_radio/ui-orig + -D ADVERT_NAME='"t1000-e Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=8 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 + -D RX_BOOSTED_GAIN=true + -D RF_SWITCH_TABLE + -D DISPLAY_CLASS=NullDisplayDriver +build_src_filter = ${t1000-e.build_src_filter} + +<../examples/simple_repeater> +lib_deps = ${t1000-e.lib_deps} + stevemarple/MicroNMEA @ ^2.0.6 + +[env:t1000e_room_server] +extends = t1000-e +build_flags = ${t1000-e.build_flags} + -I examples/companion_radio/ui-orig + -D ADVERT_NAME='"t1000-e Room"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D ROOM_PASSWORD='"hello"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 + -D RX_BOOSTED_GAIN=true + -D RF_SWITCH_TABLE + -D DISPLAY_CLASS=NullDisplayDriver +build_src_filter = ${t1000-e.build_src_filter} + +<../examples/simple_room_server> +lib_deps = ${t1000-e.lib_deps} + stevemarple/MicroNMEA @ ^2.0.6 + +[env:t1000e_companion_radio_usb] +extends = t1000-e +build_flags = ${t1000-e.build_flags} + -I examples/companion_radio/ui-orig + -D MAX_CONTACTS=100 + -D MAX_GROUP_CHANNELS=8 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 + -D OFFLINE_QUEUE_SIZE=256 + -D RX_BOOSTED_GAIN=true + -D RF_SWITCH_TABLE + -D DISPLAY_CLASS=NullDisplayDriver + -D PIN_BUZZER=25 + -D PIN_BUZZER_EN=37 ; P1/5 - required for T1000-E +build_src_filter = ${t1000-e.build_src_filter} + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-orig/*.cpp> +lib_deps = ${t1000-e.lib_deps} + densaugeo/base64 @ ~1.4.0 + stevemarple/MicroNMEA @ ^2.0.6 + end2endzone/NonBlockingRTTTL@^1.3.0 + [env:t1000e_companion_radio_ble] extends = t1000-e build_flags = ${t1000-e.build_flags} @@ -58,4 +119,4 @@ build_src_filter = ${t1000-e.build_src_filter} lib_deps = ${t1000-e.lib_deps} densaugeo/base64 @ ~1.4.0 stevemarple/MicroNMEA @ ^2.0.6 - end2endzone/NonBlockingRTTTL@^1.3.0 \ No newline at end of file + end2endzone/NonBlockingRTTTL@^1.3.0 From 136f733df52c8e3e801fec5534261fa42357f17d Mon Sep 17 00:00:00 2001 From: Florent Date: Wed, 27 Aug 2025 21:19:12 +0200 Subject: [PATCH 18/51] SensorMesh: add the possibility to receive msgs from admin --- examples/simple_sensor/SensorMesh.cpp | 99 +++++++++++++++++++-------- examples/simple_sensor/SensorMesh.h | 3 +- 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/examples/simple_sensor/SensorMesh.cpp b/examples/simple_sensor/SensorMesh.cpp index ce36e0c2..ad295501 100644 --- a/examples/simple_sensor/SensorMesh.cpp +++ b/examples/simple_sensor/SensorMesh.cpp @@ -613,6 +613,23 @@ void SensorMesh::getPeerSharedSecret(uint8_t* dest_secret, int peer_idx) { } } +void SensorMesh::sendAckTo(const ContactInfo& dest, uint32_t ack_hash) { + if (dest.out_path_len < 0) { + mesh::Packet* ack = createAck(ack_hash); + if (ack) sendFlood(ack, TXT_ACK_DELAY); + } else { + uint32_t d = TXT_ACK_DELAY; + if (getExtraAckTransmitCount() > 0) { + mesh::Packet* a1 = createMultiAck(ack_hash, 1); + if (a1) sendDirect(a1, dest.out_path, dest.out_path_len, d); + d += 300; + } + + mesh::Packet* a2 = createAck(ack_hash); + if (a2) sendDirect(a2, dest.out_path, dest.out_path_len, d); + } +} + void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) { int i = matching_peer_indexes[sender_idx]; if (i < 0 || i >= num_contacts) { @@ -656,38 +673,55 @@ void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_i memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong) uint flags = (data[4] >> 2); // message attempt number, and other flags - if (!(flags == TXT_TYPE_CLI_DATA)) { - MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported text type received: flags=%02x", (uint32_t)flags); - } else if (sender_timestamp > from.last_timestamp) { // prevent replay attacks - from.last_timestamp = sender_timestamp; - from.last_activity = getRTCClock()->getCurrentTime(); + if (sender_timestamp > from.last_timestamp) { // prevent replay attacks + if (flags == TXT_TYPE_PLAIN) { + bool handled = handleIncomingMsg(from, sender_timestamp, &data[5], flags, len - 5); + if (handled) { // if msg was handled then send an ack + uint32_t ack_hash; // calc truncated hash of the message timestamp + text + sender pub_key, to prove to sender that we got it + mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 5 + strlen((char *)&data[5]), from.id.pub_key, PUB_KEY_SIZE); - // len can be > original length, but 'text' will be padded with zeroes - data[len] = 0; // need to make a C string again, with null terminator - - uint8_t temp[166]; - char *command = (char *) &data[5]; - char *reply = (char *) &temp[5]; - handleCommand(sender_timestamp, command, reply); - - int text_len = strlen(reply); - if (text_len > 0) { - uint32_t timestamp = getRTCClock()->getCurrentTimeUnique(); - if (timestamp == sender_timestamp) { - // WORKAROUND: the two timestamps need to be different, in the CLI view - timestamp++; - } - memcpy(temp, ×tamp, 4); // mostly an extra blob to help make packet_hash unique - temp[4] = (TXT_TYPE_CLI_DATA << 2); - - auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, from.id, secret, temp, 5 + text_len); - if (reply) { - if (from.out_path_len < 0) { - sendFlood(reply, CLI_REPLY_DELAY_MILLIS); + if (packet->isRouteFlood()) { + // let this sender know path TO here, so they can use sendDirect(), and ALSO encode the ACK + mesh::Packet* path = createPathReturn(from.id, secret, packet->path, packet->path_len, + PAYLOAD_TYPE_ACK, (uint8_t *) &ack_hash, 4); + if (path) sendFlood(path, TXT_ACK_DELAY); } else { - sendDirect(reply, from.out_path, from.out_path_len, CLI_REPLY_DELAY_MILLIS); + sendAckTo(from, ack_hash); + } + } + } else if (flags == TXT_TYPE_CLI_DATA) { + from.last_timestamp = sender_timestamp; + from.last_activity = getRTCClock()->getCurrentTime(); + + // len can be > original length, but 'text' will be padded with zeroes + data[len] = 0; // need to make a C string again, with null terminator + + uint8_t temp[166]; + char *command = (char *) &data[5]; + char *reply = (char *) &temp[5]; + handleCommand(sender_timestamp, command, reply); + + int text_len = strlen(reply); + if (text_len > 0) { + uint32_t timestamp = getRTCClock()->getCurrentTimeUnique(); + if (timestamp == sender_timestamp) { + // WORKAROUND: the two timestamps need to be different, in the CLI view + timestamp++; + } + memcpy(temp, ×tamp, 4); // mostly an extra blob to help make packet_hash unique + temp[4] = (TXT_TYPE_CLI_DATA << 2); + + auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, from.id, secret, temp, 5 + text_len); + if (reply) { + if (from.out_path_len < 0) { + sendFlood(reply, CLI_REPLY_DELAY_MILLIS); + } else { + sendDirect(reply, from.out_path, from.out_path_len, CLI_REPLY_DELAY_MILLIS); + } } } + } else { + MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported text type received: flags=%02x", (uint32_t)flags); } } else { MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected"); @@ -695,6 +729,15 @@ void SensorMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_i } } +bool SensorMesh::handleIncomingMsg(ContactInfo& from, uint32_t timestamp, uint8_t* data, uint flags, size_t len) { + MESH_DEBUG_PRINT("handleIncomingMsg: unhandled msg from "); + #ifdef MESH_DEBUG + mesh::Utils::printHex(Serial, from.id.pub_key, PUB_KEY_SIZE); + Serial.printf(": %s\n", data); + #endif + return false; +} + bool SensorMesh::onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) { int i = matching_peer_indexes[sender_idx]; if (i < 0 || i >= num_contacts) { diff --git a/examples/simple_sensor/SensorMesh.h b/examples/simple_sensor/SensorMesh.h index 0d87617b..62c1867e 100644 --- a/examples/simple_sensor/SensorMesh.h +++ b/examples/simple_sensor/SensorMesh.h @@ -140,7 +140,8 @@ protected: void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override; bool onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override; void onAckRecv(mesh::Packet* packet, uint32_t ack_crc) override; - + virtual bool handleIncomingMsg(ContactInfo& from, uint32_t timestamp, uint8_t* data, uint flags, size_t len); + void sendAckTo(const ContactInfo& dest, uint32_t ack_hash); private: FILESYSTEM* _fs; unsigned long next_local_advert, next_flood_advert; From 666b036d3dd83c715d1bf5d76fb73d72d740c922 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 28 Aug 2025 14:03:20 +0800 Subject: [PATCH 19/51] Adapt the new UI for heltec paper. --- variants/heltec_wireless_paper/platformio.ini | 5 ++++- variants/heltec_wireless_paper/target.cpp | 1 + variants/heltec_wireless_paper/target.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index b0c9ed1d..bc3168e9 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -29,6 +29,7 @@ build_flags = -D WIRELESS_PAPER build_src_filter = ${esp32_base.build_src_filter} +<../variants/heltec_wireless_paper> + + lib_deps = ${esp32_base.lib_deps} https://github.com/todd-herbert/heltec-eink-modules/archive/9207eb6ab2b96f66298e0488740218c17b006af7.zip @@ -37,6 +38,7 @@ lib_deps = extends = Heltec_Wireless_Paper_base build_flags = ${Heltec_Wireless_Paper_base.build_flags} + -I examples/companion_radio/ui-new -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=E213Display @@ -46,7 +48,8 @@ build_flags = build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter} + + - +<../examples/companion_radio> + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Heltec_Wireless_Paper_base.lib_deps} densaugeo/base64 @ ~1.4.0 diff --git a/variants/heltec_wireless_paper/target.cpp b/variants/heltec_wireless_paper/target.cpp index d434b241..dd2d51c0 100644 --- a/variants/heltec_wireless_paper/target.cpp +++ b/variants/heltec_wireless_paper/target.cpp @@ -19,6 +19,7 @@ SensorManager sensors; #ifdef DISPLAY_CLASS DISPLAY_CLASS display; +MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #endif bool radio_init() { diff --git a/variants/heltec_wireless_paper/target.h b/variants/heltec_wireless_paper/target.h index cb95905c..65b972d0 100644 --- a/variants/heltec_wireless_paper/target.h +++ b/variants/heltec_wireless_paper/target.h @@ -9,6 +9,7 @@ #include #ifdef DISPLAY_CLASS #include +#include #endif extern HeltecV3Board board; @@ -18,6 +19,7 @@ extern SensorManager sensors; #ifdef DISPLAY_CLASS extern DISPLAY_CLASS display; +extern MomentaryButton user_btn; #endif bool radio_init(); From 141579214104ab7123dfd4f405917a7bb1f4f336 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 28 Aug 2025 14:29:56 +0800 Subject: [PATCH 20/51] Adapt the new UI for heltec e213. --- variants/heltec_vision_master_e213/platformio.ini | 8 ++++++-- variants/heltec_vision_master_e213/target.cpp | 1 + variants/heltec_vision_master_e213/target.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 29611dfa..6eb7e69a 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -28,7 +28,8 @@ build_flags = -D DISP_MOSI=6 -D Vision_Master_E213 build_src_filter = ${esp32_base.build_src_filter} - +<../variants/heltec_vision_master_e213> + +<../variants/heltec_vision_master_e213> + + lib_deps = ${esp32_base.lib_deps} https://github.com/Quency-D/heltec-eink-modules/archive/563dd41fd850a1bc3039b8723da4f3a20fe1c800.zip @@ -37,6 +38,7 @@ lib_deps = extends = Heltec_Vision_Master_E213_base build_flags = ${Heltec_Vision_Master_E213_base.build_flags} + -I examples/companion_radio/ui-new -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=E213Display @@ -46,7 +48,9 @@ build_flags = build_src_filter = ${Heltec_Vision_Master_E213_base.build_src_filter} + + - +<../examples/companion_radio> + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Heltec_Vision_Master_E213_base.lib_deps} densaugeo/base64 @ ~1.4.0 diff --git a/variants/heltec_vision_master_e213/target.cpp b/variants/heltec_vision_master_e213/target.cpp index dfba0103..23561850 100644 --- a/variants/heltec_vision_master_e213/target.cpp +++ b/variants/heltec_vision_master_e213/target.cpp @@ -19,6 +19,7 @@ SensorManager sensors; #ifdef DISPLAY_CLASS DISPLAY_CLASS display; +MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #endif bool radio_init() { diff --git a/variants/heltec_vision_master_e213/target.h b/variants/heltec_vision_master_e213/target.h index ec113879..9ecdc212 100644 --- a/variants/heltec_vision_master_e213/target.h +++ b/variants/heltec_vision_master_e213/target.h @@ -9,6 +9,7 @@ #include #ifdef DISPLAY_CLASS #include +#include #endif extern HeltecE213Board board; @@ -18,6 +19,7 @@ extern SensorManager sensors; #ifdef DISPLAY_CLASS extern DISPLAY_CLASS display; +extern MomentaryButton user_btn; #endif bool radio_init(); From d5bec3d6a5cc7c10ae65d0ad5b72fceebe5b64de Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 28 Aug 2025 14:36:56 +0800 Subject: [PATCH 21/51] Remove duplicate rows. --- variants/heltec_vision_master_e213/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 6eb7e69a..de5f2417 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -49,7 +49,6 @@ build_src_filter = ${Heltec_Vision_Master_E213_base.build_src_filter} + + +<../examples/companion_radio/*.cpp> - +<../examples/companion_radio/*.cpp> +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Heltec_Vision_Master_E213_base.lib_deps} From 2e49eef3375da12725746efb3f3e60f0767468a5 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 28 Aug 2025 15:00:27 +0800 Subject: [PATCH 22/51] Adapt the new UI for heltec e290. --- variants/heltec_vision_master_e290/platformio.ini | 5 ++++- variants/heltec_vision_master_e290/target.cpp | 1 + variants/heltec_vision_master_e290/target.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index b3ba33be..83d479e1 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -23,6 +23,7 @@ build_flags = -D Vision_Master_E290 build_src_filter = ${esp32_base.build_src_filter} +<../variants/heltec_vision_master_e290> + + lib_deps = ${esp32_base.lib_deps} https://github.com/Quency-D/heltec-eink-modules/archive/563dd41fd850a1bc3039b8723da4f3a20fe1c800.zip @@ -31,6 +32,7 @@ lib_deps = extends = Heltec_Vision_Master_E290_base build_flags = ${Heltec_Vision_Master_E290_base.build_flags} + -I examples/companion_radio/ui-new -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=E290Display @@ -40,7 +42,8 @@ build_flags = build_src_filter = ${Heltec_Vision_Master_E290_base.build_src_filter} + + - +<../examples/companion_radio> + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Heltec_Vision_Master_E290_base.lib_deps} densaugeo/base64 @ ~1.4.0 diff --git a/variants/heltec_vision_master_e290/target.cpp b/variants/heltec_vision_master_e290/target.cpp index 2e897e49..92b02092 100644 --- a/variants/heltec_vision_master_e290/target.cpp +++ b/variants/heltec_vision_master_e290/target.cpp @@ -19,6 +19,7 @@ SensorManager sensors; #ifdef DISPLAY_CLASS DISPLAY_CLASS display; +MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #endif bool radio_init() { diff --git a/variants/heltec_vision_master_e290/target.h b/variants/heltec_vision_master_e290/target.h index 00b27e54..60770112 100644 --- a/variants/heltec_vision_master_e290/target.h +++ b/variants/heltec_vision_master_e290/target.h @@ -9,6 +9,7 @@ #include #ifdef DISPLAY_CLASS #include +#include #endif extern HeltecE290Board board; @@ -18,6 +19,7 @@ extern SensorManager sensors; #ifdef DISPLAY_CLASS extern DISPLAY_CLASS display; +extern MomentaryButton user_btn; #endif bool radio_init(); From ec6d1199003fa471854763d70b0f88159e290b12 Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 28 Aug 2025 17:07:33 +0800 Subject: [PATCH 23/51] Adapt the new UI for heltec t190. --- variants/heltec_vision_master_t190/platformio.ini | 4 +++- variants/heltec_vision_master_t190/target.cpp | 1 + variants/heltec_vision_master_t190/target.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini index 026e1e18..ecf71409 100644 --- a/variants/heltec_vision_master_t190/platformio.ini +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -44,6 +44,7 @@ lib_deps = extends = Heltec_Vision_Master_T190_base build_flags = ${Heltec_Vision_Master_T190_base.build_flags} + -I examples/companion_radio/ui-new -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 ; dynamic, random PIN @@ -51,7 +52,8 @@ build_flags = -D OFFLINE_QUEUE_SIZE=256 build_src_filter = ${Heltec_Vision_Master_T190_base.build_src_filter} + - +<../examples/companion_radio> + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Heltec_Vision_Master_T190_base.lib_deps} densaugeo/base64 @ ~1.4.0 diff --git a/variants/heltec_vision_master_t190/target.cpp b/variants/heltec_vision_master_t190/target.cpp index 9e13d36b..b9357594 100644 --- a/variants/heltec_vision_master_t190/target.cpp +++ b/variants/heltec_vision_master_t190/target.cpp @@ -19,6 +19,7 @@ SensorManager sensors; #ifdef DISPLAY_CLASS DISPLAY_CLASS display; +MomentaryButton user_btn(PIN_USER_BTN, 1000, true); #endif bool radio_init() { diff --git a/variants/heltec_vision_master_t190/target.h b/variants/heltec_vision_master_t190/target.h index 9dfab3d8..8a5fc716 100644 --- a/variants/heltec_vision_master_t190/target.h +++ b/variants/heltec_vision_master_t190/target.h @@ -9,6 +9,7 @@ #include #ifdef DISPLAY_CLASS #include +#include #endif extern HeltecT190Board board; @@ -18,6 +19,7 @@ extern SensorManager sensors; #ifdef DISPLAY_CLASS extern DISPLAY_CLASS display; +extern MomentaryButton user_btn; #endif bool radio_init(); From 3fe2d48a6182c3acc3d55e160bacc10014fdfffa Mon Sep 17 00:00:00 2001 From: Quency-D Date: Thu, 28 Aug 2025 19:20:11 +0800 Subject: [PATCH 24/51] Remove duplicate rows. --- variants/heltec_vision_master_e290/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index 83d479e1..d52dcc0d 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -23,7 +23,6 @@ build_flags = -D Vision_Master_E290 build_src_filter = ${esp32_base.build_src_filter} +<../variants/heltec_vision_master_e290> - + lib_deps = ${esp32_base.lib_deps} https://github.com/Quency-D/heltec-eink-modules/archive/563dd41fd850a1bc3039b8723da4f3a20fe1c800.zip From 789629f5f8a80f4599ab37a52664589179fc3a8b Mon Sep 17 00:00:00 2001 From: 446564 Date: Thu, 28 Aug 2025 08:13:33 -0700 Subject: [PATCH 25/51] remove display class from repeater and room --- variants/t1000-e/platformio.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/t1000-e/platformio.ini b/variants/t1000-e/platformio.ini index c555a735..b1826139 100644 --- a/variants/t1000-e/platformio.ini +++ b/variants/t1000-e/platformio.ini @@ -47,7 +47,6 @@ build_flags = ${t1000-e.build_flags} ; -D MESH_DEBUG=1 -D RX_BOOSTED_GAIN=true -D RF_SWITCH_TABLE - -D DISPLAY_CLASS=NullDisplayDriver build_src_filter = ${t1000-e.build_src_filter} +<../examples/simple_repeater> lib_deps = ${t1000-e.lib_deps} @@ -66,7 +65,6 @@ build_flags = ${t1000-e.build_flags} ; -D MESH_DEBUG=1 -D RX_BOOSTED_GAIN=true -D RF_SWITCH_TABLE - -D DISPLAY_CLASS=NullDisplayDriver build_src_filter = ${t1000-e.build_src_filter} +<../examples/simple_room_server> lib_deps = ${t1000-e.lib_deps} From 13cd849fcd5fa30982fa7459fce52a09cc599105 Mon Sep 17 00:00:00 2001 From: 446564 Date: Thu, 28 Aug 2025 08:37:25 -0700 Subject: [PATCH 26/51] add power off to nano g2 --- variants/nano_g2_ultra/nano-g2.h | 66 +++++++++++++++++--------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/variants/nano_g2_ultra/nano-g2.h b/variants/nano_g2_ultra/nano-g2.h index 884ed7f8..69df0c65 100644 --- a/variants/nano_g2_ultra/nano-g2.h +++ b/variants/nano_g2_ultra/nano-g2.h @@ -1,39 +1,40 @@ #pragma once -#include +#include "variant.h" + #include +#include // LoRa radio module pins -#define P_LORA_DIO_1 (32 + 10) -#define P_LORA_NSS (32 + 13) -#define P_LORA_RESET (32 + 15) -#define P_LORA_BUSY (32 + 11) -#define P_LORA_SCLK (0 + 12) -#define P_LORA_MISO (32 + 9) -#define P_LORA_MOSI (0 + 11) +#define P_LORA_DIO_1 (32 + 10) +#define P_LORA_NSS (32 + 13) +#define P_LORA_RESET (32 + 15) +#define P_LORA_BUSY (32 + 11) +#define P_LORA_SCLK (0 + 12) +#define P_LORA_MISO (32 + 9) +#define P_LORA_MOSI (0 + 11) #define SX126X_DIO2_AS_RF_SWITCH true #define SX126X_DIO3_TCXO_VOLTAGE 1.8 -#define SX126X_POWER_EN 37 +#define SX126X_POWER_EN 37 // buttons -#define PIN_BUTTON1 (32 + 6) -#define BUTTON_PIN PIN_BUTTON1 -#define PIN_USER_BTN BUTTON_PIN +#define PIN_BUTTON1 (32 + 6) +#define BUTTON_PIN PIN_BUTTON1 +#define PIN_USER_BTN BUTTON_PIN // GPS -#define GPS_EN PIN_GPS_STANDBY +#define GPS_EN PIN_GPS_STANDBY // built-ins -#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096 +#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096 -#define VBAT_DIVIDER (0.5F) // 150K + 150K voltage divider on VBAT, actually 100K + 100K -#define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider +#define VBAT_DIVIDER (0.5F) // 150K + 150K voltage divider on VBAT, actually 100K + 100K +#define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider -#define PIN_VBAT_READ (0 + 2) -#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) +#define PIN_VBAT_READ (0 + 2) +#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB) -class NanoG2Ultra : public mesh::MainBoard -{ +class NanoG2Ultra : public mesh::MainBoard { protected: uint8_t startup_reason; @@ -42,18 +43,21 @@ public: uint16_t getBattMilliVolts() override; bool startOTAUpdate(const char *id, char reply[]) override; - uint8_t getStartupReason() const override - { - return startup_reason; - } + uint8_t getStartupReason() const override { return startup_reason; } - const char *getManufacturerName() const override - { - return "Nano G2 Ultra"; - } + const char *getManufacturerName() const override { return "Nano G2 Ultra"; } - void reboot() override - { - NVIC_SystemReset(); + void reboot() override { NVIC_SystemReset(); } + + void powerOff() override { + // put GPS chip to sleep + digitalWrite(PIN_GPS_STANDBY, LOW); +// unset buzzer to prevent notification circuit activating on hibernate +#undef PIN_BUZZER + + nrf_gpio_cfg_sense_input(digitalPinToInterrupt(PIN_USER_BTN), NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_SENSE_LOW); + + sd_power_system_off(); } }; From c49ecc121e4228e35636fedac73c28d791d58084 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 29 Aug 2025 18:08:06 +1200 Subject: [PATCH 27/51] use new instance of neighbour info object when removing neighbour --- examples/simple_repeater/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index ea3f7de6..81c4d455 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -724,7 +724,7 @@ public: for (int i = 0; i < MAX_NEIGHBOURS; i++) { NeighbourInfo* neighbour = &neighbours[i]; if(memcmp(neighbour->id.pub_key, pubkey, key_len) == 0){ - neighbours[i] = {}; // clear neighbour entry + neighbours[i] = NeighbourInfo(); // clear neighbour entry } } #endif From 9ee01520845599a3820f0a1f0eb6ee1e0afe4f7c Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 29 Aug 2025 18:17:01 +1200 Subject: [PATCH 28/51] add default no op implementation for remove neighbor function --- src/helpers/CommonCLI.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/helpers/CommonCLI.h b/src/helpers/CommonCLI.h index 3bf71b5a..d1e49873 100644 --- a/src/helpers/CommonCLI.h +++ b/src/helpers/CommonCLI.h @@ -43,7 +43,9 @@ public: virtual void dumpLogFile() = 0; virtual void setTxPower(uint8_t power_dbm) = 0; virtual void formatNeighborsReply(char *reply) = 0; - virtual void removeNeighbor(const uint8_t* pubkey, int key_len) = 0; + virtual void removeNeighbor(const uint8_t* pubkey, int key_len) { + // no op by default + }; virtual mesh::LocalIdentity& getSelfId() = 0; virtual void clearStats() = 0; virtual void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) = 0; From 09e45f25b7767f5fef653d09fa46e6f285f5afc9 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 29 Aug 2025 18:58:54 +1200 Subject: [PATCH 29/51] add new ui to heltec v3 wifi companion --- variants/heltec_v3/platformio.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index 24bc0bf0..32673b1f 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -129,6 +129,7 @@ lib_deps = extends = Heltec_lora32_v3 build_flags = ${Heltec_lora32_v3.build_flags} + -I examples/companion_radio/ui-new -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=SSD1306Display @@ -141,7 +142,8 @@ build_src_filter = ${Heltec_lora32_v3.build_src_filter} + + + - +<../examples/companion_radio> + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Heltec_lora32_v3.lib_deps} densaugeo/base64 @ ~1.4.0 From 6984d9f496765339d9abf995bd9be032dd0946b4 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Fri, 29 Aug 2025 17:01:39 +1000 Subject: [PATCH 30/51] * minor compilation fix --- src/helpers/CommonCLI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index 083fe2b7..443fcc30 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -168,7 +168,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch } else if (memcmp(command, "neighbor.remove ", 16) == 0) { const char* hex = &command[16]; uint8_t pubkey[PUB_KEY_SIZE]; - int hex_len = min(strlen(hex), PUB_KEY_SIZE*2); + int hex_len = min((int)strlen(hex), PUB_KEY_SIZE*2); int pubkey_len = hex_len / 2; if (mesh::Utils::fromHex(pubkey, pubkey_len, hex)) { _callbacks->removeNeighbor(pubkey, pubkey_len); From 796b4c705c345aed9a15e550c34d653a47fb6f01 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 29 Aug 2025 19:47:24 +1200 Subject: [PATCH 31/51] disconnect existing wifi client when new connection established --- src/helpers/esp32/SerialWifiInterface.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/helpers/esp32/SerialWifiInterface.cpp b/src/helpers/esp32/SerialWifiInterface.cpp index e7dc055e..2df9980a 100644 --- a/src/helpers/esp32/SerialWifiInterface.cpp +++ b/src/helpers/esp32/SerialWifiInterface.cpp @@ -44,7 +44,18 @@ bool SerialWifiInterface::isWriteBusy() const { } size_t SerialWifiInterface::checkRecvFrame(uint8_t dest[]) { - if (!client) client = server.available(); + // check if new client connected + auto newClient = server.available(); + if (newClient) { + + // disconnect existing client + deviceConnected = false; + client.stop(); + + // switch active connection to new client + client = newClient; + + } if (client.connected()) { if (!deviceConnected) { From 4eaaeebfcace926f039f3025c2fc665df6aa1d3f Mon Sep 17 00:00:00 2001 From: Quency-D Date: Fri, 29 Aug 2025 17:12:35 +0800 Subject: [PATCH 32/51] Remove duplicate rows. --- variants/heltec_vision_master_e213/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index de5f2417..9ca9b5ad 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -29,7 +29,6 @@ build_flags = -D Vision_Master_E213 build_src_filter = ${esp32_base.build_src_filter} +<../variants/heltec_vision_master_e213> - + lib_deps = ${esp32_base.lib_deps} https://github.com/Quency-D/heltec-eink-modules/archive/563dd41fd850a1bc3039b8723da4f3a20fe1c800.zip From fee79756684305d3dda3ae61340e62ee473ba8cf Mon Sep 17 00:00:00 2001 From: Quency-D Date: Fri, 29 Aug 2025 17:31:28 +0800 Subject: [PATCH 33/51] Remove duplicate rows. --- variants/heltec_wireless_paper/platformio.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index bc3168e9..adb24676 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -29,7 +29,6 @@ build_flags = -D WIRELESS_PAPER build_src_filter = ${esp32_base.build_src_filter} +<../variants/heltec_wireless_paper> - + lib_deps = ${esp32_base.lib_deps} https://github.com/todd-herbert/heltec-eink-modules/archive/9207eb6ab2b96f66298e0488740218c17b006af7.zip From 5a34bd54604a62384f7a51418b25785b60821f81 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sat, 30 Aug 2025 21:54:46 +1200 Subject: [PATCH 34/51] turn off tx led when powering off --- src/helpers/nrf52/ThinkNodeM1Board.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/helpers/nrf52/ThinkNodeM1Board.h b/src/helpers/nrf52/ThinkNodeM1Board.h index c1ffcbbf..fc752223 100644 --- a/src/helpers/nrf52/ThinkNodeM1Board.h +++ b/src/helpers/nrf52/ThinkNodeM1Board.h @@ -57,6 +57,14 @@ public: } void powerOff() override { + + // turn off all leds, sd_power_system_off will not do this for us + #ifdef P_LORA_TX_LED + digitalWrite(P_LORA_TX_LED, LOW); + #endif + + // power off board sd_power_system_off(); + } }; From 6172537459ce99dbc7a6988f559d58144298ebeb Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sat, 30 Aug 2025 21:56:00 +1200 Subject: [PATCH 35/51] auto shutdown thinknode m1 at 3.3v --- variants/thinknode_m1/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/thinknode_m1/platformio.ini b/variants/thinknode_m1/platformio.ini index fa8cd55b..590f2100 100644 --- a/variants/thinknode_m1/platformio.ini +++ b/variants/thinknode_m1/platformio.ini @@ -77,6 +77,7 @@ build_flags = -D DISPLAY_CLASS=GxEPDDisplay -D OFFLINE_QUEUE_SIZE=256 -D PIN_BUZZER=6 + -D AUTO_SHUTDOWN_MILLIVOLTS=3300 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 build_src_filter = ${ThinkNode_M1.build_src_filter} From 18ef1ba804862aec15c1ab4617dd7cc007ff0cf8 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sat, 30 Aug 2025 23:09:01 +1200 Subject: [PATCH 36/51] add low battery shutdown alert for thinknode m1 --- examples/companion_radio/ui-new/UITask.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 1920dd26..22f394e7 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -551,7 +551,22 @@ void UITask::loop() { if (millis() > next_batt_chck) { uint16_t milliVolts = getBattMilliVolts(); if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) { + + // show low battery shutdown alert + // we should only do this for eink displays, which will persist after power loss + #ifdef THINKNODE_M1 + if (_display != NULL) { + _display->startFrame(); + _display->setTextSize(2); + _display->setColor(DisplayDriver::RED); + _display->drawTextCentered(_display->width() / 2, 20, "Low Battery."); + _display->drawTextCentered(_display->width() / 2, 40, "Shutting Down!"); + _display->endFrame(); + } + #endif + shutdown(); + } next_batt_chck = millis() + 8000; } From 0f23c0120a616d3fae6669dbe1feb0f864eefc4e Mon Sep 17 00:00:00 2001 From: recrof Date: Sun, 31 Aug 2025 12:09:04 +0200 Subject: [PATCH 37/51] fix: migrate meshadventurer to new ui --- variants/meshadventurer/platformio.ini | 10 ++++++++++ variants/meshadventurer/target.cpp | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/variants/meshadventurer/platformio.ini b/variants/meshadventurer/platformio.ini index 60cc55eb..3ea09ba7 100644 --- a/variants/meshadventurer/platformio.ini +++ b/variants/meshadventurer/platformio.ini @@ -82,6 +82,7 @@ build_src_filter = ${Meshadventurer.build_src_filter} + build_flags = ${Meshadventurer.build_flags} + -I examples/companion_radio/ui-new -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper -D LORA_TX_POWER=22 @@ -99,8 +100,11 @@ build_src_filter = ${Meshadventurer.build_src_filter} +<../examples/companion_radio/*.cpp> + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> build_flags = ${Meshadventurer.build_flags} + -I examples/companion_radio/ui-new -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper -D LORA_TX_POWER=22 @@ -159,8 +163,11 @@ extends = Meshadventurer build_src_filter = ${Meshadventurer.build_src_filter} +<../examples/companion_radio/*.cpp> + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> build_flags = ${Meshadventurer.build_flags} + -I examples/companion_radio/ui-new -D RADIO_CLASS=CustomSX1268 -D WRAPPER_CLASS=CustomSX1268Wrapper -D LORA_TX_POWER=22 @@ -178,8 +185,11 @@ build_src_filter = ${Meshadventurer.build_src_filter} +<../examples/companion_radio/*.cpp> + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> build_flags = ${Meshadventurer.build_flags} + -I examples/companion_radio/ui-new -D RADIO_CLASS=CustomSX1268 -D WRAPPER_CLASS=CustomSX1268Wrapper -D LORA_TX_POWER=22 diff --git a/variants/meshadventurer/target.cpp b/variants/meshadventurer/target.cpp index a1d6dcad..cabcee58 100644 --- a/variants/meshadventurer/target.cpp +++ b/variants/meshadventurer/target.cpp @@ -18,10 +18,6 @@ MASensorManager sensors = MASensorManager(nmea); DISPLAY_CLASS display; #endif -#ifndef LORA_CR - #define LORA_CR 5 -#endif - bool radio_init() { fallback_clock.begin(); rtc_clock.begin(Wire); From 7854244026d712dc4014e2a93fe0abe8bd1c29e9 Mon Sep 17 00:00:00 2001 From: recrof Date: Sun, 31 Aug 2025 12:11:07 +0200 Subject: [PATCH 38/51] fix: add xiao s3 wio serial companion to new ui --- variants/xiao_s3_wio/platformio.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/variants/xiao_s3_wio/platformio.ini b/variants/xiao_s3_wio/platformio.ini index fe4670b5..6288dded 100644 --- a/variants/xiao_s3_wio/platformio.ini +++ b/variants/xiao_s3_wio/platformio.ini @@ -103,15 +103,21 @@ lib_deps = extends = Xiao_S3_WIO build_flags = ${Xiao_S3_WIO.build_flags} + -I examples/companion_radio/ui-new -D MAX_CONTACTS=100 -D MAX_GROUP_CHANNELS=8 + -D DISPLAY_CLASS=SSD1306Display -D SERIAL_TX=D6 -D SERIAL_RX=D7 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 build_src_filter = ${Xiao_S3_WIO.build_src_filter} + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> lib_deps = ${Xiao_S3_WIO.lib_deps} densaugeo/base64 @ ~1.4.0 + adafruit/Adafruit SSD1306 @ ^2.5.13 From 50cab444735b814ebcfbc10c35e0d50d4e0d19ba Mon Sep 17 00:00:00 2001 From: recrof Date: Sun, 31 Aug 2025 14:27:44 +0200 Subject: [PATCH 39/51] set companion radios with esp32c3 esp32c6 and esp32s3 boards to max 300 contacts --- variants/generic_espnow/platformio.ini | 4 +- variants/heltec_ct62/platformio.ini | 4 +- variants/heltec_tracker/platformio.ini | 2 +- variants/heltec_v3/platformio.ini | 2 +- .../heltec_vision_master_e213/platformio.ini | 2 +- .../heltec_vision_master_e290/platformio.ini | 4 +- .../heltec_vision_master_t190/platformio.ini | 6 +- variants/heltec_wireless_paper/platformio.ini | 4 +- variants/lilygo_t3s3/platformio.ini | 6 +- variants/lilygo_t3s3_sx1276/platformio.ini | 6 +- .../platformio.ini | 4 +- variants/lilygo_tlora_c6/platformio.ini | 2 +- variants/station_g2/platformio.ini | 4 +- variants/xiao_c3/platformio.ini | 69 +------------------ variants/xiao_c6/platformio.ini | 6 +- variants/xiao_s3_wio/platformio.ini | 6 +- 16 files changed, 33 insertions(+), 98 deletions(-) diff --git a/variants/generic_espnow/platformio.ini b/variants/generic_espnow/platformio.ini index cf3e4c94..1c14dfee 100644 --- a/variants/generic_espnow/platformio.ini +++ b/variants/generic_espnow/platformio.ini @@ -26,7 +26,7 @@ build_src_filter = ${esp32_base.build_src_filter} extends = Generic_ESPNOW build_flags = ${Generic_ESPNOW.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=1 build_src_filter = ${Generic_ESPNOW.build_src_filter} +<../examples/simple_secure_chat/main.cpp> @@ -54,7 +54,7 @@ lib_deps = extends = Generic_ESPNOW build_flags = ${Generic_ESPNOW.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 diff --git a/variants/heltec_ct62/platformio.ini b/variants/heltec_ct62/platformio.ini index 9721d037..0dc512b9 100644 --- a/variants/heltec_ct62/platformio.ini +++ b/variants/heltec_ct62/platformio.ini @@ -55,7 +55,7 @@ build_flags = ${Heltec_ct62.build_flags} ; -D ARDUINO_USB_MODE=1 ; -D ARDUINO_USB_CDC_ON_BOOT=1 - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D OFFLINE_QUEUE_SIZE=256 ; -D MESH_PACKET_LOGGING=1 @@ -73,7 +73,7 @@ build_flags = ${Heltec_ct62.build_flags} ; -D ARDUINO_USB_MODE=1 ; -D ARDUINO_USB_CDC_ON_BOOT=1 - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D OFFLINE_QUEUE_SIZE=256 -D BLE_PIN_CODE=123456 diff --git a/variants/heltec_tracker/platformio.ini b/variants/heltec_tracker/platformio.ini index 357ab854..f1477e9f 100644 --- a/variants/heltec_tracker/platformio.ini +++ b/variants/heltec_tracker/platformio.ini @@ -43,7 +43,7 @@ build_flags = -D ARDUINO_USB_CDC_ON_BOOT=1 ; need for Serial -D DISPLAY_ROTATION=1 -D DISPLAY_CLASS=ST7735Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 ; HWT will use display for pin -D OFFLINE_QUEUE_SIZE=256 diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index 32673b1f..ba34cead 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -72,7 +72,7 @@ lib_deps = extends = Heltec_lora32_v3 build_flags = ${Heltec_lora32_v3.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 diff --git a/variants/heltec_vision_master_e213/platformio.ini b/variants/heltec_vision_master_e213/platformio.ini index 9ca9b5ad..c6b68724 100644 --- a/variants/heltec_vision_master_e213/platformio.ini +++ b/variants/heltec_vision_master_e213/platformio.ini @@ -38,7 +38,7 @@ extends = Heltec_Vision_Master_E213_base build_flags = ${Heltec_Vision_Master_E213_base.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=E213Display -D BLE_PIN_CODE=123456 ; dynamic, random PIN diff --git a/variants/heltec_vision_master_e290/platformio.ini b/variants/heltec_vision_master_e290/platformio.ini index d52dcc0d..4150adc8 100644 --- a/variants/heltec_vision_master_e290/platformio.ini +++ b/variants/heltec_vision_master_e290/platformio.ini @@ -22,7 +22,7 @@ build_flags = -D PIN_BOARD_SCL=38 -D Vision_Master_E290 build_src_filter = ${esp32_base.build_src_filter} - +<../variants/heltec_vision_master_e290> + +<../variants/heltec_vision_master_e290> lib_deps = ${esp32_base.lib_deps} https://github.com/Quency-D/heltec-eink-modules/archive/563dd41fd850a1bc3039b8723da4f3a20fe1c800.zip @@ -32,7 +32,7 @@ extends = Heltec_Vision_Master_E290_base build_flags = ${Heltec_Vision_Master_E290_base.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=E290Display -D BLE_PIN_CODE=123456 ; dynamic, random PIN diff --git a/variants/heltec_vision_master_t190/platformio.ini b/variants/heltec_vision_master_t190/platformio.ini index ecf71409..e8492335 100644 --- a/variants/heltec_vision_master_t190/platformio.ini +++ b/variants/heltec_vision_master_t190/platformio.ini @@ -31,11 +31,11 @@ build_flags = -D ST7789 -D DISPLAY_CLASS=ST7789Display build_src_filter = ${esp32_base.build_src_filter} - +<../variants/heltec_vision_master_t190> + +<../variants/heltec_vision_master_t190> + + + - + + + lib_deps = ${esp32_base.lib_deps} adafruit/Adafruit GFX Library @ ^1.12.1 @@ -45,7 +45,7 @@ extends = Heltec_Vision_Master_T190_base build_flags = ${Heltec_Vision_Master_T190_base.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 ; dynamic, random PIN -D BLE_DEBUG_LOGGING=1 diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index adb24676..8de826e4 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -28,7 +28,7 @@ build_flags = -D ARDUINO_heltec_wifi_lora_32_V3 -D WIRELESS_PAPER build_src_filter = ${esp32_base.build_src_filter} - +<../variants/heltec_wireless_paper> + +<../variants/heltec_wireless_paper> lib_deps = ${esp32_base.lib_deps} https://github.com/todd-herbert/heltec-eink-modules/archive/9207eb6ab2b96f66298e0488740218c17b006af7.zip @@ -38,7 +38,7 @@ extends = Heltec_Wireless_Paper_base build_flags = ${Heltec_Wireless_Paper_base.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=E213Display -D BLE_PIN_CODE=123456 ; dynamic, random PIN diff --git a/variants/lilygo_t3s3/platformio.ini b/variants/lilygo_t3s3/platformio.ini index 722a3243..637cc123 100644 --- a/variants/lilygo_t3s3/platformio.ini +++ b/variants/lilygo_t3s3/platformio.ini @@ -56,7 +56,7 @@ lib_deps = extends = LilyGo_T3S3_sx1262 build_flags = ${LilyGo_T3S3_sx1262.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -91,7 +91,7 @@ build_flags = ${LilyGo_T3S3_sx1262.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SSD1306Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 @@ -110,7 +110,7 @@ build_flags = ${LilyGo_T3S3_sx1262.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SSD1306Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/lilygo_t3s3_sx1276/platformio.ini b/variants/lilygo_t3s3_sx1276/platformio.ini index 8f1c00e4..23c58fb8 100644 --- a/variants/lilygo_t3s3_sx1276/platformio.ini +++ b/variants/lilygo_t3s3_sx1276/platformio.ini @@ -54,7 +54,7 @@ lib_deps = extends = LilyGo_T3S3_sx1276 build_flags = ${LilyGo_T3S3_sx1276.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -90,7 +90,7 @@ build_flags = ${LilyGo_T3S3_sx1276.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SSD1306Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D MESH_PACKET_LOGGING=1 -D MESH_DEBUG=1 @@ -109,7 +109,7 @@ build_flags = ${LilyGo_T3S3_sx1276.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SSD1306Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/lilygo_tbeam_supreme_SX1262/platformio.ini b/variants/lilygo_tbeam_supreme_SX1262/platformio.ini index 9b10f459..e6135872 100644 --- a/variants/lilygo_tbeam_supreme_SX1262/platformio.ini +++ b/variants/lilygo_tbeam_supreme_SX1262/platformio.ini @@ -25,7 +25,7 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/lilygo_tbeam_supreme_SX1262> + + - + + + board_build.partitions = min_spiffs.csv ; get around 4mb flash limit lib_deps = ${esp32_base.lib_deps} @@ -74,7 +74,7 @@ extends = T_Beam_S3_Supreme_SX1262 build_flags = ${T_Beam_S3_Supreme_SX1262.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D OFFLINE_QUEUE_SIZE=256 diff --git a/variants/lilygo_tlora_c6/platformio.ini b/variants/lilygo_tlora_c6/platformio.ini index 5aab2213..76a897d6 100644 --- a/variants/lilygo_tlora_c6/platformio.ini +++ b/variants/lilygo_tlora_c6/platformio.ini @@ -67,7 +67,7 @@ lib_deps = [env:LilyGo_Tlora_C6_companion_radio_ble] extends = tlora_c6 build_flags = ${tlora_c6.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/station_g2/platformio.ini b/variants/station_g2/platformio.ini index 756ff5f3..0e1631a8 100644 --- a/variants/station_g2/platformio.ini +++ b/variants/station_g2/platformio.ini @@ -87,7 +87,7 @@ build_flags = ${Station_G2.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SH1106Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 @@ -105,7 +105,7 @@ build_flags = ${Station_G2.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SH1106Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/xiao_c3/platformio.ini b/variants/xiao_c3/platformio.ini index 659313db..de79fb10 100644 --- a/variants/xiao_c3/platformio.ini +++ b/variants/xiao_c3/platformio.ini @@ -19,28 +19,6 @@ build_flags = build_src_filter = ${esp32_base.build_src_filter} +<../variants/xiao_c3> -[Xiao_esp32_C3_custom] -extends = esp32_base -board = seeed_xiao_esp32c3 -build_flags = - ${esp32_base.build_flags} - -I variants/xiao_c3 - -D ESP32_CPU_FREQ=80 - -D LORA_TX_BOOST_PIN=D3 - -D P_LORA_TX_LED=D5 - -D PIN_VBAT_READ=D0 - -D P_LORA_DIO_1=D2 - -D P_LORA_NSS=D4 - -D P_LORA_RESET=RADIOLIB_NC - -D P_LORA_BUSY=D1 - -D PIN_BOARD_SDA=D6 - -D PIN_BOARD_SCL=D7 - -D SX126X_DIO2_AS_RF_SWITCH=true - -D SX126X_DIO3_TCXO_VOLTAGE=1.8 - -D SX126X_CURRENT_LIMIT=140 -build_src_filter = ${esp32_base.build_src_filter} - +<../variants/xiao_c3> - [env:Xiao_C3_Repeater_sx1262] extends = Xiao_esp32_C3 build_src_filter = ${Xiao_esp32_C3.build_src_filter} @@ -74,7 +52,7 @@ build_flags = -D WRAPPER_CLASS=CustomSX1262Wrapper -D SX126X_RX_BOOSTED_GAIN=1 -D LORA_TX_POWER=22 - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D OFFLINE_QUEUE_SIZE=256 @@ -97,7 +75,7 @@ build_flags = -D WRAPPER_CLASS=CustomSX1262Wrapper -D SX126X_RX_BOOSTED_GAIN=1 -D LORA_TX_POWER=22 - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D OFFLINE_QUEUE_SIZE=256 ; -D BLE_DEBUG_LOGGING=1 @@ -107,46 +85,3 @@ lib_deps = ${Xiao_esp32_C3.lib_deps} ${esp32_ota.lib_deps} densaugeo/base64 @ ~1.4.0 - -[env:Xiao_C3_Repeater_sx1262_custom] -extends = Xiao_esp32_C3_custom -build_src_filter = ${Xiao_esp32_C3_custom.build_src_filter} - +<../examples/simple_repeater/main.cpp> -build_flags = - ${Xiao_esp32_C3_custom.build_flags} - -D RADIO_CLASS=CustomSX1262 - -D WRAPPER_CLASS=CustomSX1262Wrapper - -D SX126X_RX_BOOSTED_GAIN=1 - -D LORA_TX_POWER=22 - -D ADVERT_NAME='"Xiao Repeater"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D MAX_NEIGHBOURS=8 -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -lib_deps = - ${Xiao_esp32_C3_custom.lib_deps} - ${esp32_ota.lib_deps} - bakercp/CRC32 @ ^2.0.0 - -[env:Xiao_C3_Repeater_sx1268_custom] -extends = Xiao_esp32_C3_custom -build_src_filter = ${Xiao_esp32_C3_custom.build_src_filter} - +<../examples/simple_repeater/main.cpp> -build_flags = - ${Xiao_esp32_C3_custom.build_flags} - -D RADIO_CLASS=CustomSX1268 - -D WRAPPER_CLASS=CustomSX1268Wrapper - -D LORA_TX_POWER=22 - -D ADVERT_NAME='"Xiao Repeater"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D MAX_NEIGHBOURS=8 - ; -D MESH_PACKET_LOGGING=1 - ; -D MESH_DEBUG=1 -lib_deps = - ${Xiao_esp32_C3_custom.lib_deps} - ${esp32_ota.lib_deps} - bakercp/CRC32 @ ^2.0.0 diff --git a/variants/xiao_c6/platformio.ini b/variants/xiao_c6/platformio.ini index 602bd6ae..24a17e06 100644 --- a/variants/xiao_c6/platformio.ini +++ b/variants/xiao_c6/platformio.ini @@ -50,7 +50,7 @@ lib_deps = [env:Xiao_C6_companion_radio_ble] extends = Xiao_C6 build_flags = ${Xiao_C6.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 @@ -107,7 +107,7 @@ lib_deps = [env:Meshimi_companion_radio_ble] extends = Meshimi build_flags = ${Meshimi.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 @@ -167,7 +167,7 @@ lib_deps = [env:WHY2025_badge_companion_radio_ble] extends = WHY2025_badge build_flags = ${WHY2025_badge.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/xiao_s3_wio/platformio.ini b/variants/xiao_s3_wio/platformio.ini index fe4670b5..e9ac05e0 100644 --- a/variants/xiao_s3_wio/platformio.ini +++ b/variants/xiao_s3_wio/platformio.ini @@ -65,7 +65,7 @@ lib_deps = extends = Xiao_S3_WIO build_flags = ${Xiao_S3_WIO.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -80,7 +80,7 @@ extends = Xiao_S3_WIO build_flags = ${Xiao_S3_WIO.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D DISPLAY_CLASS=SSD1306Display @@ -103,7 +103,7 @@ lib_deps = extends = Xiao_S3_WIO build_flags = ${Xiao_S3_WIO.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D SERIAL_TX=D6 -D SERIAL_RX=D7 From 7a00f3060e59fbe9b7d1750c3fdfebe8da7bd68e Mon Sep 17 00:00:00 2001 From: recrof Date: Sun, 31 Aug 2025 14:33:49 +0200 Subject: [PATCH 40/51] downgrading pioarduino because build issues --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index e935d77e..c7d4eff8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -68,7 +68,7 @@ lib_deps = ; esp32c6 uses arduino framework 3.x [esp32c6_base] extends = esp32_base -platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21/platform-espressif32.zip +platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.12/platform-espressif32.zip ; ----------------- NRF52 --------------------- From 7c7faaab0594b51b0f96d496bdf1355020ea5e61 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sun, 31 Aug 2025 23:15:56 +1000 Subject: [PATCH 41/51] * agc.reset.interval rounding warning --- src/helpers/CommonCLI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index 443fcc30..45dfe29b 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -268,7 +268,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch } else if (memcmp(config, "agc.reset.interval ", 19) == 0) { _prefs->agc_reset_interval = atoi(&config[19]) / 4; savePrefs(); - strcpy(reply, "OK"); + sprintf(reply, "OK - interval rounded to %d", ((uint32_t) _prefs->agc_reset_interval) * 4); } else if (memcmp(config, "multi.acks ", 11) == 0) { _prefs->multi_acks = atoi(&config[11]); savePrefs(); From 8b3c16c497311a98bfef4ff6451ee0d5466c8367 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sun, 31 Aug 2025 23:42:15 +1000 Subject: [PATCH 42/51] * ver bump --- examples/companion_radio/MyMesh.h | 4 ++-- examples/simple_repeater/main.cpp | 4 ++-- examples/simple_room_server/main.cpp | 4 ++-- examples/simple_sensor/SensorMesh.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 0a5057ea..89ee8133 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -8,11 +8,11 @@ #define FIRMWARE_VER_CODE 7 #ifndef FIRMWARE_BUILD_DATE -#define FIRMWARE_BUILD_DATE "24 Jul 2025" +#define FIRMWARE_BUILD_DATE "31 Aug 2025" #endif #ifndef FIRMWARE_VERSION -#define FIRMWARE_VERSION "v1.7.4" +#define FIRMWARE_VERSION "v1.8.0" #endif #if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 81c4d455..2fda6b85 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -22,11 +22,11 @@ /* ------------------------------ Config -------------------------------- */ #ifndef FIRMWARE_BUILD_DATE - #define FIRMWARE_BUILD_DATE "24 Jul 2025" + #define FIRMWARE_BUILD_DATE "31 Aug 2025" #endif #ifndef FIRMWARE_VERSION - #define FIRMWARE_VERSION "v1.7.4" + #define FIRMWARE_VERSION "v1.8.0" #endif #ifndef LORA_FREQ diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 712d02a5..77e59d99 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -22,11 +22,11 @@ /* ------------------------------ Config -------------------------------- */ #ifndef FIRMWARE_BUILD_DATE - #define FIRMWARE_BUILD_DATE "24 Jul 2025" + #define FIRMWARE_BUILD_DATE "31 Aug 2025" #endif #ifndef FIRMWARE_VERSION - #define FIRMWARE_VERSION "v1.7.4" + #define FIRMWARE_VERSION "v1.8.0" #endif #ifndef LORA_FREQ diff --git a/examples/simple_sensor/SensorMesh.h b/examples/simple_sensor/SensorMesh.h index 62c1867e..ddcdf685 100644 --- a/examples/simple_sensor/SensorMesh.h +++ b/examples/simple_sensor/SensorMesh.h @@ -49,11 +49,11 @@ struct ContactInfo { }; #ifndef FIRMWARE_BUILD_DATE - #define FIRMWARE_BUILD_DATE "24 Jul 2025" + #define FIRMWARE_BUILD_DATE "31 Aug 2025" #endif #ifndef FIRMWARE_VERSION - #define FIRMWARE_VERSION "v1.7.4" + #define FIRMWARE_VERSION "v1.8.0" #endif #define FIRMWARE_ROLE "sensor" From 489bcaffc983352be98198604ced5530230a2e4d Mon Sep 17 00:00:00 2001 From: recrof Date: Sun, 31 Aug 2025 16:23:21 +0200 Subject: [PATCH 43/51] raised max contacts for esp32 classic companions to 160 and 170; set to 300 for WSL3 --- variants/heltec_v2/platformio.ini | 6 ++--- variants/heltec_v3/platformio.ini | 6 ++--- variants/lilygo_tbeam_SX1262/platformio.ini | 4 ++-- variants/lilygo_tbeam_SX1276/platformio.ini | 4 ++-- variants/lilygo_tlora_v2_1/platformio.ini | 26 ++++++++++++++++++--- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/variants/heltec_v2/platformio.ini b/variants/heltec_v2/platformio.ini index ea41f845..352ea34d 100644 --- a/variants/heltec_v2/platformio.ini +++ b/variants/heltec_v2/platformio.ini @@ -64,7 +64,7 @@ lib_deps = extends = Heltec_lora32_v2 build_flags = ${Heltec_lora32_v2.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=170 -D MAX_GROUP_CHANNELS=1 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -80,7 +80,7 @@ build_flags = ${Heltec_lora32_v2.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SSD1306Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=170 -D MAX_GROUP_CHANNELS=8 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 @@ -100,7 +100,7 @@ build_flags = ${Heltec_lora32_v2.build_flags} -I examples/companion_radio/ui-new -D DISPLAY_CLASS=SSD1306Display - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=170 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index ba34cead..d667a576 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -87,7 +87,7 @@ extends = Heltec_lora32_v3 build_flags = ${Heltec_lora32_v3.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=SSD1306Display ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 @@ -130,7 +130,7 @@ extends = Heltec_lora32_v3 build_flags = ${Heltec_lora32_v3.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D DISPLAY_CLASS=SSD1306Display -D WIFI_DEBUG_LOGGING=1 @@ -207,7 +207,7 @@ lib_deps = extends = Heltec_lora32_v3 build_flags = ${Heltec_lora32_v3.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=300 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D BLE_DEBUG_LOGGING=1 diff --git a/variants/lilygo_tbeam_SX1262/platformio.ini b/variants/lilygo_tbeam_SX1262/platformio.ini index 7bb008ac..ea8872de 100644 --- a/variants/lilygo_tbeam_SX1262/platformio.ini +++ b/variants/lilygo_tbeam_SX1262/platformio.ini @@ -24,7 +24,7 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/lilygo_tbeam_SX1262> + + - + + + board_build.partitions = min_spiffs.csv ; get around 4mb flash limit lib_deps = ${esp32_base.lib_deps} @@ -38,7 +38,7 @@ board_build.upload.maximum_ram_size=2000000 build_flags = ${LilyGo_TBeam_SX1262.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D OFFLINE_QUEUE_SIZE=256 diff --git a/variants/lilygo_tbeam_SX1276/platformio.ini b/variants/lilygo_tbeam_SX1276/platformio.ini index e0391f1d..782b74c7 100644 --- a/variants/lilygo_tbeam_SX1276/platformio.ini +++ b/variants/lilygo_tbeam_SX1276/platformio.ini @@ -22,7 +22,7 @@ build_src_filter = ${esp32_base.build_src_filter} +<../variants/lilygo_tbeam_SX1276> + + - + + + board_build.partitions = min_spiffs.csv ; get around 4mb flash limit lib_deps = ${esp32_base.lib_deps} @@ -37,7 +37,7 @@ board_build.upload.maximum_ram_size=2000000 build_flags = ${LilyGo_TBeam_SX1276.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 ; -D BLE_DEBUG_LOGGING=1 diff --git a/variants/lilygo_tlora_v2_1/platformio.ini b/variants/lilygo_tlora_v2_1/platformio.ini index 0ed06856..05a87d70 100644 --- a/variants/lilygo_tlora_v2_1/platformio.ini +++ b/variants/lilygo_tlora_v2_1/platformio.ini @@ -68,7 +68,7 @@ lib_deps = extends = LilyGo_TLora_V2_1_1_6 build_flags = ${LilyGo_TLora_V2_1_1_6.build_flags} - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 @@ -84,7 +84,7 @@ extends = LilyGo_TLora_V2_1_1_6 build_flags = ${LilyGo_TLora_V2_1_1_6.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 ; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 ; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 @@ -102,7 +102,7 @@ extends = LilyGo_TLora_V2_1_1_6 build_flags = ${LilyGo_TLora_V2_1_1_6.build_flags} -I examples/companion_radio/ui-new - -D MAX_CONTACTS=100 + -D MAX_CONTACTS=160 -D MAX_GROUP_CHANNELS=8 -D BLE_PIN_CODE=123456 -D OFFLINE_QUEUE_SIZE=256 @@ -136,3 +136,23 @@ build_flags = lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} ${esp32_ota.lib_deps} + +[env:LilyGo_TLora_V2_1_1_6_companion_radio_wifi] +extends = LilyGo_TLora_V2_1_1_6 +build_flags = + ${LilyGo_TLora_V2_1_1_6.build_flags} + -I examples/companion_radio/ui-new + -D MAX_CONTACTS=160 + -D MAX_GROUP_CHANNELS=8 + -D WIFI_SSID='"ssid"' + -D WIFI_PWD='"password"' + -D WIFI_DEBUG_LOGGING=1 +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + + + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${LilyGo_TLora_V2_1_1_6.lib_deps} + densaugeo/base64 @ ~1.4.0 From 3aa57780f10f8831c0ca39259e09998b324c8bc3 Mon Sep 17 00:00:00 2001 From: fdlamotte Date: Sun, 31 Aug 2025 17:30:31 +0200 Subject: [PATCH 44/51] Update library.json version --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 982983a3..572c55b0 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "MeshCore", - "version" : "1.7.4", + "version" : "1.8.0", "dependencies": { "SPI": "*", "Wire": "*", @@ -13,4 +13,4 @@ "build": { "extraScript": "build_as_lib.py" } -} \ No newline at end of file +} From c28001d1e2a04adb7eee2e4ddab42b3510855945 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 1 Sep 2025 14:29:40 +1000 Subject: [PATCH 45/51] * ESP platform ver > 6.11.0 seems to break Github Actions --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index c7d4eff8..1c89465f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -53,7 +53,7 @@ build_src_filter = [esp32_base] extends = arduino_base -platform = platformio/espressif32@^6.11.0 +platform = platformio/espressif32@6.11.0 monitor_filters = esp32_exception_decoder extra_scripts = merge-bin.py build_flags = ${arduino_base.build_flags} From ee194a7b197984ee4b7adc207bb0979e19c6297d Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 1 Sep 2025 15:22:11 +1000 Subject: [PATCH 46/51] * added CommonCLI::saveIdentity() --- examples/simple_repeater/main.cpp | 14 ++++++++++++++ examples/simple_room_server/main.cpp | 14 ++++++++++++++ examples/simple_sensor/SensorMesh.cpp | 14 ++++++++++++++ examples/simple_sensor/SensorMesh.h | 1 + src/helpers/CommonCLI.cpp | 4 +++- src/helpers/CommonCLI.h | 1 + 6 files changed, 47 insertions(+), 1 deletion(-) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 2fda6b85..309be201 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -732,6 +732,20 @@ public: mesh::LocalIdentity& getSelfId() override { return self_id; } + void saveIdentity(const mesh::LocalIdentity& new_id) override { + self_id = new_id; +#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) + IdentityStore store(*_fs, ""); +#elif defined(ESP32) + IdentityStore store(*_fs, "/identity"); +#elif defined(RP2040_PLATFORM) + IdentityStore store(*_fs, "/identity"); +#else + #error "need to define saveIdentity()" +#endif + store.save("_main", self_id); + } + void clearStats() override { radio_driver.resetStats(); resetStats(); diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 77e59d99..76961e22 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -865,6 +865,20 @@ public: mesh::LocalIdentity& getSelfId() override { return self_id; } + void saveIdentity(const mesh::LocalIdentity& new_id) override { + self_id = new_id; +#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) + IdentityStore store(*_fs, ""); +#elif defined(ESP32) + IdentityStore store(*_fs, "/identity"); +#elif defined(RP2040_PLATFORM) + IdentityStore store(*_fs, "/identity"); +#else + #error "need to define saveIdentity()" +#endif + store.save("_main", self_id); + } + void clearStats() override { radio_driver.resetStats(); resetStats(); diff --git a/examples/simple_sensor/SensorMesh.cpp b/examples/simple_sensor/SensorMesh.cpp index ad295501..72c0d97b 100644 --- a/examples/simple_sensor/SensorMesh.cpp +++ b/examples/simple_sensor/SensorMesh.cpp @@ -837,6 +837,20 @@ bool SensorMesh::formatFileSystem() { #endif } +void SensorMesh::saveIdentity(const mesh::LocalIdentity& new_id) { + self_id = new_id; +#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) + IdentityStore store(*_fs, ""); +#elif defined(ESP32) + IdentityStore store(*_fs, "/identity"); +#elif defined(RP2040_PLATFORM) + IdentityStore store(*_fs, "/identity"); +#else + #error "need to define saveIdentity()" +#endif + store.save("_main", self_id); +} + void SensorMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) { set_radio_at = futureMillis(2000); // give CLI reply some time to be sent back, before applying temp radio params pending_freq = freq; diff --git a/examples/simple_sensor/SensorMesh.h b/examples/simple_sensor/SensorMesh.h index ddcdf685..89f2ee88 100644 --- a/examples/simple_sensor/SensorMesh.h +++ b/examples/simple_sensor/SensorMesh.h @@ -89,6 +89,7 @@ public: strcpy(reply, "not supported"); } mesh::LocalIdentity& getSelfId() override { return self_id; } + void saveIdentity(const mesh::LocalIdentity& new_id) override; void clearStats() override { } void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override; diff --git a/src/helpers/CommonCLI.cpp b/src/helpers/CommonCLI.cpp index 45dfe29b..7125e5b0 100644 --- a/src/helpers/CommonCLI.cpp +++ b/src/helpers/CommonCLI.cpp @@ -305,7 +305,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch uint8_t prv_key[PRV_KEY_SIZE]; bool success = mesh::Utils::fromHex(prv_key, PRV_KEY_SIZE, &config[8]); if (success) { - _callbacks->getSelfId().readFrom(prv_key, PRV_KEY_SIZE); + mesh::LocalIdentity new_id; + new_id.readFrom(prv_key, PRV_KEY_SIZE); + _callbacks->saveIdentity(new_id); strcpy(reply, "OK"); } else { strcpy(reply, "Error, invalid key"); diff --git a/src/helpers/CommonCLI.h b/src/helpers/CommonCLI.h index d1e49873..ff8ff50e 100644 --- a/src/helpers/CommonCLI.h +++ b/src/helpers/CommonCLI.h @@ -47,6 +47,7 @@ public: // no op by default }; virtual mesh::LocalIdentity& getSelfId() = 0; + virtual void saveIdentity(const mesh::LocalIdentity& new_id) = 0; virtual void clearStats() = 0; virtual void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) = 0; }; From 81afd83099c41a47a41d292e18551cf650ba1538 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 1 Sep 2025 16:10:45 +1000 Subject: [PATCH 47/51] * Meshadventurer companion USB build fix --- variants/meshadventurer/platformio.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/meshadventurer/platformio.ini b/variants/meshadventurer/platformio.ini index 3ea09ba7..1b881c1a 100644 --- a/variants/meshadventurer/platformio.ini +++ b/variants/meshadventurer/platformio.ini @@ -80,6 +80,8 @@ extends = Meshadventurer build_src_filter = ${Meshadventurer.build_src_filter} +<../examples/companion_radio/*.cpp> + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> build_flags = ${Meshadventurer.build_flags} -I examples/companion_radio/ui-new From b8223e9d07a967870720319fb68f2244759851e3 Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 1 Sep 2025 16:28:53 +1000 Subject: [PATCH 48/51] * reverting HeltecV3 _CURRENT_LIMIT change --- variants/heltec_v3/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index d667a576..f545d898 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -17,7 +17,7 @@ build_flags = -D PIN_VEXT_EN=36 -D SX126X_DIO2_AS_RF_SWITCH=true -D SX126X_DIO3_TCXO_VOLTAGE=1.8 - -D SX126X_CURRENT_LIMIT=160 + -D SX126X_CURRENT_LIMIT=140 -D SX126X_RX_BOOSTED_GAIN=1 -D PIN_GPS_RX=47 -D PIN_GPS_TX=48 From 74722c24b8b0052ed17b4613866247cb35728e0f Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 1 Sep 2025 17:11:55 +1000 Subject: [PATCH 49/51] * MomentaryButton: added support for analog button (with threshold) * RAK: support for PIN_USER_BTN_ANA --- examples/companion_radio/ui-new/UITask.cpp | 11 +++++++++++ src/helpers/ui/MomentaryButton.cpp | 22 +++++++++++++++++++--- src/helpers/ui/MomentaryButton.h | 2 ++ variants/rak4631/target.cpp | 4 ++++ variants/rak4631/target.h | 3 +++ 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 22f394e7..c751eaf5 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -354,6 +354,9 @@ void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* no #if defined(PIN_USER_BTN) user_btn.begin(); #endif +#if defined(PIN_USER_BTN_ANA) + analog_btn.begin(); +#endif _node_prefs = node_prefs; if (_display != NULL) { @@ -508,6 +511,14 @@ void UITask::loop() { c = handleLongPress(KEY_RIGHT); } #endif +#if defined(PIN_USER_BTN_ANA) + ev = analog_btn.check(); + if (ev == BUTTON_EVENT_CLICK) { + c = checkDisplayOn(KEY_SELECT); + } else if (ev == BUTTON_EVENT_LONG_PRESS) { + c = handleLongPress(KEY_ENTER); + } +#endif if (c != 0 && curr) { curr->handleInput(c); diff --git a/src/helpers/ui/MomentaryButton.cpp b/src/helpers/ui/MomentaryButton.cpp index 9ddf1327..36309600 100644 --- a/src/helpers/ui/MomentaryButton.cpp +++ b/src/helpers/ui/MomentaryButton.cpp @@ -8,16 +8,29 @@ MomentaryButton::MomentaryButton(int8_t pin, int long_press_millis, bool reverse prev = _reverse ? HIGH : LOW; cancel = 0; _long_millis = long_press_millis; + _threshold = 0; +} + +MomentaryButton::MomentaryButton(int8_t pin, int long_press_millis, int analog_threshold) { + _pin = pin; + _reverse = false; + _pull = false; + down_at = 0; + prev = LOW; + cancel = 0; + _long_millis = long_press_millis; + _threshold = analog_threshold; } void MomentaryButton::begin() { - if (_pin >= 0) { + if (_pin >= 0 && _threshold == 0) { pinMode(_pin, _pull ? (_reverse ? INPUT_PULLUP : INPUT_PULLDOWN) : INPUT); } } bool MomentaryButton::isPressed() const { - return isPressed(digitalRead(_pin)); + int btn = _threshold > 0 ? (analogRead(_pin) < _threshold) : digitalRead(_pin); + return isPressed(btn); } void MomentaryButton::cancelClick() { @@ -25,6 +38,9 @@ void MomentaryButton::cancelClick() { } bool MomentaryButton::isPressed(int level) const { + if (_threshold > 0) { + return level; + } if (_reverse) { return level == LOW; } else { @@ -36,7 +52,7 @@ int MomentaryButton::check(bool repeat_click) { if (_pin < 0) return BUTTON_EVENT_NONE; int event = BUTTON_EVENT_NONE; - int btn = digitalRead(_pin); + int btn = _threshold > 0 ? (analogRead(_pin) < _threshold) : digitalRead(_pin); if (btn != prev) { if (isPressed(btn)) { down_at = millis(); diff --git a/src/helpers/ui/MomentaryButton.h b/src/helpers/ui/MomentaryButton.h index 0bcc776c..d002f652 100644 --- a/src/helpers/ui/MomentaryButton.h +++ b/src/helpers/ui/MomentaryButton.h @@ -11,12 +11,14 @@ class MomentaryButton { int8_t prev, cancel; bool _reverse, _pull; int _long_millis; + int _threshold; // analog mode unsigned long down_at; bool isPressed(int level) const; public: MomentaryButton(int8_t pin, int long_press_mills=0, bool reverse=false, bool pulldownup=false); + MomentaryButton(int8_t pin, int long_press_mills, int analog_threshold); void begin(); int check(bool repeat_click=false); // returns one of BUTTON_EVENT_* void cancelClick(); // suppress next BUTTON_EVENT_CLICK (if already in DOWN state) diff --git a/variants/rak4631/target.cpp b/variants/rak4631/target.cpp index 618c9fc5..efed90aa 100644 --- a/variants/rak4631/target.cpp +++ b/variants/rak4631/target.cpp @@ -11,6 +11,10 @@ RAK4631Board board; #ifdef DISPLAY_CLASS DISPLAY_CLASS display; MomentaryButton user_btn(PIN_USER_BTN, 1000, true); + + #if defined(PIN_USER_BTN_ANA) + MomentaryButton analog_btn(PIN_USER_BTN_ANA, 1000, 20); + #endif #endif RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI); diff --git a/variants/rak4631/target.h b/variants/rak4631/target.h index 5e93b7fc..aa6be664 100644 --- a/variants/rak4631/target.h +++ b/variants/rak4631/target.h @@ -13,6 +13,9 @@ extern DISPLAY_CLASS display; #include extern MomentaryButton user_btn; + #if defined(PIN_USER_BTN_ANA) + extern MomentaryButton analog_btn; + #endif #endif extern RAK4631Board board; From 3ad43431d973aeed5cae6d9b584ae895c3b19a22 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Mon, 1 Sep 2025 21:04:41 +1200 Subject: [PATCH 50/51] fixed wismesh pocket user button --- variants/rak4631/target.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/rak4631/target.cpp b/variants/rak4631/target.cpp index efed90aa..bc7465fd 100644 --- a/variants/rak4631/target.cpp +++ b/variants/rak4631/target.cpp @@ -10,7 +10,7 @@ RAK4631Board board; #ifdef DISPLAY_CLASS DISPLAY_CLASS display; - MomentaryButton user_btn(PIN_USER_BTN, 1000, true); + MomentaryButton user_btn(PIN_USER_BTN, 1000, true, true); #if defined(PIN_USER_BTN_ANA) MomentaryButton analog_btn(PIN_USER_BTN_ANA, 1000, 20); From 637891b81468c2f25acd41260f2512591a1fe3cb Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Mon, 1 Sep 2025 19:32:15 +1000 Subject: [PATCH 51/51] * ver bump --- examples/companion_radio/MyMesh.h | 4 ++-- examples/simple_repeater/main.cpp | 4 ++-- examples/simple_room_server/main.cpp | 4 ++-- examples/simple_sensor/SensorMesh.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index 89ee8133..e3235128 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -8,11 +8,11 @@ #define FIRMWARE_VER_CODE 7 #ifndef FIRMWARE_BUILD_DATE -#define FIRMWARE_BUILD_DATE "31 Aug 2025" +#define FIRMWARE_BUILD_DATE "1 Sep 2025" #endif #ifndef FIRMWARE_VERSION -#define FIRMWARE_VERSION "v1.8.0" +#define FIRMWARE_VERSION "v1.8.1" #endif #if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 309be201..565dc04a 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -22,11 +22,11 @@ /* ------------------------------ Config -------------------------------- */ #ifndef FIRMWARE_BUILD_DATE - #define FIRMWARE_BUILD_DATE "31 Aug 2025" + #define FIRMWARE_BUILD_DATE "1 Sep 2025" #endif #ifndef FIRMWARE_VERSION - #define FIRMWARE_VERSION "v1.8.0" + #define FIRMWARE_VERSION "v1.8.1" #endif #ifndef LORA_FREQ diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 76961e22..fd9c4397 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -22,11 +22,11 @@ /* ------------------------------ Config -------------------------------- */ #ifndef FIRMWARE_BUILD_DATE - #define FIRMWARE_BUILD_DATE "31 Aug 2025" + #define FIRMWARE_BUILD_DATE "1 Sep 2025" #endif #ifndef FIRMWARE_VERSION - #define FIRMWARE_VERSION "v1.8.0" + #define FIRMWARE_VERSION "v1.8.1" #endif #ifndef LORA_FREQ diff --git a/examples/simple_sensor/SensorMesh.h b/examples/simple_sensor/SensorMesh.h index 89f2ee88..7b3b3954 100644 --- a/examples/simple_sensor/SensorMesh.h +++ b/examples/simple_sensor/SensorMesh.h @@ -49,11 +49,11 @@ struct ContactInfo { }; #ifndef FIRMWARE_BUILD_DATE - #define FIRMWARE_BUILD_DATE "31 Aug 2025" + #define FIRMWARE_BUILD_DATE "1 Sep 2025" #endif #ifndef FIRMWARE_VERSION - #define FIRMWARE_VERSION "v1.8.0" + #define FIRMWARE_VERSION "v1.8.1" #endif #define FIRMWARE_ROLE "sensor"