mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-29 22:27:13 +02:00
0.8.110
* improved `Wizard
This commit is contained in:
parent
e76722ad33
commit
1f86e4cedb
9 changed files with 43 additions and 8 deletions
|
@ -4,6 +4,8 @@
|
||||||
* revert CMT2300A changes #1553
|
* revert CMT2300A changes #1553
|
||||||
* merged PR: fix closing tag #1584
|
* merged PR: fix closing tag #1584
|
||||||
* add disable retain flag #1582
|
* add disable retain flag #1582
|
||||||
|
* fix German translation #1569
|
||||||
|
* improved `Wizard`
|
||||||
|
|
||||||
## 0.8.109 - 2024-04-09
|
## 0.8.109 - 2024-04-09
|
||||||
* fix hal patch
|
* fix hal patch
|
||||||
|
|
|
@ -168,7 +168,7 @@ class app : public IApp, public ah::Scheduler {
|
||||||
|
|
||||||
#if !defined(ETHERNET)
|
#if !defined(ETHERNET)
|
||||||
bool getAvailNetworks(JsonObject obj) override {
|
bool getAvailNetworks(JsonObject obj) override {
|
||||||
return mNetwork->getAvailNetworks(obj);
|
return mNetwork->getAvailNetworks(obj, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupStation(void) override {
|
void setupStation(void) override {
|
||||||
|
@ -204,6 +204,10 @@ class app : public IApp, public ah::Scheduler {
|
||||||
return mVersionModules;
|
return mVersionModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addOnce(ah::scdCb c, uint32_t timeout, const char *name) override {
|
||||||
|
once(c, timeout, name);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t getSunrise() override {
|
uint32_t getSunrise() override {
|
||||||
return mSunrise;
|
return mSunrise;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
|
#include "utils/scheduler.h"
|
||||||
|
|
||||||
// abstract interface to App. Make members of App accessible from child class
|
// abstract interface to App. Make members of App accessible from child class
|
||||||
// like web or API without forward declaration
|
// like web or API without forward declaration
|
||||||
|
@ -25,6 +26,8 @@ class IApp {
|
||||||
virtual const char *getVersion() = 0;
|
virtual const char *getVersion() = 0;
|
||||||
virtual const char *getVersionModules() = 0;
|
virtual const char *getVersionModules() = 0;
|
||||||
|
|
||||||
|
virtual void addOnce(ah::scdCb c, uint32_t timeout, const char *name) = 0;
|
||||||
|
|
||||||
#if !defined(ETHERNET)
|
#if !defined(ETHERNET)
|
||||||
virtual bool getAvailNetworks(JsonObject obj) = 0;
|
virtual bool getAvailNetworks(JsonObject obj) = 0;
|
||||||
virtual void setupStation(void) = 0;
|
virtual void setupStation(void) = 0;
|
||||||
|
|
|
@ -90,12 +90,9 @@ class AhoyNetwork {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ETHERNET)
|
#if !defined(ETHERNET)
|
||||||
bool getAvailNetworks(JsonObject obj) {
|
bool getAvailNetworks(JsonObject obj, IApp *app) {
|
||||||
if(!mScanActive) {
|
if(!mScanActive) {
|
||||||
mScanActive = true;
|
app->addOnce([this]() {scan();}, 1, F("scan"));
|
||||||
if(NetworkState::GOT_IP != mStatus)
|
|
||||||
WiFi.disconnect();
|
|
||||||
WiFi.scanNetworks(true, true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +114,13 @@ class AhoyNetwork {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scan(void) {
|
||||||
|
mScanActive = true;
|
||||||
|
if(NetworkState::GOT_IP != mStatus)
|
||||||
|
WiFi.disconnect();
|
||||||
|
WiFi.scanNetworks(true, true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -63,6 +63,7 @@ class AhoyWifiAp {
|
||||||
#if defined(ETHERNET)
|
#if defined(ETHERNET)
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
#else
|
#else
|
||||||
|
WiFi.scanDelete();
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class AhoyWifi : public AhoyNetwork {
|
||||||
|
|
||||||
DBGPRINT(F("connect to network '"));
|
DBGPRINT(F("connect to network '"));
|
||||||
DBGPRINT(mConfig->sys.stationSsid);
|
DBGPRINT(mConfig->sys.stationSsid);
|
||||||
|
DBGPRINTLN(F("'"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,9 @@ class RestApi {
|
||||||
|
|
||||||
void getHtmlFactory(AsyncWebServerRequest *request, JsonObject obj) {
|
void getHtmlFactory(AsyncWebServerRequest *request, JsonObject obj) {
|
||||||
getGeneric(request, obj.createNestedObject(F("generic")));
|
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) {
|
void getHtmlFactoryTrue(AsyncWebServerRequest *request, JsonObject obj) {
|
||||||
|
|
|
@ -72,4 +72,22 @@
|
||||||
#define BTN_REBOOT "Reboot"
|
#define BTN_REBOOT "Reboot"
|
||||||
#endif
|
#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__*/
|
#endif /*__LANG_H__*/
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
{
|
{
|
||||||
"token": "NETWORK_SUCCESS",
|
"token": "NETWORK_SUCCESS",
|
||||||
"en": "success, got following IP in your network: ",
|
"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",
|
"token": "BTN_FINISH",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue