TomWS, thanks for pointing this out.
That means on AVR node instead of this:
typedef struct {
int node_id;
float temp;
float hum;
int batt;
} Payload;
I should use this:
typedef struct {
uint16_t node_id;
float temp;
float hum;
uint16_t batt;
} Payload;
Well, we're mixing signed-ness with size and they are entirely different. IF you really want a signed integer to pass back and forth in a packet, you could use:
typedef struct {
int16_t node_id;
float temp;
float hum;
int16_t batt;
} Payload;
or, if you really do want unsigned values, this is fine:
typedef struct {
uint16_t node_id;
float temp;
float hum;
uint16_t batt;
} Payload;
Note that, in these cases, 'float' is accepted to be a single precision IEEE floating point value (whose size is standard, unlike ints).
Finally, so that you can use a single include file to be defining the packet structures with the same file on both ends, including the packed attribute, as you had earlier, is also fine (the attribute is redundant on the AVR processor).
typedef struct __attribute__((__packed__)) {
uint16_t node_id;
float temp;
float hum;
uint16_t batt;
} Payload;
Tom