pl_text_size_009
This commit is contained in:
@@ -423,20 +423,33 @@ void Config::loadStation(uint16_t ls) {
|
|||||||
playlist.close();
|
playlist.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::fillPlMenu(char plmenu[][40], int from, byte count, bool removeNum) {
|
char * Config::stationByNum(uint16_t num){
|
||||||
int ls = from;
|
File playlist = SPIFFS.open(REAL_PLAYL, "r");
|
||||||
byte c = 0;
|
File index = SPIFFS.open(REAL_INDEX, "r");
|
||||||
bool finded = false;
|
index.seek((num - 1) * 4, SeekSet);
|
||||||
char sName[BUFLEN], sUrl[BUFLEN];
|
uint32_t pos;
|
||||||
int sOvol;
|
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) {
|
if (store.countStation == 0) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
File playlist = SPIFFS.open(REAL_PLAYL, "r");
|
File playlist = SPIFFS.open(REAL_PLAYL, "r");
|
||||||
File index = SPIFFS.open(REAL_INDEX, "r");
|
File index = SPIFFS.open(REAL_INDEX, "r");
|
||||||
while (true) {
|
while (true) {
|
||||||
if (ls < 1) {
|
if (ls < 1) {
|
||||||
ls++;
|
ls++;
|
||||||
|
display.printPLitem(c, "");
|
||||||
c++;
|
c++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -449,24 +462,16 @@ void Config::fillPlMenu(char plmenu[][40], int from, byte count, bool removeNum)
|
|||||||
playlist.seek(pos, SeekSet);
|
playlist.seek(pos, SeekSet);
|
||||||
}
|
}
|
||||||
while (playlist.available()) {
|
while (playlist.available()) {
|
||||||
if (parseCSV(playlist.readStringUntil('\n').c_str(), sName, sUrl, sOvol)) {
|
String stationName = playlist.readStringUntil('\n');
|
||||||
if(config.store.numplaylist){
|
stationName = stationName.substring(0, stationName.indexOf('\t'));
|
||||||
if(removeNum){
|
if(config.store.numplaylist) stationName = String(from+c)+" "+stationName;
|
||||||
strlcpy(plmenu[c], sName, 39);
|
display.printPLitem(c, stationName.c_str());
|
||||||
}else{
|
c++;
|
||||||
char buf[BUFLEN+10];
|
|
||||||
sprintf(buf, "%d %s", (int)(from+c), sName);
|
|
||||||
strlcpy(plmenu[c], buf, 39);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
strlcpy(plmenu[c], sName, 39);
|
|
||||||
}
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
if (c >= count) break;
|
if (c >= count) break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return c;
|
||||||
playlist.close();
|
playlist.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ class Config {
|
|||||||
void setSmartStart(byte ss);
|
void setSmartStart(byte ss);
|
||||||
void initPlaylist();
|
void initPlaylist();
|
||||||
void indexPlaylist();
|
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 setTimezone(int8_t tzh, int8_t tzm);
|
||||||
void setTimezoneOffset(uint16_t tzo);
|
void setTimezoneOffset(uint16_t tzo);
|
||||||
uint16_t getTimezoneOffset();
|
uint16_t getTimezoneOffset();
|
||||||
@@ -209,6 +210,7 @@ class Config {
|
|||||||
bool checkNoMedia(const char* path);
|
bool checkNoMedia(const char* path);
|
||||||
void _initHW();
|
void _initHW();
|
||||||
bool _isFSempty();
|
bool _isFSempty();
|
||||||
|
char _stationBuf[BUFLEN/2];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Config config;
|
extern Config config;
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ void Display::_buildPager(){
|
|||||||
#else
|
#else
|
||||||
_plcurrent.init("*", playlistConf, config.theme.plcurrent, config.theme.plcurrentbg);
|
_plcurrent.init("*", playlistConf, config.theme.plcurrent, config.theme.plcurrentbg);
|
||||||
#endif
|
#endif
|
||||||
|
_plcurrent.moveTo({TFT_FRAMEWDT, (uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight), (int16_t)playlistConf.width});
|
||||||
#ifndef HIDE_TITLE2
|
#ifndef HIDE_TITLE2
|
||||||
_title2 = new ScrollWidget("*", title2Conf, config.theme.title2, config.theme.background);
|
_title2 = new ScrollWidget("*", title2Conf, config.theme.title2, config.theme.background);
|
||||||
#endif
|
#endif
|
||||||
@@ -153,7 +154,11 @@ void Display::_buildPager(){
|
|||||||
pages[PG_DIALOG]->addPage(&_footer);
|
pages[PG_DIALOG]->addPage(&_footer);
|
||||||
#endif
|
#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);
|
pages[PG_PLAYLIST]->addWidget(&_plcurrent);
|
||||||
|
|
||||||
for(const auto& p: pages) _pager.addPage(p);
|
for(const auto& p: pages) _pager.addPage(p);
|
||||||
@@ -286,26 +291,18 @@ void Display::resetQueue(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Display::_drawPlaylist() {
|
void Display::_drawPlaylist() {
|
||||||
char buf[PLMITEMLENGHT];
|
dsp.drawPlaylist(currentPlItem);
|
||||||
dsp.drawPlaylist(currentPlItem, buf);
|
|
||||||
_plcurrent.setText(buf);
|
|
||||||
/*#ifdef USE_NEXTION
|
|
||||||
nextion.drawPlaylist(currentPlItem);
|
|
||||||
#endif*/
|
|
||||||
_setReturnTicker(30);
|
_setReturnTicker(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::_drawNextStationNum(uint16_t num) {
|
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);
|
_setReturnTicker(30);
|
||||||
_meta.setText(currentItemText);
|
_meta.setText(config.stationByNum(num));
|
||||||
_nums.setText(num, "%d");
|
_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){
|
void Display::putRequest(displayRequestType_e type, int payload){
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Display {
|
|||||||
bool deepsleep();
|
bool deepsleep();
|
||||||
void wakeup();
|
void wakeup();
|
||||||
void setContrast();
|
void setContrast();
|
||||||
|
void printPLitem(uint8_t pos, const char* item);
|
||||||
private:
|
private:
|
||||||
ScrollWidget _meta, _title1, _plcurrent;
|
ScrollWidget _meta, _title1, _plcurrent;
|
||||||
ScrollWidget *_weather;
|
ScrollWidget *_weather;
|
||||||
@@ -105,6 +106,7 @@ class Display {
|
|||||||
void setContrast(){}
|
void setContrast(){}
|
||||||
bool deepsleep(){return true;}
|
bool deepsleep(){return true;}
|
||||||
void wakeup(){}
|
void wakeup(){}
|
||||||
|
void printPLitem(uint8_t pos, const char* item){}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define YOVERSION "0.9.001"
|
#define YOVERSION "0.9.009"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
#define DSP_WIDTH 320
|
#define DSP_WIDTH 320
|
||||||
#define TFT_FRAMEWDT 8
|
#define TFT_FRAMEWDT 8
|
||||||
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
||||||
#define PLMITEMS 11
|
|
||||||
#define PLMITEMLENGHT 40
|
|
||||||
#define PLMITEMHEIGHT 22
|
|
||||||
|
|
||||||
#define bootLogoTop 68
|
#define bootLogoTop 68
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
#define DSP_WIDTH 84
|
#define DSP_WIDTH 84
|
||||||
#define TFT_FRAMEWDT 0
|
#define TFT_FRAMEWDT 0
|
||||||
#define MAX_WIDTH DSP_WIDTH
|
#define MAX_WIDTH DSP_WIDTH
|
||||||
#define PLMITEMS 7
|
|
||||||
#define PLMITEMLENGHT 40
|
|
||||||
#define PLMITEMHEIGHT 10
|
|
||||||
#define SCROLLDELAY 180
|
#define SCROLLDELAY 180
|
||||||
|
|
||||||
#define HIDE_TITLE2
|
#define HIDE_TITLE2
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
#define DSP_WIDTH 128
|
#define DSP_WIDTH 128
|
||||||
#define TFT_FRAMEWDT 4
|
#define TFT_FRAMEWDT 4
|
||||||
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
||||||
#define PLMITEMS 7
|
|
||||||
#define PLMITEMLENGHT 40
|
|
||||||
#define PLMITEMHEIGHT 21
|
|
||||||
|
|
||||||
#define bootLogoTop 68
|
#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 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 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 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 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 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 };
|
const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 42, 1, WA_LEFT }, 140, true, MAX_WIDTH, 0, 3, 30 };
|
||||||
|
|||||||
@@ -10,9 +10,6 @@
|
|||||||
#define DSP_WIDTH 160
|
#define DSP_WIDTH 160
|
||||||
#define TFT_FRAMEWDT 4
|
#define TFT_FRAMEWDT 4
|
||||||
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
||||||
#define PLMITEMS 7
|
|
||||||
#define PLMITEMLENGHT 40
|
|
||||||
#define PLMITEMHEIGHT 21
|
|
||||||
|
|
||||||
#define bootLogoTop 68
|
#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 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 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 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 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 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 };
|
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 bootstrConf PROGMEM = { 0, 110, 1, WA_CENTER };
|
||||||
const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 26, 1, WA_RIGHT };
|
const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 26, 1, WA_RIGHT };
|
||||||
//const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 99, 1, WA_LEFT };
|
//const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 99, 1, WA_LEFT };
|
||||||
const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
|
const WidgetConfig voltxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT };
|
||||||
const WidgetConfig iptxtConf 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 rssiConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_RIGHT };
|
||||||
const WidgetConfig numConf PROGMEM = { 0, 86, 35, WA_CENTER };
|
const WidgetConfig numConf PROGMEM = { 0, 86, 35, WA_CENTER };
|
||||||
const WidgetConfig apNameConf PROGMEM = { 0, 40, 1, 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 */
|
/* STRINGS */
|
||||||
const char numtxtFmt[] PROGMEM = "%d";
|
const char numtxtFmt[] PROGMEM = "%d";
|
||||||
const char rssiFmt[] PROGMEM = "%d";
|
const char rssiFmt[] PROGMEM = "%d";
|
||||||
const char iptxtFmt[] PROGMEM = "%s";
|
const char iptxtFmt[] PROGMEM = " %s";
|
||||||
const char voltxtFmt[] PROGMEM = "%d";
|
const char voltxtFmt[] PROGMEM = "\023\025%d";
|
||||||
const char bitrateFmt[] PROGMEM = "%d";
|
const char bitrateFmt[] PROGMEM = "%d";
|
||||||
/* MOVES */ /* { left, top, width (0 - auto, -1 - lock } */
|
/* MOVES */ /* { left, top, width (0 - auto, -1 - lock } */
|
||||||
const MoveConfig clockMove PROGMEM = { 16, 94, 0};
|
const MoveConfig clockMove PROGMEM = { 16, 94, 0};
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
#define DSP_WIDTH 160
|
#define DSP_WIDTH 160
|
||||||
#define TFT_FRAMEWDT 1
|
#define TFT_FRAMEWDT 1
|
||||||
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
||||||
#define PLMITEMS 7
|
|
||||||
#define PLMITEMLENGHT 40
|
|
||||||
#define PLMITEMHEIGHT 19
|
|
||||||
|
|
||||||
#define HIDE_IP
|
#define HIDE_IP
|
||||||
#define HIDE_TITLE2
|
#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 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 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 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 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 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-4, 0, 3, 30 }; // ПОГОДА!!
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
#define DSP_WIDTH 320
|
#define DSP_WIDTH 320
|
||||||
#define TFT_FRAMEWDT 8
|
#define TFT_FRAMEWDT 8
|
||||||
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
|
||||||
#define PLMITEMS 11
|
//#define PLMITEMS 11
|
||||||
#define PLMITEMLENGHT 40
|
//#define PLMITEMLENGHT 40
|
||||||
#define PLMITEMHEIGHT 22
|
//#define PLMITEMHEIGHT 22
|
||||||
|
|
||||||
#define bootLogoTop 68
|
#define bootLogoTop 68
|
||||||
|
|
||||||
|
|||||||
@@ -24,29 +24,35 @@ void DspCore::initDisplay() {
|
|||||||
cp437(true);
|
cp437(true);
|
||||||
flip();
|
flip();
|
||||||
setTextWrap(false);
|
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) {
|
void DspCore::drawLogo(uint16_t top) {
|
||||||
drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64);
|
drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
setTextSize(playlistConf.widget.textsize);
|
||||||
plMenu[i][0] = '\0';
|
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;
|
void DspCore::drawPlaylist(uint16_t currentItem) {
|
||||||
//fillRect(0, (height() / 2 - PLMITEMHEIGHT / 2) - 1, width(), PLMITEMHEIGHT + 2, config.theme.meta);
|
uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
if(lastPos<plTtemsCount){
|
||||||
if (i == 5) {
|
fillRect(0, lastPos*plItemHeight+plYStart, width(), height()/2, config.theme.background);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ void DspCore::initDisplay() {
|
|||||||
invert();
|
invert();
|
||||||
flip();
|
flip();
|
||||||
setTextWrap(false);
|
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) {
|
void DspCore::drawLogo(uint16_t top) {
|
||||||
@@ -78,22 +84,23 @@ void DspCore::drawLogo(uint16_t top) {
|
|||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
setTextSize(playlistConf.widget.textsize);
|
||||||
plMenu[i][0] = '\0';
|
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(1);
|
|
||||||
int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
void DspCore::drawPlaylist(uint16_t currentItem) {
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
if(lastPos<plTtemsCount){
|
||||||
if (i == 3) {
|
fillRect(0, lastPos*plItemHeight+plYStart, width(), height()/2, config.theme.background);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ void DspCore::initDisplay() {
|
|||||||
invert();
|
invert();
|
||||||
flip();
|
flip();
|
||||||
setTextWrap(false);
|
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) {
|
void DspCore::drawLogo(uint16_t top) {
|
||||||
@@ -40,24 +46,23 @@ void DspCore::drawLogo(uint16_t top) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
setTextSize(playlistConf.widget.textsize);
|
||||||
plMenu[i][0] = '\0';
|
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;
|
void DspCore::drawPlaylist(uint16_t currentItem) {
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
|
||||||
if (abs(i - 3) == 3) setTextColor(config.theme.playlist[2], config.theme.background);
|
if(lastPos<plTtemsCount){
|
||||||
if (abs(i - 3) == 2) setTextColor(config.theme.playlist[1], config.theme.background);
|
fillRect(0, lastPos*plItemHeight+plYStart, width(), height()/2, 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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,27 +32,34 @@ void DspCore::initDisplay() {
|
|||||||
setTextWrap(false);
|
setTextWrap(false);
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
fillScreen(0x0000);
|
fillScreen(0x0000);
|
||||||
|
|
||||||
|
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::drawLogo(uint16_t top) { drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64); }
|
||||||
|
|
||||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
setTextSize(playlistConf.widget.textsize);
|
||||||
plMenu[i][0] = '\0';
|
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;
|
|
||||||
|
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
void DspCore::drawPlaylist(uint16_t currentItem) {
|
||||||
if (i == 5) {
|
uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
|
||||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
if(lastPos<plTtemsCount){
|
||||||
} else {
|
fillRect(0, lastPos*plItemHeight+plYStart, width(), height()/2, config.theme.background);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#ifndef common_gfx_h
|
#ifndef common_gfx_h
|
||||||
#define common_gfx_h
|
#define common_gfx_h
|
||||||
|
public:
|
||||||
|
uint16_t plItemHeight, plTtemsCount, plCurrentPos;
|
||||||
|
int plYStart;
|
||||||
public:
|
public:
|
||||||
DspCore();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
//char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
void initDisplay();
|
void initDisplay();
|
||||||
void drawLogo(uint16_t top);
|
void drawLogo(uint16_t top);
|
||||||
void clearDsp(bool black=false);
|
void clearDsp(bool black=false);
|
||||||
@@ -11,7 +13,7 @@
|
|||||||
void printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight, bool redraw);
|
void printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight, bool redraw);
|
||||||
void clearClock();
|
void clearClock();
|
||||||
char* utf8Rus(const char* str, bool uppercase);
|
char* utf8Rus(const char* str, bool uppercase);
|
||||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
void drawPlaylist(uint16_t currentItem);
|
||||||
void loop(bool force=false);
|
void loop(bool force=false);
|
||||||
void charSize(uint8_t textsize, uint8_t& width, uint16_t& height);
|
void charSize(uint8_t textsize, uint8_t& width, uint16_t& height);
|
||||||
#ifndef DSP_LCD
|
#ifndef DSP_LCD
|
||||||
@@ -62,6 +64,7 @@
|
|||||||
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||||
uint16_t drawChar(uint16_t x, uint16_t y, uint16_t ch, uint16_t color = COLOR_WHITE);
|
uint16_t drawChar(uint16_t x, uint16_t y, uint16_t ch, uint16_t color = COLOR_WHITE);
|
||||||
#endif
|
#endif
|
||||||
|
void printPLitem(uint8_t pos, const char* item, ScrollWidget& current);
|
||||||
private:
|
private:
|
||||||
char _timeBuf[20], _dateBuf[20], _oldTimeBuf[20], _oldDateBuf[20], _bufforseconds[4], _buffordate[40];
|
char _timeBuf[20], _dateBuf[20], _oldTimeBuf[20], _oldDateBuf[20], _bufforseconds[4], _buffordate[40];
|
||||||
uint16_t _timewidth, _timeleft, _datewidth, _dateleft, _oldtimeleft, _oldtimewidth, _olddateleft, _olddatewidth, clockTop, clockRightSpace, clockTimeHeight, _dotsLeft;
|
uint16_t _timewidth, _timeleft, _datewidth, _dateleft, _oldtimeleft, _oldtimewidth, _olddateleft, _olddatewidth, clockTop, clockRightSpace, clockTimeHeight, _dotsLeft;
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ void FillWidget::_draw(){
|
|||||||
dsp.fillRect(_config.left, _config.top, _width, _height, _bgcolor);
|
dsp.fillRect(_config.left, _config.top, _width, _height, _bgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FillWidget::setHeight(uint16_t newHeight){
|
||||||
|
_height = newHeight;
|
||||||
|
//_draw();
|
||||||
|
}
|
||||||
/************************
|
/************************
|
||||||
TEXT WIDGET
|
TEXT WIDGET
|
||||||
************************/
|
************************/
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ class FillWidget: public Widget {
|
|||||||
FillWidget() {}
|
FillWidget() {}
|
||||||
FillWidget(FillConfig conf, uint16_t bgcolor) { init(conf, bgcolor); }
|
FillWidget(FillConfig conf, uint16_t bgcolor) { init(conf, bgcolor); }
|
||||||
void init(FillConfig conf, uint16_t bgcolor);
|
void init(FillConfig conf, uint16_t bgcolor);
|
||||||
|
void setHeight(uint16_t newHeight);
|
||||||
protected:
|
protected:
|
||||||
uint16_t _height;
|
uint16_t _height;
|
||||||
void _draw();
|
void _draw();
|
||||||
|
|||||||
Reference in New Issue
Block a user