LaserTag: Fix interrupt interference and ammo counting - #9
Conversation
The IR library uses interrupts to manage timing of incoming data, while the Neo Pixel library disables interrupts when shipping out data. If an IR message comes while the Neo Pixel is updating the pixels, the IR message is garbled and undecodable. This change skips a pixel update during UpdateLights if an IR message is being read. Since pixel updates are rapid, missing one isn't important or noticeable. All other pixel updates - during setup or a hit - are untouched and should take precedent.
|
Thanks - will take a look at these eventually - right now I'm working on some other updates that will make changing code much easier on our side first, then I'll be doing passes myself on all the code and merging good PRs here. |
|
Sounds good. Just note that these are legit bugs that need very little code to fix, and the code will not function as expected without the changes. The lights do not track the ammo count, and many "hits" are skipped, looking like misses. Everybody using the lights hack thinks they are worse marksmen than they really are! Because of tracking one of these down, I now know more than I really wanted to about IR encoding and libraries. |
|
I will add that I tested successfully this within my Arduino IDE, with recent versions of all the libraries. However, I just noticed that if I upload the identical code to the online Crunch Labs IDE and load the Arduino via the online IDE, the ammo LEDs do not light up and the servos seem to be overdriven (heavy clicking once the goggles are fully open or closed). My only suspicion is that the online IDE is pinned to older library versions. |
|
Yes it does pin library versions per project. I presume your Arduino IDE is using the latest as of this PR so if we merged it we'd just have to bump up the library versions. |
No description provided.