Replies: 3 comments 3 replies
-
I don't really see why this should behave differently for strings and structs, at the end of the day the same transmit/read methods that operate with binary buffer and size will be used. Couple of thoughts:
|
Beta Was this translation helpful? Give feedback.
-
Hi @jgromes ! Thank you for your answer! Yes, I'm pretty sure about the size of the structure. I checked the size of the transmitter and the receiver. I also tried to pack, but it didn't work. Also, the transmitter and the receiver are the same Arduino Nano ESP32. The size of |
Beta Was this translation helpful? Give feedback.
-
typedef union Vec4_u {
struct {
float x;
float y;
float z;
float w;
};
float data[4];
} __attribute__((packed, aligned(1))) Vec4; typedef union Vec3_u {
struct {
float x;
float y;
float z;
};
float data[3];
} __attribute__((packed, aligned(1))) Vec3; enum __attribute__((packed)) FlyState {
FLYING,
LANDED,
ON_GROUND
}; enum __attribute__((packed)) DeviceStatus {
DOWN,
READY,
SLEEP,
BOOTING,
CONNECTED,
FIRED ,
BOOTED
}; typedef struct Device_s {
DeviceStatus status;
} __attribute__((packed, aligned(1))) Device; typedef struct Devices_s {
Device radio;
Device parachute;
Device bmp;
Device imu;
Device system;
Device gnss;
uint8_t batteryLevel;
} __attribute__((packed, aligned(1))) Devices; typedef struct Rocket_s {
Vec4 orientation;
Vec3 velocity;
Vec3 acceleration;
float altitude;
FlyState flyState;
Devices devices;
long latitude;
long longitude;
bool emergency;
} __attribute__((packed, aligned(1))) Rocket; Those structures are my entire package. I tried with |
Beta Was this translation helpful? Give feedback.
-
Hi!
I'm starting to play with the Lora module SX1262 in FSK mod and RadioLib (thank you for your hard work).
I would like to send a c++ structure over the radio, but on the receiver I get a lot of CRC error that I don't have when I'm sending regular
String
.Emitter code
With the code above, I'm getting CRC error on the receiver but when I replace the function
sendMessage
by this one below, I'm not facing the issue, everything is working well without getting CRC error.Rocket's structure
The Rocket structure has a size of 64 bytes while the string, more than 200 bytes.
Receiver
Example of output log
General information
Do you have an idea of what could be the issue? Thank you for your help.
Beta Was this translation helpful? Give feedback.
All reactions