aboutsummaryrefslogtreecommitdiff
path: root/fsm
diff options
context:
space:
mode:
authorSelene ToyKeeper2024-03-25 04:25:43 -0600
committerSelene ToyKeeper2024-03-25 04:25:43 -0600
commita87812f436e08b14a7cede83e30306d779774872 (patch)
tree42ea09d981ade4d582a01f9c03dc996dc0d3f57b /fsm
parentd3aa fine-tuning: (diff)
downloadanduril-a87812f436e08b14a7cede83e30306d779774872.tar.gz
anduril-a87812f436e08b14a7cede83e30306d779774872.tar.bz2
anduril-a87812f436e08b14a7cede83e30306d779774872.zip
dammit, got alkaline detection half working and then my flashing adapter died
(saving progress here so I can work on a different branch)
Diffstat (limited to '')
-rw-r--r--fsm/ramping.c5
-rw-r--r--fsm/ramping.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/fsm/ramping.c b/fsm/ramping.c
index adc8acb..63ab399 100644
--- a/fsm/ramping.c
+++ b/fsm/ramping.c
@@ -57,6 +57,11 @@ inline void set_level_aux_rgb_leds(uint8_t level) {
void set_level(uint8_t level) {
+ #ifdef USE_RAMP_LEVEL_HARD_LIMIT
+ if (level > ramp_level_hard_limit)
+ level = ramp_level_hard_limit;
+ #endif
+
#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)
diff --git a/fsm/ramping.h b/fsm/ramping.h
index c4b7d48..6fe87fe 100644
--- a/fsm/ramping.h
+++ b/fsm/ramping.h
@@ -10,6 +10,9 @@
uint8_t actual_level = 0;
// the level used before actual
uint8_t prev_level = 0;
+#ifdef USE_RAMP_LEVEL_HARD_LIMIT
+uint8_t ramp_level_hard_limit = RAMP_SIZE;
+#endif
void set_level(uint8_t level);
//void set_level_smooth(uint8_t level);