Message manipulation with set(void* payload, uint8_t length);
-
Just a quick question: any hints/examples on how to use it? I haven't found anything while I'm afraid it can be helpful to me.
-
@feanor-anglin I think set is used in most of the example sketches. One example: https://github.com/mysensors/MySensorsArduinoExamples/blob/bba998bce09bc5139eb4ca7a05b0279f4083ff88/examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino#L123
-
As far as I understand it, there is 10 different set functions for all kinds of payload:
Source: https://www.mysensors.org/apidocs/classMyMessage.htmlAnd now, the set (const void *payload, const size_t length) seems to me as a variant of set function which should give me an ability to create any kind of payload. I see it like this:
send(message.setType(messageType).setSensor(sensorID).set(payload, length));
So, do I understand it correctly? And if yes, then how to use set (const void *payload, const size_t length) to create any payload, from binary to float?
-
@feanor-anglin thanks for explaining. I don’t think I have seen this particular variant of set used, but I think it works the way you describe it.
Depending om your use case, you might also be interested in the new multimessage feature.
-
I've asked, because I cannot test it right now and thought maybe someone has done it before. In this case I will test it myself next week. Right now I have some code that compiles, so maybe it will also work
Referring to multimessage feature, I don't see any application yet (maybe I need to understand it better). More important to me is auto ID assignment for RS485 which seems to be also finally merged. Great!