mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
Merge pull request #5261 from iNavFlight/dzikuvx-fix-pid-bank-selection
Fix PID bank selection
This commit is contained in:
commit
c89e1e7f2c
2 changed files with 10 additions and 5 deletions
|
@ -1053,7 +1053,7 @@ void pidInit(void)
|
|||
#endif
|
||||
|
||||
if (pidProfile()->pidControllerType == PID_TYPE_AUTO) {
|
||||
if (STATE(FIXED_WING)) {
|
||||
if (mixerConfig()->platformType == PLATFORM_AIRPLANE) {
|
||||
usedPidControllerType = PID_TYPE_PIFF;
|
||||
} else {
|
||||
usedPidControllerType = PID_TYPE_PID;
|
||||
|
@ -1076,3 +1076,10 @@ void pidInit(void)
|
|||
pidControllerApplyFn = nullRateController;
|
||||
}
|
||||
}
|
||||
|
||||
const pidBank_t FAST_CODE NOINLINE * pidBank(void) {
|
||||
return usedPidControllerType == PID_TYPE_PIFF ? &pidProfile()->bank_fw : &pidProfile()->bank_mc;
|
||||
}
|
||||
pidBank_t FAST_CODE NOINLINE * pidBankMutable(void) {
|
||||
return usedPidControllerType == PID_TYPE_PIFF ? &pidProfileMutable()->bank_fw : &pidProfileMutable()->bank_mc;
|
||||
}
|
||||
|
|
|
@ -157,10 +157,8 @@ typedef struct pidAutotuneConfig_s {
|
|||
PG_DECLARE_PROFILE(pidProfile_t, pidProfile);
|
||||
PG_DECLARE(pidAutotuneConfig_t, pidAutotuneConfig);
|
||||
|
||||
static uint8_t usedPidControllerType;
|
||||
|
||||
static inline const pidBank_t * pidBank(void) { return usedPidControllerType == PID_TYPE_PIFF ? &pidProfile()->bank_fw : &pidProfile()->bank_mc; }
|
||||
static inline pidBank_t * pidBankMutable(void) { return usedPidControllerType == PID_TYPE_PIFF ? &pidProfileMutable()->bank_fw : &pidProfileMutable()->bank_mc; }
|
||||
const pidBank_t * pidBank(void);
|
||||
pidBank_t * pidBankMutable(void);
|
||||
|
||||
extern int16_t axisPID[];
|
||||
extern int32_t axisPID_P[], axisPID_I[], axisPID_D[], axisPID_Setpoint[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue