This commit is contained in:
e2002
2022-07-07 12:52:47 +03:00
parent 1a857cb6fd
commit 36c24ecdb5
12 changed files with 24 additions and 10 deletions

View File

@@ -295,6 +295,9 @@ Work is in progress...
--- ---
## Version history ## Version history
#### v0.6.400
- fixed compilation errors with esp32 core 2.0.4
#### v0.6.380 #### v0.6.380
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!** **!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!**
- fixed a bug when saving a playlist with special characters in the name and url - fixed a bug when saving a playlist with special characters in the name and url

View File

@@ -25,7 +25,7 @@ Ticker ticker;
***********************************************/ ***********************************************/
Scroll hello; Scroll hello;
char weather[140] = { 0 }; char weather[254] = { 0 };
bool weatherRequest = false; bool weatherRequest = false;
TaskHandle_t weatherUpdateTaskHandle; TaskHandle_t weatherUpdateTaskHandle;

View File

@@ -13,7 +13,7 @@ bool dsp_before_rssi(DspCore *dsp){
char buf[20]; /* buffer for the bitrate string */ char buf[20]; /* buffer for the bitrate string */
uint16_t w, h; /* width & height of the bitrate string */ uint16_t w, h; /* width & height of the bitrate string */
int16_t vTop = dsp->height() - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2; /* vTop - Y cordnate of the bitrate string */; int16_t vTop = dsp->height() - TFT_FRAMEWDT * 2 - TFT_LINEHGHT - 2; /* vTop - Y cordnate of the bitrate string */;
sprintf(buf, "RSSI:000dBm", config.station.bitrate); sprintf(buf, "RSSI:000dBm");
dsp->setTextSize(1); dsp->setTextSize(1);
dsp->getTextBounds(buf, 0, 0, &x1, &y1, &w, &h); 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 */, TFT_BG /* background color */);

View File

@@ -232,7 +232,7 @@ void Config::fillPlMenu(char plmenu[][40], int from, byte count) {
while (playlist.available()) { while (playlist.available()) {
if (parseCSV(playlist.readStringUntil('\n').c_str(), sName, sUrl, sOvol)) { if (parseCSV(playlist.readStringUntil('\n').c_str(), sName, sUrl, sOvol)) {
#ifdef PL_WITH_NUMBERS #ifdef PL_WITH_NUMBERS
char buf[BUFLEN]; char buf[BUFLEN+10];
sprintf(buf, "%d %s", (int)(from+c), sName); sprintf(buf, "%d %s", (int)(from+c), sName);
strlcpy(plmenu[c], buf, 39); strlcpy(plmenu[c], buf, 39);
#else #else
@@ -270,7 +270,7 @@ bool Config::parseCSV(const char* line, char* name, char* url, int &ovol) {
bool Config::parseJSON(const char* line, char* name, char* url, int &ovol) { bool Config::parseJSON(const char* line, char* name, char* url, int &ovol) {
char* tmps, *tmpe; char* tmps, *tmpe;
const char* cursor = line; const char* cursor = line;
char port[8], host[254], file[254]; char port[8], host[246], file[254];
tmps = strstr(cursor, "\":\""); tmps = strstr(cursor, "\":\"");
if (tmps == NULL) return false; if (tmps == NULL) return false;
tmpe = strstr(tmps, "\",\""); tmpe = strstr(tmps, "\",\"");

View File

@@ -401,6 +401,8 @@ void touchLoop() {
} }
break; break;
} }
default:
break;
} }
} }
if (TS_DBG) { if (TS_DBG) {

View File

@@ -543,6 +543,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; if (dsp_before_clock) if (!dsp_before_clock(&dsp, dt)) return;
char timeStringBuff[20] = { 0 }; char timeStringBuff[20] = { 0 };
(void)timeStringBuff;
if (!dt) { if (!dt) {
heap(); heap();
rssi(); rssi();

View File

@@ -270,4 +270,8 @@ static const unsigned char font[] PROGMEM = {
0x7C, 0x10, 0x38, 0x44, 0x38, 0x7C, 0x10, 0x38, 0x44, 0x38,
0x48, 0x34, 0x14, 0x14, 0x7C 0x48, 0x34, 0x14, 0x14, 0x7C
}; };
static inline void avoid_unused_const_variable_compiler_warning(void) {
(void)font;
}
#endif // FONT5X7_H #endif // FONT5X7_H

View File

@@ -19,7 +19,7 @@ void mqttInit() {
mqttClient.onConnect(onMqttConnect); mqttClient.onConnect(onMqttConnect);
mqttClient.onDisconnect(onMqttDisconnect); mqttClient.onDisconnect(onMqttDisconnect);
mqttClient.onMessage(onMqttMessage); mqttClient.onMessage(onMqttMessage);
if(MQTT_USER!="") mqttClient.setCredentials(MQTT_USER, MQTT_PASS); if(strlen(MQTT_USER)>0) mqttClient.setCredentials(MQTT_USER, MQTT_PASS);
mqttClient.setServer(MQTT_HOST, MQTT_PORT); mqttClient.setServer(MQTT_HOST, MQTT_PORT);
connectToMqtt(); connectToMqtt();
} }
@@ -35,7 +35,7 @@ void onMqttConnect(bool sessionPresent) {
void mqttPublishStatus() { void mqttPublishStatus() {
if(mqttClient.connected()){ if(mqttClient.connected()){
char topic[140], status[255]; char topic[140], status[BUFLEN*3];
sprintf(topic, "%s%s", MQTT_ROOT_TOPIC, "status"); sprintf(topic, "%s%s", MQTT_ROOT_TOPIC, "status");
sprintf(status, "{\"status\": %d, \"station\": %d, \"name\": \"%s\", \"title\": \"%s\"}", player.mode==PLAYING?1:0, config.store.lastStation, config.station.name, config.station.title); sprintf(status, "{\"status\": %d, \"station\": %d, \"name\": \"%s\", \"title\": \"%s\"}", player.mode==PLAYING?1:0, config.store.lastStation, config.station.name, config.station.title);
mqttClient.publish(topic, 0, true, status); mqttClient.publish(topic, 0, true, status);
@@ -111,12 +111,13 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
player.setVol(volume, false); player.setVol(volume, false);
return; return;
} }
uint16_t sb; //uint16_t sb;
int sb;
if (sscanf(buf, "play %d", &sb) == 1 ) { if (sscanf(buf, "play %d", &sb) == 1 ) {
if (sb < 1) sb = 1; if (sb < 1) sb = 1;
if (sb >= config.store.countStation) sb = config.store.countStation; if (sb >= config.store.countStation) sb = config.store.countStation;
//player.play(sb); //player.play(sb);
player.request.station = sb; player.request.station = (uint16_t)sb;
player.request.doSave = true; player.request.doSave = true;
return; return;
} }

View File

@@ -1,7 +1,7 @@
#ifndef options_h #ifndef options_h
#define options_h #define options_h
#define VERSION "0.6.380" #define VERSION "0.6.400"
/******************************************************* /*******************************************************
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.

View File

@@ -355,6 +355,7 @@ 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;
(void)volTop;
uint16_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2); uint16_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);
fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG); fillRect(TFT_FRAMEWDT, vTop - 2, vWidth, 6, TFT_BG);
drawRectangle(TFT_FRAMEWDT, vTop - 2, TFT_FRAMEWDT+vWidth, 6+vTop - 2, TFT_LOGO); drawRectangle(TFT_FRAMEWDT, vTop - 2, TFT_FRAMEWDT+vWidth, 6+vTop - 2, TFT_LOGO);

View File

@@ -257,6 +257,7 @@ void DspCore::printClock(struct tm timeinfo, bool dots, bool redraw) {
void DspCore::drawVolumeBar(bool withNumber) { void DspCore::drawVolumeBar(bool withNumber) {
int16_t vTop = sheight - 4; int16_t vTop = sheight - 4;
(void)vTop;
int16_t vWidth = swidth-TFT_FRAMEWDT*2; int16_t vWidth = swidth-TFT_FRAMEWDT*2;
#if DSP_MODEL==DSP_SSD1306 #if DSP_MODEL==DSP_SSD1306
uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2); uint8_t ww = map(config.store.volume, 0, 254, 0, vWidth - 2);

View File

@@ -34,7 +34,8 @@ private:
uint8_t encoderBPin; uint8_t encoderBPin;
long encoderSteps; long encoderSteps;
long _minEncoderValue = -1 << 15; //long _minEncoderValue = -1 << 15;
long _minEncoderValue = -32768;
long _maxEncoderValue = 1 << 15; long _maxEncoderValue = 1 << 15;
uint8_t old_AB; uint8_t old_AB;