forked from NG-SD-Plugins/PowerTools
Allow max == min, fix SMT bug, compile missing .mo files
This commit is contained in:
parent
df69a5a2db
commit
aff5005ca9
15 changed files with 71 additions and 18 deletions
2
backend/Cargo.lock
generated
2
backend/Cargo.lock
generated
|
@ -826,7 +826,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "powertools-rs"
|
||||
version = "1.1.0"
|
||||
version = "1.1.0-beta4"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"limits_core",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "powertools-rs"
|
||||
version = "1.1.0"
|
||||
version = "1.1.0-beta4"
|
||||
edition = "2021"
|
||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||
description = "Backend (superuser) functionality for PowerTools"
|
||||
|
|
|
@ -145,6 +145,7 @@ impl CpuMessage {
|
|||
matches!(self,
|
||||
Self::SetCpuOnline(_, _)
|
||||
| Self::SetCpusOnline(_)
|
||||
| Self::SetSmt(_, _)
|
||||
| Self::SetClockLimits(_, _)
|
||||
| Self::SetCpuGovernor(_, _)
|
||||
| Self::SetCpusGovernor(_)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
47
pt_oc.json
Normal file
47
pt_oc.json
Normal file
|
@ -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}
|
||||
}
|
||||
}
|
|
@ -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[];
|
||||
|
|
|
@ -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]);
|
||||
|
|
BIN
translations/es-ES.mo
Normal file
BIN
translations/es-ES.mo
Normal file
Binary file not shown.
|
@ -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 <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\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"
|
||||
|
|
BIN
translations/zh-HK.mo
Normal file
BIN
translations/zh-HK.mo
Normal file
Binary file not shown.
Loading…
Reference in a new issue