From f1ff71108531137d4a94b913175084781987199d Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sat, 7 Sep 2019 00:30:39 -0600 Subject: slowed down rainbow RGB mode, added a ramp-down on stuck-button for safety purposes --- spaghetti-monster/anduril/anduril.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster') diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 5032dcd..e8524a8 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -792,6 +792,10 @@ uint8_t steady_state(Event event, uint16_t arg) { // (off->hold->stepped_min->release causes this state) else if (actual_level <= mode_min) { 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)) { + ramp_direction = -1; + } memorized_level = nearest_level((int16_t)actual_level \ + (ramp_step_size * ramp_direction)); #else @@ -2286,7 +2290,9 @@ void rgb_led_update(uint8_t mode, uint8_t arg) { actual_color = colors[color]; } else if (color == 7) { // rainbow - if (0 == (arg & 0x03)) { + uint8_t speed = 0x03; // awake speed + if (go_to_standby) speed = 0x0f; // asleep speed + if (0 == (arg & speed)) { rainbow = (rainbow + 1) % 6; } actual_color = colors[rainbow]; -- cgit v1.2.3