Open gedankenexperimenter opened 6 years ago
I think I want to go one step farther than Kaleidoscope's LEDControl, and have it pass through not just the LED-update functions, but also the hook functions.
On another note, the tricky part is when multiple plugins are all trying to update LEDs. Maybe there should be a two-phase update system, where plugins can update all LEDs (to a single color), then that can be overridden by others that set individual keys.
Furthermore, maybe I want to move the updates into the core, and have a hook function for LED updates, run just before the LEDs are updated by sending to the hardware. Maybe this would make it easier to optimize out that code on keyboards without lights, because those hook functions would never get called, because the update function in hooks doesn't get overridden?
One of the design goals should be to have an easy way to optimize out plugin code that exists only to update LEDs.
Do I leave updating in core, or do I use a plugin, like Kaleidoscope's LEDControl module?
LED modes must still be plugins, because they might respond to input, but they needn't be called except via LEDControl. That way, inactive modes don't get their hook functions needlessly called.
Maybe there should be a global brightness scaling function that gets applied to all modes.
Instead of doing an array lookup, maybe a simple algorithm could translate values to output.