Closed cdjackson closed 9 years ago
Merged the startup timer changes into this branch...
Feel free to merge this yourself. Please ensure that the end result is in working order. I am fully tied with my day job so even I would like to review and test this I am not able to currently. :+1:
No probs - thanks Tommi. I’m using this daily, and so are a few others so I think it’s good :)
This changes the startup methods to allow for the system to read the dongle configuration before the network starts. This allows the system to detect if the dongle configuration is different to that asked for, and then do a reset of the dongle - this is not possible in the current methods as the reset flag is included in the constructor...
You can still use the current startup method which works the same as normal. However, it also adds initializeHardware and initializeNetwork methods which effectively splits startup method in two.
After calling initializeHardware you can then call the getCurrentChannel and getCurrentPanId methods, and then the initializeNetwork method. The initializeHardware method takes parameter to specify if the network should be reset or not.
This also fixes a bug during the startup. If the startup sequence fails in the .open() method due to the reset timing out, then .close() doesn't get called.
I might merge my other dongle reset PR into this but it would be good if @tlaukkan and @chris-hatton can comment on this before it's merged. It shouldn't break anything as the existing methods are retained, but is a bit of a change all the same.