mirror of https://github.com/ArduPilot/ardupilot
RC_Channel: avoid invalid misaligned access in example
This commit is contained in:
parent
5350ea5c58
commit
04e29d58e3
|
@ -110,7 +110,9 @@ void RC_UART::loop()
|
||||||
uint16_t rcin[8];
|
uint16_t rcin[8];
|
||||||
uint16_t crc;
|
uint16_t crc;
|
||||||
} rcin;
|
} rcin;
|
||||||
if (hal.rcin->new_input() && hal.rcin->read(rcin.rcin, 8) == 8) {
|
uint16_t rcval[8];
|
||||||
|
if (hal.rcin->new_input() && hal.rcin->read(rcval, 8) == 8) {
|
||||||
|
memcpy(rcin.rcin, rcval, sizeof(rcval));
|
||||||
rcin.crc = crc_calculate((uint8_t*)&rcin.rcin[0], 16);
|
rcin.crc = crc_calculate((uint8_t*)&rcin.rcin[0], 16);
|
||||||
hal.UART->write((uint8_t*)&rcin, sizeof(rcin));
|
hal.UART->write((uint8_t*)&rcin, sizeof(rcin));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue