Fixed CONFIG_FASTLOOP_PREFERRED_ACC related magic numbers
This commit is contained in:
parent
efda3d7b5b
commit
91e7c160a3
|
@ -103,7 +103,6 @@ extern uint16_t cycleTime; // FIXME dependency on mw.c
|
||||||
extern uint16_t rssi; // FIXME dependency on mw.c
|
extern uint16_t rssi; // FIXME dependency on mw.c
|
||||||
extern void resetPidProfile(pidProfile_t *pidProfile);
|
extern void resetPidProfile(pidProfile_t *pidProfile);
|
||||||
|
|
||||||
|
|
||||||
void setGyroSamplingSpeed(uint16_t looptime) {
|
void setGyroSamplingSpeed(uint16_t looptime) {
|
||||||
uint16_t gyroSampleRate = 1000;
|
uint16_t gyroSampleRate = 1000;
|
||||||
uint8_t maxDivider = 1;
|
uint8_t maxDivider = 1;
|
||||||
|
@ -116,43 +115,44 @@ void setGyroSamplingSpeed(uint16_t looptime) {
|
||||||
gyroSampleRate = 125;
|
gyroSampleRate = 125;
|
||||||
maxDivider = 8;
|
maxDivider = 8;
|
||||||
masterConfig.pid_process_denom = 1;
|
masterConfig.pid_process_denom = 1;
|
||||||
masterConfig.acc_hardware = 0;
|
masterConfig.acc_hardware = ACC_DEFAULT;
|
||||||
masterConfig.baro_hardware = 0;
|
masterConfig.baro_hardware = BARO_DEFAULT;
|
||||||
masterConfig.mag_hardware = 0;
|
masterConfig.mag_hardware = MAG_DEFAULT;
|
||||||
if (looptime < 250) {
|
if (looptime < 250) {
|
||||||
masterConfig.acc_hardware = 1;
|
masterConfig.acc_hardware = ACC_NONE;
|
||||||
masterConfig.baro_hardware = 1;
|
masterConfig.baro_hardware = BARO_NONE;
|
||||||
masterConfig.mag_hardware = 1;
|
masterConfig.mag_hardware = MAG_NONE;
|
||||||
masterConfig.pid_process_denom = 2;
|
masterConfig.pid_process_denom = 2;
|
||||||
} else if (looptime < 375) {
|
} else if (looptime < 375) {
|
||||||
masterConfig.acc_hardware = CONFIG_FASTLOOP_PREFERRED_ACC;
|
masterConfig.acc_hardware = CONFIG_FASTLOOP_PREFERRED_ACC;
|
||||||
masterConfig.acc_hardware = 1;
|
masterConfig.baro_hardware = BARO_NONE;
|
||||||
masterConfig.baro_hardware = 1;
|
masterConfig.mag_hardware = MAG_NONE;
|
||||||
masterConfig.mag_hardware = 1;
|
|
||||||
masterConfig.pid_process_denom = 2;
|
masterConfig.pid_process_denom = 2;
|
||||||
}
|
}
|
||||||
masterConfig.gyro_sync_denom = constrain(looptime / gyroSampleRate, 1, maxDivider);
|
masterConfig.gyro_sync_denom = constrain(looptime / gyroSampleRate, 1, maxDivider);
|
||||||
} else {
|
} else {
|
||||||
masterConfig.gyro_lpf = 0;
|
masterConfig.gyro_lpf = 0;
|
||||||
masterConfig.gyro_sync_denom = 8;
|
masterConfig.gyro_sync_denom = 8;
|
||||||
masterConfig.acc_hardware = 0;
|
masterConfig.acc_hardware = ACC_DEFAULT;
|
||||||
masterConfig.baro_hardware = 0;
|
masterConfig.baro_hardware = BARO_DEFAULT;
|
||||||
masterConfig.mag_hardware = 0;
|
masterConfig.mag_hardware = MAG_DEFAULT;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (looptime < 1000) {
|
if (looptime < 1000) {
|
||||||
masterConfig.gyro_lpf = 0;
|
masterConfig.gyro_lpf = 0;
|
||||||
masterConfig.acc_hardware = 1;
|
masterConfig.acc_hardware = ACC_NONE;
|
||||||
masterConfig.baro_hardware = 1;
|
masterConfig.baro_hardware = BARO_NONE;
|
||||||
masterConfig.mag_hardware = 1;
|
masterConfig.mag_hardware = MAG_NONE;
|
||||||
gyroSampleRate = 125;
|
gyroSampleRate = 125;
|
||||||
maxDivider = 8;
|
maxDivider = 8;
|
||||||
masterConfig.pid_process_denom = 1;
|
masterConfig.pid_process_denom = 1;
|
||||||
if (currentProfile->pidProfile.pidController == 2) masterConfig.pid_process_denom = 2;
|
if (currentProfile->pidProfile.pidController == PID_CONTROLLER_LUX_FLOAT) {
|
||||||
|
masterConfig.pid_process_denom = 2;
|
||||||
|
}
|
||||||
if (looptime < 250) {
|
if (looptime < 250) {
|
||||||
masterConfig.pid_process_denom = 4;
|
masterConfig.pid_process_denom = 4;
|
||||||
} else if (looptime < 375) {
|
} else if (looptime < 375) {
|
||||||
if (currentProfile->pidProfile.pidController == 2) {
|
if (currentProfile->pidProfile.pidController == PID_CONTROLLER_LUX_FLOAT) {
|
||||||
masterConfig.pid_process_denom = 3;
|
masterConfig.pid_process_denom = 3;
|
||||||
} else {
|
} else {
|
||||||
masterConfig.pid_process_denom = 2;
|
masterConfig.pid_process_denom = 2;
|
||||||
|
@ -161,11 +161,10 @@ void setGyroSamplingSpeed(uint16_t looptime) {
|
||||||
masterConfig.gyro_sync_denom = constrain(looptime / gyroSampleRate, 1, maxDivider);
|
masterConfig.gyro_sync_denom = constrain(looptime / gyroSampleRate, 1, maxDivider);
|
||||||
} else {
|
} else {
|
||||||
masterConfig.gyro_lpf = 0;
|
masterConfig.gyro_lpf = 0;
|
||||||
|
|
||||||
masterConfig.gyro_sync_denom = 8;
|
masterConfig.gyro_sync_denom = 8;
|
||||||
masterConfig.acc_hardware = 0;
|
masterConfig.acc_hardware = ACC_DEFAULT;
|
||||||
masterConfig.baro_hardware = 0;
|
masterConfig.baro_hardware = BARO_DEFAULT;
|
||||||
masterConfig.mag_hardware = 0;
|
masterConfig.mag_hardware = MAG_DEFAULT;
|
||||||
masterConfig.pid_process_denom = 1;
|
masterConfig.pid_process_denom = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#define TARGET_BOARD_IDENTIFIER "AFF3" // AlienFlight F3.
|
#define TARGET_BOARD_IDENTIFIER "AFF3" // AlienFlight F3.
|
||||||
#define ALIENFLIGHT
|
#define ALIENFLIGHT
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 0
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
#define USE_HARDWARE_REVISION_DETECTION
|
#define USE_HARDWARE_REVISION_DETECTION
|
||||||
#define HW_PIN PB2
|
#define HW_PIN PB2
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "CHF3" // Chebuzz F3
|
#define TARGET_BOARD_IDENTIFIER "CHF3" // Chebuzz F3
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
#define LED0 PE8 // Blue LEDs - PE8/PE12
|
#define LED0 PE8 // Blue LEDs - PE8/PE12
|
||||||
#define LED0_INVERTED
|
#define LED0_INVERTED
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#define BST_DEVICE_NAME "COLIBRI RACE"
|
#define BST_DEVICE_NAME "COLIBRI RACE"
|
||||||
#define BST_DEVICE_NAME_LENGTH 12
|
#define BST_DEVICE_NAME_LENGTH 12
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 0
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
#define LED0 PC15
|
#define LED0 PC15
|
||||||
#define LED1 PC14
|
#define LED1 PC14
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "DOGE"
|
#define TARGET_BOARD_IDENTIFIER "DOGE"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 0
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
// tqfp48 pin 34
|
// tqfp48 pin 34
|
||||||
#define LED0 PA13
|
#define LED0 PA13
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "FURY"
|
#define TARGET_BOARD_IDENTIFIER "FURY"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
#define MPU_INT_EXTI PC4
|
#define MPU_INT_EXTI PC4
|
||||||
#define USE_EXTI
|
#define USE_EXTI
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#define TARGET_BOARD_IDENTIFIER "LUX"
|
#define TARGET_BOARD_IDENTIFIER "LUX"
|
||||||
#define BOARD_HAS_VOLTAGE_DIVIDER
|
#define BOARD_HAS_VOLTAGE_DIVIDER
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 0
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
#define LED0 PC15
|
#define LED0 PC15
|
||||||
#define LED1 PC14
|
#define LED1 PC14
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#define TARGET_BOARD_IDENTIFIER "MOTO" // MotoLab
|
#define TARGET_BOARD_IDENTIFIER "MOTO" // MotoLab
|
||||||
#define USE_CLI
|
#define USE_CLI
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 0
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
#define LED0 PB5 // Blue LEDs - PB5
|
#define LED0 PB5 // Blue LEDs - PB5
|
||||||
//#define LED1 PB9 // Green LEDs - PB9
|
//#define LED1 PB9 // Green LEDs - PB9
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "AFF3" // AFro F3
|
#define TARGET_BOARD_IDENTIFIER "AFF3" // AFro F3
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "REVO"
|
#define TARGET_BOARD_IDENTIFIER "REVO"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
|
||||||
|
|
||||||
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8)
|
||||||
#define CONFIG_SERIALRX_PROVIDER SERIALRX_SBUS
|
#define CONFIG_SERIALRX_PROVIDER SERIALRX_SBUS
|
||||||
#define CONFIG_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
|
#define CONFIG_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "SING"
|
#define TARGET_BOARD_IDENTIFIER "SING"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
#define LED0 PB3
|
#define LED0 PB3
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "SPKY" // SParKY
|
#define TARGET_BOARD_IDENTIFIER "SPKY" // SParKY
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
#define LED0 PB4 // Blue (Rev 1 & 2) - PB4
|
#define LED0 PB4 // Blue (Rev 1 & 2) - PB4
|
||||||
#define LED1 PB5 // Green (Rev 1) / Red (Rev 2) - PB5
|
#define LED1 PB5 // Green (Rev 1) / Red (Rev 2) - PB5
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "SRF3"
|
#define TARGET_BOARD_IDENTIFIER "SRF3"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
#define LED0 PB3
|
#define LED0 PB3
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "SPEV"
|
#define TARGET_BOARD_IDENTIFIER "SPEV"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 0
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
|
||||||
|
|
||||||
#define LED0 PB8
|
#define LED0 PB8
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "SRFM"
|
#define TARGET_BOARD_IDENTIFIER "SRFM"
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
// early prototype had slightly different pin mappings.
|
// early prototype had slightly different pin mappings.
|
||||||
//#define SPRACINGF3MINI_MKII_REVA
|
//#define SPRACINGF3MINI_MKII_REVA
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "SDF3" // STM Discovery F3
|
#define TARGET_BOARD_IDENTIFIER "SDF3" // STM Discovery F3
|
||||||
|
|
||||||
#define CONFIG_FASTLOOP_PREFERRED_ACC 1
|
#define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
|
||||||
|
|
||||||
#define LED0 PE8 // Blue LEDs - PE8/PE12
|
#define LED0 PE8 // Blue LEDs - PE8/PE12
|
||||||
#define LED0_INVERTED
|
#define LED0_INVERTED
|
||||||
|
|
Loading…
Reference in New Issue