Cycling Through LED Modes Causes Right Side Stop Working - Latest Firmware


(Xenoscr) #1

Hello,

I’m hoping that there is a simple fix for this one. I finally had some free time and decided to update the firmware on both of my Model 01’s. After getting the Arduino IDE and all the required software downloaded I successfully flashed the first keyboard. All seemed will until I cycled through the LED modes by pressing the “led” button. I am able to cycle through the first two modes, on the third press of the “led” button the right half stops working and a single key, the “-” key in the lower right, remains lit and that half remains unresponsive until I unplug and reconnect the Model 01.

After some time the keyboard has sent the following keystrokes to whatever window has focus:

iopuy
=adfgBCVXZ

I decided to flash my second keyboard to see if it was a problem with the first one’s hardware, it now is doing the same thing. Again, thanks in advance for your help.

Conor Richard


(Xenoscr) #2

I commented out “LEDChaseEffect” and re-compiled the firmware. Everything is working fine now without that effect enabled. The issue seems to be with it.

Conor Richard


(Gergely Nagy) #3

Thanks for narrowing it down to Chase, that’ll help us debugging it further.


(Xenoscr) #4

You’re welcome. If I were better at hardware stuffs I would have perhaps found more for you. Let me know if you need me to test out anything or if you need me to give you any more information that’ll help you track down the issue.

Conor Richard


(Gergely Nagy) #5

Narrowing down to Chase and clearly explaining the symptoms was enough to track the issue down. I knew it was working recently, so wasn’t particularly hard to find the commit where I broke it (sorry!). A fix is available at:

There were two underlying problems: the firmware crashed because the LED index went below zero, and the hardware plugin wasn’t prepared for that case. It only checked if the index is smaller than LED_COUNT, it never accounted for the index being negative. This is because originally we used an unsigned integer, but for various reasons, changed to a signed one recently. When it went negative, all kinds of bad stuff happened, and the firmware ended up crashing.

With this fixed, the firmware no longer crashed, but Chase still didn’t work properly, the right half wouldn’t do the effect, and the left had issues as well. This was caused by the same unsigned -> signed transition, the code that flipped the direction of the chase did not account for the position being anything less than zero.

The pull request above fixes both, you can take it for a spin if you want to, or wait 'till @jesse merges it when he’s up. :slight_smile:


(Xenoscr) #6

Awesome. I appreciate the explanation and the quick fix on this. And, I’m happy that I hadn’t borked my keyboards when I finally decided to upgrade the firmware. :smile:

I did checkout your commit and tested it successfully. Everything worked as it should. Thank you!

Conor Richard