-
-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update examples to use logical order for methods #927
Comments
Sugesstion has two parts:
Some more complex examples and description from my personal experience (I don't claim any copyright on the code for myself).
Further examples: https://github.com/rejoe2/MySensors-Dallas-Address-ChildID-Consistency/blob/master/DallasTemperatureSensor_Stored_ID/DallasTemperatureSensor_Stored_ID.ino |
After reviewing the most recent versions of the counter sketches: There already the initialisation of values is implemented (other than in the DallasTemp-Sketch (Arduino-Examples) or DHT (where the request for metric is done within presentation()). Sorry for mentioning these, I should have had reviewed prior to writing... |
I have now checked the code and the functions are called in the following order: after this I guess loop() is called but I am not skilled enough to follow the execution path. |
@mfalkvidd correct 👍 |
@mfalkvidd Thanks for having a look at the code and linking at the right place for deeper analysis.
|
@rejoe2, @mfalkvidd I just realized there is more to add: Generally speaking, it depends on MY_TRANSPORT_WAIT_READY_MS and transport initialization status:
|
@tekka007 Thx for clarification, this makes it more complicated to explain the "mechanics" to "normal users". I would still vote for changing the textual appearance, because only a few users are aware of that option and those using this kind of tricks will understand that all other code than presentation() will be executed after timout. Maybe a hint in the respective cpp/h-file (?) would be helpful wrt. to the need of shifting that kind of things in the code in case MY_TRANSPORT_WAIT_READY_MS is set to >0? But wrt. to this, best place to ask for initialisation values (counters) would be at the end of presentation(), as this is also compatible with MY_TRANSPORT_WAIT_READY_MS>0. Today, this is different in the example sketches -> initialising values here is done in setup(). |
Since there is no logical order (due to the flexibility of MySesnors), I'll close this. If someone has a suggested way forward, feel free to reopen. |
See here for a general flow graph: https://forum.mysensors.org/topic/10529/nrf24-transport-status-not-initialized/10 |
I added the flow chart here: |
https://forum.mysensors.org/post/75527 suggests that the order of the methods in the MySensors examples follow the order in which they are called (before->setup->presentation->loop?). This will not affect execution, but could make it easier for users to understand what is happening when.
The text was updated successfully, but these errors were encountered: