From 1c8e5077c064625f89a8eab8dbcc8fb94fc94c84 Mon Sep 17 00:00:00 2001 From: e2002 Date: Sun, 3 Aug 2025 21:36:48 +0300 Subject: [PATCH] v0.9.570 --- README.md | 33 ++++--- yoRadio/src/core/options.h | 1 + .../src/displays/conf/displayST7789_76conf.h | 71 ++++++++++++++++ yoRadio/src/displays/displayST7789.cpp | 85 +++++++++++++++++-- yoRadio/src/displays/displayST7789.h | 16 +++- yoRadio/src/displays/dspcore.h | 2 +- 6 files changed, 182 insertions(+), 26 deletions(-) create mode 100644 yoRadio/src/displays/conf/displayST7789_76conf.h diff --git a/README.md b/README.md index a3fc5f9..43b33fb 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ https://aliexpress.com/item/32965676064.html - or **ILI9486** (Testing mode) 3.5' 480x320 SPI https://aliexpress.com/item/1005001999296476.html?sku_id=12000018365356568 - or **SSD1322** 2.8' 256x64 SPI https://aliexpress.com/item/1005003480981568.html - or **ST7920** 2.6' 128x64 SPI https://aliexpress.com/item/32699482638.html +- or **ST7789** 2.25' 284x76 SPI https://aliexpress.ru/item/1005009016973081.html (see [Wiki](https://github.com/e2002/yoradio/wiki/Available-display-models) for more details) @@ -234,32 +235,36 @@ Work is in progress... --- ## Version history -### 0.9.561 +#### v0.9.570 +- added support for ST7789 284x76 2.25' SPI displays https://aliexpress.ru/item/1005009016973081.html \ + note: the brightness pin of this display should be pulled up to GND + +### v0.9.561 **!!! a [full update](#update-over-web-interface) with Sketch data upload is required !!!**\ - or-> just upload `yoRadio/data/www/script.js.gz` to Webboard Uploader http://radioipaddr/webboard\ + or-> just upload `yoRadio/data/www/script.js.gz` to Webboard Uploader http://radioipaddr/webboard \ After updating please clear browser cache. - fixed error when switching to SD Card mode - fixed issue causing random reboots - fixed preview playback bug in Playlist Editor -### 0.9.555 +### v0.9.555 - fixed error "assert failed: udp_new_ip_type /IDF/components/lwip/lwip/src/core/udp.c:1278 (Required to lock TCPIP core functionality!)"\ part #2 - weather synchronization code rewritten -### 0.9.553 +### v0.9.553 - fix "No 'Access-Control-Allow-Origin' header is present on the requested resource" on saving playlist\ just reupload the file `script.js.gz` with Webboard uploader - fixed error "assert failed: udp_new_ip_type /IDF/components/lwip/lwip/src/core/udp.c:1278 (Required to lock TCPIP core functionality!)" - fixed error "Exception in status_listener when handling msg" in HA component -### 0.9.552 +### v0.9.552 - fixed compilation error for ESP cores version below 3.0.0\ Thanks to @salawalas ! https://github.com/e2002/yoradio/pull/197/ - disabled websocket reconnection on all pages except the start page "/"\ just reupload the file `script.js.gz` -### 0.9.550 +### v0.9.550 **!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!**\ or-> just upload all files from data/www (11 pcs) to Webboard Uploader http://radioipaddr/webboard - fixed the issue with selecting all rows in the playlist editor @@ -276,12 +281,12 @@ or-> just upload all files from data/www (11 pcs) to Webboard Uploader http://ra - settings for time and weather synchronization intervals have been added to the web interface - bug fixes, optimization -### 0.9.533 +### v0.9.533 - fixed compilation error for esp32 core version lower than 3.0.0 - fixed error setting display brightness to 1 - fixed error setting IR tolerance value (upload a new file `options.html.gz` via WEB Board Uploader and press Ctrl+F5 on the settings page) -### 0.9.530 +### v0.9.530 - optimization of webserver/socket code in netserver.cpp, part#1 - added support for ArduinoOTA (OTA update from Arduino IDE) (disabled by default)\ to enable you need to add to myoptions.h: `#define USE_OTA true`\ @@ -294,13 +299,13 @@ or-> just upload all files from data/www (11 pcs) to Webboard Uploader http://ra - added config (sys.config) telnet command that displays the same information usually shown over serial at boot. - bug fixes 🪲 -### 0.9.515 +### v0.9.515 - fixed a bug with resetting all parameters when resetting only one section of parameters -### 0.9.512 +### v0.9.512 - fixed bug with saving ntp server #1 value -### 0.9.511 +### v0.9.511 In this version, the contents of the data/www directory have changed, so that the first time you flash it, you will be greeted by WEB Board Uploader. Just upload all the files from data/www (11 pcs) to it\ or -> **!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** - fixed a bug with saving smartstart mode @@ -314,7 +319,7 @@ or -> **!!! a [full update](#update-over-web-interface) with Sketch data upload - buttons reboot (reboot) format (spiffs format) and reset (reset settings to default) have been added to the settings - the beginnings of theming (theme.css) (just a list of global colors that can be changed, and then uploaded to theme.css via WB uploader) -### 0.9.434 +### v0.9.434 - fixed the issue with exiting Screensaver Blank Screen mode via button presses and IR commands. - reduced the minimum frequency for tone control on I2S modules to 80Hz. - increased the display update task delay to 10 TICKS. @@ -322,13 +327,13 @@ or -> **!!! a [full update](#update-over-web-interface) with Sketch data upload - when ENCODER2 is connected, the UP and DOWN buttons now work as PREV and NEXT (single click). - implemented backlight off in Screensaver Blank Screen mode. -### 0.9.428 +### v0.9.428 - fixed freezing after SD scanning during playback - AsyncWebSocket queue increased to 128 - fixed VU meter overlapping the clock on displays - fixed Guru Meditation error when loading in SD mode with SD card removed -### 0.9.420 +### v0.9.420 **!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** - added screensaver mode during playback, configurable via the web interface, pull request[#129](https://github.com/e2002/yoradio/pull/129) - added blank screen mode to screensaver, configurable via the web interface, pull request[#129](https://github.com/e2002/yoradio/pull/129) diff --git a/yoRadio/src/core/options.h b/yoRadio/src/core/options.h index e86b507..67defdf 100644 --- a/yoRadio/src/core/options.h +++ b/yoRadio/src/core/options.h @@ -50,6 +50,7 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti #define DSP_ILI9486 22 // (Testing mode) 480x320 3.5' https://aliexpress.com/item/1005001999296476.html?sku_id=12000018365356568 #define DSP_SSD1322 23 // 256x64 2.8' https://aliexpress.com/item/1005003480981568.html #define DSP_ST7920 24 // 128x64 2.6' https://aliexpress.com/item/32699482638.html +#define DSP_ST7789_76 25 // 284x76 2.25' https://aliexpress.ru/item/1005009016973081.html #define DSP_CUSTOM 101 // your display #ifndef DSP_MODEL diff --git a/yoRadio/src/displays/conf/displayST7789_76conf.h b/yoRadio/src/displays/conf/displayST7789_76conf.h new file mode 100644 index 0000000..37b79ed --- /dev/null +++ b/yoRadio/src/displays/conf/displayST7789_76conf.h @@ -0,0 +1,71 @@ +/************************************************************************************* + SSD1305 265x64 displays configuration file. + Copy this file to yoRadio/src/displays/conf/displaySSD1322conf_custom.h + and modify it + More info on https://github.com/e2002/yoradio/wiki/Widgets#widgets-description +*************************************************************************************/ + +#ifndef displayST778976conf_h +#define displayST778976conf_h + +#define DSP_WIDTH 284 +#define DSP_HEIGHT 76 +#define TFT_FRAMEWDT 2 +#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2 + +#define HIDE_HEAPBAR +#define HIDE_VOL +//#define HIDE_VU +//#define HIDE_TITLE2 + +#define bootLogoTop 68 + +/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */ +const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT+1, TFT_FRAMEWDT+1, 2, WA_LEFT }, 140, true, MAX_WIDTH-2, 5000, 2, 25 }; +const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 21, 1, WA_LEFT }, 140, true, DSP_WIDTH/2+18, 5000, 2, 25 }; +const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 30, 1, WA_LEFT }, 140, true, DSP_WIDTH/2+18, 5000, 2, 25 }; +const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 30, 1, WA_LEFT }, 140, true, MAX_WIDTH, 500, 2, 25 }; +const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT+1, TFT_FRAMEWDT+1, 1, WA_CENTER }, 140, false, MAX_WIDTH-2, 0, 2, 25 }; +const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 64-7, 1, WA_LEFT }, 140, false, MAX_WIDTH, 0, 2, 25 }; +const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 64-12, 1, WA_LEFT }, 140, true, DSP_WIDTH/2+18, 0, 2, 25 }; // ПОГОДА!! + +/* BACKGROUNDS */ /* {{ left, top, fontsize, align }, width, height, outlined } */ +const FillConfig metaBGConf PROGMEM = {{ 0, 0, 0, WA_LEFT }, DSP_WIDTH, 19, false }; +const FillConfig volbarConf PROGMEM = {{ TFT_FRAMEWDT, DSP_HEIGHT-4, 0, WA_LEFT }, DSP_WIDTH-TFT_FRAMEWDT*2, 3, true }; +const FillConfig playlBGConf PROGMEM = {{ 0, 26, 0, WA_LEFT }, DSP_WIDTH, 12, false }; +const FillConfig heapbarConf PROGMEM = {{ 0, 63, 0, WA_LEFT }, DSP_WIDTH, 1, false }; + +/* WIDGETS */ /* { left, top, fontsize, align } */ +const WidgetConfig bootstrConf PROGMEM = { 0, DSP_HEIGHT-10, 1, WA_CENTER }; +const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT+20, 64-11-10, 1, WA_LEFT }; +//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT }; +const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 64-12, 1, WA_LEFT }; +const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 64-11-10, 1, WA_LEFT }; +const WidgetConfig numConf PROGMEM = { TFT_FRAMEWDT, 57, 35, WA_CENTER }; +const WidgetConfig apNameConf PROGMEM = { 0, 18, 1, WA_CENTER }; +const WidgetConfig apName2Conf PROGMEM = { 0, 26, 1, WA_CENTER }; +const WidgetConfig apPassConf PROGMEM = { 0, 37, 1, WA_CENTER }; +const WidgetConfig apPass2Conf PROGMEM = { 0, 45, 1, WA_CENTER }; +//const WidgetConfig clockConf PROGMEM = { 6, 34, 2, WA_CENTER }; +const WidgetConfig clockConf PROGMEM = { 0, 57, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */ +const WidgetConfig vuConf PROGMEM = { 2, DSP_HEIGHT-14, 1, WA_CENTER }; + +const WidgetConfig bootWdtConf PROGMEM = { 0, DSP_HEIGHT-8*2-5, 1, WA_CENTER }; +const ProgressConfig bootPrgConf PROGMEM = { 90, 10, 4 }; + +/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */ +const VUBandsConfig bandsConf PROGMEM = { DSP_WIDTH/2-TFT_FRAMEWDT*2-2, 7, TFT_FRAMEWDT*2+4, 1, 17, 2 }; + +/* STRINGS */ +const char numtxtFmt[] PROGMEM = "%d"; +const char rssiFmt[] PROGMEM = "%d"; +const char iptxtFmt[] PROGMEM = "%s"; +//const char voltxtFmt[] PROGMEM = "%d"; +const char bitrateFmt[] PROGMEM = "%d kBs"; + +/* MOVES */ /* { left, top, width } */ +const MoveConfig clockMove PROGMEM = { 0, 0, -1 }; +const MoveConfig weatherMove PROGMEM = { 0, 0, -1 }; +const MoveConfig weatherMoveVU PROGMEM = { 0, 0, -1 }; + +#endif diff --git a/yoRadio/src/displays/displayST7789.cpp b/yoRadio/src/displays/displayST7789.cpp index 2354b9b..37f94fd 100644 --- a/yoRadio/src/displays/displayST7789.cpp +++ b/yoRadio/src/displays/displayST7789.cpp @@ -1,9 +1,14 @@ #include "../core/options.h" -#if DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 +#if DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 || DSP_MODEL==DSP_ST7789_76 #include "displayST7789.h" //#include +#if DSP_MODEL==DSP_ST7789_76 +#include "fonts/bootlogo40.h" +#else #include "fonts/bootlogo.h" +#endif + #include "../core/config.h" #include "../core/network.h" @@ -20,7 +25,11 @@ DspCore::DspCore(): Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST) {} #include "tools/utf8RusGFX.h" void DspCore::initDisplay() { - init(240,(DSP_MODEL==DSP_ST7789)?320:240); + if(DSP_MODEL==DSP_ST7789_76){ + init(76,284); + }else{ + init(240,(DSP_MODEL==DSP_ST7789)?320:240); + } if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); invert(); cp437(true); @@ -36,8 +45,14 @@ void DspCore::initDisplay() { plYStart = (height() / 2 - plItemHeight / 2) - plItemHeight * (plTtemsCount - 1) / 2 + playlistConf.widget.textsize*2; } - +#if DSP_MODEL==DSP_ST7789_76 +void DspCore::drawLogo(uint16_t top) { + //drawBitmap( (width() - LOGO_WIDTH ) / 2, 8, logo, LOGO_WIDTH, LOGO_HEIGHT, 1); + drawRGBBitmap((width() - 62) / 2, 8, bootlogo40, 62, 40); +} +#else void DspCore::drawLogo(uint16_t top) { drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64); } +#endif void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){ setTextSize(playlistConf.widget.textsize); @@ -66,7 +81,11 @@ GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) { } uint8_t DspCore::_charWidth(unsigned char c){ +#if DSP_MODEL==DSP_ST7789_76 + GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI28pt7b, c - 0x20); +#else GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI42pt7b, c - 0x20); +#endif return pgm_read_byte(&glyph->xAdvance); } @@ -82,15 +101,61 @@ void DspCore::_getTimeBounds() { strftime(buf, 4, "%H", &network.timeinfo); _dotsLeft=textWidth(buf); } +#if DSP_MODEL==DSP_ST7789_76 +void DspCore::_clockSeconds(){ + setTextSize(1); + setFont(&DS_DIGI28pt7b); + setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background); + setCursor(_timeleft+_dotsLeft, clockTop); + print(":"); + setFont(); +} +void DspCore::_clockDate(){ } + +void DspCore::_clockTime(){ + if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth+CHARWIDTH*2+2, clockTimeHeight, config.theme.background); + _timeleft = (width()/*/2*/ - _timewidth/*/2*/)-clockRightSpace; + setTextSize(1); + setFont(&DS_DIGI28pt7b); + + if(CLOCKFONT_MONO) { + setCursor(_timeleft, clockTop); + setTextColor(config.theme.clockbg, config.theme.background); + print("88:88"); + } + setTextColor(config.theme.clock, config.theme.background); + setCursor(_timeleft, clockTop); + print(_timeBuf); + setFont(); + strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf)); + _oldtimewidth = _timewidth; + _oldtimeleft = _timeleft; +} + +void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight, bool redraw){ + clockTop = top; + clockRightSpace = rightspace; + clockTimeHeight = timeheight; + strftime(_timeBuf, sizeof(_timeBuf), "%H:%M", &network.timeinfo); + if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){ + _getTimeBounds(); + _clockTime(); + } + _clockSeconds(); +} + +void DspCore::clearClock(){ + dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+2, clockTimeHeight+1, config.theme.background); +} +#else void DspCore::_clockSeconds(){ setTextSize(3); setTextColor(config.theme.seconds, config.theme.background); setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-clockTimeHeight+1); sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec); if(!config.isScreensaver) print(_bufforseconds); /* print seconds */ - setTextSize(1); - setFont(&DS_DIGI42pt7b); + setNumFont(); setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background); setCursor(_timeleft+_dotsLeft, clockTop); print(":"); /* print dots */ @@ -115,8 +180,7 @@ void DspCore::_clockDate(){ void DspCore::_clockTime(){ if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, clockTimeHeight, config.theme.background); _timeleft = width()-clockRightSpace-CHARWIDTH*3*2-24-_timewidth; - setTextSize(1); - setFont(&DS_DIGI42pt7b); + setNumFont(); if(CLOCKFONT_MONO) { setCursor(_timeleft, clockTop); @@ -155,6 +219,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight, void DspCore::clearClock(){ dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+10+CHARHEIGHT, config.theme.background); } +#endif void DspCore::startWrite(void) { Adafruit_ST7789::startWrite(); @@ -178,7 +243,7 @@ void DspCore::setTextSize(uint8_t s){ } void DspCore::flip(){ -#if DSP_MODEL==DSP_ST7789 +#if DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_76 setRotation(config.store.flipscreen?3:1); #endif #if DSP_MODEL==DSP_ST7789_240 @@ -226,7 +291,11 @@ void DspCore::clearClipping(){ } void DspCore::setNumFont(){ +#if DSP_MODEL==DSP_ST7789_76 + setFont(&DS_DIGI28pt7b); +#else setFont(&DS_DIGI42pt7b); +#endif setTextSize(1); } #endif diff --git a/yoRadio/src/displays/displayST7789.h b/yoRadio/src/displays/displayST7789.h index 933048f..891ebe3 100644 --- a/yoRadio/src/displays/displayST7789.h +++ b/yoRadio/src/displays/displayST7789.h @@ -6,10 +6,18 @@ #include #include -#if CLOCKFONT_MONO - #include "fonts/DS_DIGI42pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/ +#if DSP_MODEL==DSP_ST7789_76 + #if CLOCKFONT_MONO + #include "fonts/DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/ + #else + #include "fonts/DS_DIGI28pt7b.h" + #endif #else - #include "fonts/DS_DIGI42pt7b.h" + #if CLOCKFONT_MONO + #include "fonts/DS_DIGI42pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/ + #else + #include "fonts/DS_DIGI42pt7b.h" + #endif #endif #include "tools/l10n.h" @@ -25,6 +33,8 @@ typedef GFXcanvas16 Canvas; #else #if DSP_MODEL==DSP_ST7789 #include "conf/displayST7789conf.h" + #elif DSP_MODEL==DSP_ST7789_76 + #include "conf/displayST7789_76conf.h" #else #include "conf/displayST7789_240conf.h" #endif diff --git a/yoRadio/src/displays/dspcore.h b/yoRadio/src/displays/dspcore.h index 16ea0d1..bff288f 100644 --- a/yoRadio/src/displays/dspcore.h +++ b/yoRadio/src/displays/dspcore.h @@ -12,7 +12,7 @@ #include "displaySSD1306.h" #elif DSP_MODEL==DSP_NOKIA5110 #include "displayN5110.h" -#elif DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 +#elif DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 || DSP_MODEL==DSP_ST7789_76 #include "displayST7789.h" #elif DSP_MODEL==DSP_SH1106 #include "displaySH1106.h"