Merge pull request #827 from mikeller/fix_msp_reset_profile
Moved resetting rateprofile values into 'resetPidProfile' to make them get reset on 'Reset PID' in GUI.
This commit is contained in:
commit
5305b86bec
|
@ -180,7 +180,23 @@ static void resetAccelerometerTrims(flightDynamicsTrims_t *accelerometerTrims)
|
||||||
accelerometerTrims->values.yaw = 0;
|
accelerometerTrims->values.yaw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetPidProfile(pidProfile_t *pidProfile)
|
static void resetControlRateConfig(controlRateConfig_t *controlRateConfig)
|
||||||
|
{
|
||||||
|
controlRateConfig->rcRate8 = 100;
|
||||||
|
controlRateConfig->rcYawRate8 = 100;
|
||||||
|
controlRateConfig->rcExpo8 = 10;
|
||||||
|
controlRateConfig->thrMid8 = 50;
|
||||||
|
controlRateConfig->thrExpo8 = 0;
|
||||||
|
controlRateConfig->dynThrPID = 20;
|
||||||
|
controlRateConfig->rcYawExpo8 = 10;
|
||||||
|
controlRateConfig->tpa_breakpoint = 1650;
|
||||||
|
|
||||||
|
for (uint8_t axis = 0; axis < FLIGHT_DYNAMICS_INDEX_COUNT; axis++) {
|
||||||
|
controlRateConfig->rates[axis] = 70;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
{
|
{
|
||||||
pidProfile->pidController = PID_CONTROLLER_BETAFLIGHT;
|
pidProfile->pidController = PID_CONTROLLER_BETAFLIGHT;
|
||||||
|
|
||||||
|
@ -242,6 +258,15 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetProfile(profile_t *profile)
|
||||||
|
{
|
||||||
|
resetPidProfile(&profile->pidProfile);
|
||||||
|
|
||||||
|
for (int rI = 0; rI<MAX_RATEPROFILES; rI++) {
|
||||||
|
resetControlRateConfig(&profile->controlRateProfile[rI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GPS
|
#ifdef GPS
|
||||||
void resetGpsProfile(gpsProfile_t *gpsProfile)
|
void resetGpsProfile(gpsProfile_t *gpsProfile)
|
||||||
{
|
{
|
||||||
|
@ -350,23 +375,6 @@ void resetSerialConfig(serialConfig_t *serialConfig)
|
||||||
serialConfig->reboot_character = 'R';
|
serialConfig->reboot_character = 'R';
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetControlRateConfig(controlRateConfig_t *controlRateConfig)
|
|
||||||
{
|
|
||||||
controlRateConfig->rcRate8 = 100;
|
|
||||||
controlRateConfig->rcYawRate8 = 100;
|
|
||||||
controlRateConfig->rcExpo8 = 10;
|
|
||||||
controlRateConfig->thrMid8 = 50;
|
|
||||||
controlRateConfig->thrExpo8 = 0;
|
|
||||||
controlRateConfig->dynThrPID = 20;
|
|
||||||
controlRateConfig->rcYawExpo8 = 10;
|
|
||||||
controlRateConfig->tpa_breakpoint = 1650;
|
|
||||||
|
|
||||||
for (uint8_t axis = 0; axis < FLIGHT_DYNAMICS_INDEX_COUNT; axis++) {
|
|
||||||
controlRateConfig->rates[axis] = 70;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetRcControlsConfig(rcControlsConfig_t *rcControlsConfig)
|
void resetRcControlsConfig(rcControlsConfig_t *rcControlsConfig)
|
||||||
{
|
{
|
||||||
rcControlsConfig->deadband = 0;
|
rcControlsConfig->deadband = 0;
|
||||||
|
@ -560,11 +568,8 @@ static void resetConf(void)
|
||||||
|
|
||||||
masterConfig.emf_avoidance = 0; // TODO - needs removal
|
masterConfig.emf_avoidance = 0; // TODO - needs removal
|
||||||
|
|
||||||
resetPidProfile(¤tProfile->pidProfile);
|
resetProfile(currentProfile);
|
||||||
|
|
||||||
for (int rI = 0; rI<MAX_RATEPROFILES; rI++) {
|
|
||||||
resetControlRateConfig(&masterConfig.profile[0].controlRateProfile[rI]);
|
|
||||||
}
|
|
||||||
resetRollAndPitchTrims(&masterConfig.accelerometerTrims);
|
resetRollAndPitchTrims(&masterConfig.accelerometerTrims);
|
||||||
|
|
||||||
masterConfig.mag_declination = 0;
|
masterConfig.mag_declination = 0;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static serialPort_t *mspSerialPort;
|
||||||
|
|
||||||
extern uint16_t cycleTime; // FIXME dependency on mw.c
|
extern uint16_t cycleTime; // FIXME dependency on mw.c
|
||||||
extern uint16_t rssi; // FIXME dependency on mw.c
|
extern uint16_t rssi; // FIXME dependency on mw.c
|
||||||
extern void resetPidProfile(pidProfile_t *pidProfile);
|
extern void resetProfile(profile_t *profile);
|
||||||
|
|
||||||
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, escAndServoConfig_t *escAndServoConfigToUse, pidProfile_t *pidProfileToUse);
|
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, escAndServoConfig_t *escAndServoConfigToUse, pidProfile_t *pidProfileToUse);
|
||||||
|
|
||||||
|
@ -1482,7 +1482,7 @@ static bool processInCommand(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP_SET_RESET_CURR_PID:
|
case MSP_SET_RESET_CURR_PID:
|
||||||
resetPidProfile(¤tProfile->pidProfile);
|
resetProfile(currentProfile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP_SET_SENSOR_ALIGNMENT:
|
case MSP_SET_SENSOR_ALIGNMENT:
|
||||||
|
|
Loading…
Reference in New Issue