mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-06 04:31:37 +02:00
0.8.35
* changed reload time for opendtufusion after update to 5s * fix default interval and gap for communication * fix serial number in exported json (was decimal, now correct as hexdecimal number) * beautified factory reset * added second stage for erase settings * increased maximal number of inverters to 32 for opendtufusion board (ESP32-S3) * fixed crash if CMT inverter is enabled, but CMT isn't configured
This commit is contained in:
parent
b5cdd775a7
commit
86ff9f054a
8 changed files with 79 additions and 42 deletions
2
.github/workflows/compile_release.yml
vendored
2
.github/workflows/compile_release.yml
vendored
|
@ -77,7 +77,7 @@ jobs:
|
|||
VERSION: ${{ steps.rename-binary-files.outputs.name }}
|
||||
|
||||
- name: Create Artifact
|
||||
run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip src/firmware/* User_Manual.md
|
||||
run: zip --junk-paths ${{ steps.rename-binary-files.outputs.name }}.zip src/firmware/* User_Manual.md
|
||||
|
||||
- name: Upload Release
|
||||
id: upload-release
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
## 0.8.35 - 2023-12-30
|
||||
* added dim option for LEDS
|
||||
* changed reload time for opendtufusion after update to 5s
|
||||
* fix default interval and gap for communication
|
||||
* fix serial number in exported json (was decimal, now correct as hexdecimal number)
|
||||
* beautified factory reset
|
||||
* added second stage for erase settings
|
||||
* increased maximal number of inverters to 32 for opendtufusion board (ESP32-S3)
|
||||
* fixed crash if CMT inverter is enabled, but CMT isn't configured
|
||||
|
||||
# RELEASE 0.8.34 - 2023-12-29
|
||||
|
||||
|
|
|
@ -354,6 +354,9 @@ void app::tickSend(void) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if(!iv->radio->isChipConnected())
|
||||
continue;
|
||||
|
||||
iv->tickSend([this, iv](uint8_t cmd, bool isDevControl) {
|
||||
if(isDevControl)
|
||||
mCommunication.addImportant(iv, cmd);
|
||||
|
|
|
@ -153,7 +153,11 @@
|
|||
|
||||
// number of configurable inverters
|
||||
#if defined(ESP32)
|
||||
#define MAX_NUM_INVERTERS 16
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define MAX_NUM_INVERTERS 32
|
||||
#else
|
||||
#define MAX_NUM_INVERTERS 16
|
||||
#endif
|
||||
#else
|
||||
#define MAX_NUM_INVERTERS 4
|
||||
#endif
|
||||
|
|
|
@ -425,7 +425,7 @@ class settings {
|
|||
mCfg.serial.showIv = false;
|
||||
mCfg.serial.debug = false;
|
||||
mCfg.serial.privacyLog = true;
|
||||
mCfg.serial.printWholeTrace = true;
|
||||
mCfg.serial.printWholeTrace = false;
|
||||
|
||||
mCfg.mqtt.port = DEF_MQTT_PORT;
|
||||
snprintf(mCfg.mqtt.broker, MQTT_ADDR_LEN, "%s", DEF_MQTT_BROKER);
|
||||
|
@ -441,7 +441,7 @@ class settings {
|
|||
mCfg.inst.startWithoutTime = false;
|
||||
mCfg.inst.rstMaxValsMidNight = false;
|
||||
mCfg.inst.yieldEffiency = 1.0f;
|
||||
mCfg.inst.gapMs = 2000;
|
||||
mCfg.inst.gapMs = 500;
|
||||
mCfg.inst.readGrid = true;
|
||||
|
||||
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
||||
|
@ -456,8 +456,6 @@ class settings {
|
|||
mCfg.led.high_active = LED_HIGH_ACTIVE;
|
||||
mCfg.led.luminance = 255;
|
||||
|
||||
memset(&mCfg.inst, 0, sizeof(cfgInst_t));
|
||||
|
||||
mCfg.plugin.display.pwrSaveAtIvOffline = false;
|
||||
mCfg.plugin.display.contrast = 60;
|
||||
mCfg.plugin.display.screenSaver = 1; // default: 1 .. pixelshift for OLED for downward compatibility
|
||||
|
|
|
@ -88,6 +88,10 @@ class RestApi {
|
|||
else if(path == "html/logout") getHtmlLogout(request, root);
|
||||
else if(path == "html/reboot") getHtmlReboot(request, root);
|
||||
else if(path == "html/save") getHtmlSave(request, root);
|
||||
else if(path == "html/erase") getHtmlErase(request, root);
|
||||
else if(path == "html/erasetrue") getHtmlEraseTrue(request, root);
|
||||
else if(path == "html/factory") getHtmlFactory(request, root);
|
||||
else if(path == "html/factorytrue") getHtmlFactoryTrue(request, root);
|
||||
else if(path == "system") getSysInfo(request, root);
|
||||
else if(path == "generic") getGeneric(request, root);
|
||||
else if(path == "reboot") getReboot(request, root);
|
||||
|
@ -214,6 +218,16 @@ class RestApi {
|
|||
tmp.remove(i, tmp.indexOf("\"", i)-i);
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
// convert all serial numbers to hexadecimal
|
||||
while (i != -1) {
|
||||
i = tmp.indexOf("\"sn\":", i);
|
||||
if(-1 != i) {
|
||||
i+=5;
|
||||
String sn = tmp.substring(i, tmp.indexOf("\"", i)-1);
|
||||
tmp.replace(sn, String(atoll(sn.c_str()), HEX));
|
||||
}
|
||||
}
|
||||
response = request->beginResponse(200, F("application/json; charset=utf-8"), tmp);
|
||||
}
|
||||
|
||||
|
@ -337,6 +351,40 @@ class RestApi {
|
|||
#endif
|
||||
}
|
||||
|
||||
void getHtmlErase(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
obj[F("html")] = F("Erase settings (not WiFi)? <a class=\"btn\" href=\"/erasetrue\">yes</a> <a class=\"btn\" href=\"/\">no</a>");
|
||||
}
|
||||
|
||||
void getHtmlEraseTrue(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
mApp->eraseSettings(false);
|
||||
mApp->setRebootFlag();
|
||||
obj[F("html")] = F("Erase settings: success");
|
||||
#if defined(ETHERNET) && defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
obj[F("reload")] = 5;
|
||||
#else
|
||||
obj[F("reload")] = 20;
|
||||
#endif
|
||||
}
|
||||
|
||||
void getHtmlFactory(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
obj[F("html")] = F("Factory reset? <a class=\"btn\" href=\"/factorytrue\">yes</a> <a class=\"btn\" href=\"/\">no</a>");
|
||||
}
|
||||
|
||||
void getHtmlFactoryTrue(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
mApp->eraseSettings(true);
|
||||
mApp->setRebootFlag();
|
||||
obj[F("html")] = F("Factory reset: success");
|
||||
#if defined(ETHERNET) && defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
obj[F("reload")] = 5;
|
||||
#else
|
||||
obj[F("reload")] = 20;
|
||||
#endif
|
||||
}
|
||||
|
||||
void getReboot(AsyncWebServerRequest *request, JsonObject obj) {
|
||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
||||
obj[F("refresh")] = 10;
|
||||
|
|
|
@ -126,8 +126,7 @@
|
|||
meta.httpEquiv = "refresh"
|
||||
meta.content = obj.refresh + "; URL=" + obj.refresh_url;
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
}
|
||||
else {
|
||||
} else if(null != obj.system) {
|
||||
parseRadio(obj.system);
|
||||
parseMqtt(obj.system.mqtt);
|
||||
parseSysInfo(obj.system);
|
||||
|
|
|
@ -71,14 +71,15 @@ class Web {
|
|||
mWeb.onNotFound ( std::bind(&Web::showNotFound, this, std::placeholders::_1));
|
||||
mWeb.on("/reboot", HTTP_ANY, std::bind(&Web::onReboot, this, std::placeholders::_1));
|
||||
mWeb.on("/system", HTTP_ANY, std::bind(&Web::onSystem, this, std::placeholders::_1));
|
||||
mWeb.on("/erase", HTTP_ANY, std::bind(&Web::showErase, this, std::placeholders::_1));
|
||||
mWeb.on("/factory", HTTP_ANY, std::bind(&Web::showFactoryRst, this, std::placeholders::_1));
|
||||
mWeb.on("/erase", HTTP_ANY, std::bind(&Web::showHtml, this, std::placeholders::_1));
|
||||
mWeb.on("/erasetrue", HTTP_ANY, std::bind(&Web::showHtml, this, std::placeholders::_1));
|
||||
mWeb.on("/factory", HTTP_ANY, std::bind(&Web::showHtml, this, std::placeholders::_1));
|
||||
mWeb.on("/factorytrue", HTTP_ANY, std::bind(&Web::showHtml, 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("/live", HTTP_ANY, std::bind(&Web::onLive, this, std::placeholders::_1));
|
||||
//mWeb.on("/api1", HTTP_POST, std::bind(&Web::showWebApi, this, std::placeholders::_1));
|
||||
|
||||
#ifdef ENABLE_PROMETHEUS_EP
|
||||
mWeb.on("/metrics", HTTP_ANY, std::bind(&Web::showMetrics, this, std::placeholders::_1));
|
||||
|
@ -197,6 +198,11 @@ class Web {
|
|||
#if !defined(ETHERNET)
|
||||
strncpy(mConfig->sys.stationPwd, pwd, PWD_LEN); // restore WiFi PWD
|
||||
#endif
|
||||
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
||||
if((mConfig->inst.iv[i].serial.u64 != 0) && (mConfig->inst.iv[i].serial.u64 < 138999999999)) { // hexadecimal
|
||||
mConfig->inst.iv[i].serial.u64 = ah::Serial2u64(String(mConfig->inst.iv[i].serial.u64).c_str());
|
||||
}
|
||||
}
|
||||
mApp->saveSettings(true);
|
||||
}
|
||||
if (!mUploadFail)
|
||||
|
@ -426,39 +432,12 @@ class Web {
|
|||
request->send(response);
|
||||
}
|
||||
|
||||
void showErase(AsyncWebServerRequest *request) {
|
||||
void showHtml(AsyncWebServerRequest *request) {
|
||||
checkProtection(request);
|
||||
|
||||
DPRINTLN(DBG_VERBOSE, F("showErase"));
|
||||
mApp->eraseSettings(false);
|
||||
onReboot(request);
|
||||
}
|
||||
|
||||
void showFactoryRst(AsyncWebServerRequest *request) {
|
||||
checkProtection(request);
|
||||
|
||||
DPRINTLN(DBG_VERBOSE, F("showFactoryRst"));
|
||||
String content = "";
|
||||
int refresh = 3;
|
||||
if (request->args() > 0) {
|
||||
if (request->arg("reset").toInt() == 1) {
|
||||
refresh = 10;
|
||||
if (mApp->eraseSettings(true))
|
||||
content = F("factory reset: success\n\nrebooting ... ");
|
||||
else
|
||||
content = F("factory reset: failed\n\nrebooting ... ");
|
||||
} else {
|
||||
content = F("factory reset: aborted");
|
||||
refresh = 3;
|
||||
}
|
||||
} else {
|
||||
content = F("<h1>Factory Reset</h1>"
|
||||
"<p><a href=\"/factory?reset=1\">RESET</a><br/><br/><a href=\"/factory?reset=0\">CANCEL</a><br/></p>");
|
||||
refresh = 120;
|
||||
}
|
||||
request->send(200, F("text/html; charset=UTF-8"), F("<!doctype html><html><head><title>Factory Reset</title><meta http-equiv=\"refresh\" content=\"") + String(refresh) + F("; URL=/\"></head><body>") + content + F("</body></html>"));
|
||||
if (refresh == 10)
|
||||
onReboot(request);
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html; charset=UTF-8"), system_html, system_html_len);
|
||||
response->addHeader(F("Content-Encoding"), "gzip");
|
||||
request->send(response);
|
||||
}
|
||||
|
||||
void onSetup(AsyncWebServerRequest *request) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue