commit
822bea7b7c
97 files changed
+2404
-795
No files matched your search
@@ -26,9 +26,10 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#include <helpers/sensors/RakLocationProvider.h>
|
||||
RakI2cGpsDriver gps_driver;
|
||||
RakLocationProvider location(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors(location);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -27,7 +27,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -11,7 +11,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
SolarSensorManager sensors = SolarSensorManager(nmea);
|
||||
SolarExternalWatchdog external_watchdog;
|
||||
|
||||
@@ -30,17 +31,11 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
}
|
||||
|
||||
void SolarSensorManager::start_gps() {
|
||||
if (!gps_active) {
|
||||
gps_active = true;
|
||||
_location->begin();
|
||||
}
|
||||
_location->setGpsOn(true);
|
||||
}
|
||||
|
||||
void SolarSensorManager::stop_gps() {
|
||||
if (gps_active) {
|
||||
gps_active = false;
|
||||
_location->stop();
|
||||
}
|
||||
_location->setGpsOn(false);
|
||||
}
|
||||
|
||||
bool SolarSensorManager::begin() {
|
||||
@@ -71,7 +66,7 @@ void SolarSensorManager::loop() {
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
@@ -91,7 +86,7 @@ const char* SolarSensorManager::getSettingName(int i) const {
|
||||
|
||||
const char* SolarSensorManager::getSettingValue(int i) const {
|
||||
if (gps_detected && i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _location->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#endif
|
||||
|
||||
class SolarSensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
bool gps_detected = false;
|
||||
LocationProvider* _location;
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, PIN_GPS_RESET, PIN_GPS_EN);
|
||||
NmeaGpsDriver gps_driver(Serial1, PIN_GPS_TX, PIN_GPS_RX, PIN_GPS_RESET,
|
||||
PIN_GPS_EN);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -22,7 +22,9 @@ 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);
|
||||
NmeaGpsDriver gps_driver(Serial1, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN,
|
||||
&board.periph_power);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -21,7 +21,9 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power);
|
||||
NmeaGpsDriver gps_driver(Serial1, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN,
|
||||
&board.periph_power);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -22,7 +22,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -12,7 +12,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
TowerV2ExternalWatchdog external_watchdog;
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ build_flags =
|
||||
-D USE_PIN_TFT=1
|
||||
-D PIN_VEXT_EN=3 ; Vext is connected to VDD which is also connected to OLED & GPS
|
||||
-D PIN_TFT_LEDA_CTL=21 ; LEDK (switches on/off via mosfet to create the ground)
|
||||
-D PIN_GPS_RX=33
|
||||
-D PIN_GPS_TX=34
|
||||
-D PIN_GPS_TX=33 ; GPS module TX -> MCU RX (GPIO33)
|
||||
-D PIN_GPS_RX=34 ; GPS module RX <- MCU TX (GPIO34)
|
||||
-D PIN_GPS_EN=35 ; N-ch MOSFET Q2 drives P-ch high-side switch → active HIGH (default)
|
||||
-D PIN_GPS_RESET=36
|
||||
-D PIN_GPS_RESET_ACTIVE=LOW
|
||||
|
||||
@@ -17,7 +17,25 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
// GPS_EN (GPIO35) drives N-ch MOSFET → P-ch high-side switch; GPS_RESET (GPIO36) active LOW
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power);
|
||||
class HeltecTrackerGpsDriver : public NmeaGpsDriver {
|
||||
public:
|
||||
HeltecTrackerGpsDriver()
|
||||
: NmeaGpsDriver(Serial1, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN,
|
||||
&board.periph_power) {}
|
||||
|
||||
void reset() override {
|
||||
NmeaGpsDriver::reset();
|
||||
// Send configuration after reset
|
||||
if (isActive()) {
|
||||
delay(250);
|
||||
sendNmeaSentence("$CFGSYS,h35155*68");
|
||||
// TODO: remove active wait (250ms is a lot)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
HeltecTrackerGpsDriver gps_driver;
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
HWTSensorManager sensors = HWTSensorManager(nmea);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
@@ -43,23 +61,15 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
}
|
||||
|
||||
void HWTSensorManager::start_gps() {
|
||||
if (!gps_active) {
|
||||
_location->begin(); // Claims periph_power via RefCountedDigitalPin
|
||||
gps_active = true;
|
||||
Serial1.println("$CFGSYS,h35155*68"); // Configure GPS for all constellations
|
||||
}
|
||||
_location->setGpsOn(true);
|
||||
}
|
||||
|
||||
void HWTSensorManager::stop_gps() {
|
||||
if (gps_active) {
|
||||
gps_active = false;
|
||||
_location->stop(); // Releases periph_power via RefCountedDigitalPin
|
||||
}
|
||||
_location->setGpsOn(false);
|
||||
}
|
||||
|
||||
bool HWTSensorManager::begin() {
|
||||
// init GPS port
|
||||
Serial1.begin(115200, SERIAL_8N1, PIN_GPS_RX, PIN_GPS_TX);
|
||||
// the GPS UART (pins, baud rate) is now configured by gps_driver when the GPS is started
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -76,7 +86,7 @@ void HWTSensorManager::loop() {
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (gps_active && _location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
@@ -93,7 +103,7 @@ const char* HWTSensorManager::getSettingName(int i) const {
|
||||
}
|
||||
const char* HWTSensorManager::getSettingValue(int i) const {
|
||||
if (i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _location->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#endif
|
||||
|
||||
class HWTSensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
LocationProvider * _location;
|
||||
|
||||
void start_gps();
|
||||
|
||||
@@ -17,7 +17,9 @@ 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);
|
||||
NmeaGpsDriver gps_driver(Serial1, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN,
|
||||
&board.periph_power);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -43,4 +45,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -43,4 +44,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -43,4 +44,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ 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);
|
||||
NmeaGpsDriver gps_driver(Serial1, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN,
|
||||
&board.periph_power);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -12,7 +12,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -34,4 +35,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -34,4 +35,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -47,4 +48,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -38,4 +39,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -19,7 +19,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -35,4 +36,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider gps(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider gps(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors(gps);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -36,5 +37,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -35,4 +36,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ build_flags =
|
||||
-D SX126X_DIO2_AS_RF_SWITCH=false
|
||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D PIN_GPS_RX=12
|
||||
-D PIN_GPS_TX=15
|
||||
-D PIN_GPS_TX=12 ; GPS module TX -> MCU RX (GPIO12)
|
||||
-D PIN_GPS_RX=15 ; GPS module RX <- MCU TX (GPIO15)
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/meshadventurer>
|
||||
|
||||
@@ -11,7 +11,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
MASensorManager sensors = MASensorManager(nmea);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
@@ -37,23 +38,17 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
|
||||
|
||||
void MASensorManager::start_gps() {
|
||||
if(!gps_active) {
|
||||
MESH_DEBUG_PRINTLN("starting GPS");
|
||||
gps_active = true;
|
||||
}
|
||||
MESH_DEBUG_PRINTLN("starting GPS");
|
||||
_location->setGpsOn(true);
|
||||
}
|
||||
|
||||
void MASensorManager::stop_gps() {
|
||||
if(gps_active) {
|
||||
MESH_DEBUG_PRINTLN("stopping GPS");
|
||||
gps_active = false;
|
||||
}
|
||||
MESH_DEBUG_PRINTLN("stopping GPS");
|
||||
_location->setGpsOn(false);
|
||||
}
|
||||
|
||||
bool MASensorManager::begin() {
|
||||
Serial1.setPins(PIN_GPS_RX, PIN_GPS_TX);
|
||||
Serial1.begin(9600);
|
||||
delay(500);
|
||||
// the GPS UART (pins, baud rate) is now configured by gps_driver when the GPS is started
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -67,8 +62,8 @@ bool MASensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& te
|
||||
void MASensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
_location->loop();
|
||||
if(millis() > next_gps_update && gps_active) {
|
||||
if(_location->isValid()) {
|
||||
if(millis() > next_gps_update && _location->isGpsOn()) {
|
||||
if(_location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_location->getLongitude()) / 1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
@@ -85,7 +80,7 @@ const char* MASensorManager::getSettingName(int i) const {
|
||||
}
|
||||
const char* MASensorManager::getSettingValue(int i) const {
|
||||
if(i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _location->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
#endif
|
||||
|
||||
class MASensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
LocationProvider * _location;
|
||||
LocationProvider* _location;
|
||||
|
||||
void start_gps();
|
||||
void stop_gps();
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -70,4 +71,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#include <helpers/sensors/AirohaGpsDriver.h>
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
#include <helpers/sensors/AirohaSleep.h>
|
||||
|
||||
MeshTrackerX1Board board;
|
||||
|
||||
@@ -10,7 +10,8 @@ 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);
|
||||
AirohaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
MeshTrackerX1SensorManager sensors = MeshTrackerX1SensorManager(nmea);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
@@ -27,28 +28,16 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
}
|
||||
|
||||
void MeshTrackerX1SensorManager::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 MeshTrackerX1SensorManager::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);
|
||||
digitalWrite(GPS_EN, LOW);
|
||||
_nmea->setGpsOn(false);
|
||||
}
|
||||
|
||||
bool MeshTrackerX1SensorManager::begin() {
|
||||
// init GPS
|
||||
Serial1.begin(GPS_BAUD_RATE);
|
||||
digitalWrite(GPS_RESET, HIGH);
|
||||
delay(10);
|
||||
digitalWrite(GPS_RESET, LOW);
|
||||
gps_driver.initialize();
|
||||
|
||||
// init SPA06-003 barometer
|
||||
baro_ok = spa06.begin(SPA06_003_DEFAULT_ADDR, &Wire) || spa06.begin(0x76, &Wire);
|
||||
@@ -81,7 +70,7 @@ void MeshTrackerX1SensorManager::loop() {
|
||||
_nmea->loop();
|
||||
|
||||
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;
|
||||
@@ -97,7 +86,7 @@ const char* MeshTrackerX1SensorManager::getSettingName(int i) const {
|
||||
}
|
||||
const char* MeshTrackerX1SensorManager::getSettingValue(int i) const {
|
||||
if (i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _nmea->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
#endif
|
||||
|
||||
class MeshTrackerX1SensorManager: public SensorManager {
|
||||
bool gps_active = false;
|
||||
bool baro_ok = false;
|
||||
Adafruit_SPA06_003 spa06;
|
||||
LocationProvider * _nmea;
|
||||
|
||||
void start_gps();
|
||||
void sleep_gps();
|
||||
void stop_gps();
|
||||
public:
|
||||
MeshTrackerX1SensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
||||
|
||||
@@ -10,7 +10,8 @@ VolatileRTCClock rtc_clock;
|
||||
extern EnvironmentSensorManager sensors;
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
MuziBaseSensorManager sensors = MuziBaseSensorManager(nmea);
|
||||
#else
|
||||
MuziBaseSensorManager sensors;
|
||||
@@ -38,13 +39,7 @@ static void muziPowerOff() {
|
||||
|
||||
bool MuziBaseSensorManager::begin() {
|
||||
pwr_btn.begin();
|
||||
bool ok = EnvironmentSensorManager::begin();
|
||||
#if ENV_INCLUDE_GPS
|
||||
pinMode(PIN_GPS_SWITCH, INPUT);
|
||||
_last_gps_sw = digitalRead(PIN_GPS_SWITCH); // initial gps state from the switch
|
||||
if (_last_gps_sw == HIGH) start_gps(); else stop_gps();
|
||||
#endif
|
||||
return ok;
|
||||
return EnvironmentSensorManager::begin();
|
||||
}
|
||||
|
||||
void MuziBaseSensorManager::loop() {
|
||||
@@ -56,14 +51,15 @@ void MuziBaseSensorManager::loop() {
|
||||
if (++_pwr_clicks >= USER_BTN_POWER_OFF_CLICKS) muziPowerOff();
|
||||
}
|
||||
#if ENV_INCLUDE_GPS
|
||||
unsigned long now = millis();
|
||||
if (now > _next_sw_check) { // check the mode switch ~once a sec
|
||||
_next_sw_check = now + 1000;
|
||||
int sw = digitalRead(PIN_GPS_SWITCH);
|
||||
if (sw != _last_gps_sw) {
|
||||
_last_gps_sw = sw;
|
||||
if (sw == HIGH) start_gps(); else stop_gps();
|
||||
}
|
||||
// the ATGM336H keeps its nmea output config across power cycles (backup
|
||||
// supply), and other firmware may have turned every sentence off. re-enable
|
||||
// GGA + RMC after each power-up, once the module has booted.
|
||||
bool gps_on = _location->isActive();
|
||||
if (gps_on && !_gps_was_active) _gps_cfg_at = millis() + 1000;
|
||||
_gps_was_active = gps_on;
|
||||
if (_gps_cfg_at && gps_on && (long)(millis() - _gps_cfg_at) > 0) {
|
||||
_gps_cfg_at = 0;
|
||||
_location->sendSentence("$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0");
|
||||
}
|
||||
#endif
|
||||
EnvironmentSensorManager::loop();
|
||||
|
||||
@@ -38,13 +38,13 @@ extern AutoDiscoverRTCClock rtc_clock;
|
||||
|
||||
// muzi sensor manager, polled from main loop via sensors.loop():
|
||||
// - user button: USER_BTN_POWER_OFF_CLICKS quick presses -> power off (all builds)
|
||||
// - gps mode switch on/off (superIO only, see thinknode_m1)
|
||||
// gps mode is now handled by GpsDriver on superIO
|
||||
class MuziBaseSensorManager : public EnvironmentSensorManager {
|
||||
unsigned long _pwr_last_click = 0;
|
||||
uint8_t _pwr_clicks = 0;
|
||||
#if ENV_INCLUDE_GPS
|
||||
int _last_gps_sw = -1;
|
||||
unsigned long _next_sw_check = 0;
|
||||
unsigned long _gps_cfg_at = 0;
|
||||
bool _gps_was_active = false;
|
||||
#endif
|
||||
public:
|
||||
#if ENV_INCLUDE_GPS
|
||||
|
||||
@@ -54,8 +54,8 @@ static const uint8_t AREF = (PIN_AREF); // not used
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// UART pin definition
|
||||
|
||||
#define PIN_SERIAL1_RX (19) // P0.19 used for GPS RX
|
||||
#define PIN_SERIAL1_TX (20) // P0.20 used for GPS TX
|
||||
#define PIN_SERIAL1_RX (20) // P0.20, data from the gps
|
||||
#define PIN_SERIAL1_TX (19) // P0.19, data to the gps
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// I2C pin definition
|
||||
@@ -153,8 +153,8 @@ static const uint8_t AREF = (PIN_AREF); // not used
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// GPS
|
||||
#define HAS_GPS 1
|
||||
#define PIN_GPS_RX PIN_SERIAL1_RX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_RX // gps module's TX pin
|
||||
#define PIN_GPS_RX PIN_SERIAL1_TX // gps module's RX pin
|
||||
#define PIN_GPS_EN (32+1) // P1.01 PWR_IO2 on schematic. gps power, driven by the sensor manager.
|
||||
|
||||
// superIO 3-position mode switch (pins from the meshtastic muzi_base variant).
|
||||
@@ -162,6 +162,8 @@ static const uint8_t AREF = (PIN_AREF); // not used
|
||||
#define SWITCH_MODE1 (32+9) // P1.09
|
||||
#define SWITCH_MODE2 (12) // P0.12
|
||||
#define PIN_GPS_SWITCH SWITCH_MODE2
|
||||
#define GPS_SWITCH_IS_HARDWARE (0)
|
||||
#define GPS_SWITCH_TURNS_GPS_ON (1)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Buzzer
|
||||
|
||||
@@ -20,7 +20,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/sensors/NmeaGpsDriver.h>
|
||||
|
||||
class NanoG2UltraGpsDriver : public NmeaGpsDriver {
|
||||
public:
|
||||
NanoG2UltraGpsDriver(UART_TYPE& serial) : NmeaGpsDriver(serial) {
|
||||
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
||||
digitalWrite(PIN_GPS_STANDBY, LOW);
|
||||
}
|
||||
|
||||
void begin() override {
|
||||
if (isActive()) return;
|
||||
|
||||
digitalWrite(PIN_GPS_STANDBY, HIGH);
|
||||
NmeaGpsDriver::begin();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
void stop() override {
|
||||
NmeaGpsDriver::stop();
|
||||
digitalWrite(PIN_GPS_STANDBY, LOW);
|
||||
}
|
||||
|
||||
bool detectAtBoot() {
|
||||
begin();
|
||||
const bool wasActive = detect(0);
|
||||
if (!wasActive) stop();
|
||||
return wasActive;
|
||||
}
|
||||
};
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
#include "NanoG2UltraGpsDriver.h"
|
||||
|
||||
NanoG2Ultra board;
|
||||
|
||||
@@ -12,8 +13,10 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NanoG2UltraSensorManager sensors = NanoG2UltraSensorManager(nmea);
|
||||
// NanoG2UltraGpsDriver now handles the special init needed for NanoG2
|
||||
NanoG2UltraGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
NanoG2UltraSensorManager sensors = NanoG2UltraSensorManager(nmea, gps_driver);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display;
|
||||
@@ -27,35 +30,19 @@ bool radio_init() {
|
||||
|
||||
void NanoG2UltraSensorManager::start_gps() {
|
||||
MESH_DEBUG_PRINTLN("Starting GPS");
|
||||
if (!gps_active) {
|
||||
digitalWrite(PIN_GPS_STANDBY, HIGH); // Wake GPS from standby
|
||||
Serial1.setPins(PIN_GPS_TX, PIN_GPS_RX);
|
||||
Serial1.begin(9600);
|
||||
MESH_DEBUG_PRINTLN("Waiting for gps to power up");
|
||||
delay(1000);
|
||||
gps_active = true;
|
||||
}
|
||||
_location->begin();
|
||||
_location->setGpsOn(true);
|
||||
}
|
||||
|
||||
void NanoG2UltraSensorManager::stop_gps() {
|
||||
MESH_DEBUG_PRINTLN("Stopping GPS");
|
||||
if (gps_active) {
|
||||
digitalWrite(PIN_GPS_STANDBY, LOW); // sleep GPS
|
||||
gps_active = false;
|
||||
}
|
||||
_location->stop();
|
||||
_location->setGpsOn(false);
|
||||
}
|
||||
|
||||
bool NanoG2UltraSensorManager::begin() {
|
||||
digitalWrite(PIN_GPS_STANDBY, HIGH); // Wake GPS from standby
|
||||
Serial1.setPins(PIN_GPS_TX, PIN_GPS_RX);
|
||||
Serial1.begin(9600);
|
||||
MESH_DEBUG_PRINTLN("Checking GPS switch state");
|
||||
delay(1000);
|
||||
|
||||
// Check initial switch state to determine if GPS should be active
|
||||
if (Serial1.available() > 0) {
|
||||
if (_gps_driver->detectAtBoot()) {
|
||||
MESH_DEBUG_PRINTLN("GPS was on at boot, GPS enabled");
|
||||
start_gps();
|
||||
} else {
|
||||
@@ -75,14 +62,14 @@ bool NanoG2UltraSensorManager::querySensors(uint8_t requester_permissions, Cayen
|
||||
void NanoG2UltraSensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
|
||||
if (!gps_active) {
|
||||
if (!_location->isGpsOn()) {
|
||||
return; // GPS is not active, skip further processing
|
||||
}
|
||||
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_location->getLongitude()) / 1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
@@ -105,7 +92,7 @@ const char *NanoG2UltraSensorManager::getSettingName(int i) const {
|
||||
|
||||
const char *NanoG2UltraSensorManager::getSettingValue(int i) const {
|
||||
if (i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _location->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,18 @@
|
||||
#endif
|
||||
#include <helpers/sensors/LocationProvider.h>
|
||||
|
||||
class NanoG2UltraGpsDriver;
|
||||
|
||||
class NanoG2UltraSensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
LocationProvider *_location;
|
||||
NanoG2UltraGpsDriver *_gps_driver;
|
||||
|
||||
void start_gps();
|
||||
void stop_gps();
|
||||
|
||||
public:
|
||||
NanoG2UltraSensorManager(LocationProvider &location) : _location(&location) {}
|
||||
NanoG2UltraSensorManager(LocationProvider &location, NanoG2UltraGpsDriver &gps_driver)
|
||||
: _location(&location), _gps_driver(&gps_driver) {}
|
||||
bool begin() override;
|
||||
bool querySensors(uint8_t requester_permissions, CayenneLPP &telemetry) override;
|
||||
void loop() override;
|
||||
@@ -44,4 +47,3 @@ extern MomentaryButton user_btn;
|
||||
|
||||
bool radio_init();
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
|
||||
@@ -12,7 +12,13 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
#ifdef GPS_BAUD_PROBE_LIST // e.g. -D GPS_BAUD_PROBE_LIST=9600,38400,115200
|
||||
static const uint32_t gps_probe_bauds[] = { GPS_BAUD_PROBE_LIST };
|
||||
NmeaGpsDriver gps_driver(Serial1, gps_probe_bauds, sizeof(gps_probe_bauds) / sizeof(gps_probe_bauds[0]));
|
||||
#else
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
#endif
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -34,4 +40,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -43,4 +44,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -25,9 +25,10 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#include <helpers/sensors/RakLocationProvider.h>
|
||||
RakI2cGpsDriver gps_driver;
|
||||
RakLocationProvider location(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors(location);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
@@ -41,4 +42,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -55,6 +55,14 @@ build_src_filter = ${rak4631.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
|
||||
; Lets `gps off`, periodic mode and shutdown cut the power to a serial GPS (RAK12501).
|
||||
; WB_IO2 switches the shared 3V3_S slot rail, so this also powers down any other slot module.
|
||||
[env:RAK_4631_repeater_gps_power]
|
||||
extends = env:RAK_4631_repeater
|
||||
build_flags =
|
||||
${env:RAK_4631_repeater.build_flags}
|
||||
-D GPS_RAIL_POWER_CONTROL
|
||||
|
||||
[env:RAK_4631_repeater_ethernet]
|
||||
extends = rak4631
|
||||
build_flags =
|
||||
|
||||
@@ -25,9 +25,19 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#include <helpers/sensors/RakLocationProvider.h>
|
||||
RakI2cGpsDriver gps_driver;
|
||||
#ifdef GPS_RAIL_POWER_CONTROL
|
||||
#ifdef ETHERNET_ENABLED
|
||||
#error "GPS_RAIL_POWER_CONTROL would cut the RAK13800's power, which also comes from WB_IO2"
|
||||
#endif
|
||||
// WB_IO2 switches 3V3_S, which powers the serial GPS and every other slot module.
|
||||
RefCountedDigitalPin gps_rail(WB_IO2);
|
||||
RakLocationProvider location(gps_driver, &rtc_clock, Serial1, &gps_rail);
|
||||
#else
|
||||
RakLocationProvider location(gps_driver, &rtc_clock);
|
||||
#endif
|
||||
EnvironmentSensorManager sensors(location);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -37,4 +38,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ ESPNOWRadio radio_driver;
|
||||
|
||||
ESP32RTCClock rtc_clock;
|
||||
#if defined(ENV_INCLUDE_GPS)
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, (mesh::RTCClock*)&rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, (mesh::RTCClock*)&rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
|
||||
@@ -13,7 +13,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -29,4 +30,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -44,4 +45,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,29 +82,16 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
bool T1000SensorManager::begin() {
|
||||
// init GPS
|
||||
Serial1.begin(115200);
|
||||
digitalWrite(GPS_RESET, HIGH);
|
||||
delay(10);
|
||||
digitalWrite(GPS_RESET, LOW);
|
||||
_gps_driver->initialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -125,7 +113,7 @@ void T1000SensorManager::loop() {
|
||||
_nmea->loop();
|
||||
|
||||
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;
|
||||
@@ -141,7 +129,7 @@ const char* T1000SensorManager::getSettingName(int i) const {
|
||||
}
|
||||
const char* T1000SensorManager::getSettingValue(int i) const {
|
||||
if (i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _nmea->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -12,15 +12,18 @@
|
||||
#include "NullDisplayDriver.h"
|
||||
#endif
|
||||
|
||||
class AirohaGpsDriver;
|
||||
|
||||
class T1000SensorManager: public SensorManager {
|
||||
bool gps_active = false;
|
||||
LocationProvider * _nmea;
|
||||
AirohaGpsDriver* _gps_driver;
|
||||
|
||||
void start_gps();
|
||||
void sleep_gps();
|
||||
void stop_gps();
|
||||
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
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "target.h"
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
#include <helpers/sensors/NmeaGpsDriver.h>
|
||||
|
||||
ThinkNodeM1Board board;
|
||||
|
||||
@@ -11,7 +12,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(gps_driver, &rtc_clock);
|
||||
ThinkNodeM1SensorManager sensors = ThinkNodeM1SensorManager(nmea);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
@@ -31,34 +33,15 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
}
|
||||
|
||||
void ThinkNodeM1SensorManager::start_gps() {
|
||||
if (!gps_active) {
|
||||
gps_active = true;
|
||||
_location->begin();
|
||||
}
|
||||
_location->setGpsOn(true);
|
||||
}
|
||||
|
||||
void ThinkNodeM1SensorManager::stop_gps() {
|
||||
if (gps_active) {
|
||||
gps_active = false;
|
||||
_location->stop();
|
||||
}
|
||||
_location->setGpsOn(false);
|
||||
}
|
||||
|
||||
bool ThinkNodeM1SensorManager::begin() {
|
||||
Serial1.begin(9600);
|
||||
|
||||
// Initialize GPS switch pin
|
||||
pinMode(PIN_GPS_SWITCH, INPUT);
|
||||
last_gps_switch_state = digitalRead(PIN_GPS_SWITCH);
|
||||
|
||||
// Initialize GPS power pin
|
||||
pinMode(GPS_EN, OUTPUT);
|
||||
|
||||
// Check initial switch state to determine if GPS should be active
|
||||
if (last_gps_switch_state == HIGH) { // Switch is HIGH when ON
|
||||
start_gps();
|
||||
}
|
||||
|
||||
start_gps();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,36 +54,11 @@ bool ThinkNodeM1SensorManager::querySensors(uint8_t requester_permissions, Cayen
|
||||
|
||||
void ThinkNodeM1SensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
static long last_switch_check = 0;
|
||||
|
||||
// Check GPS switch state every second
|
||||
if (millis() - last_switch_check > 1000) {
|
||||
bool current_switch_state = digitalRead(PIN_GPS_SWITCH);
|
||||
|
||||
// Detect switch state change
|
||||
if (current_switch_state != last_gps_switch_state) {
|
||||
last_gps_switch_state = current_switch_state;
|
||||
|
||||
if (current_switch_state == HIGH) { // Switch is ON
|
||||
MESH_DEBUG_PRINTLN("GPS switch ON");
|
||||
start_gps();
|
||||
} else { // Switch is OFF
|
||||
MESH_DEBUG_PRINTLN("GPS switch OFF");
|
||||
stop_gps();
|
||||
}
|
||||
}
|
||||
|
||||
last_switch_check = millis();
|
||||
}
|
||||
|
||||
if (!gps_active) {
|
||||
return; // GPS is not active, skip further processing
|
||||
}
|
||||
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
@@ -120,7 +78,7 @@ const char* ThinkNodeM1SensorManager::getSettingName(int i) const {
|
||||
|
||||
const char* ThinkNodeM1SensorManager::getSettingValue(int i) const {
|
||||
if (i == 0) {
|
||||
return gps_active ? "1" : "0";
|
||||
return _location->isGpsOn() ? "1" : "0";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -136,4 +94,3 @@ bool ThinkNodeM1SensorManager::setSettingValue(const char* name, const char* val
|
||||
}
|
||||
return false; // not supported
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#endif
|
||||
|
||||
class ThinkNodeM1SensorManager : public SensorManager {
|
||||
bool gps_active = false;
|
||||
bool last_gps_switch_state = false;
|
||||
LocationProvider* _location;
|
||||
|
||||
void start_gps();
|
||||
@@ -45,4 +43,3 @@ extern ThinkNodeM1SensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
|
||||
@@ -146,3 +146,5 @@ extern const int SCK;
|
||||
#define PIN_GPS_PPS (36)
|
||||
#define PIN_GPS_STANDBY (34)
|
||||
#define PIN_GPS_SWITCH (33)
|
||||
#define GPS_SWITCH_IS_HARDWARE (0)
|
||||
#define GPS_SWITCH_TURNS_GPS_ON (1)
|
||||
@@ -11,7 +11,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
|
||||
@@ -11,7 +11,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
|
||||
@@ -17,7 +17,8 @@ ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -46,5 +47,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -25,4 +25,5 @@
|
||||
#define PIN_GPS_RESET (13)
|
||||
#define PIN_GPS_RX (20)
|
||||
#define PIN_GPS_TX (19)
|
||||
#define PIN_GPS_SWITCH (10)
|
||||
#define PIN_GPS_SWITCH (10)
|
||||
#define GPS_SWITCH_IS_HARDWARE (1)
|
||||
@@ -12,7 +12,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -32,4 +33,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -81,4 +82,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
|
||||
@@ -11,7 +11,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -37,4 +38,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#ifdef ENV_INCLUDE_GPS
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||
@@ -37,4 +38,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||
NmeaGpsDriver gps_driver(Serial1);
|
||||
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
@@ -39,4 +40,3 @@ mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user