Only commit Deck CPU & GPU frequency settings when no errors occur
This commit is contained in:
parent
2b94298e8c
commit
7acff88b14
6 changed files with 19 additions and 15 deletions
2
backend/Cargo.lock
generated
2
backend/Cargo.lock
generated
|
@ -826,7 +826,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "powertools"
|
||||
version = "1.2.0-beta2"
|
||||
version = "1.2.0-beta3"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"limits_core",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "powertools"
|
||||
version = "1.2.0-beta2"
|
||||
version = "1.2.0-beta3"
|
||||
edition = "2021"
|
||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||
description = "Backend (superuser) functionality for PowerTools"
|
||||
|
|
|
@ -302,7 +302,7 @@ impl Cpu {
|
|||
},
|
||||
).unwrap_or_else(|e| errors.push(e));
|
||||
}
|
||||
// commit changes
|
||||
|
||||
usdpl_back::api::files::write_single(CPU_CLOCK_LIMITS_PATH, "c\n")
|
||||
.unwrap_or_else(|e| {
|
||||
errors.push(SettingError {
|
||||
|
@ -310,9 +310,14 @@ impl Cpu {
|
|||
setting: crate::settings::SettingVariant::Cpu,
|
||||
});
|
||||
});
|
||||
|
||||
// commit changes (if no errors have already occured)
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
usdpl_back::api::files::write_single(CPU_CLOCK_LIMITS_PATH, "c\n").map_err(|e| {
|
||||
vec![SettingError {
|
||||
msg: format!("Failed to write `c` to `{}`: {}", CPU_CLOCK_LIMITS_PATH, e),
|
||||
setting: crate::settings::SettingVariant::Cpu,
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
Err(errors)
|
||||
}
|
||||
|
|
|
@ -139,15 +139,14 @@ impl Gpu {
|
|||
});
|
||||
self.set_clocks()
|
||||
.unwrap_or_else(|mut e| errors.append(&mut e));
|
||||
// commit changes
|
||||
// commit changes (if no errors have already occured)
|
||||
if errors.is_empty() {
|
||||
usdpl_back::api::files::write_single(GPU_CLOCK_LIMITS_PATH, "c\n").map_err(|e| {
|
||||
SettingError {
|
||||
vec![SettingError {
|
||||
msg: format!("Failed to write `c` to `{}`: {}", GPU_CLOCK_LIMITS_PATH, e),
|
||||
setting: crate::settings::SettingVariant::Gpu,
|
||||
}
|
||||
}).unwrap_or_else(|e| errors.push(e));
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
Err(errors)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "PowerTools",
|
||||
"version": "1.2.0-beta2",
|
||||
"version": "1.2.0-beta3",
|
||||
"description": "Power tweaks for power users",
|
||||
"scripts": {
|
||||
"build": "shx rm -rf dist && rollup -c",
|
||||
|
|
|
@ -299,7 +299,7 @@ export default definePlugin((serverApi: ServerAPI) => {
|
|||
periodicHook = null;
|
||||
lifetimeHook!.unregister();
|
||||
startHook!.unregister();
|
||||
serverApi.routerHook.removeRoute("/decky-plugin-test");
|
||||
//serverApi.routerHook.removeRoute("/decky-plugin-test");
|
||||
backend.log(backend.LogLevel.Debug, "Unregistered PowerTools callbacks, so long and thanks for all the fish.");
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue