ld_current_out_ctrl_timer: lower current ramp rate
- Ld current ramp now updates in 250Hz (< 500Hz IIR filter cutoff frequency) for pwr_exc_protector
This commit is contained in:
parent
bd83a8fc92
commit
749f19b105
@ -1,6 +1,6 @@
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use fugit::{KilohertzU32, TimerDurationU32};
|
use fugit::{HertzU32, TimerDurationU32};
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use stm32f4xx_hal::{pac::{interrupt, Interrupt, TIM2},
|
use stm32f4xx_hal::{pac::{interrupt, Interrupt, TIM2},
|
||||||
timer::{Counter, Event},
|
timer::{Counter, Event},
|
||||||
@ -20,7 +20,7 @@ pub const FREQ: u32 = 1000000;
|
|||||||
/// This timer notifies the main loop to set the correct output current so that ld output current can ramp up/down slowly.
|
/// This timer notifies the main loop to set the correct output current so that ld output current can ramp up/down slowly.
|
||||||
/// The current output slope is guaranteed to be larger but not necessarily equal to than the preset value.
|
/// The current output slope is guaranteed to be larger but not necessarily equal to than the preset value.
|
||||||
impl LdCurrentOutCtrlTimer {
|
impl LdCurrentOutCtrlTimer {
|
||||||
const TIME_STEP_MS: TimerDurationU32<FREQ> = TimerDurationU32::from_rate(KilohertzU32::from_raw(1));
|
const TIME_STEP: TimerDurationU32<FREQ> = TimerDurationU32::from_rate(HertzU32::from_raw(250));
|
||||||
const STEP_SIZE: ElectricCurrent = ElectricCurrent {
|
const STEP_SIZE: ElectricCurrent = ElectricCurrent {
|
||||||
dimension: PhantomData,
|
dimension: PhantomData,
|
||||||
units: PhantomData,
|
units: PhantomData,
|
||||||
@ -28,7 +28,7 @@ impl LdCurrentOutCtrlTimer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub fn setup(mut tim2: Counter<TIM2, FREQ>) {
|
pub fn setup(mut tim2: Counter<TIM2, FREQ>) {
|
||||||
tim2.start(LdCurrentOutCtrlTimer::TIME_STEP_MS).unwrap();
|
tim2.start(LdCurrentOutCtrlTimer::TIME_STEP).unwrap();
|
||||||
unsafe {
|
unsafe {
|
||||||
cortex_m::peripheral::NVIC::unmask(Interrupt::TIM2);
|
cortex_m::peripheral::NVIC::unmask(Interrupt::TIM2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user