From 651bd6953b04af18ba6588f79e10da1bd4dae913 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Sat, 11 Feb 2012 11:35:59 +0800 Subject: [PATCH] fix uint > int issue - for hil --- libraries/RC_Channel/RC_Channel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index bd94992ab1..16187051b1 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -252,9 +252,9 @@ RC_Channel::norm_input() float RC_Channel::norm_output() { - uint16_t mid = (radio_max + radio_min) / 2; - - if(radio_out < radio_trim) + int16_t mid = (radio_max + radio_min) / 2; + + if(radio_out < mid) return (float)(radio_out - mid) / (float)(mid - radio_min); else return (float)(radio_out - mid) / (float)(radio_max - mid);