Compare commits

..

5 Commits

Author SHA1 Message Date
Luke D. Jones
450205f9a9 Bug fix: correctly set charge limit from UI 2025-01-19 17:29:36 +13:00
Luke D. Jones
82431ee25b Prep 6.1.0-rc5 2025-01-19 16:11:48 +13:00
Luke D. Jones
f11aea02a8 Add help and reset to UI for ppt values 2025-01-19 16:01:57 +13:00
Luke D. Jones
2d6d669c22 PPT restor defaults (WIP) 2025-01-19 12:02:22 +13:00
Luke D. Jones
f9cebf9221 Per-AC/DC per-profile tunings enabled 2025-01-19 11:33:48 +13:00
17 changed files with 561 additions and 185 deletions

View File

@@ -2,6 +2,14 @@
## [Unreleased] ## [Unreleased]
## [v6.1.0-rc5]
### Changed
- Per-AC/DC, per-profile tunings enabled (Battery vs AC power + platform profile)
- Add ability to restore PPT defaults
- Add PPT help dialogue to UI
- Bug fix: correctly set charge limit from UI
## [v6.1.0-rc4] ## [v6.1.0-rc4]
### Changed ### Changed

28
Cargo.lock generated
View File

@@ -176,7 +176,7 @@ dependencies = [
[[package]] [[package]]
name = "asusctl" name = "asusctl"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"dmi_id", "dmi_id",
"env_logger", "env_logger",
@@ -195,7 +195,7 @@ dependencies = [
[[package]] [[package]]
name = "asusd" name = "asusd"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"cargo-husky", "cargo-husky",
"concat-idents", "concat-idents",
@@ -221,7 +221,7 @@ dependencies = [
[[package]] [[package]]
name = "asusd-user" name = "asusd-user"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"config-traits", "config-traits",
"dirs", "dirs",
@@ -901,7 +901,7 @@ dependencies = [
[[package]] [[package]]
name = "config-traits" name = "config-traits"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"log", "log",
"ron", "ron",
@@ -1293,7 +1293,7 @@ dependencies = [
[[package]] [[package]]
name = "dmi_id" name = "dmi_id"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"log", "log",
"udev 0.8.0", "udev 0.8.0",
@@ -4092,7 +4092,7 @@ dependencies = [
[[package]] [[package]]
name = "rog-control-center" name = "rog-control-center"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"asusd", "asusd",
"concat-idents", "concat-idents",
@@ -4122,7 +4122,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_anime" name = "rog_anime"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"dmi_id", "dmi_id",
"gif 0.12.0", "gif 0.12.0",
@@ -4136,7 +4136,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_aura" name = "rog_aura"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"dmi_id", "dmi_id",
"log", "log",
@@ -4147,7 +4147,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_dbus" name = "rog_dbus"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"asusd", "asusd",
"rog_anime", "rog_anime",
@@ -4161,7 +4161,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_platform" name = "rog_platform"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"concat-idents", "concat-idents",
"inotify", "inotify",
@@ -4174,7 +4174,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_profiles" name = "rog_profiles"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"log", "log",
"rog_platform", "rog_platform",
@@ -4185,7 +4185,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_scsi" name = "rog_scsi"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"ron", "ron",
"serde", "serde",
@@ -4195,7 +4195,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_simulators" name = "rog_simulators"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"log", "log",
"rog_anime", "rog_anime",
@@ -4205,7 +4205,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_slash" name = "rog_slash"
version = "6.1.0-rc4" version = "6.1.0-rc5"
dependencies = [ dependencies = [
"dmi_id", "dmi_id",
"serde", "serde",

View File

@@ -1,5 +1,5 @@
[workspace.package] [workspace.package]
version = "6.1.0-rc4" version = "6.1.0-rc5"
rust-version = "1.82" rust-version = "1.82"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"

View File

@@ -96,6 +96,9 @@ pub struct GraphicsCommand {
pub struct ArmouryCommand { pub struct ArmouryCommand {
#[options(help = "print help message")] #[options(help = "print help message")]
pub help: bool, pub help: bool,
#[options(free)] #[options(
free,
help = "append each value name followed by the value to set. `-1` sets to default"
)]
pub free: Vec<String> pub free: Vec<String>
} }

View File

@@ -9,7 +9,7 @@ use aura_cli::{LedPowerCommand1, LedPowerCommand2};
use dmi_id::DMIID; use dmi_id::DMIID;
use fan_curve_cli::FanCurveCommand; use fan_curve_cli::FanCurveCommand;
use gumdrop::{Opt, Options}; use gumdrop::{Opt, Options};
use log::error; use log::{error, info};
use rog_anime::usb::get_anime_type; use rog_anime::usb::get_anime_type;
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2}; use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower}; use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
@@ -1122,7 +1122,12 @@ fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error
for attr in attr.iter() { for attr in attr.iter() {
let name = attr.name()?; let name = attr.name()?;
if <&str>::from(name) == cmd[0] { if <&str>::from(name) == cmd[0] {
attr.set_current_value(cmd[1].parse()?)?; let mut value: i32 = cmd[1].parse()?;
if value == -1 {
info!("Setting to default");
value = attr.default_value()?;
}
attr.set_current_value(value)?;
print_firmware_attr(attr)?; print_firmware_attr(attr)?;
} }
} }

View File

@@ -1,4 +1,3 @@
use std::collections::HashMap;
use std::str::FromStr; use std::str::FromStr;
use std::sync::Arc; use std::sync::Arc;
@@ -7,6 +6,7 @@ use config_traits::StdConfig;
use log::{debug, error, info}; use log::{debug, error, info};
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes}; use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
use rog_platform::platform::{RogPlatform, ThrottlePolicy}; use rog_platform::platform::{RogPlatform, ThrottlePolicy};
use rog_platform::power::AsusPower;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zbus::object_server::SignalEmitter; use zbus::object_server::SignalEmitter;
use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}; use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
@@ -33,15 +33,22 @@ pub struct AsusArmouryAttribute {
attr: Attribute, attr: Attribute,
config: Arc<Mutex<Config>>, config: Arc<Mutex<Config>>,
/// platform control required here for access to PPD or Throttle profile /// platform control required here for access to PPD or Throttle profile
platform: RogPlatform platform: RogPlatform,
power: AsusPower
} }
impl AsusArmouryAttribute { impl AsusArmouryAttribute {
pub fn new(attr: Attribute, platform: RogPlatform, config: Arc<Mutex<Config>>) -> Self { pub fn new(
attr: Attribute,
platform: RogPlatform,
power: AsusPower,
config: Arc<Mutex<Config>>
) -> Self {
Self { Self {
attr, attr,
config, config,
platform platform,
power
} }
} }
@@ -95,10 +102,23 @@ impl crate::Reloadable for AsusArmouryAttribute {
info!("Reloading {}", self.attr.name()); info!("Reloading {}", self.attr.name());
let profile: ThrottlePolicy = let profile: ThrottlePolicy =
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?; ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
if let Some(tunings) = self.config.lock().await.profile_tunings.get(&profile) { let power_plugged = self
.power
.get_online()
.map_err(|e| {
error!("Could not get power status: {e:?}");
e
})
.unwrap_or_default();
let config = if power_plugged == 1 {
&self.config.lock().await.ac_profile_tunings
} else {
&self.config.lock().await.dc_profile_tunings
};
if let Some(tunings) = config.get(&profile) {
if let Some(tune) = tunings.get(&self.name()) { if let Some(tune) = tunings.get(&self.name()) {
self.attr self.attr
.set_current_value(AttrValue::Integer(*tune)) .set_current_value(&AttrValue::Integer(*tune))
.map_err(|e| { .map_err(|e| {
error!("Could not set value: {e:?}"); error!("Could not set value: {e:?}");
e e
@@ -159,6 +179,32 @@ impl AsusArmouryAttribute {
} }
} }
async fn restore_default(&self) -> fdo::Result<()> {
self.attr.restore_default()?;
if self.name().is_ppt() {
let profile: ThrottlePolicy =
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
let power_plugged = self
.power
.get_online()
.map_err(|e| {
error!("Could not get power status: {e:?}");
e
})
.unwrap_or_default();
let mut config = self.config.lock().await;
let tunings = config.select_tunings(power_plugged == 1, profile);
if let Some(tune) = tunings.get_mut(&self.name()) {
if let AttrValue::Integer(i) = self.attr.default_value() {
*tune = *i;
}
}
config.write();
}
Ok(())
}
#[zbus(property)] #[zbus(property)]
async fn min_value(&self) -> i32 { async fn min_value(&self) -> i32 {
match self.attr.min_value() { match self.attr.min_value() {
@@ -204,7 +250,7 @@ impl AsusArmouryAttribute {
#[zbus(property)] #[zbus(property)]
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> { async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
self.attr self.attr
.set_current_value(AttrValue::Integer(value)) .set_current_value(&AttrValue::Integer(value))
.map_err(|e| { .map_err(|e| {
error!("Could not set value: {e:?}"); error!("Could not set value: {e:?}");
e e
@@ -214,29 +260,21 @@ impl AsusArmouryAttribute {
let profile: ThrottlePolicy = let profile: ThrottlePolicy =
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?; ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
// var here to prevent async deadlock on else clause let power_plugged = self
let has_profile = self .power
.config .get_online()
.lock() .map_err(|e| {
.await error!("Could not get power status: {e:?}");
.profile_tunings e
.contains_key(&profile); })
if has_profile { .unwrap_or_default();
if let Some(tunings) = self.config.lock().await.profile_tunings.get_mut(&profile) { let mut config = self.config.lock().await;
if let Some(tune) = tunings.get_mut(&self.name()) { let tunings = config.select_tunings(power_plugged == 1, profile);
*tune = value;
} else { if let Some(tune) = tunings.get_mut(&self.name()) {
tunings.insert(self.name(), value); *tune = value;
debug!("Set tuning config for {} = {:?}", self.attr.name(), value);
}
}
} else { } else {
debug!("Adding tuning config for {}", profile); tunings.insert(self.name(), value);
self.config
.lock()
.await
.profile_tunings
.insert(profile, HashMap::from([(self.name(), value)]));
debug!("Set tuning config for {} = {:?}", self.attr.name(), value); debug!("Set tuning config for {} = {:?}", self.attr.name(), value);
} }
} else { } else {
@@ -274,10 +312,16 @@ impl AsusArmouryAttribute {
pub async fn start_attributes_zbus( pub async fn start_attributes_zbus(
conn: &Connection, conn: &Connection,
platform: RogPlatform, platform: RogPlatform,
power: AsusPower,
config: Arc<Mutex<Config>> config: Arc<Mutex<Config>>
) -> Result<(), RogError> { ) -> Result<(), RogError> {
for attr in FirmwareAttributes::new().attributes() { for attr in FirmwareAttributes::new().attributes() {
let mut attr = AsusArmouryAttribute::new(attr.clone(), platform.clone(), config.clone()); let mut attr = AsusArmouryAttribute::new(
attr.clone(),
platform.clone(),
power.clone(),
config.clone()
);
attr.reload().await?; attr.reload().await?;
let path = dbus_path_for_attr(attr.attr.name()); let path = dbus_path_for_attr(attr.attr.name());
@@ -288,3 +332,41 @@ pub async fn start_attributes_zbus(
} }
Ok(()) Ok(())
} }
pub async fn set_config_or_default(
attrs: &FirmwareAttributes,
config: &mut Config,
power_plugged: bool,
profile: ThrottlePolicy
) {
for attr in attrs.attributes().iter() {
let name: FirmwareAttribute = attr.name().into();
if name.is_ppt() {
let tunings = config.select_tunings(power_plugged, profile);
if let Some(tune) = tunings.get(&name) {
attr.set_current_value(&AttrValue::Integer(*tune))
.map_err(|e| {
error!("Failed to set {}: {e}", <&str>::from(name));
})
.ok();
} else {
let default = attr.default_value();
attr.set_current_value(default)
.map_err(|e| {
error!("Failed to set {}: {e}", <&str>::from(name));
})
.ok();
if let AttrValue::Integer(i) = default {
tunings.insert(name, *i);
info!(
"Set default tuning config for {} = {:?}",
<&str>::from(name),
i
);
config.write();
}
}
}
}
}

View File

@@ -7,6 +7,7 @@ use rog_platform::platform::ThrottlePolicy;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "asusd.ron"; const CONFIG_FILE: &str = "asusd.ron";
type Tunings = HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>;
#[derive(Deserialize, Serialize, PartialEq)] #[derive(Deserialize, Serialize, PartialEq)]
pub struct Config { pub struct Config {
@@ -37,13 +38,29 @@ pub struct Config {
pub throttle_balanced_epp: CPUEPP, pub throttle_balanced_epp: CPUEPP,
/// The energy_performance_preference for this throttle/platform profile /// The energy_performance_preference for this throttle/platform profile
pub throttle_performance_epp: CPUEPP, pub throttle_performance_epp: CPUEPP,
pub profile_tunings: HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>, pub ac_profile_tunings: Tunings,
pub dc_profile_tunings: Tunings,
pub armoury_settings: HashMap<FirmwareAttribute, i32>, pub armoury_settings: HashMap<FirmwareAttribute, i32>,
/// Temporary state for AC/Batt /// Temporary state for AC/Batt
#[serde(skip)] #[serde(skip)]
pub last_power_plugged: u8 pub last_power_plugged: u8
} }
impl Config {
pub fn select_tunings(
&mut self,
power_plugged: bool,
profile: ThrottlePolicy
) -> &mut HashMap<FirmwareAttribute, i32> {
let config = if power_plugged {
&mut self.ac_profile_tunings
} else {
&mut self.dc_profile_tunings
};
config.entry(profile).or_insert_with(HashMap::new)
}
}
impl Default for Config { impl Default for Config {
fn default() -> Self { fn default() -> Self {
Self { Self {
@@ -60,7 +77,8 @@ impl Default for Config {
throttle_quiet_epp: CPUEPP::Power, throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower, throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance, throttle_performance_epp: CPUEPP::Performance,
profile_tunings: HashMap::default(), ac_profile_tunings: HashMap::default(),
dc_profile_tunings: HashMap::default(),
armoury_settings: HashMap::default(), armoury_settings: HashMap::default(),
last_power_plugged: Default::default() last_power_plugged: Default::default()
} }
@@ -148,7 +166,8 @@ impl From<Config601> for Config {
throttle_balanced_epp: c.throttle_balanced_epp, throttle_balanced_epp: c.throttle_balanced_epp,
throttle_performance_epp: c.throttle_performance_epp, throttle_performance_epp: c.throttle_performance_epp,
last_power_plugged: c.last_power_plugged, last_power_plugged: c.last_power_plugged,
profile_tunings: HashMap::default(), ac_profile_tunings: HashMap::default(),
dc_profile_tunings: HashMap::default(),
armoury_settings: HashMap::default() armoury_settings: HashMap::default()
} }
} }

View File

@@ -5,7 +5,7 @@ use std::sync::Arc;
use config_traits::StdConfig; use config_traits::StdConfig;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rog_platform::asus_armoury::{AttrValue, FirmwareAttribute, FirmwareAttributes}; use rog_platform::asus_armoury::FirmwareAttributes;
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP}; use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
use rog_platform::platform::{Properties, RogPlatform, ThrottlePolicy}; use rog_platform::platform::{Properties, RogPlatform, ThrottlePolicy};
use rog_platform::power::AsusPower; use rog_platform::power::AsusPower;
@@ -14,6 +14,7 @@ use zbus::fdo::Error as FdoErr;
use zbus::object_server::SignalEmitter; use zbus::object_server::SignalEmitter;
use zbus::{interface, Connection}; use zbus::{interface, Connection};
use crate::asus_armoury::set_config_or_default;
use crate::config::Config; use crate::config::Config;
use crate::error::RogError; use crate::error::RogError;
use crate::{task_watch_item, CtrlTask, ReloadAndNotify}; use crate::{task_watch_item, CtrlTask, ReloadAndNotify};
@@ -661,6 +662,24 @@ impl CtrlTask for CtrlPlatform {
if platform3.power.has_charge_control_end_threshold() && !power_plugged { if platform3.power.has_charge_control_end_threshold() && !power_plugged {
platform3.restore_charge_limit().await; platform3.restore_charge_limit().await;
} }
if let Ok(profile) = platform3
.platform
.get_throttle_thermal_policy()
.map(ThrottlePolicy::from)
.map_err(|e| {
error!("Platform: get_throttle_thermal_policy error: {e}");
})
{
let attrs = FirmwareAttributes::new();
set_config_or_default(
&attrs,
&mut *platform3.config.lock().await,
power_plugged,
profile
)
.await;
}
} }
} }
) )
@@ -698,35 +717,21 @@ impl CtrlTask for CtrlPlatform {
ctrl.throttle_thermal_policy_changed(&signal_ctxt) ctrl.throttle_thermal_policy_changed(&signal_ctxt)
.await .await
.ok(); .ok();
for attr in attrs.attributes().iter() { let power_plugged = ctrl
let name: FirmwareAttribute = attr.name().into(); .power
if name.is_ppt() { .get_online()
let mut do_default = false; .map_err(|e| {
if let Some(tunings) = error!("Could not get power status: {e:?}");
ctrl.config.lock().await.profile_tunings.get(&profile) e
{ })
if let Some(tune) = tunings.get(&name) { .unwrap_or_default();
attr.set_current_value(AttrValue::Integer(*tune)) set_config_or_default(
.map_err(|e| { &attrs,
error!("Failed to set {}: {e}", <&str>::from(name)); &mut *ctrl.config.lock().await,
}) power_plugged == 1,
.ok(); profile
} else { )
do_default = true; .await;
}
} else {
do_default = true;
}
if do_default {
let default = attr.default_value().clone();
attr.set_current_value(default)
.map_err(|e| {
error!("Failed to set {}: {e}", <&str>::from(name));
})
.ok();
}
}
}
} }
} }
} }

View File

@@ -13,6 +13,7 @@ use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
use config_traits::{StdConfig, StdConfigLoad1}; use config_traits::{StdConfig, StdConfigLoad1};
use log::{error, info}; use log::{error, info};
use rog_platform::platform::RogPlatform; use rog_platform::platform::RogPlatform;
use rog_platform::power::AsusPower;
use zbus::fdo::ObjectManager; use zbus::fdo::ObjectManager;
#[tokio::main] #[tokio::main]
@@ -67,7 +68,8 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
// supported.add_to_server(&mut connection).await; // supported.add_to_server(&mut connection).await;
let platform = RogPlatform::new()?; // TODO: maybe needs async mutex? let platform = RogPlatform::new()?; // TODO: maybe needs async mutex?
start_attributes_zbus(&server, platform, config.clone()).await?; let power = AsusPower::new()?; // TODO: maybe needs async mutex?
start_attributes_zbus(&server, platform, power, config.clone()).await?;
match CtrlFanCurveZbus::new() { match CtrlFanCurveZbus::new() {
Ok(ctrl) => { Ok(ctrl) => {

View File

@@ -20,7 +20,7 @@ fn main() {
CompilerConfiguration::new() CompilerConfiguration::new()
// .embed_resources(EmbedResourcesKind::EmbedFiles) // .embed_resources(EmbedResourcesKind::EmbedFiles)
.with_include_paths(vec![include]) .with_include_paths(vec![include])
.with_style("fluent-dark".into()) .with_style("fluent".into())
) )
.unwrap(); .unwrap();
} }

View File

@@ -132,6 +132,23 @@ macro_rules! setup_callback {
}; };
} }
// For handling callbacks from UI value changes
macro_rules! setup_callback_restore_default {
($property:ident, $handle:expr, $attr:expr) => {
let proxy_copy = $attr.clone();
concat_idents!(on_callback = on_cb_default_, $property {
$handle
.global::<SystemPageData>()
.on_callback(move || {
let proxy_copy = proxy_copy.clone();
tokio::spawn(async move {
proxy_copy.restore_default().await.ok();
});
});
});
};
}
macro_rules! setup_external { macro_rules! setup_external {
($property:ident, $type:tt, $handle:expr, $attr:expr, $value:expr) => {{ ($property:ident, $type:tt, $handle:expr, $attr:expr, $value:expr) => {{
// EXTERNAL CHANGES // EXTERNAL CHANGES
@@ -358,41 +375,49 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
FirmwareAttribute::PptPl1Spl => { FirmwareAttribute::PptPl1Spl => {
init_minmax_property!(ppt_pl1_spl, handle, attr); init_minmax_property!(ppt_pl1_spl, handle, attr);
setup_callback!(ppt_pl1_spl, handle, attr, i32); setup_callback!(ppt_pl1_spl, handle, attr, i32);
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform); setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
} }
FirmwareAttribute::PptPl2Sppt => { FirmwareAttribute::PptPl2Sppt => {
init_minmax_property!(ppt_pl2_sppt, handle, attr); init_minmax_property!(ppt_pl2_sppt, handle, attr);
setup_callback!(ppt_pl2_sppt, handle, attr, i32); setup_callback!(ppt_pl2_sppt, handle, attr, i32);
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform); setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
} }
FirmwareAttribute::PptPl3Fppt => { FirmwareAttribute::PptPl3Fppt => {
init_minmax_property!(ppt_pl3_fppt, handle, attr); init_minmax_property!(ppt_pl3_fppt, handle, attr);
setup_callback!(ppt_pl3_fppt, handle, attr, i32); setup_callback!(ppt_pl3_fppt, handle, attr, i32);
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform); setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
} }
FirmwareAttribute::PptFppt => { FirmwareAttribute::PptFppt => {
init_minmax_property!(ppt_fppt, handle, attr); init_minmax_property!(ppt_fppt, handle, attr);
setup_callback!(ppt_fppt, handle, attr, i32); setup_callback!(ppt_fppt, handle, attr, i32);
setup_callback_restore_default!(ppt_fppt, handle, attr);
setup_minmax_external!(ppt_fppt, handle, attr, platform); setup_minmax_external!(ppt_fppt, handle, attr, platform);
} }
FirmwareAttribute::PptApuSppt => { FirmwareAttribute::PptApuSppt => {
init_minmax_property!(ppt_apu_sppt, handle, attr); init_minmax_property!(ppt_apu_sppt, handle, attr);
setup_callback!(ppt_apu_sppt, handle, attr, i32); setup_callback!(ppt_apu_sppt, handle, attr, i32);
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform); setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
} }
FirmwareAttribute::PptPlatformSppt => { FirmwareAttribute::PptPlatformSppt => {
init_minmax_property!(ppt_platform_sppt, handle, attr); init_minmax_property!(ppt_platform_sppt, handle, attr);
setup_callback!(ppt_platform_sppt, handle, attr, i32); setup_callback!(ppt_platform_sppt, handle, attr, i32);
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform); setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
} }
FirmwareAttribute::NvDynamicBoost => { FirmwareAttribute::NvDynamicBoost => {
init_minmax_property!(nv_dynamic_boost, handle, attr); init_minmax_property!(nv_dynamic_boost, handle, attr);
setup_callback!(nv_dynamic_boost, handle, attr, i32); setup_callback!(nv_dynamic_boost, handle, attr, i32);
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform); setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
} }
FirmwareAttribute::NvTempTarget => { FirmwareAttribute::NvTempTarget => {
init_minmax_property!(nv_temp_target, handle, attr); init_minmax_property!(nv_temp_target, handle, attr);
setup_callback!(nv_temp_target, handle, attr, i32); setup_callback!(nv_temp_target, handle, attr, i32);
setup_callback_restore_default!(nv_temp_target, handle, attr);
setup_minmax_external!(nv_temp_target, handle, attr, platform); setup_minmax_external!(nv_temp_target, handle, attr, platform);
} }
FirmwareAttribute::DgpuBaseTgp => {} FirmwareAttribute::DgpuBaseTgp => {}

View File

@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-01-18 10:11+0000\n" "POT-Creation-Date: 2025-01-19 02:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -292,142 +292,198 @@ msgctxt "SystemPageData"
msgid "Power" msgid "Power"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:130 #: rog-control-center/ui/pages/system.slint:139
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Power settings" msgid "Power settings"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:135 #: rog-control-center/ui/pages/system.slint:144
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Charge limit" msgid "Charge limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:147 #: rog-control-center/ui/pages/system.slint:157
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy" msgid "Throttle Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:157 #: rog-control-center/ui/pages/system.slint:167
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Advanced" msgid "Advanced"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:175 #: rog-control-center/ui/pages/system.slint:185
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Armoury settings" msgid "Armoury settings"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:183 #: rog-control-center/ui/pages/system.slint:193
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Panel Overdrive" msgid "Panel Overdrive"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:191 #: rog-control-center/ui/pages/system.slint:201
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "MiniLED Mode" msgid "MiniLED Mode"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:199 #: rog-control-center/ui/pages/system.slint:209
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "POST boot sound" msgid "POST boot sound"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:210 #: rog-control-center/ui/pages/system.slint:223
msgctxt "PageSystem" msgctxt "no_asus_armoury_driver_2"
msgid "The asus-armoury driver is not loaded" msgid "The asus-armoury driver is not loaded"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:215 #: rog-control-center/ui/pages/system.slint:229
msgctxt "PageSystem" msgctxt "no_asus_armoury_driver_2"
msgid "For advanced features you will require a kernel with this driver added." msgid "For advanced features you will require a kernel with this driver added."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:226 #: rog-control-center/ui/pages/system.slint:240
msgctxt "ppt_warning" msgctxt "ppt_warning"
msgid "The following settings may not be safe, please take care." msgid "The following settings may not be safe, please review the help."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:231 #: rog-control-center/ui/pages/system.slint:245 rog-control-center/ui/pages/system.slint:246
msgctxt "ppt_pl1_spl" msgctxt "ppt_pl1_spl"
msgid "PL1, sustained power limit" msgid "CPU Sustained Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:242 #: rog-control-center/ui/pages/system.slint:247
msgctxt "ppt_pl1_spl_help"
msgid ""
"Long-term CPU power limit that affects sustained workload performance. "
"Higher values may increase heat and power consumption."
msgstr ""
#: rog-control-center/ui/pages/system.slint:262 rog-control-center/ui/pages/system.slint:263
msgctxt "ppt_pl2_sppt" msgctxt "ppt_pl2_sppt"
msgid "PL2, turbo power limit" msgid "CPU Turbo Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:253 #: rog-control-center/ui/pages/system.slint:264
msgctxt "ppt_pl2_sppt_help"
msgid ""
"Short-term CPU power limit for boost periods. Controls maximum power during "
"brief high-performance bursts."
msgstr ""
#: rog-control-center/ui/pages/system.slint:279 rog-control-center/ui/pages/system.slint:280
msgctxt "ppt_pl3_fppt" msgctxt "ppt_pl3_fppt"
msgid "PL3, Fast Power Limit" msgid "CPU Fast Burst Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:263 #: rog-control-center/ui/pages/system.slint:281
msgctxt "ppt_pl3_fppt_help"
msgid ""
"Ultra-short duration power limit for instantaneous CPU bursts. Affects "
"responsiveness during sudden workload spikes."
msgstr ""
#: rog-control-center/ui/pages/system.slint:295 rog-control-center/ui/pages/system.slint:296
msgctxt "ppt_fppt" msgctxt "ppt_fppt"
msgid "FPPT, Fast Power Limit" msgid "Fast Package Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:274 #: rog-control-center/ui/pages/system.slint:297
msgctxt "ppt_fppt_help"
msgid ""
"Ultra-short duration power limit for system package. Controls maximum power "
"during millisecond-scale load spikes."
msgstr ""
#: rog-control-center/ui/pages/system.slint:312 rog-control-center/ui/pages/system.slint:313
msgctxt "ppt_apu_sppt" msgctxt "ppt_apu_sppt"
msgid "SPPT, APU slow power limit" msgid "APU Sustained Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:285 #: rog-control-center/ui/pages/system.slint:314
msgctxt "ppt_apu_sppt_help"
msgid ""
"Long-term power limit for integrated graphics and CPU combined. Affects "
"sustained performance of APU-based workloads."
msgstr ""
#: rog-control-center/ui/pages/system.slint:329 rog-control-center/ui/pages/system.slint:330
msgctxt "ppt_platform_sppt" msgctxt "ppt_platform_sppt"
msgid "Slow package power tracking limit" msgid "Platform Sustained Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:296 #: rog-control-center/ui/pages/system.slint:331
msgctxt "ppt_platform_sppt_help"
msgid ""
"Overall system power limit for sustained operations. Controls total platform "
"power consumption over extended periods."
msgstr ""
#: rog-control-center/ui/pages/system.slint:346 rog-control-center/ui/pages/system.slint:347
msgctxt "nv_dynamic_boost" msgctxt "nv_dynamic_boost"
msgid "dGPU boost overclock" msgid "GPU Power Boost"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:307 #: rog-control-center/ui/pages/system.slint:348
msgctxt "nv_dynamic_boost_help"
msgid ""
"Additional power allocation for GPU dynamic boost. Higher values increase "
"GPU performance but generate more heat."
msgstr ""
#: rog-control-center/ui/pages/system.slint:363 rog-control-center/ui/pages/system.slint:364
msgctxt "nv_temp_target" msgctxt "nv_temp_target"
msgid "dGPU temperature max" msgid "GPU Temperature Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:354 #: rog-control-center/ui/pages/system.slint:365
msgctxt "nv_temp_target_help"
msgid ""
"Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain "
"temperature below this limit."
msgstr ""
#: rog-control-center/ui/pages/system.slint:416
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy" msgid "Energy Performance Preference linked to Throttle Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:358 #: rog-control-center/ui/pages/system.slint:420
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy" msgid "Change EPP based on Throttle Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:366 #: rog-control-center/ui/pages/system.slint:428
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "EPP for Balanced Policy" msgid "EPP for Balanced Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:376 #: rog-control-center/ui/pages/system.slint:438
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "EPP for Performance Policy" msgid "EPP for Performance Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:386 #: rog-control-center/ui/pages/system.slint:448
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "EPP for Quiet Policy" msgid "EPP for Quiet Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:404 #: rog-control-center/ui/pages/system.slint:466
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy for power state" msgid "Throttle Policy for power state"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:410 #: rog-control-center/ui/pages/system.slint:472
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy on Battery" msgid "Throttle Policy on Battery"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:420 rog-control-center/ui/pages/system.slint:441 #: rog-control-center/ui/pages/system.slint:482 rog-control-center/ui/pages/system.slint:503
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Enabled" msgid "Enabled"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:431 #: rog-control-center/ui/pages/system.slint:493
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy on AC" msgid "Throttle Policy on AC"
msgstr "" msgstr ""
@@ -667,6 +723,11 @@ msgctxt "AuraPowerGroupOld"
msgid "Sleep" msgid "Sleep"
msgstr "" msgstr ""
#: rog-control-center/ui/widgets/common.slint:133
msgctxt "confirm_reset"
msgid "Are you sure you want to reset this?"
msgstr ""
#: rog-control-center/ui/main_window.slint:51 #: rog-control-center/ui/main_window.slint:51
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "ROG" msgid "ROG"

View File

@@ -21,8 +21,8 @@ export component MainWindow inherits Window {
title: "ROG Control"; title: "ROG Control";
default-font-family: "DejaVu Sans"; default-font-family: "DejaVu Sans";
in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true]; in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true];
private property <bool> show-notif; private property <bool> show_notif;
private property <bool> fade-cover; private property <bool> fade_cover;
private property <bool> toast: false; private property <bool> toast: false;
private property <string> toast_text: "I show when something is waiting"; private property <string> toast_text: "I show when something is waiting";
callback show_toast(string); callback show_toast(string);
@@ -31,10 +31,10 @@ export component MainWindow inherits Window {
toast_text = text; toast_text = text;
} }
callback exit-app(); callback exit-app();
callback show-notification(bool); callback show_notification(bool);
show-notification(yes) => { show_notification(yes) => {
show-notif = yes; show_notif = yes;
fade-cover = yes; fade_cover = yes;
} }
callback external_colour_change(); callback external_colour_change();
external_colour_change() => { external_colour_change() => {
@@ -109,7 +109,7 @@ export component MainWindow inherits Window {
} }
} }
if fade-cover: Rectangle { if fade_cover: Rectangle {
x: 0px; x: 0px;
y: 0px; y: 0px;
width: root.width; width: root.width;
@@ -121,10 +121,10 @@ export component MainWindow inherits Window {
width: 100%; width: 100%;
clicked => { clicked => {
// toolbar-dropdown.close(); // toolbar-dropdown.close();
if (show-notif) { if (show_notif) {
show-notif = false; show_notif = false;
} }
fade-cover = false; fade_cover = false;
} }
} }
} }
@@ -156,7 +156,7 @@ export component MainWindow inherits Window {
} }
// // TODO: or use Dialogue // // TODO: or use Dialogue
if show-notif: Rectangle { if show_notif: Rectangle {
x: root.width / 8; x: root.width / 8;
y: root.height / 8; y: root.height / 8;
height: (root.height / 8) * 6; height: (root.height / 8) * 6;
@@ -165,7 +165,7 @@ export component MainWindow inherits Window {
height: 100%; height: 100%;
width: 100%; width: 100%;
clicked => { clicked => {
show-notif = false; show_notif = false;
exit-app(); exit-app();
} }
} }

View File

@@ -57,6 +57,7 @@ export global SystemPageData {
val: 20, val: 20,
}; };
callback cb_ppt_pl1_spl(int); callback cb_ppt_pl1_spl(int);
callback cb_default_ppt_pl1_spl();
in-out property <AttrMinMax> ppt_pl2_sppt: { in-out property <AttrMinMax> ppt_pl2_sppt: {
min: 0, min: 0,
@@ -64,6 +65,7 @@ export global SystemPageData {
val: 20, val: 20,
}; };
callback cb_ppt_pl2_sppt(int); callback cb_ppt_pl2_sppt(int);
callback cb_default_ppt_pl2_sppt();
in-out property <AttrMinMax> ppt_pl3_fppt: { in-out property <AttrMinMax> ppt_pl3_fppt: {
min: 0, min: 0,
@@ -71,6 +73,7 @@ export global SystemPageData {
val: 20, val: 20,
}; };
callback cb_ppt_pl3_fppt(int); callback cb_ppt_pl3_fppt(int);
callback cb_default_ppt_pl3_fppt();
in-out property <AttrMinMax> ppt_fppt: { in-out property <AttrMinMax> ppt_fppt: {
min: 0, min: 0,
@@ -78,6 +81,7 @@ export global SystemPageData {
val: 20, val: 20,
}; };
callback cb_ppt_fppt(int); callback cb_ppt_fppt(int);
callback cb_default_ppt_fppt();
in-out property <AttrMinMax> ppt_apu_sppt: { in-out property <AttrMinMax> ppt_apu_sppt: {
min: 0, min: 0,
@@ -85,6 +89,7 @@ export global SystemPageData {
val: 20, val: 20,
}; };
callback cb_ppt_apu_sppt(int); callback cb_ppt_apu_sppt(int);
callback cb_default_ppt_apu_sppt();
in-out property <AttrMinMax> ppt_platform_sppt: { in-out property <AttrMinMax> ppt_platform_sppt: {
min: 0, min: 0,
@@ -92,6 +97,7 @@ export global SystemPageData {
val: 20, val: 20,
}; };
callback cb_ppt_platform_sppt(int); callback cb_ppt_platform_sppt(int);
callback cb_default_ppt_platform_sppt();
in-out property <AttrMinMax> nv_dynamic_boost: { in-out property <AttrMinMax> nv_dynamic_boost: {
min: 0, min: 0,
@@ -99,6 +105,7 @@ export global SystemPageData {
val: 5, val: 5,
}; };
callback cb_nv_dynamic_boost(int); callback cb_nv_dynamic_boost(int);
callback cb_default_nv_dynamic_boost();
in-out property <AttrMinMax> nv_temp_target: { in-out property <AttrMinMax> nv_temp_target: {
min: 0, min: 0,
@@ -106,6 +113,7 @@ export global SystemPageData {
val: 75, val: 75,
}; };
callback cb_nv_temp_target(int); callback cb_nv_temp_target(int);
callback cb_default_nv_temp_target();
} }
export component PageSystem inherits Rectangle { export component PageSystem inherits Rectangle {
@@ -117,6 +125,7 @@ export component PageSystem inherits Rectangle {
VerticalLayout { VerticalLayout {
padding: 10px; padding: 10px;
spacing: 10px; spacing: 10px;
alignment: LayoutAlignment.start;
Rectangle { Rectangle {
background: Palette.alternate-background; background: Palette.alternate-background;
border-color: Palette.accent-background; border-color: Palette.accent-background;
@@ -135,8 +144,10 @@ export component PageSystem inherits Rectangle {
text: @tr("Charge limit"); text: @tr("Charge limit");
minimum: 20; minimum: 20;
maximum: 100; maximum: 100;
value <=> SystemPageData.charge_control_end_threshold; has_reset: false;
value: SystemPageData.charge_control_end_threshold;
released => { released => {
SystemPageData.charge_control_end_threshold = self.value;
SystemPageData.cb_charge_control_end_threshold(Math.round(SystemPageData.charge_control_end_threshold)) SystemPageData.cb_charge_control_end_threshold(Math.round(SystemPageData.charge_control_end_threshold))
} }
} }
@@ -205,33 +216,43 @@ export component PageSystem inherits Rectangle {
} }
if !SystemPageData.asus_armoury_loaded: Rectangle { if !SystemPageData.asus_armoury_loaded: Rectangle {
VerticalBox { border-width: 3px;
Text { border-color: red;
text: @tr("The asus-armoury driver is not loaded"); max-height: 30px;
font-size: 16px; VerticalBox {
horizontal-alignment: TextHorizontalAlignment.center; Text {
text: @tr("no_asus_armoury_driver_2" => "The asus-armoury driver is not loaded");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
Text {
text: @tr("no_asus_armoury_driver_2" => "For advanced features you will require a kernel with this driver added.");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
} }
Text {
text: @tr("For advanced features you will require a kernel with this driver added.");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
}
} }
if SystemPageData.ppt_pl1_spl.val != -1: Rectangle { if SystemPageData.ppt_pl1_spl.val != -1: Rectangle {
height: 32px; height: 32px;
Text { Text {
font-size: 16px; font-size: 16px;
text: @tr("ppt_warning" => "The following settings may not be safe, please take care."); text: @tr("ppt_warning" => "The following settings may not be safe, please review the help.");
} }
} }
if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider { if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider {
text: @tr("ppt_pl1_spl" => "PL1, sustained power limit"); 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; minimum: SystemPageData.ppt_pl1_spl.min;
maximum: SystemPageData.ppt_pl1_spl.max; maximum: SystemPageData.ppt_pl1_spl.max;
value: SystemPageData.ppt_pl1_spl.val; value: SystemPageData.ppt_pl1_spl.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_pl1_spl();
}
released => { released => {
SystemPageData.ppt_pl1_spl.val = self.value; SystemPageData.ppt_pl1_spl.val = self.value;
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value)) SystemPageData.cb_ppt_pl1_spl(Math.round(self.value))
@@ -239,10 +260,16 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.ppt_pl2_sppt.val != -1: SystemSlider { if SystemPageData.ppt_pl2_sppt.val != -1: SystemSlider {
text: @tr("ppt_pl2_sppt" => "PL2, turbo power limit"); 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; minimum: SystemPageData.ppt_pl2_sppt.min;
maximum: SystemPageData.ppt_pl2_sppt.max; maximum: SystemPageData.ppt_pl2_sppt.max;
value: SystemPageData.ppt_pl2_sppt.val; value: SystemPageData.ppt_pl2_sppt.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_pl2_sppt();
}
released => { released => {
SystemPageData.ppt_pl2_sppt.val = self.value; SystemPageData.ppt_pl2_sppt.val = self.value;
SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value)) SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value))
@@ -250,20 +277,32 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.ppt_pl3_fppt.val != -1: SystemSlider { if SystemPageData.ppt_pl3_fppt.val != -1: SystemSlider {
text: @tr("ppt_pl3_fppt" => "PL3, Fast Power Limit"); 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; minimum: SystemPageData.ppt_pl3_fppt.min;
maximum: SystemPageData.ppt_pl3_fppt.max; maximum: SystemPageData.ppt_pl3_fppt.max;
value: SystemPageData.ppt_pl3_fppt.val; value: SystemPageData.ppt_pl3_fppt.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_pl3_fppt();
}
released => { released => {
SystemPageData.ppt_pl3_fppt.val = self.value; SystemPageData.ppt_pl3_fppt.val = self.value;
SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value)) SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value))
} }
} }
if SystemPageData.ppt_fppt.val != -1: SystemSlider { if SystemPageData.ppt_fppt.val != -1: SystemSlider {
text: @tr("ppt_fppt" => "FPPT, Fast Power Limit"); 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; minimum: SystemPageData.ppt_fppt.min;
maximum: SystemPageData.ppt_fppt.max; maximum: SystemPageData.ppt_fppt.max;
value: SystemPageData.ppt_fppt.val; value: SystemPageData.ppt_fppt.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_fppt();
}
released => { released => {
SystemPageData.ppt_fppt.val = self.value; SystemPageData.ppt_fppt.val = self.value;
SystemPageData.cb_ppt_fppt(Math.round(self.value)) SystemPageData.cb_ppt_fppt(Math.round(self.value))
@@ -271,10 +310,16 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.ppt_apu_sppt.val != -1: SystemSlider { if SystemPageData.ppt_apu_sppt.val != -1: SystemSlider {
text: @tr("ppt_apu_sppt" => "SPPT, APU slow power limit"); 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; minimum: SystemPageData.ppt_apu_sppt.min;
maximum: SystemPageData.ppt_apu_sppt.max; maximum: SystemPageData.ppt_apu_sppt.max;
value: SystemPageData.ppt_apu_sppt.val; value: SystemPageData.ppt_apu_sppt.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_apu_sppt();
}
released => { released => {
SystemPageData.ppt_apu_sppt.val = self.value; SystemPageData.ppt_apu_sppt.val = self.value;
SystemPageData.cb_ppt_apu_sppt(Math.round(self.value)) SystemPageData.cb_ppt_apu_sppt(Math.round(self.value))
@@ -282,10 +327,16 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.ppt_platform_sppt.val != -1: SystemSlider { if SystemPageData.ppt_platform_sppt.val != -1: SystemSlider {
text: @tr("ppt_platform_sppt" => "Slow package power tracking limit"); 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; minimum: SystemPageData.ppt_platform_sppt.min;
maximum: SystemPageData.ppt_platform_sppt.max; maximum: SystemPageData.ppt_platform_sppt.max;
value: SystemPageData.ppt_platform_sppt.val; value: SystemPageData.ppt_platform_sppt.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_ppt_platform_sppt();
}
released => { released => {
SystemPageData.ppt_platform_sppt.val = self.value; SystemPageData.ppt_platform_sppt.val = self.value;
SystemPageData.cb_ppt_platform_sppt(Math.round(self.value)) SystemPageData.cb_ppt_platform_sppt(Math.round(self.value))
@@ -293,10 +344,16 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.nv_dynamic_boost.val != -1: SystemSlider { if SystemPageData.nv_dynamic_boost.val != -1: SystemSlider {
text: @tr("nv_dynamic_boost" => "dGPU boost overclock"); 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; minimum: SystemPageData.nv_dynamic_boost.min;
maximum: SystemPageData.nv_dynamic_boost.max; maximum: SystemPageData.nv_dynamic_boost.max;
value: SystemPageData.nv_dynamic_boost.val; value: SystemPageData.nv_dynamic_boost.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_nv_dynamic_boost();
}
released => { released => {
SystemPageData.nv_dynamic_boost.val = self.value; SystemPageData.nv_dynamic_boost.val = self.value;
SystemPageData.cb_nv_dynamic_boost(Math.round(self.value)) SystemPageData.cb_nv_dynamic_boost(Math.round(self.value))
@@ -304,10 +361,16 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.nv_temp_target.val != -1: SystemSlider { if SystemPageData.nv_temp_target.val != -1: SystemSlider {
text: @tr("nv_temp_target" => "dGPU temperature max"); 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; minimum: SystemPageData.nv_temp_target.min;
maximum: SystemPageData.nv_temp_target.max; maximum: SystemPageData.nv_temp_target.max;
value: SystemPageData.nv_temp_target.val; value: SystemPageData.nv_temp_target.val;
has_reset: true;
cb_do_reset => {
SystemPageData.cb_default_nv_temp_target();
}
released => { released => {
SystemPageData.nv_temp_target.val = self.value; SystemPageData.nv_temp_target.val = self.value;
SystemPageData.cb_nv_temp_target(Math.round(self.value)) SystemPageData.cb_nv_temp_target(Math.round(self.value))

View File

@@ -10,40 +10,46 @@ export component RogItem inherits Rectangle {
} }
export component SystemSlider inherits RogItem { export component SystemSlider inherits RogItem {
in property <string> title;
in property <string> text; in property <string> text;
in-out property <float> value; in-out property <float> value;
in-out property <float> minimum; in-out property <float> minimum;
in-out property <float> maximum; in-out property <float> maximum;
callback released(int); callback released(int);
in-out property <string> help_text;
in-out property <bool> has_reset: false;
callback cb_do_reset();
HorizontalLayout { HorizontalLayout {
HorizontalLayout { HorizontalLayout {
width: 50%; width: 40%;
alignment: LayoutAlignment.stretch; alignment: LayoutAlignment.stretch;
padding-left: 10px; padding-left: 10px;
TouchArea { TouchArea {
clicked => { clicked => {
slider.value += 1; slider.value += 1;
if slider.value > slider.maximum { if slider.value > slider.maximum {
slider.value = slider.minimum; slider.value = slider.minimum;
}
} }
} HorizontalLayout {
HorizontalLayout { spacing: 6px;
spacing: 6px; Text {
Text { font-size: 16px;
font-size: 16px; vertical-alignment: TextVerticalAlignment.center;
vertical-alignment: TextVerticalAlignment.center; color: Palette.control-foreground;
color: Palette.control-foreground; text <=> root.text;
text <=> root.text; }
Text {
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.right;
vertical-alignment: TextVerticalAlignment.center;
color: Palette.control-foreground;
text: "\{Math.round(root.value)}";
}
} }
Text {
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.right;
vertical-alignment: TextVerticalAlignment.center;
color: Palette.control-foreground;
text: "\{Math.round(root.value)}";
}
}
} }
} }
@@ -59,6 +65,96 @@ export component SystemSlider inherits RogItem {
} }
} }
} }
help_popup := PopupWindow {
x: help.x - self.width + help.width - 10px;
y: help.y - self.height + help.height - 10px;
Rectangle {
drop-shadow-blur: 10px;
drop-shadow-color: black;
border-radius: 10px;
border-color: Palette.accent-background;
background: Palette.background;
Dialog {
title <=> root.title;
VerticalBox {
Text {
max-width: 420px;
font-size: 18px;
wrap: TextWrap.word-wrap;
horizontal-alignment: TextHorizontalAlignment.center;
text <=> root.title;
}
Rectangle {
height: 1px;
border-color: black;
border-width: 1px;
}
Text {
max-width: 420px;
font-size: 16px;
wrap: TextWrap.word-wrap;
text <=> root.help_text;
}
}
StandardButton {
kind: ok;
}
}
}
}
help := HorizontalBox {
if (help_text != ""): StandardButton {
kind: StandardButtonKind.help;
clicked => {
help_popup.show();
}
}
}
reset_popup := PopupWindow {
x: reset.x - self.width + reset.width;
y: reset.y - self.height + reset.height;
Rectangle {
drop-shadow-blur: 10px;
drop-shadow-color: black;
border-radius: 10px;
border-color: Palette.accent-background;
background: Palette.background;
Dialog {
Text {
max-width: 420px;
font-size: 16px;
wrap: TextWrap.word-wrap;
text: @tr("confirm_reset" => "Are you sure you want to reset this?");
}
StandardButton {
kind: ok;
clicked => {
root.cb_do_reset();
}
}
StandardButton {
kind: cancel;
}
}
}
}
reset := HorizontalBox {
if (has_reset): StandardButton {
kind: StandardButtonKind.reset;
clicked => {
reset_popup.show();
}
}
}
} }
} }
@@ -114,7 +210,7 @@ export component SystemToggleInt inherits RogItem {
alignment: LayoutAlignment.end; alignment: LayoutAlignment.end;
padding-right: 20px; padding-right: 20px;
Switch { Switch {
checked: root.checked_int != 0; checked: root.checked_int != 0;
toggled => { toggled => {
root.checked_int = self.checked ? 1 : 0; root.checked_int = self.checked ? 1 : 0;
root.toggled(root.checked_int); root.toggled(root.checked_int);

View File

@@ -48,4 +48,6 @@ pub trait AsusArmoury {
/// take. Returns `-1` if not used or set. /// take. Returns `-1` if not used or set.
#[zbus(property)] #[zbus(property)]
fn scalar_increment(&self) -> zbus::Result<i32>; fn scalar_increment(&self) -> zbus::Result<i32>;
async fn restore_default(&self) -> zbus::Result<()>;
} }

View File

@@ -76,11 +76,11 @@ impl Attribute {
} }
/// Write the `current_value` directly to the attribute path /// Write the `current_value` directly to the attribute path
pub fn set_current_value(&self, new_value: AttrValue) -> Result<(), PlatformError> { pub fn set_current_value(&self, new_value: &AttrValue) -> Result<(), PlatformError> {
let path = self.base_path.join("current_value"); let path = self.base_path.join("current_value");
let value_str = match new_value { let value_str = match new_value {
AttrValue::Integer(val) => val.to_string(), AttrValue::Integer(val) => &val.to_string(),
AttrValue::String(val) => val, AttrValue::String(val) => val,
_ => return Err(PlatformError::InvalidValue) _ => return Err(PlatformError::InvalidValue)
}; };
@@ -94,6 +94,10 @@ impl Attribute {
&self.default_value &self.default_value
} }
pub fn restore_default(&self) -> Result<(), PlatformError> {
self.set_current_value(&self.default_value)
}
pub fn possible_values(&self) -> &AttrValue { pub fn possible_values(&self) -> &AttrValue {
&self.possible_values &self.possible_values
} }
@@ -178,6 +182,7 @@ impl Attribute {
} }
} }
#[derive(Clone)]
pub struct FirmwareAttributes { pub struct FirmwareAttributes {
attrs: Vec<Attribute> attrs: Vec<Attribute>
} }
@@ -452,6 +457,6 @@ mod tests {
if let AttrValue::Integer(val) = &mut val { if let AttrValue::Integer(val) = &mut val {
*val = 0; *val = 0;
} }
attr.set_current_value(val).unwrap(); attr.set_current_value(&val).unwrap();
} }
} }