1
0
forked from M-Labs/kirdy

ld: Block pwr on request if alarm is asserted

- Align the alarm and pwr up behavior with thermostat temp_mon
This commit is contained in:
linuswck 2024-07-26 11:02:05 +08:00
parent 201148fb21
commit 3f9a4bf140

View File

@ -211,12 +211,14 @@ impl LdPwrExcProtector {
pub fn pwr_on_and_arm_protection() { pub fn pwr_on_and_arm_protection() {
if let Some(ref mut wdg) = LdPwrExcProtector::get() { if let Some(ref mut wdg) = LdPwrExcProtector::get() {
wdg.alarm_status = Status::default(); if !wdg.alarm_status.pwr_excursion {
LdPwrExcProtector::clear_interrupt_bit(); wdg.alarm_status = Status::default();
LdPwrExcProtector::pwr_on(); LdPwrExcProtector::clear_interrupt_bit();
// Interrupt should be enabled after power on to tackle the following edge case: LdPwrExcProtector::pwr_on();
// Pd_Mon pin voltage has already exceed threshold before LD Power is on. // Interrupt should be enabled after power on to tackle the following edge case:
LdPwrExcProtector::enable_watchdog_interrupt(); // Pd_Mon pin voltage has already exceed threshold before LD Power is on.
LdPwrExcProtector::enable_watchdog_interrupt();
}
} }
} }