From 364029afecbe8b691ff6c753885c9893adc7d135 Mon Sep 17 00:00:00 2001 From: "Larry (TBS)" Date: Tue, 2 Feb 2016 16:52:18 +0800 Subject: [PATCH] - BST Update and BST_SET_LED_COLORS can set one by one. --- src/main/config/config.c | 58 ++++++++++++++++++++++------------------ src/main/io/i2c_bst.c | 20 +++++++------- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/src/main/config/config.c b/src/main/config/config.c index e9b2dcd50b..ea5ce2cb1a 100755 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -577,17 +577,37 @@ static void resetConf(void) #if defined(COLIBRI_RACE) currentProfile->pidProfile.pidController = 1; - masterConfig.rxConfig.rcmap[0] = 1; - masterConfig.rxConfig.rcmap[1] = 2; - masterConfig.rxConfig.rcmap[2] = 3; - masterConfig.rxConfig.rcmap[3] = 0; - masterConfig.rxConfig.rcmap[4] = 4; - masterConfig.rxConfig.rcmap[5] = 5; - masterConfig.rxConfig.rcmap[6] = 6; - masterConfig.rxConfig.rcmap[7] = 7; - masterConfig.rxConfig.rcSmoothing = 0; - currentProfile->pidProfile.pidController = 2; + + currentControlRateProfile->rcRate8 = 100; + currentControlRateProfile->rcExpo8 = 70; + currentControlRateProfile->rcYawExpo8 = 70; + currentControlRateProfile->thrMid8 = 50; + currentControlRateProfile->thrExpo8 = 0; + currentControlRateProfile->rates[FD_ROLL] = 90; + currentControlRateProfile->rates[FD_PITCH] = 90; + currentControlRateProfile->rates[FD_YAW] = 90; + currentControlRateProfile->dynThrPID = 30; + currentControlRateProfile->tpa_breakpoint = 1500; + currentProfile->rcControlsConfig.deadband = 10; + + masterConfig.escAndServoConfig.minthrottle = 1025; + masterConfig.escAndServoConfig.maxthrottle = 1980; + masterConfig.batteryConfig.vbatmaxcellvoltage = 45; + masterConfig.batteryConfig.vbatmincellvoltage = 30; + + currentProfile->pidProfile.P8[ROLL] = 31; // new PID with preliminary defaults test carefully + currentProfile->pidProfile.I8[ROLL] = 42; + currentProfile->pidProfile.D8[ROLL] = 21; + currentProfile->pidProfile.P8[PITCH] = 62; + currentProfile->pidProfile.I8[PITCH] = 74; + currentProfile->pidProfile.D8[PITCH] = 23; + currentProfile->pidProfile.P8[YAW] = 100; + currentProfile->pidProfile.I8[YAW] = 45; + currentProfile->pidProfile.D8[YAW] = 15; + currentProfile->pidProfile.P8[PIDLEVEL] = 60; + currentProfile->pidProfile.I8[PIDLEVEL] = 60; + currentProfile->pidProfile.D8[PIDLEVEL] = 100; currentProfile->pidProfile.P_f[ROLL] = 0.7f; // new PID with preliminary defaults test carefully currentProfile->pidProfile.I_f[ROLL] = 0.4f; @@ -599,22 +619,8 @@ static void resetConf(void) currentProfile->pidProfile.I_f[YAW] = 0.9f; currentProfile->pidProfile.D_f[YAW] = 0.01f; - masterConfig.controlRateProfiles[0].rcRate8 = 100; - masterConfig.controlRateProfiles[0].rcExpo8 = 70; - masterConfig.controlRateProfiles[0].rcYawExpo8 = 70; - masterConfig.controlRateProfiles[0].thrMid8 = 50; - masterConfig.controlRateProfiles[0].thrExpo8 = 0; - masterConfig.controlRateProfiles[0].rates[FD_ROLL] = 90; - masterConfig.controlRateProfiles[0].rates[FD_PITCH] = 90; - masterConfig.controlRateProfiles[0].rates[FD_YAW] = 90; - masterConfig.controlRateProfiles[0].dynThrPID = 30; - masterConfig.controlRateProfiles[0].tpa_breakpoint = 1500; - masterConfig.profile[0].rcControlsConfig.deadband = 10; - - masterConfig.escAndServoConfig.minthrottle = 1025; - masterConfig.escAndServoConfig.maxthrottle = 1980; - masterConfig.batteryConfig.vbatmaxcellvoltage = 45; - masterConfig.batteryConfig.vbatmincellvoltage = 30; + masterConfig.failsafeConfig.failsafe_delay = 10; + masterConfig.failsafeConfig.failsafe_off_delay = 20; featureSet(FEATURE_ONESHOT125); featureSet(FEATURE_VBAT); diff --git a/src/main/io/i2c_bst.c b/src/main/io/i2c_bst.c index 53224d66f5..876bbbb1c2 100644 --- a/src/main/io/i2c_bst.c +++ b/src/main/io/i2c_bst.c @@ -987,10 +987,10 @@ static bool bstSlaveProcessFeedbackCommand(uint8_t bstRequest) bstWrite32(0); // future exp break; case BST_DEADBAND: - bstWrite8(masterConfig.profile[0].rcControlsConfig.alt_hold_deadband); - bstWrite8(masterConfig.profile[0].rcControlsConfig.alt_hold_fast_change); - bstWrite8(masterConfig.profile[0].rcControlsConfig.deadband); - bstWrite8(masterConfig.profile[0].rcControlsConfig.yaw_deadband); + bstWrite8(currentProfile->rcControlsConfig.alt_hold_deadband); + bstWrite8(currentProfile->rcControlsConfig.alt_hold_fast_change); + bstWrite8(currentProfile->rcControlsConfig.deadband); + bstWrite8(currentProfile->rcControlsConfig.yaw_deadband); break; case BST_FC_FILTERS: bstWrite16(constrain(masterConfig.gyro_lpf, 0, 1)); // Extra safety to prevent OSD setting corrupt values @@ -1401,7 +1401,9 @@ static bool bstSlaveProcessWriteCommand(uint8_t bstWriteCommand) break; #ifdef LED_STRIP case BST_SET_LED_COLORS: - for (i = 0; i < CONFIGURABLE_COLOR_COUNT; i++) { + //for (i = 0; i < CONFIGURABLE_COLOR_COUNT; i++) { + { + i = bstRead8(); hsvColor_t *color = &masterConfig.colors[i]; color->h = bstRead16(); color->s = bstRead8(); @@ -1449,10 +1451,10 @@ static bool bstSlaveProcessWriteCommand(uint8_t bstWriteCommand) DISABLE_ARMING_FLAG(PREVENT_ARMING); break; case BST_SET_DEADBAND: - masterConfig.profile[0].rcControlsConfig.alt_hold_deadband = bstRead8(); - masterConfig.profile[0].rcControlsConfig.alt_hold_fast_change = bstRead8(); - masterConfig.profile[0].rcControlsConfig.deadband = bstRead8(); - masterConfig.profile[0].rcControlsConfig.yaw_deadband = bstRead8(); + currentProfile->rcControlsConfig.alt_hold_deadband = bstRead8(); + currentProfile->rcControlsConfig.alt_hold_fast_change = bstRead8(); + currentProfile->rcControlsConfig.deadband = bstRead8(); + currentProfile->rcControlsConfig.yaw_deadband = bstRead8(); break; case BST_SET_FC_FILTERS: masterConfig.gyro_lpf = bstRead16();