brentstineman / ButtonPong

A sample lab that demonstrates a simple game using Azure Serverless and Particle Internet Button Devices
MIT License
4 stars 14 forks source link

"Winner" API & Firmware Mismatch #21

Open mikaelweave opened 6 years ago

mikaelweave commented 6 years ago

Hi!

I'm seeing a mismatch in code between the firmware and the API for triggering a winner. (See #18 for my first stab at this issue).

The firmware is expecting a timeout value of "-1" to be sent to trigger the "game won" state. See: https://github.com/brentstineman/ButtonPong/blob/master/firmware/src/buttonpong.ino#L160-L166

The API is invoking a "winner" wekhook which is expecting a function called "winner" existing in the firmware. See: https://github.com/brentstineman/ButtonPong/blob/master/api/csharp/CloudAPI/PingManager.cs#L83-L88 and https://github.com/brentstineman/ButtonPong/blob/master/api/csharp/CloudAPI/Infrastructure/ParticleDeviceCommunicator.cs#L84-L87

Either the API needs to be updated to not call the "winner" webhook and use the "-1" timeout instead or the firmware needs to be updated to only trigger a winner event in a new function called "winner" (like #18 but also removing the code in the ping function.

Thoughts?? I'd be more than happy to change the code and submit a pull request once the proper "winner" triggering method is determined. I think adding a "winner" function to the firmware is the more ideal approach since it's more clear.

Thanks! Mikael