v0.7.402
This commit is contained in:
@@ -536,10 +536,10 @@ void TFT_22_ILI9225::_resetWindow() {
|
||||
}
|
||||
|
||||
|
||||
void TFT_22_ILI9225::clear() {
|
||||
void TFT_22_ILI9225::clear(uint16_t withColor) {
|
||||
uint8_t old = _orientation;
|
||||
setOrientation(0);
|
||||
fillRectangle(0, 0, _maxX - 1, _maxY - 1, COLOR_BLACK);
|
||||
fillRectangle(0, 0, _maxX - 1, _maxY - 1, withColor);
|
||||
setOrientation(old);
|
||||
delay(10);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class TFT_22_ILI9225 {
|
||||
#endif
|
||||
|
||||
/// Clear the screen
|
||||
void clear(void);
|
||||
void clear(uint16_t withColor = COLOR_BLACK);
|
||||
|
||||
/// Invert screen
|
||||
/// @param flag true to invert, false for normal screen
|
||||
|
||||
@@ -97,14 +97,14 @@ char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||
|
||||
void DspCore::apScreen() {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.title1, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 3 * TFT_LINEHGHT);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.title2, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, 107);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, 117);
|
||||
@@ -117,7 +117,7 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin(DEF_SPI_FREQ);
|
||||
cp437(true);
|
||||
invert();
|
||||
fillScreen(TFT_BG);
|
||||
// fillScreen(TFT_BG);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
@@ -128,14 +128,10 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
|
||||
void DspCore::drawLogo() {
|
||||
fillScreen(0x0000);
|
||||
drawRGBBitmap((swidth - 62) / 2, 5, bootlogo40, 62, 40);
|
||||
}
|
||||
|
||||
// http://greekgeeks.net/#maker-tools_convertColor
|
||||
#define CLR_ITEM1 0x52AA
|
||||
#define CLR_ITEM2 0x39C7
|
||||
#define CLR_ITEM3 0x18E3
|
||||
|
||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
@@ -145,21 +141,21 @@ void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
//fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT + 2, TFT_LOGO);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (abs(i - 3) == 3) setTextColor(CLR_ITEM3, TFT_BG);
|
||||
if (abs(i - 3) == 2) setTextColor(CLR_ITEM2, TFT_BG);
|
||||
if (abs(i - 3) == 1) setTextColor(CLR_ITEM1, TFT_BG);
|
||||
if (abs(i - 3) == 3) setTextColor(config.theme.playlist[2], config.theme.background);
|
||||
if (abs(i - 3) == 2) setTextColor(config.theme.playlist[1], config.theme.background);
|
||||
if (abs(i - 3) == 1) setTextColor(config.theme.playlist[0], config.theme.background);
|
||||
if (i == 3) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT - 1, swidth, PLMITEMHEIGHT - 4, TFT_BG);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT - 1, swidth, PLMITEMHEIGHT - 4, config.theme.background);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::clearDsp() {
|
||||
fillScreen(TFT_BG);
|
||||
fillScreen(config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
@@ -239,7 +235,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
||||
getTextBounds(oldTimeBuf, 0, 0, &x, &y, &wot, &hot);
|
||||
setCursor((swidth - wot) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
setTextColor(TFT_BG);
|
||||
setTextColor(config.theme.background);
|
||||
print(oldTimeBuf);
|
||||
dot = (swidth - wot) / 2 - 4 + clockdelta;
|
||||
/* dots */
|
||||
@@ -253,7 +249,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
strlcpy(oldTimeBuf, timeBuf, 20);
|
||||
setTextSize(1);
|
||||
getTextBounds(timeBuf, 0, 0, &x, &y, &ncwidth, &ncheight);
|
||||
setTextColor(TFT_LOGO);
|
||||
setTextColor(config.theme.clock);
|
||||
setCursor((swidth - ncwidth) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
dot = (swidth - ncwidth) / 2 - 4 + clockdelta;
|
||||
setTextSize(1);
|
||||
@@ -265,7 +261,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
/* dots */
|
||||
}
|
||||
setCursor(dot, clockY+28+6);
|
||||
setTextColor(dots?TFT_BG:TFT_LOGO);
|
||||
setTextColor(dots?config.theme.background:config.theme.clock);
|
||||
print(":");
|
||||
setFont();
|
||||
yield();
|
||||
@@ -277,18 +273,18 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT - 2;
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT * 2;
|
||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth);
|
||||
fillRect(TFT_FRAMEWDT, vTop, vWidth, 2, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, vTop, ww, 2, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT, vTop, vWidth, 2, config.theme.background);
|
||||
fillRect(TFT_FRAMEWDT, vTop, ww, 2, config.theme.volbarout);
|
||||
if (withNumber) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, VTOP + hv);
|
||||
print(volstr);
|
||||
setFont();
|
||||
@@ -297,14 +293,14 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
|
||||
void DspCore::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, VTOP + hv);
|
||||
print(numstr);
|
||||
setFont();
|
||||
@@ -312,19 +308,19 @@ void DspCore::drawNextStationNum(uint16_t num) {
|
||||
|
||||
void DspCore::frameTitle(const char* str) {
|
||||
setTextSize(2);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
centerText(str, TFT_FRAMEWDT, config.theme.meta, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::rssi(const char* str) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
setTextSize(1);
|
||||
rightText(str, vTop, SILVER, TFT_BG);
|
||||
rightText(str, vTop, config.theme.rssi, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::ip(const char* str) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.ip, config.theme.background);
|
||||
setCursor(4, vTop);
|
||||
print(str);
|
||||
}
|
||||
@@ -385,4 +381,8 @@ void DspCore::flip(){
|
||||
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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "fonts/DS_DIGI28pt7b.h"
|
||||
|
||||
#define VU_READY 1
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 0
|
||||
@@ -62,6 +63,8 @@ class DspCore: public Adafruit_GC9106Ex {
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
/*virtual void sendCommand(uint8_t commandByte, uint8_t *dataBytes,
|
||||
uint8_t numDataBytes);
|
||||
virtual void sendCommand(uint8_t commandByte, const uint8_t *dataBytes = NULL,
|
||||
@@ -83,7 +86,7 @@ extern DspCore dsp;
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define BLACK 0x0000
|
||||
/*#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define RED 0xF800
|
||||
#define GREEN 0x07E0
|
||||
@@ -110,6 +113,6 @@ extern DspCore dsp;
|
||||
|
||||
#define TFT_BG BLACK
|
||||
#define TFT_FG WHITE
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -96,15 +96,17 @@ char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||
}
|
||||
|
||||
void DspCore::apScreen() {
|
||||
started = true;
|
||||
clearDsp();
|
||||
setTextSize(TITLE_SIZE1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.title1, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP1);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP2);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.title2, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*4);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*2);
|
||||
@@ -112,7 +114,7 @@ void DspCore::apScreen() {
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
TAKE_MUTEX();
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, SILVER);
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, config.theme.div);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
@@ -189,10 +191,10 @@ void DspCore::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
//hspi.begin();
|
||||
started = false;
|
||||
begin();
|
||||
invert();
|
||||
setBackgroundColor(TFT_BG);
|
||||
clear();
|
||||
// clear(0x0000);
|
||||
flip();
|
||||
setTextSize(1);
|
||||
screenwidth = maxX();
|
||||
@@ -202,11 +204,11 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
|
||||
void DspCore::drawLogo() {
|
||||
// setBackgroundColor(0x0000);
|
||||
drawBitmap((swidth - 99) / 2, (sheight-64)/2 - TFT_LINEHGHT*2, bootlogo2, 99, 64);
|
||||
// setBackgroundColor(config.theme.background);
|
||||
}
|
||||
|
||||
// http://greekgeeks.net/#maker-tools_convertColor
|
||||
uint16_t iclrs[] = { 0x738E /*707070*/, 0x52AA /*575757*/, 0x39C7, 0x18E3 };
|
||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
@@ -214,22 +216,24 @@ void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
config.fillPlMenu(plMenu, currentItem - 4, PLMITEMS);
|
||||
setTextSize(2);
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT, TFT_LOGO);
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT, config.theme.meta);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (i == 4) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setTextColor(iclrs[abs(i - 4)-1], TFT_BG);
|
||||
setTextColor(config.theme.playlist[abs(i - 4)-1], config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT-1, swidth, PLMITEMHEIGHT-7, TFT_BG);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT-1, swidth, PLMITEMHEIGHT-7, config.theme.background);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::clearDsp() {
|
||||
//fillScreen(TFT_BG);
|
||||
clear();
|
||||
//fillRect(0, 0, swidth, sheight, config.theme.background);
|
||||
TAKE_MUTEX();
|
||||
clear(started?config.theme.background:0x0000);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
@@ -260,7 +264,7 @@ void DspCore::centerText(const char* text, uint16_t y, uint16_t fg, uint16_t bg)
|
||||
if(y==90) y=(sheight-64)/2 + 64 + TFT_LINEHGHT;
|
||||
if(y==110) y=(sheight-64)/2 + 64 + TFT_LINEHGHT*3;
|
||||
getTextBounds(txt, 0, 0, &x1, &y1, &w, &h);
|
||||
setTextColor(fg);
|
||||
setTextColor(fg, bg);
|
||||
setCursor((swidth - w) / 2, y);
|
||||
fillRect((swidth-w)/2-5, y, w+10, h, bg);
|
||||
print(txt);
|
||||
@@ -279,18 +283,18 @@ void DspCore::displayHeapForDebug() {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||
char buf[50];
|
||||
setTextSize(1);
|
||||
setTextColor(DARK_GRAY, TFT_BG);
|
||||
setTextColor(config.theme.heap, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, config.theme.background);
|
||||
sprintf(buf, "%d / %d", ESP.getFreeHeap(), ESP.getMaxAllocHeap());
|
||||
print(buf);
|
||||
// audio buffer;
|
||||
fillRect(0, sheight - 2, swidth, 2, TFT_BG);
|
||||
fillRect(0, sheight - 2, swidth, 2, config.theme.background);
|
||||
int astored = player.inBufferFilled();
|
||||
int afree = player.inBufferFree();
|
||||
int aprcnt = 100 * astored / (astored + afree);
|
||||
byte sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, SILVER);
|
||||
uint16_t sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, config.theme.buffer);
|
||||
}
|
||||
|
||||
void DspCore::printClock(const char* timestr) {
|
||||
@@ -316,34 +320,34 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
clwidth = wot+clsp+34;
|
||||
clleft=swidth-TFT_FRAMEWDT-clwidth;
|
||||
setCursor(clleft, cltop);
|
||||
setTextColor(TFT_BG);
|
||||
setTextColor(config.theme.background, config.theme.background);
|
||||
print(oldTimeBuf);
|
||||
strlcpy(oldTimeBuf, timeBuf, 20);
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wot, &hot);
|
||||
clwidth = wot+clsp+34;
|
||||
clleft=swidth-TFT_FRAMEWDT-clwidth;
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setTextColor(config.theme.clock, config.theme.background);
|
||||
setCursor(clleft, cltop);
|
||||
print(timeBuf);
|
||||
gFont=false;
|
||||
setTextSize(2);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.dow, config.theme.background);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+22);
|
||||
print(utf8Rus(dow[timeinfo.tm_wday], false));
|
||||
TAKE_MUTEX();
|
||||
drawLine(clleft+wot+clsp/2, cltop-34, clleft+wot+clsp/2, cltop+1, SILVER); //vert
|
||||
drawLine(clleft+wot+clsp/2, cltop-hot+20, clleft+wot+clsp/2+35, cltop-hot+20, SILVER); //hor
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, SILVER);
|
||||
drawLine(clleft+wot+clsp/2, cltop-34, clleft+wot+clsp/2, cltop+1, config.theme.div); //vert
|
||||
drawLine(clleft+wot+clsp/2, cltop-hot+20, clleft+wot+clsp/2+35, cltop-hot+20, config.theme.div); //hor
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, config.theme.div);
|
||||
GIVE_MUTEX();
|
||||
sprintf(timeBuf, "%2d %s %d", timeinfo.tm_mday,mnths[timeinfo.tm_mon], timeinfo.tm_year+1900);
|
||||
uint16_t wdate, hdate;
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wdate, &hdate);
|
||||
fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, TFT_BG);
|
||||
fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, config.theme.background);
|
||||
setTextSize(1);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, TFT_FG, TFT_BG, false, 12);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, config.theme.date, config.theme.background, false, 12);
|
||||
}
|
||||
setTextSize(2);
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+1);
|
||||
sprintf(timeBuf, "%02d", timeinfo.tm_sec);
|
||||
print(timeBuf);
|
||||
@@ -355,12 +359,13 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT *2;
|
||||
(void)volTop;
|
||||
uint16_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG);
|
||||
drawRectangle(TFT_FRAMEWDT, vTop - 2, TFT_FRAMEWDT+vWidth, 6+vTop - 2, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, config.theme.background);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, config.theme.volbarin);
|
||||
drawRectangle(TFT_FRAMEWDT, vTop - 2, TFT_FRAMEWDT+vWidth, 6+vTop - 2, config.theme.volbarout);
|
||||
|
||||
if (withNumber) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit, config.theme.background);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
@@ -373,9 +378,9 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
print(volstr);*/
|
||||
sprintf(volstr, "%d", oldVolume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect((swidth - wv) / 2 - 12, (sheight-hv)/2, wv+24, hv, TFT_BG);
|
||||
fillRect((swidth - wv) / 2 - 12, (sheight-hv)/2, wv+24, hv, config.theme.background);
|
||||
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.vol, config.theme.background);
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
@@ -386,23 +391,23 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
|
||||
void DspCore::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit, config.theme.background);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(numstr);
|
||||
}
|
||||
|
||||
void DspCore::frameTitle(const char* str) {
|
||||
setTextSize(META_SIZE);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
centerText(str, TFT_FRAMEWDT, config.theme.meta, config.theme.background);
|
||||
TAKE_MUTEX();
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, SILVER);
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, config.theme.div);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
@@ -411,15 +416,19 @@ void DspCore::rssi(const char* str) {
|
||||
char buf[20];
|
||||
sprintf(buf, "RSSI:%s", str);
|
||||
setTextSize(1);
|
||||
rightText(buf, vTop, SILVER, TFT_BG);
|
||||
rightText(buf, vTop, config.theme.rssi, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::ip(const char* str) {
|
||||
if(!started){
|
||||
started = true;
|
||||
clear(config.theme.background);
|
||||
}
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
char buf[30];
|
||||
sprintf(buf, "IP: %s", str);
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.ip, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
print(buf);
|
||||
}
|
||||
@@ -455,4 +464,8 @@ void DspCore::flip(){
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
|
||||
void DspCore::sleep(void) { setDisplay(false); }
|
||||
void DspCore::wake(void) { setDisplay(true); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 4
|
||||
@@ -32,7 +33,6 @@
|
||||
#ifndef TITLE_TOP2
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + (META_SIZE+2) * TFT_LINEHGHT
|
||||
#endif
|
||||
#define TITLE_FG2 SILVER
|
||||
|
||||
class DspCore: public TFT_22_ILI9225 {
|
||||
public:
|
||||
@@ -66,7 +66,7 @@ class DspCore: public TFT_22_ILI9225 {
|
||||
void setFont(uint8_t* font, bool monoSp=false );
|
||||
void setFont(const GFXfont *f = NULL);
|
||||
void setTextSize(uint8_t s);
|
||||
void setTextColor(uint16_t fg, uint16_t bg=0x0000);
|
||||
void setTextColor(uint16_t fg, uint16_t bg);
|
||||
void setCursor(int16_t x, int16_t y);
|
||||
uint16_t print(const char* s);
|
||||
void getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1,
|
||||
@@ -78,11 +78,13 @@ class DspCore: public TFT_22_ILI9225 {
|
||||
void drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap, int16_t w, int16_t h);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
uint16_t bgcolor, fgcolor;
|
||||
int16_t cursorx, cursory;
|
||||
bool gFont;
|
||||
bool gFont, started;
|
||||
char oldTimeBuf[20];
|
||||
uint8_t oldVolume;
|
||||
uint16_t wot, hot;
|
||||
@@ -91,36 +93,4 @@ class DspCore: public TFT_22_ILI9225 {
|
||||
|
||||
extern DspCore dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define RED 0xF800
|
||||
#define GREEN 0x07E0
|
||||
#define MAGENTA 0xF81F
|
||||
#define YELLOW 0xFFE0
|
||||
#define WHITE 0xFFFF
|
||||
#define GRAY 0x7BEF
|
||||
#define DARK_GRAY 0x2945
|
||||
#define LIGHT_GRAY 0xC618
|
||||
#define LIME 0x87E0
|
||||
#define AQUA 0x5D1C
|
||||
#define CYAN 0x07FF
|
||||
#define DARK_CYAN 0x03EF
|
||||
#define ORANGE 0xFCA0
|
||||
#define PINK 0xF97F
|
||||
#define BROWN 0x8200
|
||||
#define VIOLET 0x9199
|
||||
#define SILVER 0xA510
|
||||
#define GOLD 0xA508
|
||||
#define NAVY 0x000F
|
||||
#define MAROON 0x7800
|
||||
#define PURPLE 0x780F
|
||||
#define OLIVE 0x7BE0
|
||||
|
||||
#define TFT_BG BLACK
|
||||
#define TFT_FG WHITE
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92
|
||||
|
||||
#endif
|
||||
|
||||
@@ -94,28 +94,28 @@ char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||
|
||||
void DspCore::apScreen() {
|
||||
setTextSize(TITLE_SIZE1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.title1, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP1);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP2);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.title2, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*4);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*2);
|
||||
print("http://");
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, config.theme.div);
|
||||
}
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin(); /* SPI_DEFAULT_FREQ 40000000 */
|
||||
invert();
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
// fillScreen(config.theme.background);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
setTextSize(1);
|
||||
@@ -126,33 +126,32 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
|
||||
void DspCore::drawLogo() {
|
||||
fillScreen(0x0000);
|
||||
drawRGBBitmap((swidth - 99) / 2, (sheight-64)/2 - TFT_LINEHGHT*2, bootlogo2, 99, 64);
|
||||
}
|
||||
|
||||
// http://greekgeeks.net/#maker-tools_convertColor
|
||||
uint16_t iclrs[] = { 0x738E /*707070*/, 0x52AA /*575757*/, 0x39C7, 0x18E3 };
|
||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
}
|
||||
config.fillPlMenu(plMenu, currentItem - 4, PLMITEMS);
|
||||
config.fillPlMenu(plMenu, currentItem - 5, PLMITEMS);
|
||||
setTextSize(2);
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT + 2, TFT_LOGO);
|
||||
fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT + 2, config.theme.meta);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (i == 4) {
|
||||
if (i == 5) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setTextColor(iclrs[abs(i - 4)-1], TFT_BG);
|
||||
setTextColor(config.theme.playlist[abs(i - 5)-1], config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT-1, swidth, PLMITEMHEIGHT-4, TFT_BG);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT-1, swidth, PLMITEMHEIGHT-4, config.theme.background);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::clearDsp() {
|
||||
fillScreen(TFT_BG);
|
||||
fillScreen(config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
@@ -202,19 +201,19 @@ void DspCore::rightText(const char* text, uint16_t y, uint16_t fg, uint16_t bg,
|
||||
void DspCore::displayHeapForDebug() {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||
setTextSize(1);
|
||||
setTextColor(DARK_GRAY, TFT_BG);
|
||||
setTextColor(config.theme.heap, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, config.theme.background);
|
||||
print(ESP.getFreeHeap());
|
||||
print(" / ");
|
||||
print(ESP.getMaxAllocHeap());
|
||||
// audio buffer;
|
||||
fillRect(0, sheight - 2, swidth, 2, TFT_BG);
|
||||
fillRect(0, sheight - 2, swidth, 2, config.theme.background);
|
||||
int astored = player.inBufferFilled();
|
||||
int afree = player.inBufferFree();
|
||||
int aprcnt = 100 * astored / (astored + afree);
|
||||
byte sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, SILVER);
|
||||
uint16_t sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, config.theme.buffer);
|
||||
}
|
||||
|
||||
void DspCore::printClock(const char* timestr) {
|
||||
@@ -239,21 +238,21 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
}
|
||||
clwidth = wot+clsp+(swidth>240?46:34);
|
||||
clleft=swidth-TFT_FRAMEWDT-clwidth;
|
||||
//fillRect(swidth-TFT_FRAMEWDT-clwidth, cltop-hot, clwidth, hot+3, TFT_BG);
|
||||
//fillRect(swidth-TFT_FRAMEWDT-clwidth, cltop-hot, clwidth, hot+3, config.theme.background);
|
||||
setCursor(clleft, cltop);
|
||||
setTextColor(TFT_BG);
|
||||
setTextColor(config.theme.background);
|
||||
print(oldTimeBuf);
|
||||
strlcpy(oldTimeBuf, timeBuf, 20);
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wot, &hot);
|
||||
clwidth = wot+clsp+(swidth>240?46:34);
|
||||
clleft=swidth-TFT_FRAMEWDT-clwidth;
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setTextColor(config.theme.clock, config.theme.background);
|
||||
setCursor(clleft, cltop);
|
||||
print(timeBuf);
|
||||
|
||||
setFont();
|
||||
setTextSize(3);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.dow, config.theme.background);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+32);
|
||||
print(utf8Rus(dow[timeinfo.tm_wday], false));
|
||||
|
||||
@@ -261,15 +260,15 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
setTextSize(1);
|
||||
uint16_t wdate, hdate;
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wdate, &hdate);
|
||||
fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, TFT_BG);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, TFT_FG, TFT_BG, false, swidth>240?12:0);
|
||||
drawFastVLine(clleft+wot+clsp/2+3, cltop-hot, hot+3, SILVER);
|
||||
drawFastHLine(clleft+wot+clsp/2+3, cltop-hot+29, 42, SILVER);
|
||||
fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, config.theme.background);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, config.theme.date, config.theme.background, false, swidth>240?12:0);
|
||||
drawFastVLine(clleft+wot+clsp/2+3, cltop-hot, hot+3, config.theme.div);
|
||||
drawFastHLine(clleft+wot+clsp/2+3, cltop-hot+29, 42, config.theme.div);
|
||||
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, config.theme.div);
|
||||
}
|
||||
setTextSize(3);
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+1);
|
||||
sprintf(timeBuf, "%02d", timeinfo.tm_sec);
|
||||
print(timeBuf);
|
||||
@@ -280,36 +279,36 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
int16_t volTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT *2;
|
||||
uint16_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, config.theme.background);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, config.theme.volbarin);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, config.theme.volbarout);
|
||||
if(swidth>240){
|
||||
char buf[20];
|
||||
sprintf(buf, "VOL %d", config.store.volume);
|
||||
setTextSize(1);
|
||||
centerText(buf, volTop, SILVER, TFT_BG);
|
||||
centerText(buf, volTop, config.theme.vol, config.theme.background);
|
||||
}
|
||||
if (withNumber) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
|
||||
/*setTextColor(TFT_BG);
|
||||
/*setTextColor(config.theme.background);
|
||||
sprintf(volstr, "%d", oldVolume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(volstr);*/
|
||||
sprintf(volstr, "%d", oldVolume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect((swidth - wv) / 2 - 12, (sheight-hv)/2, wv+24, hv+4, TFT_BG);
|
||||
fillRect((swidth - wv) / 2 - 12, (sheight-hv)/2, wv+24, hv+4, config.theme.background);
|
||||
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.vol);
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
//fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
//fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(volstr);
|
||||
oldVolume=config.store.volume;
|
||||
@@ -319,14 +318,14 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
|
||||
void DspCore::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(numstr);
|
||||
setFont();
|
||||
@@ -334,8 +333,8 @@ void DspCore::drawNextStationNum(uint16_t num) {
|
||||
|
||||
void DspCore::frameTitle(const char* str) {
|
||||
setTextSize(META_SIZE);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
centerText(str, TFT_FRAMEWDT, config.theme.meta, config.theme.background);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, config.theme.div);
|
||||
}
|
||||
|
||||
void DspCore::rssi(const char* str) {
|
||||
@@ -343,7 +342,7 @@ void DspCore::rssi(const char* str) {
|
||||
char buf[20];
|
||||
sprintf(buf, "RSSI:%s", str);
|
||||
setTextSize(1);
|
||||
rightText(buf, vTop, SILVER, TFT_BG);
|
||||
rightText(buf, vTop, config.theme.rssi, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::ip(const char* str) {
|
||||
@@ -351,7 +350,7 @@ void DspCore::ip(const char* str) {
|
||||
char buf[30];
|
||||
sprintf(buf, "IP: %s", str);
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.ip, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
print(buf);
|
||||
}
|
||||
@@ -392,4 +391,8 @@ void DspCore::flip(){
|
||||
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);}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 8
|
||||
@@ -21,14 +22,13 @@
|
||||
#define SCROLLTIME 30
|
||||
#endif
|
||||
|
||||
#define PLMITEMS 9
|
||||
#define PLMITEMS 11
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 22
|
||||
#define TFT_FULLTIME 1
|
||||
|
||||
#define TITLE_TOP1 TFT_FRAMEWDT + META_SIZE * TFT_LINEHGHT + 8
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + (META_SIZE+2) * TFT_LINEHGHT + 8
|
||||
#define TITLE_FG2 SILVER
|
||||
|
||||
class DspCore: public Adafruit_ILI9341 {
|
||||
public:
|
||||
@@ -63,6 +63,8 @@ class DspCore: public Adafruit_ILI9341 {
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
@@ -73,36 +75,4 @@ class DspCore: public Adafruit_ILI9341 {
|
||||
|
||||
extern DspCore dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define RED 0xF800
|
||||
#define GREEN 0x07E0
|
||||
#define MAGENTA 0xF81F
|
||||
#define YELLOW 0xFFE0
|
||||
#define WHITE 0xFFFF
|
||||
#define GRAY 0x7BEF
|
||||
#define DARK_GRAY 0x2945
|
||||
#define LIGHT_GRAY 0xC618
|
||||
#define LIME 0x87E0
|
||||
#define AQUA 0x5D1C
|
||||
#define CYAN 0x07FF
|
||||
#define DARK_CYAN 0x03EF
|
||||
#define ORANGE 0xFCA0
|
||||
#define PINK 0xF97F
|
||||
#define BROWN 0x8200
|
||||
#define VIOLET 0x9199
|
||||
#define SILVER 0xA510
|
||||
#define GOLD 0xA508
|
||||
#define NAVY 0x000F
|
||||
#define MAROON 0x7800
|
||||
#define PURPLE 0x780F
|
||||
#define OLIVE 0x7BE0
|
||||
|
||||
#define TFT_BG BLACK
|
||||
#define TFT_FG WHITE
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
#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
|
||||
#endif
|
||||
|
||||
#ifdef LCD_2004
|
||||
const byte controlspaces[] = { CLOCK_SPACE, 0, 0, VOL_SPACE };
|
||||
#else
|
||||
const byte controlspaces[] = { CLOCK_SPACE, VOL_SPACE };
|
||||
#endif
|
||||
|
||||
DspCore::DspCore(): DSP_INIT {}
|
||||
|
||||
@@ -219,6 +223,19 @@ boolean DspCore::checkdelay(int m, unsigned long & tstamp) {
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::sleep(void) {
|
||||
noDisplay();
|
||||
#ifdef LCD_I2C
|
||||
noBacklight();
|
||||
#endif
|
||||
}
|
||||
void DspCore::wake(void) {
|
||||
display();
|
||||
#ifdef LCD_I2C
|
||||
backlight();
|
||||
#endif
|
||||
}
|
||||
|
||||
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||
int index = 0;
|
||||
static char strn[BUFLEN];
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#define TFT_LINEHGHT 1
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 9
|
||||
@@ -93,6 +93,8 @@ class DspCore: public LiquidCrystal {
|
||||
void loop(bool force=false);
|
||||
void flip(){};
|
||||
void invert(){};
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight, xOffset, yOffset;
|
||||
int16_t nextX;
|
||||
|
||||
@@ -134,6 +134,13 @@ void DspCore::data(uint8_t c) {
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin();
|
||||
setReinitInterval(255);
|
||||
config.theme.background = TFT_BG;
|
||||
config.theme.meta = TFT_FG;
|
||||
config.theme.title1 = TFT_FG;
|
||||
config.theme.title2 = TFT_FG;
|
||||
config.theme.rssi = TFT_FG;
|
||||
for(byte i=0;i<5;i++) config.theme.playlist[i] = TFT_FG;
|
||||
setContrast(config.store.contrast);
|
||||
cp437(true);
|
||||
invert();
|
||||
@@ -344,4 +351,8 @@ void DspCore::flip(){
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
|
||||
void DspCore::sleep(void) { command( PCD8544_FUNCTIONSET | PCD8544_POWERDOWN); }
|
||||
void DspCore::wake(void) { initDisplay(); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
#define DSP_CAN_SLEEP true
|
||||
#define DSP_OLED true
|
||||
|
||||
#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
|
||||
//#define SCROLLDELTA 8
|
||||
//#define SCROLLTIME 332
|
||||
@@ -60,6 +63,8 @@ class DspCore: public Adafruit_PCD8544 {
|
||||
virtual void data(uint8_t c);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -140,6 +140,12 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
Serial.println(F("SH110X allocation failed"));
|
||||
for (;;); // Don't proceed, loop forever
|
||||
}
|
||||
config.theme.background = TFT_BG;
|
||||
config.theme.meta = TFT_FG;
|
||||
config.theme.title1 = TFT_FG;
|
||||
config.theme.title2 = TFT_FG;
|
||||
config.theme.rssi = TFT_FG;
|
||||
for(byte i=0;i<5;i++) config.theme.playlist[i] = TFT_FG;
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
flip();
|
||||
@@ -356,4 +362,8 @@ void DspCore::flip(){
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
|
||||
void DspCore::sleep(void) { oled_command(SH110X_DISPLAYOFF); }
|
||||
void DspCore::wake(void) { oled_command(SH110X_DISPLAYON); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
#define DSP_CAN_SLEEP true
|
||||
#define DSP_OLED true
|
||||
|
||||
#define PLMITEMS 7
|
||||
#define PLMITEMLENGHT 40
|
||||
@@ -59,6 +61,8 @@ class DspCore: public Adafruit_SH1107 {
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -142,6 +142,12 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
Serial.println(F("SSD1305 allocation failed"));
|
||||
for (;;); // Don't proceed, loop forever
|
||||
}
|
||||
config.theme.background = TFT_BG;
|
||||
config.theme.meta = TFT_FG;
|
||||
config.theme.title1 = TFT_FG;
|
||||
config.theme.title2 = TFT_FG;
|
||||
config.theme.rssi = TFT_FG;
|
||||
for(byte i=0;i<5;i++) config.theme.playlist[i] = TFT_FG;
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
flip();
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <Adafruit_SSD1305.h>
|
||||
|
||||
#define WEATHER_READY 0
|
||||
#define DSP_CAN_SLEEP true
|
||||
#define DSP_OLED true
|
||||
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
@@ -139,6 +139,13 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
for (;;); // Don't proceed, loop forever
|
||||
}
|
||||
maxcontrast = DSP_MODEL==DSP_SSD1306?0xCF:0x8F;
|
||||
config.theme.background = TFT_BG;
|
||||
config.theme.meta = TFT_FG;
|
||||
config.theme.title1 = TFT_FG;
|
||||
config.theme.title2 = TFT_FG;
|
||||
config.theme.rssi = TFT_FG;
|
||||
for(byte i=0;i<5;i++) config.theme.playlist[i] = TFT_FG;
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
flip();
|
||||
@@ -360,4 +367,8 @@ void DspCore::flip(){
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
|
||||
void DspCore::sleep(void) { ssd1306_command(SSD1306_DISPLAYOFF); }
|
||||
void DspCore::wake(void) { ssd1306_command(SSD1306_DISPLAYON); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
#define PLMITEMLENGHT 40
|
||||
#define DSP_CAN_SLEEP true
|
||||
#define DSP_OLED true
|
||||
|
||||
#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
|
||||
#define SCROLLDELTA 2
|
||||
@@ -73,9 +75,12 @@ class DspCore: public Adafruit_SSD1306 {
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
uint8_t maxcontrast;
|
||||
char insideClc[10];
|
||||
boolean checkdelay(int m, unsigned long &tstamp);
|
||||
};
|
||||
|
||||
@@ -114,13 +114,28 @@ void DspCore::apScreen() {
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
}
|
||||
|
||||
#define CLR_ITEM1 0xA
|
||||
#define CLR_ITEM2 0x8
|
||||
#define CLR_ITEM3 0x5
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
tw.begin(I2C_SDA, I2C_SCL);
|
||||
if (!begin(SCREEN_ADDRESS)) {
|
||||
Serial.println(F("SSD1327 allocation failed"));
|
||||
for (;;);
|
||||
}
|
||||
config.theme.background = TFT_BG;
|
||||
config.theme.meta = TFT_FG;
|
||||
config.theme.title1 = TFT_FG;
|
||||
config.theme.title2 = SILVER;
|
||||
config.theme.rssi = TFT_FG;
|
||||
config.theme.weather = ORANGE;
|
||||
config.theme.heap = SILVER;
|
||||
config.theme.ip = SILVER;
|
||||
config.theme.playlist[0] = CLR_ITEM1;
|
||||
config.theme.playlist[1] = CLR_ITEM2;
|
||||
config.theme.playlist[2] = CLR_ITEM3;
|
||||
config.theme.playlist[3] = CLR_ITEM3;
|
||||
config.theme.playlist[4] = CLR_ITEM3;
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
flip();
|
||||
@@ -137,9 +152,6 @@ void DspCore::drawLogo() {
|
||||
drawGrayscaleBitmap((swidth - 99) / 2, 18, bootlogobw, 99, 64);
|
||||
}
|
||||
|
||||
#define CLR_ITEM1 0xA
|
||||
#define CLR_ITEM2 0x8
|
||||
#define CLR_ITEM3 0x5
|
||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
@@ -413,4 +425,8 @@ void DspCore::flip(){
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
|
||||
void DspCore::sleep(void) { oled_command(SSD1327_DISPLAYOFF); }
|
||||
void DspCore::wake(void) { oled_command(SSD1327_DISPLAYON); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "fonts/DS_DIGI28pt7b.h"
|
||||
|
||||
#define WEATHER_READY 1
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 4
|
||||
@@ -57,6 +58,8 @@ class DspCore: public Adafruit_SSD1327 {
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
int16_t x, y;
|
||||
|
||||
@@ -107,14 +107,14 @@ char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||
|
||||
void DspCore::apScreen() {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.title1, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 3 * TFT_LINEHGHT);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.title2, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, 107);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, 117);
|
||||
@@ -128,7 +128,7 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
|
||||
cp437(true);
|
||||
invert();
|
||||
fillScreen(TFT_BG);
|
||||
// fillScreen(0x0000);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
@@ -139,6 +139,7 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
|
||||
void DspCore::drawLogo() {
|
||||
fillScreen(0x0000);
|
||||
#ifdef DSP_MINI
|
||||
drawRGBBitmap((swidth - 62) / 2, 5, bootlogo40, 62, 40);
|
||||
#else
|
||||
@@ -146,11 +147,6 @@ void DspCore::drawLogo() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// http://greekgeeks.net/#maker-tools_convertColor
|
||||
#define CLR_ITEM1 0x52AA
|
||||
#define CLR_ITEM2 0x39C7
|
||||
#define CLR_ITEM3 0x18E3
|
||||
|
||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
@@ -160,21 +156,21 @@ void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
//fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT + 2, TFT_LOGO);
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (abs(i - 3) == 3) setTextColor(CLR_ITEM3, TFT_BG);
|
||||
if (abs(i - 3) == 2) setTextColor(CLR_ITEM2, TFT_BG);
|
||||
if (abs(i - 3) == 1) setTextColor(CLR_ITEM1, TFT_BG);
|
||||
if (abs(i - 3) == 3) setTextColor(config.theme.playlist[2], config.theme.background);
|
||||
if (abs(i - 3) == 2) setTextColor(config.theme.playlist[1], config.theme.background);
|
||||
if (abs(i - 3) == 1) setTextColor(config.theme.playlist[0], config.theme.background);
|
||||
if (i == 3) {
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT - 1, swidth, PLMITEMHEIGHT - 4, TFT_BG);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT - 1, swidth, PLMITEMHEIGHT - 4, config.theme.background);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::clearDsp() {
|
||||
fillScreen(TFT_BG);
|
||||
fillScreen(config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
@@ -222,19 +218,19 @@ void DspCore::displayHeapForDebug() {
|
||||
#ifndef DSP_MINI
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||
setTextSize(1);
|
||||
setTextColor(DARK_GRAY, TFT_BG);
|
||||
setTextColor(config.theme.heap, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, config.theme.background);
|
||||
print(ESP.getFreeHeap());
|
||||
print(" / ");
|
||||
print(ESP.getMaxAllocHeap());
|
||||
// audio buffer;
|
||||
fillRect(0, sheight - 2, swidth, 2, TFT_BG);
|
||||
fillRect(0, sheight - 2, swidth, 2, config.theme.background);
|
||||
int astored = player.inBufferFilled();
|
||||
int afree = player.inBufferFree();
|
||||
int aprcnt = 100 * astored / (astored + afree);
|
||||
byte sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, SILVER);
|
||||
fillRect(0, sheight - 2, sbw, 2, config.theme.title2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -271,7 +267,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
||||
getTextBounds(oldTimeBuf, 0, 0, &x, &y, &wot, &hot);
|
||||
setCursor((swidth - wot) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
setTextColor(TFT_BG);
|
||||
setTextColor(config.theme.background);
|
||||
print(oldTimeBuf);
|
||||
dot = (swidth - wot) / 2 - 4 + clockdelta;
|
||||
/* dots */
|
||||
@@ -285,7 +281,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
strlcpy(oldTimeBuf, timeBuf, 20);
|
||||
setTextSize(1);
|
||||
getTextBounds(timeBuf, 0, 0, &x, &y, &ncwidth, &ncheight);
|
||||
setTextColor(TFT_LOGO);
|
||||
setTextColor(config.theme.clock);
|
||||
setCursor((swidth - ncwidth) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
dot = (swidth - ncwidth) / 2 - 4 + clockdelta;
|
||||
setTextSize(1);
|
||||
@@ -297,7 +293,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
/* dots */
|
||||
}
|
||||
setCursor(dot, clockY+28+6);
|
||||
setTextColor(dots?TFT_BG:TFT_LOGO);
|
||||
setTextColor(dots?config.theme.background:config.theme.clock);
|
||||
print(":");
|
||||
setFont();
|
||||
yield();
|
||||
@@ -312,26 +308,26 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT - 2;
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT * 2;
|
||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth);
|
||||
fillRect(TFT_FRAMEWDT, vTop, vWidth, 2, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, vTop, ww, 2, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT, vTop, vWidth, 2, config.theme.background);
|
||||
fillRect(TFT_FRAMEWDT, vTop, ww, 2, config.theme.volbarin);
|
||||
#else
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT - 6;
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT * 2;
|
||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2 + 3, vWidth, 5, config.theme.background);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1 + 3, ww, 3, config.theme.volbarin);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2 + 3, vWidth, 5, config.theme.volbarout);
|
||||
#endif
|
||||
if (withNumber) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, VTOP + hv);
|
||||
print(volstr);
|
||||
setFont();
|
||||
@@ -340,14 +336,14 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
|
||||
void DspCore::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, VTOP, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, VTOP + hv);
|
||||
print(numstr);
|
||||
setFont();
|
||||
@@ -355,19 +351,19 @@ void DspCore::drawNextStationNum(uint16_t num) {
|
||||
|
||||
void DspCore::frameTitle(const char* str) {
|
||||
setTextSize(2);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
centerText(str, TFT_FRAMEWDT, config.theme.meta, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::rssi(const char* str) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
setTextSize(1);
|
||||
rightText(str, vTop, SILVER, TFT_BG);
|
||||
rightText(str, vTop, config.theme.rssi, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::ip(const char* str) {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.ip, config.theme.background);
|
||||
setCursor(4, vTop);
|
||||
print(str);
|
||||
}
|
||||
@@ -401,6 +397,7 @@ void DspCore::printText(const char* txt) {
|
||||
void DspCore::loop(bool force) {
|
||||
|
||||
}
|
||||
|
||||
void DspCore::flip(){
|
||||
if(ROTATE_90){
|
||||
setRotation(config.store.flipscreen?2:0);
|
||||
@@ -412,4 +409,12 @@ void DspCore::flip(){
|
||||
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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#if DTYPE==INITR_MINI160x80
|
||||
@@ -25,7 +26,6 @@
|
||||
#define PLMITEMHEIGHT 21
|
||||
#endif
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||
#define TITLE_FG2 SILVER
|
||||
|
||||
#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
|
||||
#define SCROLLDELTA 2
|
||||
@@ -74,6 +74,8 @@ class DspCore: public Adafruit_ST7735 {
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
@@ -86,36 +88,4 @@ class DspCore: public Adafruit_ST7735 {
|
||||
|
||||
extern DspCore dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define RED 0xF800
|
||||
#define GREEN 0x07E0
|
||||
#define MAGENTA 0xF81F
|
||||
#define YELLOW 0xFFE0
|
||||
#define WHITE 0xFFFF
|
||||
#define GRAY 0x7BEF
|
||||
#define DARK_GRAY 0x2945
|
||||
#define LIGHT_GRAY 0xC618
|
||||
#define LIME 0x87E0
|
||||
#define AQUA 0x5D1C
|
||||
#define CYAN 0x07FF
|
||||
#define DARK_CYAN 0x03EF
|
||||
#define ORANGE 0xFCA0
|
||||
#define PINK 0xF97F
|
||||
#define BROWN 0x8200
|
||||
#define VIOLET 0x9199
|
||||
#define SILVER 0xA510
|
||||
#define GOLD 0xA508
|
||||
#define NAVY 0x000F
|
||||
#define MAROON 0x7800
|
||||
#define PURPLE 0x780F
|
||||
#define OLIVE 0x7BE0
|
||||
|
||||
#define TFT_BG BLACK
|
||||
#define TFT_FG WHITE
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92
|
||||
|
||||
#endif
|
||||
|
||||
@@ -97,21 +97,21 @@ char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||
|
||||
void DspCore::apScreen() {
|
||||
setTextSize(TITLE_SIZE1);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.title1, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP1);
|
||||
print("AP NAME: ");
|
||||
print(apSsid);
|
||||
setCursor(TFT_FRAMEWDT, TITLE_TOP2);
|
||||
print("PASSWORD: ");
|
||||
print(apPassword);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.title2, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*4);
|
||||
print("SETTINGS PAGE ON: ");
|
||||
setCursor(TFT_FRAMEWDT, sheight-TFT_FRAMEWDT-TFT_LINEHGHT*2);
|
||||
print("http://");
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, config.theme.div);
|
||||
}
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
@@ -119,7 +119,7 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
|
||||
invert();
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
// fillScreen(0x0000);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
setTextSize(1);
|
||||
@@ -130,34 +130,33 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
|
||||
void DspCore::drawLogo() {
|
||||
fillScreen(0x0000);
|
||||
drawRGBBitmap((swidth - 99) / 2, (sheight-64)/2 - TFT_LINEHGHT*2, bootlogo2, 99, 64);
|
||||
}
|
||||
|
||||
// http://greekgeeks.net/#maker-tools_convertColor
|
||||
uint16_t iclrs[] = { 0x738E /*707070*/, 0x52AA /*575757*/, 0x39C7, 0x18E3 };
|
||||
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
plMenu[i][0] = '\0';
|
||||
}
|
||||
config.fillPlMenu(plMenu, currentItem - 4, PLMITEMS);
|
||||
config.fillPlMenu(plMenu, currentItem - 5, PLMITEMS);
|
||||
setTextSize(2);
|
||||
int yStart = (sheight / 2 - PLMITEMHEIGHT / 2) - PLMITEMHEIGHT * (PLMITEMS - 1) / 2 + 3;
|
||||
|
||||
for (byte i = 0; i < PLMITEMS; i++) {
|
||||
if (i == 4) {
|
||||
if (i == 5) {
|
||||
//fillRect(0, (sheight / 2 - PLMITEMHEIGHT / 2) - 1, swidth, PLMITEMHEIGHT + 2, TFT_LOGO);
|
||||
strlcpy(currentItemText, plMenu[i], PLMITEMLENGHT - 1);
|
||||
} else {
|
||||
setTextColor(iclrs[abs(i - 4)-1], TFT_BG);
|
||||
setTextColor(config.theme.playlist[abs(i - 5)-1], config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, yStart + i * PLMITEMHEIGHT);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT - 1, swidth, PLMITEMHEIGHT - 2, TFT_BG);
|
||||
fillRect(0, yStart + i * PLMITEMHEIGHT - 1, swidth, PLMITEMHEIGHT - 2, config.theme.background);
|
||||
print(utf8Rus(plMenu[i], true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::clearDsp() {
|
||||
fillScreen(TFT_BG);
|
||||
fillScreen(config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||
@@ -210,19 +209,19 @@ void DspCore::rightText(const char* text, uint16_t y, uint16_t fg, uint16_t bg,
|
||||
void DspCore::displayHeapForDebug() {
|
||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||
setTextSize(1);
|
||||
setTextColor(DARK_GRAY, TFT_BG);
|
||||
setTextColor(config.theme.heap, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, vTop, swidth - TFT_FRAMEWDT / 2, 7, config.theme.background);
|
||||
print(ESP.getFreeHeap());
|
||||
print(" / ");
|
||||
print(ESP.getMaxAllocHeap());
|
||||
// audio buffer;
|
||||
fillRect(0, sheight - 2, swidth, 2, TFT_BG);
|
||||
fillRect(0, sheight - 2, swidth, 2, config.theme.background);
|
||||
int astored = player.inBufferFilled();
|
||||
int afree = player.inBufferFree();
|
||||
int aprcnt = 100 * astored / (astored + afree);
|
||||
byte sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, SILVER);
|
||||
uint16_t sbw = map(aprcnt, 0, 100 , 0, swidth);
|
||||
fillRect(0, sheight - 2, sbw, 2, config.theme.buffer);
|
||||
yield();
|
||||
}
|
||||
|
||||
@@ -247,20 +246,20 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
cltop=sheight-(TFT_FRAMEWDT * 2 + TFT_LINEHGHT + 38) - hot;
|
||||
}
|
||||
clwidth = wot+clsp+(swidth>240?46:34);
|
||||
fillRect(swidth-TFT_FRAMEWDT-clwidth, cltop-hot, clwidth, hot+3, TFT_BG);
|
||||
fillRect(swidth-TFT_FRAMEWDT-clwidth, cltop-hot, clwidth, hot+3, config.theme.background);
|
||||
strlcpy(oldTimeBuf, timeBuf, 20);
|
||||
setTextSize(1);
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wot, &hot);
|
||||
clwidth = wot+clsp+(swidth>240?46:34);
|
||||
clleft=swidth-TFT_FRAMEWDT-clwidth;
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setTextColor(config.theme.clock, config.theme.background);
|
||||
setCursor(clleft, cltop);
|
||||
setTextSize(1);
|
||||
print(timeBuf);
|
||||
|
||||
setFont();
|
||||
setTextSize(3);
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
setTextColor(config.theme.dow, config.theme.background);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+32);
|
||||
print(utf8Rus(dow[timeinfo.tm_wday], false));
|
||||
|
||||
@@ -268,15 +267,15 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
setTextSize(1);
|
||||
uint16_t wdate, hdate;
|
||||
getTextBounds(timeBuf, 0, 0, &x1, &y1, &wdate, &hdate);
|
||||
fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, TFT_BG);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, TFT_FG, TFT_BG, false, swidth>240?12:0);
|
||||
drawFastVLine(clleft+wot+clsp/2+3, cltop-hot, hot+3, SILVER);
|
||||
drawFastHLine(clleft+wot+clsp/2+3, cltop-hot+29, 42, SILVER);
|
||||
fillRect(swidth - wdate - TFT_FRAMEWDT-20, cltop+10, wdate+20, hdate, config.theme.background);
|
||||
rightText(utf8Rus(timeBuf,true), cltop+10, config.theme.date, config.theme.background, false, swidth>240?12:0);
|
||||
drawFastVLine(clleft+wot+clsp/2+3, cltop-hot, hot+3, config.theme.div);
|
||||
drawFastHLine(clleft+wot+clsp/2+3, cltop-hot+29, 42, config.theme.div);
|
||||
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, config.theme.div);
|
||||
}
|
||||
setTextSize(3);
|
||||
setTextColor(TFT_LOGO, TFT_BG);
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(clleft+wot+clsp, cltop-hot+1);
|
||||
sprintf(timeBuf, "%02d", timeinfo.tm_sec);
|
||||
print(timeBuf);
|
||||
@@ -288,25 +287,25 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
int16_t volTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||
int16_t vWidth = swidth - TFT_FRAMEWDT *2;
|
||||
uint16_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, TFT_LOGO);
|
||||
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, config.theme.background);
|
||||
fillRect(TFT_FRAMEWDT + 1, vTop - 1, ww, 5, config.theme.volbarin);
|
||||
drawRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, config.theme.volbarout);
|
||||
if(swidth>240){
|
||||
char buf[20];
|
||||
sprintf(buf, "VOL %d", config.store.volume);
|
||||
setTextSize(1);
|
||||
centerText(buf, volTop, SILVER, TFT_BG);
|
||||
centerText(buf, volTop, config.theme.vol, config.theme.background);
|
||||
}
|
||||
if (withNumber) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
char volstr[4];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
getTextBounds(volstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(volstr);
|
||||
setFont();
|
||||
@@ -316,14 +315,14 @@ void DspCore::drawVolumeBar(bool withNumber) {
|
||||
|
||||
void DspCore::drawNextStationNum(uint16_t num) {
|
||||
setTextSize(1);
|
||||
setTextColor(TFT_FG);
|
||||
setTextColor(config.theme.digit);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
char numstr[7];
|
||||
uint16_t wv, hv;
|
||||
int16_t x1, y1;
|
||||
sprintf(numstr, "%d", num);
|
||||
getTextBounds(numstr, 0, 0, &x1, &y1, &wv, &hv);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, TFT_BG);
|
||||
fillRect(TFT_FRAMEWDT, (sheight-hv)/2, swidth - TFT_FRAMEWDT / 2, hv + 3, config.theme.background);
|
||||
setCursor((swidth - wv) / 2, (sheight-hv)/2 + hv);
|
||||
print(numstr);
|
||||
setFont();
|
||||
@@ -331,8 +330,8 @@ void DspCore::drawNextStationNum(uint16_t num) {
|
||||
|
||||
void DspCore::frameTitle(const char* str) {
|
||||
setTextSize(META_SIZE);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||
centerText(str, TFT_FRAMEWDT, config.theme.meta, config.theme.background);
|
||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, config.theme.div);
|
||||
}
|
||||
|
||||
void DspCore::rssi(const char* str) {
|
||||
@@ -340,7 +339,7 @@ void DspCore::rssi(const char* str) {
|
||||
char buf[20];
|
||||
sprintf(buf, "RSSI:%s", str);
|
||||
setTextSize(1);
|
||||
rightText(buf, vTop, SILVER, TFT_BG);
|
||||
rightText(buf, vTop, config.theme.rssi, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::ip(const char* str) {
|
||||
@@ -348,7 +347,7 @@ void DspCore::ip(const char* str) {
|
||||
char buf[30];
|
||||
sprintf(buf, "IP: %s", str);
|
||||
setTextSize(1);
|
||||
setTextColor(SILVER, TFT_BG);
|
||||
setTextColor(config.theme.ip, config.theme.background);
|
||||
setCursor(TFT_FRAMEWDT, vTop);
|
||||
print(buf);
|
||||
}
|
||||
@@ -398,4 +397,12 @@ void DspCore::flip(){
|
||||
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);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
#define DSP_CAN_SLEEP true
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 8
|
||||
@@ -21,14 +22,13 @@
|
||||
#define SCROLLTIME 30
|
||||
#endif
|
||||
|
||||
#define PLMITEMS 9
|
||||
#define PLMITEMS 11
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 22
|
||||
#define TFT_FULLTIME 1
|
||||
|
||||
#define TITLE_TOP1 TFT_FRAMEWDT + META_SIZE * TFT_LINEHGHT + 8
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + (META_SIZE+2) * TFT_LINEHGHT + 8
|
||||
#define TITLE_FG2 SILVER
|
||||
|
||||
class DspCore: public Adafruit_ST7789 {
|
||||
public:
|
||||
@@ -63,6 +63,8 @@ class DspCore: public Adafruit_ST7789 {
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
void sleep();
|
||||
void wake();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
@@ -72,36 +74,4 @@ class DspCore: public Adafruit_ST7789 {
|
||||
|
||||
extern DspCore dsp;
|
||||
|
||||
/*
|
||||
* TFT COLORS
|
||||
*/
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define RED 0xF800
|
||||
#define GREEN 0x07E0
|
||||
#define MAGENTA 0xF81F
|
||||
#define YELLOW 0xFFE0
|
||||
#define WHITE 0xFFFF
|
||||
#define GRAY 0x7BEF
|
||||
#define DARK_GRAY 0x2945
|
||||
#define LIGHT_GRAY 0xC618
|
||||
#define LIME 0x87E0
|
||||
#define AQUA 0x5D1C
|
||||
#define CYAN 0x07FF
|
||||
#define DARK_CYAN 0x03EF
|
||||
#define ORANGE 0xFCA0
|
||||
#define PINK 0xF97F
|
||||
#define BROWN 0x8200
|
||||
#define VIOLET 0x9199
|
||||
#define SILVER 0xA510
|
||||
#define GOLD 0xA508
|
||||
#define NAVY 0x000F
|
||||
#define MAROON 0x7800
|
||||
#define PURPLE 0x780F
|
||||
#define OLIVE 0x7BE0
|
||||
|
||||
#define TFT_BG BLACK
|
||||
#define TFT_FG WHITE
|
||||
#define TFT_LOGO 0xE68B // 224, 209, 92
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user