Page 351 - 2
P. 351

errorGyroI[ROLL] = 0; errorGyroI[PITCH] = 0;
                    #if PID_CONTROLLER == 1
                      errorGyroI_YAW = 0;
                    #elif PID_CONTROLLER == 2
                      errorGyroI[YAW] = 0;
                    #endif
                    errorAngleI[ROLL] = 0; errorAngleI[PITCH] = 0;
                  #endif
                  if (conf.activate[BOXARM] > 0) {              // Arming/Disarming via ARM BOX
                    if ( rcOptions[BOXARM] && f.OK_TO_ARM ) go_arm(); else if (f.ARMED) go_disarm();
                  }
                }
                if(rcDelayCommand == 20) {
                  if(f.ARMED) {                   // actions during armed
                    #ifdef ALLOW_ARM_DISARM_VIA_TX_YAW
                      if (conf.activate[BOXARM] == 0 && rcSticks == THR_LO + YAW_LO + PIT_CE + RO
            L_CE) go_disarm();    // Disarm via YAW
                    #endif
                    #ifdef ALLOW_ARM_DISARM_VIA_TX_ROLL
                      if (conf.activate[BOXARM] == 0 && rcSticks == THR_LO + YAW_CE + PIT_CE + RO
            L_LO) go_disarm();    // Disarm via ROLL
                    #endif
                  } else {                        // actions during not armed
                    i=0;
                    if (rcSticks == THR_LO + YAW_LO + PIT_LO + ROL_CE) {             // GYRO calibration
                      calibratingG=512;
                      #if GPS
                        GPS_reset_home_position();
                      #endif
                      #if BARO
                        calibratingB=10;  // calibrate baro to new ground level (10 * 25 ms = ~250 ms non
            blocking)
                      #endif
                    }
                    #if defined(INFLIGHT_ACC_CALIBRATION)
                     else if (rcSticks == THR_LO + YAW_LO + PIT_HI + ROL_HI) {            // Inflight ACC cali
            bration START/STOP
                        if (AccInflightCalibrationMeasurementDone){                 // trigger saving into eep
            rom after landing
                          AccInflightCalibrationMeasurementDone = 0;
                          AccInflightCalibrationSavetoEEProm = 1;
                        }else{
                          AccInflightCalibrationArmed = !AccInflightCalibrationArmed;
                          #if defined(BUZZER)
                            if (AccInflightCalibrationArmed) SET_ALARM_BUZZER(ALRM_FAC_TOGGLE, ALR


                                                         - 351 -
   346   347   348   349   350   351   352   353   354   355   356