mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
engine: try to handle systems with multiple batteries
This commit is contained in:
parent
620dc48be0
commit
7c34ef5aa0
2 changed files with 3 additions and 3 deletions
|
@ -73,7 +73,7 @@ pub struct SupportedBattery {
|
|||
pub fn set_battery_charge_thresholds(start_threshold: u8, stop_threshold: u8) -> Result<()> {
|
||||
// Validate thresholds using `BatteryChargeThresholds`
|
||||
let thresholds = BatteryChargeThresholds::new(start_threshold, stop_threshold)
|
||||
.map_err(|e| ControlError::InvalidValueError(e))?;
|
||||
.map_err(ControlError::InvalidValueError)?;
|
||||
|
||||
let power_supply_path = Path::new("/sys/class/power_supply");
|
||||
if !power_supply_path.exists() {
|
||||
|
|
|
@ -78,8 +78,8 @@ pub fn determine_and_apply_settings(
|
|||
// No batteries means desktop/server, always on AC
|
||||
true
|
||||
} else {
|
||||
// At least one battery exists, check if it's on AC
|
||||
report.batteries.first().is_some_and(|b| b.ac_connected)
|
||||
// Check if any battery reports AC connected
|
||||
report.batteries.iter().any(|b| b.ac_connected)
|
||||
};
|
||||
|
||||
if on_ac_power {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue