Skip to content

Commit

Permalink
Nav Page complete and V0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
oxothnk423 committed Feb 3, 2025
1 parent 64cf6d1 commit e550c9f
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 157 deletions.
106 changes: 61 additions & 45 deletions src/vario/PageNavigate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ void navigatePage_draw() {
uint8_t varioBarBottomHeight = 45;
uint8_t varioBarHeight = varioBarTopHeight + varioBarBottomHeight + 1;
uint8_t varioBarMidpoint = topOfFrame + varioBarTopHeight;
uint8_t climbTriangleWidth = 9;
uint8_t varioBoxHeight = 18;

//////////////////////
Expand Down Expand Up @@ -190,13 +189,11 @@ void navigatePage_draw() {
pointer_y + pointer_h + shaft_h);


// Waypoint Drop Shape
if (gpxNav.navigating) {
displayWaypointDropletPointer(nav_x, nav_y, nav_r-1, gpxNav.turnToActive * DEG_TO_RAD + PI / 2);
}
// Waypoint Drop Shape Placemark Icon
// just testing options here:
//displayWaypointDropletPointer(nav_x, nav_y, nav_r, gpxNav.turnToActive * DEG_TO_RAD + PI / 2);

// Waypoint Pointer

// Waypoint Pointer
if (gpxNav.navigating) {
uint8_t waypoint_tip_r = nav_r - 1;
uint8_t waypoint_shaft_r = waypoint_tip_r - 3;
Expand Down Expand Up @@ -246,13 +243,30 @@ void navigatePage_draw() {
// Vario Info *************************************

// Vario Bar
display_varioBar(topOfFrame, varioBarHeight, varioBarWidth, baro.climbRateFiltered);
display_varioBar(topOfFrame,
varioBarTopHeight,
varioBarBottomHeight,
varioBarWidth,
baro.climbRateFiltered);

// Climb
// Climb Triangle
u8g2.drawTriangle(varioBarWidth - climbTriangleWidth - 1, topOfFrame + varioBarTopHeight, // left
varioBarWidth - 1, topOfFrame + varioBarTopHeight - climbTriangleWidth, // top
varioBarWidth - 1, topOfFrame + varioBarTopHeight + climbTriangleWidth); // bottom
uint8_t climbTriangleWidth = 9;
uint8_t triLeftX = varioBarWidth - climbTriangleWidth - 1;
uint8_t triLeftY = topOfFrame + varioBarTopHeight;
uint8_t triRightX = varioBarWidth - 1;
uint8_t triTopY = topOfFrame + varioBarTopHeight - climbTriangleWidth;
uint8_t triBotY = topOfFrame + varioBarTopHeight + climbTriangleWidth;
u8g2.drawTriangle(triLeftX, triLeftY, // left
triRightX, triTopY, // top
triRightX, triBotY); // bottom
// now erase a gap between the triangle and the fill of the vario bar
u8g2.setDrawColor(0);
u8g2.drawLine(triLeftX-1, triLeftY, triRightX-1, triTopY);
u8g2.drawLine(triLeftX-1, triLeftY - 1, triRightX-1, triTopY - 1);
u8g2.drawLine(triLeftX-1, triLeftY, triRightX-1, triBotY);
u8g2.drawLine(triLeftX-1, triLeftY + 1, triRightX-1, triBotY + 1);
u8g2.setDrawColor(1);

// climb background
u8g2.drawBox(varioBarWidth, topOfFrame + 2 * nav_r + 4, 30, 17);
Expand Down Expand Up @@ -317,46 +331,48 @@ void navigatePage_draw() {

///////////////////////////////////////////////////
// Waypoint Info **********************************
// Name
u8g2.setCursor(varioBarWidth + 2, topOfFrame + varioBarHeight - 8);
u8g2.setFont(u8g2_font_12x6LED_tf);

String defaultWaypointString = "<Select Dest>";
if (gpxData.totalRoutes <= 0 && gpxData.totalWaypoints <= 0) {
defaultWaypointString = "No Waypoints!";
}
// Waypoint Name
uint8_t waypointNameY = topOfFrame + varioBarHeight - 9;
u8g2.setCursor(varioBarWidth + 2, waypointNameY);
u8g2.setFont(u8g2_font_12x6LED_tf);

String defaultWaypointString = "<Select Dest>";
if (gpxData.totalRoutes <= 0 && gpxData.totalWaypoints <= 0) {
defaultWaypointString = "No Waypoints!";
}

// if the cursor is here, write the waypoint/route name of where the selection index is, rather
// than the active waypoint).
if (navigatePage_cursorPosition == cursor_navigatePage_waypoint) {
u8g2.setCursor(u8g2.getCursorX() + 6,
u8g2.getCursorY()); // Also scoot the string over a few pixels to make room
// for selection box
if (destination_selection_index == 0) {
u8g2.print(defaultWaypointString);
} else {
if (destination_selection_routes_vs_waypoints) {
u8g2.setFont(leaf_icons);
u8g2.print('R');
u8g2.setFont(u8g2_font_12x6LED_tf);
u8g2.print(gpxData.routes[destination_selection_index].name);
// if the cursor is here, write the waypoint/route name of where the selection index is, rather
// than the active waypoint).
if (navigatePage_cursorPosition == cursor_navigatePage_waypoint) {
u8g2.setCursor(u8g2.getCursorX() + 6,
u8g2.getCursorY()); // Also scoot the string over a few pixels to make room
// for selection box
if (destination_selection_index == 0) {
u8g2.print(defaultWaypointString);
} else {
u8g2.print(gpxData.waypoints[destination_selection_index].name);
if (destination_selection_routes_vs_waypoints) {
u8g2.setFont(leaf_icons);
u8g2.print('R');
u8g2.setFont(u8g2_font_12x6LED_tf);
u8g2.print(gpxData.routes[destination_selection_index].name);
} else {
u8g2.print(gpxData.waypoints[destination_selection_index].name);
}
}
} else {
if (gpxNav.navigating)
u8g2.print(gpxNav.activePoint.name.c_str());
else
u8g2.print(defaultWaypointString);
u8g2.setFont(leaf_6x12);
}
} else {
if (gpxNav.navigating)
u8g2.print(gpxNav.activePoint.name.c_str());
else
u8g2.print(defaultWaypointString);
u8g2.setFont(leaf_6x12);
}

// selection box
if (navigatePage_cursorPosition == cursor_navigatePage_waypoint) {
display_selectionBox(
varioBarWidth + 1, topOfFrame + varioBarHeight - 23, 96 - varioBarWidth - 1, 19, 5);
}
if (navigatePage_cursorPosition == cursor_navigatePage_waypoint) {
uint8_t selectionBoxHeight = 18;
display_selectionBox(
varioBarWidth + 1, waypointNameY - 14, 96 - varioBarWidth - 1, selectionBoxHeight, 5);
}

// Progress Bar
float percent_progress;
Expand Down
70 changes: 36 additions & 34 deletions src/vario/PageThermal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,47 +44,49 @@ void thermalPage_draw() {
display_headerAndFooter(cursor_position == cursor_thermalPage_timer, false);

// Main Info ****************************************************
uint8_t topOfFrame = 30;
uint8_t graphBoxHeight = 40;
uint8_t varioBarWidth = 20;
uint8_t varioBarHeight = 141;
// Vario Bar
uint8_t topOfFrame = 30;
uint8_t varioBarWidth = 20;
uint8_t varioBarClimbHeight = 70;
uint8_t varioBarSinkHeight = varioBarClimbHeight;

display_varioBar(topOfFrame, varioBarClimbHeight, varioBarSinkHeight, varioBarWidth, baro.climbRateFiltered);

// Graph Box
u8g2.drawFrame(varioBarWidth - 1, topOfFrame, 96 - varioBarWidth + 1, graphBoxHeight);
// Graph Box
uint8_t graphBoxHeight = 40;
u8g2.drawFrame(varioBarWidth - 1, topOfFrame, 96 - varioBarWidth + 1, graphBoxHeight);

// Vario Bar
display_varioBar(topOfFrame, varioBarHeight, varioBarWidth, baro.climbRateFiltered);
// alt
display_alt_type(22, 89, leaf_8x14, THMPG_ALT_TYP);

// alt
display_alt_type(22, 89, leaf_8x14, THMPG_ALT_TYP);
// altselection box
if (cursor_position == cursor_thermalPage_alt1) {
display_selectionBox(21, 73, 96 - 21, 18, 6);
}

// altselection box
if (cursor_position == cursor_thermalPage_alt1) {
display_selectionBox(21, 73, 96 - 21, 18, 6);
}
// climb rate
display_climbRatePointerBox(20, 92, 76, 17, 6); // x, y, w, h, triangle size
display_climbRate(20, 108, leaf_8x14, baro.climbRateFiltered);

// climb rate
display_climbRatePointerBox(20, 92, 76, 17, 6); // x, y, w, h, triangle size
display_climbRate(20, 108, leaf_8x14, baro.climbRateFiltered);

display_altAboveLaunch(24, 132, baro.altAboveLaunch);
// altitude above launch
display_altAboveLaunch(24, 132, baro.altAboveLaunch);

// User Fields ****************************************************
uint8_t userFieldsTop = 136;
uint8_t userFieldsHeight = 17;
uint8_t userFieldsMid = userFieldsTop + userFieldsHeight;
uint8_t userFieldsBottom = userFieldsMid + userFieldsHeight;
uint8_t userSecondColumn = varioBarWidth / 2 + 48;

u8g2.drawHLine(varioBarWidth - 1, userFieldsTop, 96 - varioBarWidth + 1);
u8g2.drawHLine(varioBarWidth - 1, userFieldsMid, 96 - varioBarWidth + 1);
u8g2.drawHLine(varioBarWidth - 1, userFieldsBottom, 96 - varioBarWidth + 1);
u8g2.drawVLine(userSecondColumn, userFieldsTop, userFieldsHeight * 2);

display_temp(varioBarWidth + 5, userFieldsMid - 1, (int16_t)tempRH_getTemp());
display_humidity(userSecondColumn + 3, userFieldsMid - 1, (uint8_t)tempRH_getHumidity());
display_accel(varioBarWidth + 5, userFieldsBottom - 1, IMU_getAccel());
display_glide(userSecondColumn + 3, userFieldsBottom - 1, gps_getGlideRatio());
uint8_t userFieldsTop = 136;
uint8_t userFieldsHeight = 17;
uint8_t userFieldsMid = userFieldsTop + userFieldsHeight;
uint8_t userFieldsBottom = userFieldsMid + userFieldsHeight;
uint8_t userSecondColumn = varioBarWidth / 2 + 48;

u8g2.drawHLine(varioBarWidth - 1, userFieldsTop, 96 - varioBarWidth + 1);
u8g2.drawHLine(varioBarWidth - 1, userFieldsMid, 96 - varioBarWidth + 1);
u8g2.drawHLine(varioBarWidth - 1, userFieldsBottom, 96 - varioBarWidth + 1);
u8g2.drawVLine(userSecondColumn, userFieldsTop, userFieldsHeight * 2);

display_temp(varioBarWidth + 5, userFieldsMid - 1, (int16_t)tempRH_getTemp());
display_humidity(userSecondColumn + 3, userFieldsMid - 1, (uint8_t)tempRH_getHumidity());
display_accel(varioBarWidth + 5, userFieldsBottom - 1, IMU_getAccel());
display_glide(userSecondColumn + 3, userFieldsBottom - 1, gps_getGlideRatio());

// Footer Info ****************************************************

Expand Down
15 changes: 9 additions & 6 deletions src/vario/PageThermalSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ void thermalSimplePage_draw() {


// Main Info ****************************************************
uint8_t topOfFrame = 26; //22
uint8_t varioBarWidth = 25;
uint8_t varioBarHeight = 151;


// Vario Bar
display_varioBar(topOfFrame, varioBarHeight, varioBarWidth, baro.climbRateFiltered);
uint8_t topOfFrame = 26; //22
uint8_t varioBarWidth = 25;
uint8_t varioBarClimbHeight = 75;
uint8_t varioBarSinkHeight = varioBarClimbHeight;

display_varioBar(topOfFrame, varioBarClimbHeight, varioBarSinkHeight, varioBarWidth, baro.climbRateFiltered);


// Altitude
uint8_t alt_y = 62; //58
Expand All @@ -89,7 +92,7 @@ void thermalSimplePage_draw() {

// Climb
uint8_t climbBoxHeight = 27;
uint8_t climbBoxY = topOfFrame + varioBarHeight/2 - climbBoxHeight/2;
uint8_t climbBoxY = topOfFrame + varioBarClimbHeight - climbBoxHeight/2;
display_climbRatePointerBox(varioBarWidth, climbBoxY, 76, climbBoxHeight, 13); // x, y, w, h, triangle size
display_climbRate(20, climbBoxY + 24, leaf_21h, baro.climbRateFiltered);
u8g2.setDrawColor(0);
Expand Down
Loading

0 comments on commit e550c9f

Please sign in to comment.