mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
refactor: more conditionals for GPS
also re-added some missing returns.
This commit is contained in:
parent
400c4353dc
commit
5987e95ce9
3 changed files with 19 additions and 6 deletions
|
|
@ -127,14 +127,16 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
|
||||||
|
|
||||||
int EnvironmentSensorManager::getNumSettings() const {
|
int EnvironmentSensorManager::getNumSettings() const {
|
||||||
#if ENV_INCLUDE_GPS
|
#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
|
#endif
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* EnvironmentSensorManager::getSettingName(int i) const {
|
const char* EnvironmentSensorManager::getSettingName(int i) const {
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
return (gps_detected && i == 0) ? "gps" : NULL;
|
return (gps_detected && i == 0) ? "gps" : NULL;
|
||||||
#endif
|
#endif
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* EnvironmentSensorManager::getSettingValue(int i) const {
|
const char* EnvironmentSensorManager::getSettingValue(int i) const {
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ protected:
|
||||||
bool INA3221_initialized = false;
|
bool INA3221_initialized = false;
|
||||||
bool INA219_initialized = false;
|
bool INA219_initialized = false;
|
||||||
|
|
||||||
LocationProvider* _location;
|
|
||||||
bool gps_detected = false;
|
bool gps_detected = false;
|
||||||
bool gps_active = false;
|
bool gps_active = false;
|
||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
|
LocationProvider* _location;
|
||||||
void start_gps();
|
void start_gps();
|
||||||
void stop_gps();
|
void stop_gps();
|
||||||
void initBasicGPS();
|
void initBasicGPS();
|
||||||
|
|
@ -48,7 +48,11 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
EnvironmentSensorManager(LocationProvider &location): _location(&location){};
|
EnvironmentSensorManager(LocationProvider &location): _location(&location){};
|
||||||
|
#else
|
||||||
|
EnvironmentSensorManager(){};
|
||||||
|
#endif
|
||||||
bool begin() override;
|
bool begin() override;
|
||||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
|
#endif
|
||||||
|
|
||||||
PromicroBoard board;
|
PromicroBoard board;
|
||||||
|
|
||||||
|
|
@ -11,8 +13,13 @@ WRAPPER_CLASS radio_driver(radio, board);
|
||||||
|
|
||||||
VolatileRTCClock fallback_clock;
|
VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
#if ENV_INCLUDE_GPS
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
||||||
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
|
#else
|
||||||
|
EnvironmentSensorManager sensors;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
DISPLAY_CLASS display;
|
DISPLAY_CLASS display;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue