t1000e: gps toggle not using board class

This commit is contained in:
Florent de Lamotte 2025-06-19 17:26:58 +02:00
parent 8765b3d040
commit 588a986976
8 changed files with 14 additions and 14 deletions

View file

@ -34,8 +34,9 @@ static const uint8_t meshcore_logo [] PROGMEM = {
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
};
void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs) {
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs) {
_display = display;
_sensors = sensors;
_auto_off = millis() + AUTO_OFF_MILLIS;
clearMsgPreview();
_node_prefs = node_prefs;
@ -386,7 +387,9 @@ void UITask::handleButtonTriplePress() {
void UITask::handleButtonQuadruplePress() {
MESH_DEBUG_PRINTLN("UITask: quad press triggered");
_board->toggleGps();
if (_sensors != NULL) {
_sensors->toggleGps();
}
_need_refresh = true;
}

View file

@ -2,6 +2,7 @@
#include <MeshCore.h>
#include <helpers/ui/DisplayDriver.h>
#include <helpers/SensorManager.h>
#include <stddef.h>
#ifdef PIN_BUZZER
@ -24,6 +25,7 @@
class UITask {
DisplayDriver* _display;
mesh::MainBoard* _board;
SensorManager* _sensors;
#ifdef PIN_BUZZER
genericBuzzer buzzer;
#endif
@ -59,12 +61,12 @@ class UITask {
public:
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) {
UITask(mesh::MainBoard* board) : _board(board), _display(NULL), _sensors(NULL) {
_next_refresh = 0;
ui_started_at = 0;
_connected = false;
}
void begin(DisplayDriver* display, NodePrefs* node_prefs);
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs);
void setHasConnection(bool connected) { _connected = connected; }
bool hasDisplay() const { return _display != NULL; }

View file

@ -186,7 +186,7 @@ void setup() {
sensors.begin();
#ifdef DISPLAY_CLASS
ui_task.begin(disp, the_mesh.getNodePrefs()); // still want to pass this in as dependency, as prefs might be moved
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs()); // still want to pass this in as dependency, as prefs might be moved
#endif
}

View file

@ -41,7 +41,6 @@ public:
virtual void onAfterTransmit() { }
virtual void reboot() = 0;
virtual void powerOff() { /* no op */ }
virtual bool toggleGps() { return false; } // could be a board_toggle depending on the board features ...
virtual uint8_t getStartupReason() const = 0;
virtual bool startOTAUpdate(const char* id, char reply[]) { return false; } // not supported
};

View file

@ -21,4 +21,6 @@ public:
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 bool getGpsStatus() { return false; }
virtual bool toggleGps() { return false; }
};

View file

@ -1,7 +1,6 @@
#include <Arduino.h>
#include "T1000eBoard.h"
#include <Wire.h>
#include "target.h"
#include <bluefruit.h>
@ -27,10 +26,6 @@ void T1000eBoard::begin() {
delay(10); // give sx1262 some time to power up
}
bool T1000eBoard::toggleGps() {
return sensors.toggle_gps();
}
#if 0
static BLEDfu bledfu;

View file

@ -66,8 +66,6 @@ public:
return 0;
}
virtual bool toggleGps() override;
void powerOff() override {
#ifdef HAS_GPS
digitalWrite(GPS_VRTC_EN, LOW);

View file

@ -28,7 +28,8 @@ public:
const char* getSettingName(int i) const override;
const char* getSettingValue(int i) const override;
bool setSettingValue(const char* name, const char* value) override;
bool toggle_gps() { gps_active ? stop_gps() : start_gps(); return gps_active;}
bool getGpsStatus() override { return gps_active; }
bool toggleGps() override { gps_active ? sleep_gps() : start_gps(); return gps_active; }
};
#ifdef DISPLAY_CLASS