mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 17:55:30 +03:00
Merge pull request #5932 from etracer65/gyro_cal_settings
Make gyro calibration period user configurable and rename moron_threshold
This commit is contained in:
commit
e605b497e8
4 changed files with 6 additions and 3 deletions
|
@ -187,6 +187,7 @@ PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 2);
|
|||
|
||||
PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig,
|
||||
.gyro_align = ALIGN_DEFAULT,
|
||||
.gyroCalibrationDuration = 125, // 1.25 seconds
|
||||
.gyroMovementCalibrationThreshold = 48,
|
||||
.gyro_sync_denom = GYRO_SYNC_DENOM_DEFAULT,
|
||||
.gyro_hardware_lpf = GYRO_HARDWARE_LPF_NORMAL,
|
||||
|
@ -877,7 +878,7 @@ static bool isOnFinalGyroCalibrationCycle(const gyroCalibration_t *gyroCalibrati
|
|||
|
||||
static int32_t gyroCalculateCalibratingCycles(void)
|
||||
{
|
||||
return (CALIBRATING_GYRO_TIME_US / gyro.targetLooptime);
|
||||
return (gyroConfig()->gyroCalibrationDuration * 10000) / gyro.targetLooptime;
|
||||
}
|
||||
|
||||
static bool isOnFirstGyroCalibrationCycle(const gyroCalibration_t *gyroCalibration)
|
||||
|
|
|
@ -105,6 +105,8 @@ typedef struct gyroConfig_s {
|
|||
bool yaw_spin_recovery;
|
||||
int16_t yaw_spin_threshold;
|
||||
|
||||
uint16_t gyroCalibrationDuration; // Gyro calibration duration in 1/100 second
|
||||
|
||||
} gyroConfig_t;
|
||||
|
||||
PG_DECLARE(gyroConfig_t, gyroConfig);
|
||||
|
|
|
@ -43,7 +43,6 @@ typedef union flightDynamicsTrims_u {
|
|||
flightDynamicsTrims_def_t values;
|
||||
} flightDynamicsTrims_t;
|
||||
|
||||
#define CALIBRATING_GYRO_TIME_US 3000000
|
||||
#define CALIBRATING_ACC_CYCLES 400
|
||||
#define CALIBRATING_BARO_CYCLES 200 // 10 seconds init_delay + 200 * 25 ms = 15 seconds before ground pressure settles
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue