mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 04:45:24 +03:00
Fix BST // Sync motor to PID loop (less CPU)
This commit is contained in:
parent
24b4d37d43
commit
795feddf71
4 changed files with 5 additions and 17 deletions
|
@ -668,14 +668,6 @@ int main(void) {
|
|||
rescheduleTask(TASK_GYROPID, targetLooptime);
|
||||
setTaskEnabled(TASK_GYROPID, true);
|
||||
|
||||
setTaskEnabled(TASK_MOTOR, true);
|
||||
|
||||
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);
|
||||
switch(targetLooptime) { // Switch statement kept in place to change acc rates in the future
|
||||
|
@ -732,6 +724,10 @@ int main(void) {
|
|||
#ifdef TRANSPONDER
|
||||
setTaskEnabled(TASK_TRANSPONDER, feature(FEATURE_TRANSPONDER));
|
||||
#endif
|
||||
#ifdef USE_BST
|
||||
setTaskEnabled(TASK_BST_READ_WRITE, true);
|
||||
setTaskEnabled(TASK_BST_MASTER_PROCESS, true);
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
scheduler();
|
||||
|
|
|
@ -766,6 +766,7 @@ void taskMainPidLoopCheck(void) {
|
|||
static uint8_t pidUpdateCountdown;
|
||||
|
||||
if (runTaskMainSubprocesses) {
|
||||
taskMotorUpdate();
|
||||
subTasksMainPidLoop();
|
||||
runTaskMainSubprocesses = false;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ typedef enum {
|
|||
/* Actual tasks */
|
||||
TASK_SYSTEM = 0,
|
||||
TASK_GYROPID,
|
||||
TASK_MOTOR,
|
||||
TASK_ATTITUDE,
|
||||
TASK_ACCEL,
|
||||
TASK_SERIAL,
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "scheduler.h"
|
||||
|
||||
void taskMainPidLoopCheck(void);
|
||||
void taskMotorUpdate(void);
|
||||
void taskUpdateAccelerometer(void);
|
||||
void taskHandleSerial(void);
|
||||
void taskUpdateAttitude(void);
|
||||
|
@ -59,13 +58,6 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
.subTaskName = "GYRO",
|
||||
.taskFunc = taskMainPidLoopCheck,
|
||||
.desiredPeriod = 1000,
|
||||
.staticPriority = TASK_PRIORITY_HIGH,
|
||||
},
|
||||
|
||||
[TASK_MOTOR] = {
|
||||
.taskName = "MOTOR",
|
||||
.taskFunc = taskMotorUpdate,
|
||||
.desiredPeriod = 1000,
|
||||
.staticPriority = TASK_PRIORITY_REALTIME,
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue