Enable pages Weather, Wind, XTETrack + charts function for small decimals

This commit is contained in:
Ulrich Meine
2026-09-01 16:55:34 +02:00
parent d44dc94ec7
commit 0202c5d82a
4 changed files with 55 additions and 53 deletions
+18 -20
View File
@@ -28,8 +28,13 @@ static unsigned char ship_bits[] PROGMEM = {
class PageXTETrack : public Page
{
static constexpr int8_t LEFT = 0;
static constexpr int8_t CENTER = 1;
static constexpr int8_t RIGHT = 2;
bool simulation = false;
bool holdvalues = false;
bool smallDecimals = false;
public:
PageXTETrack(CommonData &common){
@@ -37,6 +42,7 @@ class PageXTETrack : public Page
common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack");
simulation = common.config->getBool(common.config->useSimuData);
holdvalues = common.config->getBool(common.config->holdvalues);
smallDecimals = common.config->getBool(common.config->smallDecimals);
}
void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
@@ -95,44 +101,33 @@ class PageXTETrack : public Page
// descriptions
getdisplay().setFont(&Ubuntu_Bold8pt8b);
getdisplay().setCursor(50, 188);
getdisplay().setCursor(30, 188);
getdisplay().print("Cross-track error");
getdisplay().setCursor(270, 188);
getdisplay().setCursor(290, 188);
getdisplay().print("Track");
getdisplay().setCursor(45, 275);
getdisplay().setCursor(25, 275);
getdisplay().print("Distance to waypoint");
getdisplay().setCursor(260, 275);
getdisplay().print("Bearing");
// values
getdisplay().setFont(&DSEG7Classic_BoldItalic30pt7b);
int16_t x, y;
uint16_t w, h;
GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE
String sval_xte = formatValue(bv_xte, *commonData).svalue;
displayGetTextBounds(sval_xte, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(160-w, 170);
getdisplay().print(sval_xte);
// printBoatValue(sval_xte, 160, 170, RIGHT, 30, smallDecimals);
printBoatValue(sval_xte, 20, 170, LEFT, 30, smallDecimals);
GwApi::BoatValue *bv_cog = pageData.values[1]; // COG
String sval_cog = formatValue(bv_cog, *commonData).svalue;
displayGetTextBounds(sval_cog, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(360-w, 170);
getdisplay().print(sval_cog);
printBoatValue(sval_cog, 380, 170, RIGHT, 30, smallDecimals);
GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW
String sval_dtw = formatValue(bv_dtw, *commonData).svalue;
displayGetTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(160-w, 257);
getdisplay().print(sval_dtw);
// printBoatValue(sval_dtw, 160, 257, RIGHT, 30, smallDecimals);
printBoatValue(sval_dtw, 40, 257, LEFT, 30, smallDecimals);
GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW
String sval_btw = formatValue(bv_btw, *commonData).svalue;
displayGetTextBounds(sval_btw, 0, 0, &x, &y, &w, &h);
getdisplay().setCursor(360-w, 257);
getdisplay().print(sval_btw);
printBoatValue(sval_btw, 360, 257, RIGHT, 30, smallDecimals);
bool valid = bv_cog->valid && bv_btw->valid;
@@ -148,6 +143,9 @@ class PageXTETrack : public Page
sval_wpname = "Tonne 122";
}
int16_t x, y;
uint16_t w, h;
getdisplay().setFont(&Ubuntu_Bold10pt8b);
displayGetTextBounds(sval_wpname, 0, 150, &x, &y, &w, &h);
// TODO if text don't fix use smaller font size.