Skip to content

Commit

Permalink
Merge pull request #6 from tobozo/1.2.5
Browse files Browse the repository at this point in the history
1.2.5
  • Loading branch information
tobozo authored Oct 15, 2022
2 parents 0add0f5 + e20e98a commit 90f7296
Show file tree
Hide file tree
Showing 5 changed files with 341 additions and 205 deletions.
11 changes: 5 additions & 6 deletions examples/ReadWriteConfigFile/ReadWriteConfigFile.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

const char* yaml_example_str = R"_YAML_STRING_(
my_setting: "false"
my_setting: false
flag1: "true"
flag2: "true"
flag1: true
flag2: true
settings1:
just_a_string: "I am a string"
Expand Down Expand Up @@ -59,7 +59,7 @@ bool loadYamlConfig()
return false;
}
myConfig = json_doc.as<JsonObject>();
current_value = myConfig[nodename].as<String>() == "true";
current_value = myConfig[nodename].as<bool>();
//serializeJson( myConfig, Serial );
//Serial.println();
return true;
Expand All @@ -86,8 +86,7 @@ bool toggleYamlProperty()
//Serial.printf("Initial value: [%s] = %s\n", nodename, current_value ? "true" : "false" );
current_value = !current_value;
Serial.printf("New value: [%s] = %s\n", nodename, current_value ? "true" : "false" );
// ArduinoJson @bool is borked up so we use a string
myConfig[nodename] = current_value ? "true" : "false";
myConfig[nodename] = current_value;
return saveYamlConfig();
}

Expand Down
Loading

0 comments on commit 90f7296

Please sign in to comment.