diff --git a/yoRadio/locale/displayL10n_en.h b/yoRadio/locale/displayL10n_en.h index 2e4b078..506b84f 100644 --- a/yoRadio/locale/displayL10n_en.h +++ b/yoRadio/locale/displayL10n_en.h @@ -71,7 +71,7 @@ const char apPassTxt[] PROGMEM = "PASSWORD"; const char bootstrFmt[] PROGMEM = "Trying to %s"; const char apSettFmt[] PROGMEM = "SETTINGS PAGE ON: HTTP://%s/"; #if EXT_WEATHER -const char weatherFmt[] PROGMEM = "%s, %.1f\011C \007 feels like: %.1f\011C \007 pressure: %d мм * humidity: %s%% \007 wind: %.1f m/s [%s]"; +const char weatherFmt[] PROGMEM = "%s, %.1f\011C \007 feels like: %.1f\011C \007 pressure: %d мм \007 humidity: %s%% \007 wind: %.1f m/s [%s]"; #else const char weatherFmt[] PROGMEM = "%s, %.1f\011C \007 pressure: %d mm \007 humidity: %s%%"; #endif diff --git a/yoRadio/src/core/display.cpp b/yoRadio/src/core/display.cpp index e6f1dca..bf1fcd4 100644 --- a/yoRadio/src/core/display.cpp +++ b/yoRadio/src/core/display.cpp @@ -85,7 +85,9 @@ 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}); + #if !defined(DSP_LCD) + _plcurrent.moveTo({TFT_FRAMEWDT, (uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight), (int16_t)playlistConf.width}); + #endif #ifndef HIDE_TITLE2 _title2 = new ScrollWidget("*", title2Conf, config.theme.title2, config.theme.background); #endif @@ -153,12 +155,13 @@ void Display::_buildPager(){ #if !defined(DSP_LCD) && DSP_MODEL!=DSP_NOKIA5110 pages[PG_DIALOG]->addPage(&_footer); #endif - + #if !defined(DSP_LCD) 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}); } + #endif pages[PG_PLAYLIST]->addWidget(&_plcurrent); for(const auto& p: pages) _pager.addPage(p); @@ -255,6 +258,9 @@ void Display::_swichMode(displayMode_e newmode) { _mode = newmode; dsp.setScrollId(NULL); if (newmode == PLAYER) { + #ifdef DSP_LCD + dsp.clearDsp(); + #endif numOfNextStation = 0; _returnTicker.detach(); #ifdef META_MOVE diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index aee7d36..be7c0c1 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.010" +#define YOVERSION "0.9.012" /******************************************************* DO NOT EDIT THIS FILE. diff --git a/yoRadio/src/displays/conf/displayLCD1602conf.h b/yoRadio/src/displays/conf/displayLCD1602conf.h index de4e8fc..3250ef6 100644 --- a/yoRadio/src/displays/conf/displayLCD1602conf.h +++ b/yoRadio/src/displays/conf/displayLCD1602conf.h @@ -12,7 +12,6 @@ #define TFT_FRAMEWDT 0 #define MAX_WIDTH 16 #define PLMITEMS 2 -#define PLMITEMLENGHT 40 #define HIDE_IP #define HIDE_TITLE2 diff --git a/yoRadio/src/displays/conf/displayLCD2004conf.h b/yoRadio/src/displays/conf/displayLCD2004conf.h index e08470a..3174cc6 100644 --- a/yoRadio/src/displays/conf/displayLCD2004conf.h +++ b/yoRadio/src/displays/conf/displayLCD2004conf.h @@ -12,7 +12,6 @@ #define TFT_FRAMEWDT 0 #define MAX_WIDTH 20 #define PLMITEMS 4 -#define PLMITEMLENGHT 40 #define HIDE_IP #define HIDE_VOLBAR diff --git a/yoRadio/src/displays/conf/displaySSD1306conf.h b/yoRadio/src/displays/conf/displaySSD1306conf.h index fce90e3..8a2220a 100644 --- a/yoRadio/src/displays/conf/displaySSD1306conf.h +++ b/yoRadio/src/displays/conf/displaySSD1306conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 128 #define TFT_FRAMEWDT 1 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 5 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 18 #define HIDE_HEAPBAR #define HIDE_VOL @@ -25,7 +22,7 @@ const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, 0, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 15 }; const ScrollConfig title1Conf PROGMEM = {{ 0, 17, 1, WA_LEFT }, 140, true, DSP_WIDTH-6*4, 5000, 2, 35 }; const ScrollConfig title2Conf PROGMEM = {{ 0, 26, 1, WA_LEFT }, 140, true, DSP_WIDTH, 5000, 2, 35 }; -const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 26, 2, WA_LEFT }, 140, true, MAX_WIDTH, 500, 2, 25 }; +const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 26, 1, WA_LEFT }, 140, true, MAX_WIDTH, 500, 2, 25 }; const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, 0, 2, WA_CENTER }, 140, false, MAX_WIDTH, 0, 2, 35 }; const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 64-7, 1, WA_LEFT }, 140, false, MAX_WIDTH, 0, 2, 15 }; const ScrollConfig weatherConf PROGMEM = {{ 0, 64-11, 1, WA_LEFT }, 140, true, DSP_WIDTH-6*4, 0, 2, 25 }; // ПОГОДА!! diff --git a/yoRadio/src/displays/conf/displaySSD1306x32conf.h b/yoRadio/src/displays/conf/displaySSD1306x32conf.h index c94af31..c2ae379 100644 --- a/yoRadio/src/displays/conf/displaySSD1306x32conf.h +++ b/yoRadio/src/displays/conf/displaySSD1306x32conf.h @@ -11,9 +11,6 @@ #define DSP_WIDTH 128 #define TFT_FRAMEWDT 1 #define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 -#define PLMITEMS 5 -#define PLMITEMLENGHT 40 -#define PLMITEMHEIGHT 10 #define HIDE_IP #define HIDE_TITLE2 diff --git a/yoRadio/src/displays/displayLC1602.cpp b/yoRadio/src/displays/displayLC1602.cpp index 98a3e74..ca3bd9e 100644 --- a/yoRadio/src/displays/displayLC1602.cpp +++ b/yoRadio/src/displays/displayLC1602.cpp @@ -31,8 +31,6 @@ void DspCore::apScreen() { #endif } -byte Arrow[] PROGMEM = { B00000, B00100, B00010, B01001, B00010, B00100, B00000, B00000 }; - void DspCore::initDisplay() { #ifdef LCD_I2C init(); @@ -45,30 +43,29 @@ void DspCore::initDisplay() { #endif #endif clearClipping(); - createChar(0, Arrow); + + plTtemsCount = PLMITEMS; + plCurrentPos = 1; } void DspCore::drawLogo(uint16_t top) { } +void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){ + if (pos == plCurrentPos) { + current.setText(item); + } else { + setCursor(1, pos); + char tmp[width()] = {0}; + strlcpy(tmp, utf8Rus(item, true), width()); + print(tmp); + } +} -void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) { - clear(); - for (byte i = 0; i < PLMITEMS; i++) { - plMenu[i][0] = '\0'; - } - config.fillPlMenu(plMenu, currentItem-1, PLMITEMS); - for (byte i = 0; i < PLMITEMS; i++) { - if (i == 1) { - strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1); - } else { - char tmp[width()] = {0}; - strlcpy(tmp, utf8Rus(plMenu[i], true), width()); - setCursor(1, i); - print(tmp); - } - } +void DspCore::drawPlaylist(uint16_t currentItem) { + clear(); + config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount); setCursor(0,1); - write(byte(0)); + write(byte(126)); } void DspCore::clearDsp(bool black) { diff --git a/yoRadio/src/displays/displaySSD1306.cpp b/yoRadio/src/displays/displaySSD1306.cpp index f0f6ed0..23b436c 100644 --- a/yoRadio/src/displays/displaySSD1306.cpp +++ b/yoRadio/src/displays/displaySSD1306.cpp @@ -50,6 +50,12 @@ void DspCore::initDisplay() { flip(); invert(); 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) { @@ -65,22 +71,23 @@ void DspCore::drawLogo(uint16_t top) { display(); } -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 - 2, PLMITEMS); - setTextSize((DSP_MODEL==DSP_SSD1306)?2: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 == 2) { - 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(lastPos