2025-04-29 17:32:08 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#define RADIOLIB_STATIC_ONLY 1
|
|
|
|
|
#include <RadioLib.h>
|
2025-07-13 11:37:33 +02:00
|
|
|
#include <helpers/radiolib/RadioLibWrappers.h>
|
2025-09-03 20:17:55 +02:00
|
|
|
#include <ThinkNodeM1Board.h>
|
2025-07-13 11:37:33 +02:00
|
|
|
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
2025-04-29 17:32:08 +02:00
|
|
|
#include <helpers/AutoDiscoverRTCClock.h>
|
2025-05-03 15:42:10 +02:00
|
|
|
#include <helpers/SensorManager.h>
|
2025-05-27 21:38:48 -07:00
|
|
|
#include <helpers/sensors/LocationProvider.h>
|
2025-05-19 14:16:55 +10:00
|
|
|
#ifdef DISPLAY_CLASS
|
|
|
|
|
#include <helpers/ui/GxEPDDisplay.h>
|
2025-08-09 00:21:10 +12:00
|
|
|
#include <helpers/ui/MomentaryButton.h>
|
2025-05-19 14:16:55 +10:00
|
|
|
#endif
|
2025-04-29 17:32:08 +02:00
|
|
|
|
2025-05-27 21:38:48 -07:00
|
|
|
class ThinkNodeM1SensorManager : public SensorManager {
|
|
|
|
|
bool gps_active = false;
|
2025-05-27 23:24:08 -07:00
|
|
|
bool last_gps_switch_state = false;
|
2025-05-27 21:38:48 -07:00
|
|
|
LocationProvider* _location;
|
|
|
|
|
|
|
|
|
|
void start_gps();
|
|
|
|
|
void stop_gps();
|
|
|
|
|
public:
|
|
|
|
|
ThinkNodeM1SensorManager(LocationProvider &location): _location(&location) { }
|
|
|
|
|
bool begin() override;
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
2025-04-29 17:32:08 +02:00
|
|
|
extern ThinkNodeM1Board board;
|
|
|
|
|
extern WRAPPER_CLASS radio_driver;
|
|
|
|
|
extern AutoDiscoverRTCClock rtc_clock;
|
2025-05-27 21:38:48 -07:00
|
|
|
extern ThinkNodeM1SensorManager sensors;
|
2025-04-29 17:32:08 +02:00
|
|
|
|
2025-05-19 14:16:55 +10:00
|
|
|
#ifdef DISPLAY_CLASS
|
|
|
|
|
extern DISPLAY_CLASS display;
|
2025-08-09 00:21:10 +12:00
|
|
|
extern MomentaryButton user_btn;
|
2025-05-19 14:16:55 +10:00
|
|
|
#endif
|
|
|
|
|
|
2025-04-29 17:32:08 +02:00
|
|
|
bool radio_init();
|
|
|
|
|
uint32_t radio_get_rng_seed();
|
|
|
|
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
|
|
|
|
void radio_set_tx_power(uint8_t dbm);
|
|
|
|
|
mesh::LocalIdentity radio_new_identity();
|