x7/x9 GPS datetime fix (#5051)
* Fix x7 display in telemetry widget (only time is displayed) * rename drawDate to a more specific name, since it is not generic fix for x9 * Travis build fix * Introduce time FONTSIZE_MASK macro * Cosmetics based on Bertrand's last feedbacks
This commit is contained in:
@@ -1129,11 +1129,11 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
|
|||||||
lcdDrawSizedText(lcdLastRightPos+1, y, direction + (value>=0 ? 0 : 1), 1);
|
lcdDrawSizedText(lcdLastRightPos+1, y, direction + (value>=0 ? 0 : 1), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
void drawTelemScreenDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
||||||
{
|
{
|
||||||
if (att & DBLSIZE) {
|
if (att & DBLSIZE) {
|
||||||
x -= 42;
|
x -= 42;
|
||||||
att &= ~0x0F00; // TODO constant
|
att &= ~FONTSIZE_MASK;
|
||||||
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||||
lcdDrawChar(lcdLastRightPos-1, y, '-', att);
|
lcdDrawChar(lcdLastRightPos-1, y, '-', att);
|
||||||
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||||
|
|||||||
@@ -94,7 +94,8 @@
|
|||||||
#define NO_UNIT 0x40
|
#define NO_UNIT 0x40
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define FONTSIZE(x) ((x) & 0x0700)
|
#define FONTSIZE_MASK 0x0700
|
||||||
|
#define FONTSIZE(x) ((x) & FONTSIZE_MASK)
|
||||||
#define TINSIZE 0x0100
|
#define TINSIZE 0x0100
|
||||||
#define SMLSIZE 0x0200
|
#define SMLSIZE 0x0200
|
||||||
#define MIDSIZE 0x0300
|
#define MIDSIZE 0x0300
|
||||||
|
|||||||
@@ -355,7 +355,10 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
|||||||
att |= INVERS|BLINK;
|
att |= INVERS|BLINK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawSourceValue(pos[j+1]-2, (i==3 ? 1+FH+2*FH*i:FH+2*FH*i), field, att);
|
if(isSensorUnit(1+(field-MIXSRC_FIRST_TELEM)/3, UNIT_DATETIME))
|
||||||
|
drawSourceValue(pos[j+1]-36, 6+FH+2*FH*i, field, SMLSIZE|NO_UNIT);
|
||||||
|
else
|
||||||
|
drawSourceValue(pos[j+1]-2, (i==3 ? 1+FH+2*FH*i:FH+2*FH*i), field, att);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -756,42 +756,27 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L
|
|||||||
lcdDrawSizedText(lcdLastRightPos+1, y, direction + (value>=0 ? 0 : 1), 1);
|
lcdDrawSizedText(lcdLastRightPos+1, y, direction + (value>=0 ? 0 : 1), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
void drawTelemScreenDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
||||||
{
|
{
|
||||||
if (att & DBLSIZE) {
|
att &= ~FONTSIZE_MASK;
|
||||||
x -= 42;
|
lcdDrawNumber(x, y+1, telemetryItem.datetime.sec, att|LEADING0, 2);
|
||||||
att &= ~0x0F00; // TODO constant
|
lcdDrawText(lcdNextPos, y+1, ":", att);
|
||||||
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
lcdDrawNumber(lcdNextPos, y+1, telemetryItem.datetime.min, att|LEADING0, 2);
|
||||||
lcdDrawChar(lcdLastRightPos-1, y, '-', att);
|
lcdDrawText(lcdNextPos, y+1, ":", att);
|
||||||
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
lcdDrawNumber(lcdNextPos, y+1, telemetryItem.datetime.hour, att|LEADING0, 2);
|
||||||
lcdDrawChar(lcdLastRightPos-1, y, '-', att);
|
|
||||||
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.year-2000, att|LEFT);
|
lcdDrawNumber(x, y+9, telemetryItem.datetime.year, att, 4);
|
||||||
y += FH;
|
lcdDrawText(lcdNextPos, y+9, "-", att);
|
||||||
lcdDrawNumber(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
lcdDrawNumber(lcdNextPos+1, y+9, telemetryItem.datetime.month, att|LEADING0, 2);
|
||||||
lcdDrawChar(lcdLastRightPos, y, ':', att);
|
lcdDrawText(lcdNextPos+1, y+9, "-", att);
|
||||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
lcdDrawNumber(lcdNextPos+1, y+9, telemetryItem.datetime.day, att|LEADING0,2);
|
||||||
lcdDrawChar(lcdLastRightPos, y, ':', att);
|
|
||||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
|
||||||
lcdDrawChar(lcdLastRightPos-1, y, '-', att);
|
|
||||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.month, att|LEFT, 2);
|
|
||||||
lcdDrawChar(lcdLastRightPos-1, y, '-', att);
|
|
||||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.year-2000, att|LEFT);
|
|
||||||
lcdDrawNumber(lcdNextPos+FW+1, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
|
||||||
lcdDrawChar(lcdLastRightPos, y, ':', att);
|
|
||||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
|
||||||
lcdDrawChar(lcdLastRightPos, y, ':', att);
|
|
||||||
lcdDrawNumber(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
||||||
{
|
{
|
||||||
if (att & DBLSIZE) {
|
if (att & DBLSIZE) {
|
||||||
x -= (g_eeGeneral.gpsFormat == 0 ? 54 : 51);
|
x -= (g_eeGeneral.gpsFormat == 0 ? 54 : 51);
|
||||||
att &= ~0x0F00; // TODO constant
|
att &= ~FONTSIZE_MASK;
|
||||||
drawGPSCoord(x, y, telemetryItem.gps.latitude, "NS", att, true);
|
drawGPSCoord(x, y, telemetryItem.gps.latitude, "NS", att, true);
|
||||||
drawGPSCoord(x, y+FH, telemetryItem.gps.longitude, "EW", att, true);
|
drawGPSCoord(x, y+FH, telemetryItem.gps.longitude, "EW", att, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,8 @@
|
|||||||
/* telemetry flags */
|
/* telemetry flags */
|
||||||
#define NO_UNIT 0x40
|
#define NO_UNIT 0x40
|
||||||
|
|
||||||
#define FONTSIZE(x) ((x) & 0x0700)
|
#define FONTSIZE_MASK 0x0700
|
||||||
|
#define FONTSIZE(x) ((x) & FONTSIZE_MASK)
|
||||||
#define TINSIZE 0x0100
|
#define TINSIZE 0x0100
|
||||||
#define SMLSIZE 0x0200
|
#define SMLSIZE 0x0200
|
||||||
#define MIDSIZE 0x0300
|
#define MIDSIZE 0x0300
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ enum MenuModelTelemetryFrskyItems {
|
|||||||
|
|
||||||
#define TELEM_COL1 (1*FW)
|
#define TELEM_COL1 (1*FW)
|
||||||
#define TELEM_COL2 (16*FW)
|
#define TELEM_COL2 (16*FW)
|
||||||
#define TELEM_COL3 (28*FW+2)
|
#define TELEM_COL3 (30*FW+2)
|
||||||
|
|
||||||
#define IF_FAS_OFFSET(x) x,
|
#define IF_FAS_OFFSET(x) x,
|
||||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||||
|
|||||||
@@ -307,12 +307,12 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
void drawTelemScreenDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
if (att & DBLSIZE) {
|
if (att & DBLSIZE) {
|
||||||
x -= 42;
|
x -= 42;
|
||||||
att &= ~0x0F00; // TODO constant
|
att &= ~FONTSIZE_MASK;
|
||||||
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
lcdDrawNumber(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||||
lcdDrawChar(lcdNextPos-1, y, '-', att);
|
lcdDrawChar(lcdNextPos-1, y, '-', att);
|
||||||
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
lcdDrawNumber(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ enum FontSizeIndex {
|
|||||||
#define DBLSIZE (DBLSIZE_INDEX << 8)
|
#define DBLSIZE (DBLSIZE_INDEX << 8)
|
||||||
#define XXLSIZE (XXLSIZE_INDEX << 8)
|
#define XXLSIZE (XXLSIZE_INDEX << 8)
|
||||||
#define BOLD (STDSIZE_BOLD_INDEX << 8)
|
#define BOLD (STDSIZE_BOLD_INDEX << 8)
|
||||||
#define FONTSIZE(flags) ((flags) & 0x0f00)
|
#define FONTSIZE_MASK 0x0f00
|
||||||
|
#define FONTSIZE(flags) ((flags) & FONTSIZE_MASK)
|
||||||
#define FONTINDEX(flags) (FONTSIZE(flags) >> 8)
|
#define FONTINDEX(flags) (FONTSIZE(flags) >> 8)
|
||||||
|
|
||||||
#define TIMEBLINK 0x1000
|
#define TIMEBLINK 0x1000
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value,
|
|||||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[sensor];
|
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[sensor];
|
||||||
|
|
||||||
if (telemetrySensor.unit == UNIT_DATETIME) {
|
if (telemetrySensor.unit == UNIT_DATETIME) {
|
||||||
drawDate(x, y, telemetryItem, flags);
|
drawTelemScreenDate(x, y, telemetryItem, flags);
|
||||||
}
|
}
|
||||||
else if (telemetrySensor.unit == UNIT_GPS) {
|
else if (telemetrySensor.unit == UNIT_GPS) {
|
||||||
drawGPSSensorValue(x, y, telemetryItem, flags);
|
drawGPSSensorValue(x, y, telemetryItem, flags);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
|||||||
#include "telemetry/telemetry_sensors.h"
|
#include "telemetry/telemetry_sensors.h"
|
||||||
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags flags);
|
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags flags);
|
||||||
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0);
|
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0);
|
||||||
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
|
void drawTelemScreenDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
|
||||||
void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags=0);
|
void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags=0);
|
||||||
void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
|
void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags=0);
|
||||||
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
|
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
|
||||||
|
|||||||
Reference in New Issue
Block a user