Fixes: bugfixes in aura config loading

This commit is contained in:
Luke D. Jones
2023-08-26 21:34:02 +12:00
parent ea0eaef8a6
commit 423bd54f79
7 changed files with 25 additions and 23 deletions

View File

@@ -112,15 +112,17 @@ impl CtrlKbdLed {
LEDNode::None
};
let mut config_init = AuraConfig::default();
// New loads data fromt he DB also
let mut config_init = AuraConfig::new();
let mut config_loaded = config_init.clone().load();
// update the initialised data with what we loaded from disk
for mode in &mut config_init.builtins {
// update init values from loaded values if they exist
if let Some(loaded) = config_loaded.builtins.get(mode.0) {
*mode.1 = loaded.clone();
}
}
// Then replace just incase the initialised data contains new modes added
config_loaded.builtins = config_init.builtins;
if let (Some(mut multizone_init), Some(multizone_loaded)) =