diff --git a/src/CHANGES.md b/src/CHANGES.md index 1ad0ee1e0..8a41bd806 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -4,6 +4,8 @@ * revert CMT2300A changes #1553 * merged PR: fix closing tag #1584 * add disable retain flag #1582 +* fix German translation #1569 +* improved `Wizard` ## 0.8.109 - 2024-04-09 * fix hal patch diff --git a/src/app.h b/src/app.h index 70a1fde27..a7be0a55d 100644 --- a/src/app.h +++ b/src/app.h @@ -168,7 +168,7 @@ class app : public IApp, public ah::Scheduler { #if !defined(ETHERNET) bool getAvailNetworks(JsonObject obj) override { - return mNetwork->getAvailNetworks(obj); + return mNetwork->getAvailNetworks(obj, this); } void setupStation(void) override { @@ -204,6 +204,10 @@ class app : public IApp, public ah::Scheduler { return mVersionModules; } + void addOnce(ah::scdCb c, uint32_t timeout, const char *name) override { + once(c, timeout, name); + } + uint32_t getSunrise() override { return mSunrise; } diff --git a/src/appInterface.h b/src/appInterface.h index a1f5cd0e8..a5f4d081d 100644 --- a/src/appInterface.h +++ b/src/appInterface.h @@ -8,6 +8,7 @@ #include "defines.h" #include "ESPAsyncWebServer.h" +#include "utils/scheduler.h" // abstract interface to App. Make members of App accessible from child class // like web or API without forward declaration @@ -25,6 +26,8 @@ class IApp { virtual const char *getVersion() = 0; virtual const char *getVersionModules() = 0; + virtual void addOnce(ah::scdCb c, uint32_t timeout, const char *name) = 0; + #if !defined(ETHERNET) virtual bool getAvailNetworks(JsonObject obj) = 0; virtual void setupStation(void) = 0; diff --git a/src/network/AhoyNetwork.h b/src/network/AhoyNetwork.h index b5778f7de..75b262bf9 100644 --- a/src/network/AhoyNetwork.h +++ b/src/network/AhoyNetwork.h @@ -90,12 +90,9 @@ class AhoyNetwork { } #if !defined(ETHERNET) - bool getAvailNetworks(JsonObject obj) { + bool getAvailNetworks(JsonObject obj, IApp *app) { if(!mScanActive) { - mScanActive = true; - if(NetworkState::GOT_IP != mStatus) - WiFi.disconnect(); - WiFi.scanNetworks(true, true); + app->addOnce([this]() {scan();}, 1, F("scan")); return false; } @@ -117,6 +114,13 @@ class AhoyNetwork { return true; } + + void scan(void) { + mScanActive = true; + if(NetworkState::GOT_IP != mStatus) + WiFi.disconnect(); + WiFi.scanNetworks(true, true); + } #endif protected: diff --git a/src/network/AhoyWifiAp.h b/src/network/AhoyWifiAp.h index 994af3de1..669e8ec81 100644 --- a/src/network/AhoyWifiAp.h +++ b/src/network/AhoyWifiAp.h @@ -63,6 +63,7 @@ class AhoyWifiAp { #if defined(ETHERNET) WiFi.mode(WIFI_OFF); #else + WiFi.scanDelete(); WiFi.mode(WIFI_STA); #endif diff --git a/src/network/AhoyWifiEsp32.h b/src/network/AhoyWifiEsp32.h index 6ccb077a7..98b7053cb 100644 --- a/src/network/AhoyWifiEsp32.h +++ b/src/network/AhoyWifiEsp32.h @@ -30,6 +30,7 @@ class AhoyWifi : public AhoyNetwork { DBGPRINT(F("connect to network '")); DBGPRINT(mConfig->sys.stationSsid); + DBGPRINTLN(F("'")); #endif } diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 968ea0e8b..188afe233 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -489,7 +489,9 @@ class RestApi { void getHtmlFactory(AsyncWebServerRequest *request, JsonObject obj) { getGeneric(request, obj.createNestedObject(F("generic"))); - obj[F("html")] = F("Factory reset? yes no"); + char tmp[200]; + snprintf(tmp, 200, "%s %s %s", FACTORY_RESET, BTN_YES, BTN_NO); + obj[F("html")] = tmp; } void getHtmlFactoryTrue(AsyncWebServerRequest *request, JsonObject obj) { diff --git a/src/web/lang.h b/src/web/lang.h index fb5506ee6..54ade94e4 100644 --- a/src/web/lang.h +++ b/src/web/lang.h @@ -72,4 +72,22 @@ #define BTN_REBOOT "Reboot" #endif +#ifdef LANG_DE + #define BTN_REBOOT "Ahoy neustarten" +#else /*LANG_EN*/ + #define BTN_REBOOT "Reboot" +#endif + +#ifdef LANG_DE + #define BTN_YES "ja" +#else /*LANG_EN*/ + #define BTN_YES "yes" +#endif + +#ifdef LANG_DE + #define BTN_NO "nein" +#else /*LANG_EN*/ + #define BTN_NO "no" +#endif + #endif /*__LANG_H__*/ diff --git a/src/web/lang.json b/src/web/lang.json index 42669e288..34b10a258 100644 --- a/src/web/lang.json +++ b/src/web/lang.json @@ -106,7 +106,7 @@ { "token": "NETWORK_SUCCESS", "en": "success, got following IP in your network: ", - "de": "Verindung erfolgreich. AhoyDTU hat die folgende IP bekommen: " + "de": "Verbindung erfolgreich. AhoyDTU hat die folgende IP bekommen: " }, { "token": "BTN_FINISH",