Skip to content

Commit

Permalink
Fixed AFHDS2A telemetry GPS lat/lon display. (#354)
Browse files Browse the repository at this point in the history
Fixed AFHDS2A telemetry GPS lat/lon display.
  • Loading branch information
ajjjjjjjj authored May 26, 2023
1 parent 0b1fb16 commit 3539f83
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion radio/src/gui/128x64/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att
}
}

void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags att, bool seconds=true)
void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags att, bool seconds)
{
att &= ~RIGHT & ~BOLD;
uint32_t absvalue = abs(value);
Expand Down
8 changes: 7 additions & 1 deletion radio/src/gui/common/arm/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value,
drawDate(x, y, telemetryItem, flags);
}
else if (telemetrySensor.unit == UNIT_GPS) {
drawGPSSensorValue(x, y, telemetryItem, flags);
if (telemetrySensor.id == 0x80 || telemetrySensor.id == 0x81) { // AFHDS2A is handled differently
x -= (g_eeGeneral.gpsFormat == 0 ? 62 : 61);
flags &= ~0x0F00;
drawGPSCoord(x, y, value / 10, (telemetrySensor.id == 0x80) ? "NS" : "EW", flags);
} else {
drawGPSSensorValue(x, y, telemetryItem, flags);
}
}
else if (telemetrySensor.unit == UNIT_BITFIELD) {
#if defined(TELEMETRY_FRSKY_SPORT)
Expand Down
1 change: 1 addition & 0 deletions radio/src/gui/gui_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags fla
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, source_t sensor, LcdFlags flags=0);
void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags att, bool seconds=true);
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 drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
Expand Down
8 changes: 4 additions & 4 deletions radio/src/telemetry/flysky_ibus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,17 @@ const FlySkySensor flySkySensors[] = {
{AFHDS2A_ID_ODO2, ZSTR_ODO2, UNIT_METERS, 2}, // 2 bytes Odometer2 -- some magic with 330 needed
{AFHDS2A_ID_SPE, ZSTR_ASPD, UNIT_KMH, 2}, // 2 bytes Speed km/h -- some magic with 330 needed
{AFHDS2A_ID_TX_V, ZSTR_TXV, UNIT_VOLTS, 2}, // TX Voltage
{AFHDS2A_ID_GPS_LAT, ZSTR_GPS, UNIT_RAW, 7}, // 4 bytes signed WGS84 in degrees * 1E7
{AFHDS2A_ID_GPS_LON, ZSTR_GPS, UNIT_RAW, 7}, // 4 bytes signed WGS84 in degrees * 1E7
{AFHDS2A_ID_GPS_LAT, ZSTR_GPS, UNIT_GPS, 0}, // 4 bytes signed WGS84 in degrees * 1E7
{AFHDS2A_ID_GPS_LON, ZSTR_GPS, UNIT_GPS, 0}, // 4 bytes signed WGS84 in degrees * 1E7
{AFHDS2A_ID_GPS_ALT, ZSTR_GPSALT, UNIT_METERS, 2}, // 4 bytes signed GPS alt m*100
{AFHDS2A_ID_ALT, ZSTR_ALT, UNIT_METERS, 2}, // 4 bytes signed Alt m*100
// {AFHDS2A_ID_RX_SIG_AFHDS3, ZSTR_RX_QUALITY, UNIT_RAW, 0}, // RX error rate
// {AFHDS2A_ID_RX_SIG_AFHDS3, ZSTR_RX_QUALITY, UNIT_PERCENT, 0}, // RX error rate
// {AFHDS2A_ID_RX_SNR_AFHDS3, ZSTR_RX_SNR, UNIT_DB, 1}, // RX SNR
{AFHDS2A_ID_RX_SNR, ZSTR_RX_SNR, UNIT_DB, 0}, // RX SNR
{AFHDS2A_ID_RX_NOISE, ZSTR_RX_NOISE, UNIT_DB, 0}, // RX Noise
{AFHDS2A_ID_RX_RSSI, ZSTR_RSSI, UNIT_DB, 0}, // RX RSSI (0xfc)
{AFHDS2A_ID_RX_ERR_RATE, ZSTR_RX_QUALITY, UNIT_RAW, 0}, // RX error rate
{AFHDS2A_ID_TX_RSSI, ZSTR_TX_RSSI, UNIT_RAW, 0}, // Pseudo sensor for TRSSI
{AFHDS2A_ID_TX_RSSI, ZSTR_TX_RSSI, UNIT_DBM, 0}, // Pseudo sensor for TRSSI

{0x00, NULL, UNIT_RAW, 0}, // sentinel
};
Expand Down

0 comments on commit 3539f83

Please sign in to comment.