add USB check for powerup

This commit is contained in:
sigil-03 2025-11-14 15:08:40 -07:00
parent c43cc5599e
commit 2f92805c1a
2 changed files with 13 additions and 2 deletions

View file

@ -648,6 +648,16 @@ impl App {
pub fn get_state(&self) -> State { pub fn get_state(&self) -> State {
self.state self.state
} }
pub fn should_wake(&self) -> bool {
if self.interfaces.usb.powered() {
return true;
} else {
if self.interfaces.adc_core.get_average() > 421 {
return true;
}
}
return false;
}
} }
// TODO LIST // TODO LIST

View file

@ -526,9 +526,10 @@ fn app_main(mut p: hal::Peripherals) -> ! {
} }
unsafe { unsafe {
#[allow(static_mut_refs)] #[allow(static_mut_refs)]
if INPUT_FLAGS.sense_coin_flag.active() if (INPUT_FLAGS.sense_coin_flag.active()
|| (INPUT_FLAGS.main_btn_flag.active() || (INPUT_FLAGS.main_btn_flag.active()
&& main_btn_input.is_high_immediate()) && main_btn_input.is_high_immediate()))
&& app.should_wake()
{ {
unsafe { unsafe {
use hal::pac::Interrupt; use hal::pac::Interrupt;