Added a condition for enabling OSD task

This commit is contained in:
Andrey Mironov 2018-07-24 11:54:37 +03:00
parent 0115ff15b2
commit 65bff6b7d7
6 changed files with 18 additions and 5 deletions

View File

@ -265,7 +265,7 @@ void fcTasksInit(void)
#endif
#ifdef USE_OSD_SLAVE
setTaskEnabled(TASK_OSD_SLAVE, true);
setTaskEnabled(TASK_OSD_SLAVE, osdSlaveInitialized());
#else
if (sensors(SENSOR_GYRO)) {
rescheduleTask(TASK_GYROPID, gyro.targetLooptime);
@ -319,7 +319,7 @@ void fcTasksInit(void)
setTaskEnabled(TASK_TRANSPONDER, feature(FEATURE_TRANSPONDER));
#endif
#ifdef USE_OSD
setTaskEnabled(TASK_OSD, feature(FEATURE_OSD));
setTaskEnabled(TASK_OSD, feature(FEATURE_OSD) && osdInitialized());
#endif
#ifdef USE_BST
setTaskEnabled(TASK_BST_MASTER_PROCESS, true);

View File

@ -166,12 +166,13 @@ static const displayPortVTable_t max7456VTable = {
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile)
{
if (
#ifdef USE_OSD_SLAVE
if (!max7456Init(max7456Config(), vcdProfile, false))
!max7456Init(max7456Config(), vcdProfile, false)
#else
if (!max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock))
!max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock)
#endif
{
) {
return NULL;
}

View File

@ -1131,6 +1131,11 @@ void osdInit(displayPort_t *osdDisplayPortToUse)
resumeRefreshAt = micros() + (4 * REFRESH_1S);
}
bool osdInitialized(void)
{
return osdDisplayPort;
}
void osdUpdateAlarms(void)
{
// This is overdone?

View File

@ -201,6 +201,7 @@ extern timeUs_t resumeRefreshAt;
struct displayPort_s;
void osdInit(struct displayPort_s *osdDisplayPort);
bool osdInitialized(void);
void osdResetAlarms(void);
void osdUpdate(timeUs_t currentTimeUs);
void osdStatSetState(uint8_t statIndex, bool enabled);

View File

@ -120,6 +120,11 @@ void osdSlaveInit(displayPort_t *osdDisplayPortToUse)
displayResync(osdDisplayPort);
}
bool osdSlaveInitialized(void)
{
return osdDisplayPort;
}
bool osdSlaveCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTimeUs)
{
UNUSED(currentTimeUs);

View File

@ -29,6 +29,7 @@ extern bool osdSlaveIsLocked;
// init
void osdSlaveInit(struct displayPort_s *osdDisplayPort);
bool osdSlaveInitialized(void);
// task api
bool osdSlaveCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTimeUs);