Merge remote-tracking branch 'upstream/dev' into feat/kiss-agc-fem-control

This commit is contained in:
agessaman committed 2026-11-06 20:38:01 -08:00
commit c0ccb9c7ff
123 files changed
+2095 -396

No files matched your search

@@ -7,7 +7,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/gat562_30s_mesh_kit
-D RAK_4631
-D RAK_BOARD
-D NRF52_POWER_MANAGEMENT
-D PIN_BOARD_SCL=14
-D PIN_BOARD_SDA=13
-D PIN_OLED_RESET=-1
@@ -5,7 +5,6 @@ board_check = true
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/gat562_mesh_evb_pro
-D NRF52_POWER_MANAGEMENT
-D PIN_BOARD_SCL=14
-D PIN_BOARD_SDA=13
-D RADIO_CLASS=CustomSX1262
@@ -5,7 +5,6 @@ board_check = true
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/gat562_mesh_tracker_pro
-D NRF52_POWER_MANAGEMENT
-D PIN_BOARD_SCL=14
-D PIN_BOARD_SDA=13
-D PIN_OLED_RESET=-1
@@ -8,7 +8,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/gat562_mesh_watch13
-D RAK_4631
-D RAK_BOARD
-D NRF52_POWER_MANAGEMENT
-D PIN_BOARD_SCL=14
-D PIN_BOARD_SDA=13
-D PIN_OLED_RESET=-1
-1
View File
@@ -9,7 +9,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/heltec_t096
-I src/helpers/ui
-D HELTEC_T096
-D NRF52_POWER_MANAGEMENT
-D P_LORA_DIO_1=21
-D P_LORA_NSS=5
-D P_LORA_RESET=16
+6
View File
@@ -9,6 +9,12 @@
#define USE_LFXO
#define VARIANT_MCK (64000000ul)
// This board has no external RTC chip -- the ICM-42607-P IMU sits at 0x68,
// the same I2C address DS3231 probing checks, so without this the IMU gets
// misidentified as a DS3231 and its unrelated registers get read/written
// as if they were time/status registers, producing a bogus, unfixable clock.
#define DISABLE_DS3231_PROBE
////////////////////////////////////////////////////////////////////////////////
// Number of pins
-1
View File
@@ -12,7 +12,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/heltec_t114
-I src/helpers/ui
-D HELTEC_T114
-D NRF52_POWER_MANAGEMENT
-D P_LORA_DIO_1=20
-D P_LORA_NSS=24
-D P_LORA_RESET=25
+5 -1
View File
@@ -168,12 +168,14 @@ build_flags =
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
@@ -312,12 +314,14 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
lib_deps =
${Heltec_lora32_v3.lib_deps}
+4
View File
@@ -211,12 +211,14 @@ build_flags =
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${heltec_v4_oled.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
@@ -378,12 +380,14 @@ build_flags =
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${heltec_v4_tft.build_src_filter}
+<helpers/ui/ST7789LCDDisplay.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
+2
View File
@@ -160,10 +160,12 @@ build_flags =
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
@@ -52,11 +52,13 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=E213Display
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D BLE_DEBUG_LOGGING=1
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
+<helpers/ui/E213Display.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
@@ -9,7 +9,7 @@ protected:
uint8_t btn_prev_state;
public:
TImpulsePlusBoard() : NRF52Board("T-Impulse-Plus OTA") {}
TImpulsePlusBoard() : NRF52Board("T-Impulse-Plus_OTA") {}
void begin();
#if defined(P_LORA_TX_LED)
@@ -131,11 +131,13 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=8
; -D MESH_DEBUG=1
build_src_filter = ${T_Beam_S3_Supreme_SX1262.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
+9 -3
View File
@@ -32,8 +32,16 @@ build_flags = ${nrf52_base.build_flags}
-D PIN_GPS_RESET_ACTIVE=LOW
-D TELEM_BME280_ADDRESS=0x77
-D DISPLAY_CLASS=GxEPDDisplay
-D EINK_DISPLAY_MODEL=GxEPD2_154_D67
-D EINK_SCALE_X=1.5625f
-D EINK_SCALE_Y=1.5625f
-D EINK_X_OFFSET=0
-D EINK_Y_OFFSET=10
-D EINK_SCREENOFF_BLANK
-D UI_RECENT_LIST_SIZE=9
-D UI_MSG_PREVIEW_SIZE=165
-D AUTO_OFF_MILLIS=300000
-D BACKLIGHT_BTN=PIN_BUTTON2
-D AUTO_OFF_MILLIS=0
build_src_filter = ${nrf52_base.build_src_filter}
+<helpers/*.cpp>
+<TechoBoard.cpp>
@@ -91,7 +99,6 @@ build_flags =
-D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D UI_RECENT_LIST_SIZE=9
-D UI_SENSORS_PAGE=1
-D UI_GPS_PAGE=1
; -D MESH_PACKET_LOGGING=1
@@ -116,7 +123,6 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D UI_RECENT_LIST_SIZE=9
-D UI_SENSORS_PAGE=1
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
-D QSPIFLASH=1
+1
View File
@@ -23,6 +23,7 @@ EnvironmentSensorManager sensors = EnvironmentSensorManager();
#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
MomentaryButton backlight_btn(BACKLIGHT_BTN, 1000, true);
#endif
bool radio_init() {
+1
View File
@@ -22,6 +22,7 @@ extern EnvironmentSensorManager sensors;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
extern MomentaryButton backlight_btn;
#endif
bool radio_init();
+6
View File
@@ -131,6 +131,12 @@ extern const int SCK;
#define DISP_BUSY (3)
#define DISP_BACKLIGHT (43)
// used by GxEPDDisplay when EINK_DISPLAY_MODEL is set
#define PIN_DISPLAY_CS DISP_CS
#define PIN_DISPLAY_DC DISP_DC
#define PIN_DISPLAY_RST DISP_RST
#define PIN_DISPLAY_BUSY DISP_BUSY
////////////////////////////////////////////////////////////////////////////////
// GPS
+26 -5
View File
@@ -98,6 +98,32 @@ lib_deps =
${LilyGo_T-Echo-Lite.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_T-Echo-Lite_kiss_modem]
extends = LilyGo_T-Echo-Lite
build_src_filter = ${LilyGo_T-Echo-Lite.build_src_filter}
+<../examples/kiss_modem/>
[env:LilyGo_T-Echo-Lite_companion_radio_usb]
extends = LilyGo_T-Echo-Lite
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
board_upload.maximum_size = 712704
build_flags =
${LilyGo_T-Echo-Lite.build_flags}
-I src/helpers/ui
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D UI_RECENT_LIST_SIZE=9
-D UI_SENSORS_PAGE=1
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
; -D QSPIFLASH=1
build_src_filter = ${LilyGo_T-Echo-Lite.build_src_filter}
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${LilyGo_T-Echo-Lite.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_T-Echo-Lite_non_shell_companion_radio_ble]
extends = LilyGo_T-Echo-Lite
upload_protocol = nrfutil
@@ -187,8 +213,3 @@ build_src_filter = ${nrf52_base.build_src_filter}
lib_deps =
${LilyGo_T-Echo-Lite.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_T-Echo-Lite_kiss_modem]
extends = LilyGo_T-Echo-Lite
build_src_filter = ${LilyGo_T-Echo-Lite.build_src_filter}
+<../examples/kiss_modem/>
+3 -9
View File
@@ -70,9 +70,6 @@
#define PIN_QSPI_IO2 _PINNUM(1, 9)
#define PIN_QSPI_IO3 _PINNUM(0, 26)
#define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR
#define EXTERNAL_FLASH_USE_QSPI
////////////////////////////////////////////////////////////////////////////////
// Builtin LEDs
@@ -95,9 +92,6 @@
#define PIN_BUTTON2 _PINNUM(0, 18)
#define BUTTON_PIN2 PIN_BUTTON2
#define EXTERNAL_FLASH_DEVICES MX25R1635F
#define EXTERNAL_FLASH_USE_QSPI
////////////////////////////////////////////////////////////////////////////////
// Lora
@@ -154,8 +148,8 @@ extern const int SCK;
// GPS — per LilyGo t_echo_lite_config.h
// PIN_GPS_TX/RX named from GPS module's perspective
#define PIN_GPS_TX _PINNUM(0, 29) // GPS UART TX → MCU RX
#define PIN_GPS_RX _PINNUM(1, 10) // GPS UART RX ← MCU TX
#define PIN_GPS_RX _PINNUM(0, 29) // GPS UART TX → MCU RX
#define PIN_GPS_TX _PINNUM(1, 10) // GPS UART RX ← MCU TX
#define GPS_EN _PINNUM(1, 11) // GPS RT9080 power enable
#define PIN_GPS_STANDBY _PINNUM(1, 13) // GPS wake-up
#define PIN_GPS_PPS _PINNUM(1, 15) // GPS 1PPS
#define PIN_GPS_PPS _PINNUM(1, 15) // GPS 1PPS
+4
View File
@@ -110,5 +110,9 @@ lib_deps =
[env:M5Stack_Unit_C6L_kiss_modem]
extends = M5Stack_Unit_C6L
build_flags = ${M5Stack_Unit_C6L.build_flags}
-D ARDUINO_USB_CDC_ON_BOOT=1
-D ARDUINO_USB_MODE=1
-D ENABLE_USB_INTERFACE
build_src_filter = ${M5Stack_Unit_C6L.build_src_filter}
+<../examples/kiss_modem/>
+1 -1
View File
@@ -9,7 +9,7 @@ protected:
uint8_t btn_prev_state;
public:
MeshtinyBoard() : NRF52Board("Meshtiny OTA") {}
MeshtinyBoard() : NRF52Board("Meshtiny_OTA") {}
void begin();
#if defined(P_LORA_TX_LED)
@@ -5,7 +5,6 @@
void MeshTrackerX1Board::begin() {
NRF52BoardDCDC::begin();
btn_prev_state = LOW; // button is active HIGH
#ifdef BUTTON_PIN
pinMode(BATTERY_PIN, INPUT);
@@ -5,9 +5,6 @@
#include <helpers/NRF52Board.h>
class MeshTrackerX1Board : public NRF52BoardDCDC {
protected:
uint8_t btn_prev_state;
public:
MeshTrackerX1Board() : NRF52Board("X1_OTA") {}
void begin();
@@ -35,17 +32,6 @@ public:
return "Seeed SenseCAP MeshTracker X1";
}
int buttonStateChanged() {
#ifdef BUTTON_PIN
uint8_t v = digitalRead(BUTTON_PIN);
if (v != btn_prev_state) {
btn_prev_state = v;
return (v == USER_BTN_PRESSED) ? 1 : -1;
}
#endif
return 0;
}
void powerOff() override {
#ifdef HAS_GPS
digitalWrite(GPS_VRTC_EN, LOW);
+10 -28
View File
@@ -1,6 +1,7 @@
#include <Arduino.h>
#include "target.h"
#include <helpers/sensors/MicroNMEALocationProvider.h>
#include <helpers/sensors/AirohaSleep.h>
MeshTrackerX1Board board;
@@ -27,46 +28,27 @@ mesh::LocalIdentity radio_new_identity() {
void MeshTrackerX1SensorManager::start_gps() {
gps_active = true;
// this init sequence comes from seeed examples and deals with all gps pins
pinMode(GPS_EN, OUTPUT);
digitalWrite(GPS_EN, HIGH);
delay(10);
pinMode(GPS_VRTC_EN, OUTPUT);
digitalWrite(GPS_VRTC_EN, HIGH);
delay(10);
pinMode(GPS_RESET, OUTPUT);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
pinMode(GPS_SLEEP_INT, OUTPUT);
digitalWrite(GPS_SLEEP_INT, HIGH);
pinMode(GPS_RTC_INT, OUTPUT);
digitalWrite(GPS_RTC_INT, LOW);
}
void MeshTrackerX1SensorManager::sleep_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, HIGH); // keep RTC alive for faster fix on wake
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, LOW);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, HIGH);
delay(5);
digitalWrite(GPS_RTC_INT, LOW);
}
void MeshTrackerX1SensorManager::stop_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_VRTC_EN, HIGH); // keep GPS RTC alive for faster fix on wake
digitalWrite(GPS_RTC_INT, LOW); // make sure this is LOW so we can pulse it to wake
airohaEnterSleep(_nmea);
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, LOW);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, LOW);
}
bool MeshTrackerX1SensorManager::begin() {
// init GPS
Serial1.begin(GPS_BAUD_RATE);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
// init SPA06-003 barometer
baro_ok = spa06.begin(SPA06_003_DEFAULT_ADDR, &Wire) || spa06.begin(0x76, &Wire);
@@ -122,7 +104,7 @@ const char* MeshTrackerX1SensorManager::getSettingValue(int i) const {
bool MeshTrackerX1SensorManager::setSettingValue(const char* name, const char* value) {
if (strcmp(name, "gps") == 0) {
if (strcmp(value, "0") == 0) {
sleep_gps(); // sleep for faster fix !
stop_gps();
} else {
start_gps();
}
-1
View File
@@ -7,7 +7,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/muziworks_r1_neo
-I src/helpers/ui
-D R1Neo
-D NRF52_POWER_MANAGEMENT
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D DISPLAY_CLASS=NullDisplayDriver
-1
View File
@@ -5,7 +5,6 @@
void PromicroBoard::begin() {
NRF52Board::begin();
btn_prev_state = HIGH;
pinMode(PIN_VBAT_READ, INPUT);
-12
View File
@@ -9,7 +9,6 @@
class PromicroBoard : public NRF52BoardDCDC {
protected:
uint8_t btn_prev_state;
float adc_mult = ADC_MULTIPLIER;
public:
@@ -48,15 +47,4 @@ public:
const char* getManufacturerName() const override {
return "ProMicro DIY";
}
int buttonStateChanged() {
#ifdef BUTTON_PIN
uint8_t v = digitalRead(BUTTON_PIN);
if (v != btn_prev_state) {
btn_prev_state = v;
return (v == LOW) ? 1 : -1;
}
#endif
return 0;
}
};
+2
View File
@@ -23,6 +23,7 @@ build_flags = ${nrf52_base.build_flags}
-D ENV_INCLUDE_BMP280=1
-D ENV_INCLUDE_INA3221=1
-D ENV_INCLUDE_INA219=1
-D ENV_INCLUDE_INA226=1
build_src_filter = ${nrf52_base.build_src_filter}
+<helpers/sensors>
+<../variants/promicro>
@@ -34,6 +35,7 @@ lib_deps= ${nrf52_base.lib_deps}
adafruit/Adafruit BME280 Library @ ^2.3.0
adafruit/Adafruit BMP280 Library@^2.6.8
stevemarple/MicroNMEA @ ^2.0.6
robtillaart/INA226@^0.6.6
[env:ProMicro_repeater]
extends = Promicro
+3
View File
@@ -2,6 +2,7 @@
#include <Arduino.h>
#include <MeshCore.h>
#include <helpers/KeyValueStore.h>
// from https://github.com/RAKWireless/RAK11300-AT-Command-Firmware/blob/9c48409a43620a828d653501d536473200aa33af/RAK11300-AT-Arduino/batt.cpp#L17-L19
#define VBAT_MV_PER_LSB (0.806F) // 3.0V ADC range and 12 - bit ADC resolution = 3300mV / 4096
@@ -46,4 +47,6 @@ public:
void reboot() override { rp2040.reboot(); }
bool startOTAUpdate(const char *id, char reply[]) override;
void attachDynamicPrefs(KeyValueStore* prefs) { } // no-op
};
+3 -1
View File
@@ -155,12 +155,14 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
-D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${rak3112.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-orig/*.cpp>
lib_deps =
-1
View File
@@ -7,7 +7,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/rak3401
-D RAK_3401
-D RAK_BOARD
-D NRF52_POWER_MANAGEMENT
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D LORA_TX_POWER=22
+13 -11
View File
@@ -9,7 +9,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/rak4631
-D RAK_4631
-D RAK_BOARD
-D NRF52_POWER_MANAGEMENT
-D PIN_BOARD_SCL=14
-D PIN_BOARD_SDA=13
-D PIN_GPS_TX=PIN_SERIAL1_RX
@@ -29,11 +28,14 @@ build_src_filter = ${nrf52_base.build_src_filter}
+<../variants/rak4631>
+<helpers/sensors>
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/SH1106Display.cpp>
+<helpers/ui/AutoDetectDisplay.cpp>
+<helpers/ui/MomentaryButton.cpp>
lib_deps =
${nrf52_base.lib_deps}
${sensor_base.lib_deps}
adafruit/Adafruit SSD1306 @ ^2.5.13
adafruit/Adafruit SH110X @ ^2.1.13
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.27
boschsensortec/BSEC Software Library @ ^1.8.1492
@@ -41,7 +43,7 @@ lib_deps =
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"RAK4631 Repeater"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
@@ -57,7 +59,7 @@ build_src_filter = ${rak4631.build_src_filter}
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"RAK4631 Repeater"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
@@ -76,7 +78,7 @@ lib_deps =
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"RS232 Bridge"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
@@ -99,7 +101,7 @@ build_src_filter = ${rak4631.build_src_filter}
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"RS232 Bridge"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
@@ -122,7 +124,7 @@ build_src_filter = ${rak4631.build_src_filter}
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"Test Room"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
@@ -138,7 +140,7 @@ build_src_filter = ${rak4631.build_src_filter}
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"RAK4631 Room Server"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
@@ -162,7 +164,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D PIN_USER_BTN=9
-D PIN_USER_BTN_ANA=31
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
@@ -187,7 +189,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D PIN_USER_BTN=9
-D PIN_USER_BTN_ANA=31
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ETHERNET_ENABLED=1
@@ -216,7 +218,7 @@ build_flags =
-I examples/companion_radio/ui-new
-D PIN_USER_BTN=9
-D PIN_USER_BTN_ANA=31
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
@@ -252,7 +254,7 @@ lib_deps =
extends = rak4631
build_flags =
${rak4631.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D DISPLAY_CLASS=AutoDetectDisplay
-D ADVERT_NAME='"RAK4631 Sensor"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
+1 -1
View File
@@ -9,7 +9,7 @@
#include <helpers/sensors/EnvironmentSensorManager.h>
#ifdef DISPLAY_CLASS
#include <helpers/ui/SSD1306Display.h>
#include <helpers/ui/AutoDetectDisplay.h>
extern DISPLAY_CLASS display;
#include <helpers/ui/MomentaryButton.h>
extern MomentaryButton user_btn;
@@ -1,5 +1,6 @@
#include <Arduino.h>
#include <Wire.h>
#include <HardwarePWM.h>
#include "SenseCapSolarBoard.h"
@@ -50,6 +51,9 @@ void SenseCapSolarBoard::begin() {
#ifdef LED_WHITE
pinMode(LED_WHITE, OUTPUT);
digitalWrite(LED_WHITE, LOW);
#ifdef SENSECAP_SOLAR_WHITE_LED
white_led_last_pulse_at_ = millis(); // first heartbeat pulse 5 s after boot
#endif
#endif
#ifdef LED_BLUE
pinMode(LED_BLUE, OUTPUT);
@@ -67,3 +71,76 @@ void SenseCapSolarBoard::begin() {
delay(10); // give sx1262 some time to power up
}
#ifdef SENSECAP_SOLAR_WHITE_LED
// Dimmed WHITE heartbeat using hardware PWM (repeater builds only).
//
// Peripheral audit for this firmware: no analogWrite()/tone() callers, no
// NeoPixel/Servo, Bluefruit52Lib uses no PWM, SoftDevice S140 does not own
// any PWM instance -> NRF_PWM0 (HwPWM0) is free. takeOwnership() fences the
// instance so a future analogWrite() caller cannot claim it.
//
// Timing: base clock 16 MHz (DIV_1), COUNTERTOP 16000 -> exactly 1 kHz.
// Duty: HardwarePWM non-inverted values place bit15 (active-HIGH polarity),
// so compare 1600 => HIGH for [0,1600)/16000 => 10% duty, active-high.
static const uint32_t WHITE_LED_PWM_TOKEN = 0x5031574C; // 'P1WL'
static const uint16_t WHITE_LED_PWM_TOP = 16000; // 16 MHz / 16000 = 1 kHz
static const uint16_t WHITE_LED_PWM_DUTY = 1600; // 1600 / 16000 = 10 %
static_assert(WHITE_LED_PWM_TOP <= 0x7FFF, "PWM compare values are 15-bit");
static_assert(WHITE_LED_PWM_DUTY < WHITE_LED_PWM_TOP, "duty must stay below COUNTERTOP");
void SenseCapSolarBoard::whiteLedHeartbeatOn() {
HwPWM0.takeOwnership(WHITE_LED_PWM_TOKEN); // no-op once owned; keeps analogWrite away
HwPWM0.setClockDiv(PWM_PRESCALER_PRESCALER_DIV_1); // 16 MHz base clock
HwPWM0.setMaxValue(WHITE_LED_PWM_TOP); // 1 kHz period
HwPWM0.addPin(LED_WHITE); // drives pin LOW, connects PSEL
HwPWM0.writePin(LED_WHITE, WHITE_LED_PWM_DUTY); // enables + starts 10% PWM
}
void SenseCapSolarBoard::whiteLedHeartbeatOff() {
HwPWM0.stop(); // ENABLE=0: waveform and its HFCLK demand stop
if (HwPWM0.checkPin(LED_WHITE)) {
HwPWM0.removePin(LED_WHITE); // disconnect PSEL; GPIO block drives again
}
pinMode(LED_WHITE, OUTPUT);
digitalWrite(LED_WHITE, LOW); // deterministic LOW during the 4900 ms off phase
}
// 100 ms pulse every 5000 ms, non-blocking millis() with wrap-safe unsigned
// arithmetic. Called from loop(); frozen while the OTA steady-on owns the LED.
void SenseCapSolarBoard::updateWhiteStatusLed() {
if (white_led_ota_active_) return;
const uint32_t now = millis();
const uint32_t elapsed = (uint32_t)(now - white_led_last_pulse_at_);
if (white_led_pulse_active_ && elapsed >= 100U) {
whiteLedHeartbeatOff(); // stop PWM, pin LOW
white_led_pulse_active_ = false;
}
if (!white_led_pulse_active_ && elapsed >= 5000U) {
whiteLedHeartbeatOn(); // 1 kHz hardware PWM, 10% duty
white_led_pulse_active_ = true;
white_led_last_pulse_at_ = now;
}
}
void SenseCapSolarBoard::loop() {
mesh::MainBoard::loop(); // keep base housekeeping (watchdog etc.) if it ever gains any
updateWhiteStatusLed();
}
// `start ota` keeps WHITE on for as long as the application is advertising
// its BLE OTA service. The heartbeat PWM is stopped and the pin released
// first, so steady-on is a plain full-brightness GPIO drive (no PWM vs
// digitalWrite conflict). On a failed start nothing changes: the heartbeat
// keeps its normal blinking.
bool SenseCapSolarBoard::startOTAUpdate(const char *id, char reply[]) {
const bool started = NRF52Board::startOTAUpdate(id, reply);
if (started) {
white_led_ota_active_ = true;
whiteLedHeartbeatOff();
digitalWrite(LED_WHITE, LED_STATE_ON);
}
return started;
}
#endif // SENSECAP_SOLAR_WHITE_LED
@@ -5,6 +5,19 @@
#include <helpers/NRF52Board.h>
class SenseCapSolarBoard : public NRF52BoardDCDC {
#ifdef SENSECAP_SOLAR_WHITE_LED
// Dimmed white-LED heartbeat state (repeater builds only; enabled with
// -D SENSECAP_SOLAR_WHITE_LED in the PlatformIO env, so room-server and
// companion firmwares sharing this board class are unaffected).
bool white_led_ota_active_ = false;
bool white_led_pulse_active_ = false;
uint32_t white_led_last_pulse_at_ = 0;
void whiteLedHeartbeatOn(); // start 1 kHz PWM at 10% duty on LED_WHITE
void whiteLedHeartbeatOff(); // stop/release PWM, hold LED_WHITE LOW
void updateWhiteStatusLed(); // non-blocking 100 ms pulse every 5000 ms
#endif
protected:
#ifdef NRF52_POWER_MANAGEMENT
void initiateShutdown(uint8_t reason) override;
@@ -14,6 +27,13 @@ public:
SenseCapSolarBoard() : NRF52Board("SENSECAP_SOLAR_OTA") {}
void begin();
#ifdef SENSECAP_SOLAR_WHITE_LED
// Runs the white-LED heartbeat; invoked by the example main loops via the
// existing board.loop() call (mesh::MainBoard::loop() is a no-op by default).
void loop() override;
bool startOTAUpdate(const char *id, char reply[]) override;
#endif
#if defined(P_LORA_TX_LED)
void onBeforeTransmit() override {
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
@@ -38,6 +58,9 @@ public:
}
void powerOff() override {
#ifdef SENSECAP_SOLAR_WHITE_LED
whiteLedHeartbeatOff(); // stop/release the heartbeat PWM before shutdown
#endif
digitalWrite(LED_WHITE, LOW);
digitalWrite(LED_BLUE, LOW);
+2 -1
View File
@@ -10,7 +10,6 @@ build_flags = ${nrf52_base.build_flags}
-I src/helpers/nrf52
-D NRF52_PLATFORM=1
-D USE_SX1262
-D NRF52_POWER_MANAGEMENT
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D P_LORA_TX_LED=12
@@ -46,6 +45,8 @@ build_flags =
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
; dimmed white-LED heartbeat + OTA steady-on (repeater builds only)
-D SENSECAP_SOLAR_WHITE_LED=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${SenseCap_Solar.build_src_filter}
-1
View File
@@ -5,7 +5,6 @@
void T1000eBoard::begin() {
NRF52BoardDCDC::begin();
btn_prev_state = HIGH;
#ifdef BUTTON_PIN
pinMode(BATTERY_PIN, INPUT);
-18
View File
@@ -5,9 +5,6 @@
#include <helpers/NRF52Board.h>
class T1000eBoard : public NRF52BoardDCDC {
protected:
uint8_t btn_prev_state;
public:
T1000eBoard() : NRF52Board("T1000E_OTA") {}
void begin();
@@ -38,17 +35,6 @@ public:
return "Seeed Tracker T1000-E";
}
int buttonStateChanged() {
#ifdef BUTTON_PIN
uint8_t v = digitalRead(BUTTON_PIN);
if (v != btn_prev_state) {
btn_prev_state = v;
return (v == USER_BTN_PRESSED) ? 1 : -1;
}
#endif
return 0;
}
void powerOff() override {
#ifdef HAS_GPS
digitalWrite(GPS_VRTC_EN, LOW);
@@ -69,10 +55,6 @@ public:
#ifdef PIN_3V3_ACC_EN
digitalWrite(PIN_3V3_ACC_EN, LOW);
#endif
#ifdef SENSOR_EN
digitalWrite(SENSOR_EN, LOW);
#endif
// set led on and wait for button release before poweroff
#ifdef LED_PIN
digitalWrite(LED_PIN, HIGH);
-4
View File
@@ -72,7 +72,6 @@ float t1000e_get_temperature(void) {
unsigned int ntc_v, vcc_v;
digitalWrite(PIN_3V3_EN, HIGH);
digitalWrite(SENSOR_EN, HIGH);
analogReference(AR_INTERNAL_3_0);
analogReadResolution(12);
delay(10);
@@ -80,7 +79,6 @@ float t1000e_get_temperature(void) {
vcc_v = (rail_v > NTC_REF_VCC) ? NTC_REF_VCC : rail_v;
ntc_v = (1000.0 * AREF_VOLTAGE * analogRead(TEMP_SENSOR)) / 4096;
digitalWrite(PIN_3V3_EN, LOW);
digitalWrite(SENSOR_EN, LOW);
return get_heater_temperature(vcc_v, ntc_v);
}
@@ -90,13 +88,11 @@ uint32_t t1000e_get_light(void) {
unsigned int lux_v = 0;
digitalWrite(PIN_3V3_EN, HIGH);
digitalWrite(SENSOR_EN, HIGH);
analogReference(AR_INTERNAL_3_0);
analogReadResolution(12);
delay(10);
lux_v = 1000 * analogRead(LUX_SENSOR) * AREF_VOLTAGE / 4096;
lux = get_light_lv(lux_v);
digitalWrite(SENSOR_EN, LOW);
digitalWrite(PIN_3V3_EN, LOW);
return lux;
+10 -38
View File
@@ -2,6 +2,7 @@
#include "t1000e_sensors.h"
#include "target.h"
#include <helpers/sensors/MicroNMEALocationProvider.h>
#include <helpers/sensors/AirohaSleep.h>
T1000eBoard board;
@@ -81,56 +82,28 @@ mesh::LocalIdentity radio_new_identity() {
void T1000SensorManager::start_gps() {
gps_active = true;
//_nmea->begin();
// this init sequence should be better
// comes from seeed examples and deals with all gps pins
pinMode(GPS_EN, OUTPUT);
digitalWrite(GPS_EN, HIGH);
delay(10);
pinMode(GPS_VRTC_EN, OUTPUT);
digitalWrite(GPS_VRTC_EN, HIGH);
delay(10);
pinMode(GPS_RESET, OUTPUT);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
pinMode(GPS_SLEEP_INT, OUTPUT);
digitalWrite(GPS_SLEEP_INT, HIGH);
pinMode(GPS_RTC_INT, OUTPUT);
digitalWrite(GPS_RTC_INT, HIGH);
delay(5);
digitalWrite(GPS_RTC_INT, LOW);
pinMode(GPS_RESETB, INPUT_PULLUP);
}
void T1000SensorManager::sleep_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, HIGH);
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, HIGH);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, LOW);
pinMode(GPS_RESETB, OUTPUT);
digitalWrite(GPS_RESETB, LOW);
//_nmea->stop();
}
void T1000SensorManager::stop_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_VRTC_EN, HIGH); // keep GPS RTC alive for faster fix on wake
digitalWrite(GPS_RTC_INT, LOW); // make sure this is LOW so we can pulse it to wake
airohaEnterSleep(_nmea); // send command to put the GPS into RTC backup sleep
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, HIGH);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, LOW);
pinMode(GPS_RESETB, OUTPUT);
digitalWrite(GPS_RESETB, LOW);
//_nmea->stop();
}
bool T1000SensorManager::begin() {
// init GPS
Serial1.begin(115200);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
return true;
}
@@ -156,7 +129,6 @@ void T1000SensorManager::loop() {
node_lat = ((double)_nmea->getLatitude())/1000000.;
node_lon = ((double)_nmea->getLongitude())/1000000.;
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
//Serial.printf("lat %f lon %f\r\n", _lat, _lon);
}
next_gps_update = millis() + 1000;
}
@@ -176,7 +148,7 @@ const char* T1000SensorManager::getSettingValue(int i) const {
bool T1000SensorManager::setSettingValue(const char* name, const char* value) {
if (strcmp(name, "gps") == 0) {
if (strcmp(value, "0") == 0) {
sleep_gps(); // sleep for faster fix !
stop_gps();
} else {
start_gps();
}
+4 -6
View File
@@ -14,7 +14,7 @@ const uint32_t g_ADigitalPinMap[PINS_COUNT + 1] =
1, // P0.01
2, // P0.02, AIN0 BATTERY_PIN
3, // P0.03
4, // P0.04, SENSOR_EN
4, // P0.04
5, // P0.05, EXT_PWR_DETEC
6, // P0.06, PIN_BUTTON1
7, // P0.07, LORA_BUSY
@@ -71,13 +71,12 @@ void initVariant()
pinMode(LUX_SENSOR, INPUT);
pinMode(EXT_CHRG_DETECT, INPUT);
pinMode(EXT_PWR_DETECT, INPUT);
pinMode(GPS_RESETB, INPUT);
pinMode(GPS_RESETB, INPUT_PULLUP);
pinMode(PIN_BUTTON1, INPUT);
pinMode(PIN_3V3_EN, OUTPUT);
pinMode(PIN_3V3_ACC_EN, OUTPUT);
pinMode(BUZZER_EN, OUTPUT);
pinMode(SENSOR_EN, OUTPUT);
pinMode(GPS_EN, OUTPUT);
pinMode(GPS_RESET, OUTPUT);
pinMode(GPS_VRTC_EN, OUTPUT);
@@ -88,11 +87,10 @@ void initVariant()
digitalWrite(PIN_3V3_EN, LOW);
digitalWrite(PIN_3V3_ACC_EN, LOW);
digitalWrite(BUZZER_EN, LOW);
digitalWrite(SENSOR_EN, LOW);
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, LOW);
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_VRTC_EN, HIGH);
digitalWrite(GPS_SLEEP_INT, LOW);
digitalWrite(GPS_RTC_INT, LOW);
digitalWrite(LED_PIN, LOW);
}
-1
View File
@@ -120,7 +120,6 @@
////////////////////////////////////////////////////////////////////////////////
// Temp+Lux Sensor
#define SENSOR_EN (4) // P0.4
#define TEMP_SENSOR (31) // P0.31/AIN7
#define LUX_SENSOR (29) // P0.29/AIN5
+11
View File
@@ -24,6 +24,17 @@ build_flags = ${nrf52_base.build_flags}
-D SX126X_RX_BOOSTED_GAIN=1
-D LORA_TX_POWER=22
-D P_LORA_TX_LED=13
-D UI_RECENT_LIST_SIZE=9
-D UI_MSG_PREVIEW_SIZE=165
-D EINK_DISPLAY_MODEL=GxEPD2_154_D67
-D EINK_SCALE_X=1.5625f
-D EINK_SCALE_Y=1.5625f
-D EINK_X_OFFSET=0
-D EINK_Y_OFFSET=10
-D BACKLIGHT_BTN=PIN_BUTTON2
-D AUTO_OFF_MILLIS=300000 ; 5 minutes
-D UI_NO_HIBERNATE
-D DISABLE_DIAGNOSTIC_OUTPUT
build_src_filter = ${nrf52_base.build_src_filter}
+<helpers/*.cpp>
+<ThinkNodeM1Board.cpp>
+1
View File
@@ -17,6 +17,7 @@ ThinkNodeM1SensorManager sensors = ThinkNodeM1SensorManager(nmea);
#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
MomentaryButton backlight_btn(BACKLIGHT_BTN, 1000, true);
#endif
bool radio_init() {
+1
View File
@@ -40,6 +40,7 @@ extern ThinkNodeM1SensorManager sensors;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
extern MomentaryButton backlight_btn;
#endif
bool radio_init();
+6 -1
View File
@@ -81,7 +81,7 @@
#define BUTTON_PIN PIN_BUTTON1
#define PIN_USER_BTN BUTTON_PIN
#define PIN_BUTTON2 (11)
#define PIN_BUTTON2 (39)
#define BUTTON_PIN2 PIN_BUTTON2
#define EXTERNAL_FLASH_DEVICES MX25R1635F
@@ -131,6 +131,11 @@ extern const int SCK;
#define DISP_BUSY (3)
#define DISP_BACKLIGHT (43)
#define PIN_DISPLAY_CS DISP_CS
#define PIN_DISPLAY_DC DISP_DC
#define PIN_DISPLAY_RST DISP_RST
#define PIN_DISPLAY_BUSY DISP_BUSY
////////////////////////////////////////////////////////////////////////////////
// GPS
@@ -6,7 +6,6 @@
void ThinkNodeM3Board::begin() {
NRF52Board::begin();
btn_prev_state = HIGH;
Wire.begin();
-12
View File
@@ -11,7 +11,6 @@ protected:
#if NRF52_POWER_MANAGEMENT
void initiateShutdown(uint8_t reason) override;
#endif
uint8_t btn_prev_state;
public:
ThinkNodeM3Board() : NRF52Board("THINKNODE_M3_OTA") {}
@@ -31,17 +30,6 @@ public:
return "Elecrow ThinkNode M3";
}
int buttonStateChanged() {
#ifdef BUTTON_PIN
uint8_t v = digitalRead(BUTTON_PIN);
if (v != btn_prev_state) {
btn_prev_state = v;
return (v == LOW) ? 1 : -1;
}
#endif
return 0;
}
void powerOff() override {
// turn off all leds, sd_power_system_off will not do this for us
digitalWrite(PIN_LED_BLUE, !LED_STATE_ON);
@@ -6,7 +6,6 @@
void ThinkNodeM4Board::begin() {
NRF52Board::begin();
btn_prev_state = HIGH;
Wire.begin();
battery_serial->begin(4800);
-12
View File
@@ -9,7 +9,6 @@ protected:
#if NRF52_POWER_MANAGEMENT
void initiateShutdown(uint8_t reason) override;
#endif
uint8_t btn_prev_state;
HardwareSerial * battery_serial;
uint16_t bat_level_mv = 0;
uint8_t bat_level_percent =0;
@@ -32,17 +31,6 @@ public:
return "Elecrow ThinkNode M4";
}
int buttonStateChanged() {
#ifdef BUTTON_PIN
uint8_t v = digitalRead(BUTTON_PIN);
if (v != btn_prev_state) {
btn_prev_state = v;
return (v == USER_BTN_PRESSED) ? 1 : -1;
}
#endif
return 0;
}
void shutdownPeripherals() override {
// shutdown common peripherals
NRF52Board::shutdownPeripherals();
+6 -2
View File
@@ -26,8 +26,11 @@ build_flags = ${esp32_base.build_flags}
-D EINK_SCALE_Y=1.5625f
-D EINK_X_OFFSET=0
-D EINK_Y_OFFSET=10
-D UI_RECENT_LIST_SIZE=9
-D UI_MSG_PREVIEW_SIZE=165
-D BACKLIGHT_BTN=PIN_BUTTON2
-D AUTO_OFF_MILLIS=0
-D AUTO_OFF_MILLIS=300000
-D UI_NO_HIBERNATE
-D DISABLE_DIAGNOSTIC_OUTPUT
-D SX126X_DIO2_AS_RF_SWITCH=true
-D SX126X_DIO3_TCXO_VOLTAGE=3.3
@@ -150,7 +153,6 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
-D OFFLINE_QUEUE_SIZE=256
-D UI_RECENT_LIST_SIZE=9
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D GPS_NMEA_DEBUG
@@ -174,12 +176,14 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
-D ENABLE_WIFI_INTERFACE
build_src_filter = ${ThinkNode_M5.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
+<helpers/ui/buzzer.cpp>
+<helpers/wifi/*.cpp>
lib_deps =
${ThinkNode_M5.lib_deps}
densaugeo/base64 @ ~1.4.0
+1
View File
@@ -26,6 +26,7 @@ EnvironmentSensorManager sensors = EnvironmentSensorManager();
#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
MomentaryButton backlight_btn(BACKLIGHT_BTN, 1000, true);
#endif
bool radio_init() {
+1
View File
@@ -24,6 +24,7 @@ extern PCA9557 expander;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
extern MomentaryButton backlight_btn;
#endif
bool radio_init();
@@ -15,6 +15,9 @@ void ThinkNodeM6Board::begin() {
digitalWrite(P_LORA_TX_LED, LOW);
#endif
pinMode(EXT_PWR_DETECT, INPUT);
pinMode(EXT_CHRG_DETECT, INPUT);
delay(10); // give sx1262 some time to power up
}
+29
View File
@@ -36,6 +36,35 @@ public:
return "Elecrow ThinkNode M6";
}
bool hasUsbPowerDetect() const override { return true; }
bool isUsbPowered() override {
// P0.13 is the dedicated USB / external power-detect line on the M6 PCB
// (same pin the Meshtastic M6 variant uses for USB detection).
return digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE;
}
bool hasSolarChargerDetect() const override { return true; }
bool isSolarChargerActive() override {
// P0.15 is the active-low solar-charger status line. It reports the
// charger's state, not photovoltaic voltage or current.
return digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE;
}
bool isExternalPowered() override {
if (isUsbPowered() || isSolarChargerActive()) {
return true;
}
return NRF52Board::isExternalPowered();
}
bool isChargerActive() override {
// Preserve a generic charging indication while also exposing both
// source-specific states (USB / solar) separately through the CLI.
return isSolarChargerActive() || isUsbPowered();
}
void powerOff() override {
// turn off all leds, sd_power_system_off will not do this for us
+6
View File
@@ -29,6 +29,12 @@
#define AREF_VOLTAGE (3.0)
// External power and charger status lines.
#define EXT_PWR_DETECT (13)
#define EXT_PWR_DETECT_VALUE HIGH
#define EXT_CHRG_DETECT (15)
#define EXT_CHRG_DETECT_VALUE LOW
////////////////////////////////////////////////////////////////////////////////
// Number of pins
+5 -9
View File
@@ -18,12 +18,14 @@ build_flags = ${nrf52_base.build_flags}
-D P_LORA_SCLK=19
-D P_LORA_MISO=22
-D P_LORA_MOSI=20
-D UI_SHOW_CLOCK=1
-D DISPLAY_ROTATION=4
-D UI_HAS_ROTARY_INPUT=1
-D UI_HAS_NAV_INPUT=1
-D UI_RECENT_LIST_SIZE=9
-D UI_MSG_PREVIEW_SIZE=165
-D EINK_MAX_PARTIAL_REFRESH=60
-D AUTO_OFF_MILLIS=300000
-D BACKLIGHT_BTN=PIN_BUTTON2
-D UI_SHOW_CLOCK=1
-D EINK_DISPLAY_MODEL=GxEPD2_154_D67
; -D EINK_DISPLAY_MODEL=GxEPD2_154_GDEY0154D67
; -D EINK_DISPLAY_MODEL=GxEPD2_150_BN
@@ -40,6 +42,7 @@ build_flags = ${nrf52_base.build_flags}
-D LORA_TX_POWER=22
build_src_filter = ${nrf52_base.build_src_filter}
+<helpers/*.cpp>
+<helpers/sensors>
+<ThinkNodeM8Board.cpp>
+<../variants/thinknode_m8>
lib_deps =
@@ -92,10 +95,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
# -D BLE_DEBUG_LOGGING=1
-D DISPLAY_ROTATION=4
-D DISPLAY_CLASS=GxEPDDisplay
-D BACKLIGHT_BTN=PIN_BUTTON2
-D AUTO_OFF_MILLIS=0
-D OFFLINE_QUEUE_SIZE=256
-D PIN_BUZZER=33
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
@@ -110,7 +110,6 @@ build_src_filter = ${ThinkNode_M8.build_src_filter}
+<helpers/ui/buzzer.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/ui/RotaryInputGPIO.cpp>
+<helpers/sensors/EnvironmentSensorManager.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
@@ -133,8 +132,6 @@ build_flags =
-D DISPLAY_ROTATION=4
-D QSPIFLASH=1
-D DISPLAY_CLASS=GxEPDDisplay
-D BACKLIGHT_BTN=PIN_BUTTON2
-D AUTO_OFF_MILLIS=0
-D OFFLINE_QUEUE_SIZE=256
-D PIN_BUZZER=6
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
@@ -144,7 +141,6 @@ build_src_filter = ${ThinkNode_M8.build_src_filter}
+<helpers/ui/buzzer.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<helpers/ui/RotaryInputGPIO.cpp>
+<helpers/sensors/EnvironmentSensorManager.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
+1
View File
@@ -23,6 +23,7 @@ EnvironmentSensorManager sensors = EnvironmentSensorManager();
DISPLAY_CLASS display;
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
RotaryInputGPIO rotary_input(PIN_BUTTON1_A, PIN_BUTTON1_B);
MomentaryButton backlight_btn(BACKLIGHT_BTN, 1000, true);
#endif
bool radio_init() {
+1
View File
@@ -23,6 +23,7 @@ extern EnvironmentSensorManager sensors;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
extern MomentaryButton user_btn;
extern MomentaryButton backlight_btn;
extern RotaryInputGPIO rotary_input;
#endif
@@ -0,0 +1,11 @@
#pragma once
#include <Arduino.h>
#include <helpers/ESP32Board.h>
class WaveshareS3LR1121Board : public ESP32Board {
public:
const char* getManufacturerName() const override {
return "Waveshare ESP32-S3-LR1121";
}
};
@@ -0,0 +1,102 @@
; Waveshare ESP32-S3-LR1121 (HF: 850-930 MHz + 2.4 GHz)
; ESP32-S3FH4R2 (4MB flash, 2MB PSRAM), native USB-CDC via the Tiny-Adapter FPC.
; No user LED, battery sense or user button (BOOT is GPIO0).
[Waveshare_S3_LR1121]
extends = esp32_base
board = esp32-s3-zero
; min_spiffs: 1.9MB OTA app slots; one layout for every role so switching roles keeps the filesystem
board_build.partitions = min_spiffs.csv
build_flags = ${esp32_base.build_flags}
-I variants/waveshare_esp32s3_lr1121
-D BOARD_HAS_PSRAM
-D P_LORA_DIO_1=38
-D P_LORA_NSS=42
-D P_LORA_RESET=39
-D P_LORA_BUSY=41
-D P_LORA_SCLK=40
-D P_LORA_MISO=46
-D P_LORA_MOSI=45
-D RADIO_CLASS=CustomLR1121
-D WRAPPER_CLASS=CustomLR1121Wrapper
-D LR11X0_DIO3_TCXO_VOLTAGE=1.8
-D LR1121_FORCE_HP_PA ; RFO_LP_LF is not fitted (R4 NC)
-D RX_BOOSTED_GAIN=true
-D LORA_TX_POWER=22
build_src_filter = ${esp32_base.build_src_filter}
+<../variants/waveshare_esp32s3_lr1121>
lib_deps =
${esp32_base.lib_deps}
[env:Waveshare_S3_LR1121_repeater]
extends = Waveshare_S3_LR1121
build_flags =
${Waveshare_S3_LR1121.build_flags}
-D ADVERT_NAME='"Waveshare LR1121 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 = ${Waveshare_S3_LR1121.build_src_filter}
+<../examples/simple_repeater/*.cpp>
lib_deps =
${Waveshare_S3_LR1121.lib_deps}
${esp32_ota.lib_deps}
[env:Waveshare_S3_LR1121_room_server]
extends = Waveshare_S3_LR1121
build_flags =
${Waveshare_S3_LR1121.build_flags}
-D ADVERT_NAME='"Waveshare LR1121 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 = ${Waveshare_S3_LR1121.build_src_filter}
+<../examples/simple_room_server>
lib_deps =
${Waveshare_S3_LR1121.lib_deps}
${esp32_ota.lib_deps}
[env:Waveshare_S3_LR1121_companion_radio_usb]
extends = Waveshare_S3_LR1121
build_flags =
${Waveshare_S3_LR1121.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_USB_INTERFACE
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Waveshare_S3_LR1121.build_src_filter}
+<helpers/esp32/*.cpp>
+<../examples/companion_radio/*.cpp>
lib_deps =
${Waveshare_S3_LR1121.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:Waveshare_S3_LR1121_companion_radio_ble]
extends = Waveshare_S3_LR1121
build_flags =
${Waveshare_S3_LR1121.build_flags}
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Waveshare_S3_LR1121.build_src_filter}
+<helpers/esp32/*.cpp>
+<../examples/companion_radio/*.cpp>
lib_deps =
${Waveshare_S3_LR1121.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:Waveshare_S3_LR1121_kiss_modem]
extends = Waveshare_S3_LR1121
build_src_filter = ${Waveshare_S3_LR1121.build_src_filter}
+<../examples/kiss_modem/>
@@ -0,0 +1,63 @@
#include <Arduino.h>
#include "target.h"
WaveshareS3LR1121Board board;
static SPIClass spi;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
WRAPPER_CLASS radio_driver(radio, board);
ESP32RTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
SensorManager sensors;
#ifndef LORA_CR
#define LORA_CR 5
#endif
// DIO5/DIO6 drive the RTC6603SP sub-GHz T/R switch; the 2.4 GHz port (RFIO_HF) is unswitched
static const uint32_t rfswitch_dios[Module::RFSWITCH_MAX_PINS] = {
RADIOLIB_LR11X0_DIO5,
RADIOLIB_LR11X0_DIO6,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6
{ LR11x0::MODE_STBY, {LOW, LOW}},
{ LR11x0::MODE_RX, {HIGH, LOW}},
{ LR11x0::MODE_TX, {LOW, HIGH}},
{ LR11x0::MODE_TX_HP, {LOW, HIGH}},
{ LR11x0::MODE_TX_HF, {LOW, LOW}},
{ LR11x0::MODE_GNSS, {LOW, LOW}},
{ LR11x0::MODE_WIFI, {LOW, LOW}},
END_OF_MODE_TABLE,
};
bool radio_init() {
fallback_clock.begin();
rtc_clock.begin(Wire);
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE,
LORA_TX_POWER, 16, LR11X0_DIO3_TCXO_VOLTAGE);
if (status != RADIOLIB_ERR_NONE) {
Serial.print("ERROR: radio init failed: ");
Serial.println(status);
return false;
}
radio.setCRC(2);
radio.explicitHeader();
radio.setRfSwitchTable(rfswitch_dios, rfswitch_table);
#ifdef RX_BOOSTED_GAIN
radio.setRxBoostedGainMode(RX_BOOSTED_GAIN);
#endif
return true;
}
mesh::LocalIdentity radio_new_identity() {
RadioNoiseListener rng(radio);
return mesh::LocalIdentity(&rng);
}
@@ -0,0 +1,17 @@
#pragma once
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <helpers/radiolib/CustomLR1121Wrapper.h>
#include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/SensorManager.h>
#include "WaveshareS3LR1121Board.h"
extern WaveshareS3LR1121Board board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;
extern SensorManager sensors;
bool radio_init();
mesh::LocalIdentity radio_new_identity();
@@ -14,7 +14,7 @@ protected:
bool isLoRaFemPaGainEnabled() const { return _is_pa_enabled; }
public:
WioTrackerL1Board() : NRF52Board("WioTrackerL1 OTA") {}
WioTrackerL1Board() : NRF52Board("WioTrackerL1_OTA") {}
void begin();
void attachDynamicPrefs(KeyValueStore* prefs);
bool handleCommand(const char* command, uint32_t sender_timestamp, char* reply) override;
@@ -65,6 +65,7 @@ build_flags = ${WioTrackerL1-1W.build_flags}
-D MAX_GROUP_CHANNELS=40
-D DISPLAY_CLASS=SH1106Display
-D UI_HAS_JOYSTICK=1
-D UI_NO_HIBERNATE
-D OFFLINE_QUEUE_SIZE=256
-D PIN_BUZZER=12
-D QSPIFLASH=1
@@ -96,6 +97,7 @@ build_flags = ${WioTrackerL1-1W.build_flags}
-D OFFLINE_QUEUE_SIZE=256
-D DISPLAY_CLASS=SH1106Display
-D UI_HAS_JOYSTICK=1
-D UI_NO_HIBERNATE
-D PIN_BUZZER=12
-D QSPIFLASH=1
-D RADIO_FEM_TXGAIN=1
+1 -1
View File
@@ -9,7 +9,7 @@ protected:
uint8_t btn_prev_state;
public:
WioTrackerL1Board() : NRF52Board("WioTrackerL1 OTA") {}
WioTrackerL1Board() : NRF52Board("WioTrackerL1_OTA") {}
void begin();
#if defined(P_LORA_TX_LED)
-1
View File
@@ -9,7 +9,6 @@ build_flags = ${nrf52_base.build_flags}
-I variants/xiao_nrf52
-UENV_INCLUDE_GPS
-D NRF52_PLATFORM
-D NRF52_POWER_MANAGEMENT
-D XIAO_NRF52
-D USE_SX1262
-D RADIO_CLASS=CustomSX1262
+2
View File
@@ -100,12 +100,14 @@ build_flags =
-D BLE_PIN_CODE=123456
-D DISPLAY_CLASS=SSD1306Display
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Xiao_S3.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
+2
View File
@@ -160,12 +160,14 @@ build_flags =
-D BLE_PIN_CODE=123456
-D DISPLAY_CLASS=SSD1306Display
-D OFFLINE_QUEUE_SIZE=256
-D ENABLE_WIFI_INTERFACE
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Xiao_S3_WIO.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<helpers/esp32/*.cpp>
+<helpers/wifi/*.cpp>
+<helpers/ui/MomentaryButton.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>