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

OSD unit test

This commit is contained in:
Dan Nixon 2017-06-15 15:49:35 +01:00
parent 582af3d515
commit 427c5fe524
8 changed files with 761 additions and 119 deletions

View file

@ -36,6 +36,7 @@
#include "blackbox/blackbox.h"
#include "blackbox/blackbox_io.h"
#include "build/build_config.h"
#include "build/debug.h"
#include "build/version.h"
@ -88,13 +89,6 @@
#define VIDEO_BUFFER_CHARS_PAL 480
// Character coordinate
#define OSD_POSITION_BITS 5 // 5 bits gives a range 0-31
#define OSD_POS(x,y) ((x & 0x001F) | ((y & 0x001F) << OSD_POSITION_BITS))
#define OSD_X(x) (x & 0x001F)
#define OSD_Y(x) ((x >> OSD_POSITION_BITS) & 0x001F)
// Blink control
static bool blinkState = true;
@ -168,9 +162,9 @@ static char osdGetMetersToSelectedUnitSymbol()
{
switch (osdConfig()->units) {
case OSD_UNIT_IMPERIAL:
return 0xF;
return SYM_FT;
default:
return 0xC;
return SYM_M;
}
}
@ -761,7 +755,7 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
static void osdDrawLogo(int x, int y)
{
// display logo and help
char fontOffset = 160;
unsigned char fontOffset = 160;
for (int row = 0; row < 4; row++) {
for (int column = 0; column < 24; column++) {
if (fontOffset != 255) // FIXME magic number
@ -810,7 +804,6 @@ void osdUpdateAlarms(void)
// uint16_t *itemPos = osdConfig()->item_pos;
int32_t alt = osdGetMetersToSelectedUnit(getEstimatedAltitude()) / 100;
statRssi = rssi * 100 / 1024;
if (statRssi < osdConfig()->rssi_alarm)
SET_BLINK(OSD_RSSI_VALUE);
@ -1039,7 +1032,7 @@ static void osdShowArmed(void)
displayWrite(osdDisplayPort, 12, 7, "ARMED");
}
static void osdRefresh(timeUs_t currentTimeUs)
STATIC_UNIT_TESTED void osdRefresh(timeUs_t currentTimeUs)
{
static uint8_t lastSec = 0;
uint8_t sec;
@ -1058,6 +1051,8 @@ static void osdRefresh(timeUs_t currentTimeUs)
armState = ARMING_FLAG(ARMED);
}
statRssi = rssi * 100 / 1024;
osdUpdateStats();
sec = currentTimeUs / 1000000;