Skip to content

LaserTag: Fix interrupt interference and ammo counting - #9

Open
chrisroat wants to merge 2 commits into
HackPackOfficial:masterfrom
chrisroat:lasertag-interrupt-interference
Open

LaserTag: Fix interrupt interference and ammo counting#9
chrisroat wants to merge 2 commits into
HackPackOfficial:masterfrom
chrisroat:lasertag-interrupt-interference

Conversation

@chrisroat

Copy link
Copy Markdown

No description provided.

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.
@Reginald-Gillespie

Copy link
Copy Markdown
Member

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.

@chrisroat

Copy link
Copy Markdown
Author

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.

@chrisroat

Copy link
Copy Markdown
Author

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.

@Reginald-Gillespie

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants