mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Removed mixer and battery config static copies
This commit is contained in:
parent
5851b21e4a
commit
07dc35d441
6 changed files with 7 additions and 49 deletions
|
@ -913,13 +913,7 @@ void activateConfig(void)
|
||||||
setAccelerationTrims(&accelerometerConfigMutable()->accZero);
|
setAccelerationTrims(&accelerometerConfigMutable()->accZero);
|
||||||
setAccelerationFilter(accelerometerConfig()->acc_lpf_hz);
|
setAccelerationFilter(accelerometerConfig()->acc_lpf_hz);
|
||||||
|
|
||||||
mixerUseConfigs(
|
mixerUseConfigs(&masterConfig.airplaneConfig);
|
||||||
&masterConfig.flight3DConfig,
|
|
||||||
&masterConfig.motorConfig,
|
|
||||||
&masterConfig.mixerConfig,
|
|
||||||
&masterConfig.airplaneConfig,
|
|
||||||
&masterConfig.rxConfig
|
|
||||||
);
|
|
||||||
|
|
||||||
#ifdef USE_SERVOS
|
#ifdef USE_SERVOS
|
||||||
servoUseConfigs(&masterConfig.servoMixerConfig, masterConfig.servoProfile.servoConf, &masterConfig.gimbalConfig);
|
servoUseConfigs(&masterConfig.servoMixerConfig, masterConfig.servoProfile.servoConf, &masterConfig.gimbalConfig);
|
||||||
|
|
|
@ -551,7 +551,7 @@ void init(void)
|
||||||
// Now that everything has powered up the voltage and cell count be determined.
|
// Now that everything has powered up the voltage and cell count be determined.
|
||||||
|
|
||||||
if (feature(FEATURE_VBAT | FEATURE_CURRENT_METER))
|
if (feature(FEATURE_VBAT | FEATURE_CURRENT_METER))
|
||||||
batteryInit(batteryConfig());
|
batteryInit();
|
||||||
|
|
||||||
#ifdef USE_DASHBOARD
|
#ifdef USE_DASHBOARD
|
||||||
if (feature(FEATURE_DASHBOARD)) {
|
if (feature(FEATURE_DASHBOARD)) {
|
||||||
|
|
|
@ -63,12 +63,6 @@ int16_t motor[MAX_SUPPORTED_MOTORS];
|
||||||
int16_t motor_disarmed[MAX_SUPPORTED_MOTORS];
|
int16_t motor_disarmed[MAX_SUPPORTED_MOTORS];
|
||||||
|
|
||||||
static airplaneConfig_t *airplaneConfig;
|
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;
|
mixerMode_e currentMixerMode;
|
||||||
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
|
static motorMixer_t currentMixer[MAX_SUPPORTED_MOTORS];
|
||||||
|
@ -297,24 +291,8 @@ void initEscEndpoints(void) {
|
||||||
rcCommandThrottleRange3dHigh = PWM_RANGE_MAX - rxConfig()->midrc - flight3DConfig()->deadband3d_throttle;
|
rcCommandThrottleRange3dHigh = PWM_RANGE_MAX - rxConfig()->midrc - flight3DConfig()->deadband3d_throttle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mixerUseConfigs(
|
void mixerUseConfigs(airplaneConfig_t *airplaneConfigToUse)
|
||||||
flight3DConfig_t *flight3DConfigToUse,
|
|
||||||
motorConfig_t *motorConfigToUse,
|
|
||||||
mixerConfig_t *mixerConfigToUse,
|
|
||||||
airplaneConfig_t *airplaneConfigToUse,
|
|
||||||
rxConfig_t *rxConfigToUse)
|
|
||||||
{
|
{
|
||||||
#ifdef USE_PARAMETER_GROUPS
|
|
||||||
(void)(flight3DConfigToUse);
|
|
||||||
(void)(motorConfigToUse);
|
|
||||||
(void)(mixerConfigToUse);
|
|
||||||
(void)(rxConfigToUse);
|
|
||||||
#else
|
|
||||||
flight3DConfig = flight3DConfigToUse;
|
|
||||||
motorConfig = motorConfigToUse;
|
|
||||||
mixerConfig = mixerConfigToUse;
|
|
||||||
rxConfig = rxConfigToUse;
|
|
||||||
#endif
|
|
||||||
airplaneConfig = airplaneConfigToUse;
|
airplaneConfig = airplaneConfigToUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +472,7 @@ void mixTable(pidProfile_t *pidProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate voltage compensation
|
// 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
|
// Find roll/pitch/yaw desired output
|
||||||
float motorMix[MAX_SUPPORTED_MOTORS];
|
float motorMix[MAX_SUPPORTED_MOTORS];
|
||||||
|
|
|
@ -141,12 +141,7 @@ struct rxConfig_s;
|
||||||
uint8_t getMotorCount();
|
uint8_t getMotorCount();
|
||||||
float getMotorMixRange();
|
float getMotorMixRange();
|
||||||
|
|
||||||
void mixerUseConfigs(
|
void mixerUseConfigs(airplaneConfig_t *airplaneConfigToUse);
|
||||||
flight3DConfig_t *flight3DConfigToUse,
|
|
||||||
motorConfig_t *motorConfigToUse,
|
|
||||||
mixerConfig_t *mixerConfigToUse,
|
|
||||||
airplaneConfig_t *airplaneConfigToUse,
|
|
||||||
struct rxConfig_s *rxConfigToUse);
|
|
||||||
|
|
||||||
void mixerLoadMix(int index, motorMixer_t *customMixers);
|
void mixerLoadMix(int index, motorMixer_t *customMixers);
|
||||||
void mixerInit(mixerMode_e mixerMode, motorMixer_t *customMotorMixers);
|
void mixerInit(mixerMode_e mixerMode, motorMixer_t *customMotorMixers);
|
||||||
|
|
|
@ -68,10 +68,6 @@ int32_t amperageLatest = 0; // most recent value
|
||||||
|
|
||||||
int32_t mAhDrawn = 0; // milliampere hours drawn from the battery since start
|
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 vBatState;
|
||||||
static batteryState_e consumptionState;
|
static batteryState_e consumptionState;
|
||||||
|
|
||||||
|
@ -213,13 +209,8 @@ const char * getBatteryStateString(void)
|
||||||
return batteryStateStrings[getBatteryState()];
|
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;
|
vBatState = BATTERY_NOT_PRESENT;
|
||||||
consumptionState = BATTERY_OK;
|
consumptionState = BATTERY_OK;
|
||||||
batteryCellCount = 0;
|
batteryCellCount = 0;
|
||||||
|
|
|
@ -87,7 +87,7 @@ extern const batteryConfig_t *batteryConfig;
|
||||||
batteryState_e getBatteryState(void);
|
batteryState_e getBatteryState(void);
|
||||||
const char * getBatteryStateString(void);
|
const char * getBatteryStateString(void);
|
||||||
void updateBattery(void);
|
void updateBattery(void);
|
||||||
void batteryInit(const batteryConfig_t *initialBatteryConfig);
|
void batteryInit(void);
|
||||||
|
|
||||||
struct rxConfig_s;
|
struct rxConfig_s;
|
||||||
void updateCurrentMeter(int32_t lastUpdateAt, const struct rxConfig_s *rxConfig, uint16_t deadband3d_throttle);
|
void updateCurrentMeter(int32_t lastUpdateAt, const struct rxConfig_s *rxConfig, uint16_t deadband3d_throttle);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue