This commit is contained in:
e2002
2025-08-03 21:36:48 +03:00
parent 8b1e0a3d25
commit 1c8e5077c0
6 changed files with 182 additions and 26 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 <SPI.h>
#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

View File

@@ -6,10 +6,18 @@
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#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

View File

@@ -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"