-
Notifications
You must be signed in to change notification settings - Fork 15
Chargerate #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chargerate #117
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,16 @@ struct ClapCli { | |
#[arg(long)] | ||
charge_limit: Option<Option<u8>>, | ||
|
||
/// Get or set max charge current limit | ||
#[arg(long)] | ||
#[clap(num_args = ..2)] | ||
charge_current_limit: Vec<u32>, | ||
|
||
/// Get or set max charge current limit | ||
#[arg(long)] | ||
#[clap(num_args = ..2)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm understanding correctly, I believe this limits the argument count to a max of 1, and if you want to allow 2, you need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you're right. Thanks!. #123 |
||
charge_rate_limit: Vec<f32>, | ||
|
||
/// Get GPIO value by name | ||
#[arg(long)] | ||
get_gpio: Option<String>, | ||
|
@@ -305,6 +315,19 @@ pub fn parse(args: &[String]) -> Cli { | |
1 => Some((None, args.fansetrpm[0])), | ||
_ => None, | ||
}; | ||
let charge_current_limit = match args.charge_current_limit.len() { | ||
2 => Some(( | ||
args.charge_current_limit[0], | ||
Some(args.charge_current_limit[1]), | ||
)), | ||
1 => Some((args.charge_current_limit[0], None)), | ||
_ => None, | ||
}; | ||
let charge_rate_limit = match args.charge_rate_limit.len() { | ||
2 => Some((args.charge_rate_limit[0], Some(args.charge_rate_limit[1]))), | ||
1 => Some((args.charge_rate_limit[0], None)), | ||
_ => None, | ||
}; | ||
|
||
Cli { | ||
verbosity: args.verbosity.log_level_filter(), | ||
|
@@ -358,6 +381,8 @@ pub fn parse(args: &[String]) -> Cli { | |
inputdeck_mode: args.inputdeck_mode, | ||
expansion_bay: args.expansion_bay, | ||
charge_limit: args.charge_limit, | ||
charge_current_limit, | ||
charge_rate_limit, | ||
get_gpio: args.get_gpio, | ||
fp_led_level: args.fp_led_level, | ||
fp_brightness: args.fp_brightness, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the limit (out of 1.0) is always required and the state of charge (out of 100) is optional, and in the code the limit is always first and the SoC is second (in an Option), so would that mean that this example has the arguments reversed? Sorry if I'm missing something obvious; I can't test it because of the issue in the other comment I'm leaving.