rssi_graph

This commit is contained in:
e2002
2023-03-01 12:57:12 +03:00
parent 357ac2ec3a
commit c806f33df4
15 changed files with 62 additions and 27 deletions

View File

@@ -212,7 +212,7 @@ void Display::_start() {
if(_weather && config.store.showweather) _weather->setText(const_getWeather);
if(_vuwidget) _vuwidget->lock();
if(_rssi) _rssi->setText(WiFi.RSSI(), rssiFmt);
if(_rssi) _setRSSI(WiFi.RSSI());
#ifndef HIDE_IP
if(_volip) _volip->setText(WiFi.localIP().toString().c_str(), iptxtFmt);
#endif
@@ -408,7 +408,7 @@ void Display::loop() {
#endif*/
break;
}
case DSPRSSI: if(_rssi){ _rssi->setText(request.payload, rssiFmt); } if (_heapbar && config.store.audioinfo) _heapbar->setValue(player.inBufferFilled()); break;
case DSPRSSI: if(_rssi){ _setRSSI(request.payload); } if (_heapbar && config.store.audioinfo) _heapbar->setValue(player.inBufferFilled()); break;
case PSTART: _layoutChange(true); break;
case PSTOP: _layoutChange(false); break;
case DSP_START: _start(); break;
@@ -418,6 +418,21 @@ void Display::loop() {
dsp.loop();
}
void Display::_setRSSI(int rssi) {
if(!_rssi) return;
#if RSSI_DIGIT
_rssi->setText(rssi, rssiFmt);
return;
#endif
char rssiG[3];
if(rssi >= -50) strlcpy(rssiG, "\004\006", 3);
if(rssi >= -60 && rssi < -50) strlcpy(rssiG, "\004\005", 3);
if(rssi >= -70 && rssi < -60) strlcpy(rssiG, "\004\002", 3);
if(rssi >= -80 && rssi < -70) strlcpy(rssiG, "\003\002", 3);
if(rssi < -80 || rssi >= 0) strlcpy(rssiG, "\001\002", 3);
_rssi->setText(rssiG);
}
void Display::_station() {
_meta.setAlign(metaConf.widget.align);
_meta.setText(config.station.name);

View File

@@ -78,6 +78,7 @@ class Display {
void _bootScreen();
void _setReturnTicker(uint8_t time_s);
void _layoutChange(bool played);
void _setRSSI(int rssi);
};
#else

View File

@@ -259,7 +259,7 @@ bool getWeather(char *wstr) {
if (tmpe == NULL) { Serial.println("## OPENWEATHERMAP ###: feels_like not found !"); return false;}
strlcpy(temp, tmps, tmpe - tmps + 1);
cursor = tmpe + 2;
float tempfl = atof(temp);
float tempfl = atof(temp); (void)tempfl;
tmps = strstr(cursor, "humidity\":");
if (tmps == NULL) { Serial.println("## OPENWEATHERMAP ###: humidity not found !"); return false;}
@@ -285,7 +285,7 @@ bool getWeather(char *wstr) {
if (tmpe == NULL) { Serial.println("## OPENWEATHERMAP ###: wind speed not found !"); return false;}
strlcpy(temp, tmps, tmpe - tmps + 1);
cursor = tmpe + 1;
float wind_speed = atof(temp);
float wind_speed = atof(temp); (void)wind_speed;
tmps = strstr(cursor, "\"deg\":");
if (tmps == NULL) { Serial.println("## OPENWEATHERMAP ###: wind deg not found !"); return false;}
@@ -323,7 +323,11 @@ bool getWeather(char *wstr) {
#ifdef WEATHER_FMT_SHORT
sprintf(wstr, weatherFmt, tempf, pressi, hum);
#else
sprintf(wstr, weatherFmt, desc, tempf, tempfl, pressi, hum, wind[wind_deg], wind_speed);
#if EXT_WEATHER
sprintf(wstr, weatherFmt, desc, tempf, tempfl, pressi, hum, wind[wind_deg], wind_speed);
#else
sprintf(wstr, weatherFmt, desc, tempf, pressi, hum);
#endif
#endif
network.requestWeatherSync();
return true;

View File

@@ -1,7 +1,7 @@
#ifndef options_h
#define options_h
#define YOVERSION "0.8.979"
#define YOVERSION "0.8.981"
/*******************************************************
DO NOT EDIT THIS FILE.
@@ -285,6 +285,12 @@ The connection tables are located here https://github.com/e2002/yoradio#connecti
#ifndef DSP_INVERT_TITLE
#define DSP_INVERT_TITLE true // Invert title colors for displays ?
#endif
#ifndef EXT_WEATHER
#define EXT_WEATHER true // Extended weather
#endif
#ifndef RSSI_DIGIT
#define RSSI_DIGIT false // Extended weather
#endif
/*
*** ST7735 display submodel ***
INITR_BLACKTAB // 1.8' https://aliexpress.ru/item/1005002822797745.html