From 07dc35d441a3123bdc79ea5fc210ad726e7e2539 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Wed, 1 Feb 2017 13:09:46 +0000 Subject: [PATCH] Removed mixer and battery config static copies --- src/main/fc/config.c | 8 +------- src/main/fc/fc_init.c | 2 +- src/main/flight/mixer.c | 26 ++------------------------ src/main/flight/mixer.h | 7 +------ src/main/sensors/battery.c | 11 +---------- src/main/sensors/battery.h | 2 +- 6 files changed, 7 insertions(+), 49 deletions(-) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 232399a9a..0ab826f33 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -913,13 +913,7 @@ void activateConfig(void) setAccelerationTrims(&accelerometerConfigMutable()->accZero); setAccelerationFilter(accelerometerConfig()->acc_lpf_hz); - mixerUseConfigs( - &masterConfig.flight3DConfig, - &masterConfig.motorConfig, - &masterConfig.mixerConfig, - &masterConfig.airplaneConfig, - &masterConfig.rxConfig - ); + mixerUseConfigs(&masterConfig.airplaneConfig); #ifdef USE_SERVOS servoUseConfigs(&masterConfig.servoMixerConfig, masterConfig.servoProfile.servoConf, &masterConfig.gimbalConfig); diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index 4e24d8772..f1652946b 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -551,7 +551,7 @@ void init(void) // Now that everything has powered up the voltage and cell count be determined. if (feature(FEATURE_VBAT | FEATURE_CURRENT_METER)) - batteryInit(batteryConfig()); + batteryInit(); #ifdef USE_DASHBOARD if (feature(FEATURE_DASHBOARD)) { diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index ddac5029d..fd36ad76e 100755 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -63,12 +63,6 @@ int16_t motor[MAX_SUPPORTED_MOTORS]; int16_t motor_disarmed[MAX_SUPPORTED_MOTORS]; static airplaneConfig_t *airplaneConfig; -#ifndef USE_PARAMETER_GROUPS -static const mixerConfig_t *mixerConfig; -static const flight3DConfig_t *flight3DConfig; -static const motorConfig_t *motorConfig; -const rxConfig_t *rxConfig; -#endif mixerMode_e currentMixerMode; static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS]; @@ -297,24 +291,8 @@ void initEscEndpoints(void) { rcCommandThrottleRange3dHigh = PWM_RANGE_MAX - rxConfig()->midrc - flight3DConfig()->deadband3d_throttle; } -void mixerUseConfigs( - flight3DConfig_t *flight3DConfigToUse, - motorConfig_t *motorConfigToUse, - mixerConfig_t *mixerConfigToUse, - airplaneConfig_t *airplaneConfigToUse, - rxConfig_t *rxConfigToUse) +void mixerUseConfigs(airplaneConfig_t *airplaneConfigToUse) { -#ifdef USE_PARAMETER_GROUPS - (void)(flight3DConfigToUse); - (void)(motorConfigToUse); - (void)(mixerConfigToUse); - (void)(rxConfigToUse); -#else - flight3DConfig = flight3DConfigToUse; - motorConfig = motorConfigToUse; - mixerConfig = mixerConfigToUse; - rxConfig = rxConfigToUse; -#endif airplaneConfig = airplaneConfigToUse; } @@ -494,7 +472,7 @@ void mixTable(pidProfile_t *pidProfile) } // Calculate voltage compensation - const float vbatCompensationFactor = (batteryConfig && pidProfile->vbatPidCompensation) ? calculateVbatPidCompensation() : 1.0f; + const float vbatCompensationFactor = pidProfile->vbatPidCompensation ? calculateVbatPidCompensation() : 1.0f; // Find roll/pitch/yaw desired output float motorMix[MAX_SUPPORTED_MOTORS]; diff --git a/src/main/flight/mixer.h b/src/main/flight/mixer.h index 6a206f4e8..66baf8172 100644 --- a/src/main/flight/mixer.h +++ b/src/main/flight/mixer.h @@ -141,12 +141,7 @@ struct rxConfig_s; uint8_t getMotorCount(); float getMotorMixRange(); -void mixerUseConfigs( - flight3DConfig_t *flight3DConfigToUse, - motorConfig_t *motorConfigToUse, - mixerConfig_t *mixerConfigToUse, - airplaneConfig_t *airplaneConfigToUse, - struct rxConfig_s *rxConfigToUse); +void mixerUseConfigs(airplaneConfig_t *airplaneConfigToUse); void mixerLoadMix(int index, motorMixer_t *customMixers); void mixerInit(mixerMode_e mixerMode, motorMixer_t *customMotorMixers); diff --git a/src/main/sensors/battery.c b/src/main/sensors/battery.c index 96735549b..02f53ffa9 100644 --- a/src/main/sensors/battery.c +++ b/src/main/sensors/battery.c @@ -68,10 +68,6 @@ int32_t amperageLatest = 0; // most recent value int32_t mAhDrawn = 0; // milliampere hours drawn from the battery since start -#ifndef USE_PARAMETER_GROUPS -const batteryConfig_t *batteryConfig; -#endif - static batteryState_e vBatState; static batteryState_e consumptionState; @@ -213,13 +209,8 @@ const char * getBatteryStateString(void) return batteryStateStrings[getBatteryState()]; } -void batteryInit(const batteryConfig_t *initialBatteryConfig) +void batteryInit(void) { -#ifndef USE_PARAMETER_GROUPS - (void)initialBatteryConfig; -#else - batteryConfig = initialBatteryConfig; -#endif vBatState = BATTERY_NOT_PRESENT; consumptionState = BATTERY_OK; batteryCellCount = 0; diff --git a/src/main/sensors/battery.h b/src/main/sensors/battery.h index 8e1530390..a8e21145f 100644 --- a/src/main/sensors/battery.h +++ b/src/main/sensors/battery.h @@ -87,7 +87,7 @@ extern const batteryConfig_t *batteryConfig; batteryState_e getBatteryState(void); const char * getBatteryStateString(void); void updateBattery(void); -void batteryInit(const batteryConfig_t *initialBatteryConfig); +void batteryInit(void); struct rxConfig_s; void updateCurrentMeter(int32_t lastUpdateAt, const struct rxConfig_s *rxConfig, uint16_t deadband3d_throttle);