Skip to content

Commit

Permalink
Merge pull request #482 from MartinMueller2003/main
Browse files Browse the repository at this point in the history
Cleaned up UI <->FS path to not include any string operations.
  • Loading branch information
forkineye committed Mar 7, 2022
2 parents 05d2983 + e88bd46 commit 60a8853
Show file tree
Hide file tree
Showing 32 changed files with 897 additions and 320 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Expand Up @@ -35,7 +35,7 @@ jobs:
- target: "esp32_ttgo_t8"
chip: "esp32"
# mh et esp32 mini kit
- target: "d1_mini_mhetesp32minikit"
- target: "esp32_wt32eth01"
chip: "esp32"

runs-on: ubuntu-latest
Expand Down
17 changes: 10 additions & 7 deletions .vscode/extensions.json
@@ -1,7 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
59 changes: 39 additions & 20 deletions ESPixelStick/ESPixelStick.ino
Expand Up @@ -255,34 +255,51 @@ bool deserializeCore (JsonObject & json)

// extern void PrettyPrint (JsonObject & jsonStuff, String Name);
// PrettyPrint (json, "Main Config");
JsonObject DeviceConfig;

do // once
{
if (json.containsKey(CN_cfgver))
// was this saved by the ESP itself
if (json.containsKey(CN_system))
{
DeviceConfig = json[CN_system];
}
// is this an initial config from the flash tool?
else if (json.containsKey(CN_init))
{
// trigger a save operation
ConfigSaveNeeded = true;
logcon(String(F("Processing Flash Tool config")));
DeviceConfig = json;
}
else
{
logcon(String(F("Could not find system config")));
ConfigSaveNeeded = true;
break;
}

if (DeviceConfig.containsKey(CN_cfgver))
{
uint8_t TempVersion = uint8_t(-1);
setFromJSON (TempVersion, json, CN_cfgver);
setFromJSON(TempVersion, DeviceConfig, CN_cfgver);
if (TempVersion != CurrentConfigVersion)
{
//TODO: Add configuration update handler
logcon (String (F ("Incorrect Config Version ID")));
// TODO: Add configuration update handler
logcon(String(F("Incorrect Config Version ID")));
}
}
else
{
logcon (String (F ("Missing Config Version ID")));
logcon(String(F("Missing Config Version ID")));
// break; // ignoring this error for now.
}

// is this an initial config from the flash tool?
if (json.containsKey (CN_init))
{
// trigger a save operation
ConfigSaveNeeded = true;
}

dsDevice (json);
FileMgr.SetConfig (json);
ConfigSaveNeeded |= NetworkMgr.SetConfig (json);
dsDevice(DeviceConfig);
FileMgr.SetConfig(DeviceConfig);
// DEBUG_V("");
ConfigSaveNeeded |= NetworkMgr.SetConfig(DeviceConfig);
// DEBUG_V("");
DataHasBeenAccepted = true;

} while (false);
Expand All @@ -309,11 +326,13 @@ void SaveConfig()

ConfigSaveNeeded = false;

// Save Config
String DataToSave = serializeCore (false);
// DEBUG_V ("ConfigFileName: " + ConfigFileName);
// DEBUG_V ("DataToSave: " + DataToSave);
FileMgr.SaveConfigFile(ConfigFileName, DataToSave);
// Create buffer and root object
DynamicJsonDocument jsonConfigDoc(2048);
JsonObject JsonConfig = jsonConfigDoc.createNestedObject(CN_system);

GetConfig(JsonConfig);

FileMgr.SaveConfigFile(ConfigFileName, jsonConfigDoc);

// DEBUG_END;
} // SaveConfig
Expand Down

0 comments on commit 60a8853

Please sign in to comment.