Merge remote-tracking branch 'origin/dev'

Konflikty:
- ESP32Board.h: upstream obnovuje čas z RTC backupu přes všechny resety;
  záchytná hodnota je teď novější z FIRMWARE_BUILD_EPOCH (náš stamping)
  a RTC_TIME_MIN.
- t1000-e: upstream sloučil sleep_gps() do stop_gps() (drží VRTC + Airoha
  RTC backup sleep) ⇒ gps duty používá stop_gps(), sleep_gps() zrušen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-06 16:28:45 +02:00
commit f79ea79a13
23 files changed
+164 -120

No files matched your search

+6
View File
@@ -9,6 +9,12 @@
#define USE_LFXO
#define VARIANT_MCK (64000000ul)
// This board has no external RTC chip -- the ICM-42607-P IMU sits at 0x68,
// the same I2C address DS3231 probing checks, so without this the IMU gets
// misidentified as a DS3231 and its unrelated registers get read/written
// as if they were time/status registers, producing a bogus, unfixable clock.
#define DISABLE_DS3231_PROBE
////////////////////////////////////////////////////////////////////////////////
// Number of pins
+26 -5
View File
@@ -98,6 +98,32 @@ lib_deps =
${LilyGo_T-Echo-Lite.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_T-Echo-Lite_kiss_modem]
extends = LilyGo_T-Echo-Lite
build_src_filter = ${LilyGo_T-Echo-Lite.build_src_filter}
+<../examples/kiss_modem/>
[env:LilyGo_T-Echo-Lite_companion_radio_usb]
extends = LilyGo_T-Echo-Lite
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
board_upload.maximum_size = 712704
build_flags =
${LilyGo_T-Echo-Lite.build_flags}
-I src/helpers/ui
-I examples/companion_radio/ui-new
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D OFFLINE_QUEUE_SIZE=256
-D UI_RECENT_LIST_SIZE=9
-D UI_SENSORS_PAGE=1
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
; -D QSPIFLASH=1
build_src_filter = ${LilyGo_T-Echo-Lite.build_src_filter}
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${LilyGo_T-Echo-Lite.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_T-Echo-Lite_non_shell_companion_radio_ble]
extends = LilyGo_T-Echo-Lite
upload_protocol = nrfutil
@@ -187,8 +213,3 @@ build_src_filter = ${nrf52_base.build_src_filter}
lib_deps =
${LilyGo_T-Echo-Lite.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:LilyGo_T-Echo-Lite_kiss_modem]
extends = LilyGo_T-Echo-Lite
build_src_filter = ${LilyGo_T-Echo-Lite.build_src_filter}
+<../examples/kiss_modem/>
+3 -9
View File
@@ -70,9 +70,6 @@
#define PIN_QSPI_IO2 _PINNUM(1, 9)
#define PIN_QSPI_IO3 _PINNUM(0, 26)
#define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR
#define EXTERNAL_FLASH_USE_QSPI
////////////////////////////////////////////////////////////////////////////////
// Builtin LEDs
@@ -95,9 +92,6 @@
#define PIN_BUTTON2 _PINNUM(0, 18)
#define BUTTON_PIN2 PIN_BUTTON2
#define EXTERNAL_FLASH_DEVICES MX25R1635F
#define EXTERNAL_FLASH_USE_QSPI
////////////////////////////////////////////////////////////////////////////////
// Lora
@@ -154,8 +148,8 @@ extern const int SCK;
// GPS — per LilyGo t_echo_lite_config.h
// PIN_GPS_TX/RX named from GPS module's perspective
#define PIN_GPS_TX _PINNUM(0, 29) // GPS UART TX → MCU RX
#define PIN_GPS_RX _PINNUM(1, 10) // GPS UART RX ← MCU TX
#define PIN_GPS_RX _PINNUM(0, 29) // GPS UART TX → MCU RX
#define PIN_GPS_TX _PINNUM(1, 10) // GPS UART RX ← MCU TX
#define GPS_EN _PINNUM(1, 11) // GPS RT9080 power enable
#define PIN_GPS_STANDBY _PINNUM(1, 13) // GPS wake-up
#define PIN_GPS_PPS _PINNUM(1, 15) // GPS 1PPS
#define PIN_GPS_PPS _PINNUM(1, 15) // GPS 1PPS
+10 -28
View File
@@ -1,6 +1,7 @@
#include <Arduino.h>
#include "target.h"
#include <helpers/sensors/MicroNMEALocationProvider.h>
#include <helpers/sensors/AirohaSleep.h>
MeshTrackerX1Board board;
@@ -27,46 +28,27 @@ mesh::LocalIdentity radio_new_identity() {
void MeshTrackerX1SensorManager::start_gps() {
gps_active = true;
// this init sequence comes from seeed examples and deals with all gps pins
pinMode(GPS_EN, OUTPUT);
digitalWrite(GPS_EN, HIGH);
delay(10);
pinMode(GPS_VRTC_EN, OUTPUT);
digitalWrite(GPS_VRTC_EN, HIGH);
delay(10);
pinMode(GPS_RESET, OUTPUT);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
pinMode(GPS_SLEEP_INT, OUTPUT);
digitalWrite(GPS_SLEEP_INT, HIGH);
pinMode(GPS_RTC_INT, OUTPUT);
digitalWrite(GPS_RTC_INT, LOW);
}
void MeshTrackerX1SensorManager::sleep_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, HIGH); // keep RTC alive for faster fix on wake
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, LOW);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, HIGH);
delay(5);
digitalWrite(GPS_RTC_INT, LOW);
}
void MeshTrackerX1SensorManager::stop_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_VRTC_EN, HIGH); // keep GPS RTC alive for faster fix on wake
digitalWrite(GPS_RTC_INT, LOW); // make sure this is LOW so we can pulse it to wake
airohaEnterSleep(_nmea);
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, LOW);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, LOW);
}
bool MeshTrackerX1SensorManager::begin() {
// init GPS
Serial1.begin(GPS_BAUD_RATE);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
// init SPA06-003 barometer
baro_ok = spa06.begin(SPA06_003_DEFAULT_ADDR, &Wire) || spa06.begin(0x76, &Wire);
@@ -122,7 +104,7 @@ const char* MeshTrackerX1SensorManager::getSettingValue(int i) const {
bool MeshTrackerX1SensorManager::setSettingValue(const char* name, const char* value) {
if (strcmp(name, "gps") == 0) {
if (strcmp(value, "0") == 0) {
sleep_gps(); // sleep for faster fix !
stop_gps();
} else {
start_gps();
}
+2
View File
@@ -23,6 +23,7 @@ build_flags = ${nrf52_base.build_flags}
-D ENV_INCLUDE_BMP280=1
-D ENV_INCLUDE_INA3221=1
-D ENV_INCLUDE_INA219=1
-D ENV_INCLUDE_INA226=1
build_src_filter = ${nrf52_base.build_src_filter}
+<helpers/sensors>
+<../variants/promicro>
@@ -34,6 +35,7 @@ lib_deps= ${nrf52_base.lib_deps}
adafruit/Adafruit BME280 Library @ ^2.3.0
adafruit/Adafruit BMP280 Library@^2.6.8
stevemarple/MicroNMEA @ ^2.0.6
robtillaart/INA226@^0.6.6
[env:ProMicro_repeater]
extends = Promicro
-4
View File
@@ -69,10 +69,6 @@ public:
#ifdef PIN_3V3_ACC_EN
digitalWrite(PIN_3V3_ACC_EN, LOW);
#endif
#ifdef SENSOR_EN
digitalWrite(SENSOR_EN, LOW);
#endif
// set led on and wait for button release before poweroff
#ifdef LED_PIN
digitalWrite(LED_PIN, HIGH);
-4
View File
@@ -72,7 +72,6 @@ float t1000e_get_temperature(void) {
unsigned int ntc_v, vcc_v;
digitalWrite(PIN_3V3_EN, HIGH);
digitalWrite(SENSOR_EN, HIGH);
analogReference(AR_INTERNAL_3_0);
analogReadResolution(12);
delay(10);
@@ -80,7 +79,6 @@ float t1000e_get_temperature(void) {
vcc_v = (rail_v > NTC_REF_VCC) ? NTC_REF_VCC : rail_v;
ntc_v = (1000.0 * AREF_VOLTAGE * analogRead(TEMP_SENSOR)) / 4096;
digitalWrite(PIN_3V3_EN, LOW);
digitalWrite(SENSOR_EN, LOW);
return get_heater_temperature(vcc_v, ntc_v);
}
@@ -90,13 +88,11 @@ uint32_t t1000e_get_light(void) {
unsigned int lux_v = 0;
digitalWrite(PIN_3V3_EN, HIGH);
digitalWrite(SENSOR_EN, HIGH);
analogReference(AR_INTERNAL_3_0);
analogReadResolution(12);
delay(10);
lux_v = 1000 * analogRead(LUX_SENSOR) * AREF_VOLTAGE / 4096;
lux = get_light_lv(lux_v);
digitalWrite(SENSOR_EN, LOW);
digitalWrite(PIN_3V3_EN, LOW);
return lux;
+16 -45
View File
@@ -2,6 +2,7 @@
#include "t1000e_sensors.h"
#include "target.h"
#include <helpers/sensors/MicroNMEALocationProvider.h>
#include <helpers/sensors/AirohaSleep.h>
T1000eBoard board;
@@ -81,50 +82,19 @@ mesh::LocalIdentity radio_new_identity() {
void T1000SensorManager::start_gps() {
gps_active = true;
//_nmea->begin();
// this init sequence should be better
// comes from seeed examples and deals with all gps pins
pinMode(GPS_EN, OUTPUT);
digitalWrite(GPS_EN, HIGH);
delay(10);
pinMode(GPS_VRTC_EN, OUTPUT);
digitalWrite(GPS_VRTC_EN, HIGH);
delay(10);
pinMode(GPS_RESET, OUTPUT);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
pinMode(GPS_SLEEP_INT, OUTPUT);
digitalWrite(GPS_SLEEP_INT, HIGH);
pinMode(GPS_RTC_INT, OUTPUT);
digitalWrite(GPS_RTC_INT, HIGH);
delay(5);
digitalWrite(GPS_RTC_INT, LOW);
pinMode(GPS_RESETB, INPUT_PULLUP);
}
void T1000SensorManager::sleep_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, HIGH);
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, HIGH);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, LOW);
pinMode(GPS_RESETB, OUTPUT);
digitalWrite(GPS_RESETB, LOW);
//_nmea->stop();
}
void T1000SensorManager::stop_gps() {
gps_active = false;
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_VRTC_EN, HIGH); // keep GPS RTC alive for faster fix on wake
digitalWrite(GPS_RTC_INT, LOW); // make sure this is LOW so we can pulse it to wake
airohaEnterSleep(_nmea); // send command to put the GPS into RTC backup sleep
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, HIGH);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_RTC_INT, LOW);
pinMode(GPS_RESETB, OUTPUT);
digitalWrite(GPS_RESETB, LOW);
//_nmea->stop();
}
@@ -133,11 +103,10 @@ void T1000SensorManager::stop_gps() {
// biggest consumer on the node (46 mA measured), and a node that runs it only
// to keep its RTC set does not need a continuous fix.
//
// One deliberate difference from the environment manager: the off-state here is
// sleep_gps(), not stop_gps(). Sleep keeps GPS_VRTC_EN asserted, so the receiver
// retains its almanac and the next window gets a warm fix; stop cuts VRTC too and
// would buy a cold start every 30 minutes -- which is exactly what duty cycling
// is trying not to pay for.
// The off-state is stop_gps(), which (since upstream merged the old sleep_gps()
// into it) keeps GPS_VRTC_EN asserted and puts the AG3335 into RTC backup sleep,
// so the receiver retains its almanac and the next window gets a warm fix
// instead of a cold start every 30 minutes.
void T1000SensorManager::gpsDutyLoop() {
if (!gps_duty) return;
@@ -154,11 +123,11 @@ void T1000SensorManager::gpsDutyLoop() {
}
if (!_nmea->waitingTimeSync()) { // RTC got set -> nothing left to stay on for
sleep_gps();
stop_gps();
gps_wake_at = millis() + (uint32_t)GPS_DUTY_SYNC_INTERVAL_SECS * 1000;
MESH_DEBUG_PRINTLN("gps duty: synced, off for %d s", (int)GPS_DUTY_SYNC_INTERVAL_SECS);
} else if ((int32_t)(millis() - gps_awake_until) >= 0) {
sleep_gps();
stop_gps();
gps_wake_at = millis() + (uint32_t)GPS_DUTY_RETRY_SECS * 1000;
MESH_DEBUG_PRINTLN("gps duty: no fix in window, retry in %d s", (int)GPS_DUTY_RETRY_SECS);
}
@@ -167,6 +136,9 @@ void T1000SensorManager::gpsDutyLoop() {
bool T1000SensorManager::begin() {
// init GPS
Serial1.begin(115200);
digitalWrite(GPS_RESET, HIGH);
delay(10);
digitalWrite(GPS_RESET, LOW);
return true;
}
@@ -193,7 +165,6 @@ void T1000SensorManager::loop() {
node_lat = ((double)_nmea->getLatitude())/1000000.;
node_lon = ((double)_nmea->getLongitude())/1000000.;
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
//Serial.printf("lat %f lon %f\r\n", _lat, _lon);
}
next_gps_update = millis() + 1000;
}
@@ -227,7 +198,7 @@ bool T1000SensorManager::setSettingValue(const char* name, const char* value) {
if (strcmp(name, "gps") == 0) {
if (strcmp(value, "0") == 0) {
gps_duty = false;
sleep_gps(); // sleep for faster fix !
stop_gps(); // RTC backup sleep -> faster fix on wake
} else if (strcmp(value, "2") == 0) {
// Duty cycle: power up now (the clock is volatile, so the first sync is
// wanted immediately at boot) and let gpsDutyLoop() cut power once the
-1
View File
@@ -25,7 +25,6 @@ class T1000SensorManager: public SensorManager {
uint32_t gps_awake_until = 0; // millis the current attempt gives up at
void start_gps();
void sleep_gps();
void stop_gps();
void gpsDutyLoop();
public:
+4 -6
View File
@@ -14,7 +14,7 @@ const uint32_t g_ADigitalPinMap[PINS_COUNT + 1] =
1, // P0.01
2, // P0.02, AIN0 BATTERY_PIN
3, // P0.03
4, // P0.04, SENSOR_EN
4, // P0.04
5, // P0.05, EXT_PWR_DETEC
6, // P0.06, PIN_BUTTON1
7, // P0.07, LORA_BUSY
@@ -71,13 +71,12 @@ void initVariant()
pinMode(LUX_SENSOR, INPUT);
pinMode(EXT_CHRG_DETECT, INPUT);
pinMode(EXT_PWR_DETECT, INPUT);
pinMode(GPS_RESETB, INPUT);
pinMode(GPS_RESETB, INPUT_PULLUP);
pinMode(PIN_BUTTON1, INPUT);
pinMode(PIN_3V3_EN, OUTPUT);
pinMode(PIN_3V3_ACC_EN, OUTPUT);
pinMode(BUZZER_EN, OUTPUT);
pinMode(SENSOR_EN, OUTPUT);
pinMode(GPS_EN, OUTPUT);
pinMode(GPS_RESET, OUTPUT);
pinMode(GPS_VRTC_EN, OUTPUT);
@@ -88,11 +87,10 @@ void initVariant()
digitalWrite(PIN_3V3_EN, LOW);
digitalWrite(PIN_3V3_ACC_EN, LOW);
digitalWrite(BUZZER_EN, LOW);
digitalWrite(SENSOR_EN, LOW);
digitalWrite(GPS_EN, LOW);
digitalWrite(GPS_RESET, LOW);
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_SLEEP_INT, HIGH);
digitalWrite(GPS_VRTC_EN, HIGH);
digitalWrite(GPS_SLEEP_INT, LOW);
digitalWrite(GPS_RTC_INT, LOW);
digitalWrite(LED_PIN, LOW);
}
-1
View File
@@ -120,7 +120,6 @@
////////////////////////////////////////////////////////////////////////////////
// Temp+Lux Sensor
#define SENSOR_EN (4) // P0.4
#define TEMP_SENSOR (31) // P0.31/AIN7
#define LUX_SENSOR (29) // P0.29/AIN5