aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-main.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-11-14 19:47:49 -0700
committerSelene ToyKeeper2019-11-14 19:47:49 -0700
commit5362c032fdca4b20af49db0409a03524a396b815 (patch)
tree1d437085b5b3472279167aee905385e39a4a1fe1 /spaghetti-monster/fsm-main.c
parentmerged from fsm branch to get safety ramp-down and version check functions, a... (diff)
parentmerged irq-refactor branch, which fixes some small but long-standing issues: (diff)
downloadanduril-5362c032fdca4b20af49db0409a03524a396b815.tar.gz
anduril-5362c032fdca4b20af49db0409a03524a396b815.tar.bz2
anduril-5362c032fdca4b20af49db0409a03524a396b815.zip
merged fsm updates / irq-refactor branch, to get more stable voltage readings
(and otherwise get recent bugfixes)
Diffstat (limited to 'spaghetti-monster/fsm-main.c')
-rw-r--r--spaghetti-monster/fsm-main.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-main.c b/spaghetti-monster/fsm-main.c
index e537a9e..c9ab69b 100644
--- a/spaghetti-monster/fsm-main.c
+++ b/spaghetti-monster/fsm-main.c
@@ -123,7 +123,6 @@ int main() {
#else
delay_4ms(1);
#endif
- empty_event_sequence();
// fallback for handling a few things
#ifndef DONT_USE_DEFAULT_STATE
@@ -160,6 +159,9 @@ int main() {
standby_mode();
}
+ // catch up on interrupts
+ handle_deferred_interrupts();
+
// give the recipe some time slices
loop();
@@ -168,4 +170,22 @@ int main() {
}
}
+
+void handle_deferred_interrupts() {
+ /*
+ if (irq_pcint) { // button pressed or released
+ // nothing to do here
+ // (PCINT only matters during standby)
+ }
+ */
+ if (irq_adc) { // ADC done measuring
+ ADC_inner();
+ // irq_adc = 0; // takes care of itself
+ }
+ if (irq_wdt) { // the clock ticked
+ WDT_inner();
+ // irq_wdt = 0; // takes care of itself
+ }
+}
+
#endif