ld: ld_soft_i_limit now limits ld_i_out being set

This commit is contained in:
linuswck 2024-04-18 15:36:13 +08:00
parent 6b250aa1fd
commit 0e087c6992
1 changed files with 2 additions and 2 deletions

View File

@ -148,8 +148,8 @@ impl LdDrive{
}
pub fn ld_set_i(&mut self, i: ElectricCurrent){
self.settings.ld_drive_current = i;
LdCurrentOutCtrlTimer::set_target_i_and_listen_irq(i, self.ctrl.get_i_set());
self.settings.ld_drive_current = i.min(self.settings.ld_drive_current_limit);
LdCurrentOutCtrlTimer::set_target_i_and_listen_irq(self.settings.ld_drive_current, self.ctrl.get_i_set());
}
pub fn poll_and_update_output_current(&mut self) -> ElectricCurrent {