v0.9.399
This commit is contained in:
Binary file not shown.
@@ -68,6 +68,14 @@
|
||||
<input type="range" id="slcontrast" class="slider" data-slaveid="slcontrastinfo" name="contrast" min="0" max="100" value="55">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-title"><span>screensaver</span></div>
|
||||
<div class="flex-row group group_tft group_oled group_nextion hidden" style="margin-top:20px;">
|
||||
<div class="checkbox off nous" id="screensaverenabled">screensaver enabled</div>
|
||||
<div class="inputwrap">
|
||||
<span class="inputtitle">screensaver timeout (sec)</span>
|
||||
<input type="number" id="screensavertimeout" class="textinput inputchange" name="screensavertimeout" value="" maxlength="3" min="0" max="65520" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="group group_controls hidden" id="group_controls">
|
||||
<div class="title"><span>Controls</span></div><div class="reset" data-name="controls"></div>
|
||||
|
||||
@@ -340,26 +340,26 @@ void Audio::setVolume(uint8_t vol){
|
||||
// Input value is 0..21. 21 is the loudest.
|
||||
// Clicking reduced by using 0xf8 to 0x00 as limits.
|
||||
uint16_t value; // Value to send to SCI_VOL
|
||||
uint8_t valueL, valueR;
|
||||
int16_t balance_map = map(m_balance, -16, 16, -100, 100);
|
||||
|
||||
valueL = vol;
|
||||
uint8_t valueL, valueR;
|
||||
int16_t balance_map = map(m_balance, -16, 16, -100, 100);
|
||||
|
||||
valueL = vol;
|
||||
valueR = vol;
|
||||
if (balance_map < 0) {
|
||||
valueR = (float)valueR-(float)valueR * abs((float)balance_map)/100;
|
||||
} else if (balance_map > 0) {
|
||||
valueL = (float)valueL-(float)valueL * abs((float)balance_map)/100;
|
||||
valueL = (float)valueL-(float)valueL * abs((float)balance_map)/100;
|
||||
}
|
||||
curvol = vol;
|
||||
|
||||
uint8_t lgvolL = VS1053VOL(valueL);
|
||||
uint8_t lgvolR = VS1053VOL(valueR);
|
||||
if(lgvolL==VS1053VOLM) lgvolL=0;
|
||||
if(lgvolR==VS1053VOLM) lgvolR=0;
|
||||
valueL=map(lgvolL, 0, 254, 0xF8, 0x00);
|
||||
valueR=map(lgvolR, 0, 254, 0xF8, 0x00);
|
||||
value=(valueL << 8) | valueR;
|
||||
write_register(SCI_VOL, value);
|
||||
uint8_t lgvolL = VS1053VOL(valueL);
|
||||
uint8_t lgvolR = VS1053VOL(valueR);
|
||||
if(lgvolL==VS1053VOLM) lgvolL=0;
|
||||
if(lgvolR==VS1053VOLM) lgvolR=0;
|
||||
valueL=map(lgvolL, 0, 254, 0xF8, 0x00);
|
||||
valueR=map(lgvolR, 0, 254, 0xF8, 0x00);
|
||||
value=(valueL << 8) | valueR;
|
||||
write_register(SCI_VOL, value);
|
||||
/* uint16_t value; // Value to send to SCI_VOL
|
||||
|
||||
if(vol > 21) vol=21;
|
||||
@@ -386,23 +386,39 @@ void Audio::setTone(int8_t *rtone){ // Set bass/treble (4
|
||||
write_register(SCI_BASS, value); // Volume left and right
|
||||
}
|
||||
/*
|
||||
Name Bits Description
|
||||
ST AMPLITUDE 15:12 Treble Control in 1.5 dB steps (-8..7, 0 = off)
|
||||
ST FREQLIMIT 11:8 Lower limit frequency in 1000 Hz steps (1..15) // 1000..15000
|
||||
SB AMPLITUDE 7:4 Bass Enhancement in 1 dB steps (0..15, 0 = off)
|
||||
SB FREQLIMIT 3:0 Lower limit frequency in 10 Hz steps (2..15) // 20..150
|
||||
Name Bits Description
|
||||
ST AMPLITUDE 15:12 Treble Control in 1.5 dB steps (-8..7, 0 = off)
|
||||
ST FREQLIMIT 11:8 Lower limit frequency in 1000 Hz steps (1..15) // 1000..15000
|
||||
SB AMPLITUDE 7:4 Bass Enhancement in 1 dB steps (0..15, 0 = off)
|
||||
SB FREQLIMIT 3:0 Lower limit frequency in 10 Hz steps (2..15) // 20..150
|
||||
*/
|
||||
/*
|
||||
void Audio::setTone(int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass){
|
||||
if(gainLowPass<0) gainLowPass=0;
|
||||
if(gainLowPass>15) gainLowPass=15;
|
||||
if(gainBandPass<0) gainBandPass=0;
|
||||
if(gainBandPass>13) gainBandPass=13;
|
||||
int8_t rtone[] = {(int8_t)map(gainHighPass, -16, 16, -8, 7), (int8_t)(2+gainBandPass), gainLowPass, (int8_t)(15-gainBandPass)};
|
||||
setTone(rtone);
|
||||
}
|
||||
*/
|
||||
void Audio::setTone(int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass){
|
||||
if(gainLowPass<0) gainLowPass=0;
|
||||
if(gainLowPass>15) gainLowPass=15;
|
||||
if(gainBandPass<0) gainBandPass=0;
|
||||
if(gainBandPass>13) gainBandPass=13;
|
||||
int8_t rtone[] = {(int8_t)map(gainHighPass, -16, 16, -8, 7), (int8_t)(2+gainBandPass), gainLowPass, (int8_t)(15-gainBandPass)};
|
||||
setTone(rtone);
|
||||
gainHighPass = constrain(gainHighPass, -16, 16);
|
||||
gainBandPass = constrain(gainBandPass, -16, 16);
|
||||
gainLowPass = constrain(gainLowPass, -16, 16);
|
||||
|
||||
uint8_t trebleFreqLimit = map(-gainBandPass, -16, 16, 1, 15);
|
||||
uint8_t bassFreqLimit = map(gainBandPass, -16, 16, 2, 15);
|
||||
uint8_t st_amplitude = map(gainHighPass, -16, 16, -8, 7);
|
||||
uint8_t sb_amplitude = map(gainLowPass, -16, 16, 0, 15);
|
||||
uint16_t sci_bass = (st_amplitude << 12) | (trebleFreqLimit << 8) |
|
||||
(sb_amplitude << 4) | bassFreqLimit;
|
||||
write_register(SCI_BASS, sci_bass);
|
||||
}
|
||||
|
||||
void Audio::setBalance(int8_t bal){
|
||||
m_balance = bal;
|
||||
setVolume(curvol);
|
||||
m_balance = bal;
|
||||
setVolume(curvol);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
uint8_t Audio::getVolume() // Get the currenet volume setting.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
enum displayMode_e { PLAYER, VOL, STATIONS, NUMBERS, LOST, UPDATING, INFO, SETTINGS, TIMEZONE, WIFI, CLEAR, SLEEPING, SDCHANGE };
|
||||
enum pages_e : uint8_t { PG_PLAYER=0, PG_DIALOG=1, PG_PLAYLIST=2 };
|
||||
enum displayMode_e { PLAYER, VOL, STATIONS, NUMBERS, LOST, UPDATING, INFO, SETTINGS, TIMEZONE, WIFI, CLEAR, SLEEPING, SDCHANGE, SCREENSAVER };
|
||||
enum pages_e : uint8_t { PG_PLAYER=0, PG_DIALOG=1, PG_PLAYLIST=2, PG_SCREENSAVER=3 };
|
||||
|
||||
enum displayRequestType_e { BOOTSTRING, NEWMODE, CLOCK, NEWTITLE, NEWSTATION, NEXTSTATION, DRAWPLAYLIST, DRAWVOL, DBITRATE, AUDIOINFO, SHOWVUMETER, DSPRSSI, SHOWWEATHER, NEWWEATHER, PSTOP, PSTART, DSP_START, WAITFORSD, SDFILEINDEX, NEWIP, NOPE };
|
||||
struct requestParams_t
|
||||
|
||||
@@ -33,6 +33,8 @@ bool Config::_isFSempty() {
|
||||
void Config::init() {
|
||||
EEPROM.begin(EEPROM_SIZE);
|
||||
sdResumePos = 0;
|
||||
screensaverTicks = 0;
|
||||
isScreensaver = false;
|
||||
bootInfo();
|
||||
#if RTCSUPPORTED
|
||||
_rtcFound = false;
|
||||
@@ -86,6 +88,10 @@ void Config::_setupVersion(){
|
||||
uint16_t currentVersion = store.version;
|
||||
switch(currentVersion){
|
||||
case 1:
|
||||
saveValue(&store.screensaverEnabled, false);
|
||||
saveValue(&store.screensaverTimeout, (uint16_t)20);
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -339,6 +345,8 @@ void Config::setDefaults() {
|
||||
store.forcemono = false;
|
||||
store.i2sinternal = false;
|
||||
store.rotate90 = false;
|
||||
store.screensaverEnabled = false;
|
||||
store.screensaverTimeout = 20;
|
||||
eepromWrite(EEPROM_START, store);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
|
||||
#define ESP_ARDUINO_3 1
|
||||
#endif
|
||||
#define CONFIG_VERSION 1
|
||||
#define CONFIG_VERSION 2
|
||||
|
||||
enum playMode_e : uint8_t { PM_WEB=0, PM_SDCARD=1 };
|
||||
enum BitrateFormat { BF_UNCNOWN, BF_MP3, BF_AAC, BF_FLAC, BF_OGG, BF_WAV };
|
||||
@@ -133,6 +133,8 @@ struct config_t
|
||||
bool forcemono;
|
||||
bool i2sinternal;
|
||||
bool rotate90;
|
||||
bool screensaverEnabled;
|
||||
uint16_t screensaverTimeout;
|
||||
};
|
||||
|
||||
#if IR_PIN!=255
|
||||
@@ -175,6 +177,8 @@ class Config {
|
||||
uint32_t sdResumePos;
|
||||
bool emptyFS;
|
||||
uint16_t vuThreshold;
|
||||
uint16_t screensaverTicks;
|
||||
bool isScreensaver;
|
||||
public:
|
||||
Config() {};
|
||||
//void save();
|
||||
|
||||
@@ -252,6 +252,10 @@ void irLoop() {
|
||||
if(config.ircodes.irVals[target][j]==irResults.value){
|
||||
if (network.status != CONNECTED && network.status!=SDREADY && target!=IR_AST) return;
|
||||
if(target!=IR_AST && display.mode()==LOST) return;
|
||||
if (display.mode() == SCREENSAVER) {
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
return;
|
||||
}
|
||||
switch (target){
|
||||
case IR_PLAY: {
|
||||
irBlink();
|
||||
@@ -483,6 +487,12 @@ void onBtnClick(int id) {
|
||||
if (display.mode() == PLAYER) {
|
||||
player.toggle();
|
||||
}
|
||||
if (display.mode() == SCREENSAVER) {
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
#ifdef DSP_LCD
|
||||
delay(200);
|
||||
#endif
|
||||
}
|
||||
if (display.mode() == STATIONS) {
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
#ifdef DSP_LCD
|
||||
@@ -530,6 +540,10 @@ void onBtnClick(int id) {
|
||||
}
|
||||
|
||||
void onBtnDoubleClick(int id) {
|
||||
if (display.mode() == SCREENSAVER) {
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
return;
|
||||
}
|
||||
switch ((controlEvt_e)id) {
|
||||
case EVT_BTNLEFT: {
|
||||
if (display.mode() != PLAYER) return;
|
||||
|
||||
@@ -16,7 +16,7 @@ Nextion nextion;
|
||||
//============================================================================================================================
|
||||
DspCore dsp;
|
||||
|
||||
Page *pages[] = { new Page(), new Page(), new Page() };
|
||||
Page *pages[] = { new Page(), new Page(), new Page(), new Page() };
|
||||
|
||||
#ifndef DSQ_SEND_DELAY
|
||||
#define DSQ_SEND_DELAY portMAX_DELAY
|
||||
@@ -153,6 +153,7 @@ void Display::_buildPager(){
|
||||
#endif
|
||||
if(_vuwidget) pages[PG_PLAYER]->addWidget( _vuwidget);
|
||||
pages[PG_PLAYER]->addWidget(&_clock);
|
||||
pages[PG_SCREENSAVER]->addWidget(&_clock);
|
||||
pages[PG_PLAYER]->addPage(&_footer);
|
||||
|
||||
if(_metabackground) pages[PG_DIALOG]->addWidget( _metabackground);
|
||||
@@ -267,6 +268,7 @@ void Display::_swichMode(displayMode_e newmode) {
|
||||
_mode = newmode;
|
||||
dsp.setScrollId(NULL);
|
||||
if (newmode == PLAYER) {
|
||||
_clock.moveBack();
|
||||
#ifdef DSP_LCD
|
||||
dsp.clearDsp();
|
||||
#endif
|
||||
@@ -278,9 +280,17 @@ void Display::_swichMode(displayMode_e newmode) {
|
||||
_meta.setAlign(metaConf.widget.align);
|
||||
_meta.setText(config.station.name);
|
||||
_nums.setText("");
|
||||
config.isScreensaver = false;
|
||||
_pager.setPage( pages[PG_PLAYER]);
|
||||
pm.on_display_player();
|
||||
}
|
||||
if (newmode == SCREENSAVER) {
|
||||
config.isScreensaver = true;
|
||||
_pager.setPage( pages[PG_SCREENSAVER]);
|
||||
}else{
|
||||
config.screensaverTicks=SCREENSAVERSTARTUPDELAY;
|
||||
config.isScreensaver = false;
|
||||
}
|
||||
if (newmode == VOL) {
|
||||
#ifndef HIDE_IP
|
||||
_showDialog(const_DlgVolume);
|
||||
@@ -377,7 +387,7 @@ void Display::loop() {
|
||||
switch (request.type){
|
||||
case NEWMODE: _swichMode((displayMode_e)request.payload); break;
|
||||
case CLOCK:
|
||||
if(_mode==PLAYER) _time();
|
||||
if(_mode==PLAYER || _mode==SCREENSAVER) _time();
|
||||
/*#ifdef USE_NEXTION
|
||||
if(_mode==TIMEZONE) nextion.localTime(network.timeinfo);
|
||||
if(_mode==INFO) nextion.rssi();
|
||||
@@ -522,6 +532,8 @@ void Display::_time(bool redraw) {
|
||||
config.setBrightness();
|
||||
}
|
||||
#endif
|
||||
if(config.isScreensaver && network.timeinfo.tm_sec % 60 == 0)
|
||||
_clock.moveTo({clockConf.left, random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-TFT_FRAMEWDT*2)), 0});
|
||||
_clock.draw();
|
||||
/*#ifdef USE_NEXTION
|
||||
nextion.printClock(network.timeinfo);
|
||||
|
||||
@@ -294,7 +294,7 @@ void NetServer::processQueue(){
|
||||
config.store.softapdelay,
|
||||
config.vuThreshold);
|
||||
break;
|
||||
case GETSCREEN: sprintf (wsbuf, "{\"flip\":%d,\"inv\":%d,\"nump\":%d,\"tsf\":%d,\"tsd\":%d,\"dspon\":%d,\"br\":%d,\"con\":%d}",
|
||||
case GETSCREEN: sprintf (wsbuf, "{\"flip\":%d,\"inv\":%d,\"nump\":%d,\"tsf\":%d,\"tsd\":%d,\"dspon\":%d,\"br\":%d,\"con\":%d,\"scre\":%d,\"scrt\":%d}",
|
||||
config.store.flipscreen,
|
||||
config.store.invertdisplay,
|
||||
config.store.numplaylist,
|
||||
@@ -302,7 +302,9 @@ void NetServer::processQueue(){
|
||||
config.store.dbgtouch,
|
||||
config.store.dspon,
|
||||
config.store.brightness,
|
||||
config.store.contrast);
|
||||
config.store.contrast,
|
||||
config.store.screensaverEnabled,
|
||||
config.store.screensaverTimeout);
|
||||
break;
|
||||
case GETTIMEZONE: sprintf (wsbuf, "{\"tzh\":%d,\"tzm\":%d,\"sntp1\":\"%s\",\"sntp2\":\"%s\"}",
|
||||
config.store.tzHour,
|
||||
@@ -475,6 +477,23 @@ void NetServer::onWsMessage(void *arg, uint8_t *data, size_t len, uint8_t client
|
||||
display.setContrast();
|
||||
return;
|
||||
}
|
||||
if (strcmp(cmd, "screensaverenabled") == 0) {
|
||||
bool valb = static_cast<bool>(atoi(val));
|
||||
config.saveValue(&config.store.screensaverEnabled, valb);
|
||||
#ifndef DSP_LCD
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (strcmp(cmd, "screensavertimeout") == 0) {
|
||||
uint16_t valb = atoi(val);
|
||||
valb = constrain(valb,0,65520);
|
||||
config.saveValue(&config.store.screensaverTimeout, valb);
|
||||
#ifndef DSP_LCD
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (strcmp(cmd, "tzh") == 0) {
|
||||
int8_t vali = atoi(val);
|
||||
config.saveValue(&config.store.tzHour, vali);
|
||||
|
||||
@@ -49,6 +49,11 @@ void ticks() {
|
||||
network.forceWeather = true;
|
||||
}
|
||||
}
|
||||
#ifndef DSP_LCD
|
||||
if(config.store.screensaverEnabled && display.mode()==PLAYER && !player.isRunning()){
|
||||
if(config.screensaverTicks++ > config.store.screensaverTimeout+SCREENSAVERSTARTUPDELAY) display.putRequest(NEWMODE, SCREENSAVER);
|
||||
}
|
||||
#endif
|
||||
#if RTCSUPPORTED
|
||||
if(config.isRTCFound()){
|
||||
rtc.getTime(&network.timeinfo);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef options_h
|
||||
#define options_h
|
||||
|
||||
#define YOVERSION "0.9.390"
|
||||
#define YOVERSION "0.9.399"
|
||||
|
||||
/*******************************************************
|
||||
DO NOT EDIT THIS FILE.
|
||||
@@ -479,4 +479,7 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
|
||||
#define HOOPSENb 2
|
||||
#endif
|
||||
|
||||
#ifndef SCREENSAVERSTARTUPDELAY
|
||||
#define SCREENSAVERSTARTUPDELAY 5
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -190,6 +190,7 @@ void Player::_play(uint16_t stationId) {
|
||||
config.setDspOn(1);
|
||||
config.vuThreshold = 0;
|
||||
//display.putRequest(PSTOP);
|
||||
config.screensaverTicks=SCREENSAVERSTARTUPDELAY;
|
||||
if(config.getMode()!=PM_SDCARD) {
|
||||
display.putRequest(PSTOP);
|
||||
}
|
||||
@@ -224,6 +225,7 @@ void Player::_play(uint16_t stationId) {
|
||||
config.setSmartStart(1);
|
||||
netserver.requestOnChange(MODE, 0);
|
||||
setOutputPins(true);
|
||||
display.putRequest(NEWMODE, PLAYER);
|
||||
display.putRequest(PSTART);
|
||||
if (player_on_start_play) player_on_start_play();
|
||||
pm.on_start_play();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "display.h"
|
||||
|
||||
#if defined(SD_SPIPINS) || SD_HSPI
|
||||
SPIClass SDSPI(HSPI);
|
||||
SPIClass SDSPI(HOOPSENb);
|
||||
#define SDREALSPI SDSPI
|
||||
#else
|
||||
#define SDREALSPI SPI
|
||||
|
||||
@@ -55,7 +55,7 @@ const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 };
|
||||
const BitrateConfig fullbitrateConf PROGMEM = {{DSP_WIDTH-TFT_FRAMEWDT-38, 59, 2, WA_LEFT}, 42 };
|
||||
|
||||
/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */
|
||||
const VUBandsConfig bandsConf PROGMEM = { 32, 130, 4, 2, 10, 10 };
|
||||
const VUBandsConfig bandsConf PROGMEM = { 32, 130, 4, 2, 10, 3 };
|
||||
|
||||
/* STRINGS */
|
||||
const char numtxtFmt[] PROGMEM = "%d";
|
||||
|
||||
@@ -87,7 +87,7 @@ void DspCore::_clockSeconds(){
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-clockTimeHeight+1);
|
||||
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
|
||||
print(_bufforseconds); /* print seconds */
|
||||
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background);
|
||||
@@ -101,7 +101,7 @@ void DspCore::_clockDate(){
|
||||
dsp.fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
|
||||
setTextColor(config.theme.date, config.theme.background);
|
||||
setCursor(_dateleft, clockTop+10);
|
||||
print(_dateBuf); /* print date */
|
||||
if(!config.isScreensaver) print(_dateBuf); /* print date */
|
||||
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
|
||||
_olddatewidth = _datewidth;
|
||||
_olddateleft = _dateleft;
|
||||
@@ -130,8 +130,8 @@ void DspCore::_clockTime(){
|
||||
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
|
||||
_oldtimewidth = _timewidth;
|
||||
_oldtimeleft = _timeleft;
|
||||
drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
|
||||
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
|
||||
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
|
||||
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
|
||||
_datewidth = strlen(_dateBuf) * CHARWIDTH;
|
||||
@@ -148,6 +148,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
_getTimeBounds();
|
||||
clockRightSpace = (width()-_timewidth-CHARWIDTH*3*2-36)/2;
|
||||
_clockTime();
|
||||
if(!config.isScreensaver)
|
||||
/*if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) */_clockDate();
|
||||
}
|
||||
_clockSeconds();
|
||||
|
||||
@@ -149,7 +149,7 @@ void DspCore::_clockSeconds(){
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*2*2, clockTop-clockTimeHeight+1);
|
||||
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
|
||||
print(_bufforseconds); /* print seconds */
|
||||
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
|
||||
}
|
||||
|
||||
void DspCore::_clockDate(){
|
||||
@@ -157,7 +157,7 @@ void DspCore::_clockDate(){
|
||||
fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
|
||||
setTextColor(config.theme.date, config.theme.background);
|
||||
setCursor(_dateleft, clockTop+10);
|
||||
print(_dateBuf); /* print date */
|
||||
if(!config.isScreensaver) print(_dateBuf); /* print date */
|
||||
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
|
||||
_olddatewidth = _datewidth;
|
||||
_olddateleft = _dateleft;
|
||||
@@ -185,8 +185,8 @@ void DspCore::_clockTime(){
|
||||
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
|
||||
_oldtimewidth = _timewidth;
|
||||
_oldtimeleft = _timeleft;
|
||||
drawFastVLine(width()-clockRightSpace-CHARWIDTH*2*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
drawFastHLine(width()-clockRightSpace-CHARWIDTH*2*2-18, clockTop-clockTimeHeight+21, 32, config.theme.div); /*divider hor*/
|
||||
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*2*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*2*2-18, clockTop-clockTimeHeight+21, 32, config.theme.div); /*divider hor*/
|
||||
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
|
||||
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
|
||||
_datewidth = strlen(_dateBuf) * CHARWIDTH;
|
||||
@@ -201,7 +201,8 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
|
||||
_getTimeBounds();
|
||||
_clockTime();
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
if(!config.isScreensaver)
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
}
|
||||
_clockSeconds();
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ void DspCore::_clockSeconds(){
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-clockTimeHeight+1);
|
||||
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
|
||||
print(_bufforseconds);
|
||||
if(!config.isScreensaver) print(_bufforseconds);
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background);
|
||||
@@ -95,7 +95,7 @@ void DspCore::_clockDate(){
|
||||
dsp.fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
|
||||
setTextColor(config.theme.date, config.theme.background);
|
||||
setCursor(_dateleft, clockTop+10);
|
||||
print(_dateBuf); /* print date */
|
||||
if(!config.isScreensaver) print(_dateBuf); /* print date */
|
||||
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
|
||||
_olddatewidth = _datewidth;
|
||||
_olddateleft = _dateleft;
|
||||
@@ -123,8 +123,8 @@ void DspCore::_clockTime(){
|
||||
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
|
||||
_oldtimewidth = _timewidth;
|
||||
_oldtimeleft = _timeleft;
|
||||
drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
|
||||
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
|
||||
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
|
||||
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
|
||||
_datewidth = strlen(_dateBuf) * CHARWIDTH;
|
||||
@@ -139,7 +139,8 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
|
||||
_getTimeBounds();
|
||||
_clockTime();
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
if(!config.isScreensaver)
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
}
|
||||
_clockSeconds();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void DspCore::_clockSeconds(){
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*4*2, clockTop-clockTimeHeight+1);
|
||||
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
|
||||
print(_bufforseconds); /* print seconds */
|
||||
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI56pt7b);
|
||||
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background);
|
||||
@@ -103,7 +103,7 @@ void DspCore::_clockDate(){
|
||||
setTextColor(config.theme.date, config.theme.background);
|
||||
setCursor(_dateleft, clockTop+15);
|
||||
setTextSize(2);
|
||||
print(_dateBuf); /* print date */
|
||||
if(!config.isScreensaver) print(_dateBuf); /* print date */
|
||||
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
|
||||
_olddatewidth = _datewidth;
|
||||
_olddateleft = _dateleft;
|
||||
@@ -131,8 +131,8 @@ void DspCore::_clockTime(){
|
||||
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
|
||||
_oldtimewidth = _timewidth;
|
||||
_oldtimeleft = _timeleft;
|
||||
drawFastVLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight, clockTimeHeight+4, config.theme.div); /*divider vert*/
|
||||
drawFastHLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight+37, 59, config.theme.div); /*divider hor*/
|
||||
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight, clockTimeHeight+4, config.theme.div); /*divider vert*/
|
||||
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight+37, 59, config.theme.div); /*divider hor*/
|
||||
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
|
||||
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
|
||||
_datewidth = strlen(_dateBuf) * CHARWIDTH*2;
|
||||
@@ -147,7 +147,8 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
|
||||
_getTimeBounds();
|
||||
_clockTime();
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
if(!config.isScreensaver)
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
}
|
||||
_clockSeconds();
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
}
|
||||
|
||||
void DspCore::clearClock(){
|
||||
dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*2+2, clockTimeHeight, config.theme.background);
|
||||
dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*2+2, clockTimeHeight+2, config.theme.background);
|
||||
//dsp.fillRect(_timeleft, clockTop-clockTimeHeight, _timewidth+CHARWIDTH*3*2+24, clockTimeHeight+10+CHARHEIGHT, config.theme.background);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
}
|
||||
|
||||
void DspCore::clearClock(){
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) { }
|
||||
|
||||
@@ -154,7 +154,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
}
|
||||
|
||||
void DspCore::clearClock(){
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) { }
|
||||
|
||||
@@ -165,7 +165,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
}
|
||||
|
||||
void DspCore::clearClock(){
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) { }
|
||||
|
||||
@@ -88,7 +88,7 @@ void DspCore::_clockSeconds(){
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*3*2, clockTop-clockTimeHeight+1);
|
||||
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
|
||||
print(_bufforseconds); /* print seconds */
|
||||
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI42pt7b);
|
||||
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background);
|
||||
@@ -102,7 +102,7 @@ void DspCore::_clockDate(){
|
||||
dsp.fillRect(_olddateleft, clockTop+10, _olddatewidth, CHARHEIGHT, config.theme.background);
|
||||
setTextColor(config.theme.date, config.theme.background);
|
||||
setCursor(_dateleft, clockTop+10);
|
||||
print(_dateBuf); /* print date */
|
||||
if(!config.isScreensaver) print(_dateBuf); /* print date */
|
||||
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
|
||||
_olddatewidth = _datewidth;
|
||||
_olddateleft = _dateleft;
|
||||
@@ -130,8 +130,8 @@ void DspCore::_clockTime(){
|
||||
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
|
||||
_oldtimewidth = _timewidth;
|
||||
_oldtimeleft = _timeleft;
|
||||
drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
|
||||
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight, clockTimeHeight+3, config.theme.div); /*divider vert*/
|
||||
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*3*2-18, clockTop-clockTimeHeight+29, 44, config.theme.div); /*divider hor*/
|
||||
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
|
||||
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
|
||||
_datewidth = strlen(_dateBuf) * CHARWIDTH;
|
||||
@@ -146,7 +146,8 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
|
||||
_getTimeBounds();
|
||||
_clockTime();
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
if(!config.isScreensaver)
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
}
|
||||
_clockSeconds();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void DspCore::_clockSeconds(){
|
||||
setTextColor(config.theme.seconds, config.theme.background);
|
||||
setCursor(width() - 8 - clockRightSpace - CHARWIDTH*4*2, clockTop-clockTimeHeight+1);
|
||||
sprintf(_bufforseconds, "%02d", network.timeinfo.tm_sec);
|
||||
print(_bufforseconds); /* print seconds */
|
||||
if(!config.isScreensaver) print(_bufforseconds); /* print seconds */
|
||||
setTextSize(1);
|
||||
setFont(&DS_DIGI56pt7b);
|
||||
setTextColor((network.timeinfo.tm_sec % 2 == 0) ? config.theme.clock : (CLOCKFONT_MONO?config.theme.clockbg:config.theme.background), config.theme.background);
|
||||
@@ -102,7 +102,7 @@ void DspCore::_clockDate(){
|
||||
setTextColor(config.theme.date, config.theme.background);
|
||||
setCursor(_dateleft, clockTop+15);
|
||||
setTextSize(2);
|
||||
print(_dateBuf); /* print date */
|
||||
if(!config.isScreensaver) print(_dateBuf); /* print date */
|
||||
strlcpy(_oldDateBuf, _dateBuf, sizeof(_dateBuf));
|
||||
_olddatewidth = _datewidth;
|
||||
_olddateleft = _dateleft;
|
||||
@@ -130,8 +130,8 @@ void DspCore::_clockTime(){
|
||||
strlcpy(_oldTimeBuf, _timeBuf, sizeof(_timeBuf));
|
||||
_oldtimewidth = _timewidth;
|
||||
_oldtimeleft = _timeleft;
|
||||
drawFastVLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight, clockTimeHeight+4, config.theme.div); /*divider vert*/
|
||||
drawFastHLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight+37, 59, config.theme.div); /*divider hor*/
|
||||
if(!config.isScreensaver) drawFastVLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight, clockTimeHeight+4, config.theme.div); /*divider vert*/
|
||||
if(!config.isScreensaver) drawFastHLine(width()-clockRightSpace-CHARWIDTH*4*2-18, clockTop-clockTimeHeight+37, 59, config.theme.div); /*divider hor*/
|
||||
sprintf(_buffordate, "%2d %s %d", network.timeinfo.tm_mday,mnths[network.timeinfo.tm_mon], network.timeinfo.tm_year+1900);
|
||||
strlcpy(_dateBuf, utf8Rus(_buffordate, true), sizeof(_dateBuf));
|
||||
_datewidth = strlen(_dateBuf) * CHARWIDTH*2;
|
||||
@@ -146,7 +146,8 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
if(strcmp(_oldTimeBuf, _timeBuf)!=0 || redraw){
|
||||
_getTimeBounds();
|
||||
_clockTime();
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
if(!config.isScreensaver)
|
||||
if(strcmp(_oldDateBuf, _dateBuf)!=0 || redraw) _clockDate();
|
||||
}
|
||||
_clockSeconds();
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void DspCore::printClock(uint16_t top, uint16_t rightspace, uint16_t timeheight,
|
||||
}
|
||||
|
||||
void DspCore::clearClock(){
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
dsp.fillRect(_timeleft, clockTop, _timewidth+14, clockTimeHeight*CHARHEIGHT, config.theme.background);
|
||||
}
|
||||
|
||||
void DspCore::startWrite(void) { }
|
||||
|
||||
Reference in New Issue
Block a user