is 21 bytes with the lora-serialization lib and about 38 (variably up to 45, but minimum seems to be 38) with nanopb:
message LogEvent {
uint32 unixtime = 1;
Location coords = 2;
SolarData solar = 3;
float temperature = 4;
float humidity = 5;
}
message SolarData {
AdsGain gain = 1;
uint32 solar1 = 2 [(nanopb).int_size = IS_16];
uint32 solar2 = 3 [(nanopb).int_size = IS_16];
}
enum AdsGain {
GAIN_TWOTHIRDS = 0;
GAIN_ONE = 2;
GAIN_TWO = 4;
GAIN_FOUR = 6;
GAIN_EIGHT = 8;
GAIN_SIXTEEN = 10;
}
message Location {
float latitude = 1;
float longitude = 2;
}
A big part of that is due to the fact that the library is catered to produce lossy/boxed variants of the sensor data by making assumptions about the sensor ranges, etc.
So I am wondering whether there is a way to combine the two approaches by using custom data types with nanopb, but I can't find any markers if this is a good idea.
Thoughts?
Thank you very much, this is very helpful, I will try restructuring my event and see if that works out. Regarding the field labeling, you are right, so I am happy to spend those extra 7 bytes to make the message forward compatible.
I saw that you removed the INT_16 size constraints for nanopb - is the hinting generally not needed or detrimental?
Cheers,
Joscha