From 0132c47f0ca6725593f9b43a4984df29f7a90cc4 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Mon, 25 Jan 2021 00:02:10 -0700 Subject: bug pseudo-fix: K9.3 lockout mode failed in blinking single-color mode because of what appears to be compiler jank or a race condition or some other highly unusual issue (fixed by eating up extra clock cycles in the affected code path) --- spaghetti-monster/anduril/aux-leds.c | 9 +++++++++ spaghetti-monster/anduril/cfg-noctigon-k9.3.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/spaghetti-monster/anduril/aux-leds.c b/spaghetti-monster/anduril/aux-leds.c index c819bd7..73d163e 100644 --- a/spaghetti-monster/anduril/aux-leds.c +++ b/spaghetti-monster/anduril/aux-leds.c @@ -99,6 +99,15 @@ void rgb_led_update(uint8_t mode, uint8_t arg) { const uint8_t *colors = rgb_led_colors; uint8_t actual_color = 0; if (color < 7) { // normal color + #ifdef USE_K93_LOCKOUT_KLUDGE + // FIXME: jank alert: this is dumb + // this clause does nothing; it just uses up clock cycles + // because without it, the K9.3's lockout mode fails and returns + // to "off" after ~5 to 15 seconds when configured for a blinking + // single color, even though there is no code path from lockout to + // "off", and it doesn't act like a reboot either (no boot-up blink) + rainbow = (rainbow + 1 + pseudo_rand() % 5) % 6; + #endif actual_color = pgm_read_byte(colors + color); } else if (color == 7) { // disco diff --git a/spaghetti-monster/anduril/cfg-noctigon-k9.3.h b/spaghetti-monster/anduril/cfg-noctigon-k9.3.h index 4d3d3d9..e61ea13 100644 --- a/spaghetti-monster/anduril/cfg-noctigon-k9.3.h +++ b/spaghetti-monster/anduril/cfg-noctigon-k9.3.h @@ -84,3 +84,6 @@ inline void set_level_override(uint8_t level); // for consistency with KR4 (not otherwise necessary though) #define USE_SOFT_FACTORY_RESET + +// work around bizarre bug: lockout mode fails when set to solid color blinking +#define USE_K93_LOCKOUT_KLUDGE -- cgit v1.2.3