Merge branch 'PowerSaving-v16' into rx-powersaving
This commit is contained in:
57 files changed
+1429
-387
No files matched your search
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "default_16MB.csv",
|
||||
"memory_type": "qio_opi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
"-DBOARD_HAS_PSRAM",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||
"-DARDUINO_USB_MODE=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"]],
|
||||
"mcu": "esp32s3",
|
||||
"variant": "heltec_v4_r8"
|
||||
},
|
||||
"connectivity": ["wifi", "bluetooth", "lora"],
|
||||
"debug": {
|
||||
"default_tool": "esp-builtin",
|
||||
"onboard_tools": ["esp-builtin"],
|
||||
"openocd_target": "esp32s3.cfg"
|
||||
},
|
||||
"frameworks": ["arduino", "espidf"],
|
||||
"name": "heltec_wifi_lora_32 v4 r8 (16 MB FLASH, 8 MB PSRAM)",
|
||||
"upload": {
|
||||
"flash_size": "16MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 16777216,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": true,
|
||||
"require_upload_port": true,
|
||||
"speed": 921600
|
||||
},
|
||||
"url": "https://heltec.org/",
|
||||
"vendor": "heltec"
|
||||
}
|
||||
+103
-71
@@ -1,48 +1,54 @@
|
||||
# sh ./build-repeaters-iotthinks.sh
|
||||
export FIRMWARE_VERSION="PowerSaving16"
|
||||
export FIRMWARE_VERSION="PowerSaving17"
|
||||
|
||||
############# Repeaters #############
|
||||
# Commonly-used boards
|
||||
## ESP32 - 17 boards
|
||||
## ESP32 - 18 boards
|
||||
sh build.sh build-firmware \
|
||||
Heltec_ct62_repeater \
|
||||
Heltec_E290_repeater \
|
||||
Heltec_v3_repeater \
|
||||
Heltec_WSL3_repeater \
|
||||
heltec_v4_repeater \
|
||||
heltec_v4_r8_repeater \
|
||||
heltec_tracker_v2_repeater \
|
||||
Heltec_Wireless_Paper_repeater \
|
||||
Heltec_Wireless_Tracker_repeater \
|
||||
Heltec_WSL3_repeater \
|
||||
LilyGo_T3S3_sx1262_repeater \
|
||||
LilyGo_TBeam_1W_repeater \
|
||||
Station_G2_repeater \
|
||||
T_Beam_S3_Supreme_SX1262_repeater \
|
||||
Tbeam_SX1262_repeater \
|
||||
LilyGo_T3S3_sx1262_repeater \
|
||||
Xiao_S3_WIO_repeater \
|
||||
ThinkNode_M5_Repeater \
|
||||
Xiao_C3_repeater \
|
||||
Xiao_C6_repeater_ \
|
||||
Heltec_E290_repeater \
|
||||
Heltec_Wireless_Tracker_repeater \
|
||||
LilyGo_TBeam_1W_repeater \
|
||||
Xiao_S3_repeater \
|
||||
heltec_tracker_v2_repeater \
|
||||
Heltec_Wireless_Paper_repeater \
|
||||
Heltec_ct62_repeater
|
||||
Xiao_S3_WIO_repeater
|
||||
|
||||
## NRF52 - 17 boards
|
||||
## NRF52 - 22 boards
|
||||
sh build.sh build-firmware \
|
||||
RAK_4631_repeater \
|
||||
Heltec_t114_repeater \
|
||||
Xiao_nrf52_repeater \
|
||||
Heltec_mesh_solar_repeater \
|
||||
ProMicro_repeater \
|
||||
SenseCap_Solar_repeater \
|
||||
t1000e_repeater \
|
||||
LilyGo_T-Echo_repeater \
|
||||
WioTrackerL1_repeater \
|
||||
RAK_3401_repeater \
|
||||
RAK_WisMesh_Tag_repeater \
|
||||
GAT562_30S_Mesh_Kit_repeater \
|
||||
GAT562_Mesh_Tracker_Pro_repeater \
|
||||
Heltec_mesh_solar_repeater \
|
||||
Heltec_t096_repeater \
|
||||
Heltec_t114_repeater \
|
||||
Heltec_t1_repeater \
|
||||
ikoka_nano_nrf_22dbm_repeater \
|
||||
ikoka_nano_nrf_30dbm_repeater \
|
||||
ikoka_nano_nrf_33dbm_repeater \
|
||||
LilyGo_T-Echo_Card_repeater \
|
||||
LilyGo_T-Echo_repeater \
|
||||
ProMicro_repeater \
|
||||
RAK_3401_repeater \
|
||||
RAK_4631_repeater \
|
||||
RAK_WisMesh_Tag_repeater \
|
||||
SenseCap_Solar_repeater \
|
||||
t1000e_repeater \
|
||||
ThinkNode_M1_repeater \
|
||||
Heltec_t096_repeater
|
||||
ThinkNode_M3_repeater \
|
||||
ThinkNode_M6_repeater \
|
||||
WioTrackerL1_repeater \
|
||||
Xiao_nrf52_repeater
|
||||
|
||||
## ESP32, SX1276 - 3 boards
|
||||
sh build.sh build-firmware \
|
||||
@@ -51,85 +57,111 @@ LilyGo_TLora_V2_1_1_6_repeater \
|
||||
Tbeam_SX1276_repeater
|
||||
|
||||
############# Room Server #############
|
||||
# ESP32 - 7 boards
|
||||
# ESP32 - 8 boards
|
||||
sh build.sh build-firmware \
|
||||
Heltec_v3_room_server \
|
||||
heltec_v4_room_server \
|
||||
LilyGo_TBeam_1W_room_server \
|
||||
Heltec_WSL3_room_server \
|
||||
Xiao_S3_room_server \
|
||||
heltec_v4_r8_room_server \
|
||||
heltec_tracker_v2_room_server \
|
||||
Heltec_Wireless_Paper_room_server
|
||||
Heltec_Wireless_Paper_room_server \
|
||||
Heltec_WSL3_room_server \
|
||||
LilyGo_TBeam_1W_room_server \
|
||||
Xiao_S3_room_server
|
||||
|
||||
# NRF52 - 6 boards
|
||||
# NRF52 - 7 boards
|
||||
sh build.sh build-firmware \
|
||||
RAK_4631_room_server \
|
||||
Heltec_t096_room_server \
|
||||
Heltec_t114_room_server \
|
||||
Xiao_nrf52_room_server \
|
||||
RAK_3401_room_server \
|
||||
RAK_4631_room_server \
|
||||
t1000e_room_server \
|
||||
WioTrackerL1_room_server \
|
||||
RAK_3401_room_server \
|
||||
Heltec_t096_room_server
|
||||
Xiao_nrf52_room_server
|
||||
|
||||
############# Companions BLE #############
|
||||
# NRF52 - 12 boards
|
||||
# NRF52 - 17 boards
|
||||
sh build.sh build-firmware \
|
||||
RAK_4631_companion_radio_ble \
|
||||
Heltec_t096_companion_radio_ble_femon \
|
||||
Heltec_t096_companion_radio_ble_femoff \
|
||||
Heltec_t1_companion_radio_ble \
|
||||
Heltec_t114_companion_radio_ble \
|
||||
Xiao_nrf52_companion_radio_ble \
|
||||
t1000e_companion_radio_ble \
|
||||
LilyGo_T-Echo_Card_companion_radio_ble \
|
||||
LilyGo_T-Echo_companion_radio_ble \
|
||||
WioTrackerL1_companion_radio_ble \
|
||||
ProMicro_companion_radio_ble \
|
||||
RAK_3401_companion_radio_ble \
|
||||
RAK_4631_companion_radio_ble \
|
||||
RAK_WisMesh_Tag_companion_radio_ble \
|
||||
SenseCap_Solar_companion_radio_ble \
|
||||
t1000e_companion_radio_ble \
|
||||
ThinkNode_M1_companion_radio_ble \
|
||||
Heltec_t096_companion_radio_ble \
|
||||
Heltec_t096_companion_radio_ble_femoff
|
||||
ThinkNode_M3_companion_radio_ble \
|
||||
ThinkNode_M6_companion_radio_ble \
|
||||
WioTrackerL1_companion_radio_ble \
|
||||
Xiao_nrf52_companion_radio_ble
|
||||
|
||||
############# Companions BLE PS #############
|
||||
# ESP32 - 18 boards
|
||||
# ESP32 - 21 boards
|
||||
sh build.sh build-firmware \
|
||||
Heltec_v3_companion_radio_ble_ps \
|
||||
heltec_v4_companion_radio_ble_ps \
|
||||
heltec_v4_3_companion_radio_ble_ps_femoff \
|
||||
Xiao_C3_companion_radio_ble_ps \
|
||||
Xiao_S3_companion_radio_ble_ps \
|
||||
Xiao_S3_WIO_companion_radio_ble_ps \
|
||||
Heltec_v2_companion_radio_ble_ps \
|
||||
LilyGo_TBeam_1W_companion_radio_ble_ps \
|
||||
Heltec_WSL3_companion_radio_ble_ps \
|
||||
Heltec_Wireless_Tracker_companion_radio_ble_ps \
|
||||
heltec_tracker_v2_companion_radio_ble_ps \
|
||||
Heltec_Wireless_Paper_companion_radio_ble_ps \
|
||||
LilyGo_TLora_V2_1_1_6_companion_radio_ble_ps \
|
||||
Heltec_ct62_companion_radio_ble_ps \
|
||||
heltec_tracker_v2_companion_radio_ble_ps \
|
||||
Heltec_v2_companion_radio_ble_ps \
|
||||
Heltec_v3_companion_radio_ble_ps \
|
||||
heltec_v4_3_companion_radio_ble_ps_femoff \
|
||||
heltec_v4_companion_radio_ble_ps_femon \
|
||||
heltec_v4_expansionkit_tft_companion_radio_ble_ps \
|
||||
heltec_v4_r8_companion_radio_ble_ps \
|
||||
Heltec_Wireless_Paper_companion_radio_ble_ps \
|
||||
Heltec_Wireless_Tracker_companion_radio_ble_ps \
|
||||
Heltec_WSL3_companion_radio_ble_ps \
|
||||
LilyGo_T3S3_sx1262_companion_radio_ble_ps \
|
||||
LilyGo_TBeam_1W_companion_radio_ble_ps \
|
||||
LilyGo_TLora_V2_1_1_6_companion_radio_ble_ps \
|
||||
T_Beam_S3_Supreme_SX1262_companion_radio_ble_ps \
|
||||
Tbeam_SX1262_companion_radio_ble_ps \
|
||||
heltec_v4_expansionkit_tft_companion_radio_ble_ps \
|
||||
LilyGo_T3S3_sx1262_companion_radio_ble_ps
|
||||
|
||||
# Not working
|
||||
Tbeam_SX1276_companion_radio_ble_ps \
|
||||
ThinkNode_M5_companion_radio_ble_ps \
|
||||
Xiao_C3_companion_radio_ble_ps \
|
||||
Xiao_S3_companion_radio_ble_ps \
|
||||
Xiao_S3_WIO_companion_radio_ble_ps
|
||||
|
||||
############# Companions USB #############
|
||||
sh build.sh build-firmware \
|
||||
Heltec_t096_companion_radio_usb
|
||||
Heltec_t096_companion_radio_usb \
|
||||
heltec_v4_companion_radio_usb \
|
||||
heltec_v4_companion_radio_usb_ps_femoff \
|
||||
heltec_v4_companion_radio_usb_ps_femon
|
||||
|
||||
############# Sample builds #############
|
||||
# 14 boards
|
||||
# 24 boards
|
||||
sh build.sh build-firmware \
|
||||
Heltec_v3_repeater \
|
||||
heltec_v4_repeater \
|
||||
Xiao_C3_repeater \
|
||||
Xiao_C6_repeater_ \
|
||||
RAK_4631_repeater \
|
||||
Heltec_t096_companion_radio_ble_femon \
|
||||
Heltec_t096_companion_radio_ble_femoff \
|
||||
Heltec_t096_companion_radio_usb \
|
||||
Heltec_t096_repeater \
|
||||
Heltec_t114_companion_radio_ble \
|
||||
Heltec_t114_repeater \
|
||||
Heltec_v3_companion_radio_ble_ps \
|
||||
heltec_v4_companion_radio_ble_ps \
|
||||
Heltec_v3_repeater \
|
||||
heltec_v4_3_companion_radio_ble_ps_femoff \
|
||||
Xiao_C3_companion_radio_ble_ps \
|
||||
Xiao_C6_companion_radio_ble_ \
|
||||
heltec_v4_repeater \
|
||||
RAK_3401_companion_radio_ble \
|
||||
RAK_3401_repeater \
|
||||
RAK_4631_companion_radio_ble \
|
||||
Heltec_t096_companion_radio_ble \
|
||||
Heltec_t096_companion_radio_ble_femoff
|
||||
RAK_4631_repeater \
|
||||
SenseCap_Solar_companion_radio_ble \
|
||||
SenseCap_Solar_repeater \
|
||||
WioTrackerL1_companion_radio_ble \
|
||||
WioTrackerL1_repeater \
|
||||
Xiao_C3_companion_radio_ble_ps \
|
||||
Xiao_C3_repeater \
|
||||
Xiao_C6_companion_radio_ble_ \
|
||||
Xiao_C6_repeater_ \
|
||||
Xiao_nrf52_companion_radio_ble \
|
||||
Xiao_nrf52_repeater
|
||||
|
||||
# 4 boards
|
||||
sh build.sh build-firmware \
|
||||
heltec_v4_companion_radio_ble_ps_femon \
|
||||
heltec_v4_companion_radio_usb \
|
||||
heltec_v4_companion_radio_usb_ps_femoff \
|
||||
heltec_v4_companion_radio_usb_ps_femon
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
#include "helpers/radiolib/RXPowerSaving.h"
|
||||
|
||||
#define CMD_APP_START 1
|
||||
#define CMD_SEND_TXT_MSG 2
|
||||
@@ -279,47 +280,19 @@ bool MyMesh::getCADEnabled() const {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// RX PowerSaving
|
||||
#ifdef RXPS_FIXED_ENABLED
|
||||
static uint32_t ceilPositiveFloat(float value) {
|
||||
uint32_t rounded = (uint32_t)value;
|
||||
return value > (float)rounded ? rounded + 1 : rounded;
|
||||
}
|
||||
|
||||
static bool calcFixedRxPowerSaving(uint8_t sf, float bw, uint32_t* rx_us, uint32_t* sleep_us) {
|
||||
if (RXPS_FIXED_LEVEL < 1 || RXPS_FIXED_LEVEL > 10 || sf < 5 || sf > 12 ||
|
||||
bw <= 0.0f || (RXPS_FIXED_PREAMBLE != 16 && RXPS_FIXED_PREAMBLE != 32)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const float symbol_us = (1000.0f * (float)(1UL << sf)) / bw;
|
||||
const float amount = (float)(RXPS_FIXED_LEVEL - 1) / 9.0f;
|
||||
const float rx_start_symbols = RXPS_FIXED_PREAMBLE == 16 ? 12.0f : 16.0f;
|
||||
const float sleep_start_symbols = RXPS_FIXED_PREAMBLE == 16 ? 2.0f : 15.0f;
|
||||
const float rx_edge_symbols = 8.0f;
|
||||
const float sleep_edge_symbols = (float)RXPS_FIXED_PREAMBLE + 4.25f - 8.0f;
|
||||
|
||||
const float rx_symbols = rx_start_symbols + amount * (rx_edge_symbols - rx_start_symbols);
|
||||
const float sleep_symbols = sleep_start_symbols + amount * (sleep_edge_symbols - sleep_start_symbols);
|
||||
|
||||
*rx_us = ceilPositiveFloat(rx_symbols * symbol_us);
|
||||
*sleep_us = (uint32_t)(sleep_symbols * symbol_us);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void applyFixedRxPowerSaving(uint8_t sf, float bw) {
|
||||
uint32_t rx_us, sleep_us;
|
||||
if (!calcFixedRxPowerSaving(sf, bw, &rx_us, &sleep_us)) {
|
||||
MESH_DEBUG_PRINTLN("RX Power Saving fixed profile invalid");
|
||||
if (!calcRxPowerSavingLevel(RXPS_FIXED_LEVEL, sf, bw, RXPS_FIXED_PREAMBLE, &rx_us, &sleep_us)) {
|
||||
POWERSAVING_DEBUG_PRINTLN("RX Power Saving fixed profile invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
bool ok = radio_driver.setRxPowerSaving(true, rx_us, sleep_us);
|
||||
MESH_DEBUG_PRINTLN("RX Power Saving fixed level %d p%d: %s (%lu/%lu us)",
|
||||
RXPS_FIXED_LEVEL,
|
||||
RXPS_FIXED_PREAMBLE,
|
||||
ok ? "Enabled" : "Unsupported",
|
||||
(unsigned long)rx_us,
|
||||
(unsigned long)sleep_us);
|
||||
POWERSAVING_DEBUG_PRINTLN("RX Power Saving fixed level %d p%d: %s (%lu/%lu us)", RXPS_FIXED_LEVEL,
|
||||
RXPS_FIXED_PREAMBLE, ok ? "Enabled" : "Unsupported", (unsigned long)rx_us,
|
||||
(unsigned long)sleep_us);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1028,11 +1001,12 @@ void MyMesh::begin(bool has_display) {
|
||||
radio_driver.setTxPower(_prefs.tx_power_dbm);
|
||||
radio_driver.setRxBoostedGainMode(_prefs.rx_boosted_gain);
|
||||
board.setLoRaFemLnaEnabled(_prefs.radio_fem_rxgain);
|
||||
#ifdef RXPS_FIXED_ENABLED
|
||||
applyFixedRxPowerSaving(_prefs.sf, _prefs.bw);
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("RX Boosted Gain Mode: %s",
|
||||
radio_driver.getRxBoostedGainMode() ? "Enabled" : "Disabled");
|
||||
|
||||
#ifdef RXPS_FIXED_ENABLED
|
||||
applyFixedRxPowerSaving(_prefs.sf, _prefs.bw); // RX PowerSaving
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *MyMesh::getNodeName() {
|
||||
@@ -1457,7 +1431,7 @@ void MyMesh::handleCmdFrame(size_t len) {
|
||||
|
||||
radio_driver.setParams(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
|
||||
#ifdef RXPS_FIXED_ENABLED
|
||||
applyFixedRxPowerSaving(_prefs.sf, _prefs.bw);
|
||||
applyFixedRxPowerSaving(_prefs.sf, _prefs.bw); // RX PowerSaving
|
||||
#endif
|
||||
MESH_DEBUG_PRINTLN("OK: CMD_SET_RADIO_PARAMS: f=%d, bw=%d, sf=%d, cr=%d", freq, bw, (uint32_t)sf,
|
||||
(uint32_t)cr);
|
||||
|
||||
@@ -234,6 +234,18 @@ void setup() {
|
||||
#error "need to define filesystem"
|
||||
#endif
|
||||
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
// Apply PowerSaving profile for GPS
|
||||
if(sensors.getLocationProvider() != NULL) {
|
||||
// Enable by default
|
||||
sensors.powersaving_enabled = true;
|
||||
sensors.getLocationProvider()->enablePowerSaving(true);
|
||||
|
||||
// Set GPS on and off duration in seconds
|
||||
sensors.getLocationProvider()->setPowerSavingProfile(600, 300); // Max 10 minutes, 5 minutes
|
||||
}
|
||||
#endif
|
||||
|
||||
sensors.begin();
|
||||
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "MyMesh.h"
|
||||
#include <algorithm>
|
||||
#include "helpers/radiolib/RXPowerSaving.h"
|
||||
|
||||
/* ------------------------------ Config -------------------------------- */
|
||||
|
||||
@@ -896,8 +897,8 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
||||
_prefs.flood_max_advert = 8;
|
||||
_prefs.interference_threshold = 0; // disabled
|
||||
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
|
||||
_prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US;
|
||||
_prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US;
|
||||
_prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US; // RX PowerSaving
|
||||
_prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US; // RX PowerSaving
|
||||
|
||||
// bridge defaults
|
||||
_prefs.bridge_enabled = 1; // enabled
|
||||
|
||||
@@ -26,10 +26,11 @@ static const uint8_t meshcore_logo [] PROGMEM = {
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
};
|
||||
|
||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version, mesh::MainBoard* board) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
_node_prefs = node_prefs;
|
||||
_board = board;
|
||||
_display->turnOn();
|
||||
|
||||
// strip off dash and commit hash by changing dash to null terminator
|
||||
@@ -89,6 +90,16 @@ void UITask::renderCurrScreen() {
|
||||
_display->setCursor(0, 30);
|
||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
||||
_display->print(tmp);
|
||||
|
||||
// Battery
|
||||
_display->setCursor(0, 40);
|
||||
sprintf(tmp, "BAT: %.2fV", _board->getBattMilliVolts() / 1000.0);
|
||||
_display->print(tmp);
|
||||
|
||||
// PowerSaving
|
||||
_display->setCursor(0, 50);
|
||||
sprintf(tmp, "PowerSaving: %s", _node_prefs->powersaving_enabled? "ON" : "off");
|
||||
_display->print(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@ class UITask {
|
||||
int _prevBtnState;
|
||||
NodePrefs* _node_prefs;
|
||||
char _version_info[32];
|
||||
mesh::MainBoard* _board;
|
||||
|
||||
void renderCurrScreen();
|
||||
public:
|
||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version, mesh::MainBoard* board);
|
||||
|
||||
void loop();
|
||||
};
|
||||
@@ -87,12 +87,24 @@ void setup() {
|
||||
|
||||
command[0] = 0;
|
||||
|
||||
#if ENV_INCLUDE_GPS == 1
|
||||
// Apply PowerSaving profile for GPS
|
||||
if (sensors.getLocationProvider() != NULL) {
|
||||
// Let CLI "gps on" call setSettingValue to enable the PowerSaving mode
|
||||
// sensors.powersaving_enabled = true;
|
||||
// sensors.getLocationProvider()->enablePowerSaving(true);
|
||||
|
||||
// GPS on and off duration in seconds
|
||||
sensors.getLocationProvider()->setPowerSavingProfile(600, 86400); // Max 10 minutes, 1 day
|
||||
}
|
||||
#endif
|
||||
|
||||
sensors.begin();
|
||||
|
||||
the_mesh.begin(fs);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION, &board);
|
||||
#endif
|
||||
|
||||
// send out initial zero hop Advertisement to the mesh
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "MyMesh.h"
|
||||
#include "helpers/radiolib/RXPowerSaving.h"
|
||||
|
||||
#define REPLY_DELAY_MILLIS 1500
|
||||
#define PUSH_NOTIFY_DELAY_MILLIS 2000
|
||||
@@ -651,8 +652,8 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
||||
_prefs.flood_max_advert = 8;
|
||||
_prefs.interference_threshold = 0; // disabled
|
||||
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
|
||||
_prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US;
|
||||
_prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US;
|
||||
_prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US; // RX PowerSaving
|
||||
_prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US; // RX PowerSaving
|
||||
#ifdef ROOM_PASSWORD
|
||||
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "SensorMesh.h"
|
||||
#include "helpers/radiolib/RXPowerSaving.h"
|
||||
|
||||
/* ------------------------------ Config -------------------------------- */
|
||||
|
||||
@@ -730,8 +731,8 @@ SensorMesh::SensorMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::Millise
|
||||
_prefs.flood_max = 64;
|
||||
_prefs.interference_threshold = 0; // disabled
|
||||
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
|
||||
_prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US;
|
||||
_prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US;
|
||||
_prefs.rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US; // RX PowerSaving
|
||||
_prefs.rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US; // RX PowerSaving
|
||||
|
||||
// GPS defaults
|
||||
_prefs.gps_enabled = 0;
|
||||
|
||||
@@ -13,14 +13,6 @@ extra_configs =
|
||||
variants/*/platformio.ini
|
||||
platformio.local.ini
|
||||
|
||||
[companion_rxps]
|
||||
custom_rxps_level = 5
|
||||
custom_rxps_preamble = 16
|
||||
build_flags =
|
||||
-D RXPS_FIXED_ENABLED=1
|
||||
-D RXPS_FIXED_LEVEL=${companion_rxps.custom_rxps_level}
|
||||
-D RXPS_FIXED_PREAMBLE=${companion_rxps.custom_rxps_preamble}
|
||||
|
||||
[arduino_base]
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
|
||||
@@ -37,6 +37,15 @@
|
||||
#define BRIDGE_DEBUG_PRINTLN(...) {}
|
||||
#endif
|
||||
|
||||
#if POWERSAVING_DEBUG && ARDUINO
|
||||
#include <Arduino.h>
|
||||
#define POWERSAVING_DEBUG_PRINT(F, ...) Serial.printf("POWERSAVING: " F, ##__VA_ARGS__)
|
||||
#define POWERSAVING_DEBUG_PRINTLN(F, ...) Serial.printf("POWERSAVING: " F "\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define POWERSAVING_DEBUG_PRINT(...) {}
|
||||
#define POWERSAVING_DEBUG_PRINTLN(...) {}
|
||||
#endif
|
||||
|
||||
namespace mesh {
|
||||
|
||||
#define BD_STARTUP_NORMAL 0 // getStartupReason() codes
|
||||
|
||||
+20
-87
@@ -11,6 +11,8 @@
|
||||
#define BRIDGE_MAX_BAUD 115200
|
||||
#endif
|
||||
|
||||
#include <helpers/radiolib/RXPowerSaving.h>
|
||||
|
||||
// Believe it or not, this std C function is busted on some platforms!
|
||||
static uint32_t _atoi(const char* sp) {
|
||||
uint32_t n = 0;
|
||||
@@ -29,80 +31,6 @@ static bool isValidName(const char *n) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool isValidRxPowerSavingPeriod(uint32_t us) {
|
||||
return us >= RX_POWERSAVING_MIN_PERIOD_US && us <= RX_POWERSAVING_MAX_PERIOD_US;
|
||||
}
|
||||
|
||||
// MeshCore preamble convention used for the RX powersaving timing calculation.
|
||||
// Must stay in sync with RadioLibWrapper::preambleLengthForSF() (the value the
|
||||
// radio actually transmits); kept local here because CommonCLI is radio-agnostic.
|
||||
static uint16_t rxPowerSavingPreambleForSF(uint8_t sf) {
|
||||
return sf <= 8 ? 32 : 16;
|
||||
}
|
||||
|
||||
static bool isNumeric(const char* sp) {
|
||||
if (!sp || !*sp) return false;
|
||||
while (*sp) {
|
||||
if (*sp < '0' || *sp > '9') return false;
|
||||
sp++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint32_t ceilPositiveFloat(float value) {
|
||||
uint32_t rounded = (uint32_t)value;
|
||||
return value > (float)rounded ? rounded + 1 : rounded;
|
||||
}
|
||||
|
||||
static bool calcRxPowerSavingLevel(uint32_t level, uint8_t sf, float bw, uint32_t preamble,
|
||||
uint32_t* rx_us, uint32_t* sleep_us) {
|
||||
if (level < 1 || level > 10 || sf < 5 || sf > 12 || bw <= 0.0f || (preamble != 16 && preamble != 32)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const float symbol_us = (1000.0f * (float)(1UL << sf)) / bw;
|
||||
const float amount = (float)(level - 1) / 9.0f;
|
||||
const float rx_start_symbols = preamble == 16 ? 12.0f : 16.0f;
|
||||
const float sleep_start_symbols = preamble == 16 ? 2.0f : 15.0f;
|
||||
const float rx_edge_symbols = 8.0f;
|
||||
const float sleep_edge_symbols = (float)preamble + 4.25f - 8.0f;
|
||||
|
||||
const float rx_symbols = rx_start_symbols + amount * (rx_edge_symbols - rx_start_symbols);
|
||||
const float sleep_symbols = sleep_start_symbols + amount * (sleep_edge_symbols - sleep_start_symbols);
|
||||
|
||||
*rx_us = ceilPositiveFloat(rx_symbols * symbol_us);
|
||||
*sleep_us = (uint32_t)(sleep_symbols * symbol_us);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ensureRxPowerSavingDefaults(NodePrefs* prefs) {
|
||||
if (!isValidRxPowerSavingPeriod(prefs->rx_ps_rx_us)) {
|
||||
prefs->rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US;
|
||||
}
|
||||
if (!isValidRxPowerSavingPeriod(prefs->rx_ps_sleep_us)) {
|
||||
prefs->rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US;
|
||||
}
|
||||
}
|
||||
|
||||
// Recomputes rx_ps_rx_us/rx_ps_sleep_us from the stored level and the current
|
||||
// radio SF/BW. No-op (returns false) for manual timings (rx_ps_level == 0).
|
||||
// Lets level-based RX powersaving auto-retune when SF/BW change.
|
||||
static bool recalcRxPowerSavingFromLevel(NodePrefs* prefs) {
|
||||
if (prefs->rx_ps_level < 1 || prefs->rx_ps_level > 10) return false; // manual: nothing to recompute
|
||||
uint32_t preamble = prefs->rx_ps_preamble ? prefs->rx_ps_preamble
|
||||
: rxPowerSavingPreambleForSF(prefs->sf);
|
||||
uint32_t rx_us, sleep_us;
|
||||
if (!calcRxPowerSavingLevel(prefs->rx_ps_level, prefs->sf, prefs->bw, preamble, &rx_us, &sleep_us)) {
|
||||
return false;
|
||||
}
|
||||
if (!isValidRxPowerSavingPeriod(rx_us) || !isValidRxPowerSavingPeriod(sleep_us)) {
|
||||
return false;
|
||||
}
|
||||
prefs->rx_ps_rx_us = rx_us;
|
||||
prefs->rx_ps_sleep_us = sleep_us;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CommonCLI::loadPrefs(FILESYSTEM* fs) {
|
||||
if (fs->exists("/com_prefs")) {
|
||||
loadPrefsInt(fs, "/com_prefs"); // new filename
|
||||
@@ -208,13 +136,16 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
|
||||
_prefs->rx_boosted_gain = constrain(_prefs->rx_boosted_gain, 0, 1); // boolean
|
||||
_prefs->radio_fem_rxgain = constrain(_prefs->radio_fem_rxgain, 0, 1); // boolean
|
||||
_prefs->cad_enabled = constrain(_prefs->cad_enabled, 0, 1); // boolean
|
||||
|
||||
_prefs->rx_powersaving_enabled = constrain(_prefs->rx_powersaving_enabled, 0, 1);
|
||||
_prefs->rx_ps_level = constrain(_prefs->rx_ps_level, 0, 10);
|
||||
if (_prefs->rx_ps_preamble != 16 && _prefs->rx_ps_preamble != 32) {
|
||||
_prefs->rx_ps_preamble = 0; // 0 = auto (derive from SF)
|
||||
}
|
||||
ensureRxPowerSavingDefaults(_prefs);
|
||||
recalcRxPowerSavingFromLevel(_prefs); // retune level-based timings to the loaded SF/BW
|
||||
ensureRxPowerSavingDefaults(&_prefs->rx_ps_rx_us, &_prefs->rx_ps_sleep_us);
|
||||
recalcRxPowerSavingFromLevel(_prefs->rx_ps_level, _prefs->sf, _prefs->bw, _prefs->rx_ps_preamble,
|
||||
&_prefs->rx_ps_rx_us,
|
||||
&_prefs->rx_ps_sleep_us); // retune level-based timings to the loaded SF/BW
|
||||
|
||||
file.close();
|
||||
}
|
||||
@@ -527,9 +458,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
|
||||
int sats = l->satellitesCount();
|
||||
bool active = !strcmp(_sensors->getSettingByKey("gps"), "1");
|
||||
|
||||
if (_prefs->powersaving_enabled && l->getGPSPowerSaving()) { // GPS Power Saving
|
||||
if (_prefs->powersaving_enabled && l->isPowerSavingEnabled()) { // GPS Power Saving
|
||||
if (enabled) {
|
||||
unsigned long mins = (l->getNextGPSOff() - millis()) / 60000UL;
|
||||
unsigned long mins = (l->getNextSleep() - millis()) / 60000UL;
|
||||
sprintf(reply, "on (powersaving, sleep in %luh %lum), %s, %s, %d sats",
|
||||
mins / 60UL,
|
||||
mins % 60UL,
|
||||
@@ -537,7 +468,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
|
||||
fix ? "fix" : "no fix",
|
||||
sats);
|
||||
} else {
|
||||
unsigned long mins = (l->getNextGPSOn() - millis()) / 60000UL;
|
||||
unsigned long mins = (l->getNextWake() - millis()) / 60000UL;
|
||||
sprintf(reply, "off (powersaving, wake in %luh %lum)",
|
||||
mins / 60UL,
|
||||
mins % 60UL);
|
||||
@@ -778,17 +709,17 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
||||
} else {
|
||||
sprintf(reply, "OK - radio.rxps.rfrx_disabled %s", disabled ? "on" : "off");
|
||||
}
|
||||
} else if (memcmp(config, "radio.rxps ", 11) == 0) {
|
||||
} else if (memcmp(config, "radio.rxps ", 11) == 0) { // RX PowerSaving
|
||||
const char* value = &config[11];
|
||||
uint8_t enable = _prefs->rx_powersaving_enabled;
|
||||
uint32_t rx_us = _prefs->rx_ps_rx_us;
|
||||
uint32_t sleep_us = _prefs->rx_ps_sleep_us;
|
||||
uint32_t level = 0;
|
||||
uint32_t preamble = rxPowerSavingPreambleForSF(_prefs->sf);
|
||||
uint8_t level = 0;
|
||||
uint8_t preamble = rxPowerSavingPreambleForSF(_prefs->sf);
|
||||
bool level_requested = false;
|
||||
bool preamble_overridden = false;
|
||||
|
||||
ensureRxPowerSavingDefaults(_prefs);
|
||||
ensureRxPowerSavingDefaults(&_prefs->rx_ps_rx_us, &_prefs->rx_ps_sleep_us);
|
||||
rx_us = _prefs->rx_ps_rx_us;
|
||||
sleep_us = _prefs->rx_ps_sleep_us;
|
||||
|
||||
@@ -892,7 +823,9 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
||||
_prefs->bw = bw;
|
||||
// Retune level-based RX powersaving to the new SF/BW. Persist only; the
|
||||
// radio itself is "reboot to apply", and begin() re-arms the timings then.
|
||||
bool rxps_retuned = recalcRxPowerSavingFromLevel(_prefs);
|
||||
bool rxps_retuned = recalcRxPowerSavingFromLevel(
|
||||
_prefs->rx_ps_level, _prefs->sf, _prefs->bw, _prefs->rx_ps_preamble, &_prefs->rx_ps_rx_us,
|
||||
&_prefs->rx_ps_sleep_us); // retune level-based timings to the loaded SF/BW
|
||||
_callbacks->savePrefs();
|
||||
strcpy(reply, rxps_retuned ? "OK - reboot to apply (rxps retuned)" : "OK - reboot to apply");
|
||||
} else {
|
||||
@@ -932,7 +865,7 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
||||
strcpy(reply, "OK");
|
||||
} else {
|
||||
strcpy(reply, "Error, max 64");
|
||||
}
|
||||
}
|
||||
} else if (memcmp(config, "flood.max.advert ", 17) == 0) {
|
||||
uint8_t m = atoi(&config[17]);
|
||||
if (m <= 64) {
|
||||
@@ -1144,8 +1077,8 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
|
||||
} else {
|
||||
sprintf(reply, "> %s", _callbacks->isRxPowerSavingRfRxDisabled() ? "on" : "off");
|
||||
}
|
||||
} else if (memcmp(config, "radio.rxps", 10) == 0) {
|
||||
ensureRxPowerSavingDefaults(_prefs);
|
||||
} else if (memcmp(config, "radio.rxps", 10) == 0) { // RX PowerSaving
|
||||
ensureRxPowerSavingDefaults(&_prefs->rx_ps_rx_us, &_prefs->rx_ps_sleep_us);
|
||||
sprintf(reply, "> %s,%lu,%lu", _prefs->rx_powersaving_enabled ? "on" : "off",
|
||||
(unsigned long)_prefs->rx_ps_rx_us, (unsigned long)_prefs->rx_ps_sleep_us);
|
||||
} else if (memcmp(config, "rxps.wd", 7) == 0) {
|
||||
|
||||
+1
-12
@@ -19,18 +19,6 @@
|
||||
#define LOOP_DETECT_MODERATE 2
|
||||
#define LOOP_DETECT_STRICT 3
|
||||
|
||||
#define RX_POWERSAVING_DEFAULT_RX_US 65625UL
|
||||
#define RX_POWERSAVING_DEFAULT_SLEEP_US 60000UL
|
||||
#define RX_POWERSAVING_MIN_PERIOD_US 1000UL
|
||||
#define RX_POWERSAVING_MAX_PERIOD_US 30000000UL
|
||||
|
||||
// The named profiles are level presets pinned to a 16-symbol preamble: most
|
||||
// deployed senders still transmit 16-symbol preambles regardless of the newer
|
||||
// SF-based rule (32 for SF <= 8). Revisit once the field has largely migrated.
|
||||
#define RX_POWERSAVING_CONSERVATIVE_LEVEL 1UL
|
||||
#define RX_POWERSAVING_BALANCED_LEVEL 5UL
|
||||
#define RX_POWERSAVING_PROFILE_PREAMBLE 16UL
|
||||
|
||||
struct NodePrefs { // persisted to file
|
||||
float airtime_factor;
|
||||
char node_name[32];
|
||||
@@ -133,6 +121,7 @@ public:
|
||||
// no op by default
|
||||
};
|
||||
|
||||
// RX PowerSaving
|
||||
virtual bool setRxPowerSaving(bool enable, uint32_t rx_us, uint32_t sleep_us) {
|
||||
return !enable;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,16 @@ void TBeamBoard::begin() {
|
||||
|
||||
ESP32Board::begin();
|
||||
|
||||
#ifdef TBEAM_SUPREME_SX1262
|
||||
// On the T-Beam S3 Supreme the PMU + RTC sit on Wire1 (GPIO 42/41, brought
|
||||
// up by XPowersLib), while the SH1106 OLED and the BME280/QMC6310 sensors
|
||||
// sit on the primary bus, Wire (GPIO PIN_BOARD_SDA/PIN_BOARD_SCL). Nothing
|
||||
// else initialises Wire on this board, so the display driver would
|
||||
// otherwise talk on the wrong (default) pins and display.begin() fails,
|
||||
// leaving the screen blank. Bring the OLED bus up here.
|
||||
Wire.begin(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
#endif
|
||||
|
||||
power_init();
|
||||
|
||||
//Configure user button
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
#define RX_POWERSAVING_DEFAULT_RX_US 65625UL
|
||||
#define RX_POWERSAVING_DEFAULT_SLEEP_US 60000UL
|
||||
#define RX_POWERSAVING_MIN_PERIOD_US 1000UL
|
||||
#define RX_POWERSAVING_MAX_PERIOD_US 30000000UL
|
||||
|
||||
// The named profiles are level presets pinned to a 16-symbol preamble: most
|
||||
// deployed senders still transmit 16-symbol preambles regardless of the newer
|
||||
// SF-based rule (32 for SF <= 8). Revisit once the field has largely migrated.
|
||||
#define RX_POWERSAVING_CONSERVATIVE_LEVEL 1
|
||||
#define RX_POWERSAVING_BALANCED_LEVEL 5
|
||||
#define RX_POWERSAVING_PROFILE_PREAMBLE 16
|
||||
|
||||
// Fixed settings for companions
|
||||
#define RXPS_FIXED_ENABLED 1
|
||||
#define RXPS_FIXED_LEVEL RX_POWERSAVING_BALANCED_LEVEL
|
||||
#define RXPS_FIXED_PREAMBLE RX_POWERSAVING_PROFILE_PREAMBLE
|
||||
|
||||
inline bool isValidRxPowerSavingPeriod(uint32_t us) {
|
||||
return us >= RX_POWERSAVING_MIN_PERIOD_US && us <= RX_POWERSAVING_MAX_PERIOD_US;
|
||||
}
|
||||
|
||||
// MeshCore preamble convention used for the RX powersaving timing calculation.
|
||||
// Must stay in sync with RadioLibWrapper::preambleLengthForSF() (the value the
|
||||
// radio actually transmits); kept local here because CommonCLI is radio-agnostic.
|
||||
inline uint8_t rxPowerSavingPreambleForSF(uint8_t sf) {
|
||||
return sf <= 8 ? 32 : 16;
|
||||
}
|
||||
|
||||
inline bool isNumeric(const char *sp) {
|
||||
if (!sp || !*sp) return false;
|
||||
while (*sp) {
|
||||
if (*sp < '0' || *sp > '9') return false;
|
||||
sp++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline uint32_t ceilPositiveFloat(float value) {
|
||||
uint32_t rounded = (uint32_t)value;
|
||||
return value > (float)rounded ? rounded + 1 : rounded;
|
||||
}
|
||||
|
||||
inline bool calcRxPowerSavingLevel(uint8_t level, uint8_t sf, float bw, uint8_t preamble, uint32_t *rx_us,
|
||||
uint32_t *sleep_us) {
|
||||
if (level < 1 || level > 10 || sf < 5 || sf > 12 || bw <= 0.0f || (preamble != 16 && preamble != 32)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const float symbol_us = (1000.0f * (float)(1UL << sf)) / bw;
|
||||
const float amount = (float)(level - 1) / 9.0f;
|
||||
const float rx_start_symbols = preamble == 16 ? 12.0f : 16.0f;
|
||||
const float sleep_start_symbols = preamble == 16 ? 2.0f : 15.0f;
|
||||
const float rx_edge_symbols = 8.0f;
|
||||
const float sleep_edge_symbols = (float)preamble + 4.25f - 8.0f;
|
||||
|
||||
const float rx_symbols = rx_start_symbols + amount * (rx_edge_symbols - rx_start_symbols);
|
||||
const float sleep_symbols = sleep_start_symbols + amount * (sleep_edge_symbols - sleep_start_symbols);
|
||||
|
||||
*rx_us = ceilPositiveFloat(rx_symbols * symbol_us);
|
||||
*sleep_us = (uint32_t)(sleep_symbols * symbol_us);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void ensureRxPowerSavingDefaults(uint32_t *rx_ps_rx_us, uint32_t *rx_ps_sleep_us) {
|
||||
if (!isValidRxPowerSavingPeriod(*rx_ps_rx_us)) {
|
||||
*rx_ps_rx_us = RX_POWERSAVING_DEFAULT_RX_US;
|
||||
}
|
||||
|
||||
if (!isValidRxPowerSavingPeriod(*rx_ps_sleep_us)) {
|
||||
*rx_ps_sleep_us = RX_POWERSAVING_DEFAULT_SLEEP_US;
|
||||
}
|
||||
}
|
||||
|
||||
// Recomputes rx_ps_rx_us/rx_ps_sleep_us from the stored level and the current
|
||||
// radio SF/BW. No-op (returns false) for manual timings (rx_ps_level == 0).
|
||||
// Lets level-based RX powersaving auto-retune when SF/BW change.
|
||||
inline bool recalcRxPowerSavingFromLevel(uint8_t level, uint8_t sf, float bw, uint8_t preamble,
|
||||
uint32_t *rx_ps_rx_us, uint32_t *rx_ps_sleep_us) {
|
||||
if (level < 1 || level > 10) {
|
||||
return false; // manual: nothing to recompute
|
||||
}
|
||||
|
||||
if (preamble == 0) {
|
||||
preamble = rxPowerSavingPreambleForSF(sf);
|
||||
}
|
||||
|
||||
uint32_t rx_us, sleep_us;
|
||||
if (!calcRxPowerSavingLevel(level, sf, bw, preamble, &rx_us, &sleep_us)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isValidRxPowerSavingPeriod(rx_us) || !isValidRxPowerSavingPeriod(sleep_us)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*rx_ps_rx_us = rx_us;
|
||||
*rx_ps_sleep_us = sleep_us;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -292,6 +292,7 @@ bool RadioLibWrapper::isInRecvMode() const {
|
||||
return (state & ~STATE_INT_READY) == STATE_RX;
|
||||
}
|
||||
|
||||
// RX PowerSaving
|
||||
bool RadioLibWrapper::setRxPowerSaving(bool enabled, uint32_t rx_us, uint32_t sleep_us) {
|
||||
if (enabled && !supportsRxPowerSaving()) {
|
||||
return false;
|
||||
|
||||
@@ -169,7 +169,9 @@ static RAK12035_SoilMoisture RAK12035;
|
||||
#endif
|
||||
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
static uint32_t gpsResetPin = 0;
|
||||
// -1 = no enable pin; out-of-range values are no-ops in pinMode/digitalWrite,
|
||||
// while 0 would be a real GPIO (P0.00 = LFXO crystal on nRF52)
|
||||
static uint32_t gpsResetPin = -1;
|
||||
static bool i2cGPSFlag = false;
|
||||
static bool serialGPSFlag = false;
|
||||
#ifndef TELEM_RAK12500_ADDRESS
|
||||
@@ -185,6 +187,7 @@ class RAK12500LocationProvider : public LocationProvider {
|
||||
int _sats = 0;
|
||||
long _epoch = 0;
|
||||
bool _fix = false;
|
||||
int _pin_en = -1;
|
||||
public:
|
||||
long getLatitude() override { return _lat; }
|
||||
long getLongitude() override { return _lng; }
|
||||
@@ -197,18 +200,25 @@ public:
|
||||
void begin() override { }
|
||||
void stop() override { }
|
||||
void loop() override {
|
||||
if (ublox_GNSS.getGnssFixOk(8)) {
|
||||
_fix = true;
|
||||
_lat = ublox_GNSS.getLatitude(2) / 10;
|
||||
_lng = ublox_GNSS.getLongitude(2) / 10;
|
||||
_alt = ublox_GNSS.getAltitude(2);
|
||||
_sats = ublox_GNSS.getSIV(2);
|
||||
} else {
|
||||
_fix = false;
|
||||
static long next_gps_update = 0;
|
||||
if ((int32_t)(millis() - next_gps_update) >= 0) {
|
||||
if (ublox_GNSS.getGnssFixOk(8)) {
|
||||
_fix = true;
|
||||
_lat = ublox_GNSS.getLatitude(2) / 10;
|
||||
_lng = ublox_GNSS.getLongitude(2) / 10;
|
||||
_alt = ublox_GNSS.getAltitude(2);
|
||||
_sats = ublox_GNSS.getSIV(2);
|
||||
} else {
|
||||
_fix = false;
|
||||
}
|
||||
_epoch = ublox_GNSS.getUnixEpoch(2);
|
||||
|
||||
next_gps_update = millis() + 1000;
|
||||
}
|
||||
_epoch = ublox_GNSS.getUnixEpoch(2);
|
||||
}
|
||||
bool isEnabled() override { return true; }
|
||||
void setPinEn(int pin_en) override { _pin_en = pin_en; }
|
||||
int getPinEn() override { return _pin_en; }
|
||||
};
|
||||
|
||||
static RAK12500LocationProvider RAK12500_provider;
|
||||
@@ -621,12 +631,6 @@ static const SensorDef SENSOR_TABLE[] = {
|
||||
|
||||
static const size_t SENSOR_TABLE_SIZE = (sizeof(SENSOR_TABLE) / sizeof(SENSOR_TABLE[0])) - 1;
|
||||
|
||||
// ============================================================
|
||||
// Power Saving GPS
|
||||
// ============================================================
|
||||
static unsigned long GPS_ON_DURATION_SECS = 600; // 10 minutes
|
||||
static unsigned long GPS_OFF_DURATION_SECS = 86400; // 1 day
|
||||
|
||||
// ============================================================
|
||||
// begin() — scan the I2C bus, then initialize only what was
|
||||
// found. A sensor whose address does not ACK during the scan
|
||||
@@ -737,13 +741,13 @@ bool EnvironmentSensorManager::setSettingValue(const char* name, const char* val
|
||||
if (gps_detected && strcmp(name, "gps") == 0) {
|
||||
if (strcmp(value, "0") == 0) {
|
||||
if (powersaving_enabled) {
|
||||
_location->setGPSPowerSaving(false);
|
||||
_location->enablePowerSaving(false);
|
||||
}
|
||||
|
||||
stop_gps();
|
||||
} else {
|
||||
if (powersaving_enabled) {
|
||||
_location->setGPSPowerSaving(true);
|
||||
_location->enablePowerSaving(true);
|
||||
}
|
||||
|
||||
start_gps();
|
||||
@@ -804,24 +808,19 @@ void EnvironmentSensorManager::initBasicGPS() {
|
||||
// gps code for rak might be moved to MicroNMEALoactionProvider
|
||||
// or make a new location provider ...
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
void EnvironmentSensorManager::rakGPSInit(){
|
||||
|
||||
void EnvironmentSensorManager::rakGPSInit() {
|
||||
Serial1.setPins(PIN_GPS_TX, PIN_GPS_RX);
|
||||
|
||||
#ifdef GPS_BAUD_RATE
|
||||
#ifdef GPS_BAUD_RATE
|
||||
Serial1.begin(GPS_BAUD_RATE);
|
||||
#else
|
||||
#else
|
||||
Serial1.begin(9600);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//search for the correct IO standby pin depending on socket used
|
||||
if(gpsIsAwake(WB_IO2)){
|
||||
}
|
||||
else if(gpsIsAwake(WB_IO4)){
|
||||
}
|
||||
else if(gpsIsAwake(WB_IO5)){
|
||||
}
|
||||
else{
|
||||
// search for the correct IO standby pin depending on socket used
|
||||
if (gpsIsAwake(WB_IO2)) {
|
||||
_location->setPinEn(WB_IO2); // WB_IO2 is the power switch for all sensor and IO slots
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("No GPS found");
|
||||
gps_active = false;
|
||||
gps_detected = false;
|
||||
@@ -829,24 +828,23 @@ void EnvironmentSensorManager::rakGPSInit(){
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef FORCE_GPS_ALIVE // for use with repeaters, until GPS toggle is implimented
|
||||
//Now that GPS is found and set up, set to sleep for initial state
|
||||
#ifndef FORCE_GPS_ALIVE // for use with repeaters, until GPS toggle is implimented
|
||||
// Now that GPS is found and set up, set to sleep for initial state
|
||||
stop_gps();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool EnvironmentSensorManager::gpsIsAwake(uint8_t ioPin){
|
||||
|
||||
//set initial waking state
|
||||
pinMode(ioPin,OUTPUT);
|
||||
digitalWrite(ioPin,LOW);
|
||||
bool EnvironmentSensorManager::gpsIsAwake(uint8_t ioPin) {
|
||||
// set initial waking state
|
||||
pinMode(ioPin, OUTPUT);
|
||||
digitalWrite(ioPin, LOW);
|
||||
delay(500);
|
||||
digitalWrite(ioPin,HIGH);
|
||||
digitalWrite(ioPin, HIGH);
|
||||
delay(500);
|
||||
|
||||
//Try to init RAK12500 on I2C
|
||||
if (ublox_GNSS.begin(Wire) == true){
|
||||
MESH_DEBUG_PRINTLN("RAK12500 GPS init correctly with pin %i",ioPin);
|
||||
// Try to init RAK12500 on I2C
|
||||
if (ublox_GNSS.begin(Wire) == true) {
|
||||
MESH_DEBUG_PRINTLN("RAK12500 GPS init correctly with pin %i", ioPin);
|
||||
ublox_GNSS.setI2COutput(COM_TYPE_UBX);
|
||||
ublox_GNSS.enableGNSS(true, SFE_UBLOX_GNSS_ID_GPS);
|
||||
ublox_GNSS.enableGNSS(true, SFE_UBLOX_GNSS_ID_GALILEO);
|
||||
@@ -864,13 +862,9 @@ bool EnvironmentSensorManager::gpsIsAwake(uint8_t ioPin){
|
||||
|
||||
_location = &RAK12500_provider;
|
||||
return true;
|
||||
} else if (Serial1.available()) {
|
||||
} else if (Serial1.available()) { // RAK12501 (L76K) on UART
|
||||
MESH_DEBUG_PRINTLN("Serial GPS init correctly and is turned on");
|
||||
#ifdef PIN_GPS_EN
|
||||
if(PIN_GPS_EN){
|
||||
gpsResetPin = PIN_GPS_EN;
|
||||
}
|
||||
#endif
|
||||
gpsResetPin = ioPin;
|
||||
serialGPSFlag = true;
|
||||
gps_active = true;
|
||||
gps_detected = true;
|
||||
@@ -885,11 +879,23 @@ bool EnvironmentSensorManager::gpsIsAwake(uint8_t ioPin){
|
||||
|
||||
void EnvironmentSensorManager::start_gps() {
|
||||
gps_active = true;
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
pinMode(gpsResetPin, OUTPUT);
|
||||
digitalWrite(gpsResetPin, HIGH);
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (powersaving_enabled && _location->isPowerSavingEnabled()) {
|
||||
gps_wake = true; // gps_active is true
|
||||
_location->syncTime(); // Clear GPS data and force sync time
|
||||
_location->setNextSleep(); // Next time to off
|
||||
}
|
||||
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
#ifdef FORCE_GPS_ALIVE
|
||||
// There is no UART command to enter power save for L76K
|
||||
if (i2cGPSFlag) ublox_GNSS.powerSaveMode(false);
|
||||
#else
|
||||
pinMode(gpsResetPin, OUTPUT);
|
||||
digitalWrite(gpsResetPin, HIGH); // WB_IO2
|
||||
#endif
|
||||
return;
|
||||
#endif
|
||||
|
||||
_location->begin();
|
||||
_location->reset();
|
||||
@@ -897,24 +903,26 @@ void EnvironmentSensorManager::start_gps() {
|
||||
#ifndef PIN_GPS_EN
|
||||
MESH_DEBUG_PRINTLN("Start GPS is N/A on this board. Actual GPS state unchanged");
|
||||
#endif
|
||||
|
||||
if (powersaving_enabled && _location->getGPSPowerSaving()) {
|
||||
_location->syncTime(); // Clear GPS data and force sync time
|
||||
_location->setNextGPSOff(millis() + GPS_ON_DURATION_SECS * 1000UL); // Next time to off
|
||||
}
|
||||
}
|
||||
|
||||
void EnvironmentSensorManager::stop_gps() {
|
||||
gps_active = false;
|
||||
|
||||
if (powersaving_enabled && _location->getGPSPowerSaving()) {
|
||||
if (powersaving_enabled && _location->isPowerSavingEnabled()) {
|
||||
gps_wake = false; // gps_active is unchanged (true) even the GPS sleep (e.g: off)
|
||||
_location->stopTimeSync(); // Stop time sync
|
||||
_location->setNextGPSOn(millis() + GPS_OFF_DURATION_SECS * 1000UL); // Next time to on
|
||||
_location->setNextWake(); // Next time to on
|
||||
} else {
|
||||
gps_active = false;
|
||||
gps_wake = false; // When GPS is off, wake is false to be sure
|
||||
}
|
||||
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
#ifdef FORCE_GPS_ALIVE
|
||||
// There is no UART command to enter power save for L76K
|
||||
if(i2cGPSFlag) ublox_GNSS.powerSaveMode(false);
|
||||
#else
|
||||
pinMode(gpsResetPin, OUTPUT);
|
||||
digitalWrite(gpsResetPin, LOW);
|
||||
digitalWrite(gpsResetPin, LOW); // WB_IO2
|
||||
#endif
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -934,37 +942,35 @@ void EnvironmentSensorManager::loop() {
|
||||
|
||||
// PowerSaving
|
||||
if (powersaving_enabled) {
|
||||
if (gps_detected && _location->getGPSPowerSaving()) {
|
||||
if (gps_active && ((int32_t)(millis() - _location->getNextGPSOff()) >= 0 ||
|
||||
if (gps_detected && _location->isPowerSavingEnabled()) {
|
||||
if (gps_wake && ((int32_t)(millis() - _location->getNextSleep()) >= 0 ||
|
||||
!_location->waitingTimeSync())) { // Time to off or GPS set
|
||||
// --- TO REMOVE
|
||||
if ((int32_t)(millis() - _location->getNextGPSOff()) >= 0) Serial.println("Timeout, off");
|
||||
else if (!_location->waitingTimeSync()) Serial.println("GPS set, off early");
|
||||
// --- TO REMOVE
|
||||
if ((int32_t)(millis() - _location->getNextSleep()) >= 0) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS wake timeout. Enter sleep");
|
||||
}
|
||||
else if (!_location->waitingTimeSync()) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS set. Enter sleep early");
|
||||
}
|
||||
|
||||
stop_gps();
|
||||
} else if (!gps_active && ((int32_t)(millis() - _location->getNextGPSOn()) >= 0)) { // Time to on
|
||||
// --- TO REMOVE
|
||||
Serial.println("Timeout, on");
|
||||
// --- TO REMOVE
|
||||
} else if (!gps_wake && ((int32_t)(millis() - _location->getNextWake()) >= 0)) { // Time to on
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS sleep timeout. Wakeup.");
|
||||
|
||||
start_gps();
|
||||
} else if (!gps_active && _location->waitingTimeSync()) { // On for "gps sync"
|
||||
// --- TO REMOVE
|
||||
Serial.println("gps sync CLI, on");
|
||||
// --- TO REMOVE
|
||||
} else if (!gps_wake && _location->waitingTimeSync()) { // On for "gps sync"
|
||||
POWERSAVING_DEBUG_PRINTLN("CLI gps sync. Wakeup");
|
||||
|
||||
start_gps();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gps_active) {
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
_location->loop();
|
||||
}
|
||||
|
||||
if ((int32_t)(millis() - next_gps_update) >= 0) {
|
||||
if(gps_active){
|
||||
if((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)){
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
if ((i2cGPSFlag || serialGPSFlag) && _location->isValid()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
|
||||
@@ -21,6 +21,7 @@ protected:
|
||||
|
||||
bool gps_detected = false;
|
||||
bool gps_active = false;
|
||||
bool gps_wake = false; // In PowerSaving, gps_active can have gps_wake true or false
|
||||
uint32_t gps_update_interval_sec = 1;
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
|
||||
@@ -6,22 +6,32 @@
|
||||
class LocationProvider {
|
||||
protected:
|
||||
bool _time_sync_needed = true;
|
||||
|
||||
bool powersaving_enabled = false;
|
||||
unsigned long _next_gps_off = 0;
|
||||
unsigned long _next_gps_on = 0;
|
||||
unsigned long _wake_duration_secs = 86400; // Full day
|
||||
unsigned long _sleep_duration_secs = 0; // No off
|
||||
unsigned long _next_wake = 0;
|
||||
unsigned long _next_sleep = 0;
|
||||
unsigned long _last_valid_time_sync = 0;
|
||||
|
||||
public:
|
||||
virtual void syncTime() { _time_sync_needed = true; }
|
||||
virtual bool waitingTimeSync() { return _time_sync_needed; }
|
||||
virtual void stopTimeSync() { _time_sync_needed = false; }
|
||||
virtual void setGPSPowerSaving(bool enabled) { powersaving_enabled = enabled; _next_gps_off = 0; _next_gps_on = 0; }
|
||||
virtual bool getGPSPowerSaving() { return powersaving_enabled; }
|
||||
virtual void setNextGPSOff(unsigned long _millis) { _next_gps_off = _millis; }
|
||||
virtual unsigned long getNextGPSOff() { return _next_gps_off; }
|
||||
virtual void setNextGPSOn(unsigned long _millis) { _next_gps_on = _millis; }
|
||||
virtual unsigned long getNextGPSOn() { return _next_gps_on; }
|
||||
|
||||
virtual void setPowerSavingProfile(unsigned long wake_duration_secs, unsigned long sleep_duration_secs) {
|
||||
_wake_duration_secs = wake_duration_secs;
|
||||
_sleep_duration_secs = sleep_duration_secs;
|
||||
}
|
||||
|
||||
virtual void enablePowerSaving(bool enabled) { powersaving_enabled = enabled; _next_wake = 0; _next_sleep = 0; }
|
||||
virtual bool isPowerSavingEnabled() { return powersaving_enabled; }
|
||||
virtual void setNextWake() { _next_wake = millis() + _sleep_duration_secs * 1000UL; }
|
||||
virtual unsigned long getNextWake() { return _next_wake; }
|
||||
virtual void setNextSleep() { _next_sleep = millis() + _wake_duration_secs * 1000UL; }
|
||||
virtual unsigned long getNextSleep() { return _next_sleep; }
|
||||
virtual unsigned long getLastValidTimeSync() { return _last_valid_time_sync; }
|
||||
|
||||
virtual long getLatitude() = 0;
|
||||
virtual long getLongitude() = 0;
|
||||
virtual long getAltitude() = 0;
|
||||
@@ -34,4 +44,6 @@ public:
|
||||
virtual void stop() = 0;
|
||||
virtual void loop() = 0;
|
||||
virtual bool isEnabled() = 0;
|
||||
virtual void setPinEn(int pin_en) = 0;
|
||||
virtual int getPinEn() = 0;
|
||||
};
|
||||
@@ -111,6 +111,14 @@ public :
|
||||
}
|
||||
}
|
||||
|
||||
void setPinEn(int pin_en) override {
|
||||
_pin_en = pin_en;
|
||||
}
|
||||
|
||||
int getPinEn() override {
|
||||
return _pin_en;
|
||||
}
|
||||
|
||||
void syncTime() override { nmea.clear(); LocationProvider::syncTime(); }
|
||||
long getLatitude() override { return nmea.getLatitude(); }
|
||||
long getLongitude() override { return nmea.getLongitude(); }
|
||||
|
||||
@@ -11,7 +11,22 @@ bool SH1106Display::i2c_probe(TwoWire &wire, uint8_t addr)
|
||||
|
||||
bool SH1106Display::begin()
|
||||
{
|
||||
return display.begin(DISPLAY_ADDRESS, true) && i2c_probe(Wire, DISPLAY_ADDRESS);
|
||||
// Wire must already be initialised by board.begin() before this is called.
|
||||
// Boards with non-standard SH1106 addresses should define DISPLAY_ADDRESS
|
||||
// in their variant/platformio configuration. Some board revisions may have
|
||||
// different solder-bridge address configurations, so variants can also
|
||||
// provide DISPLAY_ADDRESS_ALT as a fallback.
|
||||
if (i2c_probe(Wire, DISPLAY_ADDRESS) && display.begin(DISPLAY_ADDRESS, true)) {
|
||||
return true;
|
||||
}
|
||||
#ifdef DISPLAY_ADDRESS_ALT
|
||||
if (DISPLAY_ADDRESS_ALT != DISPLAY_ADDRESS &&
|
||||
i2c_probe(Wire, DISPLAY_ADDRESS_ALT) &&
|
||||
display.begin(DISPLAY_ADDRESS_ALT, true)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void SH1106Display::turnOn()
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "ST7789LCDDisplay.h"
|
||||
|
||||
#ifndef PIN_TFT_MISO
|
||||
#define PIN_TFT_MISO -1
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_ROTATION
|
||||
#define DISPLAY_ROTATION 3
|
||||
#endif
|
||||
@@ -29,8 +33,8 @@ bool ST7789LCDDisplay::begin() {
|
||||
}
|
||||
|
||||
// Im not sure if this is just a t-deck problem or not, if your display is slow try this.
|
||||
#if defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT)
|
||||
displaySPI.begin(PIN_TFT_SCL, -1, PIN_TFT_SDA, PIN_TFT_CS);
|
||||
#if defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT) || defined(HELTEC_V4_R8_TFT)
|
||||
displaySPI.begin(PIN_TFT_SCL, PIN_TFT_MISO, PIN_TFT_SDA, PIN_TFT_CS);
|
||||
#endif
|
||||
|
||||
display.init(DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <helpers/RefCountedDigitalPin.h>
|
||||
|
||||
class ST7789LCDDisplay : public DisplayDriver {
|
||||
#if defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT)
|
||||
#if defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT) || defined(HELTEC_V4_R8_TFT)
|
||||
SPIClass displaySPI;
|
||||
#endif
|
||||
Adafruit_ST7789 display;
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
{
|
||||
_isOn = false;
|
||||
}
|
||||
#elif defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT)
|
||||
#elif defined(LILYGO_TDECK) || defined(HELTEC_LORA_V4_TFT) || defined(HELTEC_V4_R8_TFT)
|
||||
ST7789LCDDisplay(RefCountedDigitalPin* peripher_power=NULL) : DisplayDriver(128, 64),
|
||||
displaySPI(HSPI),
|
||||
display(&displaySPI, PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_RST),
|
||||
|
||||
@@ -31,13 +31,28 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
void SolarSensorManager::start_gps() {
|
||||
if (!gps_active) {
|
||||
gps_active = true;
|
||||
|
||||
if (powersaving_enabled && _location->isPowerSavingEnabled()) {
|
||||
gps_wake = true; // gps_active is true
|
||||
_location->syncTime(); // Clear GPS data and force sync time
|
||||
_location->setNextSleep(); // Next time to off
|
||||
}
|
||||
|
||||
_location->begin();
|
||||
}
|
||||
}
|
||||
|
||||
void SolarSensorManager::stop_gps() {
|
||||
if (gps_active) {
|
||||
gps_active = false;
|
||||
if (powersaving_enabled && _location->isPowerSavingEnabled()) {
|
||||
gps_wake = false; // gps_active is unchanged (true) even the GPS sleep (e.g: off)
|
||||
_location->stopTimeSync(); // Stop time sync
|
||||
_location->setNextWake(); // Next time to on
|
||||
} else {
|
||||
gps_active = false;
|
||||
gps_wake = false; // When GPS is off, wake is false to be sure
|
||||
}
|
||||
|
||||
_location->stop();
|
||||
}
|
||||
}
|
||||
@@ -67,16 +82,49 @@ bool SolarSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP&
|
||||
void SolarSensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
|
||||
_location->loop();
|
||||
// PowerSaving
|
||||
if (powersaving_enabled) {
|
||||
if (gps_detected && _location->isPowerSavingEnabled()) {
|
||||
if (gps_wake && ((int32_t)(millis() - _location->getNextSleep()) >= 0 ||
|
||||
!_location->waitingTimeSync())) { // Time to off or GPS set
|
||||
if ((int32_t)(millis() - _location->getNextSleep()) >= 0) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS wake timeout. Enter sleep");
|
||||
} else if (!_location->waitingTimeSync()) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS set. Enter sleep early");
|
||||
}
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isValid()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||
stop_gps();
|
||||
} else if (!gps_wake && ((int32_t)(millis() - _location->getNextWake()) >= 0)) { // Time to on
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS sleep timeout. Wakeup.");
|
||||
|
||||
start_gps();
|
||||
} else if (!gps_wake && _location->waitingTimeSync()) { // On for "gps sync"
|
||||
POWERSAVING_DEBUG_PRINTLN("CLI gps sync. Wakeup");
|
||||
|
||||
start_gps();
|
||||
}
|
||||
}
|
||||
next_gps_update = millis() + 1000;
|
||||
}
|
||||
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
_location->loop();
|
||||
}
|
||||
|
||||
if ((int32_t)(millis() - next_gps_update) >= 0) {
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
if (_location->isValid()) {
|
||||
node_lat = ((double)_location->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_location->getLongitude()) / 1000000.;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f alt %f", node_lat, node_lon, node_altitude);
|
||||
}
|
||||
|
||||
// In powersaving mode, GPS is on and off. Only update data when GPS is on
|
||||
if (powersaving_enabled) next_gps_update = millis() + 1000;
|
||||
}
|
||||
|
||||
if (!powersaving_enabled) next_gps_update = millis() + 1000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,8 +146,16 @@ const char* SolarSensorManager::getSettingValue(int i) const {
|
||||
bool SolarSensorManager::setSettingValue(const char* name, const char* value) {
|
||||
if (gps_detected && strcmp(name, "gps") == 0) {
|
||||
if (strcmp(value, "0") == 0) {
|
||||
if (powersaving_enabled) {
|
||||
_location->enablePowerSaving(false);
|
||||
}
|
||||
|
||||
stop_gps();
|
||||
} else {
|
||||
if (powersaving_enabled) {
|
||||
_location->enablePowerSaving(true);
|
||||
}
|
||||
|
||||
start_gps();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
class SolarSensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
bool gps_detected = false;
|
||||
bool gps_wake = false; // In PowerSaving, gps_active can have gps_wake true or false
|
||||
LocationProvider* _location;
|
||||
|
||||
void start_gps();
|
||||
|
||||
@@ -69,6 +69,7 @@ build_flags =
|
||||
-D MAX_NEIGHBOURS=50
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D POWERSAVING_DEBUG=1
|
||||
|
||||
[env:Heltec_t096_repeater_bridge_rs232]
|
||||
extends = Heltec_t096
|
||||
@@ -126,7 +127,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${Heltec_t096.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -136,6 +136,7 @@ build_flags =
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D POWERSAVING_DEBUG=1
|
||||
build_src_filter = ${Heltec_t096.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
@@ -156,7 +157,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${Heltec_t096.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -99,7 +99,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${Heltec_t114.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D MAX_CONTACTS=350
|
||||
@@ -123,7 +122,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${Heltec_t114.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D MAX_CONTACTS=350
|
||||
@@ -172,6 +170,7 @@ build_flags =
|
||||
-D MAX_NEIGHBOURS=50
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D POWERSAVING_DEBUG=1
|
||||
|
||||
[env:Heltec_t114_repeater_bridge_rs232]
|
||||
extends = Heltec_t114
|
||||
@@ -212,7 +211,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${Heltec_t114_with_display.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -222,6 +220,7 @@ build_flags =
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D POWERSAVING_DEBUG=1
|
||||
build_src_filter = ${Heltec_t114_with_display.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
@@ -236,7 +235,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${Heltec_t114_with_display.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -46,13 +46,28 @@ void HWTSensorManager::start_gps() {
|
||||
if (!gps_active) {
|
||||
_location->begin(); // Claims periph_power via RefCountedDigitalPin
|
||||
gps_active = true;
|
||||
|
||||
if (powersaving_enabled && _location->isPowerSavingEnabled()) {
|
||||
gps_wake = true; // gps_active is true
|
||||
_location->syncTime(); // Clear GPS data and force sync time
|
||||
_location->setNextSleep(); // Next time to off
|
||||
}
|
||||
|
||||
Serial1.println("$CFGSYS,h35155*68"); // Configure GPS for all constellations
|
||||
}
|
||||
}
|
||||
|
||||
void HWTSensorManager::stop_gps() {
|
||||
if (gps_active) {
|
||||
gps_active = false;
|
||||
if (powersaving_enabled && _location->isPowerSavingEnabled()) {
|
||||
gps_wake = false; // gps_active is unchanged (true) even the GPS sleep (e.g: off)
|
||||
_location->stopTimeSync(); // Stop time sync
|
||||
_location->setNextWake(); // Next time to on
|
||||
} else {
|
||||
gps_active = false;
|
||||
gps_wake = false; // When GPS is off, wake is false to be sure
|
||||
}
|
||||
|
||||
_location->stop(); // Releases periph_power via RefCountedDigitalPin
|
||||
}
|
||||
}
|
||||
@@ -73,16 +88,49 @@ bool HWTSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& t
|
||||
void HWTSensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
|
||||
_location->loop();
|
||||
// PowerSaving
|
||||
if (powersaving_enabled) {
|
||||
if (_location->isPowerSavingEnabled()) {
|
||||
if (gps_wake && ((int32_t)(millis() - _location->getNextSleep()) >= 0 ||
|
||||
!_location->waitingTimeSync())) { // Time to off or GPS set
|
||||
if ((int32_t)(millis() - _location->getNextSleep()) >= 0) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS wake timeout. Enter sleep");
|
||||
} else if (!_location->waitingTimeSync()) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS set. Enter sleep early");
|
||||
}
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (gps_active && _location->isValid()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||
stop_gps();
|
||||
} else if (!gps_wake && ((int32_t)(millis() - _location->getNextWake()) >= 0)) { // Time to on
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS sleep timeout. Wakeup.");
|
||||
|
||||
start_gps();
|
||||
} else if (!gps_wake && _location->waitingTimeSync()) { // On for "gps sync"
|
||||
POWERSAVING_DEBUG_PRINTLN("CLI gps sync. Wakeup");
|
||||
|
||||
start_gps();
|
||||
}
|
||||
}
|
||||
next_gps_update = millis() + 1000;
|
||||
}
|
||||
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
_location->loop();
|
||||
}
|
||||
|
||||
if ((int32_t)(millis() - next_gps_update) >= 0) {
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
if (_location->isValid()) {
|
||||
node_lat = ((double)_location->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_location->getLongitude()) / 1000000.;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f alt %f", node_lat, node_lon, node_altitude);
|
||||
}
|
||||
|
||||
// In powersaving mode, GPS is on and off. Only update data when GPS is on
|
||||
if (powersaving_enabled) next_gps_update = millis() + 1000;
|
||||
}
|
||||
|
||||
if (!powersaving_enabled) next_gps_update = millis() + 1000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +148,16 @@ const char* HWTSensorManager::getSettingValue(int i) const {
|
||||
bool HWTSensorManager::setSettingValue(const char* name, const char* value) {
|
||||
if (strcmp(name, "gps") == 0) {
|
||||
if (strcmp(value, "0") == 0) {
|
||||
if (powersaving_enabled) {
|
||||
_location->enablePowerSaving(false);
|
||||
}
|
||||
|
||||
stop_gps();
|
||||
} else {
|
||||
if (powersaving_enabled) {
|
||||
_location->enablePowerSaving(true);
|
||||
}
|
||||
|
||||
start_gps();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
class HWTSensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
bool gps_wake = false; // In PowerSaving, gps_active can have gps_wake true or false
|
||||
LocationProvider * _location;
|
||||
|
||||
void start_gps();
|
||||
|
||||
@@ -136,7 +136,6 @@ lib_deps =
|
||||
extends = Heltec_tracker_v2
|
||||
build_flags =
|
||||
${Heltec_tracker_v2.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -156,7 +155,6 @@ lib_deps =
|
||||
extends = Heltec_tracker_v2
|
||||
build_flags =
|
||||
${Heltec_tracker_v2.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -186,7 +184,6 @@ platform_packages = framework-arduinoespressif32 @ symlink://D:/esp32-2.0.17
|
||||
extends = Heltec_tracker_v2
|
||||
build_flags =
|
||||
${Heltec_tracker_v2.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -184,7 +184,6 @@ lib_deps =
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -200,11 +199,20 @@ lib_deps =
|
||||
${heltec_v4_oled.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_companion_radio_usb_ps_femon]
|
||||
extends = env:heltec_v4_companion_radio_usb
|
||||
platform_packages = framework-arduinoespressif32 @ symlink://D:/esp32-2.0.17
|
||||
|
||||
[env:heltec_v4_companion_radio_usb_ps_femoff]
|
||||
extends = env:heltec_v4_companion_radio_usb_ps_femon
|
||||
build_flags =
|
||||
${env:heltec_v4_companion_radio_usb_ps_femon.build_flags}
|
||||
-D RADIO_FEM_RXGAIN=0 ; undefined (default on), 1=on, 0=off
|
||||
|
||||
[env:heltec_v4_companion_radio_ble]
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -239,7 +247,6 @@ build_flags =
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "HeltecV4R8Board.h"
|
||||
|
||||
void HeltecV4R8Board::begin() {
|
||||
ESP32Board::begin();
|
||||
|
||||
periph_power.begin();
|
||||
periph_power.claim(); // R8 VEXT also feeds the LoRa antenna boost rail.
|
||||
|
||||
loRaFEMControl.init();
|
||||
|
||||
#ifdef PIN_TOUCH_RST
|
||||
pinMode(PIN_TOUCH_RST, OUTPUT);
|
||||
digitalWrite(PIN_TOUCH_RST, HIGH);
|
||||
delay(10);
|
||||
digitalWrite(PIN_TOUCH_RST, LOW);
|
||||
delay(100);
|
||||
digitalWrite(PIN_TOUCH_RST, HIGH);
|
||||
#endif
|
||||
|
||||
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)) {
|
||||
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 HeltecV4R8Board::onBeforeTransmit(void) {
|
||||
digitalWrite(P_LORA_TX_LED, HIGH);
|
||||
loRaFEMControl.setTxModeEnable();
|
||||
}
|
||||
|
||||
void HeltecV4R8Board::onAfterTransmit(void) {
|
||||
digitalWrite(P_LORA_TX_LED, LOW);
|
||||
loRaFEMControl.setRxModeEnable();
|
||||
}
|
||||
|
||||
void HeltecV4R8Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) {
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||
|
||||
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);
|
||||
loRaFEMControl.setRxModeEnableWhenMCUSleep();
|
||||
|
||||
if (pin_wake_btn < 0) {
|
||||
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH);
|
||||
} else {
|
||||
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1) | (1L << pin_wake_btn), ESP_EXT1_WAKEUP_ANY_HIGH);
|
||||
}
|
||||
|
||||
if (secs > 0) {
|
||||
esp_sleep_enable_timer_wakeup(secs * 1000000);
|
||||
}
|
||||
|
||||
esp_deep_sleep_start();
|
||||
}
|
||||
|
||||
void HeltecV4R8Board::powerOff() {
|
||||
enterDeepSleep(0);
|
||||
}
|
||||
|
||||
uint16_t HeltecV4R8Board::getBattMilliVolts() {
|
||||
analogReadResolution(12);
|
||||
|
||||
uint32_t raw = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
raw += analogReadMilliVolts(PIN_VBAT_READ);
|
||||
}
|
||||
raw = raw / 8;
|
||||
|
||||
return (adc_mult * raw);
|
||||
}
|
||||
|
||||
const char* HeltecV4R8Board::getManufacturerName() const {
|
||||
#ifdef HELTEC_V4_R8_TFT
|
||||
return "Heltec V4 R8 TFT";
|
||||
#else
|
||||
return "Heltec V4 R8 OLED";
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <driver/rtc_io.h>
|
||||
#include <helpers/ESP32Board.h>
|
||||
#include <helpers/RefCountedDigitalPin.h>
|
||||
#include "LoRaFEMControl.h"
|
||||
|
||||
#ifndef ADC_MULTIPLIER
|
||||
#define ADC_MULTIPLIER (4.9f * 1.035f)
|
||||
#endif
|
||||
|
||||
class HeltecV4R8Board : public ESP32Board {
|
||||
protected:
|
||||
float adc_mult = ADC_MULTIPLIER;
|
||||
|
||||
public:
|
||||
RefCountedDigitalPin periph_power;
|
||||
LoRaFEMControl loRaFEMControl;
|
||||
|
||||
HeltecV4R8Board() : periph_power(PIN_VEXT_EN, PIN_VEXT_EN_ACTIVE) { }
|
||||
|
||||
void begin();
|
||||
void onBeforeTransmit(void) override;
|
||||
void onAfterTransmit(void) override;
|
||||
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1);
|
||||
void powerOff() override;
|
||||
uint16_t getBattMilliVolts() override;
|
||||
bool setAdcMultiplier(float multiplier) override {
|
||||
if (multiplier == 0.0f) {
|
||||
adc_mult = ADC_MULTIPLIER;
|
||||
} else {
|
||||
adc_mult = multiplier;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
float getAdcMultiplier() const override { return adc_mult; }
|
||||
const char* getManufacturerName() const override;
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "LoRaFEMControl.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <driver/rtc_io.h>
|
||||
#include <esp_sleep.h>
|
||||
|
||||
void LoRaFEMControl::init(void) {
|
||||
pinMode(P_LORA_PA_POWER, OUTPUT);
|
||||
digitalWrite(P_LORA_PA_POWER, HIGH);
|
||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_POWER);
|
||||
|
||||
esp_reset_reason_t reason = esp_reset_reason();
|
||||
if (reason != ESP_RST_DEEPSLEEP) {
|
||||
delay(1);
|
||||
}
|
||||
|
||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CSD);
|
||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CTX);
|
||||
|
||||
pinMode(P_LORA_KCT8103L_PA_CSD, OUTPUT);
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||
pinMode(P_LORA_KCT8103L_PA_CTX, OUTPUT);
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CTX, lna_enabled ? LOW : HIGH);
|
||||
}
|
||||
|
||||
void LoRaFEMControl::setSleepModeEnable(void) {
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CSD, LOW);
|
||||
}
|
||||
|
||||
void LoRaFEMControl::setTxModeEnable(void) {
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
||||
}
|
||||
|
||||
void LoRaFEMControl::setRxModeEnable(void) {
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CTX, lna_enabled ? LOW : HIGH);
|
||||
}
|
||||
|
||||
void LoRaFEMControl::setRxModeEnableWhenMCUSleep(void) {
|
||||
digitalWrite(P_LORA_PA_POWER, HIGH);
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER);
|
||||
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CSD);
|
||||
digitalWrite(P_LORA_KCT8103L_PA_CTX, lna_enabled ? LOW : HIGH);
|
||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CTX);
|
||||
}
|
||||
|
||||
void LoRaFEMControl::setLNAEnable(bool enabled) {
|
||||
lna_enabled = enabled;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
KCT8103L_PA,
|
||||
OTHER_FEM_TYPES
|
||||
} LoRaFEMType;
|
||||
|
||||
class LoRaFEMControl {
|
||||
public:
|
||||
LoRaFEMControl() { }
|
||||
virtual ~LoRaFEMControl() { }
|
||||
void init(void);
|
||||
void setSleepModeEnable(void);
|
||||
void setTxModeEnable(void);
|
||||
void setRxModeEnable(void);
|
||||
void setRxModeEnableWhenMCUSleep(void);
|
||||
void setLNAEnable(bool enabled);
|
||||
bool isLnaCanControl(void) { return true; }
|
||||
void setLnaCanControl(bool can_control) { }
|
||||
LoRaFEMType getFEMType(void) const { return KCT8103L_PA; }
|
||||
|
||||
private:
|
||||
bool lna_enabled = false;
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define USB_VID 0x303a
|
||||
#define USB_PID 0x1001
|
||||
|
||||
static const uint8_t TX = 43;
|
||||
static const uint8_t RX = 44;
|
||||
|
||||
static const uint8_t SDA = 17;
|
||||
static const uint8_t SCL = 18;
|
||||
|
||||
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;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,348 @@
|
||||
[Heltec_v4_r8]
|
||||
extends = esp32_base
|
||||
board = heltec_v4_r8
|
||||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
${sensor_base.build_flags}
|
||||
-I variants/heltec_v4_r8
|
||||
-D HELTEC_V4_R8
|
||||
-D USE_SX1262
|
||||
-D ESP32_CPU_FREQ=80
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D P_LORA_DIO_1=14
|
||||
-D P_LORA_NSS=8
|
||||
-D P_LORA_RESET=12
|
||||
-D P_LORA_BUSY=13
|
||||
-D P_LORA_SCLK=9
|
||||
-D P_LORA_MISO=11
|
||||
-D P_LORA_MOSI=10
|
||||
-D P_LORA_PA_POWER=7
|
||||
-D P_LORA_KCT8103L_PA_CSD=2
|
||||
-D P_LORA_KCT8103L_PA_CTX=5
|
||||
-D P_LORA_TX_LED=46
|
||||
-D PIN_USER_BTN=0
|
||||
-D PIN_VEXT_EN=40
|
||||
-D PIN_VEXT_EN_ACTIVE=LOW
|
||||
-D ADC_MULTIPLIER=5.0715f
|
||||
-D PIN_VBAT_READ=1
|
||||
-D LORA_TX_POWER=10
|
||||
-D MAX_LORA_TX_POWER=22
|
||||
-D SX126X_REGISTER_PATCH=1
|
||||
-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_GPS_RX=38
|
||||
-D PIN_GPS_TX=39
|
||||
-D PIN_GPS_EN=42
|
||||
-D PIN_GPS_EN_ACTIVE=LOW
|
||||
-D ENV_INCLUDE_GPS=1
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/heltec_v4_r8>
|
||||
+<helpers/sensors>
|
||||
lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
${sensor_base.lib_deps}
|
||||
|
||||
[heltec_v4_r8_oled]
|
||||
extends = Heltec_v4_r8
|
||||
build_flags =
|
||||
${Heltec_v4_r8.build_flags}
|
||||
-D HELTEC_V4_R8_OLED
|
||||
-D PIN_BOARD_SDA=17
|
||||
-D PIN_BOARD_SCL=18
|
||||
-D PIN_OLED_RESET=21
|
||||
build_src_filter = ${Heltec_v4_r8.build_src_filter}
|
||||
lib_deps = ${Heltec_v4_r8.lib_deps}
|
||||
|
||||
[heltec_v4_r8_tft]
|
||||
extends = Heltec_v4_r8
|
||||
build_flags =
|
||||
${Heltec_v4_r8.build_flags}
|
||||
-D HELTEC_V4_R8_TFT
|
||||
-D PIN_BOARD_SDA=17
|
||||
-D PIN_BOARD_SCL=18
|
||||
-D DISPLAY_SCALE_X=2.5
|
||||
-D DISPLAY_SCALE_Y=3.75
|
||||
-D PIN_TFT_RST=-1
|
||||
-D PIN_TFT_VDD_CTL=-1
|
||||
-D PIN_TFT_LEDA_CTL=44
|
||||
-D PIN_TFT_LEDA_CTL_ACTIVE=HIGH
|
||||
-D PIN_TFT_CS=47
|
||||
-D PIN_TFT_DC=48
|
||||
-D PIN_TFT_SCL=16
|
||||
-D PIN_TFT_SDA=15
|
||||
-D PIN_TFT_MISO=45
|
||||
-D PIN_BUZZER=4
|
||||
-D PIN_TOUCH_RST=21
|
||||
build_src_filter = ${Heltec_v4_r8.build_src_filter}
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
lib_deps =
|
||||
${Heltec_v4_r8.lib_deps}
|
||||
adafruit/Adafruit ST7735 and ST7789 Library @ ^1.11.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_v4_r8_repeater]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ADVERT_NAME='"Heltec R8 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
bakercp/CRC32 @ ^2.0.0
|
||||
|
||||
[env:heltec_v4_r8_room_server]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ADVERT_NAME='"Heltec R8 Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_room_server>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_v4_r8_terminal_chat]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<../examples/simple_secure_chat/main.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_companion_radio_usb]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ENABLE_USB_INTERFACE
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_companion_radio_ble]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_companion_radio_ble_ps]
|
||||
extends = env:heltec_v4_r8_companion_radio_ble
|
||||
platform_packages = framework-arduinoespressif32 @ symlink://D:/esp32-2.0.17
|
||||
|
||||
[env:heltec_v4_r8_companion_radio_wifi]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_sensor]
|
||||
extends = heltec_v4_r8_oled
|
||||
build_flags =
|
||||
${heltec_v4_r8_oled.build_flags}
|
||||
-D ADVERT_NAME='"Heltec R8 Sensor"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_sensor>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_oled.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_v4_r8_tft_repeater]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D ADVERT_NAME='"Heltec R8 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
bakercp/CRC32 @ ^2.0.0
|
||||
|
||||
[env:heltec_v4_r8_tft_room_server]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D ADVERT_NAME='"Heltec R8 Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
+<../examples/simple_room_server>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_v4_r8_tft_terminal_chat]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<../examples/simple_secure_chat/main.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_tft_companion_radio_usb]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D ENABLE_USB_INTERFACE
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_tft_companion_radio_ble]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_tft_companion_radio_wifi]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_v4_r8_tft_sensor]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_flags =
|
||||
${heltec_v4_r8_tft.build_flags}
|
||||
-D ADVERT_NAME='"Heltec R8 Sensor"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
+<../examples/simple_sensor>
|
||||
lib_deps =
|
||||
${heltec_v4_r8_tft.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_v4_r8_kiss_modem]
|
||||
extends = Heltec_v4_r8
|
||||
build_src_filter = ${Heltec_v4_r8.build_src_filter}
|
||||
+<../examples/kiss_modem/>
|
||||
|
||||
[env:heltec_v4_r8_tft_kiss_modem]
|
||||
extends = heltec_v4_r8_tft
|
||||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter}
|
||||
+<../examples/kiss_modem/>
|
||||
@@ -0,0 +1,45 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
|
||||
HeltecV4R8Board board;
|
||||
|
||||
#if defined(P_LORA_SCLK)
|
||||
static SPIClass spi;
|
||||
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 <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display(&board.periph_power);
|
||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||
#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
|
||||
}
|
||||
|
||||
mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <HeltecV4R8Board.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
#include <helpers/sensors/EnvironmentSensorManager.h>
|
||||
#ifdef DISPLAY_CLASS
|
||||
#ifdef HELTEC_V4_R8_OLED
|
||||
#include <helpers/ui/SSD1306Display.h>
|
||||
#elif defined(HELTEC_V4_R8_TFT)
|
||||
#include <helpers/ui/ST7789LCDDisplay.h>
|
||||
#endif
|
||||
#include <helpers/ui/MomentaryButton.h>
|
||||
#endif
|
||||
|
||||
extern HeltecV4R8Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern EnvironmentSensorManager sensors;
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern DISPLAY_CLASS display;
|
||||
extern MomentaryButton user_btn;
|
||||
#endif
|
||||
|
||||
bool radio_init();
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
@@ -18,6 +18,8 @@ build_flags =
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
-D DISPLAY_ADDRESS=0x3D
|
||||
-D DISPLAY_ADDRESS_ALT=0x3C
|
||||
-D LORA_TX_POWER=22
|
||||
-D P_LORA_TX_LED=6
|
||||
-D PIN_BOARD_SDA=17
|
||||
|
||||
@@ -7,6 +7,7 @@ build_flags = ${nrf52_base.build_flags}
|
||||
${sensor_base.build_flags}
|
||||
-I variants/rak3401
|
||||
-D RAK_3401
|
||||
-D RAK_BOARD
|
||||
; -D NRF52_POWER_MANAGEMENT
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
@@ -14,6 +15,9 @@ build_flags = ${nrf52_base.build_flags}
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX with SKY66122 FEM
|
||||
-D FORCE_GPS_ALIVE ; on RAK3401, gpsResetPin ends up = WB_IO2 (kills 3V3_S rail) or
|
||||
; pin 4 (= SX126X_RESET, holds radio in reset). stop_gps() must not run.
|
||||
-D PIN_GPS_EN=-1 ; -1 = no dedicated GPS enable pin (power is the shared 3V3_S rail), same as rak4631
|
||||
build_src_filter = ${nrf52_base.build_src_filter}
|
||||
+<../variants/rak3401>
|
||||
+<helpers/sensors>
|
||||
|
||||
@@ -188,8 +188,8 @@ static const uint8_t AREF = PIN_AREF;
|
||||
// Power is on the controllable 3V3_S rail
|
||||
#define PIN_GPS_PPS (17) // Pulse per second input from the GPS
|
||||
|
||||
#define PIN_GPS_RX PIN_SERIAL1_RX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_RX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_RX
|
||||
|
||||
#define PIN_GPS_1PPS PIN_GPS_PPS
|
||||
#define GPS_BAUD_RATE 9600
|
||||
|
||||
@@ -13,8 +13,7 @@ build_flags = ${nrf52_base.build_flags}
|
||||
; -D NRF52_POWER_MANAGEMENT
|
||||
-D PIN_BOARD_SCL=14
|
||||
-D PIN_BOARD_SDA=13
|
||||
-D PIN_GPS_TX=PIN_SERIAL1_RX
|
||||
-D PIN_GPS_RX=PIN_SERIAL1_TX
|
||||
; -D FORCE_GPS_ALIVE // Do not off WB_IO2 if we want to keep other sensor / IO slots on
|
||||
-D PIN_GPS_EN=-1
|
||||
-D PIN_OLED_RESET=-1
|
||||
-D USE_SX1262
|
||||
@@ -50,6 +49,7 @@ build_flags =
|
||||
-D MAX_NEIGHBOURS=50
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D POWERSAVING_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
@@ -122,7 +122,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${rak4631.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D PIN_USER_BTN=9
|
||||
-D PIN_USER_BTN_ANA=31
|
||||
@@ -144,7 +143,6 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 712704
|
||||
build_flags =
|
||||
${rak4631.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D PIN_USER_BTN=9
|
||||
-D PIN_USER_BTN_ANA=31
|
||||
@@ -152,10 +150,11 @@ build_flags =
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D POWERSAVING_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
|
||||
@@ -182,6 +182,9 @@ extern "C"
|
||||
#define EXTERNAL_FLASH_DEVICES IS25LP080D
|
||||
#define EXTERNAL_FLASH_USE_QSPI
|
||||
|
||||
#define PIN_GPS_RX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_RX
|
||||
|
||||
#define PIN_GPS_1PPS 17 //GPS PPS pin
|
||||
#define GPS_BAUD_RATE 9600
|
||||
#define GPS_ADDRESS 0x42 //i2c address for GPS
|
||||
|
||||
@@ -73,7 +73,6 @@ extends = t1000-e
|
||||
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${t1000-e.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -97,7 +96,6 @@ extends = t1000-e
|
||||
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${t1000-e.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
+74
-10
@@ -81,6 +81,13 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
|
||||
void T1000SensorManager::start_gps() {
|
||||
gps_active = true;
|
||||
|
||||
if (powersaving_enabled && _nmea->isPowerSavingEnabled()) {
|
||||
gps_wake = true; // gps_active is true
|
||||
_nmea->syncTime(); // Clear GPS data and force sync time
|
||||
_nmea->setNextSleep(); // Next time to off
|
||||
}
|
||||
|
||||
//_nmea->begin();
|
||||
// this init sequence should be better
|
||||
// comes from seeed examples and deals with all gps pins
|
||||
@@ -104,7 +111,15 @@ void T1000SensorManager::start_gps() {
|
||||
}
|
||||
|
||||
void T1000SensorManager::sleep_gps() {
|
||||
gps_active = false;
|
||||
if (powersaving_enabled && _nmea->isPowerSavingEnabled()) {
|
||||
gps_wake = false; // gps_active is unchanged (true) even the GPS sleep (e.g: off)
|
||||
_nmea->stopTimeSync(); // Stop time sync
|
||||
_nmea->setNextWake(); // Next time to on
|
||||
} else {
|
||||
gps_active = false;
|
||||
gps_wake = false; // When GPS is off, wake is false to be sure
|
||||
}
|
||||
|
||||
digitalWrite(GPS_VRTC_EN, HIGH);
|
||||
digitalWrite(GPS_EN, LOW);
|
||||
digitalWrite(GPS_RESET, HIGH);
|
||||
@@ -116,7 +131,15 @@ void T1000SensorManager::sleep_gps() {
|
||||
}
|
||||
|
||||
void T1000SensorManager::stop_gps() {
|
||||
gps_active = false;
|
||||
if (powersaving_enabled && _nmea->isPowerSavingEnabled()) {
|
||||
gps_wake = false; // gps_active is unchanged (true) even the GPS sleep (e.g: off)
|
||||
_nmea->stopTimeSync(); // Stop time sync
|
||||
_nmea->setNextWake(); // Next time to on
|
||||
} else {
|
||||
gps_active = false;
|
||||
gps_wake = false; // When GPS is off, wake is false to be sure
|
||||
}
|
||||
|
||||
digitalWrite(GPS_VRTC_EN, LOW);
|
||||
digitalWrite(GPS_EN, LOW);
|
||||
digitalWrite(GPS_RESET, HIGH);
|
||||
@@ -149,16 +172,49 @@ bool T1000SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP&
|
||||
void T1000SensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
|
||||
_nmea->loop();
|
||||
// PowerSaving
|
||||
if (powersaving_enabled) {
|
||||
if (_nmea->isPowerSavingEnabled()) {
|
||||
if (gps_wake && ((int32_t)(millis() - _nmea->getNextSleep()) >= 0 ||
|
||||
!_nmea->waitingTimeSync())) { // Time to off or GPS set
|
||||
if ((int32_t)(millis() - _nmea->getNextSleep()) >= 0) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS wake timeout. Enter sleep");
|
||||
} else if (!_nmea->waitingTimeSync()) {
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS set. Enter sleep early");
|
||||
}
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (gps_active && _nmea->isValid()) {
|
||||
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);
|
||||
stop_gps();
|
||||
} else if (!gps_wake && ((int32_t)(millis() - _nmea->getNextWake()) >= 0)) { // Time to on
|
||||
POWERSAVING_DEBUG_PRINTLN("GPS sleep timeout. Wakeup.");
|
||||
|
||||
start_gps();
|
||||
} else if (!gps_wake && _nmea->waitingTimeSync()) { // On for "gps sync"
|
||||
POWERSAVING_DEBUG_PRINTLN("CLI gps sync. Wakeup");
|
||||
|
||||
start_gps();
|
||||
}
|
||||
}
|
||||
next_gps_update = millis() + 1000;
|
||||
}
|
||||
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
_nmea->loop();
|
||||
}
|
||||
|
||||
if ((int32_t)(millis() - next_gps_update) >= 0) {
|
||||
if ((!powersaving_enabled && gps_active) || (powersaving_enabled && gps_wake)) {
|
||||
if (_nmea->isValid()) {
|
||||
node_lat = ((double)_nmea->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_nmea->getLongitude()) / 1000000.;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
|
||||
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||
MESH_DEBUG_PRINTLN("lat %f lon %f alt %f", node_lat, node_lon, node_altitude);
|
||||
}
|
||||
|
||||
// In powersaving mode, GPS is on and off. Only update data when GPS is on
|
||||
if (powersaving_enabled) next_gps_update = millis() + 1000;
|
||||
}
|
||||
|
||||
if (!powersaving_enabled) next_gps_update = millis() + 1000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,8 +232,16 @@ 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) {
|
||||
if (powersaving_enabled) {
|
||||
_nmea->enablePowerSaving(false);
|
||||
}
|
||||
|
||||
sleep_gps(); // sleep for faster fix !
|
||||
} else {
|
||||
if (powersaving_enabled) {
|
||||
_nmea->enablePowerSaving(true);
|
||||
}
|
||||
|
||||
start_gps();
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
class T1000SensorManager: public SensorManager {
|
||||
bool gps_active = false;
|
||||
bool gps_wake = false; // In PowerSaving, gps_active can have gps_wake true or false
|
||||
LocationProvider * _nmea;
|
||||
|
||||
void start_gps();
|
||||
|
||||
@@ -27,7 +27,7 @@ build_flags = ${nrf52_base.build_flags}
|
||||
-D P_LORA_TX_LED_ON=LOW
|
||||
-D LR11X0_DIO_AS_RF_SWITCH=true
|
||||
-D LR11X0_DIO3_TCXO_VOLTAGE=3.3
|
||||
-D MESH_DEBUG=1
|
||||
; -D MESH_DEBUG=1
|
||||
-D ENV_INCLUDE_GPS=1
|
||||
build_src_filter = ${nrf52_base.build_src_filter}
|
||||
+<helpers/*.cpp>
|
||||
@@ -75,7 +75,6 @@ extends = ThinkNode_M3
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${ThinkNode_M3.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -99,7 +98,6 @@ extends = ThinkNode_M3
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${ThinkNode_M3.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -87,7 +87,10 @@ void initVariant()
|
||||
|
||||
pinMode(PIN_GPS_POWER, OUTPUT);
|
||||
pinMode(PIN_GPS_EN, OUTPUT);
|
||||
pinMode(PIN_GPS_RESET, OUTPUT);
|
||||
// PIN_GPS_RESET (pin 25 / REINIT) is intentionally left floating (input).
|
||||
// Driving it HIGH holds the L76K silent, so it never streams NMEA and the
|
||||
// firmware reports "no GPS". Letting it float lets the module run.
|
||||
// See GPS_RESET (-1) in variant.h.
|
||||
|
||||
// Power on gps but in standby
|
||||
digitalWrite(PIN_GPS_EN, LOW);
|
||||
|
||||
@@ -97,7 +97,11 @@
|
||||
|
||||
#define PIN_GPS_POWER (14)
|
||||
#define PIN_GPS_EN (21) // STANDBY
|
||||
#define PIN_GPS_RESET (25) // REINIT
|
||||
#define PIN_GPS_RESET (25) // REINIT - must FLOAT; driving it (esp. HIGH) silences the L76K
|
||||
// The M6's L76K streams NMEA on its own and must not have its REINIT pin driven.
|
||||
// Tell the location provider there is no reset pin so it never touches pin 25
|
||||
// (driving it HIGH holds the module silent).
|
||||
#define GPS_RESET (-1)
|
||||
#define GPS_RESET_ACTIVE LOW
|
||||
#define GPS_EN_ACTIVE HIGH
|
||||
#define GPS_BAUDRATE 9600
|
||||
|
||||
@@ -48,8 +48,8 @@ build_flags =
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
-D MESH_DEBUG=1
|
||||
-D GPS_NMEA_DEBUG=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D GPS_NMEA_DEBUG=1
|
||||
build_src_filter = ${ThinkNode_M6.build_src_filter}
|
||||
+<../examples/simple_repeater/*.cpp>
|
||||
lib_deps =
|
||||
@@ -81,7 +81,7 @@ build_flags =
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
|
||||
-D QSPIFLASH=1
|
||||
|
||||
@@ -30,6 +30,8 @@ void initVariant() {
|
||||
digitalWrite(PIN_GPS_STANDBY, HIGH);
|
||||
pinMode(PIN_GPS_EN, OUTPUT);
|
||||
digitalWrite(PIN_GPS_EN, HIGH);
|
||||
pinMode(PIN_GPS_RESET, OUTPUT);
|
||||
digitalWrite(PIN_GPS_RESET, HIGH);
|
||||
// PIN_GPS_RESET (pin 29 / REINIT) is intentionally left floating (input).
|
||||
// Driving it HIGH holds the L76K silent, so it never streams NMEA and the
|
||||
// firmware reports "no GPS". Letting it float lets the module run.
|
||||
// See GPS_RESET (-1) in variant.h.
|
||||
}
|
||||
@@ -102,7 +102,11 @@
|
||||
#define PIN_GPS_RX (2)
|
||||
#define PIN_GPS_TX (3)
|
||||
#define PIN_GPS_EN (6) // EN
|
||||
#define PIN_GPS_RESET (29)
|
||||
#define PIN_GPS_RESET (29) // REINIT - must FLOAT; driving it (esp. HIGH) silences the L76K
|
||||
// The M6's L76K streams NMEA on its own and must not have its REINIT pin driven.
|
||||
// Tell the location provider there is no reset pin so it never touches pin 29
|
||||
// (driving it HIGH holds the module silent).
|
||||
#define GPS_RESET (-1)
|
||||
#define PIN_GPS_STANDBY (30) // STANDBY
|
||||
#define PIN_GPS_PPS (31)
|
||||
#define GPS_BAUD_RATE 9600
|
||||
@@ -46,7 +46,6 @@ board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags =
|
||||
${Xiao_nrf52.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -70,7 +69,6 @@ board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags =
|
||||
${Xiao_nrf52.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-orig
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -94,7 +94,6 @@ lib_deps =
|
||||
extends = Xiao_S3
|
||||
build_flags =
|
||||
${Xiao_S3.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -123,7 +122,6 @@ platform_packages = framework-arduinoespressif32 @ symlink://D:/esp32-2.0.17
|
||||
extends = Xiao_S3
|
||||
build_flags =
|
||||
${Xiao_S3.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
@@ -132,7 +132,6 @@ lib_deps =
|
||||
extends = Xiao_S3_WIO
|
||||
build_flags =
|
||||
${Xiao_S3_WIO.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -155,7 +154,6 @@ lib_deps =
|
||||
extends = Xiao_S3_WIO
|
||||
build_flags =
|
||||
${Xiao_S3_WIO.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -184,7 +182,6 @@ platform_packages = framework-arduinoespressif32 @ symlink://D:/esp32-2.0.17
|
||||
extends = Xiao_S3_WIO
|
||||
build_flags =
|
||||
${Xiao_S3_WIO.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
@@ -213,7 +210,6 @@ build_src_filter = ${Xiao_S3_WIO.build_src_filter}
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
build_flags =
|
||||
${Xiao_S3_WIO.build_flags}
|
||||
${companion_rxps.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
|
||||
Reference in new issue
Block a user