From 75368fb6a2db5fbdd1d318119814edf20654c6d9 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Wed, 27 Jul 2016 07:27:41 +1200 Subject: [PATCH] Moved resetting rateprofile values into 'resetPidProfile' to make them get reset on 'Reset PID' in GUI. --- src/main/config/config.c | 49 ++++++++++++++++++++++------------------ src/main/io/serial_msp.c | 4 ++-- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index 74399f1bd..56b5acf19 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -180,7 +180,23 @@ static void resetAccelerometerTrims(flightDynamicsTrims_t *accelerometerTrims) 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; @@ -242,6 +258,15 @@ void resetPidProfile(pidProfile_t *pidProfile) #endif } +void resetProfile(profile_t *profile) +{ + resetPidProfile(&profile->pidProfile); + + for (int rI = 0; rIcontrolRateProfile[rI]); + } +} + #ifdef GPS void resetGpsProfile(gpsProfile_t *gpsProfile) { @@ -350,23 +375,6 @@ void resetSerialConfig(serialConfig_t *serialConfig) 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) { rcControlsConfig->deadband = 0; @@ -560,11 +568,8 @@ static void resetConf(void) masterConfig.emf_avoidance = 0; // TODO - needs removal - resetPidProfile(¤tProfile->pidProfile); + resetProfile(currentProfile); - for (int rI = 0; rIpidProfile); + resetProfile(currentProfile); break; case MSP_SET_SENSOR_ALIGNMENT: