11#include " ../../options.h"
22
3- #if DSP_MODEL==DSP_1602I2C || DSP_MODEL==DSP_1602
3+ #if DSP_MODEL==DSP_1602I2C || DSP_MODEL==DSP_1602 || DSP_MODEL==DSP_2004 || DSP_MODEL==DSP_2004I2C
44
55#include " displayLC1602.h"
66#include " ../../player.h"
1313
1414const byte controlspaces[] = { CLOCK_SPACE, VOL_SPACE };
1515
16- #ifdef LCD_I2C
17- DspCore::DspCore (): LiquidCrystal_I2C(SCREEN_ADDRESS, 16 , 2 , I2C_SDA, I2C_SCL) {
18-
19- }
20- #else
21- DspCore::DspCore (): LiquidCrystal(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7) {
16+ DspCore::DspCore (): DSP_INIT {}
2217
23- }
24- #endif
2518void DspCore::apScreen () {
2619 setCursor (0 ,0 );
2720 print (" YORADIO AP MODE" );
2821 setCursor (0 ,1 );
2922 print (WiFi.softAPIP ().toString ().c_str ());
23+ #ifdef LCD_2004
24+ setCursor (0 , 2 );
25+ print (" AP NAME: " );
26+ print (apSsid);
27+ setCursor (0 , 3 );
28+ print (" PASSWORD: " );
29+ print (apPassword);
30+ #endif
3031}
3132
3233void DspCore::initD (uint16_t &screenwidth, uint16_t &screenheight) {
3334#ifdef LCD_I2C
3435 init ();
3536 backlight ();
37+ #else
38+ #ifdef LCD_2004
39+ begin (20 , 4 );
3640#else
3741 begin (16 , 2 );
3842#endif
43+ #endif
44+
45+ #ifdef LCD_2004
46+ screenwidth = 20 ;
47+ screenheight = 4 ;
48+ #else
3949 screenwidth = 16 ;
4050 screenheight = 2 ;
51+ #endif
52+
4153 swidth = screenwidth;
4254 sheight = screenheight;
4355 fillSpaces = true ;
@@ -52,11 +64,27 @@ void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
5264 for (byte i = 0 ; i < PLMITEMS; i++) {
5365 plMenu[i][0 ] = ' \0 ' ;
5466 }
55-
67+ #ifdef LCD_2004
68+ config.fillPlMenu (plMenu, currentItem-1 , PLMITEMS);
69+ for (byte i = 0 ; i < PLMITEMS; i++) {
70+ if (i == 1 ) {
71+ strlcpy (currentItemText, " >" , 2 );
72+ // strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
73+ strlcat (currentItemText, plMenu[i], PLMITEMLENGHT - 2 );
74+ } else {
75+ char tmp[swidth+1 ] = {0 };
76+ strlcpy (tmp, utf8Rus (plMenu[i], true ), swidth);
77+ clearScroll (1 + i, 0 , 0 );
78+ setCursor (1 , 1 + i);
79+ print (tmp);
80+ }
81+ }
82+ #else
5683 config.fillPlMenu (plMenu, currentItem, PLMITEMS);
5784 for (byte i = 0 ; i < PLMITEMS; i++) {
5885 strlcpy (currentItemText, plMenu[i], PLMITEMLENGHT - 1 );
5986 }
87+ #endif
6088}
6189
6290void DspCore::clearDsp () {
@@ -113,8 +141,13 @@ void DspCore::drawVolumeBar(bool withNumber) {
113141 centerText (" " , 1 , 0 , 0 );
114142 centerText (volstr, 1 , TFT_LOGO, TFT_BG);
115143 }else {
144+ #ifdef LCD_2004
145+ rightText (" " , 3 , 0 , 0 );
146+ rightText (volstr, 3 , TFT_LOGO, TFT_BG);
147+ #else
116148 rightText (" " , 1 , 0 , 0 );
117149 rightText (volstr, 1 , TFT_LOGO, TFT_BG);
150+ #endif
118151 }
119152}
120153
@@ -134,7 +167,10 @@ void DspCore::rssi(const char* str) {
134167}
135168
136169void DspCore::ip (const char * str) {
137-
170+ #ifdef LCD_2004
171+ setCursor (0 , 3 );
172+ print (str);
173+ #endif
138174}
139175
140176void DspCore::set_TextSize (uint8_t s) {
0 commit comments