aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-ramping.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-08-23 04:24:08 -0600
committerSelene ToyKeeper2021-08-23 04:24:08 -0600
commitdac03ab316ed47aff8e1e28d357935c7e4cbda29 (patch)
treec43a2bcef0fedae36e935a73cc84c4155d17e688 /spaghetti-monster/fsm-ramping.c
parentmade jump start level configurable at runtime, and made it activate in more p... (diff)
downloadanduril-dac03ab316ed47aff8e1e28d357935c7e4cbda29.tar.gz
anduril-dac03ab316ed47aff8e1e28d357935c7e4cbda29.tar.bz2
anduril-dac03ab316ed47aff8e1e28d357935c7e4cbda29.zip
moved jump start into FSM so it'll be more universal and the app won't need special clauses
(also adjusted KR4 jump start levels a bit)
Diffstat (limited to 'spaghetti-monster/fsm-ramping.c')
-rw-r--r--spaghetti-monster/fsm-ramping.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 017a5b8..54ca45c 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -24,6 +24,18 @@
#ifdef USE_RAMPING
void set_level(uint8_t level) {
+ #ifdef USE_JUMP_START
+ // maybe "jump start" the engine, if it's prone to slow starts
+ // (pulse the output high for a moment to wake up the power regulator)
+ // (only do this when starting from off and going to a low level)
+ if ((! actual_level)
+ && level
+ && (level < jump_start_level)) {
+ set_level(jump_start_level);
+ delay_4ms(JUMP_START_TIME/4);
+ }
+ #endif // ifdef USE_JUMP_START
+
actual_level = level;
#ifdef USE_SET_LEVEL_GRADUALLY