Removed mixer and battery config static copies

This commit is contained in:
Martin Budden 2017-02-01 13:09:46 +00:00
parent 5851b21e4a
commit 07dc35d441
6 changed files with 7 additions and 49 deletions

View File

@ -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);

View File

@ -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)) {

View File

@ -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];

View File

@ -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);

View File

@ -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;

View File

@ -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);