~digitalcircuit/flashlight-firmware/anduril2_opt_ramp_low_slower

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/anduril/aux-leds.c

  • Committer: Selene Scriven
  • Date: 2021-01-25 07:02:10 UTC
  • Revision ID: bzr@toykeeper.net-20210125070210-on0s4wc224pfchyx
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)

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
    const uint8_t *colors = rgb_led_colors;
100
100
    uint8_t actual_color = 0;
101
101
    if (color < 7) {  // normal color
 
102
        #ifdef USE_K93_LOCKOUT_KLUDGE
 
103
        // FIXME: jank alert: this is dumb
 
104
        // this clause does nothing; it just uses up clock cycles
 
105
        // because without it, the K9.3's lockout mode fails and returns
 
106
        // to "off" after ~5 to 15 seconds when configured for a blinking
 
107
        // single color, even though there is no code path from lockout to
 
108
        // "off", and it doesn't act like a reboot either (no boot-up blink)
 
109
        rainbow = (rainbow + 1 + pseudo_rand() % 5) % 6;
 
110
        #endif
102
111
        actual_color = pgm_read_byte(colors + color);
103
112
    }
104
113
    else if (color == 7) {  // disco