pl_text_size_009
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user