1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

Change priorities for tasks

This commit is contained in:
borisbstyle 2016-03-01 21:49:37 +01:00
parent 98a1de2b70
commit 717290872c
3 changed files with 12 additions and 11 deletions

View file

@ -123,11 +123,7 @@ void setGyroSamplingSpeed(uint16_t looptime) {
masterConfig.mag_hardware = 1;
masterConfig.pid_process_denom = 2;
} else if (looptime < 375) {
#if defined(LUX_RACE) || defined(COLIBRI_RACE) || defined(MOTOLAB) || defined(ALIENFLIGHTF3)
masterConfig.acc_hardware = 0;
#else
masterConfig.acc_hardware = 1;
#endif
masterConfig.baro_hardware = 1;
masterConfig.mag_hardware = 1;
masterConfig.pid_process_denom = 2;

View file

@ -668,7 +668,12 @@ int main(void) {
setTaskEnabled(TASK_GYROPID, true);
setTaskEnabled(TASK_MOTOR, true);
rescheduleTask(TASK_MOTOR, constrain(lrintf((1.0f / masterConfig.motor_pwm_rate) * 1000000), 250, 3500));
if (feature(FEATURE_ONESHOT125)) {
rescheduleTask(TASK_MOTOR, constrain(lrintf((1.0f / masterConfig.motor_pwm_rate) * 1000000), 250, 3500));
} else {
rescheduleTask(TASK_MOTOR, 1000);
}
if(sensors(SENSOR_ACC)) {
setTaskEnabled(TASK_ACCEL, true);

View file

@ -87,7 +87,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
.taskName = "BEEPER",
.taskFunc = taskUpdateBeeper,
.desiredPeriod = 1000000 / 100, // 100 Hz
.staticPriority = TASK_PRIORITY_MEDIUM,
.staticPriority = TASK_PRIORITY_LOW,
},
#endif
@ -95,7 +95,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
.taskName = "BATTERY",
.taskFunc = taskUpdateBattery,
.desiredPeriod = 1000000 / 50, // 50 Hz
.staticPriority = TASK_PRIORITY_MEDIUM,
.staticPriority = TASK_PRIORITY_LOW,
},
[TASK_RX] = {
@ -120,7 +120,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
.taskName = "COMPASS",
.taskFunc = taskUpdateCompass,
.desiredPeriod = 1000000 / 10, // Compass is updated at 10 Hz
.staticPriority = TASK_PRIORITY_MEDIUM,
.staticPriority = TASK_PRIORITY_LOW,
},
#endif
@ -129,7 +129,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
.taskName = "BARO",
.taskFunc = taskUpdateBaro,
.desiredPeriod = 1000000 / 20,
.staticPriority = TASK_PRIORITY_MEDIUM,
.staticPriority = TASK_PRIORITY_LOW,
},
#endif
@ -138,7 +138,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
.taskName = "SONAR",
.taskFunc = taskUpdateSonar,
.desiredPeriod = 1000000 / 20,
.staticPriority = TASK_PRIORITY_MEDIUM,
.staticPriority = TASK_PRIORITY_LOW,
},
#endif
@ -147,7 +147,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
.taskName = "ALTITUDE",
.taskFunc = taskCalculateAltitude,
.desiredPeriod = 1000000 / 40,
.staticPriority = TASK_PRIORITY_MEDIUM,
.staticPriority = TASK_PRIORITY_LOW,
},
#endif