-----------------------------------------------------------and coming back was
#define dataType_fromNode 'A'
struct dataPacketA_fromNode {
bool emptyState;
bool fullState;
float temperature;
float humidity;
bool relayState;
uint8_t BootType;
} nodeState[16]; // = {no, no, -20.0, 0.0, relayOff, 0}; // only use logic of relay when turning on or off
but the data was buggered.
I displayed the sizeof() each structure on the RPi and the Arduino. The latter was as expected on the Arduino, 7 and 12, but on the RPi it was 12 and 16!
Some quick research showed that on the RPi the variables need to be aligned to on a 4 Byte boundary.
Putting the most Bytes variables first and padding the structure to be a multiple of 4 Bytes fixed the problem!
The data I was sending from the RPi to an Arduino was:
-----------------------------------------------------------and coming back was
but the data was buggered.
I displayed the sizeof() each structure on the RPi and the Arduino. The latter was as expected on the Arduino, 7 and 12, but on the RPi it was 12 and 16!
Some quick research showed that on the RPi the variables need to be aligned to on a 4 Byte boundary.
Putting the most Bytes variables first and padding the structure to be a multiple of 4 Bytes fixed the problem!