diff --git a/src/CHANGES.md b/src/CHANGES.md
index 1bd20103..f005f468 100644
--- a/src/CHANGES.md
+++ b/src/CHANGES.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.5.64
+* channel name can use any character, not limited any more
+* added `/` to MQTT topic and Inverter name
+* trigger for `calcSunrise` is now using local time #515
+* fix reconnect timeout for WiFi #509
+* start AP only after boot, not on WiFi connection loss
+* improved /system `free_heap` value (measured before JSON-tree is built)
+
## 0.5.63
* fix Update button protection (prevent double click #527)
* optimized scheduler #515 (thx @beegee3)
diff --git a/src/app.cpp b/src/app.cpp
index 2d3d1769..29df1e64 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -141,7 +141,7 @@ void app::tickCalcSunrise(void) {
ah::calculateSunriseSunset(mTimestamp, mCalculatedTimezoneOffset, mConfig->sun.lat, mConfig->sun.lon, &mSunrise, &mSunset);
tickIVCommunication();
- uint32_t nxtTrig = mTimestamp - ((mTimestamp - 10) % 86400) + 86400; // next midnight, -10 for safety that it is certain next day
+ uint32_t nxtTrig = mTimestamp - ((mTimestamp + mCalculatedTimezoneOffset - 10) % 86400) + 86400;; // next midnight, -10 for safety that it is certain next day, local timezone
onceAt(std::bind(&app::tickCalcSunrise, this), nxtTrig);
if (mConfig->mqtt.broker[0] > 0) {
mMqtt.tickerSun(mSunrise, mSunset, mConfig->sun.offsetSec, mConfig->sun.disNightCom);
diff --git a/src/app.h b/src/app.h
index ca5b29e2..54dca314 100644
--- a/src/app.h
+++ b/src/app.h
@@ -156,7 +156,7 @@ class app : public IApp, public ah::Scheduler {
}
void getSchedulerInfo(uint8_t *max) {
- return getStat(max);
+ getStat(max);
}
void setTimestamp(uint32_t newTime) {
diff --git a/src/defines.h b/src/defines.h
index 473d6724..fbc089b2 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
-#define VERSION_PATCH 63
+#define VERSION_PATCH 64
//-------------------------------------
typedef struct {
diff --git a/src/web/RestApi.h b/src/web/RestApi.h
index f1fca182..8ad55e26 100644
--- a/src/web/RestApi.h
+++ b/src/web/RestApi.h
@@ -19,6 +19,7 @@ class RestApi {
public:
RestApi() {
mTimezoneOffset = 0;
+ mFreeHeap = 0;
}
void setup(IApp *app, HMSYSTEM *sys, AsyncWebServer *srv, settings_t *config) {
@@ -51,6 +52,8 @@ class RestApi {
private:
void onApi(AsyncWebServerRequest *request) {
+ mFreeHeap = ESP.getFreeHeap();
+
AsyncJsonResponse* response = new AsyncJsonResponse(false, 8192);
JsonObject root = response->getRoot();
@@ -168,7 +171,7 @@ class RestApi {
obj[F("sdk")] = ESP.getSdkVersion();
obj[F("cpu_freq")] = ESP.getCpuFreqMHz();
- obj[F("heap_free")] = ESP.getFreeHeap();
+ obj[F("heap_free")] = mFreeHeap;
obj[F("sketch_total")] = ESP.getFreeSketchSpace();
obj[F("sketch_used")] = ESP.getSketchSize() / 1024; // in kb
getGeneric(obj);
@@ -571,6 +574,7 @@ class RestApi {
settings_t *mConfig;
uint32_t mTimezoneOffset;
+ uint32_t mFreeHeap;
};
#endif /*__WEB_API_H__*/
diff --git a/src/web/html/setup.html b/src/web/html/setup.html
index 3574a8f6..cf57f12b 100644
--- a/src/web/html/setup.html
+++ b/src/web/html/setup.html
@@ -147,7 +147,7 @@
-
+
@@ -320,10 +320,10 @@
iv.append(
lbl(id + "Name", "Name*"),
- inp(id + "Name", obj["name"], 32, ["text"], null, "text", "[A-Za-z0-9.\\-_\\+]+", "Invalid input")
+ inp(id + "Name", obj["name"], 32, ["text"], null, "text", "[A-Za-z0-9.\\-_\\+\\/]+", "Invalid input")
);
- for(var j of [["ModPwr", "ch_max_power", "Max Module Power (Wp)", 4, "[0-9]+"], ["ModName", "ch_name", "Module Name", 16, "[A-Za-z0-9.\\-_\\+]+"]]) {
+ for(var j of [["ModPwr", "ch_max_power", "Max Module Power (Wp)", 4, "[0-9]+"], ["ModName", "ch_name", "Module Name", 16, null]]) {
var cl = (re.test(obj["serial"])) ? null : ["hide"];
iv.appendChild(lbl(null, j[2], cl, "lbl" + id + j[0]));
d = div([j[0]]);
diff --git a/src/wifi/ahoywifi.cpp b/src/wifi/ahoywifi.cpp
index f884b1a3..95eaf432 100644
--- a/src/wifi/ahoywifi.cpp
+++ b/src/wifi/ahoywifi.cpp
@@ -35,15 +35,17 @@ void ahoywifi::setup(settings_t *config, uint32_t *utcTimestamp) {
WiFi.onEvent(std::bind(&ahoywifi::onWiFiEvent, this, std::placeholders::_1));
#endif
- setupWifi();
+ setupWifi(true);
}
//-----------------------------------------------------------------------------
-void ahoywifi::setupWifi(void) {
+void ahoywifi::setupWifi(bool startAP = false) {
#if !defined(FB_WIFI_OVERRIDDEN)
- setupAp();
- delay(1000);
+ if(startAP) {
+ setupAp();
+ delay(1000);
+ }
#endif
#if !defined(AP_ONLY)
if(mConfig->valid) {
@@ -62,7 +64,6 @@ void ahoywifi::setupWifi(void) {
void ahoywifi::tickWifiLoop() {
#if !defined(AP_ONLY)
if(mReconnect) {
- delay(100);
if (WiFi.softAPgetStationNum() > 0) { // do not reconnect if any AP connection exists
mDns.processNextRequest();
if((WIFI_AP_STA == WiFi.getMode()) && !mScanActive) {
@@ -78,12 +79,10 @@ void ahoywifi::tickWifiLoop() {
}
mCnt++;
- if ((mCnt % 10) == 0) {
- DBGPRINT(F("reconnect in "));
- DBGPRINT(String((100-mCnt)/10));
- DBGPRINTLN(F(" seconds"));
- }
- if((mCnt % 100) == 0) { // try to reconnect after 10 sec without connection
+ DBGPRINT(F("reconnect in "));
+ DBGPRINT(String((100-mCnt)/10));
+ DBGPRINTLN(F(" seconds"));
+ if((mCnt % 10) == 0) { // try to reconnect after 10 sec without connection
WiFi.reconnect();
mCnt = 0;
}
diff --git a/src/wifi/ahoywifi.h b/src/wifi/ahoywifi.h
index a84ba647..5b3b801c 100644
--- a/src/wifi/ahoywifi.h
+++ b/src/wifi/ahoywifi.h
@@ -27,7 +27,7 @@ class ahoywifi {
void getAvailNetworks(JsonObject obj);
private:
- void setupWifi(void);
+ void setupWifi(bool startAP);
void setupAp(void);
void setupStation(void);
void sendNTPpacket(IPAddress& address);