Add MeshCore relay_radio firmware for Heltec T114
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
Run Unit Tests / test (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (Tbeam_SX1276_repeater) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
PR Build Check / build (wio_wm1110_repeater) (push) Has been cancelled

This commit is contained in:
2026-06-09 15:36:22 +03:00
commit cdd9d32fb5
787 changed files with 108699 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#include "XiaoRP2040Board.h"
#include <Arduino.h>
#include <Wire.h>
void XiaoRP2040Board::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 XiaoRP2040Board::startOTAUpdate(const char *id, char reply[]) {
return false;
}

View File

@@ -0,0 +1,60 @@
#pragma once
#include <Arduino.h>
#include <MeshCore.h>
/*
* 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 XiaoRP2040Board : public mesh::MainBoard {
protected:
uint8_t startup_reason;
public:
void begin();
uint8_t getStartupReason() const override { return startup_reason; }
#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 "Xiao RP2040"; }
void reboot() override { rp2040.reboot(); }
bool startOTAUpdate(const char *id, char reply[]) override;
};

View File

@@ -0,0 +1,116 @@
[Xiao_rp2040]
extends = rp2040_base
board = seeed_xiao_rp2040
board_build.filesystem_size = 0.5m
build_flags = ${rp2040_base.build_flags}
-I variants/xiao_rp2040
-D SX126X_CURRENT_LIMIT=140
-D USE_SX1262
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D P_LORA_DIO_1=27 ; D1
-D P_LORA_NSS=6 ; D4
-D P_LORA_RESET=28 ; D2
-D P_LORA_BUSY=29 ; D3
-D P_LORA_TX_LED=17
-D SX126X_RXEN=7 ; D5
-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}
+<XiaoRP2040Board.cpp>
+<../variants/xiao_rp2040>
lib_deps = ${rp2040_base.lib_deps}
[env:Xiao_rp2040_repeater]
extends = Xiao_rp2040
build_flags = ${Xiao_rp2040.build_flags}
-D ADVERT_NAME='"Xiao 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 = ${Xiao_rp2040.build_src_filter}
+<../examples/simple_repeater>
[env:Xiao_rp2040_room_server]
extends = Xiao_rp2040
build_flags = ${Xiao_rp2040.build_flags}
-D ADVERT_NAME='"Xiao 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 = ${Xiao_rp2040.build_src_filter}
+<../examples/simple_room_server>
[env:Xiao_rp2040_companion_radio_usb]
extends = Xiao_rp2040
build_flags = ${Xiao_rp2040.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${Xiao_rp2040.build_src_filter}
+<../examples/companion_radio/*.cpp>
lib_deps = ${Xiao_rp2040.lib_deps}
densaugeo/base64 @ ~1.4.0
lib_ignore = BLE
; [env:Xiao_rp2040_companion_radio_ble]
; extends = Xiao_rp2040
; build_flags = ${Xiao_rp2040.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 = ${Xiao_rp2040.build_src_filter}
; +<../examples/companion_radio/*.cpp>
; lib_deps = ${Xiao_rp2040.lib_deps}
; densaugeo/base64 @ ~1.4.0
; [env:Xiao_rp2040_companion_radio_wifi]
; extends = Xiao_rp2040
; build_flags = ${Xiao_rp2040.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 = ${Xiao_rp2040.build_src_filter}
; +<../examples/companion_radio/*.cpp>
; lib_deps = ${Xiao_rp2040.lib_deps}
; densaugeo/base64 @ ~1.4.0
[env:Xiao_rp2040_terminal_chat]
extends = Xiao_rp2040
build_flags = ${Xiao_rp2040.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Xiao_rp2040.build_src_filter}
+<../examples/simple_secure_chat/main.cpp>
lib_deps = ${Xiao_rp2040.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:Xiao_rp2040_kiss_modem]
extends = Xiao_rp2040
build_src_filter = ${Xiao_rp2040.build_src_filter}
+<../examples/kiss_modem/>

View File

@@ -0,0 +1,35 @@
#include "target.h"
#include <Arduino.h>
#include <helpers/ArduinoHelpers.h>
XiaoRP2040Board board;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
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);
#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
}

View File

@@ -0,0 +1,19 @@
#pragma once
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/radiolib/CustomSX1262Wrapper.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <helpers/SensorManager.h>
#include <XiaoRP2040Board.h>
extern XiaoRP2040Board board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;
extern SensorManager sensors;
bool radio_init();
mesh::LocalIdentity radio_new_identity();