Skip to content

Commit 37dc715

Browse files
committed
SensorManager: remove setSettingByKey
1 parent f085a9d commit 37dc715

File tree

5 files changed

+6
-16
lines changed

5 files changed

+6
-16
lines changed

examples/simple_repeater/MyMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
137137

138138
#if ENV_INCLUDE_GPS == 1
139139
void applyGpsPrefs() {
140-
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
140+
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
141141
}
142142
#endif
143143

examples/simple_room_server/MyMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
151151

152152
#if ENV_INCLUDE_GPS == 1
153153
void applyGpsPrefs() {
154-
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
154+
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
155155
}
156156
#endif
157157

examples/simple_sensor/SensorMesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class SensorMesh : public mesh::Mesh, public CommonCLICallbacks {
151151

152152
#if ENV_INCLUDE_GPS == 1
153153
void applyGpsPrefs() {
154-
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
154+
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
155155
}
156156
#endif
157157
};

src/helpers/CommonCLI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
545545
int num = mesh::Utils::parseTextParts(tmp, parts, 2, ' ');
546546
const char *key = (num > 0) ? parts[0] : "";
547547
const char *value = (num > 1) ? parts[1] : "null";
548-
if (sensors.setSettingByKey(key, value)) {
548+
if (sensors.setSettingValue(key, value)) {
549549
strcpy(reply, "ok");
550550
} else {
551551
strcpy(reply, "can't find custom var");
@@ -577,15 +577,15 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
577577
}
578578
#if ENV_INCLUDE_GPS == 1
579579
} else if (memcmp(command, "gps on", 6) == 0) {
580-
if (sensors.setSettingByKey("gps", "1")) {
580+
if (sensors.setSettingValue("gps", "1")) {
581581
_prefs->gps_enabled = 1;
582582
savePrefs();
583583
strcpy(reply, "ok");
584584
} else {
585585
strcpy(reply, "gps toggle not found");
586586
}
587587
} else if (memcmp(command, "gps off", 7) == 0) {
588-
if (sensors.setSettingByKey("gps", "0")) {
588+
if (sensors.setSettingValue("gps", "0")) {
589589
_prefs->gps_enabled = 0;
590590
savePrefs();
591591
strcpy(reply, "ok");

src/helpers/SensorManager.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,4 @@ class SensorManager {
3434
}
3535
return NULL;
3636
}
37-
38-
bool setSettingByKey(const char* key, const char* value) {
39-
int num = getNumSettings();
40-
for (int i = 0; i < num; i++) {
41-
if (strcmp(getSettingName(i), key) == 0) {
42-
return setSettingValue(key, value);
43-
}
44-
}
45-
return false;
46-
}
4737
};

0 commit comments

Comments
 (0)