mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Various UI fixes
This commit is contained in:
980
Cargo.lock
generated
980
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -68,11 +68,14 @@ impl AsusArmouryAttribute {
|
||||
) -> Result<(), RogError> {
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
|
||||
let ctrl = self.clone();
|
||||
let name = self.name();
|
||||
match self.attr.get_watcher() {
|
||||
macro_rules! watch_value_notify {
|
||||
($attr_str:expr, $fn_prop_changed:ident) => {
|
||||
match self.attr.get_watcher($attr_str) {
|
||||
Ok(watch) => {
|
||||
let name = <&str>::from(name);
|
||||
let ctrl = self.clone();
|
||||
let sig = signal_ctxt.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut buffer = [0; 32];
|
||||
watch
|
||||
@@ -80,17 +83,25 @@ impl AsusArmouryAttribute {
|
||||
.unwrap()
|
||||
.for_each(|_| async {
|
||||
debug!("{} changed", name);
|
||||
ctrl.current_value_changed(&signal_ctxt).await.ok();
|
||||
ctrl.$fn_prop_changed(&sig).await.ok();
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
Err(e) => info!(
|
||||
"inotify watch failed: {}. You can ignore this if your device does not support \
|
||||
the feature",
|
||||
"inotify watch failed: {}. You can ignore this if your device does not \
|
||||
support the feature",
|
||||
e
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// "current_value", "default_value", "min_value", "max_value"
|
||||
watch_value_notify!("current_value", current_value_changed);
|
||||
watch_value_notify!("default_value", default_value_changed);
|
||||
watch_value_notify!("min_value", min_value_changed);
|
||||
watch_value_notify!("max_value", max_value_changed);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -372,6 +372,7 @@ impl CtrlPlatform {
|
||||
.enabled = false;
|
||||
|
||||
self.config.lock().await.write();
|
||||
// TODO: Need to get supported profiles here and ensure we translate to one
|
||||
self.platform
|
||||
.set_platform_profile(policy.into())
|
||||
.map_err(|err| {
|
||||
|
||||
@@ -80,6 +80,15 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "FX617X",
|
||||
product_id: "",
|
||||
layout_name: "fa506i",
|
||||
basic_modes: [Static, Breathe, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "FX705D",
|
||||
product_id: "",
|
||||
|
||||
@@ -5,7 +5,6 @@ use slint_build::CompilerConfiguration;
|
||||
|
||||
fn main() {
|
||||
// write_locales();
|
||||
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let mut main = PathBuf::from_str(root).unwrap();
|
||||
main.push("ui/main_window.slint");
|
||||
@@ -14,7 +13,6 @@ fn main() {
|
||||
include.push("ui");
|
||||
|
||||
slint_build::print_rustc_flags().unwrap();
|
||||
// slint_build::compile("ui/main_window.slint").unwrap();
|
||||
slint_build::compile_with_config(
|
||||
main,
|
||||
CompilerConfiguration::new()
|
||||
|
||||
@@ -84,7 +84,7 @@ async fn main() -> Result<()> {
|
||||
let board_name = dmi.board_name;
|
||||
let prod_family = dmi.product_family;
|
||||
info!("Running on {board_name}, product: {prod_family}");
|
||||
let is_rog_ally = prod_family == "RC71L";
|
||||
let is_rog_ally = prod_family == "RC71L" || prod_family == "RC72L";
|
||||
|
||||
let args: Vec<String> = args().skip(1).collect();
|
||||
|
||||
@@ -120,7 +120,9 @@ async fn main() -> Result<()> {
|
||||
config.enable_tray_icon = false;
|
||||
config.run_in_background = false;
|
||||
config.startup_in_background = false;
|
||||
config.start_fullscreen = true;
|
||||
}
|
||||
config.write();
|
||||
|
||||
let enable_tray_icon = config.enable_tray_icon;
|
||||
let startup_in_background = config.startup_in_background;
|
||||
@@ -136,8 +138,8 @@ async fn main() -> Result<()> {
|
||||
// i_slint_backend_selector::with_platform(|_| Ok(())).unwrap();
|
||||
|
||||
if !startup_in_background {
|
||||
if let Ok(mut lock) = app_state.lock() {
|
||||
*lock = AppState::MainWindowShouldOpen;
|
||||
if let Ok(mut app_state) = app_state.lock() {
|
||||
*app_state = AppState::MainWindowShouldOpen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,15 +156,15 @@ async fn main() -> Result<()> {
|
||||
let mut state = AppState::StartingUp;
|
||||
loop {
|
||||
// save as a var, don't hold the lock the entire time or deadlocks happen
|
||||
if let Ok(lock) = app_state.lock() {
|
||||
state = *lock;
|
||||
if let Ok(app_state) = app_state.lock() {
|
||||
state = *app_state;
|
||||
}
|
||||
|
||||
// This sleep is required to give the event loop time to react
|
||||
sleep(Duration::from_millis(300));
|
||||
if state == AppState::MainWindowShouldOpen {
|
||||
if let Ok(mut lock) = app_state.lock() {
|
||||
*lock = AppState::MainWindowOpen;
|
||||
if let Ok(mut app_state) = app_state.lock() {
|
||||
*app_state = AppState::MainWindowOpen;
|
||||
}
|
||||
|
||||
let config_copy = config.clone();
|
||||
@@ -174,20 +176,39 @@ async fn main() -> Result<()> {
|
||||
if let Some(ui) = ui.as_mut() {
|
||||
ui.window().show().unwrap();
|
||||
ui.window().on_close_requested(move || {
|
||||
if let Ok(mut lock) = app_state_copy.lock() {
|
||||
*lock = AppState::MainWindowClosed;
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
} else {
|
||||
let config_copy_2 = config_copy.clone();
|
||||
let newui = setup_window(config_copy);
|
||||
newui.window().show().unwrap();
|
||||
newui.window().on_close_requested(move || {
|
||||
if let Ok(mut lock) = app_state_copy.lock() {
|
||||
*lock = AppState::MainWindowClosed;
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
|
||||
let ui_copy = newui.as_weak();
|
||||
newui
|
||||
.window()
|
||||
.set_rendering_notifier(move |s, _| {
|
||||
if let slint::RenderingState::RenderingSetup = s {
|
||||
let config = config_copy_2.clone();
|
||||
ui_copy
|
||||
.upgrade_in_event_loop(move |w| {
|
||||
let fullscreen =
|
||||
config.lock().is_ok_and(|c| c.start_fullscreen);
|
||||
if fullscreen && !w.window().is_fullscreen() {
|
||||
w.window().set_fullscreen(fullscreen);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
ui.replace(newui);
|
||||
}
|
||||
});
|
||||
@@ -197,8 +218,8 @@ async fn main() -> Result<()> {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
} else if state != AppState::MainWindowOpen {
|
||||
if let Ok(lock) = config.lock() {
|
||||
if !lock.run_in_background {
|
||||
if let Ok(config) = config.lock() {
|
||||
if !config.run_in_background {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::sync::{Arc, Mutex};
|
||||
use config_traits::StdConfig;
|
||||
use log::warn;
|
||||
use rog_dbus::list_iface_blocking;
|
||||
use slint::{ComponentHandle, PhysicalSize, SharedString, Weak};
|
||||
use slint::{ComponentHandle, SharedString, Weak};
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::ui::setup_anime::setup_anime_page;
|
||||
@@ -87,15 +87,7 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
|
||||
.map_err(|e| warn!("Couldn't set application ID: {e:?}"))
|
||||
.ok();
|
||||
let ui = MainWindow::new().unwrap();
|
||||
if let Ok(lock) = config.try_lock() {
|
||||
let fullscreen = lock.start_fullscreen;
|
||||
let width = lock.fullscreen_width;
|
||||
let height = lock.fullscreen_height;
|
||||
if fullscreen {
|
||||
ui.window().set_fullscreen(fullscreen);
|
||||
ui.window().set_size(PhysicalSize { width, height });
|
||||
}
|
||||
};
|
||||
ui.window().show().unwrap();
|
||||
|
||||
let available = list_iface_blocking().unwrap_or_default();
|
||||
ui.set_sidebar_items_avilable(
|
||||
@@ -129,6 +121,7 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
|
||||
if available.contains(&"xyz.ljones.FanCurves".to_string()) {
|
||||
setup_fan_curve_page(&ui, config);
|
||||
}
|
||||
|
||||
ui
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::{set_ui_callbacks, set_ui_props_async, AttrMinMax, MainWindow, System
|
||||
const MINMAX: AttrMinMax = AttrMinMax {
|
||||
min: 0,
|
||||
max: 0,
|
||||
val: -1.0
|
||||
current: -1.0
|
||||
};
|
||||
|
||||
pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
||||
@@ -93,13 +93,13 @@ macro_rules! init_minmax_property {
|
||||
tokio::spawn(async move {
|
||||
let min = proxy_copy.min_value().await.unwrap();
|
||||
let max = proxy_copy.max_value().await.unwrap();
|
||||
let val = proxy_copy.current_value().await.unwrap() as f32;
|
||||
let current = proxy_copy.current_value().await.unwrap() as f32;
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
concat_idents!(setter = set_, $property {
|
||||
handle
|
||||
.global::<SystemPageData>()
|
||||
.setter(AttrMinMax { min, max, val });
|
||||
.setter(AttrMinMax { min, max, current });
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
@@ -174,12 +174,14 @@ macro_rules! setup_external {
|
||||
}
|
||||
|
||||
// For handling external value changes
|
||||
macro_rules! setup_minmax_external {
|
||||
($property:ident, $handle:expr, $attr:expr, $platform:expr) => {
|
||||
macro_rules! setup_value_watch {
|
||||
($property:ident, $handle:expr, $proxy:expr, $value_type:ident $($conv: tt)*) => {
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $attr.clone();
|
||||
let proxy_copy = $proxy.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut x = proxy_copy.receive_current_value_changed().await;
|
||||
let mut x = concat_idents!(recv = receive_, $value_type, _value_changed {
|
||||
proxy_copy.recv().await
|
||||
});
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
while let Some(e) = x.next().await {
|
||||
if let Ok(out) = e.get().await {
|
||||
@@ -188,7 +190,8 @@ macro_rules! setup_minmax_external {
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
let mut tmp: AttrMinMax =
|
||||
handle.global::<SystemPageData>().getter();
|
||||
tmp.val = out as f32;
|
||||
tmp.$value_type = out $($conv)*;
|
||||
dbg!(tmp.$value_type);
|
||||
concat_idents!(setter = set_, $property {
|
||||
handle.global::<SystemPageData>().setter(tmp);
|
||||
});
|
||||
@@ -198,6 +201,14 @@ macro_rules! setup_minmax_external {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! setup_minmax_external {
|
||||
($property:ident, $handle:expr, $attr:expr, $platform:expr) => {
|
||||
setup_value_watch!($property, $handle, $attr, current as f32);
|
||||
setup_value_watch!($property, $handle, $attr, min);
|
||||
setup_value_watch!($property, $handle, $attr, max);
|
||||
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $attr.clone();
|
||||
@@ -210,13 +221,13 @@ macro_rules! setup_minmax_external {
|
||||
debug!("receive_platform_profile_changed, getting new {}", stringify!(attr));
|
||||
let min = proxy_copy.min_value().await.unwrap();
|
||||
let max = proxy_copy.max_value().await.unwrap();
|
||||
let val = proxy_copy.current_value().await.unwrap() as f32;
|
||||
let current = proxy_copy.current_value().await.unwrap() as f32;
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
concat_idents!(setter = set_, $property {
|
||||
handle
|
||||
.global::<SystemPageData>()
|
||||
.setter(AttrMinMax { min, max, val });
|
||||
.setter(AttrMinMax { min, max, current });
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2025-01-21 06:49+0000\n"
|
||||
"POT-Creation-Date: 2025-02-01 07:27+0000\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"
|
||||
@@ -733,42 +733,42 @@ msgctxt "confirm_reset"
|
||||
msgid "Are you sure you want to reset this?"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:54
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
msgctxt "MainWindow"
|
||||
msgid "ROG"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:56
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
msgctxt "Menu1"
|
||||
msgid "System Control"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
#: rog-control-center/ui/main_window.slint:58
|
||||
msgctxt "Menu2"
|
||||
msgid "Keyboard Aura"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:58
|
||||
#: rog-control-center/ui/main_window.slint:59
|
||||
msgctxt "Menu3"
|
||||
msgid "AniMe Matrix"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:59
|
||||
#: rog-control-center/ui/main_window.slint:60
|
||||
msgctxt "Menu4"
|
||||
msgid "Fan Curves"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:60
|
||||
#: rog-control-center/ui/main_window.slint:61
|
||||
msgctxt "Menu5"
|
||||
msgid "App Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:61
|
||||
#: rog-control-center/ui/main_window.slint:62
|
||||
msgctxt "Menu6"
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:73
|
||||
#: rog-control-center/ui/main_window.slint:74
|
||||
msgctxt "MainWindow"
|
||||
msgid "Quit App"
|
||||
msgstr ""
|
||||
|
||||
@@ -19,6 +19,7 @@ export { AppSize, AttrMinMax, SystemPageData, AnimePageData, AppSettingsPageData
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
title: "ROG Control";
|
||||
always-on-top: true;
|
||||
default-font-family: "Noto Sans";
|
||||
default-font-size: 14px;
|
||||
default-font-weight: 400;
|
||||
|
||||
@@ -4,12 +4,12 @@ import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switc
|
||||
export struct AttrMinMax {
|
||||
min: int,
|
||||
max: int,
|
||||
val: float,
|
||||
current: float,
|
||||
}
|
||||
|
||||
export struct AttrPossible {
|
||||
range: [int],
|
||||
val: int,
|
||||
current: int,
|
||||
}
|
||||
|
||||
export global SystemPageData {
|
||||
@@ -54,7 +54,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> ppt_pl1_spl: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_pl1_spl(int);
|
||||
callback cb_default_ppt_pl1_spl();
|
||||
@@ -62,7 +62,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> ppt_pl2_sppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_pl2_sppt(int);
|
||||
callback cb_default_ppt_pl2_sppt();
|
||||
@@ -70,7 +70,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> ppt_pl3_fppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_pl3_fppt(int);
|
||||
callback cb_default_ppt_pl3_fppt();
|
||||
@@ -78,7 +78,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> ppt_fppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_fppt(int);
|
||||
callback cb_default_ppt_fppt();
|
||||
@@ -86,7 +86,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> ppt_apu_sppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_apu_sppt(int);
|
||||
callback cb_default_ppt_apu_sppt();
|
||||
@@ -94,7 +94,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> ppt_platform_sppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_platform_sppt(int);
|
||||
callback cb_default_ppt_platform_sppt();
|
||||
@@ -102,7 +102,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> nv_dynamic_boost: {
|
||||
min: 0,
|
||||
max: 30,
|
||||
val: 5,
|
||||
current: 5,
|
||||
};
|
||||
callback cb_nv_dynamic_boost(int);
|
||||
callback cb_default_nv_dynamic_boost();
|
||||
@@ -110,7 +110,7 @@ export global SystemPageData {
|
||||
in-out property <AttrMinMax> nv_temp_target: {
|
||||
min: 0,
|
||||
max: 80,
|
||||
val: 75,
|
||||
current: 75,
|
||||
};
|
||||
callback cb_nv_temp_target(int);
|
||||
callback cb_default_nv_temp_target();
|
||||
@@ -237,7 +237,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl1_spl.val != -1 || SystemPageData.ppt_pl2_sppt.val != -1 || SystemPageData.nv_dynamic_boost.val != -1: HorizontalLayout {
|
||||
if SystemPageData.ppt_pl1_spl.current != -1 || SystemPageData.ppt_pl2_sppt.current != -1 || SystemPageData.nv_dynamic_boost.current != -1: HorizontalLayout {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
alignment: LayoutAlignment.space-between;
|
||||
@@ -258,137 +258,137 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider {
|
||||
if SystemPageData.ppt_pl1_spl.current != -1: SystemSlider {
|
||||
text: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
|
||||
title: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
|
||||
help_text: @tr("ppt_pl1_spl_help" => "Long-term CPU power limit that affects sustained workload performance. Higher values may increase heat and power consumption.");
|
||||
minimum: SystemPageData.ppt_pl1_spl.min;
|
||||
maximum: SystemPageData.ppt_pl1_spl.max;
|
||||
value: SystemPageData.ppt_pl1_spl.val;
|
||||
value: SystemPageData.ppt_pl1_spl.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl1_spl();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl1_spl.val = self.value;
|
||||
SystemPageData.ppt_pl1_spl.current = self.value;
|
||||
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value));
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl2_sppt.val != -1: SystemSlider {
|
||||
if SystemPageData.ppt_pl2_sppt.current != -1: SystemSlider {
|
||||
text: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
|
||||
title: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
|
||||
help_text: @tr("ppt_pl2_sppt_help" => "Short-term CPU power limit for boost periods. Controls maximum power during brief high-performance bursts.");
|
||||
minimum: SystemPageData.ppt_pl2_sppt.min;
|
||||
maximum: SystemPageData.ppt_pl2_sppt.max;
|
||||
value: SystemPageData.ppt_pl2_sppt.val;
|
||||
value: SystemPageData.ppt_pl2_sppt.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl2_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl2_sppt.val = self.value;
|
||||
SystemPageData.ppt_pl2_sppt.current = self.value;
|
||||
SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl3_fppt.val != -1: SystemSlider {
|
||||
if SystemPageData.ppt_pl3_fppt.current != -1: SystemSlider {
|
||||
text: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
|
||||
title: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
|
||||
help_text: @tr("ppt_pl3_fppt_help" => "Ultra-short duration power limit for instantaneous CPU bursts. Affects responsiveness during sudden workload spikes.");
|
||||
minimum: SystemPageData.ppt_pl3_fppt.min;
|
||||
maximum: SystemPageData.ppt_pl3_fppt.max;
|
||||
value: SystemPageData.ppt_pl3_fppt.val;
|
||||
value: SystemPageData.ppt_pl3_fppt.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl3_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl3_fppt.val = self.value;
|
||||
SystemPageData.ppt_pl3_fppt.current = self.value;
|
||||
SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
if SystemPageData.ppt_fppt.val != -1: SystemSlider {
|
||||
if SystemPageData.ppt_fppt.current != -1: SystemSlider {
|
||||
text: @tr("ppt_fppt" => "Fast Package Power Limit");
|
||||
title: @tr("ppt_fppt" => "Fast Package Power Limit");
|
||||
help_text: @tr("ppt_fppt_help" => "Ultra-short duration power limit for system package. Controls maximum power during millisecond-scale load spikes.");
|
||||
minimum: SystemPageData.ppt_fppt.min;
|
||||
maximum: SystemPageData.ppt_fppt.max;
|
||||
value: SystemPageData.ppt_fppt.val;
|
||||
value: SystemPageData.ppt_fppt.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_fppt.val = self.value;
|
||||
SystemPageData.ppt_fppt.current = self.value;
|
||||
SystemPageData.cb_ppt_fppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_apu_sppt.val != -1: SystemSlider {
|
||||
if SystemPageData.ppt_apu_sppt.current != -1: SystemSlider {
|
||||
text: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
|
||||
title: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
|
||||
help_text: @tr("ppt_apu_sppt_help" => "Long-term power limit for integrated graphics and CPU combined. Affects sustained performance of APU-based workloads.");
|
||||
minimum: SystemPageData.ppt_apu_sppt.min;
|
||||
maximum: SystemPageData.ppt_apu_sppt.max;
|
||||
value: SystemPageData.ppt_apu_sppt.val;
|
||||
value: SystemPageData.ppt_apu_sppt.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_apu_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_apu_sppt.val = self.value;
|
||||
SystemPageData.ppt_apu_sppt.current = self.value;
|
||||
SystemPageData.cb_ppt_apu_sppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_platform_sppt.val != -1: SystemSlider {
|
||||
if SystemPageData.ppt_platform_sppt.current != -1: SystemSlider {
|
||||
text: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
|
||||
title: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
|
||||
help_text: @tr("ppt_platform_sppt_help" => "Overall system power limit for sustained operations. Controls total platform power consumption over extended periods.");
|
||||
minimum: SystemPageData.ppt_platform_sppt.min;
|
||||
maximum: SystemPageData.ppt_platform_sppt.max;
|
||||
value: SystemPageData.ppt_platform_sppt.val;
|
||||
value: SystemPageData.ppt_platform_sppt.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_platform_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_platform_sppt.val = self.value;
|
||||
SystemPageData.ppt_platform_sppt.current = self.value;
|
||||
SystemPageData.cb_ppt_platform_sppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.nv_dynamic_boost.val != -1: SystemSlider {
|
||||
if SystemPageData.nv_dynamic_boost.current != -1: SystemSlider {
|
||||
text: @tr("nv_dynamic_boost" => "GPU Power Boost");
|
||||
title: @tr("nv_dynamic_boost" => "GPU Power Boost");
|
||||
help_text: @tr("nv_dynamic_boost_help" => "Additional power allocation for GPU dynamic boost. Higher values increase GPU performance but generate more heat.");
|
||||
minimum: SystemPageData.nv_dynamic_boost.min;
|
||||
maximum: SystemPageData.nv_dynamic_boost.max;
|
||||
value: SystemPageData.nv_dynamic_boost.val;
|
||||
value: SystemPageData.nv_dynamic_boost.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_dynamic_boost();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_dynamic_boost.val = self.value;
|
||||
SystemPageData.nv_dynamic_boost.current = self.value;
|
||||
SystemPageData.cb_nv_dynamic_boost(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.nv_temp_target.val != -1: SystemSlider {
|
||||
if SystemPageData.nv_temp_target.current != -1: SystemSlider {
|
||||
text: @tr("nv_temp_target" => "GPU Temperature Limit");
|
||||
title: @tr("nv_temp_target" => "GPU Temperature Limit");
|
||||
help_text: @tr("nv_temp_target_help" => "Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain temperature below this limit.");
|
||||
minimum: SystemPageData.nv_temp_target.min;
|
||||
maximum: SystemPageData.nv_temp_target.max;
|
||||
value: SystemPageData.nv_temp_target.val;
|
||||
value: SystemPageData.nv_temp_target.current;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_temp_target();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_temp_target.val = self.value;
|
||||
SystemPageData.nv_temp_target.current = self.value;
|
||||
SystemPageData.cb_nv_temp_target(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,8 +172,8 @@ impl Attribute {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_watcher(&self) -> Result<inotify::Inotify, PlatformError> {
|
||||
let path = self.base_path.join("current_value");
|
||||
pub fn get_watcher(&self, attr: &str) -> Result<inotify::Inotify, PlatformError> {
|
||||
let path = self.base_path.join(attr);
|
||||
if let Some(path) = path.to_str() {
|
||||
let inotify = inotify::Inotify::init()?;
|
||||
inotify
|
||||
@@ -317,7 +317,13 @@ impl FirmwareAttribute {
|
||||
| FirmwareAttribute::PptFppt
|
||||
| FirmwareAttribute::PptApuSppt
|
||||
| FirmwareAttribute::PptPlatformSppt
|
||||
| FirmwareAttribute::NvDynamicBoost
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_dgpu(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
FirmwareAttribute::NvDynamicBoost
|
||||
| FirmwareAttribute::NvTempTarget
|
||||
| FirmwareAttribute::DgpuTgp
|
||||
)
|
||||
@@ -338,7 +344,7 @@ impl From<&str> for FirmwareAttribute {
|
||||
"ppt_platform_sppt" => Self::PptPlatformSppt,
|
||||
"nv_dynamic_boost" => Self::NvDynamicBoost,
|
||||
"nv_temp_target" => Self::NvTempTarget,
|
||||
"dgpu_base_tgp" => Self::DgpuBaseTgp,
|
||||
"nv_base_tgp" => Self::DgpuBaseTgp,
|
||||
"dgpu_tgp" => Self::DgpuTgp,
|
||||
"charge_mode" => Self::ChargeMode,
|
||||
"boot_sound" => Self::BootSound,
|
||||
|
||||
Reference in New Issue
Block a user