v0.7.330
This commit is contained in:
@@ -545,7 +545,7 @@ void TFT_22_ILI9225::clear() {
|
||||
}
|
||||
|
||||
|
||||
void TFT_22_ILI9225::invert(boolean flag) {
|
||||
void TFT_22_ILI9225::invertDisplay(boolean flag) {
|
||||
startWrite();
|
||||
_writeCommand16(flag ? ILI9225C_INVON : ILI9225C_INVOFF);
|
||||
//_writeCommand(0x00, flag ? ILI9225C_INVON : ILI9225C_INVOFF);
|
||||
|
||||
@@ -186,7 +186,7 @@ class TFT_22_ILI9225 {
|
||||
|
||||
/// Invert screen
|
||||
/// @param flag true to invert, false for normal screen
|
||||
void invert(boolean flag);
|
||||
void invertDisplay(boolean flag);
|
||||
|
||||
/// Switch backlight on or off
|
||||
/// @param flag true=on, false=off
|
||||
|
||||
@@ -1569,7 +1569,6 @@ void Audio::setDefaults(){
|
||||
* \n The VU meter takes about 0.2MHz of processing power with 48 kHz samplerate.
|
||||
*/
|
||||
void Audio::setVUmeter() {
|
||||
// if(!ENABLE_VU_METER) return;
|
||||
uint16_t MP3Status = read_register(SCI_STATUS);
|
||||
if(MP3Status==0) {
|
||||
Serial.println("VS1053 Error: Unable to write SCI_STATUS");
|
||||
@@ -1593,7 +1592,6 @@ void Audio::setVUmeter() {
|
||||
* \warning This feature is only available with patches that support VU meter.
|
||||
*/
|
||||
void Audio::getVUlevel() {
|
||||
// if(!ENABLE_VU_METER) return;
|
||||
if(!_vuInitalized) return;
|
||||
int16_t reg = read_register(SCI_AICTRL3);
|
||||
uint8_t rl = map((uint8_t)reg, 85, 92, 0, 255);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#define SCROLLTIME 60
|
||||
#endif
|
||||
|
||||
#define DSP_FLIPPED 0
|
||||
|
||||
class DspCore {
|
||||
public:
|
||||
DspCore();
|
||||
|
||||
@@ -12,11 +12,7 @@
|
||||
#define DEF_SPI_FREQ 24000000 /* set it to 0 for system default */
|
||||
#endif
|
||||
|
||||
#if ENABLE_VU_METER
|
||||
#define CLOCK_DELTA 16
|
||||
#else
|
||||
#define CLOCK_DELTA 0
|
||||
#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)
|
||||
@@ -120,12 +116,9 @@ void DspCore::apScreen() {
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin(DEF_SPI_FREQ);
|
||||
cp437(true);
|
||||
invertDisplay(!TFT_INVERT);
|
||||
invert();
|
||||
fillScreen(TFT_BG);
|
||||
byte tftRotate = TFT_ROTATE;
|
||||
if(tftRotate>1) tftRotate=3;
|
||||
if(tftRotate==0) tftRotate=1;
|
||||
setRotation(tftRotate);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -239,15 +232,16 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
char timeBuf[50] = { 0 };
|
||||
char tmpBuf[4] = { 0 };
|
||||
uint16_t ncwidth, ncheight;
|
||||
uint16_t clockdelta=config.store.vumeter?CLOCK_DELTA:0;
|
||||
strftime(timeBuf, sizeof(timeBuf), "%H %M", &timeinfo);
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
||||
getTextBounds(oldTimeBuf, 0, 0, &x, &y, &wot, &hot);
|
||||
setCursor((swidth - wot) / 2 - 4 + CLOCK_DELTA, clockY+28+6);
|
||||
setCursor((swidth - wot) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
setTextColor(TFT_BG);
|
||||
print(oldTimeBuf);
|
||||
dot = (swidth - wot) / 2 - 4 + CLOCK_DELTA;
|
||||
dot = (swidth - wot) / 2 - 4 + clockdelta;
|
||||
/* dots */
|
||||
strlcpy(tmpBuf, oldTimeBuf, 3);
|
||||
getTextBounds(tmpBuf, 0, 0, &x, &y, &ncwidth, &ncheight);
|
||||
@@ -260,8 +254,8 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
setTextSize(1);
|
||||
getTextBounds(timeBuf, 0, 0, &x, &y, &ncwidth, &ncheight);
|
||||
setTextColor(TFT_LOGO);
|
||||
setCursor((swidth - ncwidth) / 2 - 4 + CLOCK_DELTA, clockY+28+6);
|
||||
dot = (swidth - ncwidth) / 2 - 4 + CLOCK_DELTA;
|
||||
setCursor((swidth - ncwidth) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
dot = (swidth - ncwidth) / 2 - 4 + clockdelta;
|
||||
setTextSize(1);
|
||||
print(timeBuf);
|
||||
/* dots */
|
||||
@@ -384,5 +378,11 @@ void DspCore::printText(const char* txt) {
|
||||
void DspCore::loop(bool force) {
|
||||
|
||||
}
|
||||
void DspCore::flip(){
|
||||
setRotation(config.store.flipscreen?1:3);
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "../Adafruit_GC9106Ex/Adafruit_GC9106Ex.h"
|
||||
#include "fonts/DS_DIGI28pt7b.h"
|
||||
|
||||
#define VU_READY 1
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
@@ -58,6 +60,8 @@ class DspCore: public Adafruit_GC9106Ex {
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
/*virtual void sendCommand(uint8_t commandByte, uint8_t *dataBytes,
|
||||
uint8_t numDataBytes);
|
||||
virtual void sendCommand(uint8_t commandByte, const uint8_t *dataBytes = NULL,
|
||||
|
||||
@@ -190,10 +190,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();
|
||||
begin();
|
||||
invert(TFT_INVERT);
|
||||
invert();
|
||||
setBackgroundColor(TFT_BG);
|
||||
clear();
|
||||
setOrientation(TFT_ROTATE);
|
||||
flip();
|
||||
setTextSize(1);
|
||||
screenwidth = maxX();
|
||||
screenheight = maxY();
|
||||
@@ -449,5 +449,10 @@ void DspCore::drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap, int16_
|
||||
drawBitmap(x, y, bitmap, w, h);
|
||||
GIVE_MUTEX();
|
||||
}
|
||||
|
||||
void DspCore::flip(){
|
||||
setOrientation(config.store.flipscreen?3:1);
|
||||
}
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "../ILI9225Fix/TFT_22_ILI9225Fix.h"
|
||||
#include "fonts/DS_DIGI28pt7b.h"
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 4
|
||||
#define META_SIZE 2
|
||||
@@ -73,6 +76,8 @@ class DspCore: public TFT_22_ILI9225 {
|
||||
int16_t width(void) { return (int16_t)maxX(); }
|
||||
int16_t height(void) { return (int16_t)maxY(); }
|
||||
void drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap, int16_t w, int16_t h);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
uint16_t bgcolor, fgcolor;
|
||||
|
||||
@@ -113,10 +113,10 @@ void DspCore::apScreen() {
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin(); /* SPI_DEFAULT_FREQ 40000000 */
|
||||
invertDisplay(TFT_INVERT);
|
||||
invert();
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
setTextSize(1);
|
||||
screenwidth = width();
|
||||
@@ -385,5 +385,11 @@ void DspCore::printText(const char* txt) {
|
||||
void DspCore::loop(bool force) {
|
||||
|
||||
}
|
||||
void DspCore::flip(){
|
||||
setRotation(config.store.flipscreen?1:3);
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
// https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
|
||||
#include "fonts/DS_DIGI42pt7b.h"
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 8
|
||||
#define META_SIZE 3
|
||||
@@ -58,6 +61,8 @@ class DspCore: public Adafruit_ILI9341 {
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#define DSP_FLIPPED 0
|
||||
|
||||
#if DSP_MODEL==DSP_2004 || DSP_MODEL==DSP_2004I2C
|
||||
#define LCD_2004
|
||||
#endif
|
||||
@@ -89,6 +91,8 @@ class DspCore: public LiquidCrystal {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
void flip(){};
|
||||
void invert(){};
|
||||
private:
|
||||
uint16_t swidth, sheight, xOffset, yOffset;
|
||||
int16_t nextX;
|
||||
|
||||
@@ -134,13 +134,11 @@ void DspCore::data(uint8_t c) {
|
||||
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
begin();
|
||||
setContrast(TFT_CONTRAST);
|
||||
setContrast(config.store.contrast);
|
||||
cp437(true);
|
||||
invert();
|
||||
fillScreen(TFT_BG);
|
||||
byte tftRotate = TFT_ROTATE;
|
||||
if(tftRotate>2) tftRotate=2;
|
||||
if(tftRotate==1) tftRotate=0;
|
||||
setRotation(tftRotate);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -339,5 +337,11 @@ boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void DspCore::flip(){
|
||||
setRotation(config.store.flipscreen?2:0);
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,8 @@ class DspCore: public Adafruit_PCD8544 {
|
||||
void loop(bool force=false);
|
||||
virtual void command(uint8_t c);
|
||||
virtual void data(uint8_t c);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -142,12 +142,8 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
byte tftRotate = TFT_ROTATE;
|
||||
#if DSP_MODEL==DSP_SH1107
|
||||
if(tftRotate>=2) tftRotate=3;
|
||||
if(tftRotate==0) tftRotate=1;
|
||||
#endif
|
||||
setRotation(tftRotate);
|
||||
flip();
|
||||
invert();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -348,5 +344,16 @@ boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DspCore::flip(){
|
||||
#if DSP_MODEL==DSP_SH1107
|
||||
setRotation(config.store.flipscreen?3:1);
|
||||
#endif
|
||||
#if DSP_MODEL==DSP_SH1106
|
||||
setRotation(config.store.flipscreen?2:0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -57,6 +57,8 @@ class DspCore: public Adafruit_SH1107 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -144,7 +144,8 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
flip();
|
||||
invert();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -332,5 +333,11 @@ boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void DspCore::flip(){
|
||||
setRotation(config.store.flipscreen?2:0);
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1305.h>
|
||||
|
||||
#define WEATHER_READY 0
|
||||
|
||||
#define TFT_LINEHGHT 8
|
||||
#define TFT_FRAMEWDT 0
|
||||
|
||||
@@ -51,6 +53,8 @@ class DspCore: public Adafruit_SSD1305 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -141,10 +141,8 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
byte tftRotate = TFT_ROTATE;
|
||||
if(tftRotate>2) tftRotate=2;
|
||||
if(tftRotate==1) tftRotate=0;
|
||||
setRotation(tftRotate);
|
||||
flip();
|
||||
invert();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -355,5 +353,11 @@ boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void DspCore::flip(){
|
||||
setRotation(config.store.flipscreen?2:0);
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -71,6 +71,8 @@ class DspCore: public Adafruit_SSD1306 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
unsigned long loopdelay;
|
||||
|
||||
@@ -123,7 +123,8 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
}
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
flip();
|
||||
invert();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -401,5 +402,15 @@ boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <Adafruit_SSD1327.h>
|
||||
#include "fonts/DS_DIGI28pt7b.h"
|
||||
|
||||
#define WEATHER_READY 1
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 4
|
||||
|
||||
@@ -13,26 +15,9 @@
|
||||
#define PLMITEMLENGHT 40
|
||||
#define PLMITEMHEIGHT 22
|
||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||
/*
|
||||
#ifdef DSP_FPS
|
||||
#if DSP_FPS!=0
|
||||
#define SCROLLDELTA (DSP_FPS>30)?3:(80/DSP_FPS)
|
||||
#define SCROLLTIME (DSP_FPS>30)?34:(1000/DSP_FPS)
|
||||
#else
|
||||
#define SCROLLDELTA 4
|
||||
#define SCROLLTIME 83
|
||||
#define LOOP_DELAY 83
|
||||
#endif
|
||||
#else
|
||||
#define SCROLLDELTA 4
|
||||
#define SCROLLTIME 83
|
||||
#define LOOP_DELAY 40
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if !defined(SCROLLDELTA) || !defined(SCROLLTIME)
|
||||
/*#define SCROLLDELTA 5
|
||||
#define SCROLLTIME 83
|
||||
#define LOOP_DELAY 100*/
|
||||
|
||||
#define SCROLLDELTA 2
|
||||
#define SCROLLTIME 30
|
||||
#define LOOP_DELAY 33
|
||||
@@ -70,6 +55,8 @@ class DspCore: public Adafruit_SSD1327 {
|
||||
void ip(const char* str);
|
||||
void drawPlaylist(uint16_t currentItem, char* currentItemText);
|
||||
void loop(bool force=false);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
int16_t x, y;
|
||||
|
||||
@@ -13,11 +13,9 @@
|
||||
#include "../../network.h"
|
||||
|
||||
#ifndef DEF_SPI_FREQ
|
||||
#define DEF_SPI_FREQ 40000000UL /* set it to 0 for system default */
|
||||
#define DEF_SPI_FREQ 26000000UL /* set it to 0 for system default */
|
||||
#endif
|
||||
|
||||
#if ENABLE_VU_METER
|
||||
|
||||
#if DTYPE==INITR_BLACKTAB
|
||||
#define CLOCK_DELTA 12
|
||||
#elif DTYPE==INITR_MINI160x80
|
||||
@@ -26,10 +24,6 @@
|
||||
#define CLOCK_DELTA 0
|
||||
#endif
|
||||
|
||||
#else // !ENABLE_VU_METER
|
||||
#define CLOCK_DELTA 0
|
||||
#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)
|
||||
|
||||
@@ -133,9 +127,9 @@ void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
initR(DTYPE);
|
||||
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
|
||||
cp437(true);
|
||||
invertDisplay((DTYPE==INITR_MINI160x80)?TFT_INVERT:!TFT_INVERT);
|
||||
invert();
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
screenwidth = width();
|
||||
screenheight = height();
|
||||
@@ -270,15 +264,16 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
char timeBuf[50] = { 0 };
|
||||
char tmpBuf[4] = { 0 };
|
||||
uint16_t ncwidth, ncheight;
|
||||
uint16_t clockdelta=config.store.vumeter?CLOCK_DELTA:0;
|
||||
strftime(timeBuf, sizeof(timeBuf), "%H %M", &timeinfo);
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI28pt7b);
|
||||
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
||||
getTextBounds(oldTimeBuf, 0, 0, &x, &y, &wot, &hot);
|
||||
setCursor((swidth - wot) / 2 - 4 + CLOCK_DELTA, clockY+28+6);
|
||||
setCursor((swidth - wot) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
setTextColor(TFT_BG);
|
||||
print(oldTimeBuf);
|
||||
dot = (swidth - wot) / 2 - 4 + CLOCK_DELTA;
|
||||
dot = (swidth - wot) / 2 - 4 + clockdelta;
|
||||
/* dots */
|
||||
strlcpy(tmpBuf, oldTimeBuf, 3);
|
||||
getTextBounds(tmpBuf, 0, 0, &x, &y, &ncwidth, &ncheight);
|
||||
@@ -291,8 +286,8 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||
setTextSize(1);
|
||||
getTextBounds(timeBuf, 0, 0, &x, &y, &ncwidth, &ncheight);
|
||||
setTextColor(TFT_LOGO);
|
||||
setCursor((swidth - ncwidth) / 2 - 4 + CLOCK_DELTA, clockY+28+6);
|
||||
dot = (swidth - ncwidth) / 2 - 4 + CLOCK_DELTA;
|
||||
setCursor((swidth - ncwidth) / 2 - 4 + clockdelta, clockY+28+6);
|
||||
dot = (swidth - ncwidth) / 2 - 4 + clockdelta;
|
||||
setTextSize(1);
|
||||
print(timeBuf);
|
||||
/* dots */
|
||||
@@ -406,5 +401,15 @@ void DspCore::printText(const char* txt) {
|
||||
void DspCore::loop(bool force) {
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include <Adafruit_ST7735.h>
|
||||
#include "fonts/DS_DIGI28pt7b.h"
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#if DTYPE==INITR_MINI160x80
|
||||
#define TFT_FRAMEWDT 0
|
||||
@@ -69,6 +72,8 @@ class DspCore: public Adafruit_ST7735 {
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
@@ -117,10 +117,10 @@ void DspCore::apScreen() {
|
||||
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||
init(240,(DSP_MODEL==DSP_ST7789)?320:240);
|
||||
if(DEF_SPI_FREQ > 0) setSPISpeed(DEF_SPI_FREQ);
|
||||
invertDisplay(TFT_INVERT);
|
||||
invert();
|
||||
cp437(true);
|
||||
fillScreen(TFT_BG);
|
||||
setRotation(TFT_ROTATE);
|
||||
flip();
|
||||
setTextWrap(false);
|
||||
setTextSize(1);
|
||||
screenwidth = width();
|
||||
@@ -382,5 +382,20 @@ void DspCore::printText(const char* txt) {
|
||||
void DspCore::loop(bool force) {
|
||||
|
||||
}
|
||||
|
||||
void DspCore::flip(){
|
||||
#if DSP_MODEL==DSP_ST7789
|
||||
setRotation(config.store.flipscreen?3:1);
|
||||
#endif
|
||||
#if DSP_MODEL==DSP_ST7789_240
|
||||
if(ROTATE_90){
|
||||
setRotation(config.store.flipscreen?3:1);
|
||||
}else{
|
||||
setRotation(config.store.flipscreen?2:0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DspCore::invert(){
|
||||
invertDisplay(config.store.invertdisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
// https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
|
||||
#include "fonts/DS_DIGI42pt7b.h"
|
||||
|
||||
#define VU_READY 1
|
||||
#define WEATHER_READY 1
|
||||
|
||||
#define TFT_LINEHGHT 10
|
||||
#define TFT_FRAMEWDT 8
|
||||
#define META_SIZE 3
|
||||
@@ -58,6 +61,8 @@ class DspCore: public Adafruit_ST7789 {
|
||||
void loop(bool force=false);
|
||||
virtual void startWrite(void);
|
||||
virtual void endWrite(void);
|
||||
void flip();
|
||||
void invert();
|
||||
private:
|
||||
uint16_t swidth, sheight;
|
||||
char oldTimeBuf[20];
|
||||
|
||||
@@ -320,12 +320,22 @@ void Nextion::loop() {
|
||||
}
|
||||
if (sscanf(rxbuf, "tzhour=%d", &scanDigit) == 1){
|
||||
config.setTimezone((int8_t)scanDigit, config.store.tzMin);
|
||||
configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), SNTP_SERVER);
|
||||
//configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), SNTP_SERVER);
|
||||
if(strlen(config.store.sntp1)>0 && strlen(config.store.sntp2)>0){
|
||||
configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), config.store.sntp1, config.store.sntp2);
|
||||
}else if(strlen(config.store.sntp1)>0){
|
||||
configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), config.store.sntp1);
|
||||
}
|
||||
network.requestTimeSync(true);
|
||||
}
|
||||
if (sscanf(rxbuf, "tzmin=%d", &scanDigit) == 1){
|
||||
config.setTimezone(config.store.tzHour, (int8_t)scanDigit);
|
||||
configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), SNTP_SERVER);
|
||||
//configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), SNTP_SERVER);
|
||||
if(strlen(config.store.sntp1)>0 && strlen(config.store.sntp2)>0){
|
||||
configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), config.store.sntp1, config.store.sntp2);
|
||||
}else if(strlen(config.store.sntp1)>0){
|
||||
configTime(config.store.tzHour * 3600 + config.store.tzMin * 60, config.getTimezoneOffset(), config.store.sntp1);
|
||||
}
|
||||
network.requestTimeSync(true);
|
||||
}
|
||||
if (sscanf(rxbuf, "audioinfo=%d", &scanDigit) == 1){
|
||||
@@ -558,7 +568,7 @@ bool Nextion::getForecast(){
|
||||
return false;
|
||||
}
|
||||
char httpget[250] = {0};
|
||||
sprintf(httpget, "GET /data/2.5/weather?lat=%s&lon=%s&units=metric&lang=ru&appid=%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", NEXTION_WEATHER_LAT, NEXTION_WEATHER_LON, NEXTION_WEATHER_KEY, host);
|
||||
sprintf(httpget, "GET /data/2.5/weather?lat=%s&lon=%s&units=metric&lang=ru&appid=%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", config.store.weatherlat, config.store.weatherlon, config.store.weatherkey, host);
|
||||
client.print(httpget);
|
||||
unsigned long timeout = millis();
|
||||
while (client.available() == 0) {
|
||||
@@ -684,6 +694,10 @@ void Nextion::getWeather(void * pvParameters){
|
||||
}
|
||||
|
||||
void Nextion::updateWeather() {
|
||||
if(strlen(config.store.weatherkey)==0 || !config.store.showweather) {
|
||||
nextion.weatherVisible(0);
|
||||
return;
|
||||
}
|
||||
xTaskCreatePinnedToCore(
|
||||
nextion.getWeather, /* Task function. */
|
||||
"nextiongetWeather", /* name of task. */
|
||||
@@ -691,15 +705,11 @@ void Nextion::updateWeather() {
|
||||
NULL, /* parameter of the task */
|
||||
0, /* priority of the task */
|
||||
&nextion.weatherUpdateTaskHandle, /* Task handle to keep track of created task */
|
||||
0); /* pin task to core CORE_FOR_LOOP_CONTROLS */
|
||||
0); /* pin task to core 0 */
|
||||
}
|
||||
|
||||
void Nextion::startWeather(){
|
||||
if(strlen(NEXTION_WEATHER_KEY)==0) {
|
||||
Serial.println("## OPENWEATHERMAP ###: ERROR: NEXTION_WEATHER_KEY not configured");
|
||||
return;
|
||||
}
|
||||
updateWeather(); /* pin task to core CORE_FOR_LOOP_CONTROLS */
|
||||
updateWeather();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user