This commit is contained in:
e2002
2025-08-24 17:58:08 +03:00
parent 383a5d5119
commit 1b644d7895
117 changed files with 1777 additions and 3934 deletions

View File

@@ -235,6 +235,19 @@ Work is in progress...
---
## Version history
#### v0.9.670
- display performance optimization
- to improve rendering smoothness, a framebuffer has been added for TFT SPI displays **ST7735, ST7789, ILI9341, GC9106, ST7796, GC9A01A, ILI9488, ILI9486** \
the framebuffer is applied only to moving elements (scrolling text, VU meter, clock) \
the framebuffer works on modules with additional **PSRAM** \
on such modules, the framebuffer is enabled automatically, no extra steps required \
to disable the framebuffer, add `#define USE_FBUFFER false` in **myoptions.h** \
on modules without PSRAM, the framebuffer is disabled by default. It can be forced on by adding `#define SFBUFFER` in **myoptions.h** \
but in that case, free memory (as well as HTTPS streams) will be severely limited \
- fixed compilation error for Nextion displays
- code cleanup, optimization, and refactoring
- bug fixes
#### v0.9.574
- fixed compilation error for certain displays when `#define DSP_INVERT_TITLE false` is set
- fixed compilation error for `DSP_DUMMY`

View File

@@ -8,7 +8,7 @@
//#define SPI_CHANNEL SPI_2
#endif
#define USE_STRING_CLASS
//#define USE_STRING_CLASS
#ifdef USE_STRING_CLASS
#define STRING String

View File

@@ -161,6 +161,12 @@ void ILI9486_SPI::drawPixel(int16_t x, int16_t y, uint16_t color)
#endif
void ILI9486_SPI::writePixels(uint16_t *colors, uint32_t len) {
_startTransaction();
_writeColor16(colors, len);
_endTransaction();
}
void ILI9486_SPI::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
{
// if ((x < 0) || (y < 0) || (w < 1) || (h < 1) || (x + w > _width) || (y + h > _height))

View File

@@ -23,6 +23,7 @@ class ILI9486_SPI : public Adafruit_GFX
ILI9486_SPI(SPIClass *spiClass, int8_t cs, int8_t dc, int8_t rst);
// (overridden) virtual methods
virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
void writePixels(uint16_t *colors, uint32_t len);
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
@@ -33,6 +34,7 @@ class ILI9486_SPI : public Adafruit_GFX
void setSpiKludge(bool rpi_spi16_mode = true); // call with false before init to disable
void init(void);
void setWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {setWindow(x, y, w, h);}
void pushColors(const uint16_t* data, uint16_t n); // fast one
void setBackLight(bool lit);
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
@@ -42,6 +44,8 @@ class ILI9486_SPI : public Adafruit_GFX
virtual void _endTransaction();
void _writeCommand(uint8_t cmd);
void sendCommand(uint8_t cmd);
void startWrite(void){}
void endWrite(void){}
private:
void _setWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void _writeCommand16(uint16_t cmd);

View File

@@ -1687,23 +1687,24 @@ void Audio::setVUmeter() {
*
* \warning This feature is only available with patches that support VU meter.
*/
const uint8_t everyn = 4;
//const uint8_t everyn = 4;
void Audio::computeVUlevel() {
if(!VS_PATCH_ENABLE) return;
/*if(!VS_PATCH_ENABLE) return;
static uint8_t cc = 0;
cc++;
if(!_vuInitalized || !config.store.vumeter || cc!=everyn) return;
if(cc==everyn) cc=0;
if(cc==everyn) cc=0;*/
int16_t reg = read_register(SCI_AICTRL3);
vuLeft = map((uint8_t)(reg & 0x00FF), 85, 92, 0, 255);
vuRight = map((uint8_t)(reg >> 8), 85, 92, 0, 255);
if(vuLeft>config.vuThreshold) config.vuThreshold = vuLeft;
if(vuLeft>config.vuThreshold) config.vuThreshold=vuLeft;
if(vuRight>config.vuThreshold) config.vuThreshold=vuRight;
}
uint16_t Audio::get_VUlevel(uint16_t dimension){
if(!VS_PATCH_ENABLE) return 0;
if(!_vuInitalized || !config.store.vumeter || config.vuThreshold==0) return 0;
if(!_vuInitalized || !config.store.vumeter/* || config.vuThreshold==0*/) return 0;
computeVUlevel();
uint8_t L = map(vuLeft, config.vuThreshold, 0, 0, dimension);
uint8_t R = map(vuRight, config.vuThreshold, 0, 0, dimension);
return (L << 8) | R;

View File

@@ -51,7 +51,6 @@ bool printable(const char *info) {
void audio_showstation(const char *info) {
bool p = printable(info) && (strlen(info) > 0);(void)p;
//config.setTitle(p?info:config.station.name);
if(player.remoteStationName){
config.setStation(p?info:config.station.name);
display.putRequest(NEWSTATION);
@@ -60,7 +59,6 @@ void audio_showstation(const char *info) {
}
void audio_showstreamtitle(const char *info) {
DBGH();
if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL || strstr(info, "HTTP/1.1 401") != NULL) player.setError(info);
bool p = printable(info) && (strlen(info) > 0);
#ifdef DEBUG_TITLES
@@ -71,9 +69,7 @@ void audio_showstreamtitle(const char *info) {
}
void audio_error(const char *info) {
//config.setTitle(info);
player.setError(info);
//telnet.printf("##ERROR#:\t%s\n", info);
}
void audio_id3artist(const char *info){

View File

@@ -1,12 +1,17 @@
#include <Arduino.h>
#include "options.h"
#include "commandhandler.h"
#include "player.h"
#include "display.h"
#include "netserver.h"
#include "config.h"
#include "controls.h"
#include "options.h"
#include "telnet.h"
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#endif
CommandHandler cmd;
bool CommandHandler::exec(const char *command, const char *value, uint8_t cid) {

View File

@@ -1,8 +1,6 @@
#ifndef commandhandler_h
#define commandhandler_h
#include <Arduino.h>
class CommandHandler {
public:
bool exec(const char *command, const char *value, uint8_t cid=0);

View File

@@ -1,10 +1,11 @@
#ifndef COMMON_H
#define COMMON_H
#pragma once
enum displayMode_e { PLAYER, VOL, STATIONS, NUMBERS, LOST, UPDATING, INFO, SETTINGS, TIMEZONE, WIFI, CLEAR, SLEEPING, SDCHANGE, SCREENSAVER, SCREENBLANK };
enum pages_e : uint8_t { PG_PLAYER=0, PG_DIALOG=1, PG_PLAYLIST=2, PG_SCREENSAVER=3 };
enum displayRequestType_e { BOOTSTRING, NEWMODE, CLOCK, NEWTITLE, NEWSTATION, NEXTSTATION, DRAWPLAYLIST, DRAWVOL, DBITRATE, AUDIOINFO, SHOWVUMETER, DSPRSSI, SHOWWEATHER, NEWWEATHER, PSTOP, PSTART, DSP_START, WAITFORSD, SDFILEINDEX, NEWIP, NOPE };
enum displayRequestType_e { BOOTSTRING, NEWMODE, CLOCK, NEWTITLE, NEWSTATION, NEXTSTATION, DRAWPLAYLIST, CLOSEPLAYLIST, DRAWVOL, DBITRATE, AUDIOINFO, SHOWVUMETER, DSPRSSI, SHOWWEATHER, NEWWEATHER, PSTOP, PSTART, DSP_START, WAITFORSD, SDFILEINDEX, NEWIP, NOPE };
struct requestParams_t
{
displayRequestType_e type;

View File

@@ -1,32 +1,28 @@
#include "options.h"
#include "config.h"
//#include <SPIFFS.h>
#include "display.h"
#include "player.h"
#include "network.h"
#include "netserver.h"
#include "controls.h"
#include "timekeeper.h"
#include "telnet.h"
#include "rtcsupport.h"
#include "../displays/tools/l10n.h"
#ifdef USE_SD
#include "sdmanager.h"
#endif
#ifdef USE_NEXTION
#include "../displays/nextion.h"
#endif
#include <cstddef>
Config config;
#ifdef HEAP_DBG
void printHeapFragmentationInfo(const char* title){
size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT);
size_t largestBlock = heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT);
float fragmentation = 100.0 * (1.0 - ((float)largestBlock / (float)freeHeap));
Serial.printf("\n****** %s ******\n", title);
Serial.printf("* Free heap: %u bytes\n", freeHeap);
Serial.printf("* Largest free block: %u bytes\n", largestBlock);
Serial.printf("* Fragmentation: %.2f%%\n", fragmentation);
Serial.printf("*************************************\n\n");
}
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#endif
Config config;
void u8fix(char *src){
char last = src[strlen(src)-1];
if ((uint8_t)last >= 0xC2) src[strlen(src)-1]='\0';
@@ -143,9 +139,8 @@ void Config::_setupVersion(){
saveValue(&store.version, currentVersion);
}
#ifdef USE_SD
void Config::changeMode(int newmode){
#ifdef USE_SD
bool pir = player.isRunning();
if(SDC_CS==255) return;
if(getMode()==PM_SDCARD) {
@@ -196,9 +191,11 @@ void Config::changeMode(int newmode){
display.resetQueue();
display.putRequest(NEWMODE, PLAYER);
display.putRequest(NEWSTATION);
#endif
}
void Config::initSDPlaylist() {
#ifdef USE_SD
//store.countStation = 0;
bool doIndex = !sdman.exists(INDEX_SD_PATH);
if(doIndex) sdman.indexSDPlaylist();
@@ -212,9 +209,8 @@ void Config::initSDPlaylist() {
index.close();
//saveValue(&store.countStation, store.countStation, true, true);
}
}
#endif //#ifdef USE_SD
}
bool Config::spiffsCleanup(){
bool ret = (SPIFFS.exists(PLAYLIST_SD_PATH)) || (SPIFFS.exists(INDEX_SD_PATH)) || (SPIFFS.exists(INDEX_PATH));
@@ -243,9 +239,9 @@ bool Config::prepareForPlaying(uint16_t stationId){
}
if(!loadStation(stationId)) return false;
setTitle(getMode()==PM_WEB?const_PlConnect:"[next track]");
setTitle(getMode()==PM_WEB?LANG::const_PlConnect:"[next track]");
station.bitrate=0;
setBitrateFormat(BF_UNCNOWN);
setBitrateFormat(BF_UNKNOWN);
display.putRequest(DBITRATE);
display.putRequest(NEWSTATION);
display.putRequest(NEWMODE, PLAYER);
@@ -782,52 +778,6 @@ char * Config::stationByNum(uint16_t num){
return _stationBuf;
}
uint8_t Config::fillPlMenu(int from, uint8_t count, bool fromNextion) {
int ls = from;
uint8_t c = 0;
bool finded = false;
if (playlistLength() == 0) {
return 0;
}
File playlist = SDPLFS()->open(REAL_PLAYL, "r");
File index = SDPLFS()->open(REAL_INDEX, "r");
while (true) {
if (ls < 1) {
ls++;
if(!fromNextion) display.printPLitem(c, "");
#ifdef USE_NEXTION
if(fromNextion) nextion.printPLitem(c, "");
#endif
c++;
continue;
}
if (!finded) {
index.seek((ls - 1) * 4, SeekSet);
uint32_t pos;
index.readBytes((char *) &pos, 4);
finded = true;
index.close();
playlist.seek(pos, SeekSet);
}
bool pla = true;
while (pla) {
pla = playlist.available();
String stationName = playlist.readStringUntil('\n');
stationName = stationName.substring(0, stationName.indexOf('\t'));
if(config.store.numplaylist && stationName.length()>0) stationName = String(from+c)+" "+stationName;
if(!fromNextion) display.printPLitem(c, stationName.c_str());
#ifdef USE_NEXTION
if(fromNextion) nextion.printPLitem(c, stationName.c_str());
#endif
c++;
if (c >= count) break;
}
break;
}
playlist.close();
return c;
}
void Config::escapeQuotes(const char* input, char* output, size_t maxLen) {
size_t j = 0;
for (size_t i = 0; input[i] != '\0' && j < maxLen - 1; ++i) {

View File

@@ -1,22 +1,16 @@
#ifndef config_h
#define config_h
#pragma once
#include "Arduino.h"
#include <SPI.h>
#include <SPIFFS.h>
#include <EEPROM.h>
//#include "SD.h"
#include "options.h"
#include "telnet.h"
#include "rtcsupport.h"
#include "../pluginsManager/pluginsManager.h"
#include "../displays/widgets/widgetsconfig.h" //BitrateFormat
#define EEPROM_SIZE 768
#define EEPROM_START 500
#define EEPROM_START_IR 0
#define EEPROM_START_2 10
#ifndef BUFLEN
#define BUFLEN 170
#endif
#define PLAYLIST_PATH "/data/playlist.csv"
#define SSIDS_PATH "/data/wifi.csv"
#define TMP_PATH "/data/tmpfile.txt"
@@ -25,39 +19,20 @@
#define PLAYLIST_SD_PATH "/data/playlistsd.csv"
#define INDEX_SD_PATH "/data/indexsd.dat"
#ifdef DEBUG_V
#define DBGH() { Serial.printf("[%s:%s:%d] Heap: %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__, xPortGetFreeHeapSize()); }
#define DBGVB( ... ) { char buf[200]; sprintf( buf, __VA_ARGS__ ) ; Serial.print("[DEBUG]\t"); Serial.println(buf); }
#else
#define DBGVB( ... )
#define DBGH()
#endif
#define BOOTLOG( ... ) { char buf[120]; sprintf( buf, __VA_ARGS__ ) ; telnet.print("##[BOOT]#\t"); telnet.printf("%s\n",buf); }
#define EVERY_MS(x) static uint32_t tmr; bool flag = millis() - tmr >= (x); if (flag) tmr += (x); if (flag)
#define REAL_PLAYL getMode()==PM_WEB?PLAYLIST_PATH:PLAYLIST_SD_PATH
#define REAL_INDEX getMode()==PM_WEB?INDEX_PATH:INDEX_SD_PATH
#define REAL_PLAYL config.getMode()==PM_WEB?PLAYLIST_PATH:PLAYLIST_SD_PATH
#define REAL_INDEX config.getMode()==PM_WEB?INDEX_PATH:INDEX_SD_PATH
#define MAX_PLAY_MODE 1
#define WEATHERKEY_LENGTH 58
#define MDNS_LENGTH 24
#if SDC_CS!=255
#define USE_SD
#endif
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
#define ESP_ARDUINO_3 1
#endif
#ifdef HEAP_DBG
#define HEAP_INFO() printHeapFragmentationInfo(__PRETTY_FUNCTION__)
void printHeapFragmentationInfo(const char* title);
#else
#define HEAP_INFO()
#endif
#define CONFIG_VERSION 5
enum playMode_e : uint8_t { PM_WEB=0, PM_SDCARD=1 };
enum BitrateFormat { BF_UNCNOWN, BF_MP3, BF_AAC, BF_FLAC, BF_OGG, BF_WAV };
void u8fix(char *src);
@@ -193,7 +168,7 @@ class Config {
uint8_t irchck;
ircodes_t ircodes;
#endif
BitrateFormat configFmt = BF_UNCNOWN;
BitrateFormat configFmt = BF_UNKNOWN;
neworkItem ssids[5];
uint8_t ssidsCount;
uint16_t sleepfor;
@@ -239,10 +214,8 @@ class Config {
void setBitrateFormat(BitrateFormat fmt) { configFmt = fmt; }
void initPlaylist();
void indexPlaylist();
#ifdef USE_SD
void initSDPlaylist();
void changeMode(int newmode=-1);
#endif
void initSDPlaylist();
void changeMode(int newmode=-1);
uint16_t playlistLength();
uint16_t lastStation(){
return getMode()==PM_WEB?store.lastStation:store.lastSdStation;
@@ -251,7 +224,6 @@ class Config {
if(getMode()==PM_WEB) saveValue(&store.lastStation, newstation);
else saveValue(&store.lastSdStation, newstation);
}
uint8_t fillPlMenu(int from, uint8_t count, bool fromNextion=false);
char * stationByNum(uint16_t num);
void setTimezone(int8_t tzh, int8_t tzm);
void setTimezoneOffset(uint16_t tzo);
@@ -285,9 +257,7 @@ class Config {
bool prepareForPlaying(uint16_t stationId);
void configPostPlaying(uint16_t stationId);
FS* SDPLFS(){ return _SDplaylistFS; }
#if RTCSUPPORTED
bool isRTCFound(){ return _rtcFound; };
#endif
bool isRTCFound(){ return _rtcFound; };
template <typename T>
size_t getAddr(const T *field) const {
return (size_t)((const uint8_t *)field - (const uint8_t *)&store) + EEPROM_START;
@@ -321,9 +291,7 @@ class Config {
template <class T> int eepromWrite(int ee, const T& value);
template <class T> int eepromRead(int ee, T& value);
bool _bootDone;
#if RTCSUPPORTED
bool _rtcFound;
#endif
bool _rtcFound;
FS* _SDplaylistFS;
void setDefaults();
static void doSleep();

View File

@@ -1,16 +1,21 @@
#include "Arduino.h"
#include "controls.h"
#include "options.h"
#include "controls.h"
#include "config.h"
#include "player.h"
#include "display.h"
#include "network.h"
#include "netserver.h"
#include "../pluginsManager/pluginsManager.h"
long encOldPosition = 0;
long enc2OldPosition = 0;
int lpId = -1;
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#endif
#define ISPUSHBUTTONS BTN_LEFT!=255 || BTN_CENTER!=255 || BTN_RIGHT!=255 || ENC_BTNB!=255 || BTN_UP!=255 || BTN_DOWN!=255 || ENC2_BTNB!=255 || BTN_MODE!=255
#if ISPUSHBUTTONS
#include "../OneButton/OneButton.h"
@@ -34,6 +39,7 @@ constexpr uint8_t nrOfButtons = sizeof(button) / sizeof(button[0]);
#endif
#if (ENC_BTNL!=255 && ENC_BTNR!=255) || (ENC2_BTNL!=255 && ENC2_BTNR!=255)
#include "../yoEncoder/yoEncoder.h"
#if (ENC_BTNL!=255 && ENC_BTNR!=255)
yoEncoder encoder = yoEncoder(ENC_BTNL, ENC_BTNR, ENCODER_STEPS, ENC_INTERNALPULLUP);
#endif
@@ -115,7 +121,7 @@ void initControls() {
}
#endif
#if (TS_MODEL!=TS_MODEL_UNDEFINED) && (DSP_MODEL!=DSP_DUMMY)
touchscreen.init();
touchscreen.init(display.width(), display.height());
#endif
#if IR_PIN!=255
pinMode(IR_PIN, INPUT);
@@ -502,7 +508,8 @@ void onBtnClick(int id) {
#ifdef DSP_LCD
delay(200);
#endif
player.sendCommand({PR_PLAY, display.currentPlItem});
display.putRequest(CLOSEPLAYLIST, display.currentPlItem);
//player.sendCommand({PR_PLAY, display.currentPlItem});
}
if(network.status==SOFT_AP || display.mode()==LOST){
#ifdef USE_SD

View File

@@ -1,14 +1,7 @@
#ifndef controls_h
#define controls_h
#include "options.h"
#include "common.h"
#if (ENC_BTNL!=255 && ENC_BTNR!=255) || (ENC2_BTNL!=255 && ENC2_BTNR!=255)
#include "../yoEncoder/yoEncoder.h"
#endif
//enum tsDirection_e { TSD_STAY, TSD_LEFT, TSD_RIGHT, TSD_UP, TSD_DOWN, TDS_REQUEST };
#if IR_PIN!=255
enum : uint8_t { IR_UP=0, IR_PREV=1, IR_PLAY=2, IR_NEXT=3, IR_DOWN=4, IR_1=5, IR_2=6, IR_3=7, IR_4=8, IR_5=9, IR_6=10, IR_7=11, IR_8=12, IR_9=13, IR_AST=14, IR_0=15, IR_HASH=16 };
#endif
@@ -18,12 +11,12 @@ boolean checklpdelay(int m, unsigned long &tstamp);
void initControls();
void loopControls();
#if (ENC_BTNL!=255 && ENC_BTNR!=255) || (ENC2_BTNL!=255 && ENC2_BTNR!=255)
class yoEncoder;
void encodersLoop(yoEncoder *enc, bool first=true);
#endif
void encoder1Loop();
void encoder2Loop();
void irLoop();
//void touchLoop();
void irNumber(uint8_t num);
void irBlink();
void controlsEvent(bool toRight, int8_t volDelta = 0);
@@ -33,7 +26,6 @@ void onBtnDoubleClick(int id);
void onBtnDuringLongPress(int id);
void onBtnLongPressStart(int id);
void onBtnLongPressStop(int id);
//tsDirection_e tsDirection(uint16_t x, uint16_t y);
void setIRTolerance(uint8_t tl);
void setEncAcceleration(uint16_t acc);

View File

@@ -1,15 +1,22 @@
#include "Arduino.h"
#include "options.h"
#include "WiFi.h"
#include "time.h"
#include "config.h"
#include "display.h"
#include "player.h"
#include "network.h"
#include "netserver.h"
#include "timekeeper.h"
#include "../pluginsManager/pluginsManager.h"
#include "../displays/dspcore.h"
#include "../displays/widgets/widgets.h"
#include "../displays/widgets/pages.h"
#include "../displays/tools/l10n.h"
Display display;
#ifdef USE_NEXTION
#include "../displays/nextion.h"
Nextion nextion;
#endif
@@ -76,6 +83,18 @@ void returnPlayer(){
display.putRequest(NEWMODE, PLAYER);
}
Display::~Display() {
delete _pager;
delete _footer;
delete _plwidget;
delete _nums;
delete _clock;
delete _meta;
delete _title1;
delete _title2;
delete _plcurrent;
}
void Display::init() {
Serial.print("##[BOOT]#\tdisplay.init\t");
#ifdef USE_NEXTION
@@ -93,30 +112,57 @@ void Display::init() {
while(!_bootStep==0) { delay(10); }
//_pager.begin();
//_bootScreen();
_pager = new Pager();
_footer = new Page();
_plwidget = new PlayListWidget();
_nums = new NumWidget();
_clock = new ClockWidget();
_meta = new ScrollWidget();
_title1 = new ScrollWidget();
_plcurrent = new ScrollWidget();
Serial.println("done");
}
uint16_t Display::width(){ return dsp.width(); }
uint16_t Display::height(){ return dsp.height(); }
#if TIME_SIZE>19
#if DSP_MODEL==DSP_SSD1322
#define BOOT_PRG_COLOR WHITE
#define BOOT_TXT_COLOR WHITE
#define PINK WHITE
#elif DSP_MODEL==DSP_SSD1327
#define BOOT_PRG_COLOR 0x07
#define BOOT_TXT_COLOR 0x3f
#define PINK 0x02
#else
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
#endif
#endif
void Display::_bootScreen(){
_boot = new Page();
_boot->addWidget(new ProgressWidget(bootWdtConf, bootPrgConf, BOOT_PRG_COLOR, 0));
_bootstring = (TextWidget*) &_boot->addWidget(new TextWidget(bootstrConf, 50, true, BOOT_TXT_COLOR, 0));
_pager.addPage(_boot);
_pager.setPage(_boot, true);
_pager->addPage(_boot);
_pager->setPage(_boot, true);
dsp.drawLogo(bootLogoTop);
_bootStep = 1;
}
void Display::_buildPager(){
_meta.init("*", metaConf, config.theme.meta, config.theme.metabg);
_title1.init("*", title1Conf, config.theme.title1, config.theme.background);
_clock.init(clockConf, 0, 0);
_meta->init("*", metaConf, config.theme.meta, config.theme.metabg);
_title1->init("*", title1Conf, config.theme.title1, config.theme.background);
_clock->init(clockConf, 0, 0);
#if DSP_MODEL==DSP_NOKIA5110
_plcurrent.init("*", playlistConf, 0, 1);
_plcurrent->init("*", playlistConf, 0, 1);
#else
_plcurrent.init("*", playlistConf, config.theme.plcurrent, config.theme.plcurrentbg);
_plcurrent->init("*", playlistConf, config.theme.plcurrent, config.theme.plcurrentbg);
#endif
_plwidget->init(_plcurrent);
#if !defined(DSP_LCD)
_plcurrent.moveTo({TFT_FRAMEWDT, (uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight), (int16_t)playlistConf.width});
_plcurrent->moveTo({TFT_FRAMEWDT, (uint16_t)(_plwidget->currentTop()), (int16_t)playlistConf.width});
#endif
#ifndef HIDE_TITLE2
_title2 = new ScrollWidget("*", title2Conf, config.theme.title2, config.theme.background);
@@ -151,20 +197,20 @@ void Display::_buildPager(){
#ifndef HIDE_RSSI
_rssi = new TextWidget(rssiConf, 20, false, config.theme.rssi, config.theme.background);
#endif
_nums.init(numConf, 10, false, config.theme.digit, config.theme.background);
_nums->init(numConf, 10, false, config.theme.digit, config.theme.background);
#ifndef HIDE_WEATHER
_weather = new ScrollWidget("\007", weatherConf, config.theme.weather, config.theme.background);
#endif
if(_volbar) _footer.addWidget( _volbar);
if(_voltxt) _footer.addWidget( _voltxt);
if(_volip) _footer.addWidget( _volip);
if(_rssi) _footer.addWidget( _rssi);
if(_heapbar) _footer.addWidget( _heapbar);
if(_volbar) _footer->addWidget( _volbar);
if(_voltxt) _footer->addWidget( _voltxt);
if(_volip) _footer->addWidget( _volip);
if(_rssi) _footer->addWidget( _rssi);
if(_heapbar) _footer->addWidget( _heapbar);
if(_metabackground) pages[PG_PLAYER]->addWidget( _metabackground);
pages[PG_PLAYER]->addWidget(&_meta);
pages[PG_PLAYER]->addWidget(&_title1);
pages[PG_PLAYER]->addWidget(_meta);
pages[PG_PLAYER]->addWidget(_title1);
if(_title2) pages[PG_PLAYER]->addWidget(_title2);
if(_weather) pages[PG_PLAYER]->addWidget(_weather);
#if BITRATE_FULL
@@ -175,31 +221,31 @@ void Display::_buildPager(){
pages[PG_PLAYER]->addWidget( _bitrate);
#endif
if(_vuwidget) pages[PG_PLAYER]->addWidget( _vuwidget);
pages[PG_PLAYER]->addWidget(&_clock);
pages[PG_SCREENSAVER]->addWidget(&_clock);
pages[PG_PLAYER]->addPage(&_footer);
pages[PG_PLAYER]->addWidget(_clock);
pages[PG_SCREENSAVER]->addWidget(_clock);
pages[PG_PLAYER]->addPage(_footer);
if(_metabackground) pages[PG_DIALOG]->addWidget( _metabackground);
pages[PG_DIALOG]->addWidget(&_meta);
pages[PG_DIALOG]->addWidget(&_nums);
pages[PG_DIALOG]->addWidget(_meta);
pages[PG_DIALOG]->addWidget(_nums);
#if !defined(DSP_LCD) && DSP_MODEL!=DSP_NOKIA5110
pages[PG_DIALOG]->addPage(&_footer);
pages[PG_DIALOG]->addPage(_footer);
#endif
#if !defined(DSP_LCD)
if(_plbackground) {
pages[PG_PLAYLIST]->addWidget( _plbackground);
_plbackground->setHeight(dsp.plItemHeight);
_plbackground->moveTo({0,(uint16_t)(dsp.plYStart+dsp.plCurrentPos*dsp.plItemHeight-playlistConf.widget.textsize*2), (int16_t)playlBGConf.width});
_plbackground->setHeight(_plwidget->itemHeight());
_plbackground->moveTo({0,(uint16_t)(_plwidget->currentTop()-playlistConf.widget.textsize*2), (int16_t)playlBGConf.width});
}
#endif
pages[PG_PLAYLIST]->addWidget(&_plcurrent);
for(const auto& p: pages) _pager.addPage(p);
pages[PG_PLAYLIST]->addWidget(_plcurrent);
pages[PG_PLAYLIST]->addWidget(_plwidget);
for(const auto& p: pages) _pager->addPage(p);
}
void Display::_apScreen() {
if(_boot) _pager.removePage(_boot);
if(_boot) _pager->removePage(_boot);
#ifndef DSP_LCD
_boot = new Page();
#if DSP_MODEL!=DSP_NOKIA5110
@@ -212,24 +258,24 @@ void Display::_apScreen() {
ScrollWidget *bootTitle = (ScrollWidget*) &_boot->addWidget(new ScrollWidget("*", apTitleConf, config.theme.meta, config.theme.metabg));
bootTitle->setText("ёRadio AP Mode");
TextWidget *apname = (TextWidget*) &_boot->addWidget(new TextWidget(apNameConf, 30, false, config.theme.title1, config.theme.background));
apname->setText(apNameTxt);
apname->setText(LANG::apNameTxt);
TextWidget *apname2 = (TextWidget*) &_boot->addWidget(new TextWidget(apName2Conf, 30, false, config.theme.clock, config.theme.background));
apname2->setText(apSsid);
TextWidget *appass = (TextWidget*) &_boot->addWidget(new TextWidget(apPassConf, 30, false, config.theme.title1, config.theme.background));
appass->setText(apPassTxt);
appass->setText(LANG::apPassTxt);
TextWidget *appass2 = (TextWidget*) &_boot->addWidget(new TextWidget(apPass2Conf, 30, false, config.theme.clock, config.theme.background));
appass2->setText(apPassword);
ScrollWidget *bootSett = (ScrollWidget*) &_boot->addWidget(new ScrollWidget("*", apSettConf, config.theme.title2, config.theme.background));
bootSett->setText(config.ipToStr(WiFi.softAPIP()), apSettFmt);
_pager.addPage(_boot);
_pager.setPage(_boot);
bootSett->setText(config.ipToStr(WiFi.softAPIP()), LANG::apSettFmt);
_pager->addPage(_boot);
_pager->setPage(_boot);
#else
dsp.apScreen();
#endif
}
void Display::_start() {
if(_boot) _pager.removePage(_boot);
if(_boot) _pager->removePage(_boot);
#ifdef USE_NEXTION
nextion.wake();
#endif
@@ -247,19 +293,19 @@ void Display::_start() {
#endif
_buildPager();
_mode = PLAYER;
config.setTitle(const_PlReady);
config.setTitle(LANG::const_PlReady);
if(_heapbar) _heapbar->lock(!config.store.audioinfo);
if(_weather) _weather->lock(!config.store.showweather);
if(_weather && config.store.showweather) _weather->setText(const_getWeather);
if(_weather && config.store.showweather) _weather->setText(LANG::const_getWeather);
if(_vuwidget) _vuwidget->lock();
if(_rssi) _setRSSI(WiFi.RSSI());
#ifndef HIDE_IP
if(_volip) _volip->setText(config.ipToStr(WiFi.localIP()), iptxtFmt);
#endif
_pager.setPage( pages[PG_PLAYER]);
_pager->setPage( pages[PG_PLAYER]);
_volume();
_station();
_time(false);
@@ -269,12 +315,12 @@ void Display::_start() {
void Display::_showDialog(const char *title){
dsp.setScrollId(NULL);
_pager.setPage( pages[PG_DIALOG]);
_pager->setPage( pages[PG_DIALOG]);
#ifdef META_MOVE
_meta.moveTo(metaMove);
_meta->moveTo(metaMove);
#endif
_meta.setAlign(WA_CENTER);
_meta.setText(title);
_meta->setAlign(WA_CENTER);
_meta->setText(title);
}
void Display::_swichMode(displayMode_e newmode) {
@@ -287,29 +333,30 @@ void Display::_swichMode(displayMode_e newmode) {
dsp.setScrollId(NULL);
if (newmode == PLAYER) {
if(player.isRunning())
_clock.moveTo(clockMove);
_clock->moveTo(clockMove);
else
_clock.moveBack();
_clock->moveBack();
#ifdef DSP_LCD
dsp.clearDsp();
#endif
numOfNextStation = 0;
#ifdef META_MOVE
_meta.moveBack();
_meta->moveBack();
#endif
_meta.setAlign(metaConf.widget.align);
_meta.setText(config.station.name);
_nums.setText("");
_meta->setAlign(metaConf.widget.align);
_meta->setText(config.station.name);
_nums->setText("");
config.isScreensaver = false;
_pager.setPage( pages[PG_PLAYER]);
_pager->setPage( pages[PG_PLAYER]);
config.setDspOn(config.store.dspon, false);
pm.on_display_player();
}
if (newmode == SCREENSAVER || newmode == SCREENBLANK) {
config.isScreensaver = true;
_pager.setPage( pages[PG_SCREENSAVER]);
_pager->setPage( pages[PG_SCREENSAVER]);
if (newmode == SCREENBLANK) {
dsp.clearClock();
//dsp.clearClock();
_clock->clear();
config.setDspOn(false, false);
}
}else{
@@ -319,21 +366,21 @@ void Display::_swichMode(displayMode_e newmode) {
}
if (newmode == VOL) {
#ifndef HIDE_IP
_showDialog(const_DlgVolume);
_showDialog(LANG::const_DlgVolume);
#else
_showDialog(config.ipToStr(WiFi.localIP()));
#endif
_nums.setText(config.store.volume, numtxtFmt);
_nums->setText(config.store.volume, numtxtFmt);
}
if (newmode == LOST) _showDialog(const_DlgLost);
if (newmode == UPDATING) _showDialog(const_DlgUpdate);
if (newmode == LOST) _showDialog(LANG::const_DlgLost);
if (newmode == UPDATING) _showDialog(LANG::const_DlgUpdate);
if (newmode == SLEEPING) _showDialog("SLEEPING");
if (newmode == SDCHANGE) _showDialog(const_waitForSD);
if (newmode == INFO || newmode == SETTINGS || newmode == TIMEZONE || newmode == WIFI) _showDialog(const_DlgNextion);
if (newmode == SDCHANGE) _showDialog(LANG::const_waitForSD);
if (newmode == INFO || newmode == SETTINGS || newmode == TIMEZONE || newmode == WIFI) _showDialog(LANG::const_DlgNextion);
if (newmode == NUMBERS) _showDialog("");
if (newmode == STATIONS) {
_pager.setPage( pages[PG_PLAYLIST]);
_plcurrent.setText("");
_pager->setPage( pages[PG_PLAYLIST]);
_plcurrent->setText("");
currentPlItem = config.lastStation();
_drawPlaylist();
}
@@ -345,18 +392,15 @@ void Display::resetQueue(){
}
void Display::_drawPlaylist() {
dsp.drawPlaylist(currentPlItem);
//dsp.drawPlaylist(currentPlItem);
_plwidget->drawPlaylist(currentPlItem);
timekeeper.waitAndReturnPlayer(30);
}
void Display::_drawNextStationNum(uint16_t num) {
timekeeper.waitAndReturnPlayer(30);
_meta.setText(config.stationByNum(num));
_nums.setText(num, "%d");
}
void Display::printPLitem(uint8_t pos, const char* item){
dsp.printPLitem(pos, item, _plcurrent);
_meta->setText(config.stationByNum(num));
_nums->setText(num, "%d");
}
void Display::putRequest(displayRequestType_e type, int payload){
@@ -374,32 +418,32 @@ void Display::_layoutChange(bool played){
if(config.store.vumeter){
if(played){
if(_vuwidget) _vuwidget->unlock();
_clock.moveTo(clockMove);
_clock->moveTo(clockMove);
if(_weather) _weather->moveTo(weatherMoveVU);
}else{
if(_vuwidget) if(!_vuwidget->locked()) _vuwidget->lock();
_clock.moveBack();
_clock->moveBack();
if(_weather) _weather->moveBack();
}
}else{
if(played){
if(_weather) _weather->moveTo(weatherMove);
_clock.moveBack();
_clock->moveBack();
}else{
if(_weather) _weather->moveBack();
_clock.moveBack();
_clock->moveBack();
}
}
}
void Display::loop() {
if(_bootStep==0) {
_pager.begin();
_pager->begin();
_bootScreen();
return;
}
if(displayQueue==NULL || _locked) return;
_pager.loop();
_pager->loop();
#ifdef USE_NEXTION
nextion.loop();
#endif
@@ -410,6 +454,7 @@ void Display::loop() {
if(pm_result)
switch (request.type){
case NEWMODE: _swichMode((displayMode_e)request.payload); break;
case CLOSEPLAYLIST: player.sendCommand({PR_PLAY, request.payload});
case CLOCK:
if(_mode==PLAYER || _mode==SCREENSAVER) _time();
/*#ifdef USE_NEXTION
@@ -447,7 +492,7 @@ void Display::loop() {
if(_volip) _volip->setText(config.ipToStr(WiFi.localIP()), iptxtFmt);
#endif
}else{
if(_weather) _weather->setText(const_getWeather);
if(_weather) _weather->setText(LANG::const_getWeather);
}
break;
}
@@ -456,7 +501,7 @@ void Display::loop() {
break;
}
case BOOTSTRING: {
if(_bootstring) _bootstring->setText(config.ssids[request.payload].ssid, bootstrFmt);
if(_bootstring) _bootstring->setText(config.ssids[request.payload].ssid, LANG::bootstrFmt);
/*#ifdef USE_NEXTION
char buf[50];
snprintf(buf, 50, bootstrFmt, config.ssids[request.payload].ssid);
@@ -465,11 +510,11 @@ void Display::loop() {
break;
}
case WAITFORSD: {
if(_bootstring) _bootstring->setText(const_waitForSD);
if(_bootstring) _bootstring->setText(LANG::const_waitForSD);
break;
}
case SDFILEINDEX: {
if(_mode == SDCHANGE) _nums.setText(request.payload, "%d");
if(_mode == SDCHANGE) _nums->setText(request.payload, "%d");
break;
}
case DSPRSSI: if(_rssi){ _setRSSI(request.payload); } if (_heapbar && config.store.audioinfo) _heapbar->setValue(player.isRunning()?player.inBufferFilled():0); break;
@@ -492,9 +537,11 @@ void Display::loop() {
}
dsp.loop();
/*
#if I2S_DOUT==255
player.computeVUlevel();
#endif
*/
}
void Display::_setRSSI(int rssi) {
@@ -514,8 +561,8 @@ void Display::_setRSSI(int rssi) {
}
void Display::_station() {
_meta.setAlign(metaConf.widget.align);
_meta.setText(config.station.name);
_meta->setAlign(metaConf.widget.align);
_meta->setText(config.station.name);
/*#ifdef USE_NEXTION
nextion.newNameset(config.station.name);
nextion.bitrate(config.station.bitrate);
@@ -536,10 +583,10 @@ void Display::_title() {
strlcpy(tmpbuf, config.station.title, strlen(config.station.title)+1);
char *stitle = split(tmpbuf, " - ");
if(stitle && _title2){
_title1.setText(tmpbuf);
_title1->setText(tmpbuf);
_title2->setText(stitle);
}else{
_title1.setText(config.station.title);
_title1->setText(config.station.title);
if(_title2) _title2->setText("");
}
/*#ifdef USE_NEXTION
@@ -547,7 +594,7 @@ void Display::_title() {
#endif*/
}else{
_title1.setText("");
_title1->setText("");
if(_title2) _title2->setText("");
}
if (player_on_track_change) player_on_track_change();
@@ -563,14 +610,17 @@ void Display::_time(bool redraw) {
}
#endif
if(config.isScreensaver && network.timeinfo.tm_sec % 60 == 0){
#ifdef GXCLOCKFONT
uint16_t ft=static_cast<uint16_t>(random(TFT_FRAMEWDT, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2-clockConf.textsize)));
#if TIME_SIZE<19
uint16_t ft=static_cast<uint16_t>(random(TFT_FRAMEWDT, (dsp.height()-TIME_SIZE*CHARHEIGHT-TFT_FRAMEWDT)));
#else
uint16_t ft=static_cast<uint16_t>(random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2)));
uint16_t ft=static_cast<uint16_t>(random(TFT_FRAMEWDT+TIME_SIZE, (dsp.height()-_clock->dateSize()-TFT_FRAMEWDT*2)));
#endif
_clock.moveTo({clockConf.left, ft, 0});
uint16_t lt=static_cast<uint16_t>(random(TFT_FRAMEWDT, (dsp.width()-_clock->clockWidth()-TFT_FRAMEWDT)));
if(clockConf.align==WA_CENTER) lt-=(dsp.width()-_clock->clockWidth())/2;
//_clock->moveTo({clockConf.left, ft, 0});
_clock->moveTo({lt, ft, 0});
}
_clock.draw();
_clock->draw();
/*#ifdef USE_NEXTION
nextion.printClock(network.timeinfo);
#endif*/
@@ -583,7 +633,7 @@ void Display::_volume() {
#endif
if(_mode==VOL) {
timekeeper.waitAndReturnPlayer(3);
_nums.setText(config.store.volume, numtxtFmt);
_nums->setText(config.store.volume, numtxtFmt);
}
/*#ifdef USE_NEXTION
nextion.setVol(config.store.volume, _mode == VOL);
@@ -617,6 +667,7 @@ void Display::wakeup(){
#else // !DUMMYDISPLAY
//============================================================================================================================
void Display::init(){
_createDspTask();
#ifdef USE_NEXTION
nextion.begin(true);
#endif
@@ -626,8 +677,9 @@ void Display::_start(){
//nextion.putcmd("page player");
nextion.start();
#endif
config.setTitle(const_PlReady);
config.setTitle(LANG::const_PlReady);
}
void Display::putRequest(displayRequestType_e type, int payload){
if(type==DSP_START) _start();
#ifdef USE_NEXTION

View File

@@ -1,21 +1,24 @@
#ifndef display_h
#define display_h
#include "options.h"
#include "Arduino.h"
#include "config.h"
#include "common.h"
#include "../displays/dspcore.h"
#if NEXTION_RX!=255 && NEXTION_TX!=255
#define USE_NEXTION
#include "../displays/nextion.h"
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#endif
//static void loopDspTask(void * pvParameters);
#ifndef DUMMYDISPLAY
class ScrollWidget;
class PlayListWidget;
class BitrateWidget;
class FillWidget;
class SliderWidget;
class Pager;
class Page;
class VuWidget;
class NumWidget;
class ClockWidget;
class TextWidget;
class Display {
public:
uint16_t currentPlItem;
@@ -23,6 +26,7 @@ class Display {
displayMode_e _mode;
public:
Display() {};
~Display();
displayMode_e mode() { return _mode; }
void mode(displayMode_e m) { _mode=m; }
void init();
@@ -36,22 +40,21 @@ class Display {
bool deepsleep();
void wakeup();
void setContrast();
void printPLitem(uint8_t pos, const char* item);
void lock() { _locked=true; }
void unlock() { _locked=false; }
uint16_t width();
uint16_t height();
private:
ScrollWidget _meta, _title1, _plcurrent;
ScrollWidget *_weather;
ScrollWidget *_title2;
ScrollWidget *_meta, *_title1, *_plcurrent, *_weather, *_title2;
PlayListWidget *_plwidget;
BitrateWidget *_fullbitrate;
FillWidget *_metabackground, *_plbackground;
SliderWidget *_volbar, *_heapbar;
Pager _pager;
Page _footer;
Pager *_pager;
Page *_footer;
VuWidget *_vuwidget;
NumWidget _nums;
ProgressWidget _testprogress;
ClockWidget _clock;
NumWidget *_nums;
ClockWidget *_clock;
Page *_boot;
TextWidget *_bootstring, *_volip, *_voltxt, *_rssi, *_bitrate;
bool _locked = false;
@@ -99,6 +102,8 @@ class Display {
void printPLitem(uint8_t pos, const char* item){}
void lock() {}
void unlock() {}
uint16_t width(){ return 0; }
uint16_t height(){ return 0; }
private:
void _createDspTask();
};

View File

@@ -1,11 +1,10 @@
#include "mqtt.h"
#include "options.h"
#ifdef MQTT_ROOT_TOPIC
#include "WiFi.h"
#include "telnet.h"
#include "player.h"
#include "config.h"
#include "mqtt.h"
#include "WiFi.h"
#include "player.h"
AsyncMqttClient mqttClient;
TimerHandle_t mqttReconnectTimer;

View File

@@ -1,6 +1,5 @@
#ifndef mqtt_h
#define mqtt_h
#include "options.h"
#ifdef MQTT_ROOT_TOPIC
#include "../async-mqtt-client/AsyncMqttClient.h"

View File

@@ -1,18 +1,22 @@
#include "netserver.h"
#include "options.h"
#include "Arduino.h"
#include <SPIFFS.h>
#include <Update.h>
#include "config.h"
#include "netserver.h"
#include "player.h"
#include "telnet.h"
#include "display.h"
#include "options.h"
#include "network.h"
#include "mqtt.h"
#include "controls.h"
#include "commandhandler.h"
#include "timekeeper.h"
#include <Update.h>
#include "../displays/widgets/widgetsconfig.h" //BitrateFormat
//#include <Ticker.h>
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#endif
#ifdef USE_SD
#include "sdmanager.h"
@@ -29,6 +33,12 @@
#define NS_QUEUE_TICKS 0
#endif
#ifdef DEBUG_V
#define DBGVB( ... ) { char buf[200]; sprintf( buf, __VA_ARGS__ ) ; Serial.print("[DEBUG]\t"); Serial.println(buf); }
#else
#define DBGVB( ... )
#endif
//#define CORS_DEBUG //Enable CORS policy: 'Access-Control-Allow-Origin' (for testing)
NetServer netserver;

View File

@@ -1,9 +1,6 @@
#ifndef netserver_h
#define netserver_h
#include "Arduino.h"
#include "config.h"
#include "../AsyncWebServer/ESPAsyncWebServer.h"
#define APPEND_GROUP(name) strcat(nsBuf, "\"" name "\",")
enum requestType_e : uint8_t { PLAYLIST=1, STATION=2, STATIONNAME=3, ITEM=4, TITLE=5, VOLUME=6, NRSSI=7, BITRATE=8, MODE=9, EQUALIZER=10, BALANCE=11, PLAYLISTSAVED=12, STARTUP=13, GETINDEX=14, GETACTIVE=15, GETSYSTEM=16, GETSCREEN=17, GETTIMEZONE=18, GETWEATHER=19, GETCONTROLS=20, DSPON=21, SDPOS=22, SDLEN=23, SDSNUFFLE=24, SDINIT=25, GETPLAYERMODE=26, CHANGEMODE=27 };

View File

@@ -1,13 +1,16 @@
#include "options.h"
#include <ESPmDNS.h>
#include "time.h"
#include "rtcsupport.h"
#include "network.h"
#include "display.h"
#include "options.h"
#include "config.h"
#include "telnet.h"
#include "netserver.h"
#include "player.h"
#include "mqtt.h"
#include "timekeeper.h"
#include <ESPmDNS.h>
#include "../pluginsManager/pluginsManager.h"
#ifndef WIFI_ATTEMPTS
#define WIFI_ATTEMPTS 16

View File

@@ -1,11 +1,6 @@
#ifndef network_h
#define network_h
#include "time.h"
#include "WiFi.h"
#include "rtcsupport.h"
#define apSsid "yoRadioAP"
#define apPassword "12345987"
#include <WiFi.h>
enum n_Status_e { CONNECTED, SOFT_AP, FAILED, SDREADY };

View File

@@ -1,7 +1,8 @@
#ifndef options_h
#define options_h
#pragma once
#define YOVERSION "0.9.574"
#define YOVERSION "0.9.670"
/*******************************************************
DO NOT EDIT THIS FILE.
@@ -73,7 +74,12 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef TFT_DC
#define TFT_DC 4
#endif
#ifndef USE_FBUFFER
#define USE_FBUFFER true
#endif
#ifndef FULL_SCR_CLOCK
#define FULL_SCR_CLOCK true
#endif
/* NEXTION */
#ifndef NEXTION_RX
#define NEXTION_RX 255
@@ -81,7 +87,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef NEXTION_TX
#define NEXTION_TX 255
#endif
#if NEXTION_RX!=255 && NEXTION_TX!=255
#define USE_NEXTION
#endif
/* OLED I2C DISPLAY */
#ifndef I2C_SDA
#define I2C_SDA 21
@@ -128,7 +136,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef SD_HSPI
#define SD_HSPI false // use HSPI for SD (miso=12, mosi=13, clk=14) instead of VSPI (by default)
#endif
#if SDC_CS!=255
#define USE_SD
#endif
/* ENCODER */
#ifndef ENC_BTNL
#define ENC_BTNL 255
@@ -408,7 +418,7 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#define COLOR_DAY_OF_W 255, 255, 255
#endif
#ifndef COLOR_DATE
#define COLOR_DATE 255, 255, 255
#define COLOR_DATE 165, 162, 132
#endif
#ifndef COLOR_HEAP
#define COLOR_HEAP 41, 40, 41
@@ -513,5 +523,14 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef CONNECTION_TIMEOUT_SSL
#define CONNECTION_TIMEOUT_SSL 5700
#endif
#ifndef apSsid
#define apSsid "yoRadioAP"
#endif
#ifndef apPassword
#define apPassword "12345987"
#endif
#ifndef BUFLEN
#define BUFLEN 170
#endif
#endif

View File

@@ -6,7 +6,11 @@
#include "sdmanager.h"
#include "netserver.h"
#include "timekeeper.h"
#include "../displays/tools/l10n.h"
#include "../pluginsManager/pluginsManager.h"
#ifdef USE_NEXTION
#include "../displays/nextion.h"
#endif
Player player;
QueueHandle_t playerQueue;
@@ -97,9 +101,9 @@ void Player::_stop(bool alreadyStopped){
if(config.getMode()==PM_SDCARD && !alreadyStopped) config.sdResumePos = player.getFilePos();
_status = STOPPED;
setOutputPins(false);
if(!_hasError) config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":const_PlStopped);
if(!_hasError) config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":LANG::const_PlStopped);
config.station.bitrate = 0;
config.setBitrateFormat(BF_UNCNOWN);
config.setBitrateFormat(BF_UNKNOWN);
#ifdef USE_NEXTION
nextion.bitrate(config.station.bitrate);
#endif
@@ -250,7 +254,7 @@ void Player::browseUrl(){
resumeAfterUrl = _status==PLAYING;
display.putRequest(PSTOP);
setOutputPins(false);
config.setTitle(const_PlConnect);
config.setTitle(LANG::const_PlConnect);
if (connecttohost(burl)){
_status = PLAYING;
config.setTitle("");

View File

@@ -1,6 +1,5 @@
#ifndef player_h
#define player_h
#include "options.h"
#if I2S_DOUT!=255 || I2S_INTERNAL
#include "../audioI2S/AudioEx.h"
@@ -13,13 +12,9 @@
#endif
#ifndef PLQ_SEND_DELAY
//#define PLQ_SEND_DELAY portMAX_DELAY
#define PLQ_SEND_DELAY pdMS_TO_TICKS(1000)
#define PLQ_SEND_DELAY pdMS_TO_TICKS(1000) //portMAX_DELAY
#endif
//#define PLERR_LN 64
//#define SET_PLAY_ERROR(...) {char buff[512 + 64]; sprintf(buff,__VA_ARGS__); setError(buff);}
enum playerRequestType_e : uint8_t { PR_PLAY = 1, PR_STOP = 2, PR_PREV = 3, PR_NEXT = 4, PR_VOL = 5, PR_CHECKSD = 6, PR_VUTONUS = 7, PR_BURL = 8, PR_TOGGLE = 9 };
struct playerRequestParams_t
{

View File

@@ -1,3 +1,4 @@
#include "options.h"
#include "rtcsupport.h"
#if RTCSUPPORTED

View File

@@ -1,8 +1,7 @@
#ifndef rtcsupport_h
#define rtcsupport_h
#include "options.h"
#define RTCSUPPORTED (RTC_SDA!=255 && RTC_SCL!=255 && (RTC_MODULE==DS3231 || RTC_MODULE==DS1307))
#define RTCSUPPORTED (RTC_SDA!=255 && RTC_SCL!=255 && (RTC_MODULE==DS3231 || RTC_MODULE==DS1307))
#if RTCSUPPORTED
#include "RTClib.h"

View File

@@ -1,6 +1,12 @@
#include "options.h"
#if SDC_CS!=255
#define USE_SD
#include <Arduino.h>
#include <SPI.h>
#include <SD.h>
#include "vfs_api.h"
#include "sd_diskio.h"
//#define USE_SD
#include "config.h"
#include "sdmanager.h"
#include "display.h"
#include "player.h"

View File

@@ -1,11 +1,5 @@
#ifndef sdmanager_h
#define sdmanager_h
#include <Arduino.h>
#include <SPI.h>
#include <SD.h>
#include "vfs_api.h"
#include "sd_diskio.h"
#include "options.h"
class SDManager : public SDFS {
public:

View File

@@ -1,11 +1,10 @@
#include "options.h"
#include <stdarg.h>
#include "WiFi.h"
#include "config.h"
#include "player.h"
#include "network.h"
#include "telnet.h"
#include "esp_heap_caps.h"
//#include "esp_heap_caps.h"
Telnet telnet;

View File

@@ -1,9 +1,9 @@
#ifndef telnet_h
#define telnet_h
#include <WiFi.h>
#define MAX_TLN_CLIENTS 5
#define BOOTLOG( ... ) { char buf[120]; sprintf( buf, __VA_ARGS__ ) ; telnet.printf("##[BOOT]#\t%s\n",buf); }
class Telnet {
public:

View File

@@ -1,11 +1,20 @@
#include "timekeeper.h"
#include "options.h"
#include "Arduino.h"
#include "timekeeper.h"
#include "config.h"
#include "network.h"
#include "display.h"
#include "player.h"
#include "netserver.h"
#include "rtcsupport.h"
#include "../displays/tools/l10n.h"
#include "../pluginsManager/pluginsManager.h"
#ifdef USE_NEXTION
#include "../displays/nextion.h"
#endif
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#endif
#if RTCSUPPORTED
//#define TIME_SYNC_INTERVAL 24*60*60*1000
@@ -17,7 +26,24 @@
#define SYNC_STACK_SIZE 1024 * 4
#define SYNC_TASK_CORE 0
#define SYNC_TASK_PRIORITY 1
#define SYNC_TASK_PRIORITY 3
#define WEATHER_STRING_L 254
#ifdef HEAP_DBG
void printHeapFragmentationInfo(const char* title){
size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT);
size_t largestBlock = heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT);
float fragmentation = 100.0 * (1.0 - ((float)largestBlock / (float)freeHeap));
Serial.printf("\n****** %s ******\n", title);
Serial.printf("* Free heap: %u bytes\n", freeHeap);
Serial.printf("* Largest free block: %u bytes\n", largestBlock);
Serial.printf("* Fragmentation: %.2f%%\n", fragmentation);
Serial.printf("*************************************\n\n");
}
#define HEAP_INFO() printHeapFragmentationInfo(__PRETTY_FUNCTION__)
#else
#define HEAP_INFO()
#endif
TimeKeeper timekeeper;
@@ -55,7 +81,8 @@ bool TimeKeeper::loop0(){ // core0 (display)
static uint32_t _last5s = 0;
if (currentTime - _last1s >= 1000) { // 1sec
_last1s = currentTime;
#ifndef DUMMYDISPLAY
//#ifndef DUMMYDISPLAY
#if !defined(DUMMYDISPLAY) || defined(USE_NEXTION)
#ifndef UPCLOCK_CORE1
_upClock();
#endif
@@ -80,7 +107,8 @@ bool TimeKeeper::loop1(){ // core1 (player)
if (currentTime - _last1s >= 1000) { // 1sec
pm.on_ticker();
_last1s = currentTime;
#ifndef DUMMYDISPLAY
//#ifndef DUMMYDISPLAY
#if !defined(DUMMYDISPLAY) || defined(USE_NEXTION)
#ifdef UPCLOCK_CORE1
_upClock();
#endif
@@ -94,7 +122,8 @@ bool TimeKeeper::loop1(){ // core1 (player)
_last2s = currentTime;
}
#ifdef DUMMYDISPLAY
//#ifdef DUMMYDISPLAY
#if defined(DUMMYDISPLAY) && !defined(USE_NEXTION)
return true;
#endif
// Sync weather & time
@@ -150,8 +179,10 @@ void TimeKeeper::_upClock(){
#if RTCSUPPORTED
if(config.isRTCFound()){
rtc.getTime(&network.timeinfo);
mktime(&network.timeinfo);
if(display.ready()) display.putRequest(CLOCK);
if(network.timeinfo.tm_year>100){
mktime(&network.timeinfo);
if(display.ready()) display.putRequest(CLOCK);
}
}
#else
if(network.timeinfo.tm_year>100 || network.status == SDREADY) {
@@ -173,6 +204,7 @@ void TimeKeeper::_upScreensaver(){
}else{
display.putRequest(NEWMODE, SCREENSAVER);
}
config.screensaverTicks=SCREENSAVERSTARTUPDELAY;
}
}
if(config.store.screensaverPlayingEnabled && display.mode()==PLAYER && player.isRunning()){
@@ -183,6 +215,7 @@ void TimeKeeper::_upScreensaver(){
}else{
display.putRequest(NEWMODE, SCREENSAVER);
}
config.screensaverPlayingTicks=SCREENSAVERSTARTUPDELAY;
}
}
#endif
@@ -251,7 +284,7 @@ bool _getWeather() {
weatherClient->onDisconnect([](void * arg, AsyncClient * c){ weatherClient = NULL; delete c; }, NULL);
char httpget[250] = {0};
sprintf(httpget, "GET /data/2.5/weather?lat=%s&lon=%s&units=%s&lang=%s&appid=%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", config.store.weatherlat, config.store.weatherlon, weatherUnits, weatherLang, config.store.weatherkey, host);
sprintf(httpget, "GET /data/2.5/weather?lat=%s&lon=%s&units=%s&lang=%s&appid=%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", config.store.weatherlat, config.store.weatherlon, LANG::weatherUnits, LANG::weatherLang, config.store.weatherkey, host);
client->write(httpget);
client->onData([](void * arg, AsyncClient * c, void * data, size_t len){
@@ -318,9 +351,9 @@ bool _getWeather() {
sprintf(timekeeper.weatherBuf, weatherFmt, tempf, press, hum);
#else
#if EXT_WEATHER
sprintf(timekeeper.weatherBuf, weatherFmt, desc, tempf, tempfl, press, hum, wind_speed, wind[(int)(wind_deg/22.5)]);
sprintf(timekeeper.weatherBuf, LANG::weatherFmt, desc, tempf, tempfl, press, hum, wind_speed, LANG::wind[(int)(wind_deg/22.5)]);
#else
sprintf(timekeeper.weatherBuf, weatherFmt, desc, tempf, press, hum);
sprintf(timekeeper.weatherBuf, LANG::weatherFmt, desc, tempf, press, hum);
#endif
#endif
display.putRequest(NEWWEATHER);

View File

@@ -1,8 +1,6 @@
#ifndef timekeeper_h
#define timekeeper_h
#include "Arduino.h"
#define WEATHER_STRING_L 254
#pragma once
void _syncTask(void * pvParameters);
bool _getWeather();

View File

@@ -1,6 +1,6 @@
#include "options.h"
#if (TS_MODEL!=TS_MODEL_UNDEFINED) && (DSP_MODEL!=DSP_DUMMY)
#include "Arduino.h"
#include "touchscreen.h"
#include "config.h"
#include "controls.h"
@@ -36,7 +36,7 @@
typedef TP_Point TSPoint;
#endif
void TouchScreen::init(){
void TouchScreen::init(uint16_t w, uint16_t h){
#if TS_MODEL==TS_MODEL_XPT2046
#ifdef TS_SPIPINS
@@ -55,8 +55,8 @@ void TouchScreen::init(){
ts.begin();
ts.setRotation(config.store.fliptouch?0:2);
#endif
_width = dsp.width();
_height = dsp.height();
_width = w;
_height = h;
#if TS_MODEL==TS_MODEL_GT911
ts.setResolution(_width, _height);
#endif

View File

@@ -1,13 +1,12 @@
#ifndef touchscreen_h
#define touchscreen_h
#include "Arduino.h"
enum tsDirection_e { TSD_STAY, TSD_LEFT, TSD_RIGHT, TSD_UP, TSD_DOWN, TDS_REQUEST };
class TouchScreen {
public:
TouchScreen() {}
void init();
void init(uint16_t w, uint16_t h);
void loop();
void flip();
private:

View File

@@ -16,7 +16,7 @@
#define HIDE_TITLE2
#define HIDE_VOL
#define bootLogoTop 68
#define bootLogoTop 5
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 4, 30 };
@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 19, 1, WA_RIGHT };
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
//const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 80-13, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 29+32, 35, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 29+32, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 20, 1, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { 0, 32, 1, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { 0, 46, 1, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { 0, 58, 1, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 29+34, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 20, 29+34, 0, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 50, 1, WA_CENTER };
@@ -62,7 +62,7 @@ const char rssiFmt[] PROGMEM = "%d";
const char bitrateFmt[] PROGMEM = "%d";
/* MOVES */ /* { left, top, width } */
const MoveConfig clockMove PROGMEM = { 14, 29+34, 0};
const MoveConfig clockMove PROGMEM = { 6, 29+34, 0};
const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 80-13, MAX_WIDTH-6*3-30 };
const MoveConfig weatherMoveVU PROGMEM = { 30, 80-13, MAX_WIDTH-6*3-30 };

View File

@@ -37,12 +37,12 @@ const WidgetConfig bitrateConf PROGMEM = { 134, 23, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { 80, 12, 1, WA_CENTER };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 214, 1, WA_CENTER };
const WidgetConfig rssiConf PROGMEM = { 134, 23, 1, WA_LEFT };
const WidgetConfig numConf PROGMEM = { 0, 120+30+20, 52, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 120+30+20, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 96, 2, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 118, 2, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 146, 2, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 168, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 176, 52, WA_CENTER }; /* 52 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 0, 176, 0, WA_CENTER };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT+20, 188, 1, WA_CENTER };
const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };

View File

@@ -28,7 +28,7 @@ const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 40, 1, WA_LEFT }, 1
const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 80, 2, WA_LEFT }, 140, true, DSP_WIDTH+10, 1000, 4, 30 };
const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_CENTER }, 140, false, MAX_WIDTH, 0, 4, 30 };
const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, DSP_HEIGHT-TFT_FRAMEWDT-16, 2, WA_LEFT }, 140, false, DSP_WIDTH+10, 0, 3, 25 };
const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 50, 2, WA_LEFT }, 140, true, DSP_WIDTH+10, 0, 4, 30 };
const ScrollConfig weatherConf PROGMEM = {{ TFT_FRAMEWDT, 56, 2, WA_LEFT }, 140, true, DSP_WIDTH+10, 0, 4, 30 };
/* BACKGROUNDS */ /* {{ left, top, fontsize, align }, width, height, outlined } */
const FillConfig metaBGConf PROGMEM = {{ 0, 0, 0, WA_LEFT }, DSP_WIDTH, 22, false };
@@ -43,12 +43,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT+6, DSP_HEIGHT-TFT_FRA
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_CENTER };
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, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 38, 2, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 62, 2, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 102, 2, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 126, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 12, 120, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { TFT_FRAMEWDT*3, 130, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 58, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 130, 1, WA_CENTER };
@@ -65,8 +65,8 @@ const char voltxtFmt[] PROGMEM = "\023\025%d";
const char bitrateFmt[] PROGMEM = "%d kBs";
/* MOVES */ /* { left, top, width } */
const MoveConfig clockMove PROGMEM = { 2, 120, 0 };
const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 58, DSP_WIDTH+10 };
const MoveConfig clockMove PROGMEM = { TFT_FRAMEWDT*2, 130, 0 };
const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 64, DSP_WIDTH+10 };
const MoveConfig weatherMoveVU PROGMEM = { TFT_FRAMEWDT+46, 58, DSP_WIDTH+10-46 };
#endif

View File

@@ -41,12 +41,12 @@ const WidgetConfig bitrateConf PROGMEM = { 70, 191, 1, WA_LEFT };
const WidgetConfig voltxtConf PROGMEM = { 0, 214, 1, WA_CENTER };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 214, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 214-6, 2, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 120+30, 52, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 120+30, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 66, 2, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 90, 2, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 130, 2, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 154, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 12, 176, 52, WA_RIGHT }; /* 52 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { TFT_FRAMEWDT*2, 176, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 100, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };

View File

@@ -42,12 +42,12 @@ const WidgetConfig bitrateConf PROGMEM = { 6, 62, 2, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { 0, DSP_HEIGHT-38, 2, WA_CENTER };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-38, 2, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-38-6, 3, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 200, 70, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 200, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 88, 3, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 120, 3, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 173, 3, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 205, 3, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 16, 224, 70, WA_RIGHT }; /* 52 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { TFT_FRAMEWDT*2, 230, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 136, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 216, 1, WA_CENTER };
@@ -65,7 +65,7 @@ const char voltxtFmt[] PROGMEM = "\023\025%d";
const char bitrateFmt[] PROGMEM = "%d kBs";
/* MOVES */ /* { left, top, width } */
const MoveConfig clockMove PROGMEM = { 0, 176, -1 };
const MoveConfig clockMove PROGMEM = { 0, 230, -1 };
const MoveConfig weatherMove PROGMEM = { 8, 120, MAX_WIDTH };
const MoveConfig weatherMoveVU PROGMEM = { 89, 120, 381 };

View File

@@ -39,12 +39,12 @@ const FillConfig volbarConf PROGMEM = {{ 0, 45, 0, WA_LEFT }, MAX_WIDTH, 3
const WidgetConfig bootstrConf PROGMEM = { 0, 48-7, 1, WA_CENTER };
const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 8, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { 0, 48-11, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 34, 19, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 34, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 8, 1, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { 0, 16, 1, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { 0, 24, 1, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { 0, 32, 1, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 4, 35, 19, WA_RIGHT }; /* 19 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 4, 35, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 50, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 48-7-10, 1, WA_CENTER };

View File

@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { 0, 19, 1, WA_RIGHT };
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 64-9, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { 0, 64-9, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 28, 2, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 28, 0, 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, 38, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 6, 38, 0, WA_CENTER };
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 64-8*2-5, 1, WA_CENTER };

View File

@@ -16,7 +16,7 @@
#define HIDE_VOL
#define HIDE_VU
#define bootLogoTop 68
#define bootLogoTop 8
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT+1, TFT_FRAMEWDT+1, 1, WA_LEFT }, 140, true, MAX_WIDTH-2, 5000, 2, 25 };
@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { 0, 13, 1, WA_RIGHT };
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { 0, 64-11, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { 0, 64-11, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 26, 2, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 26, 0, 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 = { 6, 34, 0, WA_CENTER };
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 64-8*2-5, 1, WA_CENTER };

View File

@@ -16,7 +16,7 @@
#define HIDE_VOL
#define HIDE_VU
#define bootLogoTop 68
#define bootLogoTop 8
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, 0, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 15 };
@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { 0, 17, 1, WA_RIGHT };
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { 0, 64-11, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { 0, 64-11, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 28, 2, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 28, 0, 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, 36, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 6, 36, 0, WA_CENTER };
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 64-8*2-5, 1, WA_CENTER };

View File

@@ -41,12 +41,12 @@ const WidgetConfig bitrateConf PROGMEM = { 0, 11, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { 0, 20, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { 0, 64-11, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { 0, 64-11, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 12, 2, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 12, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 9, 1, WA_LEFT };
const WidgetConfig apName2Conf PROGMEM = { 0, 9, 1, WA_RIGHT };
const WidgetConfig apPassConf PROGMEM = { 0, 17, 1, WA_LEFT };
const WidgetConfig apPass2Conf PROGMEM = { 0, 17, 1, WA_RIGHT };
const WidgetConfig clockConf PROGMEM = { 0, 1, 1, WA_RIGHT };
const WidgetConfig clockConf PROGMEM = { 0, 1, 0, WA_RIGHT };
//const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 32-8*2-5, 1, WA_CENTER };

View File

@@ -17,7 +17,7 @@
#define HIDE_VU
//#define HIDE_TITLE2
#define bootLogoTop 68
#define bootLogoTop 8
/* 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 };
@@ -41,13 +41,13 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT+20, 64-11-10, 1, WA_L
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { 0, 64-12, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { 0, 64-11-10, 1, WA_LEFT };
const WidgetConfig numConf PROGMEM = { TFT_FRAMEWDT, 57, 35, WA_CENTER };
const WidgetConfig numConf PROGMEM = { TFT_FRAMEWDT, 57, 0, 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 clockConf PROGMEM = { 0, 57, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 64-8*2-5, 1, WA_CENTER };

View File

@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 36, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { TFT_FRAMEWDT, 128-10, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 86, 35, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 86, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 40, 1, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { 0, 54, 1, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { 0, 74, 1, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { 0, 88, 1, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 94, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 0, 94, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 99, 1, WA_CENTER };
const WidgetConfig bootWdtConf PROGMEM = { 0, 90, 1, WA_CENTER };

View File

@@ -12,7 +12,7 @@
#define TFT_FRAMEWDT 4
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
#define bootLogoTop 68
#define bootLogoTop 34
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 30 };
@@ -37,12 +37,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 36, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { TFT_FRAMEWDT, 128-10, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 86, 35, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 86, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 40, 1, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { 0, 54, 1, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { 0, 74, 1, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { 0, 88, 1, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 94, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 0, 94, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 99, 1, WA_CENTER };
const WidgetConfig bootWdtConf PROGMEM = { 0, 90, 1, WA_CENTER };

View File

@@ -16,7 +16,7 @@
#else
#define TITLE_FIX 0
#endif
#define bootLogoTop 68
#define bootLogoTop 34
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 30 };
@@ -41,12 +41,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 26, 1, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_CENTER };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 86, 35, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 86, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 40, 1, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { 0, 54, 1, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { 0, 74, 1, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { 0, 88, 1, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 94, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 0, 94, 0, WA_CENTER };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 54, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 90, 1, WA_CENTER };

View File

@@ -16,7 +16,7 @@
#define HIDE_TITLE2
#define HIDE_VOL
#define bootLogoTop 68
#define bootLogoTop 5
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 30 };
@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 19, 1, WA_RIGHT };
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
//const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 108, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 80-13, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 29+32, 35, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 29+32, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { 0, 20, 1, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { 0, 32, 1, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { 0, 46, 1, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { 0, 58, 1, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 29+34, 35, WA_RIGHT }; /* 35 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 20, 29+34, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 50, 1, WA_CENTER };
@@ -62,7 +62,7 @@ const char rssiFmt[] PROGMEM = "%d";
const char bitrateFmt[] PROGMEM = "%d";
/* MOVES */ /* { left, top, width } */
const MoveConfig clockMove PROGMEM = { 14, 29+34, 0};
const MoveConfig clockMove PROGMEM = { 6, 29+34, 0};
const MoveConfig weatherMove PROGMEM = { TFT_FRAMEWDT, 80-13, MAX_WIDTH-6*3-30 };
const MoveConfig weatherMoveVU PROGMEM = { 30, 80-13, MAX_WIDTH-6*3-30 };

View File

@@ -38,12 +38,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT, 188, 1, WA_LEFT };
const WidgetConfig voltxtConf PROGMEM = { 80, 214, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 214, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 214-6, 2, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 120+30, 52, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 120+30, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 66, 2, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 90, 2, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 130, 2, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 154, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 168, 52, WA_RIGHT }; /* 52 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 0, 168, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 94, 1, WA_CENTER };
const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };

View File

@@ -18,7 +18,7 @@
//#define HIDE_VU
//#define HIDE_TITLE2
#define bootLogoTop 68
#define bootLogoTop 8
/* 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 };
@@ -42,13 +42,12 @@ const WidgetConfig bitrateConf PROGMEM = { TFT_FRAMEWDT+20, 64-11-10, 1, WA_L
//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 numConf PROGMEM = { TFT_FRAMEWDT, 57, 0, 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 clockConf PROGMEM = { 0, 57, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { 2, DSP_HEIGHT-14, 1, WA_CENTER };
const WidgetConfig bootWdtConf PROGMEM = { 0, DSP_HEIGHT-8*2-5, 1, WA_CENTER };

View File

@@ -44,12 +44,12 @@ const WidgetConfig bitrateConf PROGMEM = { 70, 191, 1, WA_LEFT };
const WidgetConfig voltxtConf PROGMEM = { 0, 214, 1, WA_CENTER };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, 214, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, 208, 2, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 120+30, 52, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 120+30, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 66, 2, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 90, 2, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 130, 2, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 154, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 8, 176, 52, WA_RIGHT }; /* 52 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { 8, 176, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 100, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };

View File

@@ -42,12 +42,12 @@ const WidgetConfig bitrateConf PROGMEM = { 6, 62, 2, WA_RIGHT };
const WidgetConfig voltxtConf PROGMEM = { 0, DSP_HEIGHT-38, 2, WA_CENTER };
const WidgetConfig iptxtConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-38, 2, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { TFT_FRAMEWDT, DSP_HEIGHT-38-6, 3, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 200, 70, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 200, 0, WA_CENTER };
const WidgetConfig apNameConf PROGMEM = { TFT_FRAMEWDT, 88, 3, WA_CENTER };
const WidgetConfig apName2Conf PROGMEM = { TFT_FRAMEWDT, 120, 3, WA_CENTER };
const WidgetConfig apPassConf PROGMEM = { TFT_FRAMEWDT, 173, 3, WA_CENTER };
const WidgetConfig apPass2Conf PROGMEM = { TFT_FRAMEWDT, 205, 3, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 16, 224, 70, WA_RIGHT }; /* 52 is a fixed font size. do not change */
const WidgetConfig clockConf PROGMEM = { TFT_FRAMEWDT*2, 230, 0, WA_RIGHT };
const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 136, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 216, 1, WA_CENTER };

View File

@@ -16,7 +16,7 @@
#define HIDE_VOL
#define HIDE_VU
#define bootLogoTop 68
#define bootLogoTop 8
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT+1, TFT_FRAMEWDT+1, 1, WA_LEFT }, 140, true, MAX_WIDTH-2, 5000, 6, 250 };
@@ -40,12 +40,12 @@ const WidgetConfig bitrateConf PROGMEM = { 0, 13, 1, WA_RIGHT };
//const WidgetConfig voltxtConf PROGMEM = { 32, 108, 1, WA_RIGHT };
const WidgetConfig iptxtConf PROGMEM = { 0, 64-11, 1, WA_LEFT };
const WidgetConfig rssiConf PROGMEM = { 0, 64-11, 1, WA_RIGHT };
const WidgetConfig numConf PROGMEM = { 0, 26, 2, WA_CENTER };
const WidgetConfig numConf PROGMEM = { 0, 26, 0, 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 = { 0, 34, 2, WA_CENTER };
const WidgetConfig clockConf PROGMEM = { 0, 34, 0, WA_CENTER };
const WidgetConfig vuConf PROGMEM = { 1, 28, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 64-8*2-5, 1, WA_CENTER };

View File

@@ -1,10 +1,7 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_GC9106
#include "displayGC9106.h"
#include "fonts/bootlogo40.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 24000000 /* set it to 0 for system default */
@@ -16,176 +13,18 @@ DspCore::DspCore(): Adafruit_GC9106Ex(&SPI2, TFT_DC, TFT_CS, TFT_RST) {}
DspCore::DspCore(): Adafruit_GC9106Ex(TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
begin(DEF_SPI_FREQ);
cp437(true);
invert();
flip();
setTextWrap(false);
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) {
drawRGBBitmap((width() - 62) / 2, 5, bootlogo40, 62, 40);
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(black?0:config.theme.background);
}
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI28pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
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(":"); /* print dots */
setFont();
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, 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+CHARWIDTH*3*2+24, clockTimeHeight+11+CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) {
Adafruit_GC9106Ex::startWrite();
}
void DspCore::endWrite(void) {
Adafruit_GC9106Ex::endWrite();
}
void DspCore::loop(bool force) { }
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?1:3);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { sendCommand(GC9106_SLPIN); delay(150); sendCommand(GC9106_DISPOFF); delay(150); }
void DspCore::wake(void) { sendCommand(GC9106_DISPON); delay(150); sendCommand(GC9106_SLPOUT); delay(150); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_GC9106Ex::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_GC9106Ex::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI28pt7b);
setTextSize(1);
}
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ setRotation(config.store.flipscreen?1:3); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ sendCommand(GC9106_SLPIN); delay(150); sendCommand(GC9106_DISPOFF); delay(150); }
void DspCore::wake(void){ sendCommand(GC9106_DISPON); delay(150); sendCommand(GC9106_SLPOUT); delay(150); }
#endif

View File

@@ -5,20 +5,13 @@
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include "../Adafruit_GC9106Ex/Adafruit_GC9106Ex.h" // https://github.com/prenticedavid/Adafruit_GC9102_kbv
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI28pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo62x40.h"
#include "fonts/dsfont35.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_GC9106Ex yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayGC9106conf_custom.h")
#include "conf/displayGC9106conf_custom.h"
@@ -26,14 +19,4 @@ typedef GFXcanvas16 Canvas;
#include "conf/displayGC9106conf.h"
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public Adafruit_GC9106Ex {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,11 +1,7 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_GC9A01A
#include "displayGC9A01A.h"
//#include <SPI.h>
#include "fonts/bootlogo.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */
@@ -17,8 +13,6 @@ DspCore::DspCore(): Adafruit_GC9A01A(&SPI2, TFT_CS, TFT_DC, TFT_RST) {}
DspCore::DspCore(): Adafruit_GC9A01A(TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
begin();
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
@@ -28,206 +22,12 @@ void DspCore::initDisplay() {
setTextWrap(false);
setTextSize(1);
fillScreen(0x0000);
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) { drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64); }
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ if(ROTATE_90) setRotation(config.store.flipscreen?3:1); else setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(!config.store.invertdisplay); }
void DspCore::sleep(void){enableSleep(true); delay(150); enableDisplay(false); delay(150); }
void DspCore::wake(void){ enableDisplay(true); delay(150); enableSleep(false); delay(150); }
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) { fillScreen(black?0:config.theme.background); }
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI42pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
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);
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 */
setFont();
}
void DspCore::_clockDate(){
if(_olddateleft>0)
dsp.fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
setTextColor(config.theme.date, config.theme.background);
setCursor(_dateleft, clockTop+10);
if(!config.isScreensaver) print(_dateBuf); /* print date */
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
_olddatewidth = _datewidth;
_olddateleft = _dateleft;
setTextSize(3);
setTextColor(config.theme.dow, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-CHARHEIGHT*3+4);
print(utf8Rus(dow[network.timeinfo.tm_wday], false)); /* print dow */
}
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;
clearClock();
setTextSize(1);
setFont(&DS_DIGI42pt7b);
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;
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
_datewidth = strlen(_dateBuf) * CHARWIDTH;
//_dateleft = width() - 8 - clockRightSpace - _datewidth;
_dateleft = (width() - _datewidth)/2;
}
void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight, bool redraw){
clockTop = top;
clockRightSpace = (width()-_timewidth-CHARWIDTH*3*2-36)/2;//rightspace;
clockTimeHeight = timeheight;
strftime(_timeBuf, sizeof(_timeBuf), "%H:%M", &network.timeinfo);
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
_getTimeBounds();
clockRightSpace = (width()-_timewidth-CHARWIDTH*3*2-36)/2;
_clockTime();
if(!config.isScreensaver)
/*if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) */_clockDate();
}
_clockSeconds();
}
void DspCore::clearClock(){
if(_oldtimeleft>0){
dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight, _oldtimewidth+CHARWIDTH*3*2+24, clockTimeHeight+10+CHARHEIGHT, config.theme.background);
}else{
dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+10+CHARHEIGHT, config.theme.background);
}
}
void DspCore::startWrite(void) {
Adafruit_GC9A01A::startWrite();
}
void DspCore::endWrite(void) {
Adafruit_GC9A01A::endWrite();
}
void DspCore::loop(bool force) {
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
if(ROTATE_90){
setRotation(config.store.flipscreen?3:1);
}else{
setRotation(config.store.flipscreen?2:0);
}
}
void DspCore::invert(){
invertDisplay(!config.store.invertdisplay);
}
void DspCore::sleep(void) {
enableSleep(true); delay(150); enableDisplay(false); delay(150);
}
void DspCore::wake(void) {
enableDisplay(true); delay(150); enableSleep(false); delay(150);
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_GC9A01A::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_GC9A01A::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI42pt7b);
setTextSize(1);
}
#endif

View File

@@ -5,20 +5,13 @@
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include "../Adafruit_GC9A01A/Adafruit_GC9A01A.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
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo99x64.h"
#include "fonts/dsfont52.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_GC9A01A yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayGC9A01Aconf_custom.h")
#include "conf/displayGC9A01Aconf_custom.h"
@@ -26,14 +19,4 @@ typedef GFXcanvas16 Canvas;
#include "conf/displayGC9A01Aconf.h"
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public Adafruit_GC9A01A {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,19 +1,14 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_ILI9225
#include "displayILI9225.h"
#include "dspcore.h"
#include <SPI.h>
#include "fonts/bootlogo.h"
#include "../core/config.h"
#include "../core/network.h"
extern unsigned char yofont5x7[];
extern unsigned char yofont10x14[];
DspCore::DspCore(): TFT_22_ILI9225(TFT_RST, TFT_DC, TFT_CS, 0) {}
#include "tools/utf8RusGFX.h"
void DspCore::setTextSize(uint8_t s){
if(s==2){
setFont(yofont10x14, true);
@@ -87,187 +82,12 @@ void DspCore::initDisplay() {
invert();
flip();
setTextSize(1);
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) {
drawBitmap((width() - 99) / 2, top, bootlogo2, 99, 64);
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
clear(black?0x0000:config.theme.background);
}
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI28pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(2);
setTextColor(config.theme.seconds, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*2*2, clockTop-clockTimeHeight+1);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
}
void DspCore::_clockDate(){
if(_olddateleft>0)
fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
setTextColor(config.theme.date, config.theme.background);
setCursor(_dateleft, clockTop+10);
if(!config.isScreensaver) print(_dateBuf); /* print date */
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
_olddatewidth = _datewidth;
_olddateleft = _dateleft;
setTextSize(2);
setTextColor(config.theme.dow, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*2*2, clockTop-CHARHEIGHT*2+4);
print(utf8Rus(dow[network.timeinfo.tm_wday], false)); /* print dow */
}
void DspCore::_clockTime(){
if(_oldtimeleft>0 && !CLOCKFONT_MONO) fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, clockTimeHeight, config.theme.background);
_timeleft = width()-clockRightSpace-CHARWIDTH*2*2-24-_timewidth;
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;
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*2*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*2*2-18, clockTop-clockTimeHeight+21, 32, config.theme.div); /*divider hor*/
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
_datewidth = strlen(_dateBuf) * CHARWIDTH;
_dateleft = width() - 8 - clockRightSpace - _datewidth;
}
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();
if(!config.isScreensaver)
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
}
_clockSeconds();
}
void DspCore::clearClock(){
fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+11+CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) {
TFT_22_ILI9225::startWrite();
}
void DspCore::endWrite(void) {
TFT_22_ILI9225::endWrite();
}
void DspCore::loop(bool force) {
//delay(5);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap, int16_t w, int16_t h) {
drawBitmap(x, y, bitmap, w, h);
}
void DspCore::flip(){
setOrientation(config.store.flipscreen?3:1);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { setDisplay(false); }
void DspCore::wake(void) { setDisplay(true); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) { }
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { }
uint16_t DspCore::drawChar(uint16_t x, uint16_t y, uint16_t ch, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) {
return cfont.width;
}
}
uint16_t ret=TFT_22_ILI9225::drawChar(x, y, ch, color);
return ret;
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setTextSize(1);
setFont(&DS_DIGI28pt7b);
}
void DspCore::clearDsp(bool black){ clear(black?0x0000:config.theme.background); }
void DspCore::flip(){ setOrientation(config.store.flipscreen?3:1); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ setDisplay(false); }
void DspCore::wake(void){ setDisplay(true); }
#endif

View File

@@ -4,20 +4,13 @@
//==================================================
#include "Arduino.h"
#include "../ILI9225Fix/TFT_22_ILI9225Fix.h"
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI28pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo99x64.h"
#include "fonts/dsfont35.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef TFT_22_ILI9225 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayILI9225conf_custom.h")
#include "conf/displayILI9225conf_custom.h"
@@ -25,14 +18,4 @@ typedef GFXcanvas16 Canvas;
#include "conf/displayILI9225conf.h"
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public TFT_22_ILI9225 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,10 +1,7 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_ILI9341
#include "displayILI9341.h"
#include "fonts/bootlogo.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#if DSP_HSPI
DspCore::DspCore(): Adafruit_ILI9341(&SPI2, TFT_DC, TFT_CS, TFT_RST) {}
@@ -12,198 +9,18 @@ DspCore::DspCore(): Adafruit_ILI9341(&SPI2, TFT_DC, TFT_CS, TFT_RST) {}
DspCore::DspCore(): Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
begin(); /* SPI_DEFAULT_FREQ 40000000 */
invert();
cp437(true);
flip();
setTextWrap(false);
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) {
drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64);
}
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ setRotation(config.store.flipscreen?1:3); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ sendCommand(ILI9341_SLPIN); delay(150); sendCommand(ILI9341_DISPOFF); delay(150);}
void DspCore::wake(void){ sendCommand(ILI9341_DISPON); delay(150); sendCommand(ILI9341_SLPOUT); delay(150);}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) { fillScreen(black?0:config.theme.background); }
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI42pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
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);
setTextSize(1);
setFont(&DS_DIGI42pt7b);
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 */
setFont(); /* print seconds */
}
void DspCore::_clockDate(){
if(_olddateleft>0)
dsp.fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
setTextColor(config.theme.date, config.theme.background);
setCursor(_dateleft, clockTop+10);
if(!config.isScreensaver) print(_dateBuf); /* print date */
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
_olddatewidth = _datewidth;
_olddateleft = _dateleft;
setTextSize(3);
setTextColor(config.theme.dow, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-CHARHEIGHT*3+4);
print(utf8Rus(dow[network.timeinfo.tm_wday], false)); /* print dow */
}
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);
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;
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
_datewidth = strlen(_dateBuf) * CHARWIDTH;
_dateleft = width() - 8 - clockRightSpace - _datewidth;
}
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();
if(!config.isScreensaver)
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
}
_clockSeconds();
}
void DspCore::clearClock(){
dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+10+CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) {
Adafruit_ILI9341::startWrite();
}
void DspCore::endWrite(void) {
Adafruit_ILI9341::endWrite();
}
void DspCore::loop(bool force) { }
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?1:3);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { sendCommand(ILI9341_SLPIN); delay(150); sendCommand(ILI9341_DISPOFF); delay(150);}
void DspCore::wake(void) { sendCommand(ILI9341_DISPON); delay(150); sendCommand(ILI9341_SLPOUT); delay(150);}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ILI9341::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ILI9341::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI42pt7b);
setTextSize(1);
}
#endif

View File

@@ -1,24 +1,16 @@
#ifndef displayILI9341_h
#define displayILI9341_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.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
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo99x64.h"
#include "fonts/dsfont52.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_ILI9341 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayILI9341conf_custom.h")
#include "conf/displayILI9341conf_custom.h"
@@ -26,14 +18,4 @@ typedef GFXcanvas16 Canvas;
#include "conf/displayILI9341conf.h"
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public Adafruit_ILI9341 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,11 +1,7 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_ILI9488 || DSP_MODEL==DSP_ILI9486
#include "displayILI9488.h"
//#include <SPI.h>
#include "fonts/bootlogo.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */
@@ -17,8 +13,6 @@
DspCore::DspCore(): ILI9486_SPI(TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
setSpiKludge(false);
init();
@@ -29,196 +23,12 @@ void DspCore::initDisplay() {
fillScreen(0x0000);
invert();
flip();
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) { drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64); }
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ setRotation(config.store.flipscreen?3:1); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ sendCommand(ILI9488_SLPIN); delay(150); sendCommand(ILI9488_DISPOFF); delay(150); }
void DspCore::wake(void){ sendCommand(ILI9488_DISPON); delay(150); sendCommand(ILI9488_SLPOUT); delay(150); }
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) { fillScreen(black?0:config.theme.background); }
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI56pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(4);
setTextColor(config.theme.seconds, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*4*2, clockTop-clockTimeHeight+1);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
setTextSize(1);
setFont(&DS_DIGI56pt7b);
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 */
setFont();
}
void DspCore::_clockDate(){
if(_olddateleft>0)
dsp.fillRect(_olddateleft, clockTop+14, _olddatewidth, CHARHEIGHT*2, config.theme.background);
setTextColor(config.theme.date, config.theme.background);
setCursor(_dateleft, clockTop+15);
setTextSize(2);
if(!config.isScreensaver) print(_dateBuf); /* print date */
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
_olddatewidth = _datewidth;
_olddateleft = _dateleft;
setTextSize(4);
setTextColor(config.theme.dow, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*4*2, clockTop-CHARHEIGHT*4+4);
print(utf8Rus(dow[network.timeinfo.tm_wday], false)); /* print dow */
}
void DspCore::_clockTime(){
if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, clockTimeHeight, config.theme.background);
_timeleft = width()-clockRightSpace-CHARWIDTH*4*2-24-_timewidth;
setTextSize(1);
setFont(&DS_DIGI56pt7b);
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;
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight, clockTimeHeight+4, config.theme.div); /*divider vert*/
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight+37, 59, config.theme.div); /*divider hor*/
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
_datewidth = strlen(_dateBuf) * CHARWIDTH*2;
_dateleft = width() - 10 - clockRightSpace - _datewidth;
}
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();
if(!config.isScreensaver)
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
}
_clockSeconds();
}
void DspCore::clearClock(){
dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+12+CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) {
ILI9486_SPI::startWrite();
}
void DspCore::endWrite(void) {
ILI9486_SPI::endWrite();
}
void DspCore::loop(bool force) {
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?3:1);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) {
sendCommand(ILI9488_SLPIN); delay(150); sendCommand(ILI9488_DISPOFF); delay(150);
}
void DspCore::wake(void) {
sendCommand(ILI9488_DISPON); delay(150); sendCommand(ILI9488_SLPOUT); delay(150);
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
ILI9486_SPI::drawPixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
ILI9486_SPI::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI56pt7b);
setTextSize(1);
}
#endif

View File

@@ -1,24 +1,16 @@
#ifndef displayILI9488_h
#define displayILI9488_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include "../ILI9488/ILI9486_SPI.h"
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI56pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI56pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo99x64.h"
#include "fonts/dsfont70.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef ILI9486_SPI yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayILI9488conf_custom.h")
#include "conf/displayILI9488conf_custom.h"
@@ -26,19 +18,9 @@ typedef GFXcanvas16 Canvas;
#include "conf/displayILI9488conf.h"
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
#define ILI9488_SLPIN 0x10
#define ILI9488_SLPOUT 0x11
#define ILI9488_DISPOFF 0x28
#define ILI9488_DISPON 0x29
class DspCore: public ILI9486_SPI {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,11 +1,8 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_1602I2C || DSP_MODEL==DSP_1602 || DSP_MODEL==DSP_2004 || DSP_MODEL==DSP_2004I2C
#include "displayLC1602.h"
#include "../core/player.h"
#include "dspcore.h"
#include <WiFi.h>
#include "../core/config.h"
#include "../core/network.h"
#ifndef SCREEN_ADDRESS
#define SCREEN_ADDRESS 0x27 ///< See datasheet for Address or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
@@ -13,14 +10,12 @@
DspCore::DspCore(): DSP_INIT {}
#include "tools/utf8RusLCD.h"
void DspCore::apScreen() {
clear();
setCursor(0,0);
print(utf8Rus(const_lcdApMode, false));
setCursor(0,1);
print(WiFi.softAPIP().toString().c_str());
print(config.ipToStr(WiFi.softAPIP()));
#ifdef LCD_2004
setCursor(0, 2);
print(utf8Rus(const_lcdApName, false));
@@ -43,33 +38,6 @@ void DspCore::initDisplay() {
#endif
#endif
clearClipping();
plTtemsCount = PLMITEMS;
plCurrentPos = 1;
}
void DspCore::drawLogo(uint16_t top) { }
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
if (pos == plCurrentPos) {
current.setText(item);
} else {
setCursor(1, pos);
char tmp[width()] = {0};
strlcpy(tmp, utf8Rus(item, true), width());
print(tmp);
}
}
void DspCore::drawPlaylist(uint16_t currentItem) {
clear();
config.fillPlMenu(currentItem - plCurrentPos, plTtemsCount);
setCursor(0,1);
write(uint8_t(126));
}
void DspCore::clearDsp(bool black) {
clear();
}
void DspCore::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color){
@@ -97,55 +65,9 @@ uint16_t DspCore::height(){
#endif
}
uint8_t DspCore::_charWidth(unsigned char c){
return 1;
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() { }
void DspCore::_clockSeconds(){
setCursor(_timeleft+_dotsLeft, clockTop);
print((network.timeinfo.tm_sec % 2 == 0)?":":" ");
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){ }
void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight, bool redraw) {
clockTop = 0;
_timeleft = width()-5;
_dotsLeft = 2;
strftime(_timeBuf, sizeof(_timeBuf), "%H:%M", &network.timeinfo);
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
setCursor(_timeleft, clockTop);
print(_timeBuf);
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
}
_clockSeconds();
}
void DspCore::clearClock() { }
void DspCore::loop(bool force) {
// delay(100);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = 1;
height = 1;
}
void DspCore::clearDsp(bool black){ clear(); }
void DspCore::flip(){ }
void DspCore::invert(){ }
void DspCore::sleep(void) {
noDisplay();
#ifdef LCD_I2C
@@ -159,20 +81,4 @@ void DspCore::wake(void) {
#endif
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) { }
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { }
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
setClipping({0, 0, width(), height()});
}
void DspCore::setNumFont(){ }
#endif

View File

@@ -1,18 +1,9 @@
#ifndef displayLC1602_h
#define displayLC1602_h
#include "../core/options.h"
#include "Arduino.h"
#include "tools/l10n.h"
#define DSP_NOT_FLIPPED
#define DSP_LCD
#define CHARWIDTH 1
#define CHARHEIGHT 1
#include "widgets/widgets.h"
#include "widgets/pages.h"
#if DSP_MODEL==DSP_2004 || DSP_MODEL==DSP_2004I2C
#define LCD_2004
@@ -26,15 +17,19 @@
#endif
#ifdef LCD_I2C
typedef LiquidCrystal_I2C yoDisplay;
#ifdef LCD_2004
#define DSP_INIT LiquidCrystal_I2C(SCREEN_ADDRESS, 20, 4, I2C_SDA, I2C_SCL)
#else
#define DSP_INIT LiquidCrystal_I2C(SCREEN_ADDRESS, 16, 2, I2C_SDA, I2C_SCL)
#endif
#else
typedef LiquidCrystal yoDisplay;
#define DSP_INIT LiquidCrystal(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7)
#endif
#include "tools/commongfx.h"
#ifdef LCD_2004
#if __has_include("conf/displayLCD2004conf_custom.h")
#include "conf/displayLCD2004conf_custom.h"
@@ -63,14 +58,4 @@ const char const_lcdApMode[] PROGMEM = "YORADIO AP MODE";
const char const_lcdApName[] PROGMEM = "AP NAME: ";
const char const_lcdApPass[] PROGMEM = "PASSWORD: ";
#ifdef LCD_I2C
class DspCore: public LiquidCrystal_I2C {
#else
class DspCore: public LiquidCrystal {
#endif
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,23 +1,8 @@
#include "../core/options.h"
#if DSP_MODEL==3
#include "displayN5110.h"
#if DSP_MODEL==DSP_NOKIA5110
#include "dspcore.h"
#include <Wire.h>
#include "../core/config.h"
#include "../core/network.h"
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 28
const unsigned char logo [] PROGMEM=
{
0x07, 0x03, 0x80, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x07,
0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x07, 0xff, 0x80, 0x1f, 0xff,
0xc0, 0x1f, 0xff, 0xe0, 0x3f, 0xff, 0xf0, 0x7f, 0x07, 0xf0, 0x7e, 0x03, 0xf0, 0x7e, 0x01, 0xf8,
0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xf8, 0x7e, 0x00, 0x00, 0x7f,
0x00, 0x00, 0x7f, 0x80, 0x20, 0x3f, 0xff, 0xe0, 0x3f, 0xff, 0xe0, 0x1f, 0xff, 0xe0, 0x0f, 0xff,
0xe0, 0x01, 0xff, 0xc0
};
#if DSP_HSPI
DspCore::DspCore(): Adafruit_PCD8544(TFT_DC, TFT_CS, TFT_RST, &SPI2) {}
@@ -25,16 +10,6 @@ DspCore::DspCore(): Adafruit_PCD8544(TFT_DC, TFT_CS, TFT_RST, &SPI2) {}
DspCore::DspCore(): Adafruit_PCD8544(TFT_DC, TFT_CS, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::command(uint8_t c) {
Adafruit_PCD8544::command(c);
}
void DspCore::data(uint8_t c) {
Adafruit_PCD8544::data(c);
}
void DspCore::initDisplay() {
begin();
setReinitInterval(0);
@@ -63,166 +38,12 @@ void DspCore::initDisplay() {
invert();
flip();
setTextWrap(false);
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) {
drawBitmap((width() - LOGO_WIDTH ) / 2, top, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
display();
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(TFT_BG);
}
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI15pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(1);
setFont(&DS_DIGI15pt7b);
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : config.theme.background, config.theme.background);
setCursor(_timeleft+_dotsLeft, clockTop);
print(":");
setFont(); /* print dots */
setTextSize(1);
setCursor(_timeleft+_timewidth+2, clockTop-CHARHEIGHT*2-1);
setTextColor(config.theme.clock, config.theme.background);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
print(_bufforseconds);
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth+CHARWIDTH*2+2, clockTimeHeight, config.theme.background);
//if(_oldtimeleft>0) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, clockTimeHeight, config.theme.background);
_timeleft = (width()/2 - _timewidth/2)-clockRightSpace;
setTextSize(1);
setFont(&DS_DIGI15pt7b);
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+CHARWIDTH*2+2, clockTimeHeight+2, config.theme.background);
//dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+10+CHARHEIGHT, config.theme.background);
}
void DspCore::loop(bool force) {
if(digitalRead(TFT_CS)==LOW) return;
display();
delay(10);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?2:0);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { command( PCD8544_FUNCTIONSET | PCD8544_POWERDOWN); }
void DspCore::wake(void) { initDisplay(); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_PCD8544::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_PCD8544::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI15pt7b);
setTextSize(1);
}
void DspCore::clearDsp(bool black){ fillScreen(TFT_BG); }
void DspCore::flip(){ setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ command( PCD8544_FUNCTIONSET | PCD8544_POWERDOWN); }
void DspCore::wake(void){ initDisplay(); }
#endif

View File

@@ -1,28 +1,18 @@
#ifndef displayN5110_h
#define displayN5110_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include "fonts/TinyFont5.h"
#include "fonts/TinyFont6.h"
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI15pt7b_mono.h"
#else
#include "fonts/DS_DIGI15pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#include "fonts/bootlogo21x28.h"
#include "fonts/bootlogo35.h"
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_PCD8544 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayN5110conf_custom.h")
#include "conf/displayN5110conf_custom.h"
@@ -30,12 +20,6 @@ typedef GFXcanvas1 Canvas;
#include "conf/displayN5110conf.h"
#endif
class DspCore: public Adafruit_PCD8544 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* TFT COLORS
*/

View File

@@ -1,35 +1,17 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_SH1106 || DSP_MODEL==DSP_SH1107
#include "displaySH1106.h"
#include "dspcore.h"
#include <Wire.h>
#include "../core/player.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef SCREEN_ADDRESS
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
#endif
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 32
#ifndef I2CFREQ_HZ
#define I2CFREQ_HZ 4000000UL
#endif
const unsigned char logo [] PROGMEM=
{
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
};
TwoWire I2CSH1106 = TwoWire(0);
#if DSP_MODEL==DSP_SH1106
DspCore::DspCore(): Adafruit_SH1106G(128, 64, &I2CSH1106, -1, I2CFREQ_HZ) {
@@ -41,8 +23,6 @@ DspCore::DspCore(): Adafruit_SH1107(64, 128, &I2CSH1106, -1) {
}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
I2CSH1106.begin(I2C_SDA, I2C_SCL);
if (!begin(SCREEN_ADDRESS, true)) {
@@ -54,119 +34,9 @@ void DspCore::initDisplay() {
flip();
invert();
setTextWrap(false);
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) {
drawBitmap((width() - LOGO_WIDTH ) / 2, top, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(TFT_BG);
}
uint8_t DspCore::_charWidth(unsigned char c){
return CHARWIDTH*clockTimeHeight;
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(clockTimeHeight);
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : config.theme.background, config.theme.background);
setCursor(_timeleft+_dotsLeft, clockTop);
print(":"); /* print dots */
setTextSize(1);
setCursor(_timeleft+_timewidth+1, clockTop);
setTextColor(config.theme.clock, config.theme.background);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
print(_bufforseconds);
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0) dsp.fillRect(_oldtimeleft, clockTop, _oldtimewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
_timeleft = (width()/2 - _timewidth/2)+clockRightSpace;
setTextColor(config.theme.clock, config.theme.background);
setTextSize(clockTimeHeight);
setCursor(_timeleft, clockTop);
print(_timeBuf);
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, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) { }
void DspCore::endWrite(void) { }
void DspCore::loop(bool force) {
display();
delay(5);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::clearDsp(bool black){ fillScreen(TFT_BG); }
void DspCore::flip(){
#if DSP_MODEL==DSP_SH1107
setRotation(config.store.flipscreen?3:1);
@@ -175,47 +45,8 @@ void DspCore::flip(){
setRotation(config.store.flipscreen?2:0);
#endif
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { oled_command(SH110X_DISPLAYOFF); }
void DspCore::wake(void) { oled_command(SH110X_DISPLAYON); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
#if DSP_MODEL==DSP_SH1107
Adafruit_SH1107::writePixel(x, y, color);
#else
Adafruit_SH1106G::writePixel(x, y, color);
#endif
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
#if DSP_MODEL==DSP_SH1107
Adafruit_SH1107::writeFillRect(x, y, w, h, color);
#else
Adafruit_SH1106G::writeFillRect(x, y, w, h, color);
#endif
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setTextSize(2);
}
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ oled_command(SH110X_DISPLAYOFF); }
void DspCore::wake(void){ oled_command(SH110X_DISPLAYON); }
#endif

View File

@@ -1,21 +1,20 @@
#ifndef displaySH1106_h
#define displaySH1106_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
#include "fonts/bootlogo21x32.h"
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
#if DSP_MODEL==DSP_SH1106
typedef Adafruit_SH1106G yoDisplay;
#else
typedef Adafruit_SH1107 yoDisplay;
#endif
#include "tools/commongfx.h"
#if __has_include("conf/displaySH1106conf_custom.h")
#include "conf/displaySH1106conf_custom.h"
@@ -23,16 +22,6 @@ typedef GFXcanvas1 Canvas;
#include "conf/displaySH1106conf.h"
#endif
#if DSP_MODEL==DSP_SH1106
class DspCore: public Adafruit_SH1106G {
#else
class DspCore: public Adafruit_SH1107 {
#endif
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* OLED COLORS
*/

View File

@@ -1,33 +1,16 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_SSD1305 || DSP_MODEL==DSP_SSD1305I2C
#include "displaySSD1305.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef SCREEN_ADDRESS
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
#endif
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 32
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 8000000UL /* set it to 0 for system default */
#endif
const unsigned char logo [] PROGMEM=
{
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
};
#if DSP_MODEL==DSP_SSD1305
#if DSP_HSPI
DspCore::DspCore(): Adafruit_SSD1305(128, 64, &SPI2, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {}
@@ -42,8 +25,6 @@ DspCore::DspCore(): Adafruit_SSD1305(128, 64, &I2CSSD1305, -1){
}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
#if DSP_MODEL==DSP_SSD1305I2C
I2CSSD1305.begin(I2C_SDA, I2C_SCL);
@@ -58,163 +39,12 @@ void DspCore::initDisplay() {
flip();
invert();
setTextWrap(false);
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) {
drawBitmap( (width() - LOGO_WIDTH ) / 2, 8, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
display();
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(TFT_BG);
}
uint8_t DspCore::_charWidth(unsigned char c){
return CHARWIDTH*clockTimeHeight;
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(clockTimeHeight);
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : config.theme.background, config.theme.background);
setCursor(_timeleft+_dotsLeft, clockTop);
print(":"); /* print dots */
setTextSize(1);
setCursor(_timeleft+_timewidth+1, clockTop);
setTextColor(config.theme.clock, config.theme.background);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
print(_bufforseconds);
//setFont();
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0) dsp.fillRect(_oldtimeleft, clockTop, _oldtimewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
_timeleft = (width()/2 - _timewidth/2)+clockRightSpace;
setTextColor(config.theme.clock, config.theme.background);
setTextSize(clockTimeHeight);
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, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) { }
void DspCore::endWrite(void) { }
void DspCore::loop(bool force) {
display();
delay(5);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?2:0);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) {
oled_command(SSD1305_DISPLAYOFF);
}
void DspCore::wake(void) {
oled_command(SSD1305_DISPLAYON);
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_SSD1305::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_SSD1305::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setTextSize(2);
}
void DspCore::clearDsp(bool black){ fillScreen(TFT_BG); }
void DspCore::flip(){ setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ oled_command(SSD1305_DISPLAYOFF); }
void DspCore::wake(void){ oled_command(SSD1305_DISPLAYON); }
#endif

View File

@@ -1,21 +1,15 @@
#ifndef displaySSD1305_h
#define displaySSD1305_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1305.h>
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
#include "fonts/bootlogo21x32.h"
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_SSD1305 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displaySSD1305conf_custom.h")
#include "conf/displaySSD1305conf_custom.h"
@@ -23,12 +17,6 @@ typedef GFXcanvas1 Canvas;
#include "conf/displaySSD1305conf.h"
#endif
class DspCore: public Adafruit_SSD1305 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* OLED COLORS
*/

View File

@@ -1,34 +1,13 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_SSD1306 || DSP_MODEL==DSP_SSD1306x32
#include "displaySSD1306.h"
#include "dspcore.h"
#include <Wire.h>
#include "../core/player.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef SCREEN_ADDRESS
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
#endif
#if DSP_MODEL==DSP_SSD1306
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 32
const unsigned char logo [] PROGMEM=
{
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
};
#endif
#ifndef I2CFREQ_HZ
#define I2CFREQ_HZ 4000000UL
#endif
@@ -37,8 +16,6 @@ TwoWire I2CSSD1306 = TwoWire(0);
DspCore::DspCore(): Adafruit_SSD1306(128, ((DSP_MODEL==DSP_SSD1306)?64:32), &I2CSSD1306, I2C_RST, I2CFREQ_HZ) { }
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
I2CSSD1306.begin(I2C_SDA, I2C_SCL);
if (!begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
@@ -50,178 +27,12 @@ void DspCore::initDisplay() {
flip();
invert();
setTextWrap(false);
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) {
#if DSP_MODEL==DSP_SSD1306
drawBitmap((width() - LOGO_WIDTH ) / 2, 8, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
#else
setTextSize(1);
setCursor((width() - 6*CHARWIDTH) / 2, 0);
setTextColor(TFT_FG, TFT_BG);
print(utf8Rus("ёRadio", false));
setTextSize(1);
#endif
display();
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(TFT_BG);
}
uint8_t DspCore::_charWidth(unsigned char c){
return CHARWIDTH*clockTimeHeight;
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(clockTimeHeight);
#if DSP_MODEL!=DSP_SSD1306x32
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : config.theme.background, config.theme.background);
#else
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? 0 : 1, 1);
#endif
setCursor(_timeleft+_dotsLeft, clockTop);
print(":"); /* print dots */
#if DSP_MODEL!=DSP_SSD1306x32
setTextSize(1);
setCursor(_timeleft+_timewidth+1, clockTop);
setTextColor(config.theme.clock, config.theme.background);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
print(_bufforseconds);
#endif
//setFont();
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0) dsp.fillRect(_oldtimeleft, clockTop, _oldtimewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
#if DSP_MODEL!=DSP_SSD1306x32
_timeleft = (width()/2 - _timewidth/2)+clockRightSpace;
setTextColor(config.theme.clock, config.theme.background);
#else
_timeleft = (width() - _timewidth)-clockRightSpace;
setTextColor(0, 1);
#endif
setTextSize(clockTimeHeight);
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, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) { }
void DspCore::endWrite(void) { }
void DspCore::loop(bool force) {
display();
delay(5);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?2:0);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { ssd1306_command(SSD1306_DISPLAYOFF); }
void DspCore::wake(void) { ssd1306_command(SSD1306_DISPLAYON); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_SSD1306::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_SSD1306::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setTextSize(2);
}
void DspCore::clearDsp(bool black){ fillScreen(TFT_BG); }
void DspCore::flip(){ setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ ssd1306_command(SSD1306_DISPLAYOFF); }
void DspCore::wake(void){ ssd1306_command(SSD1306_DISPLAYON); }
#endif

View File

@@ -1,21 +1,18 @@
#ifndef displaySSD1306_h
#define displaySSD1306_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
#if DSP_MODEL==DSP_SSD1306
#include "fonts/bootlogo21x32.h"
#endif
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_SSD1306 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displaySSD1306conf_custom.h")
#include "conf/displaySSD1306conf_custom.h"
@@ -27,13 +24,6 @@ typedef GFXcanvas1 Canvas;
#endif
#endif
class DspCore: public Adafruit_SSD1306 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* OLED COLORS
*/

View File

@@ -1,13 +1,7 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_SSD1322
#include "displaySSD1322.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 32
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 16000000UL /* set it to 0 for system default */
@@ -15,18 +9,6 @@
#ifndef SSD1322_GRAYSCALE
#define SSD1322_GRAYSCALE false
#endif
const unsigned char logo [] PROGMEM=
{
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
};
#if DSP_HSPI
DspCore::DspCore(): Jamis_SSD1322(256, 64, &SPI2, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {}
@@ -34,8 +16,6 @@ const unsigned char logo [] PROGMEM=
DspCore::DspCore(): Jamis_SSD1322(256, 64, &SPI, TFT_DC, TFT_RST, TFT_CS, DEF_SPI_FREQ) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
#if !SSD1322_GRAYSCALE
#include "tools/oledcolorfix.h"
@@ -74,174 +54,12 @@ void DspCore::initDisplay() {
flip();
invert();
setTextWrap(false);
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) {
drawBitmap( (width() - LOGO_WIDTH ) / 2, 8, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
display();
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
//fillScreen(TFT_BG);
clearDisplay();
}
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI28pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
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);
}
void DspCore::startWrite(void) {
//TAKE_MUTEX();
Jamis_SSD1322::startWrite();
}
void DspCore::endWrite(void) {
Jamis_SSD1322::endWrite();
//GIVE_MUTEX();
}
void DspCore::loop(bool force) {
display();
delay(5);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?2:0);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { oled_command(SSD1322_DISPLAYOFF); }
void DspCore::wake(void) { oled_command(SSD1322_DISPLAYON); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Jamis_SSD1322::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Jamis_SSD1322::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI28pt7b);
setTextSize(1);
}
void DspCore::clearDsp(bool black){ clearDisplay(); }
void DspCore::flip(){ setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ oled_command(SSD1322_DISPLAYOFF); }
void DspCore::wake(void){ oled_command(SSD1322_DISPLAYON); }
#endif

View File

@@ -1,26 +1,16 @@
#ifndef displaySSD1322_h
#define displaySSD1322_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include "../SSD1322/SSD1322.h"
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI28pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#include "fonts/bootlogo21x32.h"
#include "fonts/dsfont35.h"
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Jamis_SSD1322 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displaySSD1322conf_custom.h")
#include "conf/displaySSD1322conf_custom.h"
@@ -28,18 +18,10 @@ typedef GFXcanvas1 Canvas;
#include "conf/displaySSD1322conf.h"
#endif
class DspCore: public Jamis_SSD1322 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* OLED COLORS
*/
#define BOOT_PRG_COLOR WHITE
#define BOOT_TXT_COLOR WHITE
#define PINK WHITE
#define SILVER WHITE
#define TFT_BG BLACK
#define TFT_FG WHITE

View File

@@ -1,12 +1,8 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_SSD1327
#include "displaySSD1327.h"
#include "dspcore.h"
#include <Wire.h>
#include "fonts/bootlogo40.h"
#include "../core/player.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef SCREEN_ADDRESS
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; or scan it https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda
@@ -20,8 +16,6 @@ TwoWire tw = TwoWire(0);
DspCore::DspCore(): Adafruit_SSD1327(128, 128, &tw, I2C_RST/*, I2CFREQ_HZ*/) {}
#include "tools/utf8RusGFX.h"
#define CLR_ITEM1 0xA
#define CLR_ITEM2 0x8
#define CLR_ITEM3 0x5
@@ -57,170 +51,12 @@ void DspCore::initDisplay() {
flip();
invert();
setTextWrap(false);
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) {
drawRGBBitmap((DSP_WIDTH - 62) / 2, top, bootlogo40, 62, 40);
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(black?0:config.theme.background);
}
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI28pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
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(":"); /* print dots */
setFont();
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, 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, clockTimeHeight+1, config.theme.background);
}
void DspCore::startWrite(void) { }
void DspCore::endWrite(void) { }
void DspCore::loop(bool force) {
display();
delay(5);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
if(ROTATE_90){
setRotation(config.store.flipscreen?3:1);
}else{
setRotation(config.store.flipscreen?2:0);
}
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { oled_command(SSD1327_DISPLAYOFF); }
void DspCore::wake(void) { oled_command(SSD1327_DISPLAYON); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_SSD1327::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_SSD1327::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI28pt7b);
setTextSize(1);
}
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ if(ROTATE_90) setRotation(config.store.flipscreen?3:1); else setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ oled_command(SSD1327_DISPLAYOFF); }
void DspCore::wake(void){ oled_command(SSD1327_DISPLAYON); }
#endif

View File

@@ -1,26 +1,16 @@
#ifndef displaySSD1327_h
#define displaySSD1327_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1327.h>
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI28pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#include "fonts/bootlogo62x40.h"
#include "fonts/dsfont35.h"
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_SSD1327 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displaySSD1327conf_custom.h")
#include "conf/displaySSD1327conf_custom.h"
@@ -28,12 +18,6 @@ typedef GFXcanvas1 Canvas;
#include "conf/displaySSD1327conf.h"
#endif
class DspCore: public Adafruit_SSD1327 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
SSD1327_GRAYTABLE,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
@@ -43,14 +27,12 @@ extern DspCore dsp;
/*
* TFT COLORS
*/
#define BOOT_PRG_COLOR 0x07
#define BOOT_TXT_COLOR 0x3f
#define DARK_GRAY 0x01
#define SILVER 0x07
#define TFT_BG 0x00
#define TFT_FG 0x08
#define TFT_LOGO 0x3f
#define ORANGE 0x05
#define PINK 0x02
#endif

View File

@@ -1,13 +1,10 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_ST7735
#include "displayST7735.h"
#include "fonts/bootlogo40.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 26000000UL /* set it to 0 for system default */
#define DEF_SPI_FREQ 0 //26000000UL /* set it to 0 for system default */
#endif
#if DSP_HSPI
@@ -16,8 +13,6 @@ DspCore::DspCore(): Adafruit_ST7735(&SPI2, TFT_CS, TFT_DC, TFT_RST) {}
DspCore::DspCore(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
initR(DTYPE);
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
@@ -25,180 +20,12 @@ void DspCore::initDisplay() {
invert();
flip();
setTextWrap(false);
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) {
#ifdef DSP_MINI
drawRGBBitmap((DSP_WIDTH - 62) / 2, 5, bootlogo40, 62, 40);
#else
//drawRGBBitmap((DSP_WIDTH - 99) / 2, 18, bootlogo2, 99, 64);
drawRGBBitmap((DSP_WIDTH - 62) / 2, 34, bootlogo40, 62, 40);
#endif
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(black?0:config.theme.background);
}
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI28pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
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(":"); /* print dots */
setFont();
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, 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, clockTimeHeight+1, config.theme.background);
}
void DspCore::startWrite(void) {
Adafruit_ST7735::startWrite();
}
void DspCore::endWrite(void) {
Adafruit_ST7735::endWrite();
}
void DspCore::loop(bool force) { }
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
if(ROTATE_90){
setRotation(config.store.flipscreen?2:0);
}else{
setRotation(config.store.flipscreen?3:1);
}
}
void DspCore::invert(){
invertDisplay((DTYPE==INITR_MINI160x80)?!config.store.invertdisplay:config.store.invertdisplay);
}
void DspCore::sleep(void) {
enableSleep(true); delay(150); enableDisplay(false); delay(150);
}
void DspCore::wake(void) {
enableDisplay(true); delay(150); enableSleep(false); delay(150);
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ST7735::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ST7735::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI28pt7b);
setTextSize(1);
}
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ if(ROTATE_90) setRotation(config.store.flipscreen?2:0); else setRotation(config.store.flipscreen?3:1); }
void DspCore::invert(){ invertDisplay((DTYPE==INITR_MINI160x80)?!config.store.invertdisplay:config.store.invertdisplay); }
void DspCore::sleep(void){ enableSleep(true); delay(150); enableDisplay(false); delay(150); }
void DspCore::wake(void){ enableDisplay(true); delay(150); enableSleep(false); delay(150); }
#endif

View File

@@ -1,25 +1,16 @@
#ifndef displayST7735_h
#define displayST7735_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI28pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo62x40.h"
#include "fonts/dsfont35.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_ST7735 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayST7735conf_custom.h")
#include "conf/displayST7735conf_custom.h"
@@ -33,14 +24,6 @@ typedef GFXcanvas16 Canvas;
#endif
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public Adafruit_ST7735 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,16 +1,7 @@
#include "../core/options.h"
#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 "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */
@@ -22,8 +13,6 @@ DspCore::DspCore(): Adafruit_ST7789(&SPI2, TFT_CS, TFT_DC, TFT_RST) {}
DspCore::DspCore(): Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
if(DSP_MODEL==DSP_ST7789_76){
init(76,284);
@@ -37,211 +26,9 @@ void DspCore::initDisplay() {
setTextWrap(false);
setTextSize(1);
fillScreen(0x0000);
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;
}
#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);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) { fillScreen(black?0:config.theme.background); }
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + 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);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
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 */
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 */
setFont();
}
void DspCore::_clockDate(){
if(_olddateleft>0)
dsp.fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
setTextColor(config.theme.date, config.theme.background);
setCursor(_dateleft, clockTop+10);
if(!config.isScreensaver) print(_dateBuf); /* print date */
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
_olddatewidth = _datewidth;
_olddateleft = _dateleft;
setTextSize(3);
setTextColor(config.theme.dow, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-CHARHEIGHT*3+4);
print(utf8Rus(dow[network.timeinfo.tm_wday], false)); /* print dow */
}
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;
setNumFont();
if(CLOCKFONT_MONO) {
setCursor(_timeleft, clockTop);
setTextColor(config.theme.clockbg, config.theme.background);
print("88:88");
}
setCursor(_timeleft, clockTop);
setTextColor(config.theme.clock, config.theme.background);
print(_timeBuf);
setFont();
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
_oldtimewidth = _timewidth;
_oldtimeleft = _timeleft;
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
_datewidth = strlen(_dateBuf) * CHARWIDTH;
_dateleft = width() - 8 - clockRightSpace - _datewidth;
}
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();
if(!config.isScreensaver)
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
}
_clockSeconds();
}
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();
}
void DspCore::endWrite(void) {
Adafruit_ST7789::endWrite();
}
void DspCore::loop(bool force) {
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){
#if DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_76
setRotation(config.store.flipscreen?3:1);
@@ -254,48 +41,8 @@ void DspCore::flip(){
}
#endif
}
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ enableSleep(true); delay(150); enableDisplay(false); delay(150); }
void DspCore::wake(void){ enableDisplay(true); delay(150); enableSleep(false); delay(150); }
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) {
enableSleep(true); delay(150); enableDisplay(false); delay(150);
}
void DspCore::wake(void) {
enableDisplay(true); delay(150); enableSleep(false); delay(150);
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ST7789::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ST7789::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
#if DSP_MODEL==DSP_ST7789_76
setFont(&DS_DIGI28pt7b);
#else
setFont(&DS_DIGI42pt7b);
#endif
setTextSize(1);
}
#endif

View File

@@ -1,32 +1,22 @@
#ifndef displayST7789_h
#define displayST7789_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#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
#include "fonts/bootlogo62x40.h"
#include "fonts/dsfont35.h"
#else
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI42pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI42pt7b.h"
#endif
#include "fonts/bootlogo99x64.h"
#include "fonts/dsfont52.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_ST7789 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayST7789conf_custom.h")
#include "conf/displayST7789conf_custom.h"
@@ -40,14 +30,4 @@ typedef GFXcanvas16 Canvas;
#endif
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public Adafruit_ST7789 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,11 +1,7 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_ST7796
#include "displayST7796.h"
//#include <SPI.h>
#include "fonts/bootlogo.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */
@@ -17,8 +13,6 @@ DspCore::DspCore(): Adafruit_ST7796S_kbv(&SPI2, TFT_DC, TFT_CS, TFT_RST) {}
DspCore::DspCore(): Adafruit_ST7796S_kbv(TFT_CS, TFT_DC, TFT_RST) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
begin();
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
@@ -28,196 +22,12 @@ void DspCore::initDisplay() {
setTextWrap(false);
setTextSize(1);
fillScreen(0x0000);
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) { drawRGBBitmap((width() - 99) / 2, top, bootlogo2, 99, 64); }
void DspCore::clearDsp(bool black){ fillScreen(black?0:config.theme.background); }
void DspCore::flip(){ setRotation(config.store.flipscreen?3:1); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ sendCommand(ST7796S_SLPIN); delay(150); sendCommand(ST7796S_DISPOFF); delay(150); }
void DspCore::wake(void){ sendCommand(ST7796S_DISPON); delay(150); sendCommand(ST7796S_SLPOUT); delay(150); }
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) { fillScreen(black?0:config.theme.background); }
GFXglyph *pgm_read_glyph_ptr(const GFXfont *gfxFont, uint8_t c) {
return gfxFont->glyph + c;
}
uint8_t DspCore::_charWidth(unsigned char c){
GFXglyph *glyph = pgm_read_glyph_ptr(&DS_DIGI56pt7b, c - 0x20);
return pgm_read_byte(&glyph->xAdvance);
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(4);
setTextColor(config.theme.seconds, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*4*2, clockTop-clockTimeHeight+1);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
setTextSize(1);
setFont(&DS_DIGI56pt7b);
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 */
setFont();
}
void DspCore::_clockDate(){
if(_olddateleft>0)
dsp.fillRect(_olddateleft, clockTop+14, _olddatewidth, CHARHEIGHT*2, config.theme.background);
setTextColor(config.theme.date, config.theme.background);
setCursor(_dateleft, clockTop+15);
setTextSize(2);
if(!config.isScreensaver) print(_dateBuf); /* print date */
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
_olddatewidth = _datewidth;
_olddateleft = _dateleft;
setTextSize(4);
setTextColor(config.theme.dow, config.theme.background);
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*4*2, clockTop-CHARHEIGHT*4+4);
print(utf8Rus(dow[network.timeinfo.tm_wday], false)); /* print dow */
}
void DspCore::_clockTime(){
if(_oldtimeleft>0 && !CLOCKFONT_MONO) dsp.fillRect(_oldtimeleft, clockTop-clockTimeHeight+1, _oldtimewidth, clockTimeHeight, config.theme.background);
_timeleft = width()-clockRightSpace-CHARWIDTH*4*2-24-_timewidth;
setTextSize(1);
setFont(&DS_DIGI56pt7b);
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;
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight, clockTimeHeight+4, config.theme.div); /*divider vert*/
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight+37, 59, config.theme.div); /*divider hor*/
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
_datewidth = strlen(_dateBuf) * CHARWIDTH*2;
_dateleft = width() - 10 - clockRightSpace - _datewidth;
}
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();
if(!config.isScreensaver)
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
}
_clockSeconds();
}
void DspCore::clearClock(){
dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+12+CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) {
Adafruit_ST7796S_kbv::startWrite();
}
void DspCore::endWrite(void) {
Adafruit_ST7796S_kbv::endWrite();
}
void DspCore::loop(bool force) {
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?3:1);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) {
sendCommand(ST7796S_SLPIN); delay(150); sendCommand(ST7796S_DISPOFF); delay(150);
}
void DspCore::wake(void) {
sendCommand(ST7796S_DISPON); delay(150); sendCommand(ST7796S_SLPOUT); delay(150);
}
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ST7796S_kbv::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
Adafruit_ST7796S_kbv::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setFont(&DS_DIGI56pt7b);
setTextSize(1);
}
#endif

View File

@@ -1,24 +1,16 @@
#ifndef displayST7796_h
#define displayST7796_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include "../Adafruit_ST7796S/Adafruit_ST7796S_kbv.h"
#if CLOCKFONT_MONO
#include "fonts/DS_DIGI56pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "fonts/DS_DIGI56pt7b.h"
#endif
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#include "fonts/bootlogo99x64.h"
#include "fonts/dsfont70.h"
typedef GFXcanvas16 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef Adafruit_ST7796S_kbv yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayST7796conf_custom.h")
#include "conf/displayST7796conf_custom.h"
@@ -26,14 +18,4 @@ typedef GFXcanvas16 Canvas;
#include "conf/displayST7796conf.h"
#endif
#define BOOT_PRG_COLOR 0xE68B
#define BOOT_TXT_COLOR 0xFFFF
#define PINK 0xF97F
class DspCore: public Adafruit_ST7796S_kbv {
#include "tools/commongfx.h"
};
extern DspCore dsp;
#endif

View File

@@ -1,39 +1,18 @@
#include "../core/options.h"
#if DSP_MODEL==DSP_ST7920
#include "displayST7920.h"
#include "../core/player.h"
#include "dspcore.h"
#include "../core/config.h"
#include "../core/network.h"
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 32
#ifndef DEF_SPI_FREQ
#define DEF_SPI_FREQ 8000000UL
#endif
const unsigned char logo [] PROGMEM=
{
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
};
#if DSP_HSPI
DspCore::DspCore(): ST7920(&SPI2, TFT_CS, DEF_SPI_FREQ) {}
#else
DspCore::DspCore(): ST7920(&SPI, TFT_CS, DEF_SPI_FREQ) {}
#endif
#include "tools/utf8RusGFX.h"
void DspCore::initDisplay() {
#include "tools/oledcolorfix.h"
begin();
@@ -41,159 +20,12 @@ void DspCore::initDisplay() {
flip();
invert();
setTextWrap(false);
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) {
drawBitmap( (width() - LOGO_WIDTH ) / 2, 8, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
display();
}
void DspCore::printPLitem(uint8_t pos, const char* item, ScrollWidget& current){
setTextSize(playlistConf.widget.textsize);
if (pos == plCurrentPos) {
current.setText(item);
} else {
uint8_t plColor = (abs(pos - plCurrentPos)-1)>4?4:abs(pos - plCurrentPos)-1;
setTextColor(config.theme.playlist[plColor], config.theme.background);
setCursor(TFT_FRAMEWDT, plYStart + pos * plItemHeight);
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);
}
}
void DspCore::clearDsp(bool black) {
fillScreen(TFT_BG);
}
uint8_t DspCore::_charWidth(unsigned char c){
return CHARWIDTH*clockTimeHeight;
}
uint16_t DspCore::textWidth(const char *txt){
uint16_t w = 0, l=strlen(txt);
for(uint16_t c=0;c<l;c++) w+=_charWidth(txt[c]);
return w;
}
void DspCore::_getTimeBounds() {
_timewidth = textWidth(_timeBuf);
char buf[4];
strftime(buf, 4, "%H", &network.timeinfo);
_dotsLeft=textWidth(buf);
}
void DspCore::_clockSeconds(){
setTextSize(clockTimeHeight);
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : config.theme.background, config.theme.background);
setCursor(_timeleft+_dotsLeft, clockTop);
print(":"); /* print dots */
setTextSize(1);
setCursor(_timeleft+_timewidth+1, clockTop);
setTextColor(config.theme.clock, config.theme.background);
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
print(_bufforseconds);
//setFont();
}
void DspCore::_clockDate(){ }
void DspCore::_clockTime(){
if(_oldtimeleft>0) dsp.fillRect(_oldtimeleft, clockTop, _oldtimewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
_timeleft = (width()/2 - _timewidth/2)+clockRightSpace;
setTextColor(config.theme.clock, config.theme.background);
setTextSize(clockTimeHeight);
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, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
}
void DspCore::startWrite(void) { }
void DspCore::endWrite(void) { }
void DspCore::loop(bool force) {
display();
delay(20);
}
void DspCore::charSize(uint8_t textsize, uint8_t& width, uint16_t& height){
width = textsize * CHARWIDTH;
height = textsize * CHARHEIGHT;
}
void DspCore::setTextSize(uint8_t s){
Adafruit_GFX::setTextSize(s);
}
void DspCore::flip(){
setRotation(config.store.flipscreen?2:0);
}
void DspCore::invert(){
invertDisplay(config.store.invertdisplay);
}
void DspCore::sleep(void) { doSleep(true); }
void DspCore::wake(void) { doSleep(false); }
void DspCore::writePixel(int16_t x, int16_t y, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x > _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
ST7920::writePixel(x, y, color);
}
void DspCore::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
if(_clipping){
if ((x < _cliparea.left) || (x >= _cliparea.left+_cliparea.width) || (y < _cliparea.top) || (y > _cliparea.top + _cliparea.height)) return;
}
ST7920::writeFillRect(x, y, w, h, color);
}
void DspCore::setClipping(clipArea ca){
_cliparea = ca;
_clipping = true;
}
void DspCore::clearClipping(){
_clipping = false;
}
void DspCore::setNumFont(){
setTextSize(2);
}
void DspCore::clearDsp(bool black){ fillScreen(TFT_BG); }
void DspCore::flip(){ setRotation(config.store.flipscreen?2:0); }
void DspCore::invert(){ invertDisplay(config.store.invertdisplay); }
void DspCore::sleep(void){ doSleep(true); }
void DspCore::wake(void){ doSleep(false); }
#endif

View File

@@ -1,21 +1,15 @@
#ifndef displayST7920_h
#define displayST7920_h
#include "../core/options.h"
#include "Arduino.h"
#include <Adafruit_GFX.h>
#include "../ST7920/ST7920.h"
#include "tools/l10n.h"
#define CHARWIDTH 6
#define CHARHEIGHT 8
#define DSP_OLED
#define GXCLOCKFONT
#include "fonts/bootlogo21x32.h"
typedef GFXcanvas1 Canvas;
#include "widgets/widgets.h"
#include "widgets/pages.h"
typedef ST7920 yoDisplay;
#include "tools/commongfx.h"
#if __has_include("conf/displayST7920conf_custom.h")
#include "conf/displayST7920conf_custom.h"
@@ -23,12 +17,6 @@ typedef GFXcanvas1 Canvas;
#include "conf/displayST7920conf.h"
#endif
class DspCore: public ST7920 {
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* OLED COLORS
*/

View File

@@ -1,49 +1,106 @@
#ifndef dspcore_h
#define dspcore_h
#include "../core/options.h"
#pragma once
#if DSP_MODEL==DSP_DUMMY
#define DUMMYDISPLAY
#define DSP_NOT_FLIPPED
#include "tools/l10n.h"
#elif DSP_MODEL==DSP_ST7735
#elif DSP_MODEL==DSP_ST7735 // https://k210.org/images/content/uploads/yoradio/ST7735.jpg
#define TIME_SIZE 35
#define PSFBUFFER
#include "displayST7735.h"
#elif DSP_MODEL==DSP_SSD1306 || DSP_MODEL==DSP_SSD1306x32
#elif DSP_MODEL==DSP_SSD1306 // https://k210.org/images/content/uploads/yoradio/SSD1306.jpg
#define TIME_SIZE 2
#define DSP_OLED
#include "displaySSD1306.h"
#elif DSP_MODEL==DSP_NOKIA5110
#elif DSP_MODEL==DSP_SSD1306x32 // https://k210.org/images/content/uploads/yoradio/SSD1306x32.jpg
#define TIME_SIZE 1
#define DSP_OLED
#include "displaySSD1306.h"
#elif DSP_MODEL==DSP_NOKIA5110 // https://k210.org/images/content/uploads/yoradio/NOKIA5110.jpg
#define TIME_SIZE 19
#define DSP_OLED
#include "displayN5110.h"
#elif DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 || DSP_MODEL==DSP_ST7789_76
#elif DSP_MODEL==DSP_ST7789 || DSP_MODEL==DSP_ST7789_240 // https://k210.org/images/content/uploads/yoradio/ST7789.jpg
#define TIME_SIZE 52
#define PSFBUFFER
#include "displayST7789.h"
#elif DSP_MODEL==DSP_SH1106
#elif DSP_MODEL==DSP_ST7789_76 // https://k210.org/images/content/uploads/yoradio/ST7789_76.mp4
#define TIME_SIZE 35
#define PSFBUFFER
#include "displayST7789.h"
#elif DSP_MODEL==DSP_SH1106 || DSP_MODEL==DSP_SH1107 // https://k210.org/images/content/uploads/yoradio/SH1106.jpg
#define TIME_SIZE 2
#define DSP_OLED
#include "displaySH1106.h"
#elif DSP_MODEL==DSP_1602I2C || DSP_MODEL==DSP_2004I2C
#elif DSP_MODEL==DSP_1602I2C || DSP_MODEL==DSP_2004I2C || DSP_MODEL==DSP_1602 || DSP_MODEL==DSP_2004
// https://k210.org/images/content/uploads/yoradio/DSP_1602.jpg
// https://k210.org/images/content/uploads/yoradio/DSP_2004.jpg
#define TIME_SIZE 1
#define DSP_LCD
#include "displayLC1602.h"
#elif DSP_MODEL==DSP_SSD1327
#elif DSP_MODEL==DSP_SSD1327 // https://k210.org/images/content/uploads/yoradio/SSD1327.jpg
#define TIME_SIZE 35
#define DSP_OLED
#include "displaySSD1327.h"
#elif DSP_MODEL==DSP_ILI9341
#elif DSP_MODEL==DSP_ILI9341 // https://k210.org/images/content/uploads/yoradio/ILI9341.jpg
#define TIME_SIZE 52
#define PSFBUFFER
#include "displayILI9341.h"
#elif DSP_MODEL==DSP_SSD1305 || DSP_MODEL==DSP_SSD1305I2C
#elif DSP_MODEL==DSP_SSD1305 || DSP_MODEL==DSP_SSD1305I2C // https://k210.org/images/content/uploads/yoradio/SSD1305.jpg
#define TIME_SIZE 2
#define DSP_OLED
#include "displaySSD1305.h"
#elif DSP_MODEL==DSP_SH1107
#include "displaySH1106.h"
#elif DSP_MODEL==DSP_1602 || DSP_MODEL==DSP_2004
#include "displayLC1602.h"
#elif DSP_MODEL==DSP_GC9106
#elif DSP_MODEL==DSP_GC9106 // https://k210.org/images/content/uploads/yoradio/GC9106.jpg
#define TIME_SIZE 35
#define PSFBUFFER
#include "displayGC9106.h"
#elif DSP_MODEL==DSP_CUSTOM
#define TIME_SIZE 0
#include "displayCustom.h"
#elif DSP_MODEL==DSP_ILI9225
#elif DSP_MODEL==DSP_ILI9225 // https://k210.org/images/content/uploads/yoradio/ILI9225.jpg
#define TIME_SIZE 35
#include "displayILI9225.h"
#elif DSP_MODEL==DSP_ST7796
#elif DSP_MODEL==DSP_ST7796 // https://k210.org/images/content/uploads/yoradio/ST7796.jpg
#define TIME_SIZE 70
#define PSFBUFFER
#include "displayST7796.h"
#elif DSP_MODEL==DSP_GC9A01A
#elif DSP_MODEL==DSP_GC9A01A // https://k210.org/images/content/uploads/yoradio/GC9A01A.jpg
#define TIME_SIZE 52
#define PSFBUFFER
#include "displayGC9A01A.h"
#elif DSP_MODEL==DSP_ILI9488 || DSP_MODEL==DSP_ILI9486
#elif DSP_MODEL==DSP_ILI9488 || DSP_MODEL==DSP_ILI9486 // https://k210.org/images/content/uploads/yoradio/ILI9488.jpg
#define TIME_SIZE 70
#define PSFBUFFER
#include "displayILI9488.h"
#elif DSP_MODEL==DSP_SSD1322
#elif DSP_MODEL==DSP_SSD1322 // https://k210.org/images/content/uploads/yoradio/ssd1322.mp4
#define TIME_SIZE 35
#define DSP_OLED
#include "displaySSD1322.h"
#elif DSP_MODEL==DSP_ST7920
#elif DSP_MODEL==DSP_ST7920 // https://k210.org/images/content/uploads/yoradio/ST7920.jpg
#define TIME_SIZE 2
#define DSP_OLED
#include "displayST7920.h"
#endif
//extern DspCore dsp;

View File

@@ -53,7 +53,7 @@ const GFXglyph DS_DIGI15pt7bGlyphs[] PROGMEM = {
{ 257, 3, 15, 6, 2, -14 } // 0x3A ':'
};
const GFXfont DS_DIGI15pt7b PROGMEM = {
const GFXfont Clock_GFXfont PROGMEM = {
(uint8_t *)DS_DIGI15pt7bBitmaps,
(GFXglyph *)DS_DIGI15pt7bGlyphs, 0x20, 0x3A, 29 };

View File

@@ -53,7 +53,7 @@ const GFXglyph DS_DIGI15pt7bGlyphs[] PROGMEM = {
{ 257, 3, 15, 6, 2, -14 } // 0x3A ':'
};
const GFXfont DS_DIGI15pt7b PROGMEM = {
const GFXfont Clock_GFXfont PROGMEM = {
(uint8_t *)DS_DIGI15pt7bBitmaps,
(GFXglyph *)DS_DIGI15pt7bGlyphs, 0x20, 0x3A, 29 };

View File

@@ -75,7 +75,7 @@ const uint8_t DS_DIGI28pt7bBitmaps[] PROGMEM = {
};
const GFXglyph DS_DIGI28pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 12, 0, 1 }, // 0x20 ' '
{ 0, 0, 0, 11, 0, 1 }, // 0x20 ' '
{ 0, 0, 0, 0, 0, 0 }, // 0x21 '!'
{ 0, 0, 0, 0, 0, 0 }, // 0x22 '"'
{ 0, 0, 0, 0, 0, 0 }, // 0x23 '#'
@@ -104,6 +104,6 @@ const GFXglyph DS_DIGI28pt7bGlyphs[] PROGMEM = {
{ 859, 4, 29, 11, 4, -28 } // 0x3A ':'
};
const GFXfont DS_DIGI28pt7b PROGMEM = {
const GFXfont Clock_GFXfont PROGMEM = {
(uint8_t *)DS_DIGI28pt7bBitmaps,
(GFXglyph *)DS_DIGI28pt7bGlyphs, 0x20, 0x3A, 55 };

View File

@@ -75,7 +75,7 @@ const uint8_t DS_DIGI28pt7bBitmaps[] PROGMEM = {
};
const GFXglyph DS_DIGI28pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 12, 0, 1 }, // 0x20 ' '
{ 0, 0, 0, 11, 0, 1 }, // 0x20 ' '
{ 0, 0, 0, 0, 0, 0 }, // 0x21 '!'
{ 0, 0, 0, 0, 0, 0 }, // 0x22 '"'
{ 0, 0, 0, 0, 0, 0 }, // 0x23 '#'
@@ -104,6 +104,6 @@ const GFXglyph DS_DIGI28pt7bGlyphs[] PROGMEM = {
{ 859, 4, 29, 11, 4, -28 } // 0x3A ':'
};
const GFXfont DS_DIGI28pt7b PROGMEM = {
const GFXfont Clock_GFXfont PROGMEM = {
(uint8_t *)DS_DIGI28pt7bBitmaps,
(GFXglyph *)DS_DIGI28pt7bGlyphs, 0x20, 0x3A, 55 };

View File

@@ -192,7 +192,7 @@ const GFXglyph DS_DIGI42pt7bGlyphs[] PROGMEM = {
{ 1888, 6, 43, 15, 4, -42 } // 0x3A ':'
};
const GFXfont DS_DIGI42pt7b PROGMEM = {
const GFXfont Clock_GFXfont PROGMEM = {
(uint8_t *)DS_DIGI42pt7bBitmaps,
(GFXglyph *)DS_DIGI42pt7bGlyphs, 0x20, 0x3A, 82 };

View File

@@ -343,7 +343,7 @@ const GFXglyph DS_DIGI56pt7bGlyphs[] PROGMEM = {
{ 3688, 7, 59, 24, 8, -58 } // 0x3A ':'
};
const GFXfont DS_DIGI56pt7b PROGMEM = {
const GFXfont Clock_GFXfont PROGMEM = {
(uint8_t *)DS_DIGI56pt7bBitmaps,
(GFXglyph *)DS_DIGI56pt7bGlyphs, 0x20, 0x3A, 110 };

View File

@@ -0,0 +1,38 @@
#ifndef bootlogo_h
#define bootlogo_h
/*******************************************************************************
* generated by lcd-image-converter rev.030b30d from 2019-03-17 01:38:34 +0500
* image
* filename: unsaved
* name: bootlogo
*
* preset name: Color R5G6B5
* data block size: 16 bit(s), uint16_t
* RLE compression enabled: no
* conversion type: Color, not_used not_used
* split to rows: yes
* bits per pixel: 16
*
* preprocess:
* main scan direction: top_to_bottom
* line scan direction: forward
* inverse: no
*******************************************************************************/
#include <stdint.h>
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 28
const unsigned char logo [] PROGMEM=
{
0x07, 0x03, 0x80, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x07,
0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x07, 0xff, 0x80, 0x1f, 0xff,
0xc0, 0x1f, 0xff, 0xe0, 0x3f, 0xff, 0xf0, 0x7f, 0x07, 0xf0, 0x7e, 0x03, 0xf0, 0x7e, 0x01, 0xf8,
0x7f, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xf8, 0x7e, 0x00, 0x00, 0x7f,
0x00, 0x00, 0x7f, 0x80, 0x20, 0x3f, 0xff, 0xe0, 0x3f, 0xff, 0xe0, 0x1f, 0xff, 0xe0, 0x0f, 0xff,
0xe0, 0x01, 0xff, 0xc0
};
#endif

View File

@@ -0,0 +1,40 @@
#ifndef bootlogo_h
#define bootlogo_h
/*******************************************************************************
* generated by lcd-image-converter rev.030b30d from 2019-03-17 01:38:34 +0500
* image
* filename: unsaved
* name: bootlogo
*
* preset name: Color R5G6B5
* data block size: 16 bit(s), uint16_t
* RLE compression enabled: no
* conversion type: Color, not_used not_used
* split to rows: yes
* bits per pixel: 16
*
* preprocess:
* main scan direction: top_to_bottom
* line scan direction: forward
* inverse: no
*******************************************************************************/
#include <stdint.h>
#define LOGO_WIDTH 21
#define LOGO_HEIGHT 32
static const unsigned char logo [] PROGMEM=
{
0x06, 0x03, 0x00, 0x0f, 0x07, 0x80, 0x1f, 0x8f, 0xc0, 0x1f, 0x8f, 0xc0,
0x0f, 0x07, 0x80, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x03, 0xff, 0x00, 0x0f, 0xff, 0x80,
0x1f, 0xff, 0xc0, 0x1f, 0xff, 0xc0, 0x3f, 0x8f, 0xe0, 0x7e, 0x03, 0xf0,
0x7c, 0x01, 0xf0, 0x7c, 0x01, 0xf0, 0x7f, 0xff, 0xf0, 0xff, 0xff, 0xf8,
0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3f, 0xc0, 0xe0, 0x3f, 0xff, 0xe0,
0x1f, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0xfe, 0x00
};
#endif

View File

@@ -22,8 +22,10 @@
*******************************************************************************/
#include <stdint.h>
#define LOGO_WIDTH 62
#define LOGO_HEIGHT 40
static const uint16_t bootlogo40[2480] PROGMEM = {
static const uint16_t logo[2480] PROGMEM = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x5aa4, 0xcdc9, 0xde6a, 0xde4a, 0x9c67, 0x20e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1081, 0x83a5, 0xc527, 0xc526, 0xb4c5, 0x5a83, 0x0820, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7345, 0xd60a, 0xd62a, 0xde2a, 0xde4a, 0xde4a, 0xc5a9, 0x18e1, 0x0000, 0x0000, 0x0000, 0x1081, 0xbd48, 0xcd88, 0xc547, 0xc527, 0xbd06, 0xbce6, 0x7b44, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2102, 0xd5c9, 0xd5c9, 0xd5e9, 0xd60a, 0xd62a, 0xde4a, 0xde4a, 0x83c6, 0x0000, 0x0000, 0x0000, 0x83e6, 0xd5e9, 0xcda8, 0xcd88, 0xcd68, 0xc547, 0xc527, 0xc527, 0x20e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,

View File

@@ -22,8 +22,10 @@
*******************************************************************************/
#include <stdint.h>
#define LOGO_WIDTH 99
#define LOGO_HEIGHT 64
static const uint16_t bootlogo2[6336] PROGMEM = {
static const uint16_t logo[6336] PROGMEM = {
// ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙▒▓▓▓▓▒∙∙∙∙∙∙∙∙∙∙∙∙░▒▓▓▓▒░∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙
// ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙▒▓▓▓▓▓▓▓▓░∙∙∙∙∙∙∙∙∙▓▓▓▓▓▒▒▒▒∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙
// ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙░▓▓▓▓▓▓▓▓▓▓░∙∙∙∙∙∙∙▓▓▓▓▓▓▓▓▒▒▒∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙

View File

@@ -0,0 +1,10 @@
#ifndef dsfont_h
#define dsfont_h
#if CLOCKFONT_MONO
#include "DS_DIGI15pt7b_mono.h"
#else
#include "DS_DIGI15pt7b.h"
#endif
#endif

View File

@@ -0,0 +1,10 @@
#ifndef dsfont_h
#define dsfont_h
#if CLOCKFONT_MONO
#include "DS_DIGI28pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "DS_DIGI28pt7b.h"
#endif
#endif

View File

@@ -0,0 +1,10 @@
#ifndef dsfont_h
#define dsfont_h
#if CLOCKFONT_MONO
#include "DS_DIGI42pt7b_mono.h" // https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
#else
#include "DS_DIGI42pt7b.h"
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More