aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-01-25 00:02:10 -0700
committerSelene ToyKeeper2021-01-25 00:02:10 -0700
commit0132c47f0ca6725593f9b43a4984df29f7a90cc4 (patch)
tree9bccfe14958bee9b1fdffc1600f69c40ebe332e3 /spaghetti-monster
parentmerged noctigon k9.3 branch (diff)
downloadanduril-0132c47f0ca6725593f9b43a4984df29f7a90cc4.tar.gz
anduril-0132c47f0ca6725593f9b43a4984df29f7a90cc4.tar.bz2
anduril-0132c47f0ca6725593f9b43a4984df29f7a90cc4.zip
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)
Diffstat (limited to 'spaghetti-monster')
-rw-r--r--spaghetti-monster/anduril/aux-leds.c9
-rw-r--r--spaghetti-monster/anduril/cfg-noctigon-k9.3.h3
2 files changed, 12 insertions, 0 deletions
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
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.