v0.7.402
This commit is contained in:
@@ -1,29 +1,36 @@
|
||||
/**************************************************************
|
||||
/******************************************************************************************************************
|
||||
|
||||
Example of esp32 deep sleep when playback is stopped.
|
||||
This file must be in the root directory of the sketch.
|
||||
|
||||
**************************************************************/
|
||||
#define SLEEP_DELAY 60 // 1 min
|
||||
#define WAKEUP_PIN_1 GPIO_NUM_12
|
||||
#define WAKEUP_LEVEL LOW
|
||||
*******************************************************************************************************************/
|
||||
#define SLEEP_DELAY 60 /* 1 min deep sleep delay */
|
||||
#define WAKEUP_PIN ENC_BTNB /* wakeup pin (one of: BTN_XXXX, ENC_BTNB, ENC2_BTNB) */
|
||||
/* must be one of: 0,2,4,12,13,14,15,25,26,27,32,33,34,35,36,39 */
|
||||
#define WAKEUP_LEVEL LOW /* wakeup level (usually LOW) */
|
||||
|
||||
#if WAKEUP_PIN!=255
|
||||
Ticker deepSleepTicker;
|
||||
|
||||
void goToSleep(){
|
||||
if(BRIGHTNESS_PIN!=255) analogWrite(BRIGHTNESS_PIN, 0); /* BRIGHTNESS_PIN added in v0.7.330 */
|
||||
esp_deep_sleep_start();
|
||||
if(BRIGHTNESS_PIN!=255) analogWrite(BRIGHTNESS_PIN, 0); /* BRIGHTNESS_PIN added in v0.7.330 */
|
||||
if(display.deepsleep()) { /* if deep sleep is possible */
|
||||
esp_deep_sleep_start(); /* go to sleep */
|
||||
}else{ /* else */
|
||||
deepSleepTicker.detach(); /* detach the timer */
|
||||
}
|
||||
}
|
||||
|
||||
void yoradio_on_setup(){
|
||||
esp_sleep_enable_ext0_wakeup(WAKEUP_PIN_1, WAKEUP_LEVEL);
|
||||
deepSleepTicker.attach(SLEEP_DELAY, goToSleep);
|
||||
void yoradio_on_setup(){ /* occurs during loading */
|
||||
esp_sleep_enable_ext0_wakeup((gpio_num_t)WAKEUP_PIN, WAKEUP_LEVEL); /* enable wakeup pin */
|
||||
deepSleepTicker.attach(SLEEP_DELAY, goToSleep); /* attach to delay */
|
||||
}
|
||||
|
||||
void player_on_start_play(){
|
||||
deepSleepTicker.detach();
|
||||
void player_on_start_play(){ /* occurs during player is start playing */
|
||||
deepSleepTicker.detach(); /* detach the timer */
|
||||
}
|
||||
|
||||
void player_on_stop_play(){
|
||||
deepSleepTicker.attach(SLEEP_DELAY, goToSleep);
|
||||
void player_on_stop_play(){ /* occurs during player is stop playing */
|
||||
deepSleepTicker.attach(SLEEP_DELAY, goToSleep); /* attach to delay */
|
||||
}
|
||||
#endif /* #if WAKEUP_PIN!=255 */
|
||||
|
||||
@@ -157,11 +157,11 @@ void dsp_on_start(DspCore *dsp) {
|
||||
***********************************************/
|
||||
void dsp_on_init() {
|
||||
if (DSP_MODEL == DSP_ST7735 || (DSP_MODEL == DSP_SSD1327)) {
|
||||
hello.init(5, " * ", 1, TFT_LINEHGHT * 4 + 6, 0, ORANGE, TFT_BG);
|
||||
hello.init(5, " * ", 1, TFT_LINEHGHT * 4 + 6, 0, config.theme.weather, config.theme.background);
|
||||
}else if(DSP_MODEL == DSP_ILI9225){
|
||||
hello.init(5, " * ", 1, TFT_LINEHGHT * 6 + 5, 0, ORANGE, TFT_BG);
|
||||
hello.init(5, " * ", 1, TFT_LINEHGHT * 6 + 5, 0, config.theme.weather, config.theme.background);
|
||||
} else {
|
||||
hello.init(5, " * ", 2, TFT_LINEHGHT * 9 + 5, 0, ORANGE, TFT_BG);
|
||||
hello.init(5, " * ", 2, TFT_LINEHGHT * 9 + 5, 0, config.theme.weather, config.theme.background);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ 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);
|
||||
display.centerText(dsp->utf8Rus("Hello from plugin!", true), display.screenheight - TFT_FRAMEWDT * 2 - TFT_LINEHGHT * 2 - 2, 0xF97F, config.theme.background);
|
||||
}
|
||||
return true; // false, if you need to disable the drawing of the clock
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ bool dsp_before_rssi(DspCore *dsp){
|
||||
sprintf(buf, "RSSI:000dBm");
|
||||
dsp->setTextSize(1);
|
||||
dsp->getTextBounds(buf, 0, 0, &x1, &y1, &w, &h);
|
||||
dsp->fillRect(dsp->width() - w - TFT_FRAMEWDT /* left */, vTop /* top */, w /* width */, TFT_LINEHGHT-2 /* height */, TFT_BG /* background color */);
|
||||
dsp->fillRect(dsp->width() - w - TFT_FRAMEWDT /* left */, vTop /* top */, w /* width */, TFT_LINEHGHT-2 /* height */, config.theme.background /* background color */);
|
||||
sprintf(buf, "%dkBits", config.station.bitrate);
|
||||
dsp->getTextBounds(buf, 0, 0, &x1, &y1, &w, &h);
|
||||
if(cnt<2){
|
||||
@@ -25,7 +25,7 @@ bool dsp_before_rssi(DspCore *dsp){
|
||||
}
|
||||
cnt++;
|
||||
if(cnt>3) cnt=0;
|
||||
dsp->setTextColor(SILVER,TFT_BG);
|
||||
dsp->setTextColor(config.theme.rssi,config.theme.background);
|
||||
dsp->setCursor(dsp->width() - w - TFT_FRAMEWDT, vTop);
|
||||
dsp->print(buf); /* print bitrate */
|
||||
return false; /* disable to print RSSI */
|
||||
|
||||
Reference in New Issue
Block a user