Sort save JSON on startup to make user editing less error-prone

This commit is contained in:
NGnius (Graham) 2022-07-09 16:38:35 -04:00
parent 8efb5c9907
commit 8e6d328710
2 changed files with 27 additions and 3 deletions

View file

@ -22,7 +22,7 @@ impl Settings {
impl From<SettingsJson> for Settings {
fn from(mut other: SettingsJson) -> Self {
match other.version {
let mut result = match other.version {
0 => Self {
version: 1,
enable: other.enable,
@ -65,7 +65,9 @@ impl From<SettingsJson> for Settings {
max: 100.0,
},
}
}
};
result.sort_curve();
result
}
}

View file

@ -1 +1,23 @@
{"version": 0, "enable": true, "interpolate": true, "curve": [{"x": 0.2740740740740741, "y": 0.815}, {"x": 0.725925925925926, "y": 0.665}, {"x": 0.9074074074074074, "y": 0.08}]}
{
"version": 1,
"enable": true,
"interpolate": true,
"curve": [
{
"x": 0.5074626865671642,
"y": 0.225
},
{
"x": 0.6902985074626866,
"y": 0.795
}
],
"fan_bounds": {
"min": 1.0,
"max": 7000.0
},
"temperature_bounds": {
"min": 0.0,
"max": 100.0
}
}