mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-05 13:20:35 +08:00
use gcc attributes to align and pack
This commit is contained in:
committed by
Lorenz Meier
parent
76387b1693
commit
eb29b33620
@@ -490,8 +490,7 @@ MavlinkReceiver::handle_message_optical_flow_rad(mavlink_message_t *msg)
|
||||
enum Rotation flow_rot;
|
||||
param_get(param_find("SENS_FLOW_ROT"), &flow_rot);
|
||||
|
||||
struct optical_flow_s f;
|
||||
memset(&f, 0, sizeof(f));
|
||||
struct optical_flow_s f = {};
|
||||
|
||||
f.timestamp = flow.time_usec;
|
||||
f.integration_timespan = flow.integration_time_us;
|
||||
@@ -508,8 +507,8 @@ MavlinkReceiver::handle_message_optical_flow_rad(mavlink_message_t *msg)
|
||||
|
||||
/* rotate measurements according to parameter */
|
||||
float zeroval = 0.0f;
|
||||
rotate_3f(flow_rot, f.pixel_flow_x_integral, f.pixel_flow_y_integral, zeroval);
|
||||
rotate_3f(flow_rot, f.gyro_x_rate_integral, f.gyro_y_rate_integral, f.gyro_z_rate_integral);
|
||||
rotate_3f(flow_rot, &f.pixel_flow_x_integral, &f.pixel_flow_y_integral, &zeroval);
|
||||
rotate_3f(flow_rot, &f.gyro_x_rate_integral, &f.gyro_y_rate_integral, &f.gyro_z_rate_integral);
|
||||
|
||||
if (_flow_pub == nullptr) {
|
||||
_flow_pub = orb_advertise(ORB_ID(optical_flow), &f);
|
||||
|
||||
@@ -46,6 +46,13 @@
|
||||
// Hack until everything is using this header
|
||||
#include <systemlib/visibility.h>
|
||||
|
||||
// Macro to define packed structures
|
||||
#ifdef __GNUC__
|
||||
#define ORBPACKED( __Declaration__ ) __Declaration__ __attribute__((aligned(4), packed))
|
||||
#else
|
||||
#define ORBPACKED( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Object metadata.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user