paparazzi / pprzlink

Message and communication library for the Paparazzi UAV system
Other
24 stars 55 forks source link

fix acces to unaligned arrays in v2.0 #82

Closed gautierhattenberger closed 6 years ago

gautierhattenberger commented 6 years ago

Access to unaligned array seems wrong (see #80). This fix reverts back to the solution using in v1.0 that was correct. What is currently done is interpreting the content of the array as a pointer value, which is not what we want.

podhrmic commented 6 years ago

Comes with a bunch of warnings like this:

/paparazzi/var/include/pprzlink/telemetry/INDI_G.h: In function 'pprzlink_get_DL_INDI_G_G2':
/paparazzi/var/include/pprzlink/pprzlink_utils.h:105:51: warning: cast increases required alignment of target type [-Wcast-align]
 #define _PPRZ_VAL_float_array(_payload, _offset) ((float*)(_payload+_offset))

However, HITL seems to work as far as I can tell (at least it doesn't crash now). So that is definitely an improvement:-)

podhrmic commented 6 years ago

Note the warnings are for AP target (aggieiar/atomic) if you want to have a look at it.

podhrmic commented 6 years ago

Works nice and no warnings, hence merging.