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

+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