mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
t-beam supreme: fixes and cleanup
Reverted the SensorManager changes Moved BME into TbeamSupSensorManager Moved printBMEValues into TbeamSupSensorManager Moved scanDevices out of TBeamS3SupremeBoard
This commit is contained in:
parent
4990fe40e7
commit
4f503de743
4 changed files with 17 additions and 11 deletions
|
|
@ -10,10 +10,10 @@
|
||||||
|
|
||||||
class SensorManager {
|
class SensorManager {
|
||||||
public:
|
public:
|
||||||
double node_lat, node_lon, node_temp, node_hum, node_pres; // modify these, if you want to affect Advert location
|
double node_lat, node_lon; // modify these, if you want to affect Advert location
|
||||||
double node_altitude; // altitude in meters
|
double node_altitude; // altitude in meters
|
||||||
|
|
||||||
SensorManager() { node_lat = 0; node_lon = 0; node_altitude = 0; node_temp = 0; node_hum = 0; node_pres = 0;}
|
SensorManager() { node_lat = 0; node_lon = 0; node_altitude = 0;}
|
||||||
virtual bool begin() { return false; }
|
virtual bool begin() { return false; }
|
||||||
virtual bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) { return false; }
|
virtual bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) { return false; }
|
||||||
virtual void loop() { }
|
virtual void loop() { }
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,7 @@ class TBeamS3SupremeBoard : public ESP32Board {
|
||||||
XPowersAXP2101 PMU;
|
XPowersAXP2101 PMU;
|
||||||
public:
|
public:
|
||||||
#ifdef MESH_DEBUG
|
#ifdef MESH_DEBUG
|
||||||
void scanDevices(TwoWire *w);
|
|
||||||
void printPMU();
|
void printPMU();
|
||||||
void printBMEValues();
|
|
||||||
#endif
|
#endif
|
||||||
bool power_init();
|
bool power_init();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
#include <Adafruit_BME280.h>
|
|
||||||
|
|
||||||
TBeamS3SupremeBoard board;
|
TBeamS3SupremeBoard board;
|
||||||
|
|
||||||
|
|
@ -10,7 +9,6 @@ TBeamS3SupremeBoard board;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool pmuIntFlag;
|
bool pmuIntFlag;
|
||||||
//#define SEALEVELPRESSURE_HPA (1013.25)
|
|
||||||
|
|
||||||
#ifndef LORA_CR
|
#ifndef LORA_CR
|
||||||
#define LORA_CR 5
|
#define LORA_CR 5
|
||||||
|
|
@ -29,7 +27,6 @@ ESP32RTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
||||||
TbeamSupSensorManager sensors = TbeamSupSensorManager(nmea);
|
TbeamSupSensorManager sensors = TbeamSupSensorManager(nmea);
|
||||||
Adafruit_BME280 bme;
|
|
||||||
|
|
||||||
static void setPMUIntFlag(){
|
static void setPMUIntFlag(){
|
||||||
pmuIntFlag = true;
|
pmuIntFlag = true;
|
||||||
|
|
@ -114,7 +111,7 @@ void TBeamS3SupremeBoard::printPMU()
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
void printBMEValues() {
|
void TbeamSupSensorManager::printBMEValues() {
|
||||||
Serial.print("Temperature = ");
|
Serial.print("Temperature = ");
|
||||||
Serial.print(bme.readTemperature());
|
Serial.print(bme.readTemperature());
|
||||||
Serial.println(" *C");
|
Serial.println(" *C");
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,20 @@
|
||||||
#include <helpers/AutoDiscoverRTCClock.h>
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
#include <helpers/SensorManager.h>
|
#include <helpers/SensorManager.h>
|
||||||
#include <helpers/sensors/LocationProvider.h>
|
#include <helpers/sensors/LocationProvider.h>
|
||||||
|
#include <Adafruit_BME280.h>
|
||||||
|
|
||||||
class TbeamSupSensorManager: public SensorManager {
|
class TbeamSupSensorManager: public SensorManager {
|
||||||
bool gps_active = false;
|
bool gps_active = false;
|
||||||
LocationProvider * _nmea;
|
LocationProvider * _nmea;
|
||||||
|
Adafruit_BME280 bme;
|
||||||
|
double node_temp, node_hum, node_pres;
|
||||||
|
|
||||||
|
#define SEALEVELPRESSURE_HPA (1013.25)
|
||||||
|
|
||||||
void start_gps();
|
void start_gps();
|
||||||
void sleep_gps();
|
void sleep_gps();
|
||||||
public:
|
public:
|
||||||
TbeamSupSensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
TbeamSupSensorManager(LocationProvider &nmea): _nmea(&nmea) {node_temp = 0; node_hum = 0; node_pres = 0;}
|
||||||
bool begin() override;
|
bool begin() override;
|
||||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
|
|
@ -24,6 +29,11 @@ class TbeamSupSensorManager: public SensorManager {
|
||||||
const char* getSettingName(int i) const override;
|
const char* getSettingName(int i) const override;
|
||||||
const char* getSettingValue(int i) const override;
|
const char* getSettingValue(int i) const override;
|
||||||
bool setSettingValue(const char* name, const char* value) override;
|
bool setSettingValue(const char* name, const char* value) override;
|
||||||
|
|
||||||
|
#ifdef MESH_DEBUG
|
||||||
|
void printBMEValues();
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TBeamS3SupremeBoard board;
|
extern TBeamS3SupremeBoard board;
|
||||||
|
|
@ -53,7 +63,8 @@ enum {
|
||||||
OSC32768_ONLINE = _BV(13),
|
OSC32768_ONLINE = _BV(13),
|
||||||
};
|
};
|
||||||
|
|
||||||
bool power_init();
|
void scanDevices(TwoWire *w);
|
||||||
|
static bool l76kProbe();
|
||||||
bool radio_init();
|
bool radio_init();
|
||||||
uint32_t radio_get_rng_seed();
|
uint32_t radio_get_rng_seed();
|
||||||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue