mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 15:23:57 -04:00
AP_Periph: Fix bad conversion of APD ESC telemetry
le16toh() returns an unsigned type, which keeps the number as positive when cast to float. It needs to be explictly converted to a signed number first. Tested with real hardware.
This commit is contained in:
parent
daf427f6d6
commit
4381c17cb2
@ -48,7 +48,7 @@ bool ESC_APD_Telem::update() {
|
||||
// valid packet, copy the data we need and reset length
|
||||
decoded.voltage = le16toh(received.packet.voltage) * 1e-2f;
|
||||
decoded.temperature = convert_temperature(le16toh(received.packet.temperature));
|
||||
decoded.current = le16toh(received.packet.bus_current) * (1 / 12.5f);
|
||||
decoded.current = ((int16_t)le16toh(received.packet.bus_current)) * (1 / 12.5f);
|
||||
decoded.rpm = le32toh(received.packet.erpm) / pole_count;
|
||||
decoded.power_rating_pct = le16toh(received.packet.motor_duty) * 1e-2f;
|
||||
ret = true;
|
||||
|
Loading…
Reference in New Issue
Block a user