mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +03:00
Rebased on to master (with merged CMS)
This commit is contained in:
commit
61a87480b3
341 changed files with 8778 additions and 8563 deletions
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include <platform.h>
|
||||
|
||||
#include "cms/cms.h"
|
||||
#include "cms/cms_types.h"
|
||||
|
||||
#include "common/axis.h"
|
||||
#include "common/color.h"
|
||||
#include "common/utils.h"
|
||||
|
@ -40,9 +43,6 @@
|
|||
#include "flight/pid.h"
|
||||
#include "flight/altitudehold.h"
|
||||
|
||||
#include "io/cms.h"
|
||||
#include "io/cms_types.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
#include "io/dashboard.h"
|
||||
#include "io/gps.h"
|
||||
|
@ -87,11 +87,6 @@ static void taskUpdateAccelerometer(uint32_t currentTime)
|
|||
imuUpdateAccelerometer(&masterConfig.accelerometerTrims);
|
||||
}
|
||||
|
||||
static void taskUpdateAttitude(uint32_t currentTime)
|
||||
{
|
||||
imuUpdateAttitude(currentTime);
|
||||
}
|
||||
|
||||
static void taskHandleSerial(uint32_t currentTime)
|
||||
{
|
||||
UNUSED(currentTime);
|
||||
|
@ -105,13 +100,6 @@ static void taskHandleSerial(uint32_t currentTime)
|
|||
mspSerialProcess(ARMING_FLAG(ARMED) ? MSP_SKIP_NON_MSP_DATA : MSP_EVALUATE_NON_MSP_DATA, mspFcProcessCommand);
|
||||
}
|
||||
|
||||
#ifdef BEEPER
|
||||
static void taskUpdateBeeper(uint32_t currentTime)
|
||||
{
|
||||
beeperUpdate(currentTime); //call periodic beeper handler
|
||||
}
|
||||
#endif
|
||||
|
||||
static void taskUpdateBattery(uint32_t currentTime)
|
||||
{
|
||||
#ifdef USE_ADC
|
||||
|
@ -135,12 +123,6 @@ static void taskUpdateBattery(uint32_t currentTime)
|
|||
}
|
||||
}
|
||||
|
||||
static bool taskUpdateRxCheck(uint32_t currentTime, uint32_t currentDeltaTime)
|
||||
{
|
||||
UNUSED(currentDeltaTime);
|
||||
return rxUpdate(currentTime);
|
||||
}
|
||||
|
||||
static void taskUpdateRxMain(uint32_t currentTime)
|
||||
{
|
||||
processRx(currentTime);
|
||||
|
@ -165,18 +147,6 @@ static void taskUpdateRxMain(uint32_t currentTime)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef GPS
|
||||
static void taskProcessGPS(uint32_t currentTime)
|
||||
{
|
||||
// if GPS feature is enabled, gpsThread() will be called at some intervals to check for stuck
|
||||
// hardware, wrong baud rates, init GPS if needed, etc. Don't use SENSOR_GPS here as gpsUdate() can and will
|
||||
// change this based on available hardware
|
||||
if (feature(FEATURE_GPS)) {
|
||||
gpsUpdate(currentTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MAG
|
||||
static void taskUpdateCompass(uint32_t currentTime)
|
||||
{
|
||||
|
@ -200,17 +170,6 @@ static void taskUpdateBaro(uint32_t currentTime)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef SONAR
|
||||
static void taskUpdateSonar(uint32_t currentTime)
|
||||
{
|
||||
UNUSED(currentTime);
|
||||
|
||||
if (sensors(SENSOR_SONAR)) {
|
||||
sonarUpdate();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BARO) || defined(SONAR)
|
||||
static void taskCalculateAltitude(uint32_t currentTime)
|
||||
{
|
||||
|
@ -226,15 +185,6 @@ static void taskCalculateAltitude(uint32_t currentTime)
|
|||
}}
|
||||
#endif
|
||||
|
||||
#ifdef USE_DASHBOARD
|
||||
static void taskUpdateDashboard(uint32_t currentTime)
|
||||
{
|
||||
if (feature(FEATURE_DASHBOARD)) {
|
||||
dashboardUpdate(currentTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TELEMETRY
|
||||
static void taskTelemetry(uint32_t currentTime)
|
||||
{
|
||||
|
@ -246,33 +196,6 @@ static void taskTelemetry(uint32_t currentTime)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef LED_STRIP
|
||||
static void taskLedStrip(uint32_t currentTime)
|
||||
{
|
||||
if (feature(FEATURE_LED_STRIP)) {
|
||||
ledStripUpdate(currentTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TRANSPONDER
|
||||
static void taskTransponder(uint32_t currentTime)
|
||||
{
|
||||
if (feature(FEATURE_TRANSPONDER)) {
|
||||
transponderUpdate(currentTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OSD
|
||||
static void taskUpdateOsd(uint32_t currentTime)
|
||||
{
|
||||
if (feature(FEATURE_OSD)) {
|
||||
updateOsd(currentTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VTX_CONTROL
|
||||
// Everything that listens to VTX devices
|
||||
void taskVtxControl(uint32_t currentTime)
|
||||
|
@ -347,12 +270,17 @@ void fcTasksInit(void)
|
|||
setTaskEnabled(TASK_BST_MASTER_PROCESS, true);
|
||||
#endif
|
||||
#ifdef CMS
|
||||
// XXX Should check FEATURE
|
||||
#ifdef USE_MSP_DISPLAYPORT
|
||||
setTaskEnabled(TASK_CMS, true);
|
||||
#else
|
||||
setTaskEnabled(TASK_CMS, feature(FEATURE_OSD) || feature(FEATURE_DASHBOARD));
|
||||
#endif
|
||||
#endif
|
||||
#ifdef VTX_CONTROL
|
||||
#ifdef VTX_SMARTAUDIO
|
||||
setTaskEnabled(TASK_VTXCTRL, true);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
cfTask_t cfTasks[TASK_COUNT] = {
|
||||
|
@ -380,14 +308,14 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
|
||||
[TASK_ATTITUDE] = {
|
||||
.taskName = "ATTITUDE",
|
||||
.taskFunc = taskUpdateAttitude,
|
||||
.taskFunc = imuUpdateAttitude,
|
||||
.desiredPeriod = 1000000 / 100,
|
||||
.staticPriority = TASK_PRIORITY_MEDIUM,
|
||||
},
|
||||
|
||||
[TASK_RX] = {
|
||||
.taskName = "RX",
|
||||
.checkFunc = taskUpdateRxCheck,
|
||||
.checkFunc = rxUpdateCheck,
|
||||
.taskFunc = taskUpdateRxMain,
|
||||
.desiredPeriod = 1000000 / 50, // If event-based scheduling doesn't work, fallback to periodic scheduling
|
||||
.staticPriority = TASK_PRIORITY_HIGH,
|
||||
|
@ -410,7 +338,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef BEEPER
|
||||
[TASK_BEEPER] = {
|
||||
.taskName = "BEEPER",
|
||||
.taskFunc = taskUpdateBeeper,
|
||||
.taskFunc = beeperUpdate,
|
||||
.desiredPeriod = 1000000 / 100, // 100 Hz
|
||||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
|
@ -419,7 +347,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef GPS
|
||||
[TASK_GPS] = {
|
||||
.taskName = "GPS",
|
||||
.taskFunc = taskProcessGPS,
|
||||
.taskFunc = gpsUpdate,
|
||||
.desiredPeriod = 1000000 / 10, // GPS usually don't go raster than 10Hz
|
||||
.staticPriority = TASK_PRIORITY_MEDIUM,
|
||||
},
|
||||
|
@ -446,8 +374,8 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef SONAR
|
||||
[TASK_SONAR] = {
|
||||
.taskName = "SONAR",
|
||||
.taskFunc = taskUpdateSonar,
|
||||
.desiredPeriod = 1000000 / 20,
|
||||
.taskFunc = sonarUpdate,
|
||||
.desiredPeriod = 70000, // 70ms required so that SONAR pulses do not interfer with each other
|
||||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
#endif
|
||||
|
@ -464,7 +392,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef TRANSPONDER
|
||||
[TASK_TRANSPONDER] = {
|
||||
.taskName = "TRANSPONDER",
|
||||
.taskFunc = taskTransponder,
|
||||
.taskFunc = transponderUpdate,
|
||||
.desiredPeriod = 1000000 / 250, // 250 Hz
|
||||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
|
@ -473,7 +401,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef USE_DASHBOARD
|
||||
[TASK_DASHBOARD] = {
|
||||
.taskName = "DASHBOARD",
|
||||
.taskFunc = taskUpdateDashboard,
|
||||
.taskFunc = dashboardUpdate,
|
||||
.desiredPeriod = 1000000 / 10,
|
||||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
|
@ -481,7 +409,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef OSD
|
||||
[TASK_OSD] = {
|
||||
.taskName = "OSD",
|
||||
.taskFunc = taskUpdateOsd,
|
||||
.taskFunc = osdUpdate,
|
||||
.desiredPeriod = 1000000 / 60, // 60 Hz
|
||||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
|
@ -498,7 +426,7 @@ cfTask_t cfTasks[TASK_COUNT] = {
|
|||
#ifdef LED_STRIP
|
||||
[TASK_LEDSTRIP] = {
|
||||
.taskName = "LEDSTRIP",
|
||||
.taskFunc = taskLedStrip,
|
||||
.taskFunc = ledStripUpdate,
|
||||
.desiredPeriod = 1000000 / 100, // 100 Hz
|
||||
.staticPriority = TASK_PRIORITY_LOW,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue