From 76c4427fb2ffa2f6c1ce48d6a8554c7ed762a19f Mon Sep 17 00:00:00 2001 From: e2002 Date: Sat, 2 Jul 2022 09:38:33 +0300 Subject: [PATCH] v0.6.355 --- README.md | 6 ++++++ yoRadio/display.h | 2 +- yoRadio/options.h | 5 ++++- yoRadio/src/displays/displayST7789.cpp | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0de321e..8dc68ff 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ https://aliexpress.com/item/32965676064.html - or **SSD1306** 0,91' 128x32 I2C https://aliexpress.com/item/32798439084.html - or **Nokia5110** 84x48 SPI https://aliexpress.com/item/1005001621837569.html - or **ST7789** 2.4' 320x240 SPI https://aliexpress.com/item/32960241206.html +- or **ST7789** 1.3' 240x240 SPI https://aliexpress.com/item/32996979276.html - or **SH1106** 1.3' 128x64 I2C https://aliexpress.com/item/32683094040.html - or **LCD1602** 16x2 I2C https://aliexpress.com/item/32305776560.html - or **LCD1602** 16x2 without I2C https://aliexpress.com/item/32305776560.html @@ -294,6 +295,11 @@ Work is in progress... --- ## Version history +#### v0.6.355 +- added support for ST7789 1.3' 240x240 SPI displays \ + _!!! Important !!! This display requires further development when used in conjunction with the VS1053 module. \ + See this link for details https://www.instructables.com/Adding-CS-Pin-to-13-LCD/_ + #### v0.6.348 - fixed display bugs in the rssibitrate plugin - fixed some compilation warnings diff --git a/yoRadio/display.h b/yoRadio/display.h index 5606317..b0563b4 100644 --- a/yoRadio/display.h +++ b/yoRadio/display.h @@ -14,7 +14,7 @@ #include "src/displays/displaySSD1306.h" #elif DSP_MODEL==DSP_NOKIA5110 #include "src/displays/displayN5110.h" -#elif DSP_MODEL==DSP_ST7789 +#elif DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 #include "src/displays/displayST7789.h" #elif DSP_MODEL==DSP_SH1106 #include "src/displays/displaySH1106.h" diff --git a/yoRadio/options.h b/yoRadio/options.h index 8a8cf91..9bed629 100644 --- a/yoRadio/options.h +++ b/yoRadio/options.h @@ -1,7 +1,7 @@ #ifndef options_h #define options_h -#define VERSION "0.6.348" +#define VERSION "0.6.355" /******************************************************* DO NOT EDIT THIS FILE. @@ -37,6 +37,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti #define DSP_2004 15 // https://aliexpress.com/item/32783128355.html #define DSP_SSD1305I2C 16 // SSD1305 and SSD1309 128x64 I2C https://aliexpress.com/item/32950307344.html #define DSP_ILI9225 17 // 2.0' 220x176 SPI https://aliexpress.com/item/32952021835.html +#define DSP_ST7789_240 18 // 1.3' 240x240 SPI https://aliexpress.com/item/32996979276.html +/* !!! DSP_ST7789_240 requires further development when used in conjunction with the VS1053 module !!! See the link https://www.instructables.com/Adding-CS-Pin-to-13-LCD/ */ + #define DSP_CUSTOM 101 // your display #ifndef DSP_MODEL diff --git a/yoRadio/src/displays/displayST7789.cpp b/yoRadio/src/displays/displayST7789.cpp index 2458821..46891bd 100644 --- a/yoRadio/src/displays/displayST7789.cpp +++ b/yoRadio/src/displays/displayST7789.cpp @@ -1,5 +1,5 @@ #include "../../options.h" -#if DSP_MODEL==4 +#if DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 #include "displayST7789.h" #include @@ -11,7 +11,6 @@ #ifndef DEF_SPI_FREQ #define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */ #endif - const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"}; const char *mnths[12] = {"января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"}; @@ -116,7 +115,7 @@ void DspCore::apScreen() { } void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) { - init(240,320); + init(240,(DSP_MODEL==DSP_ST7789)?320:240); if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ); invertDisplay(TFT_INVERT); cp437(true); @@ -269,6 +268,9 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){ sprintf(timeBuf, "%2d %s %d", timeinfo.tm_mday,mnths[timeinfo.tm_mon], timeinfo.tm_year+1900); setTextSize(1); + uint16_t wdate, hdate; + getTextBounds(timeBuf, 0, 0, &x1, &y1, &wdate, &hdate); + fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, TFT_BG); rightText(utf8Rus(timeBuf,true), cltop+10, TFT_FG, TFT_BG, false, swidth>240?12:0); drawFastVLine(clleft+wot+clsp/2+3, cltop-hot, hot+3, SILVER); drawFastHLine(clleft+wot+clsp/2+3, cltop-hot+29, 42, SILVER);