From dd61005f3a9bc1c64fb20a664b5ee96907eb2c44 Mon Sep 17 00:00:00 2001 From: mloszand Date: Sun, 25 Oct 2026 11:01:31 +0100 Subject: [PATCH 1/4] Add Waveshare ESP32-C3-Zero support Add support for the Waveshare ESP32-C3-Zero, including BLE, USB, Wi-Fi, repeater, and room server builds. --- .../waveshare_c3_zero/WaveshareC3ZeroBoard.h | 64 +++++++++ variants/waveshare_c3_zero/platformio.ini | 121 ++++++++++++++++++ variants/waveshare_c3_zero/target.cpp | 46 +++++++ variants/waveshare_c3_zero/target.h | 17 +++ 4 files changed, 248 insertions(+) create mode 100644 variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h create mode 100644 variants/waveshare_c3_zero/platformio.ini create mode 100644 variants/waveshare_c3_zero/target.cpp create mode 100644 variants/waveshare_c3_zero/target.h diff --git a/variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h b/variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h new file mode 100644 index 00000000..c066c6b7 --- /dev/null +++ b/variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h @@ -0,0 +1,64 @@ +#pragma once + +#include +#include + +#include + +class WaveshareC3ZeroBoard : public ESP32Board { +public: + void begin() { + ESP32Board::begin(); + + esp_reset_reason_t reason = esp_reset_reason(); + if (reason == ESP_RST_DEEPSLEEP) { + long wakeup_source = esp_sleep_get_gpio_wakeup_status(); + if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep) + startup_reason = BD_STARTUP_RX_PACKET; + } + + #if defined(LORA_TX_BOOST_PIN) + gpio_hold_dis((gpio_num_t) LORA_TX_BOOST_PIN); + gpio_deep_sleep_hold_dis(); + #endif + } + + #ifdef LORA_TX_BOOST_PIN + pinMode(LORA_TX_BOOST_PIN, OUTPUT); + digitalWrite(LORA_TX_BOOST_PIN, HIGH); + #endif + + #ifdef P_LORA_TX_LED + pinMode(P_LORA_TX_LED, OUTPUT); + digitalWrite(P_LORA_TX_LED, LOW); + #endif + } + +#if defined(LORA_TX_BOOST_PIN) || defined(P_LORA_TX_LED) + void onBeforeTransmit() override { + #if defined(P_LORA_TX_LED) + digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on + #endif + #if defined(LORA_TX_BOOST_PIN) + digitalWrite(LORA_TX_BOOST_PIN, LOW); + delay(5); + #endif + } + void onAfterTransmit() override { + #if defined(LORA_TX_BOOST_PIN) + digitalWrite(LORA_TX_BOOST_PIN, HIGH); + #endif + #if defined(P_LORA_TX_LED) + digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off + #endif + } +#endif + + uint16_t getBattMilliVolts() override { + return 0; // no battery-voltage-divider circuit on this board + } + + const char* getManufacturerName() const override { + return "Waveshare ESP32-C3-Zero"; + } +}; diff --git a/variants/waveshare_c3_zero/platformio.ini b/variants/waveshare_c3_zero/platformio.ini new file mode 100644 index 00000000..3811f349 --- /dev/null +++ b/variants/waveshare_c3_zero/platformio.ini @@ -0,0 +1,121 @@ +[Waveshare_C3_Zero] +extends = esp32_base +board = esp32-c3-devkitm-1 +board_build.flash_mode = dio +build_flags = + ${esp32_base.build_flags} + -I variants/waveshare_c3_zero + -D ARDUINO_USB_CDC_ON_BOOT=1 + -D ARDUINO_USB_MODE=1 + -D P_LORA_NSS=7 + -D P_LORA_DIO_1=3 + -D P_LORA_RESET=0 + -D P_LORA_BUSY=1 + -D P_LORA_SCLK=4 + -D P_LORA_MISO=5 + -D P_LORA_MOSI=6 + -D SX126X_RXEN=10 + -D USE_SX1262 + -D RADIO_CLASS=CustomSX1262 + -D WRAPPER_CLASS=CustomSX1262Wrapper + -D SX126X_RX_BOOSTED_GAIN=1 + -D LORA_TX_POWER=14 + -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/waveshare_c3_zero> + + +lib_deps = + ${esp32_base.lib_deps} + +[env:Waveshare_C3_Zero_repeater] +extends = Waveshare_C3_Zero +build_src_filter = ${Waveshare_C3_Zero.build_src_filter} + +<../examples/simple_repeater/*.cpp> +build_flags = + ${Waveshare_C3_Zero.build_flags} + ${sensor_base.build_flags} + -UENV_INCLUDE_GPS + -UENV_INCLUDE_VL53L0X + -D ADVERT_NAME='"Waveshare C3 Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=50 +lib_deps = + ${Waveshare_C3_Zero.lib_deps} + ${sensor_base.lib_deps} + ${esp32_ota.lib_deps} + bakercp/CRC32 @ ^2.0.0 + +[env:Waveshare_C3_Zero_room_server] +extends = Waveshare_C3_Zero +build_src_filter = ${Waveshare_C3_Zero.build_src_filter} + +<../examples/simple_room_server/*.cpp> +build_flags = + ${Waveshare_C3_Zero.build_flags} + ${sensor_base.build_flags} + -UENV_INCLUDE_GPS + -UENV_INCLUDE_VL53L0X + -D ADVERT_NAME='"Waveshare C3 Room"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D ROOM_PASSWORD='"hello"' +lib_deps = + ${Waveshare_C3_Zero.lib_deps} + ${sensor_base.lib_deps} + ${esp32_ota.lib_deps} + bakercp/CRC32 @ ^2.0.0 + +[env:Waveshare_C3_Zero_companion_radio_usb] +extends = Waveshare_C3_Zero +build_src_filter = ${Waveshare_C3_Zero.build_src_filter} + +<../examples/companion_radio/*.cpp> + + +build_flags = + ${Waveshare_C3_Zero.build_flags} + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D OFFLINE_QUEUE_SIZE=256 + -D ENABLE_USB_INTERFACE +lib_deps = + ${Waveshare_C3_Zero.lib_deps} + ${esp32_ota.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Waveshare_C3_Zero_companion_radio_ble] +extends = Waveshare_C3_Zero +board_build.partitions = huge_app.csv +build_src_filter = ${Waveshare_C3_Zero.build_src_filter} + +<../examples/companion_radio/*.cpp> + + +build_flags = + ${Waveshare_C3_Zero.build_flags} + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D BLE_PIN_CODE=123456 + -D OFFLINE_QUEUE_SIZE=256 +lib_deps = + ${Waveshare_C3_Zero.lib_deps} + ${esp32_ota.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:Waveshare_C3_Zero_companion_radio_wifi] +extends = Waveshare_C3_Zero +build_src_filter = ${Waveshare_C3_Zero.build_src_filter} + +<../examples/companion_radio/*.cpp> + + +build_flags = + ${Waveshare_C3_Zero.build_flags} + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D OFFLINE_QUEUE_SIZE=256 + -D WIFI_DEBUG_LOGGING=1 + -D WIFI_SSID='"MySsid"' + -D WIFI_PWD='"MyPWD"' +lib_deps = + ${Waveshare_C3_Zero.lib_deps} + ${esp32_ota.lib_deps} + densaugeo/base64 @ ~1.4.0 diff --git a/variants/waveshare_c3_zero/target.cpp b/variants/waveshare_c3_zero/target.cpp new file mode 100644 index 00000000..cb334fbb --- /dev/null +++ b/variants/waveshare_c3_zero/target.cpp @@ -0,0 +1,46 @@ +#include +#include "target.h" + +WaveshareC3ZeroBoard board; + +#if defined(P_LORA_SCLK) + // NOTE: ESP32-C3 only exposes one general-purpose SPI peripheral (FSPI). + // The default SPIClass() constructor does not reliably bind to it on this + // chip, which silently produces an SPI object that never talks to real + // hardware -- radio chip-detection then fails every time with no error + // other than RADIOLIB_ERR_CHIP_NOT_FOUND. Always pass FSPI explicitly. + 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); + +#if ENV_INCLUDE_GPS + #include + MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock); + EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea); +#else + EnvironmentSensorManager sensors; +#endif + +bool radio_init() { + fallback_clock.begin(); + rtc_clock.begin(Wire); + +#if defined(P_LORA_SCLK) + spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); + return radio.std_init(&spi); +#else + return radio.std_init(); +#endif +} + +mesh::LocalIdentity radio_new_identity() { + RadioNoiseListener rng(radio); + return mesh::LocalIdentity(&rng); // create new random identity +} diff --git a/variants/waveshare_c3_zero/target.h b/variants/waveshare_c3_zero/target.h new file mode 100644 index 00000000..f17f197c --- /dev/null +++ b/variants/waveshare_c3_zero/target.h @@ -0,0 +1,17 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 +#include +#include +#include +#include +#include +#include + +extern WaveshareC3ZeroBoard board; +extern WRAPPER_CLASS radio_driver; +extern AutoDiscoverRTCClock rtc_clock; +extern EnvironmentSensorManager sensors; + +bool radio_init(); +mesh::LocalIdentity radio_new_identity(); \ No newline at end of file From 38eb3d99e4cef416b44db4ab856e2311b1628f92 Mon Sep 17 00:00:00 2001 From: nminaylov Date: Tue, 3 Nov 2026 14:50:29 +0300 Subject: [PATCH 2/4] rpi_pico2 HW variant support --- platformio.ini | 2 +- variants/rpi_pico2/RpiPico2Board.cpp | 30 +++++++ variants/rpi_pico2/RpiPico2Board.h | 63 ++++++++++++++ variants/rpi_pico2/platformio.ini | 120 +++++++++++++++++++++++++++ variants/rpi_pico2/target.cpp | 30 +++++++ variants/rpi_pico2/target.h | 19 +++++ 6 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 variants/rpi_pico2/RpiPico2Board.cpp create mode 100644 variants/rpi_pico2/RpiPico2Board.h create mode 100644 variants/rpi_pico2/platformio.ini create mode 100644 variants/rpi_pico2/target.cpp create mode 100644 variants/rpi_pico2/target.h diff --git a/platformio.ini b/platformio.ini index f296f838..929edf77 100644 --- a/platformio.ini +++ b/platformio.ini @@ -96,7 +96,7 @@ build_flags = ${arduino_base.build_flags} lib_deps = ${arduino_base.lib_deps} https://github.com/oltaco/CustomLFS#0.2.3 -; ----------------- RP2040 --------------------- +; ------------- RP2040 / RP2350 ----------------- [rp2040_base] extends = arduino_base diff --git a/variants/rpi_pico2/RpiPico2Board.cpp b/variants/rpi_pico2/RpiPico2Board.cpp new file mode 100644 index 00000000..f5e33971 --- /dev/null +++ b/variants/rpi_pico2/RpiPico2Board.cpp @@ -0,0 +1,30 @@ +#include "RpiPico2Board.h" + +#include +#include + +void RpiPico2Board::begin() { + // for future use, sub-classes SHOULD call this from their begin() + startup_reason = BD_STARTUP_NORMAL; + +#ifdef P_LORA_TX_LED + pinMode(P_LORA_TX_LED, OUTPUT); +#endif + +#ifdef PIN_VBAT_READ + pinMode(PIN_VBAT_READ, INPUT); +#endif + +#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL) + Wire.setSDA(PIN_BOARD_SDA); + Wire.setSCL(PIN_BOARD_SCL); +#endif + + Wire.begin(); + + delay(10); // give sx1262 some time to power up +} + +bool RpiPico2Board::startOTAUpdate(const char *id, char reply[]) { + return false; +} diff --git a/variants/rpi_pico2/RpiPico2Board.h b/variants/rpi_pico2/RpiPico2Board.h new file mode 100644 index 00000000..398c38c6 --- /dev/null +++ b/variants/rpi_pico2/RpiPico2Board.h @@ -0,0 +1,63 @@ +#pragma once + +#include +#include +#include + +/* + * This board has no built-in way to read battery voltage. + * Nevertheless it's very easy to make it work, you only require two 1% resistors. + * If your using the WIO SX1262 Addon for xaio, make sure you dont connect D0! + * + * BAT+ -----+ + * | + * VSYS --+ -/\/\/\/\- --+ + * 200k | + * +-- D0 + * | + * GND --+ -/\/\/\/\- --+ + * | 100k + * BAT- -----+ + */ +#define PIN_VBAT_READ 26 // D0 +#define BATTERY_SAMPLES 8 +#define ADC_MULTIPLIER (3.0f * 3.3f * 1000) + +class RpiPico2Board : public mesh::MainBoard { +protected: + uint8_t startup_reason; + +public: + void begin(); + uint8_t getStartupReason() const override { return startup_reason; } + + void attachDynamicPrefs(KeyValueStore* prefs) { } // no-op + +#ifdef P_LORA_TX_LED + void onBeforeTransmit() override { digitalWrite(P_LORA_TX_LED, HIGH); } + void onAfterTransmit() override { digitalWrite(P_LORA_TX_LED, LOW); } +#endif + + + uint16_t getBattMilliVolts() override { +#if defined(PIN_VBAT_READ) && defined(ADC_MULTIPLIER) + analogReadResolution(12); + + uint32_t raw = 0; + for (int i = 0; i < BATTERY_SAMPLES; i++) { + raw += analogRead(PIN_VBAT_READ); + } + raw = raw / BATTERY_SAMPLES; + + return (ADC_MULTIPLIER * raw) / 4096; +#else + return 0; +#endif + } + + const char *getManufacturerName() const override { return "RpiPico2"; } + + void reboot() override { rp2040.reboot(); } + + bool startOTAUpdate(const char *id, char reply[]) override; +}; diff --git a/variants/rpi_pico2/platformio.ini b/variants/rpi_pico2/platformio.ini new file mode 100644 index 00000000..fbf47e16 --- /dev/null +++ b/variants/rpi_pico2/platformio.ini @@ -0,0 +1,120 @@ +[rpi_pico2] +extends = rp2040_base +board = rpipico2 +board_build.filesystem_size = 0.5m +build_flags = ${rp2040_base.build_flags} + -I variants/rpi_pico2 + -D SX126X_CURRENT_LIMIT=140 + -D USE_SX1262 + -D RADIO_CLASS=CustomSX1262 + -D WRAPPER_CLASS=CustomSX1262Wrapper + -D P_LORA_DIO_1=20 + -D P_LORA_NSS=3 + -D P_LORA_RESET=15 + -D P_LORA_BUSY=2 + -D P_LORA_SCLK=10 + -D P_LORA_MOSI=11 + -D P_LORA_MISO=12 + -D P_LORA_TX_LED=25 + -D SX126X_RXEN=RADIOLIB_NC + -D SX126X_TXEN=RADIOLIB_NC + -D SX126X_DIO2_AS_RF_SWITCH=true + -D SX126X_DIO3_TCXO_VOLTAGE=1.8 + -D SX126X_RX_BOOSTED_GAIN=1 + -D LORA_TX_POWER=22 +; Debug options + ; -D DEBUG_RP2040_WIRE=1 + ; -D DEBUG_RP2040_SPI=1 + ; -D DEBUG_RP2040_CORE=1 + ; -D RADIOLIB_DEBUG_SPI=1 + ; -D DEBUG_RP2040_PORT=Serial +build_src_filter = ${rp2040_base.build_src_filter} + + + +<../variants/rpi_pico2> +lib_deps = ${rp2040_base.lib_deps} + +[env:rpi_pico2_repeater] +extends = rpi_pico2 +build_flags = ${rpi_pico2.build_flags} + -D ADVERT_NAME='"Pico2 Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=50 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${rpi_pico2.build_src_filter} + +<../examples/simple_repeater> + +[env:rpi_pico2_room_server] +extends = rpi_pico2 +build_flags = ${rpi_pico2.build_flags} + -D ADVERT_NAME='"Pico2 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 +build_src_filter = ${rpi_pico2.build_src_filter} + +<../examples/simple_room_server> + +[env:rpi_pico2_companion_radio_usb] +extends = rpi_pico2 +build_flags = ${rpi_pico2.build_flags} + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=40 + -D ENABLE_USB_INTERFACE +; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 +; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 +build_src_filter = ${rpi_pico2.build_src_filter} + +<../examples/companion_radio/*.cpp> +lib_deps = ${rpi_pico2.lib_deps} + densaugeo/base64 @ ~1.4.0 +lib_ignore = BLE + +; [env:rpi_pico2_companion_radio_ble] +; extends = rpi_pico2 +; build_flags = ${rpi_pico2.build_flags} +; -D MAX_CONTACTS=100 +; -D MAX_GROUP_CHANNELS=8 +; -D BLE_PIN_CODE=123456 +; -D BLE_DEBUG_LOGGING=1 +; ; -D MESH_PACKET_LOGGING=1 +; ; -D MESH_DEBUG=1 +; build_src_filter = ${rpi_pico2.build_src_filter} +; +<../examples/companion_radio/*.cpp> +; lib_deps = ${rpi_pico2.lib_deps} +; densaugeo/base64 @ ~1.4.0 + +; [env:rpi_pico2_companion_radio_wifi] +; extends = rpi_pico2 +; build_flags = ${rpi_pico2.build_flags} +; -D MAX_CONTACTS=100 +; -D MAX_GROUP_CHANNELS=8 +; -D WIFI_DEBUG_LOGGING=1 +; -D WIFI_SSID='"myssid"' +; -D WIFI_PWD='"mypwd"' +; ; -D MESH_PACKET_LOGGING=1 +; ; -D MESH_DEBUG=1 +; build_src_filter = ${rpi_pico2.build_src_filter} +; +<../examples/companion_radio/*.cpp> +; lib_deps = ${rpi_pico2.lib_deps} +; densaugeo/base64 @ ~1.4.0 + +[env:rpi_pico2_terminal_chat] +extends = rpi_pico2 +build_flags = ${rpi_pico2.build_flags} + -D MAX_CONTACTS=350 + -D MAX_GROUP_CHANNELS=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${rpi_pico2.build_src_filter} + +<../examples/simple_secure_chat/main.cpp> +lib_deps = ${rpi_pico2.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:rpi_pico2_kiss_modem] +extends = rpi_pico2 +build_src_filter = ${rpi_pico2.build_src_filter} + +<../examples/kiss_modem/> diff --git a/variants/rpi_pico2/target.cpp b/variants/rpi_pico2/target.cpp new file mode 100644 index 00000000..9cd72d72 --- /dev/null +++ b/variants/rpi_pico2/target.cpp @@ -0,0 +1,30 @@ +#include "target.h" + +#include +#include + +RpiPico2Board board; + +RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI1); + +WRAPPER_CLASS radio_driver(radio, board); + +VolatileRTCClock fallback_clock; +AutoDiscoverRTCClock rtc_clock(fallback_clock); +SensorManager sensors; + +#ifndef LORA_CR +#define LORA_CR 5 +#endif + +bool radio_init() { + rtc_clock.begin(Wire); + + return radio.std_init(&SPI1); +} + +mesh::LocalIdentity radio_new_identity() { + RadioNoiseListener rng(radio); + return mesh::LocalIdentity(&rng); // create new random identity +} + diff --git a/variants/rpi_pico2/target.h b/variants/rpi_pico2/target.h new file mode 100644 index 00000000..7ff28707 --- /dev/null +++ b/variants/rpi_pico2/target.h @@ -0,0 +1,19 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 + +#include +#include +#include +#include +#include +#include + +extern RpiPico2Board board; +extern WRAPPER_CLASS radio_driver; +extern AutoDiscoverRTCClock rtc_clock; +extern SensorManager sensors; + +bool radio_init(); +mesh::LocalIdentity radio_new_identity(); + From 46606a4b032f0efd7ed9700a91122bfcb8252494 Mon Sep 17 00:00:00 2001 From: Rastislav Vysoky Date: Tue, 10 Nov 2026 13:43:09 +0100 Subject: [PATCH 3/4] Revert "Support for RP2350 board" --- platformio.ini | 2 +- variants/rpi_pico2/RpiPico2Board.cpp | 30 ------- variants/rpi_pico2/RpiPico2Board.h | 63 -------------- variants/rpi_pico2/platformio.ini | 120 --------------------------- variants/rpi_pico2/target.cpp | 30 ------- variants/rpi_pico2/target.h | 19 ----- 6 files changed, 1 insertion(+), 263 deletions(-) delete mode 100644 variants/rpi_pico2/RpiPico2Board.cpp delete mode 100644 variants/rpi_pico2/RpiPico2Board.h delete mode 100644 variants/rpi_pico2/platformio.ini delete mode 100644 variants/rpi_pico2/target.cpp delete mode 100644 variants/rpi_pico2/target.h diff --git a/platformio.ini b/platformio.ini index 929edf77..f296f838 100644 --- a/platformio.ini +++ b/platformio.ini @@ -96,7 +96,7 @@ build_flags = ${arduino_base.build_flags} lib_deps = ${arduino_base.lib_deps} https://github.com/oltaco/CustomLFS#0.2.3 -; ------------- RP2040 / RP2350 ----------------- +; ----------------- RP2040 --------------------- [rp2040_base] extends = arduino_base diff --git a/variants/rpi_pico2/RpiPico2Board.cpp b/variants/rpi_pico2/RpiPico2Board.cpp deleted file mode 100644 index f5e33971..00000000 --- a/variants/rpi_pico2/RpiPico2Board.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "RpiPico2Board.h" - -#include -#include - -void RpiPico2Board::begin() { - // for future use, sub-classes SHOULD call this from their begin() - startup_reason = BD_STARTUP_NORMAL; - -#ifdef P_LORA_TX_LED - pinMode(P_LORA_TX_LED, OUTPUT); -#endif - -#ifdef PIN_VBAT_READ - pinMode(PIN_VBAT_READ, INPUT); -#endif - -#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL) - Wire.setSDA(PIN_BOARD_SDA); - Wire.setSCL(PIN_BOARD_SCL); -#endif - - Wire.begin(); - - delay(10); // give sx1262 some time to power up -} - -bool RpiPico2Board::startOTAUpdate(const char *id, char reply[]) { - return false; -} diff --git a/variants/rpi_pico2/RpiPico2Board.h b/variants/rpi_pico2/RpiPico2Board.h deleted file mode 100644 index 398c38c6..00000000 --- a/variants/rpi_pico2/RpiPico2Board.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include - -/* - * This board has no built-in way to read battery voltage. - * Nevertheless it's very easy to make it work, you only require two 1% resistors. - * If your using the WIO SX1262 Addon for xaio, make sure you dont connect D0! - * - * BAT+ -----+ - * | - * VSYS --+ -/\/\/\/\- --+ - * 200k | - * +-- D0 - * | - * GND --+ -/\/\/\/\- --+ - * | 100k - * BAT- -----+ - */ -#define PIN_VBAT_READ 26 // D0 -#define BATTERY_SAMPLES 8 -#define ADC_MULTIPLIER (3.0f * 3.3f * 1000) - -class RpiPico2Board : public mesh::MainBoard { -protected: - uint8_t startup_reason; - -public: - void begin(); - uint8_t getStartupReason() const override { return startup_reason; } - - void attachDynamicPrefs(KeyValueStore* prefs) { } // no-op - -#ifdef P_LORA_TX_LED - void onBeforeTransmit() override { digitalWrite(P_LORA_TX_LED, HIGH); } - void onAfterTransmit() override { digitalWrite(P_LORA_TX_LED, LOW); } -#endif - - - uint16_t getBattMilliVolts() override { -#if defined(PIN_VBAT_READ) && defined(ADC_MULTIPLIER) - analogReadResolution(12); - - uint32_t raw = 0; - for (int i = 0; i < BATTERY_SAMPLES; i++) { - raw += analogRead(PIN_VBAT_READ); - } - raw = raw / BATTERY_SAMPLES; - - return (ADC_MULTIPLIER * raw) / 4096; -#else - return 0; -#endif - } - - const char *getManufacturerName() const override { return "RpiPico2"; } - - void reboot() override { rp2040.reboot(); } - - bool startOTAUpdate(const char *id, char reply[]) override; -}; diff --git a/variants/rpi_pico2/platformio.ini b/variants/rpi_pico2/platformio.ini deleted file mode 100644 index fbf47e16..00000000 --- a/variants/rpi_pico2/platformio.ini +++ /dev/null @@ -1,120 +0,0 @@ -[rpi_pico2] -extends = rp2040_base -board = rpipico2 -board_build.filesystem_size = 0.5m -build_flags = ${rp2040_base.build_flags} - -I variants/rpi_pico2 - -D SX126X_CURRENT_LIMIT=140 - -D USE_SX1262 - -D RADIO_CLASS=CustomSX1262 - -D WRAPPER_CLASS=CustomSX1262Wrapper - -D P_LORA_DIO_1=20 - -D P_LORA_NSS=3 - -D P_LORA_RESET=15 - -D P_LORA_BUSY=2 - -D P_LORA_SCLK=10 - -D P_LORA_MOSI=11 - -D P_LORA_MISO=12 - -D P_LORA_TX_LED=25 - -D SX126X_RXEN=RADIOLIB_NC - -D SX126X_TXEN=RADIOLIB_NC - -D SX126X_DIO2_AS_RF_SWITCH=true - -D SX126X_DIO3_TCXO_VOLTAGE=1.8 - -D SX126X_RX_BOOSTED_GAIN=1 - -D LORA_TX_POWER=22 -; Debug options - ; -D DEBUG_RP2040_WIRE=1 - ; -D DEBUG_RP2040_SPI=1 - ; -D DEBUG_RP2040_CORE=1 - ; -D RADIOLIB_DEBUG_SPI=1 - ; -D DEBUG_RP2040_PORT=Serial -build_src_filter = ${rp2040_base.build_src_filter} - + - +<../variants/rpi_pico2> -lib_deps = ${rp2040_base.lib_deps} - -[env:rpi_pico2_repeater] -extends = rpi_pico2 -build_flags = ${rpi_pico2.build_flags} - -D ADVERT_NAME='"Pico2 Repeater"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D MAX_NEIGHBOURS=50 -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -build_src_filter = ${rpi_pico2.build_src_filter} - +<../examples/simple_repeater> - -[env:rpi_pico2_room_server] -extends = rpi_pico2 -build_flags = ${rpi_pico2.build_flags} - -D ADVERT_NAME='"Pico2 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 -build_src_filter = ${rpi_pico2.build_src_filter} - +<../examples/simple_room_server> - -[env:rpi_pico2_companion_radio_usb] -extends = rpi_pico2 -build_flags = ${rpi_pico2.build_flags} - -D MAX_CONTACTS=350 - -D MAX_GROUP_CHANNELS=40 - -D ENABLE_USB_INTERFACE -; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 -; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 -build_src_filter = ${rpi_pico2.build_src_filter} - +<../examples/companion_radio/*.cpp> -lib_deps = ${rpi_pico2.lib_deps} - densaugeo/base64 @ ~1.4.0 -lib_ignore = BLE - -; [env:rpi_pico2_companion_radio_ble] -; extends = rpi_pico2 -; build_flags = ${rpi_pico2.build_flags} -; -D MAX_CONTACTS=100 -; -D MAX_GROUP_CHANNELS=8 -; -D BLE_PIN_CODE=123456 -; -D BLE_DEBUG_LOGGING=1 -; ; -D MESH_PACKET_LOGGING=1 -; ; -D MESH_DEBUG=1 -; build_src_filter = ${rpi_pico2.build_src_filter} -; +<../examples/companion_radio/*.cpp> -; lib_deps = ${rpi_pico2.lib_deps} -; densaugeo/base64 @ ~1.4.0 - -; [env:rpi_pico2_companion_radio_wifi] -; extends = rpi_pico2 -; build_flags = ${rpi_pico2.build_flags} -; -D MAX_CONTACTS=100 -; -D MAX_GROUP_CHANNELS=8 -; -D WIFI_DEBUG_LOGGING=1 -; -D WIFI_SSID='"myssid"' -; -D WIFI_PWD='"mypwd"' -; ; -D MESH_PACKET_LOGGING=1 -; ; -D MESH_DEBUG=1 -; build_src_filter = ${rpi_pico2.build_src_filter} -; +<../examples/companion_radio/*.cpp> -; lib_deps = ${rpi_pico2.lib_deps} -; densaugeo/base64 @ ~1.4.0 - -[env:rpi_pico2_terminal_chat] -extends = rpi_pico2 -build_flags = ${rpi_pico2.build_flags} - -D MAX_CONTACTS=350 - -D MAX_GROUP_CHANNELS=1 -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -build_src_filter = ${rpi_pico2.build_src_filter} - +<../examples/simple_secure_chat/main.cpp> -lib_deps = ${rpi_pico2.lib_deps} - densaugeo/base64 @ ~1.4.0 - -[env:rpi_pico2_kiss_modem] -extends = rpi_pico2 -build_src_filter = ${rpi_pico2.build_src_filter} - +<../examples/kiss_modem/> diff --git a/variants/rpi_pico2/target.cpp b/variants/rpi_pico2/target.cpp deleted file mode 100644 index 9cd72d72..00000000 --- a/variants/rpi_pico2/target.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "target.h" - -#include -#include - -RpiPico2Board board; - -RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI1); - -WRAPPER_CLASS radio_driver(radio, board); - -VolatileRTCClock fallback_clock; -AutoDiscoverRTCClock rtc_clock(fallback_clock); -SensorManager sensors; - -#ifndef LORA_CR -#define LORA_CR 5 -#endif - -bool radio_init() { - rtc_clock.begin(Wire); - - return radio.std_init(&SPI1); -} - -mesh::LocalIdentity radio_new_identity() { - RadioNoiseListener rng(radio); - return mesh::LocalIdentity(&rng); // create new random identity -} - diff --git a/variants/rpi_pico2/target.h b/variants/rpi_pico2/target.h deleted file mode 100644 index 7ff28707..00000000 --- a/variants/rpi_pico2/target.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#define RADIOLIB_STATIC_ONLY 1 - -#include -#include -#include -#include -#include -#include - -extern RpiPico2Board board; -extern WRAPPER_CLASS radio_driver; -extern AutoDiscoverRTCClock rtc_clock; -extern SensorManager sensors; - -bool radio_init(); -mesh::LocalIdentity radio_new_identity(); - From 8f0da87099bdf1d1cf61c7996b9ba53494342363 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 10 Nov 2026 13:05:59 -0400 Subject: [PATCH 4/4] Remove waveshare_c3_zero - the PR was made against main instead of dev - the board does not have a LORA chip, and there is no LORA daughterboard associated with waveshare Zero ecosystem --- .../waveshare_c3_zero/WaveshareC3ZeroBoard.h | 64 --------- variants/waveshare_c3_zero/platformio.ini | 121 ------------------ variants/waveshare_c3_zero/target.cpp | 46 ------- variants/waveshare_c3_zero/target.h | 17 --- 4 files changed, 248 deletions(-) delete mode 100644 variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h delete mode 100644 variants/waveshare_c3_zero/platformio.ini delete mode 100644 variants/waveshare_c3_zero/target.cpp delete mode 100644 variants/waveshare_c3_zero/target.h diff --git a/variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h b/variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h deleted file mode 100644 index c066c6b7..00000000 --- a/variants/waveshare_c3_zero/WaveshareC3ZeroBoard.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include -#include - -#include - -class WaveshareC3ZeroBoard : public ESP32Board { -public: - void begin() { - ESP32Board::begin(); - - esp_reset_reason_t reason = esp_reset_reason(); - if (reason == ESP_RST_DEEPSLEEP) { - long wakeup_source = esp_sleep_get_gpio_wakeup_status(); - if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep) - startup_reason = BD_STARTUP_RX_PACKET; - } - - #if defined(LORA_TX_BOOST_PIN) - gpio_hold_dis((gpio_num_t) LORA_TX_BOOST_PIN); - gpio_deep_sleep_hold_dis(); - #endif - } - - #ifdef LORA_TX_BOOST_PIN - pinMode(LORA_TX_BOOST_PIN, OUTPUT); - digitalWrite(LORA_TX_BOOST_PIN, HIGH); - #endif - - #ifdef P_LORA_TX_LED - pinMode(P_LORA_TX_LED, OUTPUT); - digitalWrite(P_LORA_TX_LED, LOW); - #endif - } - -#if defined(LORA_TX_BOOST_PIN) || defined(P_LORA_TX_LED) - void onBeforeTransmit() override { - #if defined(P_LORA_TX_LED) - digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on - #endif - #if defined(LORA_TX_BOOST_PIN) - digitalWrite(LORA_TX_BOOST_PIN, LOW); - delay(5); - #endif - } - void onAfterTransmit() override { - #if defined(LORA_TX_BOOST_PIN) - digitalWrite(LORA_TX_BOOST_PIN, HIGH); - #endif - #if defined(P_LORA_TX_LED) - digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off - #endif - } -#endif - - uint16_t getBattMilliVolts() override { - return 0; // no battery-voltage-divider circuit on this board - } - - const char* getManufacturerName() const override { - return "Waveshare ESP32-C3-Zero"; - } -}; diff --git a/variants/waveshare_c3_zero/platformio.ini b/variants/waveshare_c3_zero/platformio.ini deleted file mode 100644 index 3811f349..00000000 --- a/variants/waveshare_c3_zero/platformio.ini +++ /dev/null @@ -1,121 +0,0 @@ -[Waveshare_C3_Zero] -extends = esp32_base -board = esp32-c3-devkitm-1 -board_build.flash_mode = dio -build_flags = - ${esp32_base.build_flags} - -I variants/waveshare_c3_zero - -D ARDUINO_USB_CDC_ON_BOOT=1 - -D ARDUINO_USB_MODE=1 - -D P_LORA_NSS=7 - -D P_LORA_DIO_1=3 - -D P_LORA_RESET=0 - -D P_LORA_BUSY=1 - -D P_LORA_SCLK=4 - -D P_LORA_MISO=5 - -D P_LORA_MOSI=6 - -D SX126X_RXEN=10 - -D USE_SX1262 - -D RADIO_CLASS=CustomSX1262 - -D WRAPPER_CLASS=CustomSX1262Wrapper - -D SX126X_RX_BOOSTED_GAIN=1 - -D LORA_TX_POWER=14 - -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/waveshare_c3_zero> - + -lib_deps = - ${esp32_base.lib_deps} - -[env:Waveshare_C3_Zero_repeater] -extends = Waveshare_C3_Zero -build_src_filter = ${Waveshare_C3_Zero.build_src_filter} - +<../examples/simple_repeater/*.cpp> -build_flags = - ${Waveshare_C3_Zero.build_flags} - ${sensor_base.build_flags} - -UENV_INCLUDE_GPS - -UENV_INCLUDE_VL53L0X - -D ADVERT_NAME='"Waveshare C3 Repeater"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D MAX_NEIGHBOURS=50 -lib_deps = - ${Waveshare_C3_Zero.lib_deps} - ${sensor_base.lib_deps} - ${esp32_ota.lib_deps} - bakercp/CRC32 @ ^2.0.0 - -[env:Waveshare_C3_Zero_room_server] -extends = Waveshare_C3_Zero -build_src_filter = ${Waveshare_C3_Zero.build_src_filter} - +<../examples/simple_room_server/*.cpp> -build_flags = - ${Waveshare_C3_Zero.build_flags} - ${sensor_base.build_flags} - -UENV_INCLUDE_GPS - -UENV_INCLUDE_VL53L0X - -D ADVERT_NAME='"Waveshare C3 Room"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D ROOM_PASSWORD='"hello"' -lib_deps = - ${Waveshare_C3_Zero.lib_deps} - ${sensor_base.lib_deps} - ${esp32_ota.lib_deps} - bakercp/CRC32 @ ^2.0.0 - -[env:Waveshare_C3_Zero_companion_radio_usb] -extends = Waveshare_C3_Zero -build_src_filter = ${Waveshare_C3_Zero.build_src_filter} - +<../examples/companion_radio/*.cpp> - + -build_flags = - ${Waveshare_C3_Zero.build_flags} - -D MAX_CONTACTS=350 - -D MAX_GROUP_CHANNELS=40 - -D OFFLINE_QUEUE_SIZE=256 - -D ENABLE_USB_INTERFACE -lib_deps = - ${Waveshare_C3_Zero.lib_deps} - ${esp32_ota.lib_deps} - densaugeo/base64 @ ~1.4.0 - -[env:Waveshare_C3_Zero_companion_radio_ble] -extends = Waveshare_C3_Zero -board_build.partitions = huge_app.csv -build_src_filter = ${Waveshare_C3_Zero.build_src_filter} - +<../examples/companion_radio/*.cpp> - + -build_flags = - ${Waveshare_C3_Zero.build_flags} - -D MAX_CONTACTS=350 - -D MAX_GROUP_CHANNELS=40 - -D BLE_PIN_CODE=123456 - -D OFFLINE_QUEUE_SIZE=256 -lib_deps = - ${Waveshare_C3_Zero.lib_deps} - ${esp32_ota.lib_deps} - densaugeo/base64 @ ~1.4.0 - -[env:Waveshare_C3_Zero_companion_radio_wifi] -extends = Waveshare_C3_Zero -build_src_filter = ${Waveshare_C3_Zero.build_src_filter} - +<../examples/companion_radio/*.cpp> - + -build_flags = - ${Waveshare_C3_Zero.build_flags} - -D MAX_CONTACTS=350 - -D MAX_GROUP_CHANNELS=40 - -D OFFLINE_QUEUE_SIZE=256 - -D WIFI_DEBUG_LOGGING=1 - -D WIFI_SSID='"MySsid"' - -D WIFI_PWD='"MyPWD"' -lib_deps = - ${Waveshare_C3_Zero.lib_deps} - ${esp32_ota.lib_deps} - densaugeo/base64 @ ~1.4.0 diff --git a/variants/waveshare_c3_zero/target.cpp b/variants/waveshare_c3_zero/target.cpp deleted file mode 100644 index cb334fbb..00000000 --- a/variants/waveshare_c3_zero/target.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include "target.h" - -WaveshareC3ZeroBoard board; - -#if defined(P_LORA_SCLK) - // NOTE: ESP32-C3 only exposes one general-purpose SPI peripheral (FSPI). - // The default SPIClass() constructor does not reliably bind to it on this - // chip, which silently produces an SPI object that never talks to real - // hardware -- radio chip-detection then fails every time with no error - // other than RADIOLIB_ERR_CHIP_NOT_FOUND. Always pass FSPI explicitly. - 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); - -#if ENV_INCLUDE_GPS - #include - MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock); - EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea); -#else - EnvironmentSensorManager sensors; -#endif - -bool radio_init() { - fallback_clock.begin(); - rtc_clock.begin(Wire); - -#if defined(P_LORA_SCLK) - spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI); - return radio.std_init(&spi); -#else - return radio.std_init(); -#endif -} - -mesh::LocalIdentity radio_new_identity() { - RadioNoiseListener rng(radio); - return mesh::LocalIdentity(&rng); // create new random identity -} diff --git a/variants/waveshare_c3_zero/target.h b/variants/waveshare_c3_zero/target.h deleted file mode 100644 index f17f197c..00000000 --- a/variants/waveshare_c3_zero/target.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#define RADIOLIB_STATIC_ONLY 1 -#include -#include -#include -#include -#include -#include - -extern WaveshareC3ZeroBoard board; -extern WRAPPER_CLASS radio_driver; -extern AutoDiscoverRTCClock rtc_clock; -extern EnvironmentSensorManager sensors; - -bool radio_init(); -mesh::LocalIdentity radio_new_identity(); \ No newline at end of file