kiibohd / controller

Kiibohd Controller
GNU General Public License v3.0
807 stars 270 forks source link

Add screensaver-like abilities (block animations on activity; shutdown LEDs on inactivity) #309

Open dnppp opened 5 years ago

dnppp commented 5 years ago

Playing with a new Kira and tried to add a basic screensaver-like capability to the firmware to get familiar with the code base.

I'm sleeping not that far from my keyboard, so I wanted to stop the LED lightning if I stop typing for too long.

Plus the Kira always animates to 'wave' by default and I felt it was weird to have animations while I'm typing. So the PR allows us to pause animation when the typist press some key, and resume it some x ms later.

To do that kind of stuff, I tried a bit to look first at the KLL spec, but the 'Timing' section doesn't seem to do the trick. Then I looked a bit at interrupts in the code base but it seemed too messy (architecture dependent?), so I just ended by using the Periodic_* functions on a larger timescale (see 2nd commit).

By default, the screensaver option is disabled (see comments in Macro/PixelMap/capabilities.kll to enable it, 3rd commit).