forked from M-Labs/kirdy
ld: add ld_terms_short in settings report
This commit is contained in:
parent
0a992c1dc8
commit
e160316bfc
|
@ -56,6 +56,7 @@ struct Settings {
|
|||
ld_drive_current_limit: ElectricCurrent,
|
||||
pd_mon_params: pd_mon_params::Parameters,
|
||||
ld_pwr_limit: Power,
|
||||
ld_terms_short: bool,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
|
@ -67,6 +68,7 @@ impl Default for Settings {
|
|||
ld_drive_current_limit: ElectricCurrent::new::<milliampere>(0.0),
|
||||
pd_mon_params: pd_mon_params::Parameters::default(),
|
||||
ld_pwr_limit: Power::new::<milliwatt>(0.0),
|
||||
ld_terms_short: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,10 +113,12 @@ impl LdDrive{
|
|||
|
||||
pub fn ld_short(&mut self) {
|
||||
self.ctrl.ld_short_enable();
|
||||
self.settings.ld_terms_short = true;
|
||||
}
|
||||
|
||||
pub fn ld_open(&mut self) {
|
||||
self.ctrl.ld_short_disable();
|
||||
self.settings.ld_terms_short = false;
|
||||
}
|
||||
|
||||
pub fn power_up(&mut self){
|
||||
|
@ -221,6 +225,7 @@ impl LdDrive{
|
|||
ld_drive_current_limit: LdSettingsSummaryField { value: settings.ld_drive_current_limit, max: Settings::LD_CURRENT_MAX},
|
||||
pd_mon_params: settings.pd_mon_params,
|
||||
ld_pwr_limit: settings.ld_pwr_limit,
|
||||
ld_terms_short: settings.ld_terms_short,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,6 +236,12 @@ impl LdDrive{
|
|||
self.settings.pd_mon_params = settings.pd_mon_params;
|
||||
self.settings.ld_pwr_limit = settings.ld_pwr_limit;
|
||||
|
||||
if self.settings.ld_terms_short {
|
||||
self.ld_short();
|
||||
} else {
|
||||
self.ld_open();
|
||||
}
|
||||
|
||||
if settings.default_pwr_on {
|
||||
self.power_up();
|
||||
} else {
|
||||
|
@ -246,6 +257,7 @@ pub struct LdSettingsSummary {
|
|||
ld_drive_current_limit: LdSettingsSummaryField<ElectricCurrent>,
|
||||
pd_mon_params: pd_mon_params::Parameters,
|
||||
ld_pwr_limit: Power,
|
||||
ld_terms_short: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Tree)]
|
||||
|
|
Loading…
Reference in New Issue