Skip to content

Commit b865ac6

Browse files
author
Scott Powell
committed
* refactored SensorManager::toggleGps()
1 parent 27388fc commit b865ac6

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

examples/companion_radio/UITask.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,18 @@ void UITask::handleButtonTriplePress() {
388388
void UITask::handleButtonQuadruplePress() {
389389
MESH_DEBUG_PRINTLN("UITask: quad press triggered");
390390
if (_sensors != NULL) {
391-
_sensors->toggleGps();
391+
// toggle GPS onn/off
392+
int num = _sensors->getNumSettings();
393+
for (int i = 0; i < num; i++) {
394+
if (strcmp(_sensors->getSettingName(i), "gps") == 0) {
395+
if (strcmp(_sensors->getSettingValue(i), "1") == 0) {
396+
_sensors->setSettingValue("gps", "0");
397+
} else {
398+
_sensors->setSettingValue("gps", "1");
399+
}
400+
break;
401+
}
402+
}
392403
}
393404
_need_refresh = true;
394405
}

src/helpers/SensorManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ class SensorManager {
2121
virtual const char* getSettingName(int i) const { return NULL; }
2222
virtual const char* getSettingValue(int i) const { return NULL; }
2323
virtual bool setSettingValue(const char* name, const char* value) { return false; }
24-
virtual bool getGpsStatus() { return false; }
25-
virtual bool toggleGps() { return false; }
2624
};

variants/t1000-e/target.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class T1000SensorManager: public SensorManager {
2828
const char* getSettingName(int i) const override;
2929
const char* getSettingValue(int i) const override;
3030
bool setSettingValue(const char* name, const char* value) override;
31-
bool getGpsStatus() override { return gps_active; }
32-
bool toggleGps() override { gps_active ? sleep_gps() : start_gps(); return gps_active; }
3331
};
3432

3533
#ifdef DISPLAY_CLASS

0 commit comments

Comments
 (0)