mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 12:45:45 +00:00
refactor: more conditionals for GPS
also re-added some missing returns.
This commit is contained in:
@@ -127,14 +127,16 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
|
||||
|
||||
int EnvironmentSensorManager::getNumSettings() const {
|
||||
#if ENV_INCLUDE_GPS
|
||||
return gps_detected ? 1 : 0; // only show GPS setting if GPS is detected
|
||||
return gps_detected ? 1 : 0; // only show GPS setting if GPS is detected
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* EnvironmentSensorManager::getSettingName(int i) const {
|
||||
#if ENV_INCLUDE_GPS
|
||||
return (gps_detected && i == 0) ? "gps" : NULL;
|
||||
return (gps_detected && i == 0) ? "gps" : NULL;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* EnvironmentSensorManager::getSettingValue(int i) const {
|
||||
|
||||
@@ -36,11 +36,11 @@ protected:
|
||||
bool INA3221_initialized = false;
|
||||
bool INA219_initialized = false;
|
||||
|
||||
LocationProvider* _location;
|
||||
bool gps_detected = false;
|
||||
bool gps_active = false;
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
LocationProvider* _location;
|
||||
void start_gps();
|
||||
void stop_gps();
|
||||
void initBasicGPS();
|
||||
@@ -48,7 +48,11 @@ protected:
|
||||
|
||||
|
||||
public:
|
||||
#if ENV_INCLUDE_GPS
|
||||
EnvironmentSensorManager(LocationProvider &location): _location(&location){};
|
||||
#else
|
||||
EnvironmentSensorManager(){};
|
||||
#endif
|
||||
bool begin() override;
|
||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||
#if ENV_INCLUDE_GPS
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
|
||||
#if ENV_INCLUDE_GPS
|
||||
#endif
|
||||
|
||||
PromicroBoard board;
|
||||
|
||||
@@ -11,8 +13,13 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display;
|
||||
|
||||
Reference in New Issue
Block a user