Merge upstream/dev (80 commits) [upstream-sync]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
8d0b0dd164
140 files changed
+3573
-853
No files matched your search
@@ -106,6 +106,7 @@ build_flags = ${t1000-e.build_flags}
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D GPS_NMEA_DEBUG
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D PIN_BUZZER=25
|
||||
|
||||
+13
-25
@@ -1,8 +1,8 @@
|
||||
#include <Arduino.h>
|
||||
#include "t1000e_sensors.h"
|
||||
#include "target.h"
|
||||
#include <helpers/sensors/AirohaGpsDriver.h>
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
#include <helpers/sensors/AirohaSleep.h>
|
||||
|
||||
T1000eBoard board;
|
||||
|
||||
@@ -11,8 +11,9 @@ RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BU
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock rtc_clock;
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
T1000SensorManager sensors = T1000SensorManager(nmea);
|
||||
AirohaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
T1000SensorManager sensors(nmea, gps_driver);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
NullDisplayDriver display;
|
||||
@@ -81,20 +82,11 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
}
|
||||
|
||||
void T1000SensorManager::start_gps() {
|
||||
gps_active = true;
|
||||
digitalWrite(GPS_EN, HIGH);
|
||||
delay(10);
|
||||
digitalWrite(GPS_RTC_INT, HIGH);
|
||||
delay(5);
|
||||
digitalWrite(GPS_RTC_INT, LOW);
|
||||
_nmea->setGpsOn(true);
|
||||
}
|
||||
|
||||
void T1000SensorManager::stop_gps() {
|
||||
gps_active = false;
|
||||
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);
|
||||
_nmea->setGpsOn(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,8 +95,8 @@ 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.
|
||||
//
|
||||
// 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,
|
||||
// The off-state is stop_gps(), which (AirohaGpsDriver::stop() since the upstream
|
||||
// GPS refactor) 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() {
|
||||
@@ -112,7 +104,7 @@ void T1000SensorManager::gpsDutyLoop() {
|
||||
|
||||
// int32_t deltas, so the 49-day millis() wrap does not park GPS on (or off)
|
||||
// forever.
|
||||
if (!gps_active) {
|
||||
if (!_nmea->isGpsOn()) {
|
||||
if ((int32_t)(millis() - gps_wake_at) >= 0) {
|
||||
start_gps();
|
||||
_nmea->syncTime(); // clears the parser + arms the sync request
|
||||
@@ -134,11 +126,7 @@ void T1000SensorManager::gpsDutyLoop() {
|
||||
}
|
||||
|
||||
bool T1000SensorManager::begin() {
|
||||
// init GPS
|
||||
Serial1.begin(115200);
|
||||
digitalWrite(GPS_RESET, HIGH);
|
||||
delay(10);
|
||||
digitalWrite(GPS_RESET, LOW);
|
||||
_gps_driver->initialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -161,7 +149,7 @@ void T1000SensorManager::loop() {
|
||||
gpsDutyLoop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (gps_active && _nmea->isValid()) {
|
||||
if (_nmea->isGpsOn() && _nmea->hasValidFix()) {
|
||||
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
||||
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||
@@ -174,7 +162,7 @@ void T1000SensorManager::loop() {
|
||||
// with `gps on` the receiver is already up, and with `gps off` the user asked for
|
||||
// silence and a telemetry request must not override that.
|
||||
void T1000SensorManager::requestLocationRefresh() {
|
||||
if (gps_duty && !gps_active) {
|
||||
if (gps_duty && !_nmea->isGpsOn()) {
|
||||
gps_wake_at = millis();
|
||||
}
|
||||
}
|
||||
@@ -190,7 +178,7 @@ const char* T1000SensorManager::getSettingValue(int i) const {
|
||||
// between syncs is not the same thing as `gps off`, and something that
|
||||
// round-trips this value must not silently downgrade the mode.
|
||||
if (gps_duty) return "2";
|
||||
return gps_active ? "1" : "0";
|
||||
return _nmea->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
#include "NullDisplayDriver.h"
|
||||
#endif
|
||||
|
||||
class AirohaGpsDriver;
|
||||
|
||||
class T1000SensorManager: public SensorManager {
|
||||
bool gps_active = false;
|
||||
LocationProvider * _nmea;
|
||||
AirohaGpsDriver* _gps_driver;
|
||||
|
||||
// Duty-cycle state, mirroring EnvironmentSensorManager: `gps_duty` is the
|
||||
// MODE, `gps_active` stays the truth about the receiver's power right now.
|
||||
// MODE, the provider's isGpsOn() stays the truth about the receiver's power.
|
||||
// This board has its own manager, so the state machine cannot simply be
|
||||
// inherited -- see gpsDutyLoop() for the one T1000-specific difference.
|
||||
bool gps_duty = false;
|
||||
@@ -28,7 +30,8 @@ class T1000SensorManager: public SensorManager {
|
||||
void stop_gps();
|
||||
void gpsDutyLoop();
|
||||
public:
|
||||
T1000SensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
||||
T1000SensorManager(LocationProvider &nmea, AirohaGpsDriver& gps_driver)
|
||||
: _nmea(&nmea), _gps_driver(&gps_driver) { }
|
||||
bool begin() override;
|
||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||
void loop() override;
|
||||
|
||||
@@ -117,6 +117,8 @@
|
||||
#define GPS_RTC_INT (15) // P0.15
|
||||
#define GPS_RESETB (46) // P1.14
|
||||
|
||||
#define GPS_BAUDRATE 115200
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Temp+Lux Sensor
|
||||
|
||||
|
||||
Reference in new issue
Block a user