Browse Source

0.8.55

* merge PR: fix reboot problem with deactivated power graph #1360
* changed scope of variables and member functions inside display classes
* removed automatically "minimal" builds
* fix include of "settings.h" (was already done in #1360)
* merge PR: Enhancement: Add info about compiled modules to version string #1357
* add info about installed binary to `/update` #1353
* fix lang in `/system` #1346
pull/1364/head
lumapu 1 year ago
parent
commit
6c4e6f9d90
  1. 30
      scripts/convertHtml.py
  2. 3
      src/CHANGES.md
  3. 58
      src/app.cpp
  4. 7
      src/app.h
  5. 1
      src/appInterface.h
  6. 5
      src/web/RestApi.h
  7. 2
      src/web/html/system.html
  8. 2
      src/web/html/update.html
  9. 12
      src/web/lang.h
  10. 7
      src/web/lang.json

30
scripts/convertHtml.py

@ -23,18 +23,33 @@ def readVersion(path):
today = date.today()
search = ["_MAJOR", "_MINOR", "_PATCH"]
version = today.strftime("%y%m%d") + "_ahoy_"
ver = ""
for line in lines:
if(line.find("VERSION_") != -1):
for s in search:
p = line.find(s)
if(p != -1):
version += line[p+13:].rstrip() + "."
ver += line[p+13:].rstrip() + "."
return ver[:-1]
def htmlParts(file, header, nav, footer, version, lang):
def readVersionFull(path):
f = open(path, "r")
lines = f.readlines()
f.close()
today = date.today()
search = ["_MAJOR", "_MINOR", "_PATCH"]
version = today.strftime("%y%m%d") + "_ahoy_"
for line in lines:
if(line.find("VERSION_") != -1):
for s in search:
p = line.find(s)
if(p != -1):
version += line[p+13:].rstrip() + "."
version = version[:-1] + "_" + get_git_sha()
return version
def htmlParts(file, header, nav, footer, versionPath, lang):
p = "";
f = open(file, "r")
lines = f.readlines()
@ -59,8 +74,10 @@ def htmlParts(file, header, nav, footer, version, lang):
p += line
#placeholders
version = readVersion(versionPath);
link = '<a target="_blank" href="https://github.com/lumapu/ahoy/commits/' + get_git_sha() + '">GIT SHA: ' + get_git_sha() + ' :: ' + version + '</a>'
p = p.replace("{#VERSION}", version)
p = p.replace("{#VERSION_FULL}", readVersionFull(versionPath))
p = p.replace("{#VERSION_GIT}", link)
# remove if - endif ESP32
@ -120,7 +137,7 @@ def translate(file, data, lang="de"):
return data
def convert2Header(inFile, version, lang):
def convert2Header(inFile, versionPath, lang):
fileType = inFile.split(".")[1]
define = inFile.split(".")[0].upper()
define2 = inFile.split(".")[1].upper()
@ -140,7 +157,7 @@ def convert2Header(inFile, version, lang):
f.close()
else:
if fileType == "html":
data = htmlParts(inFile, "includes/header.html", "includes/nav.html", "includes/footer.html", version, lang)
data = htmlParts(inFile, "includes/header.html", "includes/nav.html", "includes/footer.html", versionPath, lang)
else:
f = open(inFile, "r")
data = f.read()
@ -193,7 +210,6 @@ for files in types:
Path("h").mkdir(exist_ok=True)
Path("tmp").mkdir(exist_ok=True) # created to check if webpages are valid with all replacements
shutil.copyfile("style.css", "tmp/style.css")
version = readVersion("../../defines.h")
# get language from environment
lang = "en"
@ -202,4 +218,4 @@ if env['PIOENV'][-3:] == "-de":
# go throw the array
for val in files_grabbed:
convert2Header(val, version, lang)
convert2Header(val, "../../defines.h", lang)

3
src/CHANGES.md

@ -5,6 +5,9 @@
* changed scope of variables and member functions inside display classes
* removed automatically "minimal" builds
* fix include of "settings.h" (was already done in #1360)
* merge PR: Enhancement: Add info about compiled modules to version string #1357
* add info about installed binary to `/update` #1353
* fix lang in `/system` #1346
## 0.8.54 - 2024-01-13
* added minimal version (without: MqTT, Display, History), WebUI is not changed!

58
src/app.cpp

@ -465,42 +465,42 @@ void app:: zeroIvValues(bool checkAvail, bool skipYieldDay) {
//-----------------------------------------------------------------------------
void app::resetSystem(void) {
snprintf(mVersion, sizeof(mVersion), "%d.%d.%d%s", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH,
"-"
#ifdef ENABLE_PROMETHEUS_EP
"P"
#endif
snprintf(mVersion, sizeof(mVersion), "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
snprintf(mVersionModules, sizeof(mVersionModules), "%s",
#ifdef ENABLE_PROMETHEUS_EP
"P"
#endif
#ifdef ENABLE_MQTT
"M"
#endif
#ifdef ENABLE_MQTT
"M"
#endif
#ifdef PLUGIN_DISPLAY
"D"
#endif
#ifdef PLUGIN_DISPLAY
"D"
#endif
#ifdef ENABLE_HISTORY
"H"
#endif
#ifdef ENABLE_HISTORY
"H"
#endif
#ifdef AP_ONLY
"A"
#endif
#ifdef AP_ONLY
"A"
#endif
#ifdef ENABLE_SYSLOG
"Y"
#endif
#ifdef ENABLE_SYSLOG
"Y"
#endif
#ifdef ENABLE_SIMULATOR
"S"
#endif
#ifdef ENABLE_SIMULATOR
"S"
#endif
"-"
#ifdef LANG_DE
"de"
#else
"en"
#endif
"-"
#ifdef LANG_DE
"de"
#else
"en"
#endif
);
#ifdef AP_ONLY

7
src/app.h

@ -188,6 +188,10 @@ class app : public IApp, public ah::Scheduler {
return mVersion;
}
const char *getVersionModules() {
return mVersionModules;
}
uint32_t getSunrise() {
return mSunrise;
}
@ -386,7 +390,8 @@ class app : public IApp, public ah::Scheduler {
CmtRadio<> mCmtRadio;
#endif
char mVersion[23];
char mVersion[12];
char mVersionModules[12];
settings mSettings;
settings_t *mConfig;
bool mSavePending;

1
src/appInterface.h

@ -27,6 +27,7 @@ class IApp {
virtual bool getShouldReboot() = 0;
virtual void setRebootFlag() = 0;
virtual const char *getVersion() = 0;
virtual const char *getVersionModules() = 0;
#if !defined(ETHERNET)
virtual void scanAvailNetworks() = 0;

5
src/web/RestApi.h

@ -252,6 +252,7 @@ class RestApi {
obj[F("ts_uptime")] = mApp->getUptime();
obj[F("ts_now")] = mApp->getTimestamp();
obj[F("version")] = String(mApp->getVersion());
obj[F("modules")] = String(mApp->getVersionModules());
obj[F("build")] = String(AUTO_GIT_HASH);
obj[F("env")] = String(ENV_NAME);
obj[F("menu_prot")] = mApp->getProtection(request);
@ -325,7 +326,9 @@ class RestApi {
void getHtmlSystem(AsyncWebServerRequest *request, JsonObject obj) {
getSysInfo(request, obj.createNestedObject(F("system")));
getGeneric(request, obj.createNestedObject(F("generic")));
obj[F("html")] = F("<a href=\"/factory\" class=\"btn\">AhoyFactory Reset</a><br/><br/><a href=\"/reboot\" class=\"btn\">Reboot</a>");
char tmp[100];
snprintf(tmp, 100, "<a href=\"/factory\" class=\"btn\">%s</a><br/><br/><a href=\"/reboot\" class=\"btn\">%s</a>", FACTORY_RESET, BTN_REBOOT);
obj[F("html")] = String(tmp);
}
void getHtmlLogout(AsyncWebServerRequest *request, JsonObject obj) {

2
src/web/html/system.html

@ -24,7 +24,7 @@
const data = ["sdk", "cpu_freq", "chip_revision",
"chip_model", "chip_cores", "esp_type", "mac", "wifi_rssi", "ts_uptime",
"flash_size", "sketch_used", "heap_total", "heap_free", "heap_frag",
"max_free_blk", "version", "core_version", "reboot_reason"];
"max_free_blk", "version", "modules", "env", "core_version", "reboot_reason"];
lines = [];
for (const [key, value] of Object.entries(obj)) {

2
src/web/html/update.html

@ -10,6 +10,7 @@
<div id="content">
<fieldset>
<legend class="des">{#SELECT_FILE} (*.bin)</legend>
<p>{#INSTALLED_VERSION}: <span id="version" style="background-color: var(--input-bg); padding: 7px;"></span></p>
<form id="form" method="POST" action="/update" enctype="multipart/form-data" accept-charset="utf-8">
<input type="file" name="update">
<input type="button" class="btn my-4" value="{#BTN_UPDATE}" onclick="hide()">
@ -26,6 +27,7 @@
parseNav(obj);
parseESP(obj);
parseRssi(obj);
document.getElementById("version").innerHTML = "{#VERSION_FULL}_" + obj.env + ".bin"
}
function hide() {

12
src/web/lang.h

@ -72,4 +72,16 @@
#define INV_NOT_FOUND "inverter not found!"
#endif
#ifdef LANG_DE
#define FACTORY_RESET "Ahoy Factory Reset"
#else /*LANG_EN*/
#define FACTORY_RESET "Ahoy auf Werkseinstellungen zurücksetzen"
#endif
#ifdef LANG_DE
#define BTN_REBOOT "Reboot"
#else /*LANG_EN*/
#define BTN_REBOOT "Ahoy neustarten"
#endif
#endif /*__LANG_H__*/

7
src/web/lang.json

@ -51,7 +51,7 @@
{
"token": "WELCOME",
"en": "Welcome to AhoyDTU",
"de": "Willkommen zu AhoyDTU"
"de": "Willkommen bei AhoyDTU"
},
{
"token": "NETWORK_SETUP",
@ -1043,6 +1043,11 @@
"en": "Download latest Release and Development versions (without login)",
"de": "Lade die letzte Releaseversion oder Entwicklerversion herunter (ohne Login)"
},
{
"token": "INSTALLED_VERSION",
"en": "installed version (original filename)",
"de": "aktuell installierte Version"
},
{
"token": "UPDATE_STARTED",
"en": "update started",

Loading…
Cancel
Save