Added ability to change what EPP is linked with each throttle profile

This commit is contained in:
Luke D. Jones
2024-01-15 18:00:27 +13:00
parent 6f4a7e16dc
commit d4c68546e7
19 changed files with 230 additions and 177 deletions

View File

@@ -1,5 +1,5 @@
use egui::{RichText, Ui};
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use crate::system_state::{FanCurvesState, SystemState};
use crate::widgets::fan_graphs;
@@ -29,7 +29,7 @@ impl RogApp {
}
fn fan_curve(
current: &mut PlatformPolicy,
current: &mut ThrottlePolicy,
curves: &mut FanCurvesState,
dbus: &RogDbusClientBlocking<'_>,
do_error: &mut Option<String>,

View File

@@ -10,7 +10,7 @@ use rog_aura::aura_detection::PowerZones;
use rog_aura::layouts::KeyLayout;
use rog_aura::usb::{AuraDevice, AuraPowerDev};
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
use rog_platform::platform::{GpuMode, PlatformPolicy};
use rog_platform::platform::{GpuMode, ThrottlePolicy};
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::FanCurvePU;
use supergfxctl::pci_device::{GfxMode, GfxPower};
@@ -34,7 +34,7 @@ pub struct PlatformState {
pub mini_led_mode: Option<bool>,
pub dgpu_disable: Option<bool>,
pub egpu_enable: Option<bool>,
pub throttle: Option<PlatformPolicy>,
pub throttle: Option<ThrottlePolicy>,
pub charge_limit: Option<u8>,
}
@@ -65,9 +65,9 @@ impl PlatformState {
#[derive(Clone, Debug, Default)]
pub struct FanCurvesState {
pub show_curve: PlatformPolicy,
pub show_curve: ThrottlePolicy,
pub show_graph: FanCurvePU,
pub curves: BTreeMap<PlatformPolicy, Vec<CurveData>>,
pub curves: BTreeMap<ThrottlePolicy, Vec<CurveData>>,
pub available_fans: HashSet<FanCurvePU>,
pub drag_delta: Vec2,
}
@@ -75,13 +75,13 @@ pub struct FanCurvesState {
impl FanCurvesState {
pub fn new(dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
let profiles = vec![
PlatformPolicy::Balanced,
PlatformPolicy::Quiet,
PlatformPolicy::Performance,
ThrottlePolicy::Balanced,
ThrottlePolicy::Quiet,
ThrottlePolicy::Performance,
];
let mut available_fans = HashSet::new();
let mut curves: BTreeMap<PlatformPolicy, Vec<CurveData>> = BTreeMap::new();
let mut curves: BTreeMap<ThrottlePolicy, Vec<CurveData>> = BTreeMap::new();
for p in &profiles {
if let Ok(curve) = dbus.proxies().fan_curves().fan_curve_data(*p) {
if available_fans.is_empty() {

View File

@@ -14,7 +14,7 @@ use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
use rog_dbus::zbus_anime::AnimeProxy;
use rog_dbus::zbus_aura::AuraProxy;
use rog_dbus::zbus_platform::PlatformProxy;
use rog_platform::platform::{GpuMode, PlatformPolicy};
use rog_platform::platform::{GpuMode, ThrottlePolicy};
use serde::{Deserialize, Serialize};
use supergfxctl::actions::UserActionRequired as GfxUserAction;
use supergfxctl::pci_device::{GfxMode, GfxPower};
@@ -546,11 +546,11 @@ fn _ac_power_notification(message: &str, on: &bool) -> Result<NotificationHandle
Ok(base_notification(message, &data).show()?)
}
fn do_thermal_notif(message: &str, profile: &PlatformPolicy) -> Result<NotificationHandle> {
fn do_thermal_notif(message: &str, profile: &ThrottlePolicy) -> Result<NotificationHandle> {
let icon = match profile {
PlatformPolicy::Balanced => "asus_notif_yellow",
PlatformPolicy::Performance => "asus_notif_red",
PlatformPolicy::Quiet => "asus_notif_green",
ThrottlePolicy::Balanced => "asus_notif_yellow",
ThrottlePolicy::Performance => "asus_notif_red",
ThrottlePolicy::Quiet => "asus_notif_green",
};
let profile: &str = (*profile).into();
let mut notif = base_notification(message, &profile.to_uppercase());

View File

@@ -1,6 +1,6 @@
use egui::plot::{Line, Plot, Points};
use egui::Ui;
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::FanCurvePU;
@@ -15,7 +15,7 @@ pub fn fan_graphs(
) {
ui.separator();
let mut item = |profile: PlatformPolicy, ui: &mut Ui| {
let mut item = |profile: ThrottlePolicy, ui: &mut Ui| {
ui.group(|ui| {
if ui
.selectable_value(&mut curves.show_curve, profile, format!("{profile:?}"))

View File

@@ -1,5 +1,5 @@
use egui::Ui;
use rog_platform::platform::{GpuMode, PlatformPolicy};
use rog_platform::platform::{GpuMode, ThrottlePolicy};
use crate::system_state::SystemState;
@@ -7,7 +7,7 @@ pub fn platform_profile(states: &mut SystemState, ui: &mut Ui) {
if let Some(mut throttle) = states.bios.throttle {
ui.heading("Platform profile");
let mut item = |p: PlatformPolicy, ui: &mut Ui| {
let mut item = |p: ThrottlePolicy, ui: &mut Ui| {
if ui
.selectable_value(&mut throttle, p, format!("{p:?}"))
.clicked()
@@ -25,7 +25,7 @@ pub fn platform_profile(states: &mut SystemState, ui: &mut Ui) {
};
ui.horizontal_wrapped(|ui| {
for a in PlatformPolicy::list() {
for a in ThrottlePolicy::list() {
item(a, ui);
}
});