This commit is contained in:
e2002
2022-10-14 11:00:49 +03:00
parent dbe0f32e14
commit 1c4b1dec6e
94 changed files with 5320 additions and 6613 deletions

View File

@@ -1,121 +1,76 @@
#ifndef displayLC1602_h
#define displayLC1602_h
#include "../core/options.h"
#include "Arduino.h"
#include "tools/l10n.h"
#define DSP_FLIPPED 0
#define DSP_NOT_FLIPPED
#define DSP_LCD
#define CHARWIDTH 1
#define CHARHEIGHT 1
#include "widgets/widgets.h"
#include "widgets/pages.h"
#if DSP_MODEL==DSP_2004 || DSP_MODEL==DSP_2004I2C
#define LCD_2004
#define LCD_2004
#endif
#if DSP_MODEL==DSP_1602I2C || DSP_MODEL==DSP_2004I2C
#define LCD_I2C
#include "../LiquidCrystalI2C/LiquidCrystalI2CEx.h"
#define LCD_I2C
#include "../LiquidCrystalI2C/LiquidCrystalI2CEx.h"
#else
#include <LiquidCrystal.h>
#include <LiquidCrystal.h>
#endif
#ifdef LCD_I2C
#ifdef LCD_2004
#define DSP_INIT LiquidCrystal_I2C(SCREEN_ADDRESS, 20, 4, I2C_SDA, I2C_SCL)
#else
#define DSP_INIT LiquidCrystal_I2C(SCREEN_ADDRESS, 16, 2, I2C_SDA, I2C_SCL)
#endif
#else
#define DSP_INIT LiquidCrystal(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7)
#endif
#ifdef LCD_2004
#define DSP_INIT LiquidCrystal_I2C(SCREEN_ADDRESS, 20, 4, I2C_SDA, I2C_SCL)
#if __has_include("conf/displayLCD2004conf_custom.h")
#include "conf/displayLCD2004conf_custom.h"
#else
#include "conf/displayLCD2004conf.h"
#endif
#else
#define DSP_INIT LiquidCrystal_I2C(SCREEN_ADDRESS, 16, 2, I2C_SDA, I2C_SCL)
#endif
#else
#define DSP_INIT LiquidCrystal(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7)
#if __has_include("conf/displayLCD1602conf_custom.h")
#include "conf/displayLCD1602conf_custom.h"
#else
#include "conf/displayLCD1602conf.h"
#endif
#endif
#define BOOT_PRG_COLOR 0x1
#define BOOT_TXT_COLOR 0x1
#define PINK 0x1
#define TFT_LINEHGHT 1
#define TFT_FRAMEWDT 0
#define DSP_CAN_SLEEP true
#define PLMITEMLENGHT 40
#define PLMITEMHEIGHT 9
#define TITLE_TOP1 1
#ifdef LCD_2004
#define PLMITEMS 3
#define TITLE_TOP2 2
#define PL_TOP 2
#define BOOTSTR_TOP2 1
#define BOOTSTR_TOP1 2
#else
#define PLMITEMS 1
#define TITLE_SIZE2 0
#define IP_INST_VOL
#define PL_TOP 1
#define BOOTSTR_TOP2 0
#define BOOTSTR_TOP1 1
#endif
#define PLCURRENT_SIZE 1
#define SCROLLDELTA 1
#define SCROLLTIME 250
#define STARTTIME_PL 2000
/* not used required */
#define bootLogoTop 0
const char rssiFmt[] PROGMEM = "";
const MoveConfig clockMove PROGMEM = { 0, 0, -1 };
const MoveConfig weatherMove PROGMEM = { 0, 0, -1 };
const MoveConfig weatherMoveVU PROGMEM = { 0, 0, -1 };
const char const_lcdApMode[] PROGMEM = "YORADIO AP MODE";
const char const_lcdApName[] PROGMEM = "AP NAME: ";
const char const_lcdApPass[] PROGMEM = "PASSWORD: ";
#ifdef LCD_I2C
class DspCore: public LiquidCrystal_I2C {
class DspCore: public LiquidCrystal_I2C {
#else
class DspCore: public LiquidCrystal {
class DspCore: public LiquidCrystal {
#endif
public:
bool fillSpaces;
DspCore();
char plMenu[PLMITEMS][PLMITEMLENGHT];
uint16_t clockY;
void initD(uint16_t &screenwidth, uint16_t &screenheight);
void apScreen();
void drawLogo();
void clearDsp();
void centerText(const char* text, byte y, uint16_t fg, uint16_t bg);
void rightText(const char* text, byte y, uint16_t fg, uint16_t bg);
void set_TextSize(uint8_t s);
void set_TextColor(uint16_t fg, uint16_t bg);
void set_Cursor(int16_t x, int16_t y);
void printText(const char* txt);
void printClock(const char* timestr);
void printClock(struct tm timeinfo, bool dots, bool redraw = false);
void displayHeapForDebug();
void drawVolumeBar(bool withNumber);
void drawNextStationNum(uint16_t num);
char* utf8Rus(const char* str, bool uppercase=true);
void drawScrollFrame(uint16_t texttop, uint16_t textheight, uint16_t bg);
void getScrolBbounds(const char* text, const char* separator, byte textsize, uint16_t &tWidth, uint16_t &tHeight, uint16_t &sWidth);
void clearScroll(uint16_t texttop, uint16_t textheight, uint16_t bg);
void frameTitle(const char* str);
void rssi(const char* str);
void ip(const char* str);
void drawPlaylist(uint16_t currentItem, char* currentItemText);
void loop(bool force=false);
void flip(){};
void invert(){};
void sleep();
void wake();
private:
uint16_t swidth, sheight, xOffset, yOffset;
int16_t nextX;
unsigned long loopdelay;
boolean checkdelay(int m, unsigned long &tstamp);
#include "tools/commongfx.h"
};
extern DspCore dsp;
/*
* TFT COLORS
*/
#define CLOCK_SPACE 6
#ifdef LCD_2004
#define VOL_SPACE 0
#else
#define VOL_SPACE 3
#endif
#define SILVER 0
#define TFT_BG 0
#define TFT_FG CLOCK_SPACE
#define TFT_LOGO VOL_SPACE
#endif