Skip to content

Commit 90f7296

Browse files
authored
Merge pull request #6 from tobozo/1.2.5
1.2.5
2 parents 0add0f5 + e20e98a commit 90f7296

File tree

5 files changed

+341
-205
lines changed

5 files changed

+341
-205
lines changed

examples/ReadWriteConfigFile/ReadWriteConfigFile.ino

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
const char* yaml_example_str = R"_YAML_STRING_(
77
8-
my_setting: "false"
8+
my_setting: false
99
10-
flag1: "true"
11-
flag2: "true"
10+
flag1: true
11+
flag2: true
1212
1313
settings1:
1414
just_a_string: "I am a string"
@@ -59,7 +59,7 @@ bool loadYamlConfig()
5959
return false;
6060
}
6161
myConfig = json_doc.as<JsonObject>();
62-
current_value = myConfig[nodename].as<String>() == "true";
62+
current_value = myConfig[nodename].as<bool>();
6363
//serializeJson( myConfig, Serial );
6464
//Serial.println();
6565
return true;
@@ -86,8 +86,7 @@ bool toggleYamlProperty()
8686
//Serial.printf("Initial value: [%s] = %s\n", nodename, current_value ? "true" : "false" );
8787
current_value = !current_value;
8888
Serial.printf("New value: [%s] = %s\n", nodename, current_value ? "true" : "false" );
89-
// ArduinoJson @bool is borked up so we use a string
90-
myConfig[nodename] = current_value ? "true" : "false";
89+
myConfig[nodename] = current_value;
9190
return saveYamlConfig();
9291
}
9392

0 commit comments

Comments
 (0)