Change attitude task freqency when in angle or horizon mode
This commit is contained in:
parent
4509e8d237
commit
62ad67f45b
|
@ -382,7 +382,6 @@ void ak8963BusInit(const busDevice_t *busdev)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_MAG_AK8963) && (defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU9250))
|
#if defined(USE_MAG_AK8963) && (defined(USE_GYRO_SPI_MPU6500) || defined(USE_GYRO_SPI_MPU9250))
|
||||||
#define TASK_PERIOD_HZ(hz) (1000000 / (hz))
|
|
||||||
case BUSTYPE_MPU_SLAVE:
|
case BUSTYPE_MPU_SLAVE:
|
||||||
rescheduleTask(TASK_COMPASS, TASK_PERIOD_HZ(40));
|
rescheduleTask(TASK_COMPASS, TASK_PERIOD_HZ(40));
|
||||||
|
|
||||||
|
|
|
@ -671,8 +671,11 @@ bool processRx(timeUs_t currentTimeUs)
|
||||||
|
|
||||||
if (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE)) {
|
if (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE)) {
|
||||||
LED1_ON;
|
LED1_ON;
|
||||||
|
// increase frequency of attitude task to reduce drift when in angle or horizon mode
|
||||||
|
rescheduleTask(TASK_ATTITUDE, TASK_PERIOD_HZ(500));
|
||||||
} else {
|
} else {
|
||||||
LED1_OFF;
|
LED1_OFF;
|
||||||
|
rescheduleTask(TASK_ATTITUDE, TASK_PERIOD_HZ(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_RC_MODE_ACTIVE(BOXPREARM) && ARMING_FLAG(WAS_ARMED_WITH_PREARM)) {
|
if (!IS_RC_MODE_ACTIVE(BOXPREARM) && ARMING_FLAG(WAS_ARMED_WITH_PREARM)) {
|
||||||
|
|
|
@ -19,8 +19,4 @@
|
||||||
|
|
||||||
#define LOOPTIME_SUSPEND_TIME 3 // Prevent too long busy wait times
|
#define LOOPTIME_SUSPEND_TIME 3 // Prevent too long busy wait times
|
||||||
|
|
||||||
#define TASK_PERIOD_HZ(hz) (1000000 / (hz))
|
|
||||||
#define TASK_PERIOD_MS(ms) ((ms) * 1000)
|
|
||||||
#define TASK_PERIOD_US(us) (us)
|
|
||||||
|
|
||||||
void fcTasksInit(void);
|
void fcTasksInit(void);
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
|
|
||||||
#include "common/time.h"
|
#include "common/time.h"
|
||||||
|
|
||||||
|
#define TASK_PERIOD_HZ(hz) (1000000 / (hz))
|
||||||
|
#define TASK_PERIOD_MS(ms) ((ms) * 1000)
|
||||||
|
#define TASK_PERIOD_US(us) (us)
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TASK_PRIORITY_IDLE = 0, // Disables dynamic scheduling, task is executed only if no other task is active this cycle
|
TASK_PRIORITY_IDLE = 0, // Disables dynamic scheduling, task is executed only if no other task is active this cycle
|
||||||
TASK_PRIORITY_LOW = 1,
|
TASK_PRIORITY_LOW = 1,
|
||||||
|
|
|
@ -669,4 +669,5 @@ extern "C" {
|
||||||
void dashboardEnablePageCycling(void) {}
|
void dashboardEnablePageCycling(void) {}
|
||||||
void dashboardDisablePageCycling(void) {}
|
void dashboardDisablePageCycling(void) {}
|
||||||
bool imuQuaternionHeadfreeOffsetSet(void) { return true; }
|
bool imuQuaternionHeadfreeOffsetSet(void) { return true; }
|
||||||
|
void rescheduleTask(cfTaskId_e, uint32_t) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue