pl_text_size_010

This commit is contained in:
e2002
2023-03-07 13:10:26 +03:00
parent 617bbba589
commit 06d9c9ae3a
4 changed files with 44 additions and 41 deletions

View File

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

View File

@@ -12,9 +12,6 @@
#define DSP_HEIGHT 176 #define DSP_HEIGHT 176
#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 9
#define PLMITEMLENGHT 40
#define PLMITEMHEIGHT 22
#define bootLogoTop 28 #define bootLogoTop 28
//#define DSP_QUEUE_TICKS 5 //#define DSP_QUEUE_TICKS 5
@@ -38,8 +35,8 @@ const FillConfig heapbarConf PROGMEM = {{ 0, DSP_HEIGHT-1, 0, WA_LEFT }, DS
/* WIDGETS */ /* { left, top, fontsize, align } */ /* WIDGETS */ /* { left, top, fontsize, align } */
const WidgetConfig bootstrConf PROGMEM = { 0, 150, 1, WA_CENTER }; const WidgetConfig bootstrConf PROGMEM = { 0, 150, 1, WA_CENTER };
const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT+6, DSP_HEIGHT-TFT_FRAMEWDT-14-14, 1, WA_RIGHT }; const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT+6, DSP_HEIGHT-TFT_FRAMEWDT-14-14, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { 80, DSP_HEIGHT-TFT_FRAMEWDT-14, 1, WA_RIGHT }; const WidgetConfig voltxtConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-TFT_FRAMEWDT-14, 1, WA_LEFT };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-TFT_FRAMEWDT-14, 1, WA_LEFT }; const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-TFT_FRAMEWDT-14, 1, WA_CENTER };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-TFT_FRAMEWDT-14, 1, WA_RIGHT }; const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-TFT_FRAMEWDT-14, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 110, 35, WA_CENTER }; const WidgetConfig numConf PROGMEM = { 0, 110, 35, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 38, 2, WA_CENTER }; const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 38, 2, WA_CENTER };
@@ -57,8 +54,8 @@ const VUBandsConfig bandsConf PROGMEM = { 19, 90, 2, 2, 10, 2 };
/* STRINGS */ /* STRINGS */
const char numtxtFmt[] PROGMEM = "%d"; const char numtxtFmt[] PROGMEM = "%d";
const char rssiFmt[] PROGMEM = "WiFi %d"; const char rssiFmt[] PROGMEM = "WiFi %d";
const char iptxtFmt[] PROGMEM = "\010 %s"; const char iptxtFmt[] PROGMEM = "%s";
const char voltxtFmt[] PROGMEM = "%d"; const char voltxtFmt[] PROGMEM = "\023\025%d";
const char bitrateFmt[] PROGMEM = "%d kBs"; const char bitrateFmt[] PROGMEM = "%d kBs";
/* MOVES */ /* { left, top, width } */ /* MOVES */ /* { left, top, width } */

View File

@@ -103,6 +103,11 @@ void DspCore::initDisplay() {
flip(); flip();
setTextSize(1); setTextSize(1);
// GIVE_MUTEX(); // GIVE_MUTEX();
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) {
@@ -111,22 +116,23 @@ void DspCore::drawLogo(uint16_t top) {
GIVE_MUTEX(); GIVE_MUTEX();
} }
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 - 4, PLMITEMS);
setTextSize(2);
int yStart = (height() / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
for (byte i = 0; i < PLMITEMS; i++) {
if (i == 4) {
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
} else { } else {
setTextColor(config.theme.playlist[abs(i - 4)-1], config.theme.background); uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT); setTextColor(config.theme.playlist[plColor], config.theme.background);
fillRect(0, yStart + i * PLMITEMHEIGHT-1, width(), PLMITEMHEIGHT-7, config.theme.background); setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
print(utf8Rus(plMenu[i], true)); 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

@@ -13,35 +13,35 @@
const unsigned char yofont5x7[] PROGMEM = { const unsigned char yofont5x7[] PROGMEM = {
0x05, 0x07, 0x00, 0xFF, 0x05, 0x07, 0x00, 0xFF,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x3E, 0x55, 0x51, 0x55, 0x3E, 0x05, 0x20, 0x20, 0x00, 0x10, 0x10, // \001 rssi 00__
0x05, 0x3E, 0x6B, 0x6F, 0x6B, 0x3E, 0x05, 0x08, 0x08, 0x00, 0x04, 0x04, // \002 rssi __00
0x05, 0x0C, 0x1E, 0x3C, 0x1E, 0x0C, 0x05, 0x60, 0x60, 0x00, 0x10, 0x10, // \003 rssi 10__
0x05, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x05, 0x60, 0x60, 0x00, 0x70, 0x70, // \004 rssi 11__
0x05, 0x1C, 0x4A, 0x7F, 0x4A, 0x1C, 0x05, 0x78, 0x78, 0x00, 0x04, 0x04, // \005 rssi __10
0x05, 0x18, 0x5C, 0x7F, 0x5C, 0x18, 0x05, 0x78, 0x78, 0x00, 0x7C, 0x7C, // \006 rssi __11
0x05, 0x00, 0x1C, 0x1C, 0x1C, 0x00, 0x05, 0x00, 0x1C, 0x1C, 0x1C, 0x00, // \007 weather div
0x05, 0x7F, 0x63, 0x63, 0x63, 0x7F, 0x05, 0x7A, 0x00, 0x7E, 0x12, 0x1E, // \010 ip
0x05, 0x00, 0x1C, 0x14, 0x1C, 0x00, 0x05, 0x06, 0x09, 0x09, 0x06, 0x00, // \011 degree
0x05, 0x7F, 0x63, 0x6B, 0x63, 0x7F, 0x05, 0x7F, 0x63, 0x6B, 0x63, 0x7F,
0x05, 0x30, 0x48, 0x4D, 0x33, 0x07, 0x05, 0x30, 0x48, 0x4D, 0x33, 0x07,
0x05, 0x06, 0x29, 0x79, 0x29, 0x06, 0x05, 0x06, 0x29, 0x79, 0x29, 0x06,
0x05, 0x20, 0x50, 0x3F, 0x02, 0x0C, 0x05, 0x20, 0x50, 0x3F, 0x02, 0x0C,
0x05, 0x60, 0x7F, 0x05, 0x35, 0x3F, 0x05, 0x60, 0x7F, 0x05, 0x35, 0x3F, // \016 note
0x05, 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x05, 0x2A, 0x1C, 0x77, 0x1C, 0x2A,
0x05, 0x00, 0x7F, 0x3E, 0x1C, 0x08, 0x05, 0x00, 0x7F, 0x3E, 0x1C, 0x08, // \020 next/play
0x05, 0x08, 0x1C, 0x3E, 0x7F, 0x00, 0x05, 0x08, 0x1C, 0x3E, 0x7F, 0x00, // \021 prev
0x05, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x05, 0x14, 0x22, 0x7F, 0x22, 0x14,
0x05, 0x00, 0x5F, 0x00, 0x5F, 0x00, 0x05, 0x00, 0x00, 0x18, 0x3C, 0x7E, // \023 speaker
0x05, 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x05, 0x18, 0x00, 0x00, 0x00, 0x00, // \024 25%
0x05, 0x4A, 0x55, 0x55, 0x55, 0x29, 0x05, 0x18, 0x42, 0x3C, 0x00, 0x00, // \025 50%
0x05, 0x60, 0x60, 0x60, 0x60, 0x60, 0x05, 0x18, 0x42, 0x3C, 0x42, 0x3C, // \026 100%
0x05, 0x54, 0x62, 0x7F, 0x62, 0x54, 0x05, 0x54, 0x62, 0x7F, 0x62, 0x54,
0x05, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x05, 0x08, 0x04, 0x7E, 0x04, 0x08,
0x05, 0x08, 0x10, 0x3F, 0x10, 0x08, 0x05, 0x08, 0x10, 0x3F, 0x10, 0x08,
0x05, 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x05, 0x08, 0x08, 0x2A, 0x1C, 0x08,
0x05, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x05, 0x08, 0x1C, 0x2A, 0x08, 0x08,
0x05, 0x1C, 0x10, 0x10, 0x10, 0x10, 0x05, 0x7F, 0x7F, 0x00, 0x7F, 0x7F, // \034 pause
0x05, 0x1C, 0x3E, 0x08, 0x3E, 0x1C, 0x05, 0x55, 0x00, 0x55, 0x55, 0x55, // \035 list
0x05, 0x30, 0x3C, 0x3F, 0x3C, 0x30, 0x05, 0x30, 0x3C, 0x3F, 0x3C, 0x30,
0x05, 0x06, 0x1E, 0x7E, 0x1E, 0x06, 0x05, 0x06, 0x1E, 0x7E, 0x1E, 0x06,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,