https://github.com/meshtastic/firmware/blob/1bbc273ba6cac076fa2c97a30178ef2bc12e682b/src/graphics/Screen.cpp#L1285
Whenever I look at the compass, I always wonder why the arrow is so simple. Maybe it could be a little more beautiful.
I had time today and it's not that complicated.
I tried to make a nicer compass with the drawNodeHeading and drawCompassNorth functions.
I changed the north marking to a circle, because if the "N" was on top it wouldn't fit on the display on HT-VM E290.
Now I kept all the original variables (N1-N4) and changed the value of the arrow "tail".
Some photos of the result and the modified functions.
I know it doesn't improve the function but I think it's nicer to look at.
If you consider it functional could it be replaced? 😇
void Screen::drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading)
{
// If north is supposed to be at the top of the compass we want rotation to be +0
if (config.display.compass_north_top)
myHeading = -0;
Point N1(-0.04f, 0.65f), N2(0.04f, 0.65f);
Point N3(-0.04f, 0.55f), N4(0.04f, 0.55f);
Point N5(0.00f, 0.50f);
Point *rosePoints[] = {&N1, &N2, &N3, &N4, &N5};
uint16_t compassDiam = Screen::getCompassDiam(SCREEN_WIDTH, SCREEN_HEIGHT);
for (int i = 0; i < 5; i++) {
// North on compass will be negative of heading
rosePoints[i]->rotate(-myHeading);
rosePoints[i]->scale(compassDiam);
rosePoints[i]->translate(compassX, compassY);
}
//display->drawLine(N1.x, N1.y, N3.x, N3.y);
//display->drawLine(N2.x, N2.y, N4.x, N4.y);
//display->drawLine(N1.x, N1.y, N4.x, N4.y);
display->drawCircle(N5.x, N5.y, 4);
https://github.com/meshtastic/firmware/blob/1bbc273ba6cac076fa2c97a30178ef2bc12e682b/src/graphics/Screen.cpp#L1285 Whenever I look at the compass, I always wonder why the arrow is so simple. Maybe it could be a little more beautiful. I had time today and it's not that complicated. I tried to make a nicer compass with the drawNodeHeading and drawCompassNorth functions. I changed the north marking to a circle, because if the "N" was on top it wouldn't fit on the display on HT-VM E290. Now I kept all the original variables (N1-N4) and changed the value of the arrow "tail". Some photos of the result and the modified functions. I know it doesn't improve the function but I think it's nicer to look at. If you consider it functional could it be replaced? 😇
void Screen::drawNodeHeading(OLEDDisplay *display, int16_t compassX, int16_t compassY, uint16_t compassDiam, float headingRadian) { Point tip(0.0f, 0.5f), tail(0.0f, -0.35f); // pointing up initially float arrowOffsetX = 0.14f, arrowOffsetY = 1.0f; Point leftArrow(tip.x - arrowOffsetX, tip.y - arrowOffsetY), rightArrow(tip.x + arrowOffsetX, tip.y - arrowOffsetY);
}
void Screen::drawCompassNorth(OLEDDisplay *display, int16_t compassX, int16_t compassY, float myHeading) { // If north is supposed to be at the top of the compass we want rotation to be +0 if (config.display.compass_north_top) myHeading = -0;
}