pl_text_size_012

This commit is contained in:
e2002
2023-03-08 11:22:29 +03:00
parent 06d9c9ae3a
commit a50dd1a353
10 changed files with 52 additions and 48 deletions

View File

@@ -71,7 +71,7 @@ const char apPassTxt[] PROGMEM = "PASSWORD";
const char bootstrFmt[] PROGMEM = "Trying to %s"; const char bootstrFmt[] PROGMEM = "Trying to %s";
const char apSettFmt[] PROGMEM = "SETTINGS PAGE ON: HTTP://%s/"; const char apSettFmt[] PROGMEM = "SETTINGS PAGE ON: HTTP://%s/";
#if EXT_WEATHER #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 #else
const char weatherFmt[] PROGMEM = "%s, %.1f\011C \007 pressure: %d mm \007 humidity: %s%%"; const char weatherFmt[] PROGMEM = "%s, %.1f\011C \007 pressure: %d mm \007 humidity: %s%%";
#endif #endif

View File

@@ -85,7 +85,9 @@ 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
#if !defined(DSP_LCD)
_plcurrent.moveTo({TFT_FRAMEWDT, (uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight), (int16_t)playlistConf.width}); _plcurrent.moveTo({TFT_FRAMEWDT, (uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight), (int16_t)playlistConf.width});
#endif
#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,12 +155,13 @@ void Display::_buildPager(){
#if !defined(DSP_LCD) && DSP_MODEL!=DSP_NOKIA5110 #if !defined(DSP_LCD) && DSP_MODEL!=DSP_NOKIA5110
pages[PG_DIALOG]->addPage(&_footer); pages[PG_DIALOG]->addPage(&_footer);
#endif #endif
#if !defined(DSP_LCD)
if(_plbackground) { if(_plbackground) {
pages[PG_PLAYLIST]->addWidget( _plbackground); pages[PG_PLAYLIST]->addWidget( _plbackground);
_plbackground->setHeight(dsp.plItemHeight); _plbackground->setHeight(dsp.plItemHeight);
_plbackground->moveTo({0,(uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight-playlistConf.widget.textsize*2), (int16_t)playlBGConf.width}); _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); pages[PG_PLAYLIST]->addWidget(&_plcurrent);
for(const auto& p: pages) _pager.addPage(p); for(const auto& p: pages) _pager.addPage(p);
@@ -255,6 +258,9 @@ void Display::_swichMode(displayMode_e newmode) {
_mode = newmode; _mode = newmode;
dsp.setScrollId(NULL); dsp.setScrollId(NULL);
if (newmode == PLAYER) { if (newmode == PLAYER) {
#ifdef DSP_LCD
dsp.clearDsp();
#endif
numOfNextStation = 0; numOfNextStation = 0;
_returnTicker.detach(); _returnTicker.detach();
#ifdef META_MOVE #ifdef META_MOVE

View File

@@ -1,7 +1,7 @@
#ifndef options_h #ifndef options_h
#define options_h #define options_h
#define YOVERSION "0.9.010" #define YOVERSION "0.9.012"
/******************************************************* /*******************************************************
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.

View File

@@ -12,7 +12,6 @@
#define TFT_FRAMEWDT 0 #define TFT_FRAMEWDT 0
#define MAX_WIDTH 16 #define MAX_WIDTH 16
#define PLMITEMS 2 #define PLMITEMS 2
#define PLMITEMLENGHT 40
#define HIDE_IP #define HIDE_IP
#define HIDE_TITLE2 #define HIDE_TITLE2

View File

@@ -12,7 +12,6 @@
#define TFT_FRAMEWDT 0 #define TFT_FRAMEWDT 0
#define MAX_WIDTH 20 #define MAX_WIDTH 20
#define PLMITEMS 4 #define PLMITEMS 4
#define PLMITEMLENGHT 40
#define HIDE_IP #define HIDE_IP
#define HIDE_VOLBAR #define HIDE_VOLBAR

View File

@@ -11,9 +11,6 @@
#define DSP_WIDTH 128 #define DSP_WIDTH 128
#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 5
#define PLMITEMLENGHT 40
#define PLMITEMHEIGHT 18
#define HIDE_HEAPBAR #define HIDE_HEAPBAR
#define HIDE_VOL #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 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 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 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 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 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 }; // ПОГОДА!! const ScrollConfig weatherConf PROGMEM = {{ 0, 64-11, 1, WA_LEFT }, 140, true, DSP_WIDTH-6*4, 0, 2, 25 }; // ПОГОДА!!

View File

@@ -11,9 +11,6 @@
#define DSP_WIDTH 128 #define DSP_WIDTH 128
#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 5
#define PLMITEMLENGHT 40
#define PLMITEMHEIGHT 10
#define HIDE_IP #define HIDE_IP
#define HIDE_TITLE2 #define HIDE_TITLE2

View File

@@ -31,8 +31,6 @@ void DspCore::apScreen() {
#endif #endif
} }
byte Arrow[] PROGMEM = { B00000, B00100, B00010, B01001, B00010, B00100, B00000, B00000 };
void DspCore::initDisplay() { void DspCore::initDisplay() {
#ifdef LCD_I2C #ifdef LCD_I2C
init(); init();
@@ -45,30 +43,29 @@ void DspCore::initDisplay() {
#endif #endif
#endif #endif
clearClipping(); clearClipping();
createChar(0, Arrow);
plTtemsCount = PLMITEMS;
plCurrentPos = 1;
} }
void DspCore::drawLogo(uint16_t top) { } void DspCore::drawLogo(uint16_t top) { }
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) { if (pos == plCurrentPos) {
clear(); current.setText(item);
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 { } else {
setCursor(1, pos);
char tmp[width()] = {0}; char tmp[width()] = {0};
strlcpy(tmp, utf8Rus(plMenu[i], true), width()); strlcpy(tmp, utf8Rus(item, true), width());
setCursor(1, i);
print(tmp); print(tmp);
} }
} }
void DspCore::drawPlaylist(uint16_t currentItem) {
clear();
config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
setCursor(0,1); setCursor(0,1);
write(byte(0)); write(byte(126));
} }
void DspCore::clearDsp(bool black) { void DspCore::clearDsp(bool black) {

View File

@@ -50,6 +50,12 @@ void DspCore::initDisplay() {
flip(); flip();
invert(); invert();
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) {
@@ -65,22 +71,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);
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 { } else {
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
fillRect(0, yStart + i * PLMITEMHEIGHT, width(), PLMITEMHEIGHT - 1, TFT_BG); setTextColor(config.theme.playlist[plColor], config.theme.background);
print(utf8Rus(plMenu[i], true)); setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
fillRect(0, plYStart + pos * plItemHeight - 1, width(), plItemHeight - 2, config.theme.background);
print(utf8Rus(item, true));
} }
}
void DspCore::drawPlaylist(uint16_t currentItem) {
uint8_t lastPos = config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
if(lastPos<plTtemsCount){
fillRect(0, lastPos*plItemHeight+plYStart, width(), height()/2, config.theme.background);
} }
} }

View File

@@ -100,6 +100,8 @@ char* DspCore::utf8Rus(const char* str, bool uppercase) {
} }
strn[sind - 1] = 0; strn[sind - 1] = 0;
} else { } else {
if(strn[index]==7) strn[index]=165;
if(strn[index]==9) strn[index]=223;
char Temp[2] = {(char) strn[index] , 0 } ; char Temp[2] = {(char) strn[index] , 0 } ;
strcat(newStr, Temp); strcat(newStr, Temp);
} }