v0.5.070
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
- [Encoders](#encoders)
|
- [Encoders](#encoders)
|
||||||
- [IR receiver](#ir-receiver)
|
- [IR receiver](#ir-receiver)
|
||||||
- [Joystick](#joystic)
|
- [Joystick](#joystic)
|
||||||
- [Back to Readme](Readme.md)
|
- [Back to README](README.md)
|
||||||
|
|
||||||
---
|
---
|
||||||
### Buttons
|
### Buttons
|
||||||
|
|||||||
@@ -29,4 +29,6 @@
|
|||||||
\
|
\
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||

|
\
|
||||||
|
\
|
||||||
|

|
||||||
|
|||||||
10
README.md
10
README.md
@@ -242,9 +242,17 @@ download _http://\<yoradioip\>/data/playlist.csv_ and _http://\<yoradioip\>/data
|
|||||||
|
|
||||||
- Home Assistant support
|
- Home Assistant support
|
||||||
|
|
||||||
|
---
|
||||||
|
## Plugins
|
||||||
|
At the moment, you can display additional information on the display by writing a few additional functions. There is no documentation yet, you will have to deal with the example, which is in file [exsamples/displayhandlers.ino](exsamples/displayhandlers.ino).\
|
||||||
|
Work is in progress...
|
||||||
|
|
||||||
---
|
---
|
||||||
## Version history
|
## Version history
|
||||||
#### v0.5.033
|
#### v0.5.070
|
||||||
|
- added something similar to plugins
|
||||||
|
|
||||||
|
#### v0.5.035
|
||||||
- added two buttons BTN_UP, BTN_DOWN
|
- added two buttons BTN_UP, BTN_DOWN
|
||||||
- added the pins for the second encoder ENC2_BTNL, ENC2_BTNB, ENC2_BTNR
|
- added the pins for the second encoder ENC2_BTNL, ENC2_BTNB, ENC2_BTNR
|
||||||
- fixed display of playlist with SSD1306 configuration
|
- fixed display of playlist with SSD1306 configuration
|
||||||
|
|||||||
82
exsamples/displayhandlers.ino
Normal file
82
exsamples/displayhandlers.ino
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/**************************************************************
|
||||||
|
*
|
||||||
|
* An example of displaying user information on the display.
|
||||||
|
* This file must be in the root directory of the sketch.
|
||||||
|
*
|
||||||
|
**************************************************************/
|
||||||
|
|
||||||
|
#if DSP_MODEL==DSP_ST7735
|
||||||
|
|
||||||
|
#include <JSON_Decoder.h> // https://github.com/Bodmer/OpenWeather
|
||||||
|
#include <OpenWeather.h> // https://github.com/Bodmer/JSON_Decoder
|
||||||
|
|
||||||
|
String api_key = "********************************"; // openweathermap.org API key
|
||||||
|
|
||||||
|
String latitude = "55.7512";
|
||||||
|
String longitude = "37.6184";
|
||||||
|
|
||||||
|
String units = "metric";
|
||||||
|
String language = "ru";
|
||||||
|
|
||||||
|
OW_Weather ow;
|
||||||
|
|
||||||
|
/***********************************************
|
||||||
|
* scrolled line
|
||||||
|
***********************************************/
|
||||||
|
Scroll hello;
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************
|
||||||
|
* Occurs when the display is initialized
|
||||||
|
***********************************************/
|
||||||
|
void dsp_on_init(){
|
||||||
|
hello.init(" * ", 1, TFT_LINEHGHT*4+6, 2000, ORANGE, TFT_BG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************************
|
||||||
|
* The display has initialized, the network is connected, the player is ready to play.
|
||||||
|
* DspCore class documentation is missing :^( See the source in src/displays
|
||||||
|
*********************************************************************************************/
|
||||||
|
void dsp_on_start(DspCore *dsp){
|
||||||
|
OW_current *current = new OW_current;
|
||||||
|
OW_hourly *hourly = new OW_hourly;
|
||||||
|
OW_daily *daily = new OW_daily;
|
||||||
|
char weather[140] = { 0 };
|
||||||
|
ow.getForecast(current, hourly, daily, api_key, latitude, longitude, units, language);
|
||||||
|
|
||||||
|
sprintf(weather, "temp: %.1f * pressure: %d * humidity: %d", current->temp, (int)(current->pressure/1.333), current->humidity);
|
||||||
|
|
||||||
|
hello.setText(dsp->utf8Rus(weather, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************
|
||||||
|
* The loop cycle
|
||||||
|
************************/
|
||||||
|
void dsp_on_loop(){
|
||||||
|
if(display.mode==PLAYER) hello.loop();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************
|
||||||
|
* Occurs when the display changes mode
|
||||||
|
***********************************************/
|
||||||
|
void dsp_on_newmode(displayMode_e newmode){
|
||||||
|
if (newmode == PLAYER) {
|
||||||
|
hello.reset();
|
||||||
|
}else{
|
||||||
|
hello.lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************
|
||||||
|
* Before print the clock
|
||||||
|
************************/
|
||||||
|
bool dsp_before_clock(DspCore *dsp, bool dots){
|
||||||
|
if(display.mode==PLAYER){
|
||||||
|
dsp->setFont();
|
||||||
|
dsp->setTextSize(1);
|
||||||
|
display.centerText(dsp->utf8Rus("Hello from plugin!", true), display.screenheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2, PINK, TFT_BG);
|
||||||
|
}
|
||||||
|
return true; // false, if you need to disable the drawing of the clock
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
BIN
images/img15.jpg
Normal file
BIN
images/img15.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 297 KiB |
@@ -8,29 +8,7 @@
|
|||||||
#include "netserver.h"
|
#include "netserver.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
|
||||||
#if DSP_MODEL==DSP_DUMMY
|
DspCore dsp;
|
||||||
#include "src/displays/displayDummy.h"
|
|
||||||
DisplayDummy dsp;
|
|
||||||
#elif DSP_MODEL==DSP_ST7735
|
|
||||||
#include "src/displays/displayST7735.h"
|
|
||||||
DisplayST7735 dsp;
|
|
||||||
#elif DSP_MODEL==DSP_SSD1306 || DSP_MODEL==DSP_SSD1306x32
|
|
||||||
#include "src/displays/displaySSD1306.h"
|
|
||||||
DisplaySSD1306 dsp;
|
|
||||||
#elif DSP_MODEL==DSP_NOKIA5110
|
|
||||||
#include "src/displays/displayN5110.h"
|
|
||||||
DisplayN5110 dsp;
|
|
||||||
#elif DSP_MODEL==DSP_ST7789
|
|
||||||
#include "src/displays/displayST7789.h"
|
|
||||||
DisplayST7789 dsp;
|
|
||||||
#elif DSP_MODEL==DSP_SH1106
|
|
||||||
#include "src/displays/displaySH1106.h"
|
|
||||||
DisplaySH1106 dsp;
|
|
||||||
#elif DSP_MODEL==DSP_1602I2C
|
|
||||||
#include "src/displays/displayLC1602.h"
|
|
||||||
DisplayLC1602 dsp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Display display;
|
Display display;
|
||||||
|
|
||||||
void ticks() {
|
void ticks() {
|
||||||
@@ -206,6 +184,7 @@ void Display::init() {
|
|||||||
#endif
|
#endif
|
||||||
plCurrent.init(" * ", PLCURRENT_SIZE, yStart, STARTTIME_PL, TFT_BG, TFT_LOGO);
|
plCurrent.init(" * ", PLCURRENT_SIZE, yStart, STARTTIME_PL, TFT_BG, TFT_LOGO);
|
||||||
plCurrent.lock();
|
plCurrent.lock();
|
||||||
|
if(dsp_on_init) dsp_on_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::apScreen() {
|
void Display::apScreen() {
|
||||||
@@ -229,6 +208,7 @@ void Display::start() {
|
|||||||
rssi();
|
rssi();
|
||||||
time();
|
time();
|
||||||
timer.attach_ms(1000, ticks);
|
timer.attach_ms(1000, ticks);
|
||||||
|
if(dsp_on_start) dsp_on_start(&dsp);
|
||||||
// Экстреминатус секвестирован
|
// Экстреминатус секвестирован
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +261,7 @@ void Display::swichMode(displayMode_e newmode) {
|
|||||||
plCurrent.reset();
|
plCurrent.reset();
|
||||||
drawPlaylist();
|
drawPlaylist();
|
||||||
}
|
}
|
||||||
|
if(dsp_on_newmode) dsp_on_newmode(newmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::drawPlayer() {
|
void Display::drawPlayer() {
|
||||||
@@ -336,6 +317,7 @@ void Display::loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dsp.loop();
|
dsp.loop();
|
||||||
|
if(dsp_on_loop) dsp_on_loop();
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,6 +390,7 @@ void Display::ip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Display::time(bool redraw) {
|
void Display::time(bool redraw) {
|
||||||
|
if(dsp_before_clock) if(!dsp_before_clock(&dsp, dt)) return;
|
||||||
char timeStringBuff[20] = { 0 };
|
char timeStringBuff[20] = { 0 };
|
||||||
if (!dt) {
|
if (!dt) {
|
||||||
heap();
|
heap();
|
||||||
@@ -424,6 +407,7 @@ void Display::time(bool redraw) {
|
|||||||
dsp.printClock(network.timeinfo, dt, redraw);
|
dsp.printClock(network.timeinfo, dt, redraw);
|
||||||
#endif
|
#endif
|
||||||
dt = !dt;
|
dt = !dt;
|
||||||
|
if(dsp_after_clock) dsp_after_clock(&dsp, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::volume() {
|
void Display::volume() {
|
||||||
|
|||||||
@@ -5,6 +5,22 @@
|
|||||||
#include <Ticker.h>
|
#include <Ticker.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#if DSP_MODEL==DSP_DUMMY
|
||||||
|
#include "src/displays/displayDummy.h"
|
||||||
|
#elif DSP_MODEL==DSP_ST7735
|
||||||
|
#include "src/displays/displayST7735.h"
|
||||||
|
#elif DSP_MODEL==DSP_SSD1306 || DSP_MODEL==DSP_SSD1306x32
|
||||||
|
#include "src/displays/displaySSD1306.h"
|
||||||
|
#elif DSP_MODEL==DSP_NOKIA5110
|
||||||
|
#include "src/displays/displayN5110.h"
|
||||||
|
#elif DSP_MODEL==DSP_ST7789
|
||||||
|
#include "src/displays/displayST7789.h"
|
||||||
|
#elif DSP_MODEL==DSP_SH1106
|
||||||
|
#include "src/displays/displaySH1106.h"
|
||||||
|
#elif DSP_MODEL==DSP_1602I2C
|
||||||
|
#include "src/displays/displayLC1602.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum displayMode_e { PLAYER, VOL, STATIONS, NUMBERS };
|
enum displayMode_e { PLAYER, VOL, STATIONS, NUMBERS };
|
||||||
|
|
||||||
class Scroll {
|
class Scroll {
|
||||||
@@ -77,4 +93,11 @@ class Display {
|
|||||||
|
|
||||||
extern Display display;
|
extern Display display;
|
||||||
|
|
||||||
|
extern __attribute__((weak)) bool dsp_before_clock(DspCore *dsp, bool dots);
|
||||||
|
extern __attribute__((weak)) void dsp_after_clock(DspCore *dsp, bool dots);
|
||||||
|
extern __attribute__((weak)) void dsp_on_init();
|
||||||
|
extern __attribute__((weak)) void dsp_on_loop();
|
||||||
|
extern __attribute__((weak)) void dsp_on_start(DspCore *dsp);
|
||||||
|
extern __attribute__((weak)) void dsp_on_newmode(displayMode_e newmode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef options_h
|
#ifndef options_h
|
||||||
#define options_h
|
#define options_h
|
||||||
|
|
||||||
#define VERSION "0.5.035"
|
#define VERSION "0.5.070"
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
DO NOT EDIT THIS FILE.
|
DO NOT EDIT THIS FILE.
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#include "../../network.h"
|
#include "../../network.h"
|
||||||
|
|
||||||
DisplayDummy::DisplayDummy() {
|
DspCore::DspCore() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplayDummy::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
bool E = false;
|
bool E = false;
|
||||||
@@ -85,91 +85,91 @@ char* DisplayDummy::utf8Rus(const char* str, bool uppercase) {
|
|||||||
return strn;
|
return strn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::apScreen() {
|
void DspCore::apScreen() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDummy::loop() {
|
void DspCore::loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
#define PLMITEMLENGHT 40
|
#define PLMITEMLENGHT 40
|
||||||
#define PLMITEMHEIGHT 22
|
#define PLMITEMHEIGHT 22
|
||||||
|
|
||||||
class DisplayDummy {
|
class DspCore {
|
||||||
public:
|
public:
|
||||||
DisplayDummy();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -43,7 +43,7 @@ class DisplayDummy {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayDummy dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
@@ -13,18 +13,18 @@
|
|||||||
|
|
||||||
const byte controlspaces[] = { CLOCK_SPACE, VOL_SPACE };
|
const byte controlspaces[] = { CLOCK_SPACE, VOL_SPACE };
|
||||||
|
|
||||||
DisplayLC1602::DisplayLC1602(): LiquidCrystal_I2C(SCREEN_ADDRESS, 16, 2, I2C_SDA, I2C_SCL) {
|
DspCore::DspCore(): LiquidCrystal_I2C(SCREEN_ADDRESS, 16, 2, I2C_SDA, I2C_SCL) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::apScreen() {
|
void DspCore::apScreen() {
|
||||||
setCursor(0,0);
|
setCursor(0,0);
|
||||||
print("YORADIO AP MODE");
|
print("YORADIO AP MODE");
|
||||||
setCursor(0,1);
|
setCursor(0,1);
|
||||||
print(WiFi.softAPIP().toString().c_str());
|
print(WiFi.softAPIP().toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
init();
|
init();
|
||||||
backlight();
|
backlight();
|
||||||
screenwidth = 16;
|
screenwidth = 16;
|
||||||
@@ -34,11 +34,11 @@ void DisplayLC1602::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
|||||||
fillSpaces = true;
|
fillSpaces = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
centerText("NEXT STATION", 0, 0, 0);
|
centerText("NEXT STATION", 0, 0, 0);
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
@@ -49,34 +49,34 @@ void DisplayLC1602::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
tWidth = strlen(text);
|
tWidth = strlen(text);
|
||||||
tHeight = 1;
|
tHeight = 1;
|
||||||
sWidth = strlen(separator);
|
sWidth = strlen(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
for(uint16_t x=0; x<swidth-(fillSpaces?controlspaces[texttop]:0); x++){
|
for(uint16_t x=0; x<swidth-(fillSpaces?controlspaces[texttop]:0); x++){
|
||||||
setCursor(x, texttop);
|
setCursor(x, texttop);
|
||||||
print(" ");
|
print(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
byte x=(strlen(text)>swidth)?0:(swidth-strlen(text))/2;
|
byte x=(strlen(text)>swidth)?0:(swidth-strlen(text))/2;
|
||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
byte x=swidth-strlen(text);
|
byte x=swidth-strlen(text);
|
||||||
setCursor(x-1, y);
|
setCursor(x-1, y);
|
||||||
print(" ");
|
print(" ");
|
||||||
@@ -84,19 +84,19 @@ void DisplayLC1602::rightText(const char* text, byte y, uint16_t fg, uint16_t bg
|
|||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
rightText(timestr, 0, 0, 0);
|
rightText(timestr, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
char volstr[4];
|
char volstr[4];
|
||||||
sprintf(volstr, "%02d", config.store.volume);
|
sprintf(volstr, "%02d", config.store.volume);
|
||||||
if (withNumber) {;
|
if (withNumber) {;
|
||||||
@@ -108,34 +108,34 @@ void DisplayLC1602::drawVolumeBar(bool withNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
char numstr[7];
|
char numstr[7];
|
||||||
sprintf(numstr, "%d", num);
|
sprintf(numstr, "%d", num);
|
||||||
clearScroll(1, 0, 0);
|
clearScroll(1, 0, 0);
|
||||||
centerText(numstr, 1, TFT_LOGO, TFT_BG);
|
centerText(numstr, 1, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
if(x<0) {
|
if(x<0) {
|
||||||
xOffset=-x;
|
xOffset=-x;
|
||||||
x=0;
|
x=0;
|
||||||
@@ -147,7 +147,7 @@ void DisplayLC1602::set_Cursor(int16_t x, int16_t y) {
|
|||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
char tmp[swidth+1] = {0};
|
char tmp[swidth+1] = {0};
|
||||||
int16_t numchars = fillSpaces?swidth-controlspaces[yOffset]:swidth;
|
int16_t numchars = fillSpaces?swidth-controlspaces[yOffset]:swidth;
|
||||||
strlcpy(tmp, txt+xOffset, numchars+1-nextX);
|
strlcpy(tmp, txt+xOffset, numchars+1-nextX);
|
||||||
@@ -158,14 +158,14 @@ void DisplayLC1602::printText(const char* txt) {
|
|||||||
setCursor(nextX, yOffset);
|
setCursor(nextX, yOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLC1602::loop() {
|
void DspCore::loop() {
|
||||||
if (checkdelay(SCROLLTIME, loopdelay)) {
|
if (checkdelay(SCROLLTIME, loopdelay)) {
|
||||||
//display();
|
//display();
|
||||||
}
|
}
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean DisplayLC1602::checkdelay(int m, unsigned long & tstamp) {
|
boolean DspCore::checkdelay(int m, unsigned long & tstamp) {
|
||||||
if (millis() - tstamp > m) {
|
if (millis() - tstamp > m) {
|
||||||
tstamp = millis();
|
tstamp = millis();
|
||||||
return true;
|
return true;
|
||||||
@@ -174,7 +174,7 @@ boolean DisplayLC1602::checkdelay(int m, unsigned long & tstamp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplayLC1602::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
static char newStr[BUFLEN];
|
static char newStr[BUFLEN];
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
#define BOOTSTR_TOP1 1
|
#define BOOTSTR_TOP1 1
|
||||||
#define STARTTIME_PL 2000
|
#define STARTTIME_PL 2000
|
||||||
|
|
||||||
class DisplayLC1602: public LiquidCrystal_I2C {
|
class DspCore: public LiquidCrystal_I2C {
|
||||||
public:
|
public:
|
||||||
bool fillSpaces;
|
bool fillSpaces;
|
||||||
DisplayLC1602();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -58,7 +58,7 @@ class DisplayLC1602: public LiquidCrystal_I2C {
|
|||||||
boolean checkdelay(int m, unsigned long &tstamp);
|
boolean checkdelay(int m, unsigned long &tstamp);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayLC1602 dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ const unsigned char logo [] PROGMEM=
|
|||||||
0xe0, 0x01, 0xff, 0xc0
|
0xe0, 0x01, 0xff, 0xc0
|
||||||
};
|
};
|
||||||
|
|
||||||
DisplayN5110::DisplayN5110(): Adafruit_PCD8544(TFT_DC, TFT_CS, TFT_RST) {
|
DspCore::DspCore(): Adafruit_PCD8544(TFT_DC, TFT_CS, TFT_RST) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplayN5110::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
bool E = false;
|
bool E = false;
|
||||||
@@ -97,7 +97,7 @@ char* DisplayN5110::utf8Rus(const char* str, bool uppercase) {
|
|||||||
return strn;
|
return strn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::apScreen() {
|
void DspCore::apScreen() {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
setTextColor(TFT_FG, TFT_BG);
|
||||||
setFont(&TinyFont6);
|
setFont(&TinyFont6);
|
||||||
@@ -117,7 +117,7 @@ void DisplayN5110::apScreen() {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
begin();
|
begin();
|
||||||
setContrast(TFT_CONTRAST);
|
setContrast(TFT_CONTRAST);
|
||||||
cp437(true);
|
cp437(true);
|
||||||
@@ -133,13 +133,13 @@ void DisplayN5110::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
|||||||
sheight = screenheight;
|
sheight = screenheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
clearDisplay();
|
clearDisplay();
|
||||||
drawBitmap((width() - LOGO_WIDTH ) / 2, 0, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
|
drawBitmap((width() - LOGO_WIDTH ) / 2, 0, logo, LOGO_WIDTH, LOGO_HEIGHT, 1);
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
}
|
}
|
||||||
@@ -158,17 +158,17 @@ void DisplayN5110::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
fillScreen(TFT_BG);
|
fillScreen(TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
if (TFT_FRAMEWDT == 0) return;
|
if (TFT_FRAMEWDT == 0) return;
|
||||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
setTextSize(textsize);
|
setTextSize(textsize);
|
||||||
@@ -179,11 +179,11 @@ void DisplayN5110::getScrolBbounds(const char* text, const char* separator, byte
|
|||||||
sWidth = w;
|
sWidth = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
fillRect(0, texttop, swidth, textheight, bg);
|
fillRect(0, texttop, swidth, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
const char* txt = text;
|
const char* txt = text;
|
||||||
@@ -203,7 +203,7 @@ void DisplayN5110::centerText(const char* text, byte y, uint16_t fg, uint16_t bg
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||||
@@ -213,11 +213,11 @@ void DisplayN5110::rightText(const char* text, byte y, uint16_t fg, uint16_t bg)
|
|||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
@@ -230,7 +230,7 @@ void DisplayN5110::printClock(const char* timestr) {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
int16_t vTop = sheight - 3;
|
int16_t vTop = sheight - 3;
|
||||||
int16_t vWidth = swidth;
|
int16_t vWidth = swidth;
|
||||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||||
@@ -253,7 +253,7 @@ void DisplayN5110::drawVolumeBar(bool withNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG);
|
setTextColor(TFT_FG);
|
||||||
char numstr[7];
|
char numstr[7];
|
||||||
@@ -268,12 +268,12 @@ void DisplayN5110::drawNextStationNum(uint16_t num) {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
char buf[4];
|
char buf[4];
|
||||||
strlcpy(buf, str, strlen(str)-2);
|
strlcpy(buf, str, strlen(str)-2);
|
||||||
int16_t vTop = sheight - TFT_LINEHGHT - 2;
|
int16_t vTop = sheight - TFT_LINEHGHT - 2;
|
||||||
@@ -283,7 +283,7 @@ void DisplayN5110::rssi(const char* str) {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
int16_t vTop = sheight - TFT_LINEHGHT - 2;
|
int16_t vTop = sheight - TFT_LINEHGHT - 2;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(SILVER, TFT_BG);
|
setTextColor(SILVER, TFT_BG);
|
||||||
@@ -293,30 +293,30 @@ void DisplayN5110::ip(const char* str) {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
setTextSize(s);
|
setTextSize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
setTextColor(fg, bg);
|
setTextColor(fg, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayN5110::loop() {
|
void DspCore::loop() {
|
||||||
if (checkdelay(83, loopdelay)) {
|
if (checkdelay(83, loopdelay)) {
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean DisplayN5110::checkdelay(int m, unsigned long &tstamp) {
|
boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||||
if (millis() - tstamp > m) {
|
if (millis() - tstamp > m) {
|
||||||
tstamp = millis();
|
tstamp = millis();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
#define PLMITEMLENGHT 40
|
#define PLMITEMLENGHT 40
|
||||||
#define PLMITEMHEIGHT 10
|
#define PLMITEMHEIGHT 10
|
||||||
|
|
||||||
class DisplayN5110: public Adafruit_PCD8544 {
|
class DspCore: public Adafruit_PCD8544 {
|
||||||
public:
|
public:
|
||||||
DisplayN5110();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -57,7 +57,7 @@ class DisplayN5110: public Adafruit_PCD8544 {
|
|||||||
boolean checkdelay(int m, unsigned long &tstamp);
|
boolean checkdelay(int m, unsigned long &tstamp);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayN5110 dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ const unsigned char logo [] PROGMEM=
|
|||||||
|
|
||||||
TwoWire I2CSH1106 = TwoWire(0);
|
TwoWire I2CSH1106 = TwoWire(0);
|
||||||
|
|
||||||
DisplaySH1106::DisplaySH1106(): Adafruit_SH1106G(128, 64, &I2CSH1106, -1) {
|
DspCore::DspCore(): Adafruit_SH1106G(128, 64, &I2CSH1106, -1) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplaySH1106::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
bool E = false;
|
bool E = false;
|
||||||
@@ -108,7 +108,7 @@ char* DisplaySH1106::utf8Rus(const char* str, bool uppercase) {
|
|||||||
return strn;
|
return strn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::apScreen() {
|
void DspCore::apScreen() {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
setTextColor(TFT_FG, TFT_BG);
|
||||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
||||||
@@ -126,7 +126,7 @@ void DisplaySH1106::apScreen() {
|
|||||||
print("/");
|
print("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
I2CSH1106.begin(I2C_SDA, I2C_SCL, (uint32_t)100000);
|
I2CSH1106.begin(I2C_SDA, I2C_SCL, (uint32_t)100000);
|
||||||
if (!begin(SCREEN_ADDRESS, true)) {
|
if (!begin(SCREEN_ADDRESS, true)) {
|
||||||
Serial.println(F("SH1106 allocation failed"));
|
Serial.println(F("SH1106 allocation failed"));
|
||||||
@@ -142,7 +142,7 @@ void DisplaySH1106::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
|||||||
sheight = screenheight;
|
sheight = screenheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
clearDisplay();
|
clearDisplay();
|
||||||
drawBitmap(
|
drawBitmap(
|
||||||
(width() - LOGO_WIDTH ) / 2,
|
(width() - LOGO_WIDTH ) / 2,
|
||||||
@@ -151,7 +151,7 @@ void DisplaySH1106::drawLogo() {
|
|||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
}
|
}
|
||||||
@@ -170,17 +170,17 @@ void DisplaySH1106::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
fillScreen(TFT_BG);
|
fillScreen(TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
if (TFT_FRAMEWDT == 0) return;
|
if (TFT_FRAMEWDT == 0) return;
|
||||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
setTextSize(textsize);
|
setTextSize(textsize);
|
||||||
@@ -191,11 +191,11 @@ void DisplaySH1106::getScrolBbounds(const char* text, const char* separator, byt
|
|||||||
sWidth = w;
|
sWidth = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
fillRect(0, texttop, swidth, textheight, bg);
|
fillRect(0, texttop, swidth, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
const char* txt = text;
|
const char* txt = text;
|
||||||
@@ -208,7 +208,7 @@ void DisplaySH1106::centerText(const char* text, byte y, uint16_t fg, uint16_t b
|
|||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||||
@@ -218,11 +218,11 @@ void DisplaySH1106::rightText(const char* text, byte y, uint16_t fg, uint16_t bg
|
|||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
centerText(timestr, 34, TFT_FG, TFT_BG);
|
centerText(timestr, 34, TFT_FG, TFT_BG);
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
@@ -230,7 +230,7 @@ void DisplaySH1106::printClock(const char* timestr) {
|
|||||||
|
|
||||||
#define CLCLF 34
|
#define CLCLF 34
|
||||||
|
|
||||||
void DisplaySH1106::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
||||||
char timeStringBuff[20] = { 0 };
|
char timeStringBuff[20] = { 0 };
|
||||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%H:%M", &timeinfo);
|
strftime(timeStringBuff, sizeof(timeStringBuff), "%H:%M", &timeinfo);
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
@@ -243,7 +243,7 @@ void DisplaySH1106::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
|||||||
print(timeStringBuff);
|
print(timeStringBuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
int16_t vTop = sheight - 4;
|
int16_t vTop = sheight - 4;
|
||||||
int16_t vWidth = swidth;
|
int16_t vWidth = swidth;
|
||||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||||
@@ -264,7 +264,7 @@ void DisplaySH1106::drawVolumeBar(bool withNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
setTextColor(TFT_FG);
|
setTextColor(TFT_FG);
|
||||||
char numstr[7];
|
char numstr[7];
|
||||||
@@ -277,12 +277,12 @@ void DisplaySH1106::drawNextStationNum(uint16_t num) {
|
|||||||
print(numstr);
|
print(numstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
char buf[4];
|
char buf[4];
|
||||||
strlcpy(buf, str, strlen(str)-2);
|
strlcpy(buf, str, strlen(str)-2);
|
||||||
int16_t vTop = sheight - TFT_LINEHGHT - 4;
|
int16_t vTop = sheight - TFT_LINEHGHT - 4;
|
||||||
@@ -290,7 +290,7 @@ void DisplaySH1106::rssi(const char* str) {
|
|||||||
rightText(buf, vTop, SILVER, TFT_BG);
|
rightText(buf, vTop, SILVER, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
int16_t vTop = sheight - TFT_LINEHGHT - 4;
|
int16_t vTop = sheight - TFT_LINEHGHT - 4;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(SILVER, TFT_BG);
|
setTextColor(SILVER, TFT_BG);
|
||||||
@@ -298,30 +298,30 @@ void DisplaySH1106::ip(const char* str) {
|
|||||||
print(str);
|
print(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
setTextSize(s);
|
setTextSize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
setTextColor(fg, bg);
|
setTextColor(fg, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySH1106::loop() {
|
void DspCore::loop() {
|
||||||
if (checkdelay(SCROLLTIME, loopdelay)) {
|
if (checkdelay(SCROLLTIME, loopdelay)) {
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean DisplaySH1106::checkdelay(int m, unsigned long &tstamp) {
|
boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||||
if (millis() - tstamp > m) {
|
if (millis() - tstamp > m) {
|
||||||
tstamp = millis();
|
tstamp = millis();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
#define SCROLLDELTA 5
|
#define SCROLLDELTA 5
|
||||||
#define SCROLLTIME 110
|
#define SCROLLTIME 110
|
||||||
|
|
||||||
class DisplaySH1106: public Adafruit_SH1106G {
|
class DspCore: public Adafruit_SH1106G {
|
||||||
public:
|
public:
|
||||||
DisplaySH1106();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -52,7 +52,7 @@ class DisplaySH1106: public Adafruit_SH1106G {
|
|||||||
boolean checkdelay(int m, unsigned long &tstamp);
|
boolean checkdelay(int m, unsigned long &tstamp);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplaySH1106 dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ const unsigned char logo [] PROGMEM=
|
|||||||
|
|
||||||
TwoWire I2CSSD1306 = TwoWire(0);
|
TwoWire I2CSSD1306 = TwoWire(0);
|
||||||
|
|
||||||
DisplaySSD1306::DisplaySSD1306(): Adafruit_SSD1306(128, ((DSP_MODEL==DSP_SSD1306)?64:32), &I2CSSD1306, I2C_RST) {
|
DspCore::DspCore(): Adafruit_SSD1306(128, ((DSP_MODEL==DSP_SSD1306)?64:32), &I2CSSD1306, I2C_RST) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplaySSD1306::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
bool E = false;
|
bool E = false;
|
||||||
@@ -108,7 +108,7 @@ char* DisplaySSD1306::utf8Rus(const char* str, bool uppercase) {
|
|||||||
return strn;
|
return strn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::apScreen() {
|
void DspCore::apScreen() {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
setTextColor(TFT_FG, TFT_BG);
|
||||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + ((DSP_MODEL==DSP_SSD1306)?2:1) * TFT_LINEHGHT);
|
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + ((DSP_MODEL==DSP_SSD1306)?2:1) * TFT_LINEHGHT);
|
||||||
@@ -128,7 +128,7 @@ void DisplaySSD1306::apScreen() {
|
|||||||
print("/");
|
print("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
I2CSSD1306.begin(I2C_SDA, I2C_SCL, (uint32_t)100000);
|
I2CSSD1306.begin(I2C_SDA, I2C_SCL, (uint32_t)100000);
|
||||||
if (!begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
if (!begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||||
Serial.println(F("SSD1306 allocation failed"));
|
Serial.println(F("SSD1306 allocation failed"));
|
||||||
@@ -148,7 +148,7 @@ void DisplaySSD1306::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
|||||||
fillSpaces = true;
|
fillSpaces = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
clearDisplay();
|
clearDisplay();
|
||||||
#if DSP_MODEL==DSP_SSD1306
|
#if DSP_MODEL==DSP_SSD1306
|
||||||
drawBitmap(
|
drawBitmap(
|
||||||
@@ -163,7 +163,7 @@ void DisplaySSD1306::drawLogo() {
|
|||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
}
|
}
|
||||||
@@ -182,17 +182,17 @@ void DisplaySSD1306::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
fillScreen(TFT_BG);
|
fillScreen(TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
if (TFT_FRAMEWDT == 0) return;
|
if (TFT_FRAMEWDT == 0) return;
|
||||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
setTextSize(textsize);
|
setTextSize(textsize);
|
||||||
@@ -203,11 +203,11 @@ void DisplaySSD1306::getScrolBbounds(const char* text, const char* separator, by
|
|||||||
sWidth = w;
|
sWidth = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
fillRect(0, texttop, swidth, textheight, bg);
|
fillRect(0, texttop, swidth, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
const char* txt = text;
|
const char* txt = text;
|
||||||
@@ -218,7 +218,7 @@ void DisplaySSD1306::centerText(const char* text, byte y, uint16_t fg, uint16_t
|
|||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||||
@@ -228,11 +228,11 @@ void DisplaySSD1306::rightText(const char* text, byte y, uint16_t fg, uint16_t b
|
|||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
#if DSP_MODEL==DSP_SSD1306
|
#if DSP_MODEL==DSP_SSD1306
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
centerText(timestr, 34, TFT_FG, TFT_BG);
|
centerText(timestr, 34, TFT_FG, TFT_BG);
|
||||||
@@ -243,13 +243,13 @@ void DisplaySSD1306::printClock(const char* timestr) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw) {
|
||||||
#if DSP_MODEL==DSP_SSD1306x32
|
#if DSP_MODEL==DSP_SSD1306x32
|
||||||
strftime(insideClc, sizeof(insideClc), dots?" %H %M":" %H:%M", &timeinfo);
|
strftime(insideClc, sizeof(insideClc), dots?" %H %M":" %H:%M", &timeinfo);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
int16_t vTop = sheight - 4;
|
int16_t vTop = sheight - 4;
|
||||||
int16_t vWidth = swidth-TFT_FRAMEWDT*2;
|
int16_t vWidth = swidth-TFT_FRAMEWDT*2;
|
||||||
#if DSP_MODEL==DSP_SSD1306
|
#if DSP_MODEL==DSP_SSD1306
|
||||||
@@ -278,7 +278,7 @@ void DisplaySSD1306::drawVolumeBar(bool withNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
setTextColor(TFT_FG);
|
setTextColor(TFT_FG);
|
||||||
char numstr[7];
|
char numstr[7];
|
||||||
@@ -291,12 +291,12 @@ void DisplaySSD1306::drawNextStationNum(uint16_t num) {
|
|||||||
print(numstr);
|
print(numstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
setTextSize((DSP_MODEL==DSP_SSD1306?2:1));
|
setTextSize((DSP_MODEL==DSP_SSD1306?2:1));
|
||||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
if(!fillSpaces && DSP_MODEL==DSP_SSD1306x32) return;
|
if(!fillSpaces && DSP_MODEL==DSP_SSD1306x32) return;
|
||||||
char buf[4];
|
char buf[4];
|
||||||
strlcpy(buf, str, strlen(str)-2);
|
strlcpy(buf, str, strlen(str)-2);
|
||||||
@@ -305,7 +305,7 @@ void DisplaySSD1306::rssi(const char* str) {
|
|||||||
rightText(buf, vTop, SILVER, TFT_BG);
|
rightText(buf, vTop, SILVER, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
if(!fillSpaces && DSP_MODEL==DSP_SSD1306x32) return;
|
if(!fillSpaces && DSP_MODEL==DSP_SSD1306x32) return;
|
||||||
int16_t vTop = sheight - TFT_LINEHGHT - ((DSP_MODEL==DSP_SSD1306)?4:2);
|
int16_t vTop = sheight - TFT_LINEHGHT - ((DSP_MODEL==DSP_SSD1306)?4:2);
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
@@ -314,23 +314,23 @@ void DisplaySSD1306::ip(const char* str) {
|
|||||||
print(str);
|
print(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
setTextSize(s);
|
setTextSize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
setTextColor(fg, bg);
|
setTextColor(fg, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySSD1306::loop() {
|
void DspCore::loop() {
|
||||||
if (checkdelay(83, loopdelay)) {
|
if (checkdelay(83, loopdelay)) {
|
||||||
#if DSP_MODEL==DSP_SSD1306x32
|
#if DSP_MODEL==DSP_SSD1306x32
|
||||||
if(fillSpaces) printClock(insideClc);
|
if(fillSpaces) printClock(insideClc);
|
||||||
@@ -340,7 +340,7 @@ void DisplaySSD1306::loop() {
|
|||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean DisplaySSD1306::checkdelay(int m, unsigned long &tstamp) {
|
boolean DspCore::checkdelay(int m, unsigned long &tstamp) {
|
||||||
if (millis() - tstamp > m) {
|
if (millis() - tstamp > m) {
|
||||||
tstamp = millis();
|
tstamp = millis();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
#define VOL_TOP 16
|
#define VOL_TOP 16
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
class DisplaySSD1306: public Adafruit_SSD1306 {
|
class DspCore: public Adafruit_SSD1306 {
|
||||||
public:
|
public:
|
||||||
bool fillSpaces;
|
bool fillSpaces;
|
||||||
DisplaySSD1306();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -73,7 +73,7 @@ class DisplaySSD1306: public Adafruit_SSD1306 {
|
|||||||
boolean checkdelay(int m, unsigned long &tstamp);
|
boolean checkdelay(int m, unsigned long &tstamp);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplaySSD1306 dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ class GFXClock {
|
|||||||
|
|
||||||
GFXClock gclock;
|
GFXClock gclock;
|
||||||
|
|
||||||
DisplayST7735::DisplayST7735(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {
|
DspCore::DspCore(): Adafruit_ST7735(&SPI, TFT_CS, TFT_DC, TFT_RST) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplayST7735::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
bool E = false;
|
bool E = false;
|
||||||
@@ -122,7 +122,7 @@ char* DisplayST7735::utf8Rus(const char* str, bool uppercase) {
|
|||||||
return strn;
|
return strn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::apScreen() {
|
void DspCore::apScreen() {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
setTextColor(TFT_FG, TFT_BG);
|
||||||
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
setCursor(TFT_FRAMEWDT, TFT_FRAMEWDT + 2 * TFT_LINEHGHT);
|
||||||
@@ -140,7 +140,7 @@ void DisplayST7735::apScreen() {
|
|||||||
print("/");
|
print("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
initR(DTYPE);
|
initR(DTYPE);
|
||||||
cp437(true);
|
cp437(true);
|
||||||
fillScreen(TFT_BG);
|
fillScreen(TFT_BG);
|
||||||
@@ -153,7 +153,7 @@ void DisplayST7735::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
|||||||
gclock.init(dsp, &DS_DIGI28pt7b, TFT_LOGO, BLACK);
|
gclock.init(dsp, &DS_DIGI28pt7b, TFT_LOGO, BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
drawRGBBitmap((swidth - 99) / 2, 18, bootlogo2, 99, 64);
|
drawRGBBitmap((swidth - 99) / 2, 18, bootlogo2, 99, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void DisplayST7735::drawLogo() {
|
|||||||
#define CLR_ITEM2 0x39C7
|
#define CLR_ITEM2 0x39C7
|
||||||
#define CLR_ITEM3 0x18E3
|
#define CLR_ITEM3 0x18E3
|
||||||
|
|
||||||
void DisplayST7735::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
}
|
}
|
||||||
@@ -183,16 +183,16 @@ void DisplayST7735::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
fillScreen(TFT_BG);
|
fillScreen(TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
setTextSize(textsize);
|
setTextSize(textsize);
|
||||||
@@ -203,11 +203,11 @@ void DisplayST7735::getScrolBbounds(const char* text, const char* separator, byt
|
|||||||
sWidth = w;
|
sWidth = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
fillRect(0, texttop, swidth, textheight, bg);
|
fillRect(0, texttop, swidth, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
const char* txt = text;
|
const char* txt = text;
|
||||||
@@ -218,7 +218,7 @@ void DisplayST7735::centerText(const char* text, byte y, uint16_t fg, uint16_t b
|
|||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
void DspCore::rightText(const char* text, byte y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||||
@@ -228,7 +228,7 @@ void DisplayST7735::rightText(const char* text, byte y, uint16_t fg, uint16_t bg
|
|||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(DARK_GRAY, TFT_BG);
|
setTextColor(DARK_GRAY, TFT_BG);
|
||||||
@@ -248,11 +248,11 @@ void DisplayST7735::displayHeapForDebug() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
gclock.print(timestr);
|
gclock.print(timestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2;
|
||||||
int16_t vWidth = swidth - TFT_FRAMEWDT - 4;
|
int16_t vWidth = swidth - TFT_FRAMEWDT - 4;
|
||||||
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
|
||||||
@@ -275,7 +275,7 @@ void DisplayST7735::drawVolumeBar(bool withNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG);
|
setTextColor(TFT_FG);
|
||||||
setFont(&DS_DIGI28pt7b);
|
setFont(&DS_DIGI28pt7b);
|
||||||
@@ -290,18 +290,18 @@ void DisplayST7735::drawNextStationNum(uint16_t num) {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
setTextSize(2);
|
setTextSize(2);
|
||||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
rightText(str, vTop, SILVER, TFT_BG);
|
rightText(str, vTop, SILVER, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(SILVER, TFT_BG);
|
setTextColor(SILVER, TFT_BG);
|
||||||
@@ -309,23 +309,23 @@ void DisplayST7735::ip(const char* str) {
|
|||||||
print(str);
|
print(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
setTextSize(s);
|
setTextSize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
setTextColor(fg, bg);
|
setTextColor(fg, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7735::loop() {
|
void DspCore::loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
#define PLMITEMHEIGHT 22
|
#define PLMITEMHEIGHT 22
|
||||||
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
#define TITLE_TOP2 TFT_FRAMEWDT + 3 * TFT_LINEHGHT
|
||||||
|
|
||||||
class DisplayST7735: public Adafruit_ST7735 {
|
class DspCore: public Adafruit_ST7735 {
|
||||||
public:
|
public:
|
||||||
DisplayST7735();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -47,7 +47,7 @@ class DisplayST7735: public Adafruit_ST7735 {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayST7735 dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"};
|
const char *dow[7] = {"вс","пн","вт","ср","чт","пт","сб"};
|
||||||
const char *mnths[12] = {"января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"};
|
const char *mnths[12] = {"января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"};
|
||||||
|
|
||||||
DisplayST7789::DisplayST7789(): Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST) {
|
DspCore::DspCore(): Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* DisplayST7789::utf8Rus(const char* str, bool uppercase) {
|
char* DspCore::utf8Rus(const char* str, bool uppercase) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
static char strn[BUFLEN];
|
static char strn[BUFLEN];
|
||||||
bool E = false;
|
bool E = false;
|
||||||
@@ -89,7 +89,7 @@ char* DisplayST7789::utf8Rus(const char* str, bool uppercase) {
|
|||||||
return strn;
|
return strn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::apScreen() {
|
void DspCore::apScreen() {
|
||||||
setTextSize(TITLE_SIZE1);
|
setTextSize(TITLE_SIZE1);
|
||||||
setTextColor(TFT_FG, TFT_BG);
|
setTextColor(TFT_FG, TFT_BG);
|
||||||
setCursor(TFT_FRAMEWDT, TITLE_TOP1);
|
setCursor(TFT_FRAMEWDT, TITLE_TOP1);
|
||||||
@@ -108,7 +108,7 @@ void DisplayST7789::apScreen() {
|
|||||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
void DspCore::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
||||||
init(240,320);
|
init(240,320);
|
||||||
invertDisplay(TFT_INVERT);
|
invertDisplay(TFT_INVERT);
|
||||||
cp437(true);
|
cp437(true);
|
||||||
@@ -122,13 +122,13 @@ void DisplayST7789::initD(uint16_t &screenwidth, uint16_t &screenheight) {
|
|||||||
sheight = screenheight;
|
sheight = screenheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::drawLogo() {
|
void DspCore::drawLogo() {
|
||||||
drawRGBBitmap((swidth - 99) / 2, (sheight-64)/2 - TFT_LINEHGHT*2, bootlogo2, 99, 64);
|
drawRGBBitmap((swidth - 99) / 2, (sheight-64)/2 - TFT_LINEHGHT*2, bootlogo2, 99, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://greekgeeks.net/#maker-tools_convertColor
|
// http://greekgeeks.net/#maker-tools_convertColor
|
||||||
uint16_t iclrs[] = { 0x738E /*707070*/, 0x52AA /*575757*/, 0x39C7, 0x18E3 };
|
uint16_t iclrs[] = { 0x738E /*707070*/, 0x52AA /*575757*/, 0x39C7, 0x18E3 };
|
||||||
void DisplayST7789::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
void DspCore::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
||||||
for (byte i = 0; i < PLMITEMS; i++) {
|
for (byte i = 0; i < PLMITEMS; i++) {
|
||||||
plMenu[i][0] = '\0';
|
plMenu[i][0] = '\0';
|
||||||
}
|
}
|
||||||
@@ -147,17 +147,17 @@ void DisplayST7789::drawPlaylist(uint16_t currentItem, char* currentItemText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::clearDsp() {
|
void DspCore::clearDsp() {
|
||||||
fillScreen(TFT_BG);
|
fillScreen(TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
if (TFT_FRAMEWDT==0) return;
|
if (TFT_FRAMEWDT==0) return;
|
||||||
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(0, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
fillRect(swidth - TFT_FRAMEWDT, texttop, TFT_FRAMEWDT, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
void DspCore::getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
setTextSize(textsize);
|
setTextSize(textsize);
|
||||||
@@ -168,11 +168,11 @@ void DisplayST7789::getScrolBbounds(const char* text, const char* separator, byt
|
|||||||
sWidth = w;
|
sWidth = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
void DspCore::clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg) {
|
||||||
fillRect(0, texttop, swidth, textheight, bg);
|
fillRect(0, texttop, swidth, textheight, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::centerText(const char* text, uint16_t y, uint16_t fg, uint16_t bg) {
|
void DspCore::centerText(const char* text, uint16_t y, uint16_t fg, uint16_t bg) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
const char* txt = text;
|
const char* txt = text;
|
||||||
@@ -185,7 +185,7 @@ void DisplayST7789::centerText(const char* text, uint16_t y, uint16_t fg, uint16
|
|||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::rightText(const char* text, uint16_t y, uint16_t fg, uint16_t bg, bool fliprect, uint16_t delta) {
|
void DspCore::rightText(const char* text, uint16_t y, uint16_t fg, uint16_t bg, bool fliprect, uint16_t delta) {
|
||||||
int16_t x1, y1;
|
int16_t x1, y1;
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
|
||||||
@@ -195,7 +195,7 @@ void DisplayST7789::rightText(const char* text, uint16_t y, uint16_t fg, uint16_
|
|||||||
print(text);
|
print(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::displayHeapForDebug() {
|
void DspCore::displayHeapForDebug() {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2;
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(DARK_GRAY, TFT_BG);
|
setTextColor(DARK_GRAY, TFT_BG);
|
||||||
@@ -215,7 +215,7 @@ void DisplayST7789::displayHeapForDebug() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::printClock(const char* timestr) {
|
void DspCore::printClock(const char* timestr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ uint8_t clsp = 24;
|
|||||||
uint16_t clleft = 0;
|
uint16_t clleft = 0;
|
||||||
uint16_t clwidth = 0;
|
uint16_t clwidth = 0;
|
||||||
|
|
||||||
void DisplayST7789::printClock(struct tm timeinfo, bool dots, bool redraw){
|
void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw){
|
||||||
char timeBuf[50] = { 0 };
|
char timeBuf[50] = { 0 };
|
||||||
strftime(timeBuf, sizeof(timeBuf), "%H:%M", &timeinfo);
|
strftime(timeBuf, sizeof(timeBuf), "%H:%M", &timeinfo);
|
||||||
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
if(strstr(oldTimeBuf, timeBuf)==NULL || redraw){
|
||||||
@@ -266,7 +266,7 @@ void DisplayST7789::printClock(struct tm timeinfo, bool dots, bool redraw){
|
|||||||
print(timeBuf);
|
print(timeBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::drawVolumeBar(bool withNumber) {
|
void DspCore::drawVolumeBar(bool withNumber) {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2;
|
||||||
int16_t volTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
int16_t volTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||||
int16_t vWidth = swidth - TFT_FRAMEWDT *2;
|
int16_t vWidth = swidth - TFT_FRAMEWDT *2;
|
||||||
@@ -296,7 +296,7 @@ void DisplayST7789::drawVolumeBar(bool withNumber) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::drawNextStationNum(uint16_t num) {
|
void DspCore::drawNextStationNum(uint16_t num) {
|
||||||
setTextSize(1);
|
setTextSize(1);
|
||||||
setTextColor(TFT_FG);
|
setTextColor(TFT_FG);
|
||||||
setFont(&DS_DIGI42pt7b);
|
setFont(&DS_DIGI42pt7b);
|
||||||
@@ -311,13 +311,13 @@ void DisplayST7789::drawNextStationNum(uint16_t num) {
|
|||||||
setFont();
|
setFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::frameTitle(const char* str) {
|
void DspCore::frameTitle(const char* str) {
|
||||||
setTextSize(META_SIZE);
|
setTextSize(META_SIZE);
|
||||||
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
centerText(str, TFT_FRAMEWDT, TFT_LOGO, TFT_BG);
|
||||||
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
drawFastHLine(TFT_FRAMEWDT, TITLE_TOP1-8, swidth-TFT_FRAMEWDT*2, SILVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::rssi(const char* str) {
|
void DspCore::rssi(const char* str) {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
sprintf(buf, "RSSI:%s", str);
|
sprintf(buf, "RSSI:%s", str);
|
||||||
@@ -325,7 +325,7 @@ void DisplayST7789::rssi(const char* str) {
|
|||||||
rightText(buf, vTop, SILVER, TFT_BG);
|
rightText(buf, vTop, SILVER, TFT_BG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::ip(const char* str) {
|
void DspCore::ip(const char* str) {
|
||||||
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
int16_t vTop = sheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2;
|
||||||
char buf[30];
|
char buf[30];
|
||||||
sprintf(buf, "IP: %s", str);
|
sprintf(buf, "IP: %s", str);
|
||||||
@@ -335,23 +335,23 @@ void DisplayST7789::ip(const char* str) {
|
|||||||
print(buf);
|
print(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::set_TextSize(uint8_t s) {
|
void DspCore::set_TextSize(uint8_t s) {
|
||||||
setTextSize(s);
|
setTextSize(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::set_TextColor(uint16_t fg, uint16_t bg) {
|
void DspCore::set_TextColor(uint16_t fg, uint16_t bg) {
|
||||||
setTextColor(fg, bg);
|
setTextColor(fg, bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::set_Cursor(int16_t x, int16_t y) {
|
void DspCore::set_Cursor(int16_t x, int16_t y) {
|
||||||
setCursor(x, y);
|
setCursor(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::printText(const char* txt) {
|
void DspCore::printText(const char* txt) {
|
||||||
print(txt);
|
print(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayST7789::loop() {
|
void DspCore::loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
#define TITLE_TOP2 TFT_FRAMEWDT + (META_SIZE+2) * TFT_LINEHGHT + 8
|
#define TITLE_TOP2 TFT_FRAMEWDT + (META_SIZE+2) * TFT_LINEHGHT + 8
|
||||||
#define TITLE_FG2 SILVER
|
#define TITLE_FG2 SILVER
|
||||||
|
|
||||||
class DisplayST7789: public Adafruit_ST7789 {
|
class DspCore: public Adafruit_ST7789 {
|
||||||
public:
|
public:
|
||||||
DisplayST7789();
|
DspCore();
|
||||||
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
char plMenu[PLMITEMS][PLMITEMLENGHT];
|
||||||
uint16_t clockY;
|
uint16_t clockY;
|
||||||
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
void initD(uint16_t &screenwidth, uint16_t &screenheight);
|
||||||
@@ -61,7 +61,7 @@ class DisplayST7789: public Adafruit_ST7789 {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayST7789 dsp;
|
extern DspCore dsp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TFT COLORS
|
* TFT COLORS
|
||||||
|
|||||||
Reference in New Issue
Block a user