1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

CF/BF - Allow OSD to be compiled without blackbox.

This commit is contained in:
Hydra 2017-04-08 15:02:11 +01:00 committed by Dominic Clifton
parent 4653cfd4ad
commit 722523df31
2 changed files with 8 additions and 1 deletions

View file

@ -127,7 +127,7 @@ typedef struct statistic_s {
static statistic_t stats; static statistic_t stats;
uint16_t refreshTimeout = 0; uint16_t refreshTimeout = 0;
#define REFRESH_1S 12 #define REFRESH_1S 12 // FIXME dependant on how frequently the task is scheduled
static uint8_t armState; static uint8_t armState;
@ -704,6 +704,7 @@ static void osdUpdateStats(void)
stats.max_altitude = baro.BaroAlt; stats.max_altitude = baro.BaroAlt;
} }
#ifdef BLACKBOX
static void osdGetBlackboxStatusString(char * buff, uint8_t len) static void osdGetBlackboxStatusString(char * buff, uint8_t len)
{ {
bool storageDeviceIsWorking = false; bool storageDeviceIsWorking = false;
@ -744,6 +745,7 @@ static void osdGetBlackboxStatusString(char * buff, uint8_t len)
snprintf(buff, len, "FAULT"); snprintf(buff, len, "FAULT");
} }
} }
#endif
static void osdShowStats(void) static void osdShowStats(void)
{ {
@ -785,11 +787,13 @@ static void osdShowStats(void)
sprintf(buff, "%c%d.%01d%c", alt < 0 ? '-' : ' ', abs(alt / 100), abs((alt % 100) / 10), osdGetAltitudeSymbol()); sprintf(buff, "%c%d.%01d%c", alt < 0 ? '-' : ' ', abs(alt / 100), abs((alt % 100) / 10), osdGetAltitudeSymbol());
displayWrite(osdDisplayPort, 22, top++, buff); displayWrite(osdDisplayPort, 22, top++, buff);
#ifdef BLACKBOX
if (blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) { if (blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) {
displayWrite(osdDisplayPort, 2, top, "BLACKBOX :"); displayWrite(osdDisplayPort, 2, top, "BLACKBOX :");
osdGetBlackboxStatusString(buff, 10); osdGetBlackboxStatusString(buff, 10);
displayWrite(osdDisplayPort, 22, top++, buff); displayWrite(osdDisplayPort, 22, top++, buff);
} }
#endif
refreshTimeout = 60 * REFRESH_1S; refreshTimeout = 60 * REFRESH_1S;
} }

View file

@ -17,6 +17,7 @@
#pragma once #pragma once
#ifdef OSD
#include "common/time.h" #include "common/time.h"
#include "config/parameter_group.h" #include "config/parameter_group.h"
@ -80,3 +81,5 @@ void osdInit(struct displayPort_s *osdDisplayPort);
void osdResetConfig(osdConfig_t *osdProfile); void osdResetConfig(osdConfig_t *osdProfile);
void osdResetAlarms(void); void osdResetAlarms(void);
void osdUpdate(timeUs_t currentTimeUs); void osdUpdate(timeUs_t currentTimeUs);
#endif