From 9e9c62d24556f256c06294b423cf8cb9f387f0db Mon Sep 17 00:00:00 2001
From: Holger Steinhaus <holger@steinhaus-home.de>
Date: Wed, 27 Aug 2014 18:28:30 +0200
Subject: [PATCH] HAL_PX4: work-around for periodic enable_ch() calls

---
 libraries/AP_HAL_PX4/RCOutput.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libraries/AP_HAL_PX4/RCOutput.cpp b/libraries/AP_HAL_PX4/RCOutput.cpp
index 3b295b97a..0aec41e8c 100644
--- a/libraries/AP_HAL_PX4/RCOutput.cpp
+++ b/libraries/AP_HAL_PX4/RCOutput.cpp
@@ -149,7 +149,9 @@ void PX4RCOutput::enable_ch(uint8_t ch)
         _init_alt_channels();
     }
     _enabled_channels |= (1U<<ch);
-    _period[ch] = 0;
+    if (_period[ch] == PWM_IGNORE_THIS_CHANNEL) {
+        _period[ch] = 0;
+    }
 }
 
 void PX4RCOutput::disable_ch(uint8_t ch)
-- 
GitLab