From 64fe494434cb8e2afe0882bbd8a83e1d1e4497b4 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 14 Sep 2020 02:32:08 -0600 Subject: fixed bug: ramp 2H at floor went up instead of staying at floor (thanks to SammysHP for suggesting this fix) --- spaghetti-monster/anduril/ramp-mode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/ramp-mode.c b/spaghetti-monster/anduril/ramp-mode.c index 93f0d36..90c7368 100644 --- a/spaghetti-monster/anduril/ramp-mode.c +++ b/spaghetti-monster/anduril/ramp-mode.c @@ -142,13 +142,13 @@ uint8_t steady_state(Event event, uint16_t arg) { } // fix ramp direction on first frame if necessary if (!arg) { + // click, hold should always go down if possible + if (event == EV_click2_hold) { ramp_direction = -1; } // make it ramp down instead, if already at max - if (actual_level >= mode_max) { ramp_direction = -1; } + else if (actual_level >= mode_max) { ramp_direction = -1; } // make it ramp up if already at min // (off->hold->stepped_min->release causes this state) else if (actual_level <= mode_min) { ramp_direction = 1; } - // click, hold should always go down if possible - else if (event == EV_click2_hold) { ramp_direction = -1; } } // if the button is stuck, err on the side of safety and ramp down else if ((arg > TICKS_PER_SECOND * 5) && (actual_level >= mode_max)) { -- cgit v1.2.3