Browse Source

0.8.110

* improved `Wizard
pull/1586/head
lumapu 9 months ago
parent
commit
1f86e4cedb
  1. 2
      src/CHANGES.md
  2. 6
      src/app.h
  3. 3
      src/appInterface.h
  4. 14
      src/network/AhoyNetwork.h
  5. 1
      src/network/AhoyWifiAp.h
  6. 1
      src/network/AhoyWifiEsp32.h
  7. 4
      src/web/RestApi.h
  8. 18
      src/web/lang.h
  9. 2
      src/web/lang.json

2
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

6
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;
}

3
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;

14
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:

1
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

1
src/network/AhoyWifiEsp32.h

@ -30,6 +30,7 @@ class AhoyWifi : public AhoyNetwork {
DBGPRINT(F("connect to network '"));
DBGPRINT(mConfig->sys.stationSsid);
DBGPRINTLN(F("'"));
#endif
}

4
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? <a class=\"btn\" href=\"/factorytrue\">yes</a> <a class=\"btn\" href=\"/\">no</a>");
char tmp[200];
snprintf(tmp, 200, "%s <a class=\"btn\" href=\"/factorytrue\">%s</a> <a class=\"btn\" href=\"/\">%s</a>", FACTORY_RESET, BTN_YES, BTN_NO);
obj[F("html")] = tmp;
}
void getHtmlFactoryTrue(AsyncWebServerRequest *request, JsonObject obj) {

18
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__*/

2
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",

Loading…
Cancel
Save