mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 06:02:05 +00:00
Correct GPS positioning and string consistency across strings for GPS
This commit is contained in:
parent
497ff0a58e
commit
fa3161f4c3
@ -38,26 +38,24 @@ namespace UIRenderer
|
|||||||
void drawGps(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::GPSStatus *gps)
|
void drawGps(OLEDDisplay *display, int16_t x, int16_t y, const meshtastic::GPSStatus *gps)
|
||||||
{
|
{
|
||||||
// Draw satellite image
|
// Draw satellite image
|
||||||
display->drawFastImage(x + 2, y, 8, 8, imgSatellite);
|
int yOffset = (SCREEN_WIDTH > 128) ? 4 : 2;
|
||||||
|
display->drawFastImage(x + 1, y + yOffset, 8, 8, imgSatellite);
|
||||||
|
char textString[10];
|
||||||
|
|
||||||
if (config.position.fixed_position) {
|
if (config.position.fixed_position) {
|
||||||
// GPS coordinates are currently fixed
|
// GPS coordinates are currently fixed
|
||||||
display->drawString(x + 12, y - 2, (SCREEN_WIDTH > 128) ? "GPS: Fixed" : "Fixed");
|
snprintf(textString, sizeof(textString), "Fixed");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!gps->getIsConnected()) {
|
if (!gps->getIsConnected()) {
|
||||||
display->drawString(x + 12, y - 2, (SCREEN_WIDTH > 128) ? "GPS: No Lock" : "No Lock");
|
snprintf(textString, sizeof(textString), "No Lock");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!gps->getHasLock()) {
|
if (!gps->getHasLock()) {
|
||||||
// Draw "No sats" to the right of the icon with slightly more gap
|
// Draw "No sats" to the right of the icon with slightly more gap
|
||||||
display->drawString(x + 12, y - 3, (SCREEN_WIDTH > 128) ? "GPS: No Sats" : "No Sats");
|
snprintf(textString, sizeof(textString), "No Sats");
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
char satsString[8];
|
snprintf(textString, sizeof(textString), "%u sats", gps->getNumSatellites());
|
||||||
snprintf(satsString, sizeof(satsString), "%u sats", gps->getNumSatellites());
|
|
||||||
display->drawString(x + 12, y - 2, satsString);
|
|
||||||
}
|
}
|
||||||
|
display->drawString(x + 12, y, textString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw status when GPS is disabled or not present
|
// Draw status when GPS is disabled or not present
|
||||||
@ -569,8 +567,7 @@ void drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t
|
|||||||
displayLine);
|
displayLine);
|
||||||
} else {
|
} else {
|
||||||
UIRenderer::drawGps(
|
UIRenderer::drawGps(
|
||||||
display, 0,
|
display, 0, ((rows == 4) ? compactSecondLine : ((SCREEN_HEIGHT > 64) ? compactSecondLine : moreCompactSecondLine)),
|
||||||
((rows == 4) ? compactSecondLine : ((SCREEN_HEIGHT > 64) ? compactSecondLine : moreCompactSecondLine)) + 3,
|
|
||||||
gpsStatus);
|
gpsStatus);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -901,8 +898,6 @@ void drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
bool origBold = config.display.heading_bold;
|
bool origBold = config.display.heading_bold;
|
||||||
config.display.heading_bold = false;
|
config.display.heading_bold = false;
|
||||||
|
|
||||||
const char *Satelite_String = "Sat:";
|
|
||||||
display->drawString(0, ((SCREEN_HEIGHT > 64) ? compactFirstLine : moreCompactFirstLine), Satelite_String);
|
|
||||||
const char *displayLine = ""; // Initialize to empty string by default
|
const char *displayLine = ""; // Initialize to empty string by default
|
||||||
if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
if (config.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED) {
|
||||||
if (config.position.fixed_position) {
|
if (config.position.fixed_position) {
|
||||||
@ -910,12 +905,10 @@ void drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
} else {
|
} else {
|
||||||
displayLine = config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT ? "No GPS" : "GPS off";
|
displayLine = config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT ? "No GPS" : "GPS off";
|
||||||
}
|
}
|
||||||
display->drawString(display->getStringWidth(Satelite_String) + 3,
|
display->drawFastImage(x + 1, y, 8, 8, imgSatellite);
|
||||||
((SCREEN_HEIGHT > 64) ? compactFirstLine : moreCompactFirstLine), displayLine);
|
display->drawString(x + 12, ((SCREEN_HEIGHT > 64) ? compactFirstLine : moreCompactFirstLine), displayLine);
|
||||||
} else {
|
} else {
|
||||||
displayLine = "GPS enabled"; // Set a value when GPS is enabled
|
UIRenderer::drawGps(display, 0, ((SCREEN_HEIGHT > 64) ? compactFirstLine : moreCompactFirstLine), gpsStatus);
|
||||||
UIRenderer::drawGps(display, display->getStringWidth(Satelite_String) + 3,
|
|
||||||
((SCREEN_HEIGHT > 64) ? compactFirstLine : moreCompactFirstLine) + 3, gpsStatus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.display.heading_bold = origBold;
|
config.display.heading_bold = origBold;
|
||||||
|
Loading…
Reference in New Issue
Block a user