Moved clock to top left of the screen

This commit is contained in:
Sjef Verhoeven PE5PVB
2025-01-31 11:28:09 +01:00
parent 1756ca1d18
commit 6bdf7012a2
3 changed files with 67 additions and 84 deletions
+61 -77
View File
@@ -1407,11 +1407,7 @@ void loop() {
}
void GetData() {
if (!afscreen) {
showCT();
ShowSignalLevel();
}
if (!afscreen) ShowSignalLevel();
if (!BWtune && !menu) showPS();
if (band < BAND_GAP && !BWtune && !menu) {
@@ -1430,6 +1426,7 @@ void GetData() {
ShowStereoStatus();
if (!screenmute) {
showCT();
ShowRSSI();
ShowOffset();
ShowBW();
@@ -3450,92 +3447,79 @@ void ShowOffset() {
return;
}
int baseX = 1; // Left boundary
int baseY = 16; // Top boundary
int width = 51; // Max width
int height = 13; // Max height
int centerX = baseX + width / 2; // Center dot X
int centerY = baseY + height / 2; // Center dot Y
// **Move arrows 3px further from the dot**
int arrowGap = 3; // Space between dot and arrows
int arrowWidth = 18; // Arrow stretch size
int leftArrowBaseX = centerX - arrowWidth - arrowGap; // Shift left arrow further left
int rightArrowBaseX = centerX + arrowWidth + arrowGap; // Shift right arrow further right
int arrowHeight = height - 2; // Arrow height
int arrowBaseYTop = baseY + 1; // Adjusted top Y position
int arrowBaseYBottom = baseY + height - 1;
if (band < BAND_GAP) {
if (OStatus < -500) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, SignificantColor);
tuned = false;
} else if (OStatus < -250 && OStatus > -500) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, SignificantColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
if (OStatus < -250) {
// Left arrow active (▶)
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, SignificantColor);
// Center dot
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
// Right arrow dimmed (◀)
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, GreyoutColor);
tuned = false;
} else if (USN < 250 && WAM < 250 && OStatus > -250 && OStatus < 250 && !SQ) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, InsignificantColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
// Both arrows dimmed
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, GreyoutColor);
// Center dot active
tft.fillCircle(centerX, centerY, 3, InsignificantColor);
tuned = true;
} else if (OStatus > 250 && OStatus < 500) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, SignificantColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
tuned = false;
} else if (OStatus > 500) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, SignificantColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
} else if (OStatus > 250) {
// Right arrow active (◀)
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, SignificantColor);
// Center dot dimmed
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
// Left arrow dimmed (▶)
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, GreyoutColor);
tuned = false;
} else {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
// Everything dimmed
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
tuned = false;
}
} else {
if (OStatus <= -3) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, SignificantColor);
tuned = false;
} else if (OStatus < -2 && OStatus > -3) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, SignificantColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
if (OStatus <= -2) {
// Left arrow active (▶)
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, SignificantColor);
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
// Right arrow dimmed (◀)
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, GreyoutColor);
tuned = false;
} else if (OStatus > -2 && OStatus < 2 && !SQ) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, InsignificantColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillCircle(centerX, centerY, 3, InsignificantColor);
tuned = true;
} else if (OStatus > 2 && OStatus < 3) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, SignificantColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
tuned = false;
} else if (OStatus >= 3) {
tft.fillTriangle(3, 8, 3, 22, 11, 14, SignificantColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
} else if (OStatus > 2) {
// Right arrow active (◀)
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, SignificantColor);
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
// Left arrow dimmed (▶)
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, GreyoutColor);
tuned = false;
} else {
tft.fillTriangle(3, 8, 3, 22, 11, 14, GreyoutColor);
tft.fillTriangle(13, 8, 13, 22, 21, 14, GreyoutColor);
tft.fillCircle(26, 15, 3, GreyoutColor);
tft.fillTriangle(32, 14, 40, 8, 40, 22, GreyoutColor);
tft.fillTriangle(42, 14, 50, 8, 50, 22, GreyoutColor);
tft.fillTriangle(leftArrowBaseX, arrowBaseYTop, centerX - arrowGap, centerY, leftArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillTriangle(rightArrowBaseX, arrowBaseYTop, centerX + arrowGap, centerY, rightArrowBaseX, arrowBaseYBottom, GreyoutColor);
tft.fillCircle(centerX, centerY, 3, GreyoutColor);
tuned = false;
}
}
+1
View File
@@ -2955,6 +2955,7 @@ void BuildDisplay() {
tft.drawRect(0, 0, 320, 240, FrameColor);
tft.drawLine(0, 30, 320, 30, FrameColor);
tft.drawLine(0, 100, 320, 100, FrameColor);
tft.drawLine(0, 15, 53, 15, FrameColor);
tft.drawLine(120, 30, 120, 0, FrameColor);
tft.drawLine(210, 100, 210, 217, FrameColor);
tft.drawLine(248, 30, 248, 0, FrameColor);
+5 -7
View File
@@ -822,7 +822,7 @@ void showCT() {
// Format the time string with leading zeros for minutes
char formattedTime[10];
sprintf(formattedTime, "%d:%02d %s", hour, localtime(&t)->tm_min, ampm.c_str());
sprintf(formattedTime, "%d:%02d%s", hour, localtime(&t)->tm_min, ampm.c_str());
rds_clock = String(formattedTime);
} else { // Other regions: 24-hour format
@@ -841,16 +841,14 @@ void showCT() {
}
// Display the updated time
int yCoord = advancedRDS ? 109 : 163;
tftReplace(1, rds_clockold, rds_clock, 208, yCoord, RDSColor, RDSColorSmooth, BackgroundColor, 16);
tftReplace(0, rds_clockold, rds_clock, 26, 1, RDSColor, RDSColorSmooth, BackgroundColor, 16);
} else { // Handle dropout scenarios
int yCoord = advancedRDS ? 109 : 163;
if (rtcset) { // Display dropout message if RTC was set
tftReplace(1, rds_clockold, rds_clock, 208, yCoord, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
tftReplace(1, rds_clockold, rds_clock, 26, 1, RDSDropoutColor, RDSDropoutColorSmooth, BackgroundColor, 16);
} else { // Clear and reprint the clock
tftPrint(1, rds_clockold, 208, yCoord, BackgroundColor, BackgroundColor, 16);
tftPrint(1, rds_clock, 208, yCoord, BackgroundColor, BackgroundColor, 16);
tftPrint(0, rds_clockold, 26, 1, BackgroundColor, BackgroundColor, 16);
tftPrint(0, rds_clock, 26, 1, BackgroundColor, BackgroundColor, 16);
}
}
}