Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
}

// Must be run before any application code to set the config
if args.pd_addrs.is_some() && args.pd_ports.is_some() {
let platform = Platform::GenericFramework(args.pd_addrs.unwrap(), args.pd_ports.unwrap());
if let (Some(pd_addrs), Some(pd_ports)) = (args.pd_addrs, args.pd_ports) {
let platform = Platform::GenericFramework(pd_addrs, pd_ports);
Config::set(platform);
}

Expand Down
19 changes: 8 additions & 11 deletions framework_lib/src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,17 +616,14 @@ fn print_battery_information(power_info: &PowerInfo) {
pub fn check_update_ready(power_info: &PowerInfo) -> bool {
// Checking if battery/AC conditions are enough for FW update
// Either standalone mode or AC+20% charge
if power_info.battery.is_none()
|| (power_info.ac_present && power_info.battery.as_ref().unwrap().charge_percentage > 20)
{
true
} else {
println!("Please plug in AC. If the battery is connected, charge it to at least 20% before proceeding.");
println!(
"Current charge is: {}%",
power_info.battery.as_ref().unwrap().charge_percentage
);
false
match &power_info.battery {
None => true,
Some(battery) if power_info.ac_present && battery.charge_percentage > 20 => true,
Some(battery) => {
println!("Please plug in AC. If the battery is connected, charge it to at least 20% before proceeding.");
println!("Current charge is: {}%", battery.charge_percentage);
false
}
}
}

Expand Down