Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Added setDynamicModel (and made some minor corrections) #57

Merged
merged 2 commits into from
Dec 23, 2019
Merged

Added setDynamicModel (and made some minor corrections) #57

merged 2 commits into from
Dec 23, 2019

Conversation

PaulZC
Copy link
Collaborator

@PaulZC PaulZC commented Dec 23, 2019

Hi Nathan (@nseidle),

Here's a re-submission of the setDynamicModel PR. This supersedes PR #52.

This is based on a clean branch (PaulZC_setDynamicModel) and stands alone correctly (it doesn't needs any of the changes from #56) and so should be easy to merge.

Again, while I was working on this, I found a few gremlins in the library. Some functions weren't flowing maxWait down correctly, so I corrected those.

I've also added an extra waitForResponse in setPortOutput (and setPortInput) as I did see rare timeout failures from that call too. Again, mostly on Serial. And, again, mostly when debugging was disabled. I'm pretty sure it suffers from the same problem, that the ACK from a get/poll sendCommand can do strange things to the following sendCommand if they share the same class and ID.

This has been tested on ZOE, NEO, MAX and ZED using both Serial and I2C. And there is of course an example too.

Enjoy!
Paul

@nseidle
Copy link
Member

nseidle commented Dec 23, 2019

Excellent! Thank you Paul!

@nseidle nseidle merged commit 1d1e748 into sparkfun:master Dec 23, 2019
@nseidle
Copy link
Member

nseidle commented Dec 23, 2019

Paul - I modified the method a bit. Rather than pull in a static enum buried inside the class I pulled your enum into global (since it's basically just a defines table). Then I prefixed the possible states with
DYN_MODEL_ so that we won't risk possible clashing with other libraries that might have the bare words like "SEA" or "BIKE" (rare, I know but it happens). Then I changed your function so that it requires a dynModel variable. This will prevent users from passing in say 17 and expecting it to work. Finally, I changed your example so that it checks against a explicit 'false'. I believe this increases readability in examples.

image

@PaulZC PaulZC deleted the PaulZC_setDynamicModel branch December 24, 2019 10:34
@PaulZC
Copy link
Collaborator Author

PaulZC commented Dec 27, 2019

Hi Nathan,
With PR #62, this checks out OK on my systems. Thank you for the improvements - much appreciated!
All the best,
Paul

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants