mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-05 13:14:45 +00:00
Add bearings screen into the carousel of rotated screens
This commit is contained in:
parent
74e786e5d7
commit
bec732046a
@ -544,7 +544,31 @@ void drawDynamicNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
|
|||||||
|
|
||||||
// Render screen based on currentMode
|
// Render screen based on currentMode
|
||||||
const char *title = getCurrentModeTitle(display->getWidth());
|
const char *title = getCurrentModeTitle(display->getWidth());
|
||||||
drawNodeListScreen(display, state, x, y, title, drawEntryDynamic);
|
|
||||||
|
if (currentMode == MODE_BEARING) {
|
||||||
|
float heading = 0;
|
||||||
|
bool validHeading = false;
|
||||||
|
auto ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
|
||||||
|
double lat = DegD(ourNode->position.latitude_i);
|
||||||
|
double lon = DegD(ourNode->position.longitude_i);
|
||||||
|
|
||||||
|
if (uiconfig.compass_mode != meshtastic_CompassMode_FREEZE_HEADING) {
|
||||||
|
if (screen->hasHeading()) {
|
||||||
|
heading = screen->getHeading(); // degrees
|
||||||
|
validHeading = true;
|
||||||
|
} else {
|
||||||
|
heading = screen->estimatedHeading(lat, lon);
|
||||||
|
validHeading = !isnan(heading);
|
||||||
|
}
|
||||||
|
if (!validHeading) {
|
||||||
|
lastRenderedMode = MODE_COUNT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawNodeListScreen(display, state, x, y, title, drawEntryCompass, drawCompassArrow, heading, lat, lon);
|
||||||
|
} else {
|
||||||
|
drawNodeListScreen(display, state, x, y, title, drawEntryDynamic);
|
||||||
|
}
|
||||||
|
|
||||||
// Track the last mode to avoid reinitializing modeStartTime
|
// Track the last mode to avoid reinitializing modeStartTime
|
||||||
lastRenderedMode = currentMode;
|
lastRenderedMode = currentMode;
|
||||||
|
Loading…
Reference in New Issue
Block a user