RAK4631 ESM Migration
Changes to migrate sensor code to the ESM. Added a separate GPS init sequence for the RAK that scans I2C and Serial1 on the various sockets of the various base boards to find the RAK12500. (and soon the RAK12501) Removed the GPS specific envs from platformio.ini and enabled GPS for all envs. Verified working with RAK12500 on RAK19007 sockets A and D, as well as RAK19003.
This commit is contained in:
@@ -6,80 +6,17 @@
|
||||
#include <RAK4631Board.h>
|
||||
#include <helpers/CustomSX1262Wrapper.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
#if ENV_INCLUDE_GPS
|
||||
#include <helpers/sensors/LocationProvider.h>
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
#endif
|
||||
#include <helpers/sensors/EnvironmentSensorManager.h>
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include <helpers/ui/SSD1306Display.h>
|
||||
extern DISPLAY_CLASS display;
|
||||
#endif
|
||||
|
||||
#define _BV(x) (1 << x)
|
||||
|
||||
class RAK4631SensorManager: public SensorManager {
|
||||
#if ENV_INCLUDE_GPS
|
||||
bool gps_active = false;
|
||||
bool gps_detected = false;
|
||||
LocationProvider * _nmea;
|
||||
SFE_UBLOX_GNSS ublox_GNSS;
|
||||
uint32_t disStandbyPin = 0;
|
||||
|
||||
void start_gps();
|
||||
void stop_gps();
|
||||
void sleep_gps();
|
||||
void wake_gps();
|
||||
bool gpsIsAwake(uint32_t ioPin);
|
||||
#endif
|
||||
|
||||
#if ENV_INCLUDE_BME680
|
||||
bool bme680_active = false;
|
||||
bool bme680_present = false;
|
||||
#define SAMPLING_RATE BSEC_SAMPLE_RATE_ULP
|
||||
#endif
|
||||
|
||||
public:
|
||||
#if ENV_INCLUDE_GPS
|
||||
RAK4631SensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
||||
#else
|
||||
RAK4631SensorManager() { }
|
||||
#endif
|
||||
|
||||
void loop() override;
|
||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||
int getNumSettings() const override;
|
||||
const char* getSettingName(int i) const override;
|
||||
const char* getSettingValue(int i) const override;
|
||||
bool setSettingValue(const char* name, const char* value) override;
|
||||
bool begin() override;
|
||||
};
|
||||
|
||||
extern RAK4631Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern RAK4631SensorManager sensors;
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern DISPLAY_CLASS display;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
POWERMANAGE_ONLINE = _BV(0),
|
||||
DISPLAY_ONLINE = _BV(1),
|
||||
RADIO_ONLINE = _BV(2),
|
||||
GPS_ONLINE = _BV(3),
|
||||
PSRAM_ONLINE = _BV(4),
|
||||
SDCARD_ONLINE = _BV(5),
|
||||
AXDL345_ONLINE = _BV(6),
|
||||
BME280_ONLINE = _BV(7),
|
||||
BMP280_ONLINE = _BV(8),
|
||||
BME680_ONLINE = _BV(9),
|
||||
QMC6310_ONLINE = _BV(10),
|
||||
QMI8658_ONLINE = _BV(11),
|
||||
PCF8563_ONLINE = _BV(12),
|
||||
OSC32768_ONLINE = _BV(13),
|
||||
RAK12500_ONLINE = _BV(14),
|
||||
};
|
||||
extern EnvironmentSensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
uint32_t radio_get_rng_seed();
|
||||
|
||||
Reference in New Issue
Block a user