1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-291 Added proper float rounding before casting to uint8_t

This commit is contained in:
Vladimir Zidar 2016-04-20 19:01:26 +02:00 committed by Vladimir Zidar
parent d281d8ce0c
commit 1a870f0c0f

View File

@ -703,9 +703,9 @@ static void set_current_stabilizationbankdata( const StabilizationBankData *bank
static void pid_native2msp( const float *native, msp_pid_t *piditem )
{
piditem->P = native[0] * 10000;
piditem->I = native[1] * 10000;
piditem->D = native[2] * 10000;
piditem->P = lroundf(native[0] * 10000);
piditem->I = lroundf(native[1] * 10000);
piditem->D = lroundf(native[2] * 10000);
}
static void pid_msp2native( const msp_pid_t *piditem, float *native )