RAK4631: BME680 add and GPS cleanup

- Added the BME680 environment sensor functionality
- Added the GPS Repeater env for those wanting it
- Cleaned up the GPS and other RAK4631SensorManager code

Verified build and functionality on normal and GPS repeater and companion envs.

IAQ readout is still a work in progress, but a placeholder can be seen on Channel 2 of the app telemetry.
This commit is contained in:
cod3doomy
2025-06-24 17:46:01 -07:00
parent 213f01cd40
commit 001b996a24
3 changed files with 285 additions and 42 deletions

View File

@@ -11,6 +11,9 @@
#include <helpers/sensors/LocationProvider.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#endif
#if ENV_INCLUDE_BME680
#include "bsec2.h"
#endif
#ifdef DISPLAY_CLASS
#include <helpers/ui/SSD1306Display.h>
#endif
@@ -20,7 +23,7 @@
class RAK4631SensorManager: public SensorManager {
#if ENV_INCLUDE_GPS
bool gps_active = false;
bool gps_present = false;
bool gps_detected = false;
LocationProvider * _nmea;
SFE_UBLOX_GNSS ublox_GNSS;
uint32_t disStandbyPin = 0;
@@ -32,20 +35,26 @@ class RAK4631SensorManager: public SensorManager {
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) { }
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
void loop() 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;
#else
RAK4631SensorManager() { }
#endif
bool begin() override;
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;
@@ -75,6 +84,11 @@ enum {
RAK12500_ONLINE = _BV(14),
};
#if ENV_INCLUDE_BME680
void newDataCallback(const bme68xData data, const bsecOutputs outputs, Bsec2 bsec);
void checkBMEStatus(Bsec2 bsec);
#endif
bool radio_init();
uint32_t radio_get_rng_seed();
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);