Merge branch 'dev' into origin/main
This commit is contained in:
commit
33e3078b1d
4 changed files with 46 additions and 9 deletions
|
@ -7,6 +7,14 @@ Steam Deck power tweaks for power users.
|
||||||
This is generated from the template plugin for the [SteamOS Plugin Loader](https://github.com/SteamDeckHomebrew/PluginLoader).
|
This is generated from the template plugin for the [SteamOS Plugin Loader](https://github.com/SteamDeckHomebrew/PluginLoader).
|
||||||
You will need that installed for this plugin to work.
|
You will need that installed for this plugin to work.
|
||||||
|
|
||||||
|
## What does it do?
|
||||||
|
|
||||||
|
- Enable & disable CPU threads & SMT
|
||||||
|
- Set CPU max frequency and toggle boost
|
||||||
|
- Set some GPU power parameters (fastPPT & slowPPT)
|
||||||
|
- Set the fan RPM (unsupported on SteamOS beta)
|
||||||
|
- Display supplementary battery info
|
||||||
|
|
||||||
## Cool, but that's too much work
|
## Cool, but that's too much work
|
||||||
|
|
||||||
Fair enough.
|
Fair enough.
|
||||||
|
|
BIN
extras/ui.png
BIN
extras/ui.png
Binary file not shown.
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 202 KiB |
21
main.py
21
main.py
|
@ -1,7 +1,8 @@
|
||||||
import time
|
import time
|
||||||
#import subprocess
|
#import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
VERSION = "0.3.0"
|
VERSION = "0.4.0"
|
||||||
|
|
||||||
class Plugin:
|
class Plugin:
|
||||||
CPU_COUNT = 8
|
CPU_COUNT = 8
|
||||||
|
@ -9,6 +10,7 @@ class Plugin:
|
||||||
FAN_SPEEDS = [0, 1000, 2000, 3000, 4000, 5000, 6000]
|
FAN_SPEEDS = [0, 1000, 2000, 3000, 4000, 5000, 6000]
|
||||||
|
|
||||||
auto_fan = True
|
auto_fan = True
|
||||||
|
smt = None
|
||||||
|
|
||||||
async def get_version(self) -> str:
|
async def get_version(self) -> str:
|
||||||
return VERSION
|
return VERSION
|
||||||
|
@ -17,6 +19,7 @@ class Plugin:
|
||||||
|
|
||||||
# call from main_view.html with setCPUs(count, smt)
|
# call from main_view.html with setCPUs(count, smt)
|
||||||
async def set_cpus(self, count, smt=True) -> int:
|
async def set_cpus(self, count, smt=True) -> int:
|
||||||
|
self.smt = smt
|
||||||
# print("Setting CPUs")
|
# print("Setting CPUs")
|
||||||
if smt:
|
if smt:
|
||||||
count = min(int(count), self.CPU_COUNT)
|
count = min(int(count), self.CPU_COUNT)
|
||||||
|
@ -43,10 +46,15 @@ class Plugin:
|
||||||
return online_count
|
return online_count
|
||||||
|
|
||||||
async def get_smt(self) -> bool:
|
async def get_smt(self) -> bool:
|
||||||
for cpu in range(1, self.CPU_COUNT, 2):
|
if self.smt is None:
|
||||||
if (not status_cpu(cpu)) and status_cpu(cpu+1):
|
for cpu in range(1, self.CPU_COUNT, 2):
|
||||||
return False
|
if (not status_cpu(cpu)) and status_cpu(cpu+1):
|
||||||
return True
|
self.smt = False
|
||||||
|
return False
|
||||||
|
self.smt = True
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return self.smt
|
||||||
|
|
||||||
async def set_boost(self, enabled: bool) -> bool:
|
async def set_boost(self, enabled: bool) -> bool:
|
||||||
write_to_sys("/sys/devices/system/cpu/cpufreq/boost", int(enabled))
|
write_to_sys("/sys/devices/system/cpu/cpufreq/boost", int(enabled))
|
||||||
|
@ -124,6 +132,9 @@ class Plugin:
|
||||||
return i
|
return i
|
||||||
return len(self.FAN_SPEEDS)-1 # any higher value is considered as highest manual setting
|
return len(self.FAN_SPEEDS)-1 # any higher value is considered as highest manual setting
|
||||||
|
|
||||||
|
async def fantastic_installed(self) -> bool:
|
||||||
|
return os.path.exists("/home/deck/homebrew/plugins/Fantastic")
|
||||||
|
|
||||||
# Battery stuff
|
# Battery stuff
|
||||||
|
|
||||||
async def get_charge_now(self) -> int:
|
async def get_charge_now(self) -> int:
|
||||||
|
|
|
@ -54,6 +54,10 @@
|
||||||
return call_plugin_method("get_fan_tick", {});
|
return call_plugin_method("get_fan_tick", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFantastic() {
|
||||||
|
return call_plugin_method("fantastic_installed", {});
|
||||||
|
}
|
||||||
|
|
||||||
function getChargeNow() {
|
function getChargeNow() {
|
||||||
return call_plugin_method("get_charge_now", {});
|
return call_plugin_method("get_charge_now", {});
|
||||||
}
|
}
|
||||||
|
@ -75,7 +79,15 @@
|
||||||
selectNotch("cpuThreadsNotch", await getCPUs() - 1, 8);
|
selectNotch("cpuThreadsNotch", await getCPUs() - 1, 8);
|
||||||
selectNotch("frequencyNotch", await getMaxBoost(), 3);
|
selectNotch("frequencyNotch", await getMaxBoost(), 3);
|
||||||
await onReadyGPU();
|
await onReadyGPU();
|
||||||
selectNotch("fanNotch", await getFanTick(), 8);
|
let isFantasticInstalled = await getFantastic();
|
||||||
|
if (isFantasticInstalled) {
|
||||||
|
// Don't fight with Fantastic
|
||||||
|
let fanRoot = document.getElementById("fanRoot");
|
||||||
|
fanRoot.style.visibility = "hidden";
|
||||||
|
fanRoot.style.height = "0px";
|
||||||
|
} else {
|
||||||
|
selectNotch("fanNotch", await getFanTick(), 8);
|
||||||
|
}
|
||||||
await updateBatteryStats();
|
await updateBatteryStats();
|
||||||
// this is unimportant; always do it last
|
// this is unimportant; always do it last
|
||||||
await updateVersion();
|
await updateVersion();
|
||||||
|
@ -235,7 +247,7 @@
|
||||||
|
|
||||||
<!-- SMT toggle switch, roughly copied from https://github.com/SteamDeckHomebrew/ExtraSettingsPlugin/blob/main/main_view.html -->
|
<!-- SMT toggle switch, roughly copied from https://github.com/SteamDeckHomebrew/ExtraSettingsPlugin/blob/main/main_view.html -->
|
||||||
<!-- Due to a bug in MangoHud, this has been hidden for now -->
|
<!-- Due to a bug in MangoHud, this has been hidden for now -->
|
||||||
<div class="quickaccessmenu_TabGroupPanel_1QO7b Panel Focusable" style="display:none;">
|
<div class="quickaccessmenu_TabGroupPanel_1QO7b Panel Focusable">
|
||||||
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
||||||
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
||||||
<div class="gamepaddialog_Field_eKmEX gamepaddialog_WithFirstRow_2bDqk gamepaddialog_ExtraPaddingOnChildrenBelow_3nLNL gamepaddialog_StandardPadding_xIITX gamepaddialog_HighlightOnFocus_2HFrm Panel Focusable" style="--indent-level:0;">
|
<div class="gamepaddialog_Field_eKmEX gamepaddialog_WithFirstRow_2bDqk gamepaddialog_ExtraPaddingOnChildrenBelow_3nLNL gamepaddialog_StandardPadding_xIITX gamepaddialog_HighlightOnFocus_2HFrm Panel Focusable" style="--indent-level:0;">
|
||||||
|
@ -250,7 +262,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="gamepaddialog_FieldDescription_1W1to">Disables odd-numbered CPUs</div>
|
<div class="gamepaddialog_FieldDescription_1W1to">Enables odd-numbered CPUs</div>
|
||||||
|
<div style="font-size:x-small;">
|
||||||
|
WARNING: Disabling crashes the performance overlay.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -427,7 +442,7 @@
|
||||||
|
|
||||||
<!-- Fan RPM selector -->
|
<!-- Fan RPM selector -->
|
||||||
<!-- TODO: Make this non-notched slider when PluginLoader PR#41 is merged -->
|
<!-- TODO: Make this non-notched slider when PluginLoader PR#41 is merged -->
|
||||||
<div class="gamepaddialog_Field_eKmEX gamepaddialog_WithFirstRow_2bDqk gamepaddialog_WithChildrenBelow_37xzV gamepaddialog_InlineWrapShiftsChildrenBelow_3LCXh gamepaddialog_WithBottomSeparator_3YKpU gamepaddialog_ChildrenWidthFixed_ljcbL gamepaddialog_ExtraPaddingOnChildrenBelow_3nLNL gamepaddialog_StandardPadding_xIITX gamepaddialog_HighlightOnFocus_2HFrm Panel Focusable">
|
<div class="gamepaddialog_Field_eKmEX gamepaddialog_WithFirstRow_2bDqk gamepaddialog_WithChildrenBelow_37xzV gamepaddialog_InlineWrapShiftsChildrenBelow_3LCXh gamepaddialog_WithBottomSeparator_3YKpU gamepaddialog_ChildrenWidthFixed_ljcbL gamepaddialog_ExtraPaddingOnChildrenBelow_3nLNL gamepaddialog_StandardPadding_xIITX gamepaddialog_HighlightOnFocus_2HFrm Panel Focusable" id="fanRoot">
|
||||||
<div class="gamepaddialog_FieldLabelRow_2VcTl">
|
<div class="gamepaddialog_FieldLabelRow_2VcTl">
|
||||||
<div class="gamepaddialog_FieldLabel_3jMlJ">Fan RPM</div>
|
<div class="gamepaddialog_FieldLabel_3jMlJ">Fan RPM</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -475,6 +490,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="font-size:x-small;">
|
||||||
|
WARNING: This can cause component overheating.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Battery Info -->
|
<!-- Battery Info -->
|
||||||
|
|
Loading…
Reference in a new issue