.

Dependents:  

Revision:
6:da6b1350783c
Parent:
5:69857f8b6931
--- a/RCin.cpp	Thu Oct 18 12:41:15 2018 +0000
+++ b/RCin.cpp	Wed Oct 24 08:51:36 2018 +0000
@@ -41,17 +41,10 @@
         }
     }
 // *****************************************************************************
-bool RCin::isAlive(void){
-        if(pwms[3]>550)
-            return true;
-        else 
-            return false;
-}
-
-// *****************************************************************************
 uint8_t RCin::get_flightmode(void){
-    if(isAlive()){
+    if(isAlive){
         flightmode_changed = (old_flightmode != current_flightmode);
+        old_flightmode = current_flightmode;
         return current_flightmode;
         }
     else 
@@ -60,9 +53,9 @@
 // *****************************************************************************
 void RCin::map_pwm_2_PM1(void){
     PM1[1]=CH1_2_PM1((float)pwms[1]);
-    this->PM1[2]=this->CH2_2_PM1((float)pwms[2]);
-    this->PM1[3]=this->CH3_2_PM1((float)pwms[3]);
-    this->PM1[4]=this->CH4_2_PM1((float)pwms[4]);
+    PM1[2]=CH2_2_PM1((float)pwms[2]);
+    PM1[3]=CH3_2_PM1((float)pwms[3]);
+    PM1[4]=CH4_2_PM1((float)pwms[4]);
     if(pwms[5] >620 && pwms[5] < 720)
         current_flightmode = LOITER;
     else if(pwms[5] >720 && pwms[5] < 850)
@@ -77,4 +70,7 @@
         current_flightmode = LAND;
     else
         current_flightmode = STABILIZED;
+    if(pwms[3]>550)
+        isAlive = true;
+
     }
\ No newline at end of file