Skip to content

Commit ba6b853

Browse files
authored
Merge pull request #971 from fdlamotte/remove_set_setting_by_key
SensorManager: remove setSettingByKey
2 parents b59d199 + 90e2612 commit ba6b853

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
@@ -148,7 +148,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
148148

149149
#if ENV_INCLUDE_GPS == 1
150150
void applyGpsPrefs() {
151-
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
151+
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
152152
}
153153
#endif
154154

examples/simple_room_server/MyMesh.h

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

155155
#if ENV_INCLUDE_GPS == 1
156156
void applyGpsPrefs() {
157-
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
157+
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
158158
}
159159
#endif
160160

examples/simple_sensor/SensorMesh.h

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

157157
#if ENV_INCLUDE_GPS == 1
158158
void applyGpsPrefs() {
159-
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
159+
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
160160
}
161161
#endif
162162
};

src/helpers/CommonCLI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
547547
int num = mesh::Utils::parseTextParts(tmp, parts, 2, ' ');
548548
const char *key = (num > 0) ? parts[0] : "";
549549
const char *value = (num > 1) ? parts[1] : "null";
550-
if (_sensors->setSettingByKey(key, value)) {
550+
if (_sensors->setSettingValue(key, value)) {
551551
strcpy(reply, "ok");
552552
} else {
553553
strcpy(reply, "can't find custom var");
@@ -579,15 +579,15 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
579579
}
580580
#if ENV_INCLUDE_GPS == 1
581581
} else if (memcmp(command, "gps on", 6) == 0) {
582-
if (_sensors->setSettingByKey("gps", "1")) {
582+
if (_sensors->setSettingValue("gps", "1")) {
583583
_prefs->gps_enabled = 1;
584584
savePrefs();
585585
strcpy(reply, "ok");
586586
} else {
587587
strcpy(reply, "gps toggle not found");
588588
}
589589
} else if (memcmp(command, "gps off", 7) == 0) {
590-
if (_sensors->setSettingByKey("gps", "0")) {
590+
if (_sensors->setSettingValue("gps", "0")) {
591591
_prefs->gps_enabled = 0;
592592
savePrefs();
593593
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)