@@ -360,7 +360,7 @@ void DisplayUI::drawAlbumArt(int32_t x, int32_t y, String filename)
360
360
361
361
Monitor::start (MONITOR_ID_SPOTIFY_IMAGE_FILE_LOAD, LOGTAG_METRICS, " drawFsJpg(...)" );
362
362
drawFsJpg (x, y, filename.c_str (), LittleFS);
363
- // drawFsJpg((_tft->width() - w) / 2, 10, filename.c_str(), LittleFS);
363
+
364
364
Monitor::stop (MONITOR_ID_SPOTIFY_IMAGE_FILE_LOAD);
365
365
366
366
}
@@ -509,10 +509,9 @@ void DisplayUI::drawButton(int32_t x, int32_t y, bool isPressed)
509
509
void DisplayUI::drawBlankButton (int32_t x, int32_t y, int32_t width, int32_t height, uint8_t margin, TFTColor borderColor, bool isPressed)
510
510
{
511
511
512
- // const TFTColor borderColor = TFTColor::White;
513
- TFTColor bodyColor = getBackground ();
514
- // Invert the color
515
- TFTColor pressColor = static_cast <TFTColor>(~static_cast <uint16_t >(bodyColor));
512
+ TFTColor bodyColor = getBackground ();
513
+ // Invert the color
514
+ TFTColor pressColor = static_cast <TFTColor>(~static_cast <uint16_t >(bodyColor));
516
515
517
516
if (xSemaphoreTake (xSemaphoreDisplay, portMAX_DELAY))
518
517
{
@@ -547,11 +546,11 @@ void DisplayUI::drawSkipTrackIcon(int32_t x, int32_t y, int32_t width, int32_t h
547
546
if (xSemaphoreTake (xSemaphoreDisplay, portMAX_DELAY))
548
547
{
549
548
// Define basic geometry
550
- const int32_t centerX = x + width / 2 ;
551
- const int32_t centerY = y + height / 2 ;
552
- const int32_t triangleSize = 20 ;
553
- const int32_t lineThickness = 5 ; // Thickness of the vertical line
554
- const int32_t offsetX = 20 ; // Offset to adjust positioning
549
+ const int32_t centerX = x + width / 2 ;
550
+ const int32_t centerY = y + height / 2 ;
551
+ const int32_t triangleSize = 20 ;
552
+ const int32_t lineThickness = 5 ; // Thickness of the vertical line
553
+ const int32_t offsetX = 20 ; // Offset to adjust positioning
555
554
556
555
// Determine positions based on isReversed
557
556
const int32_t lineX = isReversed ? centerX - offsetX : centerX + offsetX - lineThickness;
@@ -569,7 +568,7 @@ void DisplayUI::drawSkipTrackIcon(int32_t x, int32_t y, int32_t width, int32_t h
569
568
_tft->fillTriangle (
570
569
triangleX + 15 , triangleY, // Top point
571
570
triangleX + 15 , triangleY + 30 , // Bottom point
572
- triangleX - triangleSize, centerY, // Leftmost point
571
+ triangleX - triangleSize, centerY, // Leftmost point
573
572
toValue (symbolColor)
574
573
);
575
574
}
@@ -579,7 +578,7 @@ void DisplayUI::drawSkipTrackIcon(int32_t x, int32_t y, int32_t width, int32_t h
579
578
_tft->fillTriangle (
580
579
triangleX - 15 , triangleY, // Top point
581
580
triangleX - 15 , triangleY + 30 , // Bottom point
582
- triangleX + triangleSize, centerY, // Rightmost point
581
+ triangleX + triangleSize, centerY, // Rightmost point
583
582
toValue (symbolColor)
584
583
);
585
584
}
@@ -603,11 +602,11 @@ void DisplayUI::drawPlayTrackIcon(int32_t x, int32_t y, int32_t width, int32_t h
603
602
if (xSemaphoreTake (xSemaphoreDisplay, portMAX_DELAY))
604
603
{
605
604
// Define basic geometry
606
- const int32_t centerX = x + width / 2 ;
607
- const int32_t centerY = y + height / 2 ;
608
- const int32_t triangleSize = 20 ;
609
- const int32_t lineThickness = 0 ; // Thickness of the vertical line
610
- const int32_t offsetX = 20 ; // Offset to adjust positioning
605
+ const int32_t centerX = x + width / 2 ;
606
+ const int32_t centerY = y + height / 2 ;
607
+ const int32_t triangleSize = 20 ;
608
+ const int32_t lineThickness = 0 ; // Thickness of the vertical line
609
+ const int32_t offsetX = 20 ; // Offset to adjust positioning
611
610
612
611
// Determine positions based on isReversed
613
612
const int32_t lineX = centerX + offsetX - lineThickness;
@@ -619,7 +618,7 @@ void DisplayUI::drawPlayTrackIcon(int32_t x, int32_t y, int32_t width, int32_t h
619
618
_tft->fillTriangle (
620
619
triangleX - 15 , triangleY, // Top point
621
620
triangleX - 15 , triangleY + 30 , // Bottom point
622
- triangleX + triangleSize, centerY, // Rightmost point
621
+ triangleX + triangleSize, centerY, // Rightmost point
623
622
toValue (symbolColor)
624
623
);
625
624
@@ -642,10 +641,10 @@ void DisplayUI::drawPauseTrackIcon(int32_t x, int32_t y, int32_t width, int32_t
642
641
if (xSemaphoreTake (xSemaphoreDisplay, portMAX_DELAY))
643
642
{
644
643
// Define basic geometry
645
- const int32_t centerX = x + width / 2 ;
646
- const int32_t centerY = y + height / 2 ;
644
+ const int32_t centerX = x + width / 2 ;
645
+ const int32_t centerY = y + height / 2 ;
647
646
const int32_t lineThickness = 5 ; // Thickness of the vertical line
648
- const TFTColor symbolColor = TFTColor::White;
647
+ const TFTColor symbolColor = TFTColor::White;
649
648
650
649
// Draw vertical line '|'
651
650
_tft->fillRect (centerX - lineThickness * 2 , centerY - 15 , lineThickness, 30 , toValue (symbolColor));
@@ -670,12 +669,12 @@ void DisplayUI::drawBackIcon(int32_t x, int32_t y, int32_t width, int32_t height
670
669
if (xSemaphoreTake (xSemaphoreDisplay, portMAX_DELAY))
671
670
{
672
671
// Define basic geometry
673
- const int32_t centerX = x + width / 2 ;
674
- const int32_t centerY = y + height / 2 ;
675
- const int32_t arrowWidth = 20 ;
676
- const int32_t arrowHeight = 10 ;
672
+ const int32_t centerX = x + width / 2 ;
673
+ const int32_t centerY = y + height / 2 ;
674
+ const int32_t arrowWidth = 20 ;
675
+ const int32_t arrowHeight = 10 ;
677
676
const int32_t lineThickness = 5 ;
678
- const TFTColor symbolColor = TFTColor::SC_NetworkSuccess; // ::White;
677
+ const TFTColor symbolColor = TFTColor::SC_NetworkSuccess; // ::White;
679
678
680
679
// Draw left-facing arrow '<-'
681
680
// Draw the line part of the arrow
@@ -717,7 +716,7 @@ uint16_t DisplayUI::read16(fs::File &f)
717
716
718
717
/*
719
718
** ===================================================================
720
- ** draw32 ()
719
+ ** read32 ()
721
720
** ===================================================================
722
721
*/
723
722
uint32_t DisplayUI::read32 (fs::File &f)
@@ -904,9 +903,9 @@ void DisplayUI::drawTextToLCD(const char *text, int posY)
904
903
{
905
904
906
905
int pbWidth = _tft->width () - 100 ;
907
- int pbX = (_tft->width () - pbWidth)/2 ;
908
- int pbY = 260 ;
909
- int textY = posY;
906
+ int pbX = (_tft->width () - pbWidth)/2 ;
907
+ int pbY = 260 ;
908
+ int textY = posY;
910
909
911
910
if (xSemaphoreTake (xSemaphoreDisplay, portMAX_DELAY))
912
911
{
@@ -936,8 +935,6 @@ void DisplayUI::drawTextToLCD(const char *text, int posY, int fontSize, bool ig
936
935
{
937
936
_ofr->setFontSize (fontSize);
938
937
939
- // _tft->setTextDatum(TL_DATUM);
940
- // _ofr->setAlignment(Align::BottomLeft);
941
938
if (ignoreText)
942
939
{
943
940
_tft->fillRect (0 , posY, _tft->width (), fontSize + 10 , toValue (getBackground ()));
@@ -1080,32 +1077,16 @@ void DisplayUI::drawText(const char *text, int posX, int posY, int fontSize, TFT
1080
1077
{
1081
1078
_ofr->setFontSize (fontSize);
1082
1079
_ofr->setAlignment (Align::BottomLeft);
1083
-
1084
- // strlen(text) * 16
1085
- // _tft->fillRect(posX, posY, 100, fontSize + 10, toValue(TFTColor::Black)); // toValue(getBackground()));
1086
- // _ofr->cdrawString(text, posX, posY, toValue(getBackground()), toValue(color));
1087
-
1088
- _tft->fillRect (posX - 70 , posY, 140 , fontSize + 10 , toValue (TFTColor::Black)); // //toValue(getBackground())); // toValue(TFTColor::Black)); //
1089
- // _ofr->setFontColor(toValue(color));
1090
- // _ofr->cdrawString(text, posX, posY, rgb565(0xFF0000), rgb565(0x000000)); //, toValue(color), toValue(color));
1091
- // _ofr->cdrawString(text, posX, posY, rgb888_to_rgb565(toValue(color)), rgb888_to_rgb565(toValue(getBackground()))); //, toValue(color), toValue(color));
1092
- // _ofr->cdrawString(text, posX, posY, convertColorForILI9488(toValue(color)), convertColorForILI9488(toValue(TFTColor::Black))); //, toValue(color), toValue(color));
1080
+ _tft->fillRect (posX - 70 , posY, 140 , fontSize + 10 , toValue (TFTColor::Black));
1093
1081
_ofr->cdrawString (text, posX, posY, toRGB565 (color), toRGB565 (TFTColor::Black));
1094
1082
1095
- // _tft->fillRect(10, posY, 270, fontSize + 10, toValue(TFTColor::Black));
1096
- // _ofr->cdrawString("RED", 50, posY, rgb888_to_rgb565(0xFF0000), rgb888_to_rgb565(0x000000)); // Red on Black
1097
- // _ofr->cdrawString("GREEN", 125, posY, rgb888_to_rgb565(0x00FF00), rgb888_to_rgb565(0x000000)); // Green on Black
1098
- // _ofr->cdrawString("BLUE", 200, posY, rgb888_to_rgb565(0x0000FF), rgb888_to_rgb565(0x000000)); // Blue on Black
1099
-
1100
1083
xSemaphoreGive (xSemaphoreDisplay);
1101
1084
}
1102
1085
else
1103
1086
{
1104
1087
spLogI (LOGTAG_MULTITASK," Unable to take xSemaphoreDisplay." );
1105
1088
}
1106
1089
1107
-
1108
-
1109
1090
}
1110
1091
1111
1092
/*
@@ -1124,8 +1105,6 @@ void DisplayUI::drawString(const char *str,
1124
1105
Align alignment,
1125
1106
const char *clearMask)
1126
1107
{
1127
- // _tft->fillRect(0, _tft->height() - 10, _tft->width() , 10, toValue(TFTColor::DarkGrey));
1128
-
1129
1108
_ofr->setAlignment (alignment);
1130
1109
_ofr->setFontSize (fontSize);
1131
1110
uint16_t fgColor = toRGB565 (fg);
@@ -1201,10 +1180,6 @@ void DisplayUI::rDrawString( const char *str,
1201
1180
TFTColor bg,
1202
1181
const char *clearMask)
1203
1182
{
1204
- // _tft->fillRect(0, _tft->height() - 10, _tft->width() , 10, toValue(TFTColor::DarkGrey));
1205
-
1206
- // drawString(str, x, y, fontSize, fg, bg, Align::Right, clearMask);
1207
-
1208
1183
_ofr->setAlignment (Align::Right);
1209
1184
_ofr->setFontSize (fontSize);
1210
1185
uint16_t fgColor = toRGB565 (fg);
@@ -1348,9 +1323,9 @@ void DisplayUI::drawClockString(
1348
1323
*/
1349
1324
std::string DisplayUI::formatTime (long millis) {
1350
1325
long totalSeconds = millis / 1000 ;
1351
- int hours = totalSeconds / 3600 ;
1352
- int minutes = (totalSeconds % 3600 ) / 60 ;
1353
- int seconds = totalSeconds % 60 ;
1326
+ int hours = totalSeconds / 3600 ;
1327
+ int minutes = (totalSeconds % 3600 ) / 60 ;
1328
+ int seconds = totalSeconds % 60 ;
1354
1329
1355
1330
std::string result;
1356
1331
@@ -1681,7 +1656,10 @@ bool DisplayUI::jpgCalculateAverageColorCallback(int16_t x, int16_t y, uint16_t
1681
1656
// Calculate average color of JPEG file
1682
1657
TFTColor DisplayUI::calculateAverageColor (const char * filename)
1683
1658
{
1684
- totalR = totalG = totalB = pixelCount = 0 ;
1659
+ totalR = 0 ;
1660
+ totalG = 0 ;
1661
+ totalB = 0 ;
1662
+ pixelCount = 0 ;
1685
1663
1686
1664
spLogV (LOGTAG_PLAYER, " Entering calculateAverageColor(%s)" , filename);
1687
1665
0 commit comments