Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/simple_repeater/MyMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {

#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_room_server/MyMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {

#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_sensor/SensorMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SensorMesh : public mesh::Mesh, public CommonCLICallbacks {

#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
sensors.setSettingByKey("gps", _prefs.gps_enabled?"1":"0");
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
}
#endif
};
6 changes: 3 additions & 3 deletions src/helpers/CommonCLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
int num = mesh::Utils::parseTextParts(tmp, parts, 2, ' ');
const char *key = (num > 0) ? parts[0] : "";
const char *value = (num > 1) ? parts[1] : "null";
if (sensors.setSettingByKey(key, value)) {
if (sensors.setSettingValue(key, value)) {
strcpy(reply, "ok");
} else {
strcpy(reply, "can't find custom var");
Expand Down Expand Up @@ -577,15 +577,15 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
}
#if ENV_INCLUDE_GPS == 1
} else if (memcmp(command, "gps on", 6) == 0) {
if (sensors.setSettingByKey("gps", "1")) {
if (sensors.setSettingValue("gps", "1")) {
_prefs->gps_enabled = 1;
savePrefs();
strcpy(reply, "ok");
} else {
strcpy(reply, "gps toggle not found");
}
} else if (memcmp(command, "gps off", 7) == 0) {
if (sensors.setSettingByKey("gps", "0")) {
if (sensors.setSettingValue("gps", "0")) {
_prefs->gps_enabled = 0;
savePrefs();
strcpy(reply, "ok");
Expand Down
10 changes: 0 additions & 10 deletions src/helpers/SensorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,4 @@ class SensorManager {
}
return NULL;
}

bool setSettingByKey(const char* key, const char* value) {
int num = getNumSettings();
for (int i = 0; i < num; i++) {
if (strcmp(getSettingName(i), key) == 0) {
return setSettingValue(key, value);
}
}
return false;
}
};