aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/controls.c
diff options
context:
space:
mode:
authorSimon Wilks <sjwilks@gmail.com>2013-03-21 01:12:01 +0100
committerSimon Wilks <sjwilks@gmail.com>2013-03-21 01:12:01 +0100
commitf1d8aa57ce9854920c9408c78be3abdc064b4b9d (patch)
tree79c392ff4bda0ed8356ab30269b735d8f364cd26 /apps/px4io/controls.c
parent1c9bc8e19d398a4d1fd1995f26ef63d7d3c55360 (diff)
downloadpx4-firmware-f1d8aa57ce9854920c9408c78be3abdc064b4b9d.tar.gz
px4-firmware-f1d8aa57ce9854920c9408c78be3abdc064b4b9d.tar.bz2
px4-firmware-f1d8aa57ce9854920c9408c78be3abdc064b4b9d.zip
Ensure that numerator / demoninator <= 1.
Diffstat (limited to 'apps/px4io/controls.c')
-rw-r--r--apps/px4io/controls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/px4io/controls.c b/apps/px4io/controls.c
index e80a41f15..dc36f6c93 100644
--- a/apps/px4io/controls.c
+++ b/apps/px4io/controls.c
@@ -177,7 +177,7 @@ controls_tick() {
scaled = 10000.0f * ((raw - conf[PX4IO_P_RC_CONFIG_CENTER] - conf[PX4IO_P_RC_CONFIG_DEADZONE]) / (float)(conf[PX4IO_P_RC_CONFIG_MAX] - conf[PX4IO_P_RC_CONFIG_CENTER] - conf[PX4IO_P_RC_CONFIG_DEADZONE]));
} else if (raw < (conf[PX4IO_P_RC_CONFIG_CENTER] - conf[PX4IO_P_RC_CONFIG_DEADZONE])) {
- scaled = 10000.0f * ((raw - conf[PX4IO_P_RC_CONFIG_CENTER] - conf[PX4IO_P_RC_CONFIG_DEADZONE]) / (float)(conf[PX4IO_P_RC_CONFIG_CENTER] - conf[PX4IO_P_RC_CONFIG_DEADZONE] - conf[PX4IO_P_RC_CONFIG_MIN]));
+ scaled = 10000.0f * ((raw - conf[PX4IO_P_RC_CONFIG_CENTER] + conf[PX4IO_P_RC_CONFIG_DEADZONE]) / (float)(conf[PX4IO_P_RC_CONFIG_CENTER] - conf[PX4IO_P_RC_CONFIG_DEADZONE] - conf[PX4IO_P_RC_CONFIG_MIN]));
} else {
/* in the configured dead zone, output zero */