v0.6.344
This commit is contained in:
@@ -9,9 +9,12 @@
|
||||
#include "../../network.h"
|
||||
|
||||
#ifndef DEF_SPI_FREQ
|
||||
#define DEF_SPI_FREQ 40000000 /* set it to 0 for system default */
|
||||
#define DEF_SPI_FREQ 24000000 /* set it to 0 for system default */
|
||||
#endif
|
||||
|
||||
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
|
||||
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
|
||||
|
||||
DspCore::DspCore(): Adafruit_GC9106Ex(TFT_CS, TFT_DC, TFT_RST) {
|
||||
|
||||
}
|
||||
@@ -326,6 +329,36 @@ void DspCore::ip(const char* str) {
|
||||
print(str);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_GC9106Ex::startWrite();
|
||||
}
|
||||
|
||||
void DspCore::endWrite(void) {
|
||||
Adafruit_GC9106Ex::endWrite();
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
/*
|
||||
void DspCore::sendCommand(uint8_t commandByte, uint8_t *dataBytes, uint8_t numDataBytes) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_GC9106Ex::sendCommand(commandByte, dataBytes, numDataBytes);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::sendCommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_GC9106Ex::sendCommand(commandByte, dataBytes, numDataBytes);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::sendCommand16(uint16_t commandWord, const uint8_t *dataBytes, uint8_t numDataBytes) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_GC9106Ex::sendCommand16(commandWord, dataBytes, numDataBytes);
|
||||
GIVE_MUTEX();
|
||||
}*/
|
||||
|
||||
|
||||
void DspCore::set_TextSize(uint8_t s) {
|
||||
setTextSize(s);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,14 @@ class DspCore: public Adafruit_GC9106Ex {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
/*virtual void sendCommand(uint8_t commandByte, uint8_t *dataBytes,
|
||||
uint8_t numDataBytes);
|
||||
virtual void sendCommand(uint8_t commandByte, const uint8_t *dataBytes = NULL,
|
||||
uint8_t numDataBytes = 0);
|
||||
virtual void sendCommand16(uint16_t commandWord, const uint8_t *dataBytes = NULL,
|
||||
uint8_t numDataBytes = 0);*/
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
@@ -13,6 +13,8 @@ const char *mnths[12] = {"января","февраля","марта","апре
|
||||
extern unsigned char yofont5x7[];
|
||||
extern unsigned char yofont10x14[];
|
||||
|
||||
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
|
||||
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
|
||||
//SPIClass hspi(VSPI);
|
||||
|
||||
DspCore::DspCore(): TFT_22_ILI9225(TFT_RST, TFT_DC, TFT_CS, 0) {
|
||||
@@ -109,7 +111,9 @@ void DspCore::apScreen() {
|
||||
print("http://");
|
||||
print(WiFi.softAPIP().toString().c_str());
|
||||
print("/");
|
||||
TAKE_MUTEX();
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, SILVER);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::setTextSize(uint8_t s){
|
||||
@@ -132,11 +136,14 @@ void DspCore::setCursor(int16_t x, int16_t y){
|
||||
}
|
||||
|
||||
uint16_t DspCore::print(const char* s){
|
||||
TAKE_MUTEX();
|
||||
if(gFont){
|
||||
drawGFXText(cursorx, cursory, s, fgcolor);
|
||||
GIVE_MUTEX();
|
||||
return 0;
|
||||
}else{
|
||||
cursorx=drawText(cursorx, cursory, s, fgcolor);
|
||||
GIVE_MUTEX();
|
||||
return cursorx;
|
||||
}
|
||||
}
|
||||
@@ -175,7 +182,9 @@ void DspCore::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
h=h+y;
|
||||
y=0;
|
||||
}
|
||||
TAKE_MUTEX();
|
||||
fillRectangle(x, y, x+w, y+h, color);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
@@ -323,10 +332,11 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
setTextColor(TFT_FG, TFT_BG);
|
||||
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);
|
||||
|
||||
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);
|
||||
@@ -392,7 +402,9 @@ void DspCore::drawNextStationNum(uint16_t num) {
|
||||
void DspCore::frameTitle(const char* str) {
|
||||
setTextSize(META_SIZE);
|
||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||
TAKE_MUTEX();
|
||||
drawLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, TITLE_TOP1-8, SILVER);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::rssi(const char* str) {
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"};
|
||||
const char *mnths[12] = {"января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"};
|
||||
|
||||
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
|
||||
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
|
||||
|
||||
DspCore::DspCore(): Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST) {
|
||||
|
||||
}
|
||||
@@ -303,7 +306,7 @@ 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+4, TFT_BG);
|
||||
|
||||
setTextColor(TFT_FG);
|
||||
sprintf(volstr, "%d", config.store.volume);
|
||||
@@ -355,6 +358,16 @@ void DspCore::ip(const char* str) {
|
||||
print(buf);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_ILI9341::startWrite();
|
||||
}
|
||||
|
||||
void DspCore::endWrite(void) {
|
||||
Adafruit_ILI9341::endWrite();
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::set_TextSize(uint8_t s) {
|
||||
setTextSize(s);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define TITLE_SIZE2 2
|
||||
|
||||
#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
|
||||
#define SCROLLDELTA 3
|
||||
#define SCROLLDELTA 4
|
||||
#define SCROLLTIME 30
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,8 @@ class DspCore: public Adafruit_ILI9341 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#define LOGO_WIDTH 21
|
||||
#define LOGO_HEIGHT 28
|
||||
|
||||
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
|
||||
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
|
||||
|
||||
const unsigned char logo [] PROGMEM=
|
||||
{
|
||||
0x07, 0x03, 0x80, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x0f, 0x87, 0xc0, 0x07,
|
||||
@@ -117,6 +120,18 @@ void DspCore::apScreen() {
|
||||
setFont();
|
||||
}
|
||||
|
||||
void DspCore::command(uint8_t c) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_PCD8544::command(c);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::data(uint8_t c) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_PCD8544::data(c);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin();
|
||||
setContrast(TFT_CONTRAST);
|
||||
|
||||
@@ -56,6 +56,8 @@ class DspCore: public Adafruit_PCD8544 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
virtual void command(uint8_t c);
|
||||
virtual void data(uint8_t c);
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */
|
||||
#endif
|
||||
|
||||
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
|
||||
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
|
||||
|
||||
DspCore::DspCore(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {
|
||||
|
||||
}
|
||||
@@ -362,6 +365,16 @@ void DspCore::ip(const char* str) {
|
||||
print(str);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_ST7735::startWrite();
|
||||
}
|
||||
|
||||
void DspCore::endWrite(void) {
|
||||
Adafruit_ST7735::endWrite();
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::set_TextSize(uint8_t s) {
|
||||
setTextSize(s);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ class DspCore: public Adafruit_ST7735 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"};
|
||||
const char *mnths[12] = {"января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"};
|
||||
|
||||
#define TAKE_MUTEX() if(player.mutex_pl) xSemaphoreTake(player.mutex_pl, portMAX_DELAY)
|
||||
#define GIVE_MUTEX() if(player.mutex_pl) xSemaphoreGive(player.mutex_pl)
|
||||
|
||||
DspCore::DspCore(): Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST) {
|
||||
|
||||
}
|
||||
@@ -350,6 +353,16 @@ void DspCore::ip(const char* str) {
|
||||
print(buf);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) {
|
||||
TAKE_MUTEX();
|
||||
Adafruit_ST7789::startWrite();
|
||||
}
|
||||
|
||||
void DspCore::endWrite(void) {
|
||||
Adafruit_ST7789::endWrite();
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::set_TextSize(uint8_t s) {
|
||||
setTextSize(s);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define TITLE_SIZE2 2
|
||||
|
||||
#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
|
||||
#define SCROLLDELTA 3
|
||||
#define SCROLLDELTA 4
|
||||
#define SCROLLTIME 30
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,8 @@ class DspCore: public Adafruit_ST7789 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
Reference in New Issue
Block a user