From ebd6acd3fe3f0f614e6ea216d42c1bf1c5d3deb9 Mon Sep 17 00:00:00 2001 From: e2002 Date: Wed, 8 Mar 2023 19:26:25 +0300 Subject: [PATCH] pl_text_size_017 --- yoRadio/src/ILI9488/ILI9486_SPI.cpp | 2 +- yoRadio/src/core/config.cpp | 12 +++-- yoRadio/src/core/config.h | 2 +- yoRadio/src/core/display.cpp | 3 +- yoRadio/src/core/options.h | 2 +- yoRadio/src/displays/conf/displayGC9106conf.h | 11 ++-- .../src/displays/conf/displayGC9A01Aconf.h | 5 +- .../src/displays/conf/displayILI9488conf.h | 3 -- yoRadio/src/displays/conf/displaySH1106conf.h | 3 -- .../src/displays/conf/displaySSD1305conf.h | 3 -- .../src/displays/conf/displaySSD1327conf.h | 5 +- .../displays/conf/displayST7735_miniconf.h | 6 +-- yoRadio/src/displays/conf/displayST7796conf.h | 3 -- yoRadio/src/displays/displayGC9106.cpp | 39 ++++++++------ yoRadio/src/displays/displayGC9A01A.cpp | 36 +++++++------ yoRadio/src/displays/displayILI9488.cpp | 36 +++++++------ yoRadio/src/displays/displaySH1106.cpp | 37 +++++++------ yoRadio/src/displays/displaySSD1305.cpp | 37 +++++++------ yoRadio/src/displays/displaySSD1327.cpp | 39 ++++++++------ yoRadio/src/displays/displayST7796.cpp | 36 +++++++------ yoRadio/src/displays/nextion.cpp | 52 ++++++++++--------- yoRadio/src/displays/nextion.h | 1 + 22 files changed, 203 insertions(+), 170 deletions(-) diff --git a/yoRadio/src/ILI9488/ILI9486_SPI.cpp b/yoRadio/src/ILI9488/ILI9486_SPI.cpp index 74d9584..77464ab 100644 --- a/yoRadio/src/ILI9488/ILI9486_SPI.cpp +++ b/yoRadio/src/ILI9488/ILI9486_SPI.cpp @@ -335,7 +335,7 @@ void ILI9486_SPI::init(void) _writeCommand(0x36); _writeData(0x48); // MX, BGR == rotation 0 // PGAMCTRL(Positive Gamma Control) -#if DSP_MODEL==DSP_ILI9486 +#if DSP_MODEL==DSP_ILI9486 && false _writeCommand(0xE0); _writeData(0x0F); _writeData(0x1F); diff --git a/yoRadio/src/core/config.cpp b/yoRadio/src/core/config.cpp index 350654b..5bcaf31 100644 --- a/yoRadio/src/core/config.cpp +++ b/yoRadio/src/core/config.cpp @@ -437,7 +437,7 @@ char * Config::stationByNum(uint16_t num){ return _stationBuf; } -uint8_t Config::fillPlMenu(int from, uint8_t count) { +uint8_t Config::fillPlMenu(int from, uint8_t count, bool fromNextion) { int ls = from; uint8_t c = 0; bool finded = false; @@ -449,7 +449,10 @@ uint8_t Config::fillPlMenu(int from, uint8_t count) { while (true) { if (ls < 1) { ls++; - display.printPLitem(c, ""); + if(!fromNextion) display.printPLitem(c, ""); + #ifdef USE_NEXTION + if(fromNextion) nextion.printPLitem(c, ""); + #endif c++; continue; } @@ -465,7 +468,10 @@ uint8_t Config::fillPlMenu(int from, uint8_t count) { String stationName = playlist.readStringUntil('\n'); stationName = stationName.substring(0, stationName.indexOf('\t')); if(config.store.numplaylist) stationName = String(from+c)+" "+stationName; - display.printPLitem(c, stationName.c_str()); + if(!fromNextion) display.printPLitem(c, stationName.c_str()); + #ifdef USE_NEXTION + if(fromNextion) nextion.printPLitem(c, stationName.c_str()); + #endif c++; if (c >= count) break; } diff --git a/yoRadio/src/core/config.h b/yoRadio/src/core/config.h index bd4a301..bf272c9 100644 --- a/yoRadio/src/core/config.h +++ b/yoRadio/src/core/config.h @@ -186,7 +186,7 @@ class Config { void setSmartStart(byte ss); void initPlaylist(); void indexPlaylist(); - uint8_t fillPlMenu(int from, uint8_t count); + uint8_t fillPlMenu(int from, uint8_t count, bool fromNextion=false); char * stationByNum(uint16_t num); void setTimezone(int8_t tzh, int8_t tzm); void setTimezoneOffset(uint16_t tzo); diff --git a/yoRadio/src/core/display.cpp b/yoRadio/src/core/display.cpp index bf1fcd4..4b8f1bd 100644 --- a/yoRadio/src/core/display.cpp +++ b/yoRadio/src/core/display.cpp @@ -211,7 +211,7 @@ void Display::_start() { return; } #ifdef USE_NEXTION - nextion.putcmd("page player"); + //nextion.putcmd("page player"); nextion.start(); #endif _buildPager(); @@ -539,6 +539,7 @@ void Display::init(){ } void Display::_start(){ #ifdef USE_NEXTION + //nextion.putcmd("page player"); nextion.start(); #endif } diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index be7c0c1..b3472ac 100644 --- a/yoRadio/src/core/options.h +++ b/yoRadio/src/core/options.h @@ -1,7 +1,7 @@ #ifndef options_h #define options_h -#define YOVERSION "0.9.012" +#define YOVERSION "0.9.017" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/displays/conf/displayGC9106conf.h b/yoRadio/src/displays/conf/displayGC9106conf.h index 9dd5485..2295069 100644 --- a/yoRadio/src/displays/conf/displayGC9106conf.h +++ b/yoRadio/src/displays/conf/displayGC9106conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 160 #define TFT_FRAMEWDT 1 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 7 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 19 #define HIDE_IP #define HIDE_TITLE2 @@ -25,10 +22,10 @@ const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 4, 30 }; const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 19, 1, WA_LEFT }, 140, true, MAX_WIDTH-6*3-4, 5000, 3, 30 }; //const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 36, 1, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 2, 30 }; -const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 33, 2, WA_LEFT }, 140, true, MAX_WIDTH, 0, 3, 30 }; +const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 33, 1, WA_LEFT }, 140, true, MAX_WIDTH, 0, 3, 30 }; const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_CENTER }, 140, false, MAX_WIDTH, 0, 3, 30 }; const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 80-TFT_FRAMEWDT-8, 1, WA_LEFT }, 140, false, MAX_WIDTH, 0, 3, 30 }; -const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 80-13, 1, WA_LEFT }, 140, true, MAX_WIDTH-6*3-4, 0, 3, 30 }; // ПОГОДА!! +const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 80-13, 1, WA_LEFT }, 140, true, MAX_WIDTH-6*3, 0, 3, 30 }; // ПОГОДА!! /* BACKGROUNGC9106DS */ /* {{ left, top, fontsize, align }, width, height, outlined } */ const FillConfig metaBGConf PROGMEM = {{ 0, 0, 0, WA_LEFT }, DSP_WIDTH, 16, false }; @@ -66,7 +63,7 @@ const char bitrateFmt[] PROGMEM = "%d"; /* MOVES */ /* { left, top, width } */ const MoveConfig clockMove PROGMEM = { 14, 29+34, 0}; -const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 80-13, MAX_WIDTH-6*3-4-30 }; -const MoveConfig weatherMoveVU PROGMEM = { 30, 80-13, MAX_WIDTH-6*3-4-30 }; +const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 80-13, MAX_WIDTH-6*3-30 }; +const MoveConfig weatherMoveVU PROGMEM = { 30, 80-13, MAX_WIDTH-6*3-30 }; #endif diff --git a/yoRadio/src/displays/conf/displayGC9A01Aconf.h b/yoRadio/src/displays/conf/displayGC9A01Aconf.h index 54b87c8..41d2d9a 100644 --- a/yoRadio/src/displays/conf/displayGC9A01Aconf.h +++ b/yoRadio/src/displays/conf/displayGC9A01Aconf.h @@ -11,10 +11,7 @@ #define DSP_WIDTH 240 #define TFT_FRAMEWDT 8 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 11 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 22 - +#define RSSI_DIGIT true #define bootLogoTop 68 #define HIDE_TITLE2 #define BOOMBOX_STYLE diff --git a/yoRadio/src/displays/conf/displayILI9488conf.h b/yoRadio/src/displays/conf/displayILI9488conf.h index 0cdd094..2742a03 100644 --- a/yoRadio/src/displays/conf/displayILI9488conf.h +++ b/yoRadio/src/displays/conf/displayILI9488conf.h @@ -12,9 +12,6 @@ #define DSP_HEIGHT 320 #define TFT_FRAMEWDT 10 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 11 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 32 #define bootLogoTop 110 diff --git a/yoRadio/src/displays/conf/displaySH1106conf.h b/yoRadio/src/displays/conf/displaySH1106conf.h index 472ece5..760682e 100644 --- a/yoRadio/src/displays/conf/displaySH1106conf.h +++ b/yoRadio/src/displays/conf/displaySH1106conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 128 #define TFT_FRAMEWDT 1 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 7 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 10 #define HIDE_HEAPBAR #define HIDE_VOL diff --git a/yoRadio/src/displays/conf/displaySSD1305conf.h b/yoRadio/src/displays/conf/displaySSD1305conf.h index 93b1c2e..16d625d 100644 --- a/yoRadio/src/displays/conf/displaySSD1305conf.h +++ b/yoRadio/src/displays/conf/displaySSD1305conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 128 #define TFT_FRAMEWDT 1 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 7 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 10 #define HIDE_HEAPBAR #define HIDE_VOL diff --git a/yoRadio/src/displays/conf/displaySSD1327conf.h b/yoRadio/src/displays/conf/displaySSD1327conf.h index 32d8243..f34bbd3 100644 --- a/yoRadio/src/displays/conf/displaySSD1327conf.h +++ b/yoRadio/src/displays/conf/displaySSD1327conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 128 #define TFT_FRAMEWDT 4 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 7 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 21 #define HIDE_HEAPBAR #define HIDE_VU @@ -24,7 +21,7 @@ const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 4, 30 }; const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 26, 1, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 2, 30 }; const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 36, 1, WA_LEFT }, 140, true, MAX_WIDTH-6*3-4, 5000, 2, 30 }; -const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 56, 2, WA_LEFT }, 140, true, MAX_WIDTH, 1000, 4, 30 }; +const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 56, 1, WA_LEFT }, 140, true, MAX_WIDTH, 1000, 4, 30 }; const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_CENTER }, 140, false, MAX_WIDTH, 0, 4, 30 }; const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 128-TFT_FRAMEWDT-8, 1, WA_LEFT }, 140, false, MAX_WIDTH, 0, 2, 30 }; const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 42, 1, WA_LEFT }, 140, true, MAX_WIDTH, 0, 3, 30 }; diff --git a/yoRadio/src/displays/conf/displayST7735_miniconf.h b/yoRadio/src/displays/conf/displayST7735_miniconf.h index 73cca54..159ca38 100644 --- a/yoRadio/src/displays/conf/displayST7735_miniconf.h +++ b/yoRadio/src/displays/conf/displayST7735_miniconf.h @@ -25,7 +25,7 @@ const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 19, 1, WA_LEFT }, 1 const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 33, 1, WA_LEFT }, 140, true, MAX_WIDTH, 0, 3, 30 }; const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_CENTER }, 140, false, MAX_WIDTH, 0, 3, 30 }; const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 80-TFT_FRAMEWDT-8, 1, WA_LEFT }, 140, false, MAX_WIDTH, 0, 3, 30 }; -const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 80-13, 1, WA_LEFT }, 140, true, MAX_WIDTH-6*3-4, 0, 3, 30 }; // ПОГОДА!! +const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 80-13, 1, WA_LEFT }, 140, true, MAX_WIDTH-6*3, 0, 3, 30 }; // ПОГОДА!! /* BACKGROUNGC9106DS */ /* {{ left, top, fontsize, align }, width, height, outlined } */ const FillConfig metaBGConf PROGMEM = {{ 0, 0, 0, WA_LEFT }, DSP_WIDTH, 16, false }; @@ -63,7 +63,7 @@ const char bitrateFmt[] PROGMEM = "%d"; /* MOVES */ /* { left, top, width } */ const MoveConfig clockMove PROGMEM = { 14, 29+34, 0}; -const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 80-13, MAX_WIDTH-6*3-4-30 }; -const MoveConfig weatherMoveVU PROGMEM = { 30, 80-13, MAX_WIDTH-6*3-4-30 }; +const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 80-13, MAX_WIDTH-6*3-30 }; +const MoveConfig weatherMoveVU PROGMEM = { 30, 80-13, MAX_WIDTH-6*3-30 }; #endif diff --git a/yoRadio/src/displays/conf/displayST7796conf.h b/yoRadio/src/displays/conf/displayST7796conf.h index a8b7ec8..64b324e 100644 --- a/yoRadio/src/displays/conf/displayST7796conf.h +++ b/yoRadio/src/displays/conf/displayST7796conf.h @@ -12,9 +12,6 @@ #define DSP_HEIGHT 320 #define TFT_FRAMEWDT 10 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 11 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 32 #define bootLogoTop 110 diff --git a/yoRadio/src/displays/displayGC9106.cpp b/yoRadio/src/displays/displayGC9106.cpp index e8d26d4..cd08859 100644 --- a/yoRadio/src/displays/displayGC9106.cpp +++ b/yoRadio/src/displays/displayGC9106.cpp @@ -28,30 +28,35 @@ void DspCore::initDisplay() { invert(); flip(); setTextWrap(false); + + plItemHeight = playlistConf.widget.textsize*(CHARHEIGHT-1)+playlistConf.widget.textsize*4; + plTtemsCount = round((float)height()/plItemHeight); + if(plTtemsCount%2==0) plTtemsCount++; + plCurrentPos = plTtemsCount/2; + plYStart = (height() / 2 - plItemHeight / 2) - plItemHeight * (plTtemsCount - 1) / 2 + playlistConf.widget.textsize*2; } void DspCore::drawLogo(uint16_t top) { drawRGBBitmap((width() - 62) / 2, 5, bootlogo40, 62, 40); } -void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) { - for (byte i = 0; i < PLMITEMS; i++) { - plMenu[i][0] = '\0'; +void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){ + setTextSize(playlistConf.widget.textsize); + if (pos == plCurrentPos) { + current.setText(item); + } else { + uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 3, PLMITEMS); - setTextSize(2); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; - for (byte i = 0; i < PLMITEMS; i++) { - if (abs(i - 3) == 3) setTextColor(config.theme.playlist[2], config.theme.background); - if (abs(i - 3) == 2) setTextColor(config.theme.playlist[1], config.theme.background); - if (abs(i - 3) == 1) setTextColor(config.theme.playlist[0], config.theme.background); - if (i == 3) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT - 1, width(), PLMITEMHEIGHT - 4, config.theme.background); - print(utf8Rus(plMenu[i], true)); - } +} + +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 5, PLMITEMS); - setTextSize(2); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; +} - for (byte i = 0; i < PLMITEMS; i++) { - if (i == 5) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setTextColor(config.theme.playlist[abs(i - 5)-1], config.theme.background); - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT - 1, width(), PLMITEMHEIGHT - 2, config.theme.background); - print(utf8Rus(plMenu[i], true)); - } +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 5, PLMITEMS); - setTextSize(3); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; +} - for (byte i = 0; i < PLMITEMS; i++) { - if (i == 5) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setTextColor(config.theme.playlist[abs(i - 5)-1], config.theme.background); - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT - 1, width(), PLMITEMHEIGHT - 6, config.theme.background); - print(utf8Rus(plMenu[i], true)); - } +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 3, PLMITEMS); - setTextSize(1); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; - setTextColor(TFT_FG, TFT_BG); - for (byte i = 0; i < PLMITEMS; i++) { - if (i == 3) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT, width(), PLMITEMHEIGHT - 1, TFT_BG); - print(utf8Rus(plMenu[i], true)); - } +} + +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 3, PLMITEMS); - setTextSize(1); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; - setTextColor(TFT_FG, TFT_BG); - for (byte i = 0; i < PLMITEMS; i++) { - if (i == 3) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT, width(), PLMITEMHEIGHT - 1, TFT_BG); - print(utf8Rus(plMenu[i], true)); - } +} + +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 3, PLMITEMS); - setTextSize(2); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; - for (byte i = 0; i < PLMITEMS; i++) { - if (abs(i - 3) == 3) setTextColor(CLR_ITEM3, TFT_BG); - if (abs(i - 3) == 2) setTextColor(CLR_ITEM2, TFT_BG); - if (abs(i - 3) == 1) setTextColor(CLR_ITEM1, TFT_BG); - if (i == 3) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT - 1, width(), PLMITEMHEIGHT - 4, TFT_BG); - print(utf8Rus(plMenu[i], true)); - } +} + +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos4?4:abs(pos - plCurrentPos)-1; + setTextColor(config.theme.playlist[plColor], config.theme.background); + setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight); + fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background); + print(utf8Rus(item, true)); } - config.fillPlMenu(plMenu, currentItem - 5, PLMITEMS); - setTextSize(3); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; +} - for (byte i = 0; i < PLMITEMS; i++) { - if (i == 5) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - setTextColor(config.theme.playlist[abs(i - 5)-1], config.theme.background); - setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); - fillRect(0, yStart + i * PLMITEMHEIGHT - 1, width(), PLMITEMHEIGHT - 6, config.theme.background); - print(utf8Rus(plMenu[i], true)); - } +void DspCore::drawPlaylist(uint16_t currentItem) { + uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); + if(lastPos