mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
more pretty changes in web and wording
This commit is contained in:
@@ -1722,7 +1722,7 @@ bool MyESP::fs_saveCustomConfig(JsonObject root) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeEvent("INFO", "sys", "Custom config stored in the SPIFFS", "");
|
_writeEvent("INFO", "system", "Custom config stored in the SPIFFS", "");
|
||||||
myDebug_P(PSTR("[FS] custom config file saved"));
|
myDebug_P(PSTR("[FS] custom config file saved"));
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
@@ -1755,7 +1755,7 @@ bool MyESP::fs_saveConfig(JsonObject root) {
|
|||||||
configFile.close();
|
configFile.close();
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
_writeEvent("INFO", "sys", "System config stored in the SPIFFS", "");
|
_writeEvent("INFO", "system", "System config stored in the SPIFFS", "");
|
||||||
myDebug_P(PSTR("[FS] system config file saved"));
|
myDebug_P(PSTR("[FS] system config file saved"));
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
@@ -1832,7 +1832,7 @@ void MyESP::_fs_setup() {
|
|||||||
if (!SPIFFS.begin()) {
|
if (!SPIFFS.begin()) {
|
||||||
myDebug_P(PSTR("[FS] Formatting filesystem..."));
|
myDebug_P(PSTR("[FS] Formatting filesystem..."));
|
||||||
if (SPIFFS.format()) {
|
if (SPIFFS.format()) {
|
||||||
_writeEvent("WARN", "sys", "File system formatted", "");
|
_writeEvent("WARN", "system", "File system formatted", "");
|
||||||
} else {
|
} else {
|
||||||
myDebug_P(PSTR("[FS] Failed to format file system"));
|
myDebug_P(PSTR("[FS] Failed to format file system"));
|
||||||
}
|
}
|
||||||
@@ -2308,7 +2308,7 @@ void MyESP::_procMsg(AsyncWebSocketClient * client, size_t sz) {
|
|||||||
_sendEventLog(page);
|
_sendEventLog(page);
|
||||||
} else if (strcmp(command, "clearevent") == 0) {
|
} else if (strcmp(command, "clearevent") == 0) {
|
||||||
if (SPIFFS.remove(MYESP_EVENTLOG_FILE)) {
|
if (SPIFFS.remove(MYESP_EVENTLOG_FILE)) {
|
||||||
_writeEvent("WARN", "sys", "Event log cleared", "");
|
_writeEvent("WARN", "system", "Event log cleared", "");
|
||||||
} else {
|
} else {
|
||||||
myDebug_P(PSTR("[WEB] Couldn't clear log file"));
|
myDebug_P(PSTR("[WEB] Couldn't clear log file"));
|
||||||
}
|
}
|
||||||
@@ -2541,27 +2541,27 @@ void MyESP::_webserver_setup() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!index) {
|
if (!index) {
|
||||||
_writeEvent("INFO", "updt", "Firmware update started", "");
|
_writeEvent("INFO", "system", "Firmware update started", "");
|
||||||
//Serial.printf("[SYSTEM] Firmware update started: %s\n", filename.c_str()); // enable for debugging
|
//Serial.printf("[SYSTEM] Firmware update started: %s\n", filename.c_str()); // enable for debugging
|
||||||
Update.runAsync(true);
|
Update.runAsync(true);
|
||||||
if (!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)) {
|
if (!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)) {
|
||||||
_writeEvent("ERRO", "updt", "Not enough space to update", "");
|
_writeEvent("ERRO", "system", "Not enough space to update", "");
|
||||||
//Update.printError(Serial); // enable for debugging
|
//Update.printError(Serial); // enable for debugging
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Update.hasError()) {
|
if (!Update.hasError()) {
|
||||||
if (Update.write(data, len) != len) {
|
if (Update.write(data, len) != len) {
|
||||||
_writeEvent("ERRO", "updt", "Writing to flash failed", "");
|
_writeEvent("ERRO", "system", "Writing to flash failed", "");
|
||||||
//Update.printError(Serial); // enable for debugging
|
//Update.printError(Serial); // enable for debugging
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (final) {
|
if (final) {
|
||||||
if (Update.end(true)) {
|
if (Update.end(true)) {
|
||||||
_writeEvent("INFO", "updt", "Firmware update finished", "");
|
_writeEvent("INFO", "system", "Firmware update finished", "");
|
||||||
//Serial.printf("[SYSTEM] Firmware update finished: %uB\n", index + len); // enable for debugging
|
//Serial.printf("[SYSTEM] Firmware update finished: %uB\n", index + len); // enable for debugging
|
||||||
_shouldRestart = !Update.hasError();
|
_shouldRestart = !Update.hasError();
|
||||||
} else {
|
} else {
|
||||||
_writeEvent("ERRO", "updt", "Firmware update failed", "");
|
_writeEvent("ERRO", "system", "Firmware update failed", "");
|
||||||
//Update.printError(Serial); // enable for debugging
|
//Update.printError(Serial); // enable for debugging
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2606,11 +2606,11 @@ void MyESP::_webserver_setup() {
|
|||||||
//static String remoteIP = (String)address[0] + "." + (String)address[1] + "." + (String)address[2] + "." + (String)address[3];
|
//static String remoteIP = (String)address[0] + "." + (String)address[1] + "." + (String)address[2] + "." + (String)address[3];
|
||||||
|
|
||||||
if (!request->authenticate(MYESP_HTTP_USERNAME, _general_password)) {
|
if (!request->authenticate(MYESP_HTTP_USERNAME, _general_password)) {
|
||||||
//_writeEvent("WARN", "websrv", "New login attempt", remoteIP);
|
//_writeEvent("WARN", "system", "New login attempt", remoteIP);
|
||||||
return request->requestAuthentication();
|
return request->requestAuthentication();
|
||||||
}
|
}
|
||||||
request->send(200, "text/plain", "Success");
|
request->send(200, "text/plain", "Success");
|
||||||
// _writeEvent("INFO", "websrv", "Login successful", remoteIP);
|
// _writeEvent("INFO", "system", "Login successful", remoteIP);
|
||||||
});
|
});
|
||||||
|
|
||||||
_webServer->rewrite("/", "/index.html");
|
_webServer->rewrite("/", "/index.html");
|
||||||
@@ -2708,7 +2708,7 @@ void MyESP::_bootupSequence() {
|
|||||||
if (boot_status == MYESP_BOOTSTATUS_BOOTED) {
|
if (boot_status == MYESP_BOOTSTATUS_BOOTED) {
|
||||||
if ((_ntp_enabled) && (now() > 10000) && !_have_ntp_time) {
|
if ((_ntp_enabled) && (now() > 10000) && !_have_ntp_time) {
|
||||||
_have_ntp_time = true;
|
_have_ntp_time = true;
|
||||||
_writeEvent("INFO", "sys", "System booted", "");
|
_writeEvent("INFO", "system", "System booted", "");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2738,7 +2738,7 @@ void MyESP::_bootupSequence() {
|
|||||||
|
|
||||||
// write a log message if we're not using NTP, otherwise wait for the internet time to arrive
|
// write a log message if we're not using NTP, otherwise wait for the internet time to arrive
|
||||||
if (!_ntp_enabled) {
|
if (!_ntp_enabled) {
|
||||||
_writeEvent("INFO", "sys", "System booted", "");
|
_writeEvent("INFO", "system", "System booted", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2811,7 +2811,7 @@ void MyESP::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_shouldRestart) {
|
if (_shouldRestart) {
|
||||||
_writeEvent("INFO", "sys", "System is restarting", "");
|
_writeEvent("INFO", "system", "System is restarting", "");
|
||||||
myDebug("[SYSTEM] Restarting...");
|
myDebug("[SYSTEM] Restarting...");
|
||||||
_deferredReset(500, CUSTOM_RESET_TERMINAL);
|
_deferredReset(500, CUSTOM_RESET_TERMINAL);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
|
|||||||
@@ -143,7 +143,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h6 class="text-muted">Note: any setting marked with a <span
|
<h6 class="text-muted">Note: any setting marked with a <span
|
||||||
class="glyphicon glyphicon-exclamation-sign text-danger"></span> requires a system restart after saving.</h6>
|
class="glyphicon glyphicon-exclamation-sign text-danger"></span> requires a system restart after saving.
|
||||||
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="custom_statuscontent">
|
<div id="custom_statuscontent">
|
||||||
@@ -175,12 +176,8 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-info table-responsive" id="boiler_show">
|
<div class="panel panel-info table-responsive" id="boiler_show">
|
||||||
<div class="panel-heading">Boiler</div>
|
<div class="panel-heading"><b>Boiler</b>: <span id="bm"></span></div>
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
<tr>
|
|
||||||
<th>Model:</th>
|
|
||||||
<td colspan="3" id="bm"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Hot Tap Water:</th>
|
<th>Hot Tap Water:</th>
|
||||||
<td id="b1"></td>
|
<td id="b1"></td>
|
||||||
@@ -203,12 +200,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-warning table-responsive" id="thermostat_show">
|
<div class="panel panel-warning table-responsive" id="thermostat_show">
|
||||||
<div class="panel-heading">Thermostat</div>
|
<div class="panel-heading"><b>Thermostat</b>: <span id="tm"></span></div>
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
<tr>
|
|
||||||
<th>Model:</th>
|
|
||||||
<td colspan="3" id="tm"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Setpoint Temperature:</th>
|
<th>Setpoint Temperature:</th>
|
||||||
<td id="ts"></td>
|
<td id="ts"></td>
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ function listCustomStats() {
|
|||||||
} else {
|
} else {
|
||||||
var color = "";
|
var color = "";
|
||||||
}
|
}
|
||||||
l.innerHTML = "Model:" + obj[i].model + ", Version:" + obj[i].version + ", ProductID:" + obj[i].productid + ", DeviceID:" + obj[i].deviceid;
|
l.innerHTML = obj[i].model + ", Version:" + obj[i].version + ", ProductID:" + obj[i].productid + ", DeviceID:" + obj[i].deviceid;
|
||||||
l.className = "list-group-item list-group-item-" + color;
|
l.className = "list-group-item list-group-item-" + color;
|
||||||
list.appendChild(l);
|
list.appendChild(l);
|
||||||
}
|
}
|
||||||
|
|||||||
25
src/ems.cpp
25
src/ems.cpp
@@ -542,18 +542,14 @@ void _debugPrintTelegram(const char * prefix, _EMS_RxTelegram * EMS_RxTelegram,
|
|||||||
strlcat(output_str, " ", sizeof(output_str)); // add space
|
strlcat(output_str, " ", sizeof(output_str)); // add space
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raw) {
|
strlcat(output_str, "(CRC=", sizeof(output_str));
|
||||||
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str)); // CRC
|
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
|
||||||
} else {
|
strlcat(output_str, ")", sizeof(output_str));
|
||||||
strlcat(output_str, "(CRC=", sizeof(output_str));
|
|
||||||
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
|
|
||||||
strlcat(output_str, ")", sizeof(output_str));
|
|
||||||
|
|
||||||
// print number of data bytes only if its a valid telegram
|
// print number of data bytes only if its a valid telegram
|
||||||
if (data_len) {
|
if (data_len) {
|
||||||
strlcat(output_str, " #data=", sizeof(output_str));
|
strlcat(output_str, " #data=", sizeof(output_str));
|
||||||
strlcat(output_str, itoa(data_len, buffer, 10), sizeof(output_str));
|
strlcat(output_str, itoa(data_len, buffer, 10), sizeof(output_str));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcat(output_str, COLOR_RESET, sizeof(output_str));
|
strlcat(output_str, COLOR_RESET, sizeof(output_str));
|
||||||
@@ -626,6 +622,7 @@ void _ems_sendTelegram() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// complete the rest of the header depending on EMS or EMS+
|
// complete the rest of the header depending on EMS or EMS+
|
||||||
|
// TODO change depending on read or write operation !
|
||||||
if (EMS_TxTelegram.type > 0xFF) {
|
if (EMS_TxTelegram.type > 0xFF) {
|
||||||
// EMS 2.0 / EMS+
|
// EMS 2.0 / EMS+
|
||||||
EMS_TxTelegram.data[2] = 0xFF; // fixed value indicating an extended message
|
EMS_TxTelegram.data[2] = 0xFF; // fixed value indicating an extended message
|
||||||
@@ -650,11 +647,11 @@ void _ems_sendTelegram() {
|
|||||||
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE) {
|
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE) {
|
||||||
char s[64] = {0};
|
char s[64] = {0};
|
||||||
if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_WRITE) {
|
if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_WRITE) {
|
||||||
snprintf(s, sizeof(s), "Sending write of type 0x%02X to 0x%02X:", EMS_TxTelegram.type, EMS_TxTelegram.dest & 0x7F);
|
snprintf(s, sizeof(s), "Sending write of type 0x%02X to 0x%02X, ", EMS_TxTelegram.type, EMS_TxTelegram.dest & 0x7F);
|
||||||
} else if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_READ) {
|
} else if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_READ) {
|
||||||
snprintf(s, sizeof(s), "Sending read of type 0x%02X to 0x%02X:", EMS_TxTelegram.type, EMS_TxTelegram.dest & 0x7F);
|
snprintf(s, sizeof(s), "Sending read of type 0x%02X to 0x%02X, ", EMS_TxTelegram.type, EMS_TxTelegram.dest & 0x7F);
|
||||||
} else if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_VALIDATE) {
|
} else if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_VALIDATE) {
|
||||||
snprintf(s, sizeof(s), "Sending validate of type 0x%02X to 0x%02X:", EMS_TxTelegram.type, EMS_TxTelegram.dest & 0x7F);
|
snprintf(s, sizeof(s), "Sending validate of type 0x%02X to 0x%02X, ", EMS_TxTelegram.type, EMS_TxTelegram.dest & 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
_EMS_RxTelegram EMS_RxTelegram;
|
_EMS_RxTelegram EMS_RxTelegram;
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ function initEventTable() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "time",
|
"name": "time",
|
||||||
"title": "Date",
|
"title": "Date/Time",
|
||||||
"parser": function (value) {
|
"parser": function (value) {
|
||||||
if (value < 1563300000) {
|
if (value < 1563300000) {
|
||||||
return "(" + value + ")";
|
return "(" + value + ")";
|
||||||
|
|||||||
Reference in New Issue
Block a user