@mfalkvidd said in Build retry funtionality into the mysensors library:
Do you statically allocate the ram needed to store the transmitted values, or are you able to do it dynamically without causing fragmentation?
For example You have a node with two sensors, then there are two MyMessage objects defined statically.
How much extra ram is required?
The size of MyMessage for every message
Is there support for larger messages, such as V_TEXT?
To My knowledge in MySensors there is only one size of MyMessage object which is a union of multiple represenstations of the message content and the size of MyMessage is MAX_MESSAGE_LENGTH. So I don't understand the question
How do you handle if the same actuator is changed multiple times before the earlier changes have been reliably delivered?
The last value of the actuator is taken. You can imagine that there are two threads. First is setting the atomic value shared between threads, and second is reading this value and sending it to the gateway. If first thread writes two times before second thread sends first time, the first value is not sent.
My approach is memory hungry if there is a lot of distinct values to send to the gateway. May be it could be improved to reuse single message in the background.
One important thing is that there is a differenc in approach to battery powered (sleeping) nodes and powered nodes.
In powered nodes, there is not problem going to forever loop trying to deliver message to the gateway.
My algorithm is essantial for battery powered nodes, where banging messages in forever loop will drain the battery quickly if for example gateway goes down for a while.
You can look into my code here:
https://github.com/mczerski/MySensorsToolkit - this is the toolkit library with all the logic implemented
https://github.com/mczerski/MyMultiSensor
- this is example use of the toolkit library