diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 53a7aa6..4576e9a 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -826,7 +826,7 @@ dependencies = [ [[package]] name = "powertools-rs" -version = "1.1.0" +version = "1.1.0-beta4" dependencies = [ "async-trait", "limits_core", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 8bbfa40..d154972 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "powertools-rs" -version = "1.1.0" +version = "1.1.0-beta4" edition = "2021" authors = ["NGnius (Graham) "] description = "Backend (superuser) functionality for PowerTools" diff --git a/backend/src/api/handler.rs b/backend/src/api/handler.rs index 2b9cd60..48a4962 100644 --- a/backend/src/api/handler.rs +++ b/backend/src/api/handler.rs @@ -145,6 +145,7 @@ impl CpuMessage { matches!(self, Self::SetCpuOnline(_, _) | Self::SetCpusOnline(_) + | Self::SetSmt(_, _) | Self::SetClockLimits(_, _) | Self::SetCpuGovernor(_, _) | Self::SetCpusGovernor(_) diff --git a/backend/src/settings/steam_deck/cpu.rs b/backend/src/settings/steam_deck/cpu.rs index 2c3544a..539a5f4 100644 --- a/backend/src/settings/steam_deck/cpu.rs +++ b/backend/src/settings/steam_deck/cpu.rs @@ -256,7 +256,8 @@ impl Cpu { }, )?; // min clock - let payload_min = format!("p {} 0 {}\n", self.index / 2, clock_limits.min); + let valid_min = if clock_limits.min < self.limits.clock_min.min {self.limits.clock_min.min} else {clock_limits.min}; + let payload_min = format!("p {} 0 {}\n", self.index / 2, valid_min); usdpl_back::api::files::write_single(CPU_CLOCK_LIMITS_PATH, &payload_min).map_err( |e| SettingError { msg: format!( @@ -339,7 +340,7 @@ impl Cpu { fn limits(&self) -> crate::api::CpuLimits { crate::api::CpuLimits { clock_min_limits: Some(RangeLimit { - min: self.limits.clock_min.min, + min: self.limits.clock_max.min, // allows min to be set by max (it's weird, blame the kernel) max: self.limits.clock_min.max }), clock_max_limits: Some(RangeLimit { diff --git a/backend/src/settings/steam_deck/oc_limits.rs b/backend/src/settings/steam_deck/oc_limits.rs index fe45826..da5cefa 100644 --- a/backend/src/settings/steam_deck/oc_limits.rs +++ b/backend/src/settings/steam_deck/oc_limits.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::settings::MinMax; -const OC_LIMITS_FILEPATH: &str = "./pt_oc.json"; +const OC_LIMITS_FILEPATH: &str = "pt_oc.json"; #[derive(Serialize, Deserialize, Debug)] pub(super) struct OverclockLimits { @@ -23,7 +23,7 @@ impl Default for OverclockLimits { impl OverclockLimits { /// (Self, is_default) pub fn load_or_default() -> (Self, bool) { - let path = std::path::Path::new(OC_LIMITS_FILEPATH); + let path = oc_limits_filepath(); if path.exists() { log::info!("Steam Deck limits file {} found", path.display()); let mut file = match std::fs::File::open(&path) { @@ -86,7 +86,7 @@ impl Default for CpuLimits { fn default() -> Self { Self { clock_min: MinMax { min: 1400, max: 3500 }, - clock_max: MinMax { min: 500, max: 3500 } + clock_max: MinMax { min: 400, max: 3500 } } } } @@ -109,3 +109,7 @@ impl Default for GpuLimits { } } } + +fn oc_limits_filepath() -> std::path::PathBuf { + crate::utility::settings_dir().join(OC_LIMITS_FILEPATH) +} diff --git a/package.json b/package.json index acca2f6..4988edf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PowerTools", - "version": "1.1.0", + "version": "1.1.0-beta4", "description": "Power tweaks for power users", "scripts": { "build": "shx rm -rf dist && rollup -c", diff --git a/pt_oc.json b/pt_oc.json new file mode 100644 index 0000000..410b8fd --- /dev/null +++ b/pt_oc.json @@ -0,0 +1,47 @@ +{ + "battery": { + "charge_rate": {"min": 250, "max": 2500} + }, + "cpus": { + "cpus": [ + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + }, + { + "clock_min": {"min": 1400, "max": 3500}, + "clock_max": {"min": 500, "max": 3500} + } + ] + }, + "gpu": { + "fast_ppt": {"min": 1000000, "max": 30000000}, + "slow_ppt": {"min": 1000000, "max": 29000000}, + "clock_min": {"min": 200, "max": 1600}, + "clock_max": {"min": 200, "max": 1600} + } +} diff --git a/src/components/cpus.tsx b/src/components/cpus.tsx index 586200c..fcc73dc 100644 --- a/src/components/cpus.tsx +++ b/src/components/cpus.tsx @@ -173,7 +173,7 @@ export class Cpus extends Component<{}, CpuState> { backend.log(backend.LogLevel.Debug, "Min freq slider is now " + freq.toString()); const freqNow = get_value(CLOCK_MIN_CPU); const maxNow = get_value(CLOCK_MAX_CPU); - if (freq != freqNow && ((maxNow != null && freq > maxNow) || maxNow == null)) { + if (freq != freqNow && ((maxNow != null && freq <= maxNow) || maxNow == null)) { set_value(CLOCK_MIN_CPU, freq); for (let i = 0; i < total_cpus; i++) { backend.resolve(backend.setCpuClockLimits(i, freq, get_value(CLOCK_MAX_CPU)), @@ -204,7 +204,7 @@ export class Cpus extends Component<{}, CpuState> { backend.log(backend.LogLevel.Debug, "Max freq slider is now " + freq.toString()); const freqNow = get_value(CLOCK_MAX_CPU); const minNow = get_value(CLOCK_MIN_CPU); - if (freq != freqNow && ((minNow != null && freq > minNow) || minNow == null)) { + if (freq != freqNow && ((minNow != null && freq >= minNow) || minNow == null)) { set_value(CLOCK_MAX_CPU, freq); for (let i = 0; i < total_cpus; i++) { backend.resolve(backend.setCpuClockLimits(i, get_value(CLOCK_MIN_CPU), freq), @@ -303,7 +303,7 @@ export class Cpus extends Component<{}, CpuState> { onChange={(freq: number) => { backend.log(backend.LogLevel.Debug, "Min freq slider for " + advancedCpu.toString() + " is now " + freq.toString()); const freqNow = get_value(CLOCK_MIN_MAX_CPU)[advancedCpuIndex] as MinMax; - if (freq != freqNow.min && ((freqNow.max != null && freqNow.max > freq) || freqNow.max == null)) { + if (freq != freqNow.min && ((freqNow.max != null && freq <= freqNow.max) || freqNow.max == null)) { backend.resolve(backend.setCpuClockLimits(advancedCpuIndex, freq, freqNow.max!), (limits: number[]) => { const clocks = get_value(CLOCK_MIN_MAX_CPU) as MinMax[]; @@ -328,7 +328,7 @@ export class Cpus extends Component<{}, CpuState> { onChange={(freq: number) => { backend.log(backend.LogLevel.Debug, "Max freq slider for " + advancedCpu.toString() + " is now " + freq.toString()); const freqNow = get_value(CLOCK_MIN_MAX_CPU)[advancedCpuIndex] as MinMax; - if (freq != freqNow.max && ((freqNow.min != null && freq > freqNow.min) || freqNow.min == null)) { + if (freq != freqNow.max && ((freqNow.min != null && freq >= freqNow.min) || freqNow.min == null)) { backend.resolve(backend.setCpuClockLimits(advancedCpuIndex, freqNow.min!, freq), (limits: number[]) => { const clocks = get_value(CLOCK_MIN_MAX_CPU) as MinMax[]; diff --git a/src/components/gpu.tsx b/src/components/gpu.tsx index e101aeb..7e432c7 100644 --- a/src/components/gpu.tsx +++ b/src/components/gpu.tsx @@ -145,7 +145,7 @@ export class Gpu extends Component<{}> { backend.log(backend.LogLevel.Debug, "GPU Clock Min is now " + val.toString()); const valNow = get_value(CLOCK_MIN_GPU); const maxNow = get_value(CLOCK_MAX_GPU); - if (val != valNow && ((maxNow != null && val < maxNow) || maxNow == null)) { + if (val != valNow && ((maxNow != null && val <= maxNow) || maxNow == null)) { backend.resolve(backend.setGpuClockLimits(val, get_value(CLOCK_MAX_GPU)), (limits: number[]) => { set_value(CLOCK_MIN_GPU, limits[0]); @@ -169,7 +169,7 @@ export class Gpu extends Component<{}> { backend.log(backend.LogLevel.Debug, "GPU Clock Max is now " + val.toString()); const valNow = get_value(CLOCK_MAX_GPU); const minNow = get_value(CLOCK_MIN_GPU); - if (val != valNow && ((minNow != null && val > minNow) || minNow == null)) { + if (val != valNow && ((minNow != null && val >= minNow) || minNow == null)) { backend.resolve(backend.setGpuClockLimits(get_value(CLOCK_MIN_GPU), val), (limits: number[]) => { set_value(CLOCK_MIN_GPU, limits[0]); diff --git a/translations/es-ES.mo b/translations/es-ES.mo new file mode 100644 index 0000000..40ddd41 Binary files /dev/null and b/translations/es-ES.mo differ diff --git a/translations/es-ES.po b/translations/es-ES.po index 937fffe..aef82f0 100644 --- a/translations/es-ES.po +++ b/translations/es-ES.po @@ -9,10 +9,10 @@ msgstr "" "Project-Id-Version: v1.1\n" "Report-Msgid-Bugs-To: https://github.com/NGnius/PowerTools/issues\n" "POT-Creation-Date: 2023-01-09 19:52-0500\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"PO-Revision-Date: 2023-01-18 19:52-0500\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es-ES\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/translations/zh_CN.mo b/translations/zh-CN.mo similarity index 100% rename from translations/zh_CN.mo rename to translations/zh-CN.mo diff --git a/translations/zh_CN.po b/translations/zh-CN.po similarity index 100% rename from translations/zh_CN.po rename to translations/zh-CN.po diff --git a/translations/zh-HK.mo b/translations/zh-HK.mo new file mode 100644 index 0000000..396104d Binary files /dev/null and b/translations/zh-HK.mo differ diff --git a/translations/zh_HK.po b/translations/zh-HK.po similarity index 100% rename from translations/zh_HK.po rename to translations/zh-HK.po