mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
Fix to acc parameter group reset
This commit is contained in:
parent
1a58b1d4fd
commit
dd4d137fbc
3 changed files with 6 additions and 19 deletions
|
@ -89,18 +89,6 @@ profile_t *currentProfile;
|
||||||
static uint8_t currentControlRateProfileIndex = 0;
|
static uint8_t currentControlRateProfileIndex = 0;
|
||||||
controlRateConfig_t *currentControlRateProfile;
|
controlRateConfig_t *currentControlRateProfile;
|
||||||
|
|
||||||
|
|
||||||
static void resetAccelerometerTrims(flightDynamicsTrims_t * accZero, flightDynamicsTrims_t * accGain)
|
|
||||||
{
|
|
||||||
accZero->values.pitch = 0;
|
|
||||||
accZero->values.roll = 0;
|
|
||||||
accZero->values.yaw = 0;
|
|
||||||
|
|
||||||
accGain->values.pitch = 4096;
|
|
||||||
accGain->values.roll = 4096;
|
|
||||||
accGain->values.yaw = 4096;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetPidProfile(pidProfile_t *pidProfile)
|
void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
{
|
{
|
||||||
pidProfile->P8[ROLL] = 40;
|
pidProfile->P8[ROLL] = 40;
|
||||||
|
@ -458,8 +446,6 @@ void createDefaultConfig(master_t *config)
|
||||||
config->imuConfig.dcm_ki_mag = 0; // 0.00 * 10000
|
config->imuConfig.dcm_ki_mag = 0; // 0.00 * 10000
|
||||||
config->imuConfig.small_angle = 25;
|
config->imuConfig.small_angle = 25;
|
||||||
|
|
||||||
resetAccelerometerTrims(&accelerometerConfig()->accZero, &accelerometerConfig()->accGain);
|
|
||||||
|
|
||||||
config->boardAlignment.rollDeciDegrees = 0;
|
config->boardAlignment.rollDeciDegrees = 0;
|
||||||
config->boardAlignment.pitchDeciDegrees = 0;
|
config->boardAlignment.pitchDeciDegrees = 0;
|
||||||
config->boardAlignment.yawDeciDegrees = 0;
|
config->boardAlignment.yawDeciDegrees = 0;
|
||||||
|
|
|
@ -68,7 +68,7 @@ static uint16_t calibratingA = 0; // the calibration is done is the main lo
|
||||||
|
|
||||||
static biquadFilter_t accFilter[XYZ_AXIS_COUNT];
|
static biquadFilter_t accFilter[XYZ_AXIS_COUNT];
|
||||||
|
|
||||||
PG_REGISTER_PROFILE_WITH_RESET_FN(accelerometerConfig_t, accelerometerConfig, PG_ACCELEROMETER_CONFIG, 0);
|
PG_REGISTER_WITH_RESET_FN(accelerometerConfig_t, accelerometerConfig, PG_ACCELEROMETER_CONFIG, 0);
|
||||||
|
|
||||||
void pgResetFn_accelerometerConfig(accelerometerConfig_t *instance)
|
void pgResetFn_accelerometerConfig(accelerometerConfig_t *instance)
|
||||||
{
|
{
|
||||||
|
@ -83,11 +83,12 @@ void pgResetFn_accelerometerConfig(accelerometerConfig_t *instance)
|
||||||
.raw[Z] = 0
|
.raw[Z] = 0
|
||||||
);
|
);
|
||||||
RESET_CONFIG_2(flightDynamicsTrims_t, &instance->accGain,
|
RESET_CONFIG_2(flightDynamicsTrims_t, &instance->accGain,
|
||||||
.raw[X] = 0,
|
.raw[X] = 4096,
|
||||||
.raw[Y] = 0,
|
.raw[Y] = 4096,
|
||||||
.raw[Z] = 0
|
.raw[Z] = 4096
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool accDetect(accDev_t *dev, accelerationSensor_e accHardwareToUse)
|
static bool accDetect(accDev_t *dev, accelerationSensor_e accHardwareToUse)
|
||||||
{
|
{
|
||||||
accelerationSensor_e accHardware = ACC_NONE;
|
accelerationSensor_e accHardware = ACC_NONE;
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef struct accelerometerConfig_s {
|
||||||
flightDynamicsTrims_t accGain; // Accelerometer gain to read exactly 1G
|
flightDynamicsTrims_t accGain; // Accelerometer gain to read exactly 1G
|
||||||
} accelerometerConfig_t;
|
} accelerometerConfig_t;
|
||||||
|
|
||||||
PG_DECLARE_PROFILE(accelerometerConfig_t, accelerometerConfig);
|
PG_DECLARE(accelerometerConfig_t, accelerometerConfig);
|
||||||
|
|
||||||
bool accInit(uint32_t accTargetLooptime);
|
bool accInit(uint32_t accTargetLooptime);
|
||||||
bool isAccelerationCalibrationComplete(void);
|
bool isAccelerationCalibrationComplete(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue