BITRATE_FULL_150

This commit is contained in:
e2002
2023-03-30 17:24:30 +03:00
parent 21d93a4816
commit 08b6d3369a
9 changed files with 39 additions and 13 deletions

View File

@@ -11,6 +11,10 @@ void audio_info(const char *info) {
#ifdef USE_NEXTION
nextion.audioinfo(info);
#endif
if (strstr(info, "format is aac") != NULL) config.setBitrateFormat(BF_AAC);
if (strstr(info, "format is flac") != NULL) config.setBitrateFormat(BF_FLAC);
if (strstr(info, "format is mp3") != NULL) config.setBitrateFormat(BF_MP3);
if (strstr(info, "format is wav") != NULL) config.setBitrateFormat(BF_WAV);
if (strstr(info, "skip metadata") != NULL) config.setTitle(config.station.name);
if (strstr(info, "Account already in use") != NULL || strstr(info, "HTTP/1.0 401") != NULL) {
player.setError(info);

View File

@@ -36,6 +36,7 @@
#define MAX_PLAY_MODE 1
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 };
void u8fix(char *src);
@@ -152,6 +153,7 @@ class Config {
uint8_t irchck;
ircodes_t ircodes;
#endif
BitrateFormat configFmt = BF_UNCNOWN;
neworkItem ssids[5];
byte ssidsCount;
uint16_t sleepfor;
@@ -185,6 +187,7 @@ class Config {
bool saveWifi();
bool saveWifiFromNextion(const char* post);
void setSmartStart(byte ss);
void setBitrateFormat(BitrateFormat fmt) { configFmt = fmt; }
void initPlaylist();
void indexPlaylist();
uint8_t fillPlMenu(int from, uint8_t count, bool fromNextion=false);

View File

@@ -24,7 +24,10 @@ Page *pages[] = { new Page(), new Page(), new Page() };
#ifndef DSP_TASK_DELAY
#define DSP_TASK_DELAY 2
#endif
#if !((DSP_MODEL==DSP_ST7735 && DTYPE==INITR_BLACKTAB) || DSP_MODEL==DSP_ST7789)
#undef BITRATE_FULL
#define BITRATE_FULL false
#endif
TaskHandle_t DspTask;
QueueHandle_t displayQueue;
@@ -137,7 +140,7 @@ void Display::_buildPager(){
pages[PG_PLAYER]->addWidget(&_title1);
if(_title2) pages[PG_PLAYER]->addWidget(_title2);
if(_weather) pages[PG_PLAYER]->addWidget(_weather);
#ifdef BITRATE_FULL
#if BITRATE_FULL
_fullbitrate = new BitrateWidget(fullbitrateConf, config.theme.bitrate, config.theme.background);
pages[PG_PLAYER]->addWidget( _fullbitrate);
#else
@@ -380,7 +383,7 @@ void Display::loop() {
if(_bitrate) { _bitrate->setText(config.station.bitrate==0?"":buf); }
if(_fullbitrate) {
_fullbitrate->setBitrate(config.station.bitrate);
_fullbitrate->setFormat(BF_MP3);
_fullbitrate->setFormat(config.configFmt);
}
}
break;

View File

@@ -1,7 +1,7 @@
#ifndef options_h
#define options_h
#define YOVERSION "0.9.143"
#define YOVERSION "0.9.150"
/*******************************************************
DO NOT EDIT THIS FILE.
@@ -305,6 +305,9 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef MAX_AUDIO_SOCKET_TIMEOUT
#define MAX_AUDIO_SOCKET_TIMEOUT false // max audio socket timeout?
#endif
#ifndef BITRATE_FULL
#define BITRATE_FULL false
#endif
/*
*** ST7735 display submodel ***
INITR_BLACKTAB // 1.8' https://aliexpress.ru/item/1005002822797745.html

View File

@@ -94,6 +94,7 @@ void Player::_stop(bool alreadyStopped){
setOutputPins(false);
if(!hasError()) config.setTitle((display.mode()==LOST || display.mode()==UPDATING)?"":const_PlStopped);
config.station.bitrate = 0;
config.setBitrateFormat(BF_UNCNOWN);
#ifdef USE_NEXTION
nextion.bitrate(config.station.bitrate);
#endif
@@ -172,8 +173,10 @@ void Player::_play(uint16_t stationId) {
setOutputPins(false);
config.setTitle(config.store.play_mode==PM_WEB?const_PlConnect:"");
config.station.bitrate=0;
config.setBitrateFormat(BF_UNCNOWN);
config.loadStation(stationId);
_loadVol(config.store.volume);
display.putRequest(DBITRATE);
display.putRequest(NEWSTATION);
netserver.requestOnChange(STATION, 0);
netserver.loop();

View File

@@ -10,13 +10,17 @@
#define DSP_WIDTH 160
#define TFT_FRAMEWDT 4
#define MAX_WIDTH DSP_WIDTH-TFT_FRAMEWDT*2
#if BITRATE_FULL
#define TITLE_FIX 24
#else
#define TITLE_FIX 0
#endif
#define bootLogoTop 68
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 30 };
const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 26, 1, WA_LEFT }, 140, true, MAX_WIDTH-24, 5000, 3, 30 };
const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 36, 1, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 3, 30 };
const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 36, 1, WA_LEFT }, 140, true, MAX_WIDTH-TITLE_FIX, 5000, 3, 30 };
const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 56, 1, WA_LEFT }, 140, true, MAX_WIDTH, 1000, 4, 30 };
const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 2, WA_CENTER }, 140, false, MAX_WIDTH, 0, 4, 30 };
const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 128-TFT_FRAMEWDT-8, 1, WA_LEFT }, 140, false, MAX_WIDTH, 0, 3, 30 };

View File

@@ -15,12 +15,17 @@
//#define PLMITEMLENGHT 40
//#define PLMITEMHEIGHT 22
#if BITRATE_FULL
#define TITLE_FIX 44
#else
#define TITLE_FIX 0
#endif
#define bootLogoTop 68
/* SROLLS */ /* {{ left, top, fontsize, align }, buffsize, uppercase, width, scrolldelay, scrolldelta, scrolltime } */
const ScrollConfig metaConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 3, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 5, 30 };
const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 50, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 4, 30 };
const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 70, 2, WA_LEFT }, 140, true, MAX_WIDTH, 5000, 4, 30 };
const ScrollConfig title1Conf PROGMEM = {{ TFT_FRAMEWDT, 48, 2, WA_LEFT }, 140, true, MAX_WIDTH-TITLE_FIX, 5000, 4, 30 };
const ScrollConfig title2Conf PROGMEM = {{ TFT_FRAMEWDT, 72, 2, WA_LEFT }, 140, true, MAX_WIDTH-TITLE_FIX, 5000, 4, 30 };
const ScrollConfig playlistConf PROGMEM = {{ TFT_FRAMEWDT, 112, 2, WA_LEFT }, 140, true, MAX_WIDTH, 1000, 2, 30 };
const ScrollConfig apTitleConf PROGMEM = {{ TFT_FRAMEWDT, TFT_FRAMEWDT, 3, WA_CENTER }, 140, false, MAX_WIDTH, 0, 4, 20 };
const ScrollConfig apSettConf PROGMEM = {{ TFT_FRAMEWDT, 240-TFT_FRAMEWDT-16, 2, WA_LEFT }, 140, false, MAX_WIDTH, 0, 4, 30 };
@@ -49,6 +54,7 @@ const WidgetConfig vuConf PROGMEM = { TFT_FRAMEWDT, 100, 1, WA_LEFT };
const WidgetConfig bootWdtConf PROGMEM = { 0, 162, 1, WA_CENTER };
const ProgressConfig bootPrgConf PROGMEM = { 90, 14, 4 };
const BitrateConfig fullbitrateConf PROGMEM = {{DSP_WIDTH-TFT_FRAMEWDT-34, 43, 2, WA_LEFT}, 42 };
/* BANDS */ /* { onebandwidth, onebandheight, bandsHspace, bandsVspace, numofbands, fadespeed } */
const VUBandsConfig bandsConf PROGMEM = { 24, 100, 4, 2, 10, 2 };
@@ -61,7 +67,7 @@ const char voltxtFmt[] PROGMEM = "\023\025%d";
const char bitrateFmt[] PROGMEM = "%d kBs";
/* MOVES */ /* { left, top, width } */
const MoveConfig clockMove PROGMEM = { 0, 176, -1 };
const MoveConfig clockMove PROGMEM = { 8, 180, -1 };
const MoveConfig weatherMove PROGMEM = { 8, 97, MAX_WIDTH };
const MoveConfig weatherMoveVU PROGMEM = { 70, 97, 250 };

View File

@@ -484,10 +484,10 @@ void BitrateWidget::_draw(){
dsp.setTextSize(_config.textsize);
dsp.setTextColor(_fgcolor, _bgcolor);
snprintf(_buf, 6, "%d", _bitrate);
dsp.setCursor(_config.left + _dimension/2 - _charWidth*strlen(_buf)/2, _config.top + _dimension/4 - _textheight/2+1);
dsp.setCursor(_config.left + _dimension/2 - _charWidth*strlen(_buf)/2 + 1, _config.top + _dimension/4 - _textheight/2+1);
dsp.print(_buf);
dsp.setTextColor(_bgcolor, _fgcolor);
dsp.setCursor(_config.left + _dimension/2 - _charWidth*3/2, _config.top + _dimension - _dimension/4 - _textheight/2);
dsp.setCursor(_config.left + _dimension/2 - _charWidth*3/2 + 1, _config.top + _dimension - _dimension/4 - _textheight/2);
switch(_format){
case BF_MP3: dsp.print("MP3"); break;
case BF_AAC: dsp.print("AAC"); break;

View File

@@ -2,9 +2,9 @@
#define widgets_h
#include "Arduino.h"
//#include "../../core/config.h"
#include "../../core/config.h"
enum WidgetAlign { WA_LEFT, WA_CENTER, WA_RIGHT };
enum BitrateFormat { BF_UNCNOWN, BF_MP3, BF_AAC, BF_FLAC, BF_OGG, BF_WAV };
typedef struct clipArea {
uint16_t left;