Thanks jevermeister's methods of Inflight ACC-calibration,it works!
After tried it serveral times , I changed some code ,so my Inflight ACC-calibration like this:
1.Calibrate gyro and ACC as usual , Armed,then continiue Keep RC sticks in Armed over 4S untill LED flash.
2.Start and use trim to eliminate drift (hover, ACRO or Level mode,I prefer to Level mode), activate MAG (or Headfree, Passthru,just chang the code ), LED stop flash and then on.
3. Land and deactivate MAG, Throttle lowest(< mincheck), new value stored
4.Take back any trims!!! start again: no drift.
Senors.pde, line 281, coment this to save loop time
Code: Select all
//blinkLED(10,10,2); //buzzer for indicatiing the start inflight
MultiWii_dev_20120225.ino
Add inflightcalibratedAccTime
Code: Select all
void annexCode() { //this code is excetuted at each loop and won't interfere with control loop if it lasts less than 650 microseconds
static uint32_t buzzerTime,calibratedAccTime;
static uint32_t inflightcalibratedAccTime;
Instead of :
Code: Select all
if ( (calibratingA>0 && (ACC || nunchuk) ) || (calibratingG>0) ) { // Calibration phasis
LEDPIN_TOGGLE;
} else {
if (calibratedACC == 1) {LEDPIN_OFF;}
if (armed) {LEDPIN_ON;}
}
To be:
Code: Select all
if ( (calibratingA>0 && (ACC || nunchuk) ) || (calibratingG>0) ) { // Calibration phasis
LEDPIN_TOGGLE;
} else {
if (calibratedACC == 1) {LEDPIN_OFF;}
if (armed) {
#if defined(InflightAccCalibration)
if ( AccInflightCalibrationArmed ) {
if (currentTime > inflightcalibratedAccTime) { inflightcalibratedAccTime = currentTime + 50000; LEDPIN_ON;}
}
else
#endif
{LEDPIN_ON;}
}
}
Instead of :
Code: Select all
#if defined(InflightAccCalibration)
else if (armed == 0 && rcData[YAW] < MINCHECK && rcData[PITCH] > MAXCHECK && rcData[ROLL] > MAXCHECK){
if (rcDelayCommand == 20){
if (AccInflightCalibrationMeasurementDone){ //trigger saving into eeprom after landing
AccInflightCalibrationMeasurementDone = 0;
AccInflightCalibrationSavetoEEProm = 1;
}else{
AccInflightCalibrationArmed = !AccInflightCalibrationArmed;
if (AccInflightCalibrationArmed){blinkLED(10,1,2);}else{blinkLED(10,10,3);}
}
}
}
#endif
To be:
Code: Select all
#if defined(InflightAccCalibration)
else if ( (rcData[YAW] > MAXCHECK || rcData[ROLL] > MAXCHECK) && rcData[PITCH] < MAXCHECK && armed == 1 && calibratingG == 0) {
if (rcDelayCommand == 200){
//calibratingA=400;
AccInflightCalibrationArmed = !AccInflightCalibrationArmed;
}
}
else if(AccInflightCalibrationMeasurementDone){ //trigger saving into eeprom after landing
AccInflightCalibrationMeasurementDone = 0;
AccInflightCalibrationSavetoEEProm = 1;
blinkLED(10,10,2);
}
#endif
Finally, comment some sentence, "!rcOptions[BOXARM]" changed to "rcOptions[BOXMAG]"
Code: Select all
#if defined(InflightAccCalibration)
if (AccInflightCalibrationArmed && armed == 1 && rcData[THROTTLE] > MINCHECK && rcOptions[BOXMAG] ){ // Copter is airborne and you are turning it off via boxarm : start measurement
InflightcalibratingA = 50;
AccInflightCalibrationArmed = 0;
}
/*if (rcOptions[BOXPASSTHRU]) { //Use the Passthru Option to activate : Passthru = TRUE Meausrement started, Land and passtrhu = 0 measurement stored
if (!AccInflightCalibrationActive && !AccInflightCalibrationMeasurementDone){
InflightcalibratingA = 50;
}
}else if(AccInflightCalibrationMeasurementDone && armed == 0){
AccInflightCalibrationMeasurementDone = 0;
AccInflightCalibrationSavetoEEProm = 1;
}*/
#endif
Sorry for my terrible English , i'm from China, Hope you like this method to calibration ACC in flight!