mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-15 21:20:03 +00:00
- gps: servers honour gps_enabled at boot (was lost on reboot; zc.gps_set upgrades older prefs to on once); sleep lock only while acquiring; gps off works on boards without a power line (UART sleep); UI toggles and fixes handled on the main thread; configure only after a good init; observer parks its GPS; one interval clamp (clampGpsInterval); one nav-mode knob (room servers on Air530Z now stationary); GNSS UARTE from DT - gps: split into ZephyrGPSManager / gps_power / gps_module_cfg (+gps_internal.h); dead driver branches, gps_get_diag, sats_* removed - clock: ZephyrRTCClock writes the hardware RTC itself (clkreboot now resets it); MESH_EVENT_RTC_SAVE gone - power: one power-off path (zephcore_power_off, ZephyrBoard::powerOff), poweroff/shutdown CLI, get pwrmgt.*, crash record kept across reboot, battery reading cached 10 s, fuel gauge on the current API - telemetry: upstream SensorManager + CayenneLPP (rounded to nearest), one builder for all roles; per-sensor channels, MCU temp always, guest gating and inverse mask on servers; sensor list/get/set work; BME280/BMP280 also probed at 0x77 - CLI: gps in upstream's form, get gps detail, gps sync
43 lines
1.6 KiB
C++
43 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <CayenneLPP.h>
|
|
// ZEPHCORE: no LocationProvider class -- the GPS manager is C
|
|
// (adapters/gps/ZephyrGPSManager.h). getLocationProvider() stays, returning
|
|
// NULL, so ported callers compile.
|
|
#include <string.h>
|
|
class LocationProvider;
|
|
|
|
#define TELEM_PERM_BASE 0x01 // 'base' permission includes battery
|
|
#define TELEM_PERM_LOCATION 0x02
|
|
#define TELEM_PERM_ENVIRONMENT 0x04 // permission to access environment sensors
|
|
|
|
#define TELEM_CHANNEL_SELF 1 // LPP data channel for 'self' device
|
|
|
|
class SensorManager {
|
|
public:
|
|
double node_lat, node_lon; // modify these, if you want to affect Advert location
|
|
double node_altitude; // altitude in meters
|
|
|
|
SensorManager() { node_lat = 0; node_lon = 0; node_altitude = 0; }
|
|
virtual bool begin() { return false; }
|
|
virtual bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) { return false; }
|
|
virtual void loop() { }
|
|
virtual int getNumSettings() const { return 0; }
|
|
virtual const char* getSettingName(int i) const { return NULL; }
|
|
virtual const char* getSettingValue(int i) const { return NULL; }
|
|
virtual bool setSettingValue(const char* name, const char* value) { return false; }
|
|
virtual LocationProvider* getLocationProvider() { return NULL; }
|
|
virtual bool isGPSDetected() const { return false; }
|
|
|
|
// Helper functions to manage setting by keys (useful in many places ...)
|
|
const char* getSettingByKey(const char* key) {
|
|
int num = getNumSettings();
|
|
for (int i = 0; i < num; i++) {
|
|
if (strcmp(getSettingName(i), key) == 0) {
|
|
return getSettingValue(i);
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
};
|