mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-25 14:56:11 +02:00
0.5.104
* further improved save settings * removed `#` character from ePaper * fixed saving pinout for `Nokia-Display` * removed `Reset` Pin for monochrome displays
This commit is contained in:
parent
296597a589
commit
a6b8794855
7 changed files with 85 additions and 85 deletions
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
(starting from release version `0.5.66`)
|
(starting from release version `0.5.66`)
|
||||||
|
|
||||||
|
## 0.5.104
|
||||||
|
* further improved save settings
|
||||||
|
* removed `#` character from ePaper
|
||||||
|
* fixed saving pinout for `Nokia-Display`
|
||||||
|
* removed `Reset` Pin for monochrome displays
|
||||||
|
|
||||||
## 0.5.103
|
## 0.5.103
|
||||||
* merged MI improvements, thx @rejoe2 #778
|
* merged MI improvements, thx @rejoe2 #778
|
||||||
* changed display inverter online message
|
* changed display inverter online message
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 5
|
#define VERSION_MINOR 5
|
||||||
#define VERSION_PATCH 103
|
#define VERSION_PATCH 104
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -168,7 +168,7 @@ void DisplayEPaper::actualPowerPaged(float _totalPower, float _totalYieldDay, fl
|
||||||
_display->println("kWh");
|
_display->println("kWh");
|
||||||
|
|
||||||
_display->setCursor(0, _display->height() - (mHeadFootPadding + 10));
|
_display->setCursor(0, _display->height() - (mHeadFootPadding + 10));
|
||||||
snprintf(_fmtText, sizeof(_fmtText), "#%d Inverter online", _isprod);
|
snprintf(_fmtText, sizeof(_fmtText), "%d Inverter online", _isprod);
|
||||||
_display->println(_fmtText);
|
_display->println(_fmtText);
|
||||||
|
|
||||||
} while (_display->nextPage());
|
} while (_display->nextPage());
|
||||||
|
|
|
@ -80,7 +80,6 @@ class RestApi {
|
||||||
if(path == "html/system") getHtmlSystem(root);
|
if(path == "html/system") getHtmlSystem(root);
|
||||||
else if(path == "html/logout") getHtmlLogout(root);
|
else if(path == "html/logout") getHtmlLogout(root);
|
||||||
else if(path == "html/save") getHtmlSave(root);
|
else if(path == "html/save") getHtmlSave(root);
|
||||||
else if(path == "html/chk_save") getHtmlSave(root);
|
|
||||||
else if(path == "system") getSysInfo(root);
|
else if(path == "system") getSysInfo(root);
|
||||||
else if(path == "generic") getGeneric(root);
|
else if(path == "generic") getGeneric(root);
|
||||||
else if(path == "reboot") getReboot(root);
|
else if(path == "reboot") getReboot(root);
|
||||||
|
@ -267,12 +266,8 @@ class RestApi {
|
||||||
|
|
||||||
void getHtmlSave(JsonObject obj) {
|
void getHtmlSave(JsonObject obj) {
|
||||||
getGeneric(obj.createNestedObject(F("generic")));
|
getGeneric(obj.createNestedObject(F("generic")));
|
||||||
obj[F("refresh")] = 1;
|
obj["pending"] = (bool)mApp->getSavePending();
|
||||||
obj[F("refresh_url")] = mApp->getSavePending() ? F("/chk_save") : F("/setup");
|
obj["success"] = (bool)mApp->getLastSaveSucceed();
|
||||||
if(mApp->getSavePending())
|
|
||||||
obj[F("html")] = F("saving settings ...");
|
|
||||||
else
|
|
||||||
obj[F("html")] = mApp->getLastSaveSucceed() ? F("settings succesfully saved") : F("failed saving settings");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getReboot(JsonObject obj) {
|
void getReboot(JsonObject obj) {
|
||||||
|
@ -417,10 +412,10 @@ class RestApi {
|
||||||
obj[F("disp_cont")] = (uint8_t)mConfig->plugin.display.contrast;
|
obj[F("disp_cont")] = (uint8_t)mConfig->plugin.display.contrast;
|
||||||
obj[F("disp_clk")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_clk;
|
obj[F("disp_clk")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_clk;
|
||||||
obj[F("disp_data")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_data;
|
obj[F("disp_data")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_data;
|
||||||
obj[F("disp_cs")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_cs;
|
obj[F("disp_cs")] = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : mConfig->plugin.display.disp_cs;
|
||||||
obj[F("disp_dc")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_dc;
|
obj[F("disp_dc")] = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : mConfig->plugin.display.disp_dc;
|
||||||
obj[F("disp_rst")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_reset;
|
obj[F("disp_rst")] = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : mConfig->plugin.display.disp_reset;
|
||||||
obj[F("disp_bsy")] = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : mConfig->plugin.display.disp_busy;
|
obj[F("disp_bsy")] = (mConfig->plugin.display.type < 10) ? DEF_PIN_OFF : mConfig->plugin.display.disp_busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getIndex(JsonObject obj) {
|
void getIndex(JsonObject obj) {
|
||||||
|
@ -492,7 +487,6 @@ class RestApi {
|
||||||
|
|
||||||
void getLive(JsonObject obj) {
|
void getLive(JsonObject obj) {
|
||||||
getGeneric(obj.createNestedObject(F("generic")));
|
getGeneric(obj.createNestedObject(F("generic")));
|
||||||
//JsonArray invArr = obj.createNestedArray(F("inverter"));
|
|
||||||
obj[F("refresh")] = mConfig->nrf.sendInterval;
|
obj[F("refresh")] = mConfig->nrf.sendInterval;
|
||||||
|
|
||||||
for (uint8_t fld = 0; fld < sizeof(acList); fld++) {
|
for (uint8_t fld = 0; fld < sizeof(acList); fld++) {
|
||||||
|
@ -512,52 +506,6 @@ class RestApi {
|
||||||
parse = iv->config->enabled;
|
parse = iv->config->enabled;
|
||||||
obj[F("iv")][i] = parse;
|
obj[F("iv")][i] = parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Inverter<> *iv;
|
|
||||||
uint8_t pos;
|
|
||||||
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i ++) {
|
|
||||||
iv = mSys->getInverterByPos(i);
|
|
||||||
if(NULL != iv) {
|
|
||||||
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
|
|
||||||
JsonObject obj2 = invArr.createNestedObject();
|
|
||||||
obj2[F("enabled")] = (bool)iv->config->enabled;
|
|
||||||
obj2[F("name")] = String(iv->config->name);
|
|
||||||
obj2[F("channels")] = iv->channels;
|
|
||||||
obj2[F("power_limit_read")] = ah::round3(iv->actPowerLimit);
|
|
||||||
//obj2[F("last_alarm")] = String(iv->lastAlarmMsg);
|
|
||||||
obj2[F("ts_last_success")] = rec->ts;
|
|
||||||
|
|
||||||
JsonArray ch = obj2.createNestedArray("ch");
|
|
||||||
JsonArray ch0 = ch.createNestedArray();
|
|
||||||
obj2[F("ch_names")][0] = "AC";
|
|
||||||
for (uint8_t fld = 0; fld < sizeof(list); fld++) {
|
|
||||||
pos = (iv->getPosByChFld(CH0, list[fld], rec));
|
|
||||||
ch0[fld] = (0xff != pos) ? ah::round3(iv->getValue(pos, rec)) : 0.0;
|
|
||||||
obj[F("ch0_fld_units")][fld] = (0xff != pos) ? String(iv->getUnit(pos, rec)) : notAvail;
|
|
||||||
obj[F("ch0_fld_names")][fld] = (0xff != pos) ? String(iv->getFieldName(pos, rec)) : notAvail;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(uint8_t j = 1; j <= iv->channels; j ++) {
|
|
||||||
obj2[F("ch_names")][j] = String(iv->config->chName[j-1]);
|
|
||||||
JsonArray cur = ch.createNestedArray();
|
|
||||||
for (uint8_t k = 0; k < 6; k++) {
|
|
||||||
switch(k) {
|
|
||||||
default: pos = (iv->getPosByChFld(j, FLD_UDC, rec)); break;
|
|
||||||
case 1: pos = (iv->getPosByChFld(j, FLD_IDC, rec)); break;
|
|
||||||
case 2: pos = (iv->getPosByChFld(j, FLD_PDC, rec)); break;
|
|
||||||
case 3: pos = (iv->getPosByChFld(j, FLD_YD, rec)); break;
|
|
||||||
case 4: pos = (iv->getPosByChFld(j, FLD_YT, rec)); break;
|
|
||||||
case 5: pos = (iv->getPosByChFld(j, FLD_IRR, rec)); break;
|
|
||||||
}
|
|
||||||
cur[k] = (0xff != pos) ? ah::round3(iv->getValue(pos, rec)) : 0.0;
|
|
||||||
if(1 == j) {
|
|
||||||
obj[F("fld_units")][k] = (0xff != pos) ? String(iv->getUnit(pos, rec)) : notAvail;
|
|
||||||
obj[F("fld_names")][k] = (0xff != pos) ? String(iv->getFieldName(pos, rec)) : notAvail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getRecord(JsonObject obj, uint8_t recType) {
|
void getRecord(JsonObject obj, uint8_t recType) {
|
||||||
|
|
51
src/web/html/save.html
Normal file
51
src/web/html/save.html
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Save</title>
|
||||||
|
{#HTML_HEADER}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{#HTML_NAV}
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="content">
|
||||||
|
<div id="html" class="mt-3 mb-3"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{#HTML_FOOTER}
|
||||||
|
<script type="text/javascript">
|
||||||
|
function parseGeneric(obj) {
|
||||||
|
parseNav(obj);
|
||||||
|
parseESP(obj);
|
||||||
|
parseRssi(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseHtml(obj) {
|
||||||
|
var html = "";
|
||||||
|
if(obj.pending)
|
||||||
|
html = "saving settings ...";
|
||||||
|
else {
|
||||||
|
if(obj.success)
|
||||||
|
html = "settings successfully saved";
|
||||||
|
else
|
||||||
|
html = "failed saving settings";
|
||||||
|
|
||||||
|
var meta = document.createElement('meta');
|
||||||
|
meta.httpEquiv = "refresh"
|
||||||
|
meta.content = 1 + "; URL=/setup";
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||||
|
}
|
||||||
|
document.getElementById("html").innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse(obj) {
|
||||||
|
if(null != obj) {
|
||||||
|
parseGeneric(obj["generic"]);
|
||||||
|
parseHtml(obj);
|
||||||
|
window.setInterval("getAjax('/api/html/save', parse)", 1100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getAjax("/api/html/save", parse);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -692,22 +692,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideDispPins(pins, dispType) {
|
function hideDispPins(pins, dispType) {
|
||||||
if(0 == dispType) {
|
for(var i = 0; i < pins.length; i++) {
|
||||||
for(p of pins) {
|
var cl = document.getElementById("row_" + pins[i][1]).classList;
|
||||||
document.getElementById("row_" + p[1]).classList.add("hide");
|
|
||||||
}
|
if(0 == dispType)
|
||||||
} else if(2 >= dispType) {
|
cl.add("hide");
|
||||||
for(var i = 0; i < pins.length; i++) {
|
else if(dispType <= 2) { // OLED
|
||||||
var cl = document.getElementById("row_" + pins[i][1]).classList;
|
|
||||||
if(i < 2)
|
if(i < 2)
|
||||||
cl.remove("hide");
|
cl.remove("hide");
|
||||||
else
|
else
|
||||||
cl.add("hide");
|
cl.add("hide");
|
||||||
}
|
} else if(dispType == 3) { // Nokia
|
||||||
} else {
|
if(i < 4)
|
||||||
for(p of pins) {
|
cl.remove("hide");
|
||||||
document.getElementById("row_" + p[1]).classList.remove("hide");
|
else
|
||||||
}
|
cl.add("hide");
|
||||||
|
} else // ePaper
|
||||||
|
cl.remove("hide");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "html/h/setup_html.h"
|
#include "html/h/setup_html.h"
|
||||||
#include "html/h/style_css.h"
|
#include "html/h/style_css.h"
|
||||||
#include "html/h/system_html.h"
|
#include "html/h/system_html.h"
|
||||||
|
#include "html/h/save_html.h"
|
||||||
#include "html/h/update_html.h"
|
#include "html/h/update_html.h"
|
||||||
#include "html/h/visualization_html.h"
|
#include "html/h/visualization_html.h"
|
||||||
|
|
||||||
|
@ -68,7 +69,6 @@ class Web {
|
||||||
|
|
||||||
mWeb.on("/setup", HTTP_GET, std::bind(&Web::onSetup, this, std::placeholders::_1));
|
mWeb.on("/setup", HTTP_GET, std::bind(&Web::onSetup, this, std::placeholders::_1));
|
||||||
mWeb.on("/save", HTTP_POST, std::bind(&Web::showSave, this, std::placeholders::_1));
|
mWeb.on("/save", HTTP_POST, std::bind(&Web::showSave, this, std::placeholders::_1));
|
||||||
mWeb.on("/chk_save", HTTP_GET, std::bind(&Web::onCheckSave, this, std::placeholders::_1));
|
|
||||||
|
|
||||||
mWeb.on("/live", HTTP_ANY, std::bind(&Web::onLive, this, std::placeholders::_1));
|
mWeb.on("/live", HTTP_ANY, std::bind(&Web::onLive, this, std::placeholders::_1));
|
||||||
//mWeb.on("/api1", HTTP_POST, std::bind(&Web::showWebApi, this, std::placeholders::_1));
|
//mWeb.on("/api1", HTTP_POST, std::bind(&Web::showWebApi, this, std::placeholders::_1));
|
||||||
|
@ -327,7 +327,7 @@ class Web {
|
||||||
|
|
||||||
mProtected = true;
|
mProtected = true;
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), save_html, save_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ class Web {
|
||||||
|
|
||||||
void onReboot(AsyncWebServerRequest *request) {
|
void onReboot(AsyncWebServerRequest *request) {
|
||||||
mApp->setRebootFlag();
|
mApp->setRebootFlag();
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), save_html, save_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
@ -586,20 +586,14 @@ class Web {
|
||||||
mConfig->plugin.display.contrast = (mConfig->plugin.display.type == 0) ? 60 : request->arg("disp_cont").toInt();
|
mConfig->plugin.display.contrast = (mConfig->plugin.display.type == 0) ? 60 : request->arg("disp_cont").toInt();
|
||||||
mConfig->plugin.display.disp_data = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : request->arg("disp_data").toInt();
|
mConfig->plugin.display.disp_data = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : request->arg("disp_data").toInt();
|
||||||
mConfig->plugin.display.disp_clk = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : request->arg("disp_clk").toInt();
|
mConfig->plugin.display.disp_clk = (mConfig->plugin.display.type == 0) ? DEF_PIN_OFF : request->arg("disp_clk").toInt();
|
||||||
mConfig->plugin.display.disp_cs = (mConfig->plugin.display.type < 4) ? DEF_PIN_OFF : request->arg("disp_cs").toInt();
|
mConfig->plugin.display.disp_cs = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : request->arg("disp_cs").toInt();
|
||||||
mConfig->plugin.display.disp_reset = (mConfig->plugin.display.type < 4) ? DEF_PIN_OFF : request->arg("disp_rst").toInt();
|
mConfig->plugin.display.disp_reset = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : request->arg("disp_rst").toInt();
|
||||||
mConfig->plugin.display.disp_dc = (mConfig->plugin.display.type < 4) ? DEF_PIN_OFF : request->arg("disp_dc").toInt();
|
mConfig->plugin.display.disp_dc = (mConfig->plugin.display.type < 3) ? DEF_PIN_OFF : request->arg("disp_dc").toInt();
|
||||||
mConfig->plugin.display.disp_busy = (mConfig->plugin.display.type < 10) ? DEF_PIN_OFF : request->arg("disp_bsy").toInt();
|
mConfig->plugin.display.disp_busy = (mConfig->plugin.display.type < 10) ? DEF_PIN_OFF : request->arg("disp_bsy").toInt();
|
||||||
|
|
||||||
mApp->saveSettings((request->arg("reboot") == "on"));
|
mApp->saveSettings((request->arg("reboot") == "on"));
|
||||||
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), save_html, save_html_len);
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
|
||||||
request->send(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onCheckSave(AsyncWebServerRequest *request) {
|
|
||||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
|
||||||
response->addHeader(F("Content-Encoding"), "gzip");
|
response->addHeader(F("Content-Encoding"), "gzip");
|
||||||
request->send(response);
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue