From 617bbba5899de984341797ac5bdcf78bd1fbe4b4 Mon Sep 17 00:00:00 2001 From: e2002 Date: Tue, 7 Mar 2023 11:39:55 +0300 Subject: [PATCH] pl_text_size_009 --- yoRadio/src/core/config.cpp | 47 ++++++++++--------- yoRadio/src/core/config.h | 4 +- yoRadio/src/core/display.cpp | 27 +++++------ yoRadio/src/core/display.h | 2 + yoRadio/src/core/options.h | 2 +- .../src/displays/conf/displayILI9341conf.h | 3 -- yoRadio/src/displays/conf/displayN5110conf.h | 3 -- .../src/displays/conf/displayST7735_144conf.h | 5 +- .../displays/conf/displayST7735_blackconf.h | 13 ++--- .../displays/conf/displayST7735_miniconf.h | 5 +- yoRadio/src/displays/conf/displayST7789conf.h | 6 +-- yoRadio/src/displays/displayILI9341.cpp | 38 ++++++++------- yoRadio/src/displays/displayN5110.cpp | 37 +++++++++------ yoRadio/src/displays/displayST7735.cpp | 39 ++++++++------- yoRadio/src/displays/displayST7789.cpp | 37 +++++++++------ yoRadio/src/displays/tools/commongfx.h | 9 ++-- yoRadio/src/displays/widgets/widgets.cpp | 4 ++ yoRadio/src/displays/widgets/widgets.h | 1 + 18 files changed, 153 insertions(+), 129 deletions(-) diff --git a/yoRadio/src/core/config.cpp b/yoRadio/src/core/config.cpp index b650d44..350654b 100644 --- a/yoRadio/src/core/config.cpp +++ b/yoRadio/src/core/config.cpp @@ -423,20 +423,33 @@ void Config::loadStation(uint16_t ls) { playlist.close(); } -void Config::fillPlMenu(char plmenu[][40], int from, byte count, bool removeNum) { - int ls = from; - byte c = 0; - bool finded = false; - char sName[BUFLEN], sUrl[BUFLEN]; - int sOvol; +char * Config::stationByNum(uint16_t num){ + File playlist = SPIFFS.open(REAL_PLAYL, "r"); + File index = SPIFFS.open(REAL_INDEX, "r"); + index.seek((num - 1) * 4, SeekSet); + uint32_t pos; + memset(_stationBuf, 0, BUFLEN/2); + index.readBytes((char *) &pos, 4); + index.close(); + playlist.seek(pos, SeekSet); + strncpy(_stationBuf, playlist.readStringUntil('\t').c_str(), BUFLEN/2); + playlist.close(); + return _stationBuf; +} + +uint8_t Config::fillPlMenu(int from, uint8_t count) { + int ls = from; + uint8_t c = 0; + bool finded = false; if (store.countStation == 0) { - return; + return 0; } File playlist = SPIFFS.open(REAL_PLAYL, "r"); File index = SPIFFS.open(REAL_INDEX, "r"); while (true) { if (ls < 1) { ls++; + display.printPLitem(c, ""); c++; continue; } @@ -449,24 +462,16 @@ void Config::fillPlMenu(char plmenu[][40], int from, byte count, bool removeNum) playlist.seek(pos, SeekSet); } while (playlist.available()) { - if (parseCSV(playlist.readStringUntil('\n').c_str(), sName, sUrl, sOvol)) { - if(config.store.numplaylist){ - if(removeNum){ - strlcpy(plmenu[c], sName, 39); - }else{ - char buf[BUFLEN+10]; - sprintf(buf, "%d %s", (int)(from+c), sName); - strlcpy(plmenu[c], buf, 39); - } - }else{ - strlcpy(plmenu[c], sName, 39); - } - c++; - } + 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()); + c++; if (c >= count) break; } break; } + return c; playlist.close(); } diff --git a/yoRadio/src/core/config.h b/yoRadio/src/core/config.h index 79c526e..bd4a301 100644 --- a/yoRadio/src/core/config.h +++ b/yoRadio/src/core/config.h @@ -186,7 +186,8 @@ class Config { void setSmartStart(byte ss); void initPlaylist(); void indexPlaylist(); - void fillPlMenu(char plmenu[][40], int from, byte count, bool removeNum = false); + uint8_t fillPlMenu(int from, uint8_t count); + char * stationByNum(uint16_t num); void setTimezone(int8_t tzh, int8_t tzm); void setTimezoneOffset(uint16_t tzo); uint16_t getTimezoneOffset(); @@ -209,6 +210,7 @@ class Config { bool checkNoMedia(const char* path); void _initHW(); bool _isFSempty(); + char _stationBuf[BUFLEN/2]; }; extern Config config; diff --git a/yoRadio/src/core/display.cpp b/yoRadio/src/core/display.cpp index 19ea600..e6f1dca 100644 --- a/yoRadio/src/core/display.cpp +++ b/yoRadio/src/core/display.cpp @@ -85,6 +85,7 @@ void Display::_buildPager(){ #else _plcurrent.init("*", playlistConf, config.theme.plcurrent, config.theme.plcurrentbg); #endif + _plcurrent.moveTo({TFT_FRAMEWDT, (uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight), (int16_t)playlistConf.width}); #ifndef HIDE_TITLE2 _title2 = new ScrollWidget("*", title2Conf, config.theme.title2, config.theme.background); #endif @@ -153,7 +154,11 @@ void Display::_buildPager(){ pages[PG_DIALOG]->addPage(&_footer); #endif - if(_plbackground) pages[PG_PLAYLIST]->addWidget( _plbackground); + if(_plbackground) { + pages[PG_PLAYLIST]->addWidget( _plbackground); + _plbackground->setHeight(dsp.plItemHeight); + _plbackground->moveTo({0,(uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight-playlistConf.widget.textsize*2), (int16_t)playlBGConf.width}); + } pages[PG_PLAYLIST]->addWidget(&_plcurrent); for(const auto& p: pages) _pager.addPage(p); @@ -286,26 +291,18 @@ void Display::resetQueue(){ } void Display::_drawPlaylist() { - char buf[PLMITEMLENGHT]; - dsp.drawPlaylist(currentPlItem, buf); - _plcurrent.setText(buf); -/*#ifdef USE_NEXTION - nextion.drawPlaylist(currentPlItem); -#endif*/ + dsp.drawPlaylist(currentPlItem); _setReturnTicker(30); } void Display::_drawNextStationNum(uint16_t num) { - char plMenu[1][40]; - char currentItemText[40] = {0}; - config.fillPlMenu(plMenu, num, 1, true); - strlcpy(currentItemText, plMenu[0], 39); _setReturnTicker(30); - _meta.setText(currentItemText); + _meta.setText(config.stationByNum(num)); _nums.setText(num, "%d"); -/*#ifdef USE_NEXTION - nextion.drawNextStationNum(num); -#endif*/ +} + +void Display::printPLitem(uint8_t pos, const char* item){ + dsp.printPLitem(pos, item, _plcurrent); } void Display::putRequest(displayRequestType_e type, int payload){ diff --git a/yoRadio/src/core/display.h b/yoRadio/src/core/display.h index 914ac9f..9afb8fb 100644 --- a/yoRadio/src/core/display.h +++ b/yoRadio/src/core/display.h @@ -47,6 +47,7 @@ class Display { bool deepsleep(); void wakeup(); void setContrast(); + void printPLitem(uint8_t pos, const char* item); private: ScrollWidget _meta, _title1, _plcurrent; ScrollWidget *_weather; @@ -105,6 +106,7 @@ class Display { void setContrast(){} bool deepsleep(){return true;} void wakeup(){} + void printPLitem(uint8_t pos, const char* item){} }; #endif diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index de8f8f6..875e12b 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.001" +#define YOVERSION "0.9.009" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/displays/conf/displayILI9341conf.h b/yoRadio/src/displays/conf/displayILI9341conf.h index 061f22b..efdcae1 100644 --- a/yoRadio/src/displays/conf/displayILI9341conf.h +++ b/yoRadio/src/displays/conf/displayILI9341conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 320 #define TFT_FRAMEWDT 8 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 11 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 22 #define bootLogoTop 68 diff --git a/yoRadio/src/displays/conf/displayN5110conf.h b/yoRadio/src/displays/conf/displayN5110conf.h index 4175d90..d36b475 100644 --- a/yoRadio/src/displays/conf/displayN5110conf.h +++ b/yoRadio/src/displays/conf/displayN5110conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 84 #define TFT_FRAMEWDT 0 #define MAX_WIDTH DSP_WIDTH -#define PLMITEMS 7 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 10 #define SCROLLDELAY 180 #define HIDE_TITLE2 diff --git a/yoRadio/src/displays/conf/displayST7735_144conf.h b/yoRadio/src/displays/conf/displayST7735_144conf.h index 70a6b6e..2f42c70 100644 --- a/yoRadio/src/displays/conf/displayST7735_144conf.h +++ b/yoRadio/src/displays/conf/displayST7735_144conf.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 bootLogoTop 68 @@ -21,7 +18,7 @@ const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 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_blackconf.h b/yoRadio/src/displays/conf/displayST7735_blackconf.h index d613fc5..a7c2bf1 100644 --- a/yoRadio/src/displays/conf/displayST7735_blackconf.h +++ b/yoRadio/src/displays/conf/displayST7735_blackconf.h @@ -10,9 +10,6 @@ #define DSP_WIDTH 160 #define TFT_FRAMEWDT 4 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 7 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 21 #define bootLogoTop 68 @@ -20,7 +17,7 @@ const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 30 }; const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 26, 1, WA_LEFT }, 140, true, MAX_WIDTH-24, 5000, 3, 30 }; const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 36, 1, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 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, 3, 30 }; const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 42, 1, WA_LEFT }, 140, true, MAX_WIDTH, 0, 3, 30 }; @@ -36,8 +33,8 @@ const FillConfig heapbarConf PROGMEM = {{ 0, 127, 0, WA_LEFT }, DSP_WIDTH, const WidgetConfig bootstrConf PROGMEM = { 0, 110, 1, WA_CENTER }; const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 26, 1, WA_RIGHT }; //const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 99, 1, WA_LEFT }; -const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT }; -const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT }; +const WidgetConfig voltxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT }; +const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_CENTER }; const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_RIGHT }; const WidgetConfig numConf PROGMEM = { 0, 86, 35, WA_CENTER }; const WidgetConfig apNameConf PROGMEM = { 0, 40, 1, WA_CENTER }; @@ -57,8 +54,8 @@ const BitrateConfig fullbitrateConf PROGMEM = {{DSP_WIDTH-TFT_FRAMEWDT-19, 23, 1 /* STRINGS */ const char numtxtFmt[] PROGMEM = "%d"; const char rssiFmt[] PROGMEM = "%d"; -const char iptxtFmt[] PROGMEM = "%s"; -const char voltxtFmt[] PROGMEM = "%d"; +const char iptxtFmt[] PROGMEM = " %s"; +const char voltxtFmt[] PROGMEM = "\023\025%d"; const char bitrateFmt[] PROGMEM = "%d"; /* MOVES */ /* { left, top, width (0 - auto, -1 - lock } */ const MoveConfig clockMove PROGMEM = { 16, 94, 0}; diff --git a/yoRadio/src/displays/conf/displayST7735_miniconf.h b/yoRadio/src/displays/conf/displayST7735_miniconf.h index 7d7b7cf..73cca54 100644 --- a/yoRadio/src/displays/conf/displayST7735_miniconf.h +++ b/yoRadio/src/displays/conf/displayST7735_miniconf.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,7 +22,7 @@ const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 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 }; // ПОГОДА!! diff --git a/yoRadio/src/displays/conf/displayST7789conf.h b/yoRadio/src/displays/conf/displayST7789conf.h index 6facf47..cf3c020 100644 --- a/yoRadio/src/displays/conf/displayST7789conf.h +++ b/yoRadio/src/displays/conf/displayST7789conf.h @@ -11,9 +11,9 @@ #define DSP_WIDTH 320 #define TFT_FRAMEWDT 8 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 11 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 22 +//#define PLMITEMS 11 +//#define PLMITEMLENGHT 40 +//#define PLMITEMHEIGHT 22 #define bootLogoTop 68 diff --git a/yoRadio/src/displays/displayILI9341.cpp b/yoRadio/src/displays/displayILI9341.cpp index 71ded06..740acd4 100644 --- a/yoRadio/src/displays/displayILI9341.cpp +++ b/yoRadio/src/displays/displayILI9341.cpp @@ -24,29 +24,35 @@ void DspCore::initDisplay() { cp437(true); 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() - 99) / 2, top, bootlogo2, 99, 64); } -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 - 5, PLMITEMS); - setTextSize(2); - int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3; - //fillRect(0, (height() / 2 - PLMITEMHEIGHT / 2) - 1, width(), PLMITEMHEIGHT + 2, config.theme.meta); - 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-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 - 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(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, DSP_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(lastPos