1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-08-18 10:22:31 +02:00

Fix vertikal time axis label

This commit is contained in:
Ulrich Meine
2026-04-06 00:58:38 +02:00
parent 856e19cd5e
commit 3f1d2d4ee2
+5 -2
View File
@@ -476,11 +476,12 @@ void Chart::drawChrtTimeAxis(const char chrtDir, const int8_t chrtSz, const int8
intv = 60; // print axis label each 60 pixels = seconds intv = 60; // print axis label each 60 pixels = seconds
axSlots = timAxis / intv; // number of axis labels; value will be truncated to full number axSlots = timAxis / intv; // number of axis labels; value will be truncated to full number
i = axSlots * chrtIntv * -1; // current minute label // i = axSlots * chrtIntv * -1; // current minute label
if (chrtDir == HORIZONTAL) { if (chrtDir == HORIZONTAL) {
getdisplay().fillRect(0, cRoot.y, dWidth, 2, fgColor); getdisplay().fillRect(0, cRoot.y, dWidth, 2, fgColor);
i = axSlots * chrtIntv * -1; // current minute label
// LOG_DEBUG(GwLog::DEBUG, "Chart::drawChrtTimeAxis: intv: %d, axSlots: %d, timAxis: %d, chrtIntv: %d", intv, axSlots, timAxis, chrtIntv); // LOG_DEBUG(GwLog::DEBUG, "Chart::drawChrtTimeAxis: intv: %d, axSlots: %d, timAxis: %d, chrtIntv: %d", intv, axSlots, timAxis, chrtIntv);
for (int j = intv; j < timAxis - 1; j += intv) { // fill time axis with values but keep area free on right hand side for value label for (int j = intv; j < timAxis - 1; j += intv) { // fill time axis with values but keep area free on right hand side for value label
@@ -495,6 +496,7 @@ void Chart::drawChrtTimeAxis(const char chrtDir, const int8_t chrtSz, const int8
} else { // vertical chart } else { // vertical chart
i = chrtIntv * -1; // current minute label
for (float j = intv; j < timAxis - 1; j += intv) { // don't print time label at upper and lower end of time axis for (float j = intv; j < timAxis - 1; j += intv) { // don't print time label at upper and lower end of time axis
snprintf(sTime, sizeof(sTime), "%d", i); snprintf(sTime, sizeof(sTime), "%d", i);
@@ -507,7 +509,8 @@ void Chart::drawChrtTimeAxis(const char chrtDir, const int8_t chrtSz, const int8
} else if (chrtSz == HALF_SIZE_RIGHT) { // half size chart; right side } else if (chrtSz == HALF_SIZE_RIGHT) { // half size chart; right side
drawTextCenter(dWidth / 2, cRoot.y + j, sTime); // time value; print mid screen drawTextCenter(dWidth / 2, cRoot.y + j, sTime); // time value; print mid screen
} }
i += chrtIntv; // i += chrtIntv;
i -= chrtIntv;
} }
} }
} }