Skip to content

Commit

Permalink
Move waypoint (#4202)
Browse files Browse the repository at this point in the history
* Move waypoint screen draw into the waypoint module

* Get the observer set up for the waypoint screen draw

* Static squashing: screen dimensions
Macros moved back to Screen.cpp, as a band-aid until we eventually move all those static functions into the Screen class.

* Move getCompassDiam into Screen class
(supress compiler warnings)
At this stage, the method is still static, because it's used by drawNodeInfo, which has no tidy reference to our screen instance.
This is probably just another band-aid until these static functions all move.

* Use new getCompassDiam function in AccelerometerThread

* Properly gate display code in WaypointModule

---------

Co-authored-by: Todd Herbert <[email protected]>
  • Loading branch information
jp-bennett and todd-herbert authored Jun 30, 2024
1 parent 47a94d7 commit b5d7718
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 228 deletions.
7 changes: 4 additions & 3 deletions src/AccelerometerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,17 @@ class AccelerometerThread : public concurrency::OSThread
display->setFont(FONT_MEDIUM);
display->drawString(x, y, "Calibrating\nCompass");
int16_t compassX = 0, compassY = 0;
uint16_t compassDiam = graphics::Screen::getCompassDiam(display->getWidth(), display->getHeight());

// coordinates for the center of the compass/circle
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) {
compassX = x + display->getWidth() - getCompassDiam(display) / 2 - 5;
compassX = x + display->getWidth() - compassDiam / 2 - 5;
compassY = y + display->getHeight() / 2;
} else {
compassX = x + display->getWidth() - getCompassDiam(display) / 2 - 5;
compassX = x + display->getWidth() - compassDiam / 2 - 5;
compassY = y + FONT_HEIGHT_SMALL + (display->getHeight() - FONT_HEIGHT_SMALL) / 2;
}
display->drawCircle(compassX, compassY, getCompassDiam(display) / 2);
display->drawCircle(compassX, compassY, compassDiam / 2);
screen->drawCompassNorth(display, compassX, compassY, screen->getHeading() * PI / 180);
}
#endif
Expand Down
Loading

0 comments on commit b5d7718

Please sign in to comment.