mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
450205f9a9 | ||
|
|
82431ee25b | ||
|
|
f11aea02a8 | ||
|
|
2d6d669c22 | ||
|
|
f9cebf9221 |
@@ -2,6 +2,14 @@
|
||||
|
||||
## [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]
|
||||
|
||||
### Changed
|
||||
|
||||
28
Cargo.lock
generated
28
Cargo.lock
generated
@@ -176,7 +176,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"env_logger",
|
||||
@@ -195,7 +195,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
@@ -221,7 +221,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd-user"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"config-traits",
|
||||
"dirs",
|
||||
@@ -901,7 +901,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "config-traits"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ron",
|
||||
@@ -1293,7 +1293,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dmi_id"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"udev 0.8.0",
|
||||
@@ -4092,7 +4092,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"concat-idents",
|
||||
@@ -4122,7 +4122,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"gif 0.12.0",
|
||||
@@ -4136,7 +4136,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"log",
|
||||
@@ -4147,7 +4147,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"rog_anime",
|
||||
@@ -4161,7 +4161,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"concat-idents",
|
||||
"inotify",
|
||||
@@ -4174,7 +4174,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_platform",
|
||||
@@ -4185,7 +4185,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_scsi"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"ron",
|
||||
"serde",
|
||||
@@ -4195,7 +4195,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_simulators"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_anime",
|
||||
@@ -4205,7 +4205,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_slash"
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"serde",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[workspace.package]
|
||||
version = "6.1.0-rc4"
|
||||
version = "6.1.0-rc5"
|
||||
rust-version = "1.82"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -96,6 +96,9 @@ pub struct GraphicsCommand {
|
||||
pub struct ArmouryCommand {
|
||||
#[options(help = "print help message")]
|
||||
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>
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use aura_cli::{LedPowerCommand1, LedPowerCommand2};
|
||||
use dmi_id::DMIID;
|
||||
use fan_curve_cli::FanCurveCommand;
|
||||
use gumdrop::{Opt, Options};
|
||||
use log::error;
|
||||
use log::{error, info};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
|
||||
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() {
|
||||
let name = attr.name()?;
|
||||
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)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::collections::HashMap;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -7,6 +6,7 @@ use config_traits::StdConfig;
|
||||
use log::{debug, error, info};
|
||||
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
|
||||
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
|
||||
use rog_platform::power::AsusPower;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zbus::object_server::SignalEmitter;
|
||||
use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
|
||||
@@ -33,15 +33,22 @@ pub struct AsusArmouryAttribute {
|
||||
attr: Attribute,
|
||||
config: Arc<Mutex<Config>>,
|
||||
/// platform control required here for access to PPD or Throttle profile
|
||||
platform: RogPlatform
|
||||
platform: RogPlatform,
|
||||
power: AsusPower
|
||||
}
|
||||
|
||||
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 {
|
||||
attr,
|
||||
config,
|
||||
platform
|
||||
platform,
|
||||
power
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,10 +102,23 @@ impl crate::Reloadable for AsusArmouryAttribute {
|
||||
info!("Reloading {}", self.attr.name());
|
||||
let profile: ThrottlePolicy =
|
||||
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()) {
|
||||
self.attr
|
||||
.set_current_value(AttrValue::Integer(*tune))
|
||||
.set_current_value(&AttrValue::Integer(*tune))
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {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)]
|
||||
async fn min_value(&self) -> i32 {
|
||||
match self.attr.min_value() {
|
||||
@@ -204,7 +250,7 @@ impl AsusArmouryAttribute {
|
||||
#[zbus(property)]
|
||||
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
|
||||
self.attr
|
||||
.set_current_value(AttrValue::Integer(value))
|
||||
.set_current_value(&AttrValue::Integer(value))
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {e:?}");
|
||||
e
|
||||
@@ -214,29 +260,21 @@ impl AsusArmouryAttribute {
|
||||
let profile: ThrottlePolicy =
|
||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
||||
|
||||
// var here to prevent async deadlock on else clause
|
||||
let has_profile = self
|
||||
.config
|
||||
.lock()
|
||||
.await
|
||||
.profile_tunings
|
||||
.contains_key(&profile);
|
||||
if has_profile {
|
||||
if let Some(tunings) = self.config.lock().await.profile_tunings.get_mut(&profile) {
|
||||
if let Some(tune) = tunings.get_mut(&self.name()) {
|
||||
*tune = value;
|
||||
} else {
|
||||
tunings.insert(self.name(), value);
|
||||
debug!("Set tuning config for {} = {:?}", self.attr.name(), value);
|
||||
}
|
||||
}
|
||||
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()) {
|
||||
*tune = value;
|
||||
} else {
|
||||
debug!("Adding tuning config for {}", profile);
|
||||
self.config
|
||||
.lock()
|
||||
.await
|
||||
.profile_tunings
|
||||
.insert(profile, HashMap::from([(self.name(), value)]));
|
||||
tunings.insert(self.name(), value);
|
||||
debug!("Set tuning config for {} = {:?}", self.attr.name(), value);
|
||||
}
|
||||
} else {
|
||||
@@ -274,10 +312,16 @@ impl AsusArmouryAttribute {
|
||||
pub async fn start_attributes_zbus(
|
||||
conn: &Connection,
|
||||
platform: RogPlatform,
|
||||
power: AsusPower,
|
||||
config: Arc<Mutex<Config>>
|
||||
) -> Result<(), RogError> {
|
||||
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?;
|
||||
|
||||
let path = dbus_path_for_attr(attr.attr.name());
|
||||
@@ -288,3 +332,41 @@ pub async fn start_attributes_zbus(
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use rog_platform::platform::ThrottlePolicy;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
const CONFIG_FILE: &str = "asusd.ron";
|
||||
type Tunings = HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>;
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq)]
|
||||
pub struct Config {
|
||||
@@ -37,13 +38,29 @@ pub struct Config {
|
||||
pub throttle_balanced_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
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>,
|
||||
/// Temporary state for AC/Batt
|
||||
#[serde(skip)]
|
||||
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 {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
@@ -60,7 +77,8 @@ impl Default for Config {
|
||||
throttle_quiet_epp: CPUEPP::Power,
|
||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
||||
throttle_performance_epp: CPUEPP::Performance,
|
||||
profile_tunings: HashMap::default(),
|
||||
ac_profile_tunings: HashMap::default(),
|
||||
dc_profile_tunings: HashMap::default(),
|
||||
armoury_settings: HashMap::default(),
|
||||
last_power_plugged: Default::default()
|
||||
}
|
||||
@@ -148,7 +166,8 @@ impl From<Config601> for Config {
|
||||
throttle_balanced_epp: c.throttle_balanced_epp,
|
||||
throttle_performance_epp: c.throttle_performance_epp,
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
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::platform::{Properties, RogPlatform, ThrottlePolicy};
|
||||
use rog_platform::power::AsusPower;
|
||||
@@ -14,6 +14,7 @@ use zbus::fdo::Error as FdoErr;
|
||||
use zbus::object_server::SignalEmitter;
|
||||
use zbus::{interface, Connection};
|
||||
|
||||
use crate::asus_armoury::set_config_or_default;
|
||||
use crate::config::Config;
|
||||
use crate::error::RogError;
|
||||
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 {
|
||||
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)
|
||||
.await
|
||||
.ok();
|
||||
for attr in attrs.attributes().iter() {
|
||||
let name: FirmwareAttribute = attr.name().into();
|
||||
if name.is_ppt() {
|
||||
let mut do_default = false;
|
||||
if let Some(tunings) =
|
||||
ctrl.config.lock().await.profile_tunings.get(&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 {
|
||||
do_default = true;
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
let power_plugged = ctrl
|
||||
.power
|
||||
.get_online()
|
||||
.map_err(|e| {
|
||||
error!("Could not get power status: {e:?}");
|
||||
e
|
||||
})
|
||||
.unwrap_or_default();
|
||||
set_config_or_default(
|
||||
&attrs,
|
||||
&mut *ctrl.config.lock().await,
|
||||
power_plugged == 1,
|
||||
profile
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
|
||||
use config_traits::{StdConfig, StdConfigLoad1};
|
||||
use log::{error, info};
|
||||
use rog_platform::platform::RogPlatform;
|
||||
use rog_platform::power::AsusPower;
|
||||
use zbus::fdo::ObjectManager;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -67,7 +68,8 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
// supported.add_to_server(&mut connection).await;
|
||||
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() {
|
||||
Ok(ctrl) => {
|
||||
|
||||
@@ -20,7 +20,7 @@ fn main() {
|
||||
CompilerConfiguration::new()
|
||||
// .embed_resources(EmbedResourcesKind::EmbedFiles)
|
||||
.with_include_paths(vec![include])
|
||||
.with_style("fluent-dark".into())
|
||||
.with_style("fluent".into())
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
($property:ident, $type:tt, $handle:expr, $attr:expr, $value:expr) => {{
|
||||
// EXTERNAL CHANGES
|
||||
@@ -358,41 +375,49 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
FirmwareAttribute::PptPl1Spl => {
|
||||
init_minmax_property!(ppt_pl1_spl, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::PptPl2Sppt => {
|
||||
init_minmax_property!(ppt_pl2_sppt, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::PptPl3Fppt => {
|
||||
init_minmax_property!(ppt_pl3_fppt, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::PptFppt => {
|
||||
init_minmax_property!(ppt_fppt, handle, attr);
|
||||
setup_callback!(ppt_fppt, handle, attr, i32);
|
||||
setup_callback_restore_default!(ppt_fppt, handle, attr);
|
||||
setup_minmax_external!(ppt_fppt, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::PptApuSppt => {
|
||||
init_minmax_property!(ppt_apu_sppt, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::PptPlatformSppt => {
|
||||
init_minmax_property!(ppt_platform_sppt, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::NvDynamicBoost => {
|
||||
init_minmax_property!(nv_dynamic_boost, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::NvTempTarget => {
|
||||
init_minmax_property!(nv_temp_target, handle, attr);
|
||||
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);
|
||||
}
|
||||
FirmwareAttribute::DgpuBaseTgp => {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -292,142 +292,198 @@ msgctxt "SystemPageData"
|
||||
msgid "Power"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:130
|
||||
#: rog-control-center/ui/pages/system.slint:139
|
||||
msgctxt "PageSystem"
|
||||
msgid "Power settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:135
|
||||
#: rog-control-center/ui/pages/system.slint:144
|
||||
msgctxt "PageSystem"
|
||||
msgid "Charge limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:147
|
||||
#: rog-control-center/ui/pages/system.slint:157
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:157
|
||||
#: rog-control-center/ui/pages/system.slint:167
|
||||
msgctxt "PageSystem"
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:175
|
||||
#: rog-control-center/ui/pages/system.slint:185
|
||||
msgctxt "PageSystem"
|
||||
msgid "Armoury settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:183
|
||||
#: rog-control-center/ui/pages/system.slint:193
|
||||
msgctxt "PageSystem"
|
||||
msgid "Panel Overdrive"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:191
|
||||
#: rog-control-center/ui/pages/system.slint:201
|
||||
msgctxt "PageSystem"
|
||||
msgid "MiniLED Mode"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:199
|
||||
#: rog-control-center/ui/pages/system.slint:209
|
||||
msgctxt "PageSystem"
|
||||
msgid "POST boot sound"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:210
|
||||
msgctxt "PageSystem"
|
||||
#: rog-control-center/ui/pages/system.slint:223
|
||||
msgctxt "no_asus_armoury_driver_2"
|
||||
msgid "The asus-armoury driver is not loaded"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:215
|
||||
msgctxt "PageSystem"
|
||||
#: rog-control-center/ui/pages/system.slint:229
|
||||
msgctxt "no_asus_armoury_driver_2"
|
||||
msgid "For advanced features you will require a kernel with this driver added."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:226
|
||||
#: rog-control-center/ui/pages/system.slint:240
|
||||
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 ""
|
||||
|
||||
#: 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"
|
||||
msgid "PL1, sustained power limit"
|
||||
msgid "CPU Sustained Power Limit"
|
||||
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"
|
||||
msgid "PL2, turbo power limit"
|
||||
msgid "CPU Turbo Power Limit"
|
||||
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"
|
||||
msgid "PL3, Fast Power Limit"
|
||||
msgid "CPU Fast Burst Power Limit"
|
||||
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"
|
||||
msgid "FPPT, Fast Power Limit"
|
||||
msgid "Fast Package Power Limit"
|
||||
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"
|
||||
msgid "SPPT, APU slow power limit"
|
||||
msgid "APU Sustained Power Limit"
|
||||
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"
|
||||
msgid "Slow package power tracking limit"
|
||||
msgid "Platform Sustained Power Limit"
|
||||
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"
|
||||
msgid "dGPU boost overclock"
|
||||
msgid "GPU Power Boost"
|
||||
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"
|
||||
msgid "dGPU temperature max"
|
||||
msgid "GPU Temperature Limit"
|
||||
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"
|
||||
msgid "Energy Performance Preference linked to Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:358
|
||||
#: rog-control-center/ui/pages/system.slint:420
|
||||
msgctxt "PageSystem"
|
||||
msgid "Change EPP based on Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:366
|
||||
#: rog-control-center/ui/pages/system.slint:428
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Balanced Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:376
|
||||
#: rog-control-center/ui/pages/system.slint:438
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Performance Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:386
|
||||
#: rog-control-center/ui/pages/system.slint:448
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Quiet Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:404
|
||||
#: rog-control-center/ui/pages/system.slint:466
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy for power state"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:410
|
||||
#: rog-control-center/ui/pages/system.slint:472
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on Battery"
|
||||
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"
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:431
|
||||
#: rog-control-center/ui/pages/system.slint:493
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on AC"
|
||||
msgstr ""
|
||||
@@ -667,6 +723,11 @@ msgctxt "AuraPowerGroupOld"
|
||||
msgid "Sleep"
|
||||
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
|
||||
msgctxt "MainWindow"
|
||||
msgid "ROG"
|
||||
|
||||
@@ -21,8 +21,8 @@ export component MainWindow inherits Window {
|
||||
title: "ROG Control";
|
||||
default-font-family: "DejaVu Sans";
|
||||
in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true];
|
||||
private property <bool> show-notif;
|
||||
private property <bool> fade-cover;
|
||||
private property <bool> show_notif;
|
||||
private property <bool> fade_cover;
|
||||
private property <bool> toast: false;
|
||||
private property <string> toast_text: "I show when something is waiting";
|
||||
callback show_toast(string);
|
||||
@@ -31,10 +31,10 @@ export component MainWindow inherits Window {
|
||||
toast_text = text;
|
||||
}
|
||||
callback exit-app();
|
||||
callback show-notification(bool);
|
||||
show-notification(yes) => {
|
||||
show-notif = yes;
|
||||
fade-cover = yes;
|
||||
callback show_notification(bool);
|
||||
show_notification(yes) => {
|
||||
show_notif = yes;
|
||||
fade_cover = yes;
|
||||
}
|
||||
callback 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;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
@@ -121,10 +121,10 @@ export component MainWindow inherits Window {
|
||||
width: 100%;
|
||||
clicked => {
|
||||
// toolbar-dropdown.close();
|
||||
if (show-notif) {
|
||||
show-notif = false;
|
||||
if (show_notif) {
|
||||
show_notif = false;
|
||||
}
|
||||
fade-cover = false;
|
||||
fade_cover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
|
||||
// // TODO: or use Dialogue
|
||||
if show-notif: Rectangle {
|
||||
if show_notif: Rectangle {
|
||||
x: root.width / 8;
|
||||
y: root.height / 8;
|
||||
height: (root.height / 8) * 6;
|
||||
@@ -165,7 +165,7 @@ export component MainWindow inherits Window {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
clicked => {
|
||||
show-notif = false;
|
||||
show_notif = false;
|
||||
exit-app();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_pl1_spl(int);
|
||||
callback cb_default_ppt_pl1_spl();
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl2_sppt: {
|
||||
min: 0,
|
||||
@@ -64,6 +65,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_pl2_sppt(int);
|
||||
callback cb_default_ppt_pl2_sppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl3_fppt: {
|
||||
min: 0,
|
||||
@@ -71,6 +73,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_pl3_fppt(int);
|
||||
callback cb_default_ppt_pl3_fppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_fppt: {
|
||||
min: 0,
|
||||
@@ -78,6 +81,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_fppt(int);
|
||||
callback cb_default_ppt_fppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_apu_sppt: {
|
||||
min: 0,
|
||||
@@ -85,6 +89,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_apu_sppt(int);
|
||||
callback cb_default_ppt_apu_sppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_platform_sppt: {
|
||||
min: 0,
|
||||
@@ -92,6 +97,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_platform_sppt(int);
|
||||
callback cb_default_ppt_platform_sppt();
|
||||
|
||||
in-out property <AttrMinMax> nv_dynamic_boost: {
|
||||
min: 0,
|
||||
@@ -99,6 +105,7 @@ export global SystemPageData {
|
||||
val: 5,
|
||||
};
|
||||
callback cb_nv_dynamic_boost(int);
|
||||
callback cb_default_nv_dynamic_boost();
|
||||
|
||||
in-out property <AttrMinMax> nv_temp_target: {
|
||||
min: 0,
|
||||
@@ -106,6 +113,7 @@ export global SystemPageData {
|
||||
val: 75,
|
||||
};
|
||||
callback cb_nv_temp_target(int);
|
||||
callback cb_default_nv_temp_target();
|
||||
}
|
||||
|
||||
export component PageSystem inherits Rectangle {
|
||||
@@ -117,6 +125,7 @@ export component PageSystem inherits Rectangle {
|
||||
VerticalLayout {
|
||||
padding: 10px;
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
Rectangle {
|
||||
background: Palette.alternate-background;
|
||||
border-color: Palette.accent-background;
|
||||
@@ -135,8 +144,10 @@ export component PageSystem inherits Rectangle {
|
||||
text: @tr("Charge limit");
|
||||
minimum: 20;
|
||||
maximum: 100;
|
||||
value <=> SystemPageData.charge_control_end_threshold;
|
||||
has_reset: false;
|
||||
value: SystemPageData.charge_control_end_threshold;
|
||||
released => {
|
||||
SystemPageData.charge_control_end_threshold = self.value;
|
||||
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 {
|
||||
VerticalBox {
|
||||
Text {
|
||||
text: @tr("The asus-armoury driver is not loaded");
|
||||
font-size: 16px;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
border-width: 3px;
|
||||
border-color: red;
|
||||
max-height: 30px;
|
||||
VerticalBox {
|
||||
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 {
|
||||
height: 32px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
text: @tr("ppt_warning" => "The following settings may not be safe, please take care.");
|
||||
}
|
||||
height: 32px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
text: @tr("ppt_warning" => "The following settings may not be safe, please review the help.");
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
maximum: SystemPageData.ppt_pl1_spl.max;
|
||||
value: SystemPageData.ppt_pl1_spl.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl1_spl();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl1_spl.val = 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 {
|
||||
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;
|
||||
maximum: SystemPageData.ppt_pl2_sppt.max;
|
||||
value: SystemPageData.ppt_pl2_sppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl2_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl2_sppt.val = 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 {
|
||||
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;
|
||||
maximum: SystemPageData.ppt_pl3_fppt.max;
|
||||
value: SystemPageData.ppt_pl3_fppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl3_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl3_fppt.val = self.value;
|
||||
SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
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;
|
||||
maximum: SystemPageData.ppt_fppt.max;
|
||||
value: SystemPageData.ppt_fppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_fppt.val = 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 {
|
||||
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;
|
||||
maximum: SystemPageData.ppt_apu_sppt.max;
|
||||
value: SystemPageData.ppt_apu_sppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_apu_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_apu_sppt.val = 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 {
|
||||
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;
|
||||
maximum: SystemPageData.ppt_platform_sppt.max;
|
||||
value: SystemPageData.ppt_platform_sppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_platform_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_platform_sppt.val = 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 {
|
||||
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;
|
||||
maximum: SystemPageData.nv_dynamic_boost.max;
|
||||
value: SystemPageData.nv_dynamic_boost.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_dynamic_boost();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_dynamic_boost.val = 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 {
|
||||
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;
|
||||
maximum: SystemPageData.nv_temp_target.max;
|
||||
value: SystemPageData.nv_temp_target.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_temp_target();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_temp_target.val = self.value;
|
||||
SystemPageData.cb_nv_temp_target(Math.round(self.value))
|
||||
|
||||
@@ -10,40 +10,46 @@ export component RogItem inherits Rectangle {
|
||||
}
|
||||
|
||||
export component SystemSlider inherits RogItem {
|
||||
in property <string> title;
|
||||
in property <string> text;
|
||||
in-out property <float> value;
|
||||
in-out property <float> minimum;
|
||||
in-out property <float> maximum;
|
||||
callback released(int);
|
||||
|
||||
in-out property <string> help_text;
|
||||
in-out property <bool> has_reset: false;
|
||||
callback cb_do_reset();
|
||||
|
||||
HorizontalLayout {
|
||||
HorizontalLayout {
|
||||
width: 50%;
|
||||
width: 40%;
|
||||
alignment: LayoutAlignment.stretch;
|
||||
padding-left: 10px;
|
||||
TouchArea {
|
||||
clicked => {
|
||||
slider.value += 1;
|
||||
if slider.value > slider.maximum {
|
||||
slider.value = slider.minimum;
|
||||
clicked => {
|
||||
slider.value += 1;
|
||||
if slider.value > slider.maximum {
|
||||
slider.value = slider.minimum;
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: 6px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
color: Palette.control-foreground;
|
||||
text <=> root.text;
|
||||
HorizontalLayout {
|
||||
spacing: 6px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
color: Palette.control-foreground;
|
||||
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;
|
||||
padding-right: 20px;
|
||||
Switch {
|
||||
checked: root.checked_int != 0;
|
||||
checked: root.checked_int != 0;
|
||||
toggled => {
|
||||
root.checked_int = self.checked ? 1 : 0;
|
||||
root.toggled(root.checked_int);
|
||||
|
||||
@@ -48,4 +48,6 @@ pub trait AsusArmoury {
|
||||
/// take. Returns `-1` if not used or set.
|
||||
#[zbus(property)]
|
||||
fn scalar_increment(&self) -> zbus::Result<i32>;
|
||||
|
||||
async fn restore_default(&self) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
@@ -76,11 +76,11 @@ impl Attribute {
|
||||
}
|
||||
|
||||
/// 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 value_str = match new_value {
|
||||
AttrValue::Integer(val) => val.to_string(),
|
||||
AttrValue::Integer(val) => &val.to_string(),
|
||||
AttrValue::String(val) => val,
|
||||
_ => return Err(PlatformError::InvalidValue)
|
||||
};
|
||||
@@ -94,6 +94,10 @@ impl Attribute {
|
||||
&self.default_value
|
||||
}
|
||||
|
||||
pub fn restore_default(&self) -> Result<(), PlatformError> {
|
||||
self.set_current_value(&self.default_value)
|
||||
}
|
||||
|
||||
pub fn possible_values(&self) -> &AttrValue {
|
||||
&self.possible_values
|
||||
}
|
||||
@@ -178,6 +182,7 @@ impl Attribute {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FirmwareAttributes {
|
||||
attrs: Vec<Attribute>
|
||||
}
|
||||
@@ -452,6 +457,6 @@ mod tests {
|
||||
if let AttrValue::Integer(val) = &mut val {
|
||||
*val = 0;
|
||||
}
|
||||
attr.set_current_value(val).unwrap();
|
||||
attr.set_current_value(&val).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user