We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cc8d1ef + 3bd173b commit 8ffc2f9Copy full SHA for 8ffc2f9
1 file changed
framework_lib/src/commandline/mod.rs
@@ -1163,11 +1163,15 @@ pub fn analyze_capsule(data: &[u8]) -> Option<capsule::EfiCapsuleHeader> {
1163
fn handle_charge_limit(ec: &CrosEc, maybe_limit: Option<u8>) -> EcResult<()> {
1164
let (cur_min, _cur_max) = ec.get_charge_limit()?;
1165
if let Some(limit) = maybe_limit {
1166
- // Prevent accidentally setting a very low limit
+ // Prevent setting unreasonable limits
1167
if limit < 25 {
1168
return Err(EcError::DeviceError(
1169
"Not recommended to set charge limit below 25%".to_string(),
1170
));
1171
+ } else if limit > 100 {
1172
+ return Err(EcError::DeviceError(
1173
+ "Charge limit cannot be set above 100%".to_string(),
1174
+ ));
1175
}
1176
ec.set_charge_limit(cur_min, limit)?;
1177
0 commit comments