Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new symbols to max7456_symbols.h #8138

Merged
merged 2 commits into from
May 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/main/drivers/max7456_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
#define SYM_END_OF_FONT 0xFF
#define SYM_BLANK 0x20
#define SYM_COLON 0x2D
#define SYM_BBLOG 0x10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One rule we have is that we generally only define symbols that are actually used - this makes it easy to sort out what slots are still available in a font.

So my recommendation is to comment out the defines for symbols that were added but aren't yet used, and uncomment them in the pull request that puts them to use.

//#define SYM_HOMEFLAG 0x11
//#define SYM_RPM 0x12
#define SYM_ROLL 0x14
#define SYM_PITCH 0x15
#define SYM_TEMPERATURE 0x7A
#define SYM_LAT 0x89
#define SYM_LON 0x98

// RSSI
#define SYM_RSSI 0x01
Expand Down Expand Up @@ -54,8 +62,8 @@
#define SYM_HEADING_LINE 0x1D

// AH Center screen Graphics
#define SYM_AH_CENTER_LINE 0x26
#define SYM_AH_CENTER_LINE_RIGHT 0x27
#define SYM_AH_CENTER_LINE 0x7B
#define SYM_AH_CENTER_LINE_RIGHT 0x7D
#define SYM_AH_CENTER 0x7E
#define SYM_AH_RIGHT 0x02
#define SYM_AH_LEFT 0x03
Expand Down Expand Up @@ -118,15 +126,15 @@
#define SYM_VOLT 0x06
#define SYM_AMP 0x9A
#define SYM_MAH 0x07
#define SYM_WATT 0x57
#define SYM_WATT 0x57 // 0x57 is 'W'

// Time
#define SYM_ON_M 0x9B
#define SYM_FLY_M 0x9C

// Speed
#define SYM_KPH 0x4B // we don't have a KPH symbol so use 'K'
#define SYM_MPH 0x4D // we don't have a MPH symbol so use 'M'
#define SYM_KPH 0x9E
#define SYM_MPH 0x9D

// Menu cursor
#define SYM_CURSOR SYM_AH_LEFT
Expand Down
16 changes: 7 additions & 9 deletions src/main/osd/osd_elements.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static void osdElementAltitude(osdElementParms_t *element)
static void osdElementAngleRollPitch(osdElementParms_t *element)
{
const int angle = (element->item == OSD_PITCH_ANGLE) ? attitude.values.pitch : attitude.values.roll;
tfp_sprintf(element->buff, "%c%02d.%01d", angle < 0 ? '-' : ' ', abs(angle / 10), abs(angle % 10));
tfp_sprintf(element->buff, "%c%c%02d.%01d", (element->item == OSD_PITCH_ANGLE) ? SYM_PITCH : SYM_ROLL , angle < 0 ? '-' : ' ', abs(angle / 10), abs(angle % 10));
}
#endif

Expand Down Expand Up @@ -530,7 +530,7 @@ static void osdElementCompassBar(osdElementParms_t *element)
#ifdef USE_ADC_INTERNAL
static void osdElementCoreTemperature(osdElementParms_t *element)
{
tfp_sprintf(element->buff, "%3d%c", osdConvertTemperatureToSelectedUnit(getCoreTemperatureCelsius()), osdGetTemperatureSymbolForSelectedUnit());
tfp_sprintf(element->buff, "%c%3d%c", SYM_TEMPERATURE, osdConvertTemperatureToSelectedUnit(getCoreTemperatureCelsius()), osdGetTemperatureSymbolForSelectedUnit());
}
#endif // USE_ADC_INTERNAL

Expand Down Expand Up @@ -754,14 +754,12 @@ static void osdElementGpsHomeDistance(osdElementParms_t *element)

static void osdElementGpsLatitude(osdElementParms_t *element)
{
// The SYM_LAT symbol in the actual font contains only blank, so we use the SYM_ARROW_NORTH
osdFormatCoordinate(element->buff, SYM_ARROW_NORTH, gpsSol.llh.lat);
osdFormatCoordinate(element->buff, SYM_LAT, gpsSol.llh.lat);
}

static void osdElementGpsLongitude(osdElementParms_t *element)
{
// The SYM_LON symbol in the actual font contains only blank, so we use the SYM_ARROW_EAST
osdFormatCoordinate(element->buff, SYM_ARROW_EAST, gpsSol.llh.lon);
osdFormatCoordinate(element->buff, SYM_LON, gpsSol.llh.lon);
}

static void osdElementGpsSats(osdElementParms_t *element)
Expand Down Expand Up @@ -810,11 +808,11 @@ static void osdElementLogStatus(osdElementParms_t *element)
{
if (IS_RC_MODE_ACTIVE(BOXBLACKBOX)) {
if (!isBlackboxDeviceWorking()) {
tfp_sprintf(element->buff, "L-");
tfp_sprintf(element->buff, "%c!", SYM_BBLOG);
} else if (isBlackboxDeviceFull()) {
tfp_sprintf(element->buff, "L>");
tfp_sprintf(element->buff, "%c>", SYM_BBLOG);
} else {
tfp_sprintf(element->buff, "L%d", blackboxGetLogNumber());
tfp_sprintf(element->buff, "%c%d", SYM_BBLOG, blackboxGetLogNumber());
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/unit/osd_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ TEST(OsdTest, TestElementCoreTemperature)
osdRefresh(simulationTime);

// then
displayPortTestBufferSubstring(1, 8, " 0%c", SYM_C);
displayPortTestBufferSubstring(1, 8, "%c 0%c", SYM_TEMPERATURE, SYM_C);

// given
simulationCoreTemperature = 33;
Expand All @@ -836,7 +836,7 @@ TEST(OsdTest, TestElementCoreTemperature)
osdRefresh(simulationTime);

// then
displayPortTestBufferSubstring(1, 8, " 33%c", SYM_C);
displayPortTestBufferSubstring(1, 8, "%c 33%c", SYM_TEMPERATURE, SYM_C);

// given
osdConfigMutable()->units = OSD_UNIT_IMPERIAL;
Expand All @@ -846,7 +846,7 @@ TEST(OsdTest, TestElementCoreTemperature)
osdRefresh(simulationTime);

// then
displayPortTestBufferSubstring(1, 8, " 91%c", SYM_F);
displayPortTestBufferSubstring(1, 8, "%c 91%c", SYM_TEMPERATURE, SYM_F);
}

/*
Expand Down