Added miss to the acc calibration

This commit is contained in:
Jonas Holmberg 2016-10-31 18:19:44 +01:00
parent e040e35cf6
commit 83c11bd444

View File

@ -163,6 +163,7 @@ bool systemTaskRxCliCheck(uint32_t currentDeltaTime)
return false;
}
//TODO: change the name of this task. Could be something like
void systemTaskSerial(void)
{
static bool readyToCalibrate = true;
@ -180,23 +181,30 @@ void systemTaskSerial(void)
// mpu6000_read_acc_offset(&accelProfile);
// }
// }
//If we are ready to accept a new calibration value. You can only perform one calibration until the sticks have been centered once until the next calibration
if(readyToCalibrate)
{
//If any calibration is performed set readyToCalibrate to false so it cant just increase indefinitely when holding the sticks in a certain position
if (flags_IsSet_ID(systemFlags_stickLeft_id))
{
accRollFineTune -= calibrationAmount;
readyToCalibrate = false;
}
else if (flags_IsSet_ID(systemFlags_stickRight_id))
{
accRollFineTune += calibrationAmount;
readyToCalibrate = false;
}
else if (flags_IsSet_ID(systemFlags_stickUp_id))
{
accPitchFineTune -= calibrationAmount;
readyToCalibrate = false;
}
else if (flags_IsSet_ID(systemFlags_stickDown_id))
{
accPitchFineTune += calibrationAmount;
readyToCalibrate = false;
}
}