mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-10 22:51:36 +02:00
0.8.94
* switched AsyncWebServer library * Ethernet version now uses same AsyncWebServer library as Wifi version * fix languange of `/history` * fix RSSI on `/history` #1463
This commit is contained in:
parent
3d2ed81adf
commit
0499d32c12
11 changed files with 99 additions and 205 deletions
|
@ -1,26 +1,26 @@
|
||||||
diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp
|
diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp
|
||||||
index 12be5f8..cffeed7 100644
|
index 6e88da9..09359c3 100644
|
||||||
--- a/src/AsyncWebSocket.cpp
|
--- a/src/AsyncWebSocket.cpp
|
||||||
+++ b/src/AsyncWebSocket.cpp
|
+++ b/src/AsyncWebSocket.cpp
|
||||||
@@ -737,7 +737,7 @@ void AsyncWebSocketClient::binary(const __FlashStringHelper *data, size_t len)
|
@@ -827,7 +827,7 @@ void AsyncWebSocketClient::binary(AsyncWebSocketMessageBuffer * buffer)
|
||||||
IPAddress AsyncWebSocketClient::remoteIP() const
|
|
||||||
{
|
|
||||||
if (!_client)
|
|
||||||
- return IPAddress(0U);
|
|
||||||
+ return IPAddress();
|
|
||||||
|
|
||||||
|
IPAddress AsyncWebSocketClient::remoteIP() {
|
||||||
|
if(!_client) {
|
||||||
|
- return IPAddress((uint32_t)0);
|
||||||
|
+ return IPAddress();
|
||||||
|
}
|
||||||
return _client->remoteIP();
|
return _client->remoteIP();
|
||||||
}
|
}
|
||||||
diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp
|
diff --git a/src/WebResponses.cpp b/src/WebResponses.cpp
|
||||||
index 22a549f..e0b36b3 100644
|
index a22e991..babef18 100644
|
||||||
--- a/src/WebResponses.cpp
|
--- a/src/WebResponses.cpp
|
||||||
+++ b/src/WebResponses.cpp
|
+++ b/src/WebResponses.cpp
|
||||||
@@ -318,7 +318,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
|
@@ -317,7 +317,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
|
||||||
free(buf);
|
free(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
- outLen = sprintf_P((char*)buf+headLen, PSTR("%x"), readLen) + headLen;
|
- outLen = sprintf((char*)buf+headLen, "%x", readLen) + headLen;
|
||||||
+ outLen = sprintf_P((char*)buf+headLen, PSTR("%04x"), readLen) + headLen;
|
+ outLen = sprintf((char*)buf+headLen, "%04x", readLen) + headLen;
|
||||||
while(outLen < headLen + 4) buf[outLen++] = ' ';
|
while(outLen < headLen + 4) buf[outLen++] = ' ';
|
||||||
buf[outLen++] = '\r';
|
buf[outLen++] = '\r';
|
||||||
buf[outLen++] = '\n';
|
buf[outLen++] = '\n';
|
||||||
|
|
|
@ -26,9 +26,10 @@ def applyPatch(libName, patchFile):
|
||||||
|
|
||||||
|
|
||||||
# list of patches to apply (relative to /src)
|
# list of patches to apply (relative to /src)
|
||||||
if env['PIOENV'][:22] != "opendtufusion-ethernet":
|
applyPatch("ESPAsyncWebServer-esphome", "../patches/AsyncWeb_Prometheus.patch")
|
||||||
applyPatch("ESP Async WebServer", "../patches/AsyncWeb_Prometheus.patch")
|
|
||||||
|
|
||||||
if env['PIOENV'][:13] == "opendtufusion":
|
if env['PIOENV'][:13] == "opendtufusion":
|
||||||
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
|
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
|
||||||
|
|
||||||
|
if (env['PIOENV'][:13] == "opendtufusion"): # or (env['PIOENV'][:13] == "esp32-wroom32"):
|
||||||
applyPatch("RF24", "../patches/RF24_Hal.patch")
|
applyPatch("RF24", "../patches/RF24_Hal.patch")
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
|
## 0.8.94 - 2024-03-16
|
||||||
|
* switched AsyncWebServer library
|
||||||
|
* Ethernet version now uses same AsyncWebServer library as Wifi version
|
||||||
|
* fix languange of `/history`
|
||||||
|
* fix RSSI on `/history` #1463
|
||||||
|
|
||||||
## 0.8.93 - 2024-03-14
|
## 0.8.93 - 2024-03-14
|
||||||
* improved history graph in WebUI #1491
|
* improved history graph in WebUI #1491
|
||||||
* merge PR: 1491
|
* merge PR: 1491
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_PATCH 93
|
#define VERSION_PATCH 94
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -31,12 +31,7 @@ void ahoyeth::setup(settings_t *config, uint32_t *utcTimestamp, OnNetworkCB onNe
|
||||||
WiFi.onEvent([this](WiFiEvent_t event, arduino_event_info_t info) -> void { this->onEthernetEvent(event, info); });
|
WiFi.onEvent([this](WiFiEvent_t event, arduino_event_info_t info) -> void { this->onEthernetEvent(event, info); });
|
||||||
|
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
//#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
|
||||||
mEthSpi.begin(DEF_ETH_MISO_PIN, DEF_ETH_MOSI_PIN, DEF_ETH_SCK_PIN, DEF_ETH_CS_PIN, DEF_ETH_IRQ_PIN, DEF_ETH_RST_PIN);
|
mEthSpi.begin(DEF_ETH_MISO_PIN, DEF_ETH_MOSI_PIN, DEF_ETH_SCK_PIN, DEF_ETH_CS_PIN, DEF_ETH_IRQ_PIN, DEF_ETH_RST_PIN);
|
||||||
//#else
|
|
||||||
//ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
|
|
||||||
//ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, DEF_ETH_MOSI_PIN, ETH_PHY_TYPE, ETH_CLK_MODE);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
if(mConfig->sys.ip.ip[0] != 0) {
|
if(mConfig->sys.ip.ip[0] != 0) {
|
||||||
IPAddress ip(mConfig->sys.ip.ip);
|
IPAddress ip(mConfig->sys.ip.ip);
|
||||||
|
@ -52,11 +47,6 @@ void ahoyeth::setup(settings_t *config, uint32_t *utcTimestamp, OnNetworkCB onNe
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool ahoyeth::updateNtpTime(void) {
|
bool ahoyeth::updateNtpTime(void) {
|
||||||
DPRINTLN(DBG_DEBUG, F(__FUNCTION__)); Serial.flush();
|
|
||||||
Serial.printf("ETH.linkUp()=%s\n", ETH.linkUp() ? "up" : "down");
|
|
||||||
Serial.print("ETH.localIP()=");
|
|
||||||
Serial.println(ETH.localIP());
|
|
||||||
Serial.printf("Go on? %s\n", (!ETH.localIP()) ? "No..." : "Yes...");
|
|
||||||
if (!ETH.localIP())
|
if (!ETH.localIP())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -134,137 +124,55 @@ void ahoyeth::welcome(String ip, String mode) {
|
||||||
void ahoyeth::onEthernetEvent(WiFiEvent_t event, arduino_event_info_t info) {
|
void ahoyeth::onEthernetEvent(WiFiEvent_t event, arduino_event_info_t info) {
|
||||||
DPRINTLN(DBG_VERBOSE, F("[ETH]: Got event..."));
|
DPRINTLN(DBG_VERBOSE, F("[ETH]: Got event..."));
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#if ( ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) && ( ARDUINO_ESP32_GIT_VER != 0x46d5afb1 ) )
|
case ARDUINO_EVENT_ETH_START:
|
||||||
// For breaking core v2.0.0
|
DPRINTLN(DBG_VERBOSE, F("ETH Started"));
|
||||||
// Why so strange to define a breaking enum arduino_event_id_t in WiFiGeneric.h
|
|
||||||
// compared to the old system_event_id_t, now in tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h
|
|
||||||
// You can preserve the old enum order and just adding new items to do no harm
|
|
||||||
case ARDUINO_EVENT_ETH_START:
|
|
||||||
DPRINTLN(DBG_INFO, F("\nETH Started"));
|
|
||||||
//set eth hostname here
|
|
||||||
if(String(mConfig->sys.deviceName) != "")
|
|
||||||
ETH.setHostname(mConfig->sys.deviceName);
|
|
||||||
else
|
|
||||||
ETH.setHostname("ESP32_W5500");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
if(String(mConfig->sys.deviceName) != "")
|
||||||
DPRINTLN(DBG_INFO, F("ETH Connected"));
|
ETH.setHostname(mConfig->sys.deviceName);
|
||||||
break;
|
else
|
||||||
|
ETH.setHostname(F("ESP32_W5500"));
|
||||||
|
break;
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_GOT_IP:
|
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||||
if (!mEthConnected) {
|
DPRINTLN(DBG_VERBOSE, F("ETH Connected"));
|
||||||
DPRINT(DBG_INFO, F("ETH MAC: "));
|
break;
|
||||||
#if defined (CONFIG_IDF_TARGET_ESP32S3)
|
|
||||||
DBGPRINT(mEthSpi.macAddress());
|
|
||||||
#else
|
|
||||||
DBGPRINT(ETH.macAddress());
|
|
||||||
#endif
|
|
||||||
DBGPRINT(F(", IPv4: "));
|
|
||||||
DBGPRINTLN(String(ETH.localIP()));
|
|
||||||
|
|
||||||
if (ETH.fullDuplex()) {
|
case ARDUINO_EVENT_ETH_GOT_IP:
|
||||||
DPRINTLN(DBG_INFO, F("FULL_DUPLEX, "));
|
if (!mEthConnected) {
|
||||||
} else {
|
/*DPRINT(DBG_INFO, F("ETH MAC: "));
|
||||||
DPRINTLN(DBG_INFO, F("HALF_DUPLEX, "));
|
DBGPRINT(mEthSpi.macAddress());*/
|
||||||
|
welcome(ETH.localIP().toString(), F(" (Station)"));
|
||||||
|
|
||||||
|
mEthConnected = true;
|
||||||
|
mOnNetworkCB(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT(DBG_INFO, String(ETH.linkSpeed()));
|
if (!MDNS.begin(mConfig->sys.deviceName)) {
|
||||||
DBGPRINTLN(F("Mbps"));
|
DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!"));
|
||||||
|
|
||||||
mEthConnected = true;
|
|
||||||
mOnNetworkCB(true);
|
|
||||||
}
|
|
||||||
if (!MDNS.begin(mConfig->sys.deviceName)) {
|
|
||||||
DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!"));
|
|
||||||
} else {
|
|
||||||
DBGPRINT(F("[WiFi] mDNS established: "));
|
|
||||||
DBGPRINT(mConfig->sys.deviceName);
|
|
||||||
DBGPRINTLN(F(".local"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
|
||||||
DPRINTLN(DBG_INFO, "ETH Disconnected");
|
|
||||||
mEthConnected = false;
|
|
||||||
mUdp.close();
|
|
||||||
mOnNetworkCB(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_STOP:
|
|
||||||
DPRINTLN(DBG_INFO, "\nETH Stopped");
|
|
||||||
mEthConnected = false;
|
|
||||||
mUdp.close();
|
|
||||||
mOnNetworkCB(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// For old core v1.0.6-
|
|
||||||
// Core v2.0.0 defines a stupid enum arduino_event_id_t, breaking any code for ESP32_W5500 written for previous core
|
|
||||||
// Why so strange to define a breaking enum arduino_event_id_t in WiFiGeneric.h
|
|
||||||
// compared to the old system_event_id_t, now in tools/sdk/esp32/include/esp_event/include/esp_event_legacy.h
|
|
||||||
// You can preserve the old enum order and just adding new items to do no harm
|
|
||||||
case SYSTEM_EVENT_ETH_START:
|
|
||||||
DPRINTLN(DBG_INFO, F("\nETH Started"));
|
|
||||||
//set eth hostname here
|
|
||||||
if(String(mConfig->sys.deviceName) != "")
|
|
||||||
ETH.setHostname(mConfig->sys.deviceName);
|
|
||||||
else
|
|
||||||
ETH.setHostname("ESP32_W5500");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_EVENT_ETH_CONNECTED:
|
|
||||||
DPRINTLN(DBG_INFO, F("ETH Connected"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_EVENT_ETH_GOT_IP:
|
|
||||||
if (!ESP32_W5500_eth_connected) {
|
|
||||||
DPRINT(DBG_INFO, F("ETH MAC: "));
|
|
||||||
DBGPRINT(ETH.macAddress());
|
|
||||||
DBGPRINT(F(", IPv4: "));
|
|
||||||
DBGPRINTLN(ETH.localIP());
|
|
||||||
|
|
||||||
if (ETH.fullDuplex()) {
|
|
||||||
DPRINTLN(DBG_INFO, F("FULL_DUPLEX, "));
|
|
||||||
} else {
|
} else {
|
||||||
DPRINTLN(DBG_INFO, F("HALF_DUPLEX, "));
|
DBGPRINT(F("mDNS established: "));
|
||||||
|
DBGPRINT(mConfig->sys.deviceName);
|
||||||
|
DBGPRINTLN(F(".local"));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
DPRINT(DBG_INFO, ETH.linkSpeed());
|
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||||
DBGPRINTLN(F("Mbps"));
|
DPRINTLN(DBG_INFO, F("ETH Disconnected"));
|
||||||
|
mEthConnected = false;
|
||||||
|
mUdp.close();
|
||||||
|
mOnNetworkCB(false);
|
||||||
|
break;
|
||||||
|
|
||||||
ESP32_W5500_eth_connected = true;
|
case ARDUINO_EVENT_ETH_STOP:
|
||||||
mOnNetworkCB(true);
|
DPRINTLN(DBG_INFO, F("ETH Stopped"));
|
||||||
}
|
mEthConnected = false;
|
||||||
if (!MDNS.begin(mConfig->sys.deviceName)) {
|
mUdp.close();
|
||||||
DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!"));
|
mOnNetworkCB(false);
|
||||||
} else {
|
break;
|
||||||
DBGPRINT(F("[WiFi] mDNS established: "));
|
|
||||||
DBGPRINT(mConfig->sys.deviceName);
|
|
||||||
DBGPRINTLN(F(".local"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_EVENT_ETH_DISCONNECTED:
|
default:
|
||||||
DPRINT(DBG_INFO, F("ETH Disconnected"));
|
break;
|
||||||
ESP32_W5500_eth_connected = false;
|
}
|
||||||
mUdp.close();
|
|
||||||
mOnNetworkCB(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYSTEM_EVENT_ETH_STOP:
|
|
||||||
DPRINT(DBG_INFO, F("ETH Stopped"));
|
|
||||||
ESP32_W5500_eth_connected = false;
|
|
||||||
mUdp.close();
|
|
||||||
mOnNetworkCB(false);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ extra_scripts =
|
||||||
pre:../scripts/reduceGxEPD2.py
|
pre:../scripts/reduceGxEPD2.py
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/yubox-node-org/ESPAsyncWebServer
|
https://github.com/esphome/ESPAsyncWebServer @ ^3.1.0
|
||||||
https://github.com/nRF24/RF24 @ 1.4.8
|
https://github.com/nRF24/RF24 @ 1.4.8
|
||||||
paulstoffregen/Time @ ^1.6.1
|
paulstoffregen/Time @ ^1.6.1
|
||||||
https://github.com/bertmelis/espMqttClient#v1.6.0
|
https://github.com/bertmelis/espMqttClient#v1.6.0
|
||||||
|
@ -216,7 +216,7 @@ monitor_filters =
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-D ETHERNET
|
-DETHERNET
|
||||||
-DRELEASE
|
-DRELEASE
|
||||||
-DUSE_HSPI_FOR_EPD
|
-DUSE_HSPI_FOR_EPD
|
||||||
-DENABLE_MQTT
|
-DENABLE_MQTT
|
||||||
|
@ -241,7 +241,7 @@ monitor_filters =
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-D ETHERNET
|
-DETHERNET
|
||||||
-DRELEASE
|
-DRELEASE
|
||||||
-DUSE_HSPI_FOR_EPD
|
-DUSE_HSPI_FOR_EPD
|
||||||
-DLANG_DE
|
-DLANG_DE
|
||||||
|
@ -436,16 +436,16 @@ monitor_filters =
|
||||||
[env:opendtufusion-ethernet]
|
[env:opendtufusion-ethernet]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.5.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
lib_deps =
|
#lib_deps =
|
||||||
khoih-prog/AsyncWebServer_ESP32_W5500
|
# khoih-prog/AsyncWebServer_ESP32_W5500
|
||||||
khoih-prog/AsyncUDP_ESP32_W5500
|
# khoih-prog/AsyncUDP_ESP32_W5500
|
||||||
https://github.com/nrf24/RF24 @ ^1.4.8
|
# https://github.com/nrf24/RF24 @ ^1.4.8
|
||||||
paulstoffregen/Time @ ^1.6.1
|
# paulstoffregen/Time @ ^1.6.1
|
||||||
https://github.com/bertmelis/espMqttClient#v1.6.0
|
# https://github.com/bertmelis/espMqttClient#v1.6.0
|
||||||
bblanchon/ArduinoJson @ ^6.21.3
|
# bblanchon/ArduinoJson @ ^6.21.3
|
||||||
https://github.com/JChristensen/Timezone @ ^1.2.4
|
# https://github.com/JChristensen/Timezone @ ^1.2.4
|
||||||
olikraus/U8g2 @ ^2.35.9
|
# olikraus/U8g2 @ ^2.35.9
|
||||||
https://github.com/zinggjm/GxEPD2#1.5.3
|
# https://github.com/zinggjm/GxEPD2#1.5.3
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DETHERNET
|
-DETHERNET
|
||||||
|
@ -481,16 +481,16 @@ monitor_filters =
|
||||||
[env:opendtufusion-ethernet-de]
|
[env:opendtufusion-ethernet-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.5.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
lib_deps =
|
#lib_deps =
|
||||||
khoih-prog/AsyncWebServer_ESP32_W5500
|
# khoih-prog/AsyncWebServer_ESP32_W5500
|
||||||
khoih-prog/AsyncUDP_ESP32_W5500
|
# khoih-prog/AsyncUDP_ESP32_W5500
|
||||||
https://github.com/nrf24/RF24 @ ^1.4.8
|
# https://github.com/nrf24/RF24 @ ^1.4.8
|
||||||
paulstoffregen/Time @ ^1.6.1
|
# paulstoffregen/Time @ ^1.6.1
|
||||||
https://github.com/bertmelis/espMqttClient#v1.6.0
|
# https://github.com/bertmelis/espMqttClient#v1.6.0
|
||||||
bblanchon/ArduinoJson @ ^6.21.3
|
# bblanchon/ArduinoJson @ ^6.21.3
|
||||||
https://github.com/JChristensen/Timezone @ ^1.2.4
|
# https://github.com/JChristensen/Timezone @ ^1.2.4
|
||||||
olikraus/U8g2 @ ^2.35.9
|
# olikraus/U8g2 @ ^2.35.9
|
||||||
https://github.com/zinggjm/GxEPD2#1.5.3
|
# https://github.com/zinggjm/GxEPD2#1.5.3
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DETHERNET
|
-DETHERNET
|
||||||
|
|
|
@ -350,8 +350,9 @@ class RestApi {
|
||||||
|
|
||||||
void getGeneric(AsyncWebServerRequest *request, JsonObject obj) {
|
void getGeneric(AsyncWebServerRequest *request, JsonObject obj) {
|
||||||
mApp->resetLockTimeout();
|
mApp->resetLockTimeout();
|
||||||
|
#if !defined(ETHERNET)
|
||||||
obj[F("wifi_rssi")] = (WiFi.status() != WL_CONNECTED) ? 0 : WiFi.RSSI();
|
obj[F("wifi_rssi")] = (WiFi.status() != WL_CONNECTED) ? 0 : WiFi.RSSI();
|
||||||
|
#endif
|
||||||
obj[F("ts_uptime")] = mApp->getUptime();
|
obj[F("ts_uptime")] = mApp->getUptime();
|
||||||
obj[F("ts_now")] = mApp->getTimestamp();
|
obj[F("ts_now")] = mApp->getTimestamp();
|
||||||
obj[F("version")] = String(mApp->getVersion());
|
obj[F("version")] = String(mApp->getVersion());
|
||||||
|
@ -378,12 +379,13 @@ class RestApi {
|
||||||
obj[F("ssid")] = mConfig->sys.stationSsid;
|
obj[F("ssid")] = mConfig->sys.stationSsid;
|
||||||
obj[F("ap_pwd")] = mConfig->sys.apPwd;
|
obj[F("ap_pwd")] = mConfig->sys.apPwd;
|
||||||
obj[F("hidd")] = mConfig->sys.isHidden;
|
obj[F("hidd")] = mConfig->sys.isHidden;
|
||||||
|
obj[F("mac")] = WiFi.macAddress();
|
||||||
|
obj[F("wifi_channel")] = WiFi.channel();
|
||||||
#endif /* !defined(ETHERNET) */
|
#endif /* !defined(ETHERNET) */
|
||||||
obj[F("device_name")] = mConfig->sys.deviceName;
|
obj[F("device_name")] = mConfig->sys.deviceName;
|
||||||
obj[F("dark_mode")] = (bool)mConfig->sys.darkMode;
|
obj[F("dark_mode")] = (bool)mConfig->sys.darkMode;
|
||||||
obj[F("sched_reboot")] = (bool)mConfig->sys.schedReboot;
|
obj[F("sched_reboot")] = (bool)mConfig->sys.schedReboot;
|
||||||
|
|
||||||
obj[F("mac")] = WiFi.macAddress();
|
|
||||||
obj[F("hostname")] = mConfig->sys.deviceName;
|
obj[F("hostname")] = mConfig->sys.deviceName;
|
||||||
obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0);
|
obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0);
|
||||||
obj[F("prot_mask")] = mConfig->sys.protectionMask;
|
obj[F("prot_mask")] = mConfig->sys.protectionMask;
|
||||||
|
@ -393,7 +395,6 @@ class RestApi {
|
||||||
obj[F("heap_free")] = mHeapFree;
|
obj[F("heap_free")] = mHeapFree;
|
||||||
obj[F("sketch_total")] = ESP.getFreeSketchSpace();
|
obj[F("sketch_total")] = ESP.getFreeSketchSpace();
|
||||||
obj[F("sketch_used")] = ESP.getSketchSize() / 1024; // in kb
|
obj[F("sketch_used")] = ESP.getSketchSize() / 1024; // in kb
|
||||||
obj[F("wifi_channel")] = WiFi.channel();
|
|
||||||
getGeneric(request, obj);
|
getGeneric(request, obj);
|
||||||
|
|
||||||
getRadioNrf(obj.createNestedObject(F("radioNrf")));
|
getRadioNrf(obj.createNestedObject(F("radioNrf")));
|
||||||
|
@ -426,9 +427,9 @@ class RestApi {
|
||||||
//obj[F("littlefs_total")] = LittleFS.totalBytes();
|
//obj[F("littlefs_total")] = LittleFS.totalBytes();
|
||||||
//obj[F("littlefs_used")] = LittleFS.usedBytes();
|
//obj[F("littlefs_used")] = LittleFS.usedBytes();
|
||||||
|
|
||||||
uint8_t max;
|
/*uint8_t max;
|
||||||
mApp->getSchedulerInfo(&max);
|
mApp->getSchedulerInfo(&max);
|
||||||
obj[F("schMax")] = max;
|
obj[F("schMax")] = max;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) {
|
void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) {
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
{#HTML_NAV}
|
{#HTML_NAV}
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h3>Total Power</h3>
|
<h3>{#TOTAL_POWER}</h3>
|
||||||
<div class="chartDiv" id="pwrChart"></div>
|
<div class="chartDiv" id="pwrChart"></div>
|
||||||
<h3>Total Power Today</h3>
|
<h3>{#TOTAL_POWER_DAY}</h3>
|
||||||
<div class="chartDiv" id="pwrDayChart"></div>
|
<div class="chartDiv" id="pwrDayChart"></div>
|
||||||
<!--IF_ENABLE_HISTORY_YIELD_PER_DAY-->
|
<!--IF_ENABLE_HISTORY_YIELD_PER_DAY-->
|
||||||
<h3>Total Yield per day</h3>
|
<h3>{#TOTAL_YIELD_PER_DAY}</h3>
|
||||||
<div class="chartDiv" id="ydChart"></div>
|
<div class="chartDiv" id="ydChart"></div>
|
||||||
<!--ENDIF_ENABLE_HISTORY_YIELD_PER_DAY-->
|
<!--ENDIF_ENABLE_HISTORY_YIELD_PER_DAY-->
|
||||||
<!--IF_ENABLE_HISTORY_LOAD_DATA-->
|
<!--IF_ENABLE_HISTORY_LOAD_DATA-->
|
||||||
|
@ -136,8 +136,8 @@
|
||||||
return [
|
return [
|
||||||
mlNs("polyline", {stroke: "url(#gLine)", fill: "none", points: pts}),
|
mlNs("polyline", {stroke: "url(#gLine)", fill: "none", points: pts}),
|
||||||
mlNs("polyline", {stroke: "none", fill: "url(#gFill)", points: pts2}),
|
mlNs("polyline", {stroke: "none", fill: "url(#gFill)", points: pts2}),
|
||||||
mlNs("text", {x: i*.8, y: 10}, "Maximum: " + String(obj.max) + "W"),
|
mlNs("text", {x: i*.8, y: 10}, "{#MAX_DAY}: " + String(obj.max) + "W"),
|
||||||
mlNs("text", {x: i*.8, y: 25}, "Last: " + String(lastVal) + "W")
|
mlNs("text", {x: i*.8, y: 25}, "{#LAST_VALUE}: " + String(lastVal) + "W")
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,9 @@
|
||||||
function parsePowerHistory(obj){
|
function parsePowerHistory(obj){
|
||||||
if(once) {
|
if(once) {
|
||||||
once = false
|
once = false
|
||||||
parseNav(obj.generic);
|
parseNav(obj.generic)
|
||||||
|
parseESP(obj.generic)
|
||||||
|
parseRssi(obj.generic)
|
||||||
window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", obj.refresh * 1000)
|
window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", obj.refresh * 1000)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.setInterval("getAjax('/api/powerHistoryDay', parsePowerHistoryDay)", refresh * 1000)
|
window.setInterval("getAjax('/api/powerHistoryDay', parsePowerHistoryDay)", refresh * 1000)
|
||||||
|
|
|
@ -1528,16 +1528,6 @@
|
||||||
"en": "Total Power",
|
"en": "Total Power",
|
||||||
"de": "Gesamtleistung"
|
"de": "Gesamtleistung"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"token": "LAST",
|
|
||||||
"en": "Last",
|
|
||||||
"de": "Die letzten"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"token": "VALUES",
|
|
||||||
"en": "values",
|
|
||||||
"de": "Werte"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"token": "TOTAL_POWER_DAY",
|
"token": "TOTAL_POWER_DAY",
|
||||||
"en": "Total Power Today",
|
"en": "Total Power Today",
|
||||||
|
@ -1557,21 +1547,6 @@
|
||||||
"token": "LAST_VALUE",
|
"token": "LAST_VALUE",
|
||||||
"en": "Last value",
|
"en": "Last value",
|
||||||
"de": "Letzter Wert"
|
"de": "Letzter Wert"
|
||||||
},
|
|
||||||
{
|
|
||||||
"token": "MAXIMUM",
|
|
||||||
"en": "Maximum value",
|
|
||||||
"de": "Maximalwert"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"token": "UPDATED",
|
|
||||||
"en": "Updated every",
|
|
||||||
"de": "Aktualisiert alle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"token": "SECONDS",
|
|
||||||
"en": "seconds",
|
|
||||||
"de": "Sekunden"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ void ahoywifi::tickWifiLoop() {
|
||||||
if (!MDNS.begin(mConfig->sys.deviceName)) {
|
if (!MDNS.begin(mConfig->sys.deviceName)) {
|
||||||
DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!"));
|
DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!"));
|
||||||
} else {
|
} else {
|
||||||
DBGPRINT(F("[WiFi] mDNS established: "));
|
DBGPRINT(F("mDNS established: "));
|
||||||
DBGPRINT(mConfig->sys.deviceName);
|
DBGPRINT(mConfig->sys.deviceName);
|
||||||
DBGPRINTLN(F(".local"));
|
DBGPRINTLN(F(".local"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "../utils/dbg.h"
|
#include "../utils/dbg.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <list>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <DNSServer.h>
|
#include <DNSServer.h>
|
||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue