GPS support at runtime

This commit is contained in:
Raphael Coeffic
2022-03-20 16:30:58 +01:00
parent b5779f2a6a
commit 4bdd7e7ea7
19 changed files with 127 additions and 263 deletions
+12 -7
View File
@@ -34,7 +34,9 @@ TopbarImpl::TopbarImpl(Window * parent) :
unsigned int TopbarImpl::getZonesCount() const
{
#if defined(INTERNAL_GPS)
return MAX_TOPBAR_ZONES-1;
if (hasSerialMode(UART_MODE_GPS)) {
return MAX_TOPBAR_ZONES-1;
}
#endif
return MAX_TOPBAR_ZONES;
}
@@ -96,13 +98,16 @@ void TopbarImpl::paint(BitmapBuffer * dc)
dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS) | CENTERED | COLOR_THEME_PRIMARY2);
#if defined(INTERNAL_GPS)
if (gpsData.fix) {
char s[10];
sprintf(s, "%d", gpsData.numSat);
dc->drawText(GPS_X, 4, s, FONT(XS) | CENTERED | COLOR_THEME_PRIMARY2);
if (hasSerialMode(UART_MODE_GPS)) {
if (gpsData.fix) {
char s[10];
sprintf(s, "%d", gpsData.numSat);
dc->drawText(GPS_X, 4, s, FONT(XS) | CENTERED | COLOR_THEME_PRIMARY2);
}
dc->drawBitmapPattern(
GPS_X - 10, 22, LBM_TOPMENU_GPS,
(gpsData.fix) ? COLOR_THEME_PRIMARY2 : COLOR_THEME_PRIMARY3);
}
dc->drawBitmapPattern(GPS_X - 10, 22, LBM_TOPMENU_GPS,
(gpsData.fix) ? COLOR_THEME_PRIMARY2 : COLOR_THEME_PRIMARY3);
#endif
// USB icon
+1 -1
View File
@@ -418,7 +418,7 @@ void RadioSetupPage::build(FormWindow * window)
#if defined(INTERNAL_GPS)
// GPS
{
if (hasSerialMode(UART_MODE_GPS)) {
new Subtitle(window, grid.getLabelSlot(), STR_GPS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();
+15 -13
View File
@@ -240,19 +240,21 @@ void DebugViewPage::build(FormWindow *window)
#endif
#if defined(INTERNAL_GPS)
new StaticText(window, grid.getLabelSlot(), STR_INT_GPS_LABEL, 0,
COLOR_THEME_PRIMARY1);
new DynamicText(
window, grid.getFieldSlot(3, 0),
[] { return std::string(gpsData.fix ? "[Fix] Yes" : "[Fix] No"); },
COLOR_THEME_PRIMARY1);
new DebugInfoNumber<uint8_t>(
window, grid.getFieldSlot(3, 1), [] { return gpsData.numSat; },
COLOR_THEME_PRIMARY1, "[Sats] ", nullptr);
new DebugInfoNumber<uint16_t>(
window, grid.getFieldSlot(3, 2), [] { return gpsData.hdop; },
COLOR_THEME_PRIMARY1, "[Hdop] ", nullptr);
grid.nextLine();
if (hasSerialMode(UART_MODE_GPS)) {
new StaticText(window, grid.getLabelSlot(), STR_INT_GPS_LABEL, 0,
COLOR_THEME_PRIMARY1);
new DynamicText(
window, grid.getFieldSlot(3, 0),
[] { return std::string(gpsData.fix ? "[Fix] Yes" : "[Fix] No"); },
COLOR_THEME_PRIMARY1);
new DebugInfoNumber<uint8_t>(
window, grid.getFieldSlot(3, 1), [] { return gpsData.numSat; },
COLOR_THEME_PRIMARY1, "[Sats] ", nullptr);
new DebugInfoNumber<uint16_t>(
window, grid.getFieldSlot(3, 2), [] { return gpsData.hdop; },
COLOR_THEME_PRIMARY1, "[Hdop] ", nullptr);
grid.nextLine();
}
#endif
// Reset
+2
View File
@@ -793,6 +793,7 @@ bool isTrainerModeAvailable(int mode)
}
#endif
#if defined(PCBTARANIS) || defined(AUX_SERIAL) || defined(AUX2_SERIAL)
if (mode == TRAINER_MODE_MASTER_BATTERY_COMPARTMENT) {
#if defined(TRAINER_BATTERY_COMPARTMENT)
return hasSerialMode(UART_MODE_SBUS_TRAINER) >= 0;
@@ -800,6 +801,7 @@ bool isTrainerModeAvailable(int mode)
return false;
#endif
}
#endif
#if defined(BLUETOOTH) && !defined(PCBX9E)
if (g_eeGeneral.bluetoothMode != BLUETOOTH_TRAINER && (mode == TRAINER_MODE_MASTER_BLUETOOTH || mode == TRAINER_MODE_SLAVE_BLUETOOTH))