Snaha o zprehledneni kodu.

This commit is contained in:
Pavel Brychta 2022-04-01 08:06:56 +02:00
parent 1ebcab01e7
commit 36e0ab5f3a
2 changed files with 55 additions and 57 deletions

View File

@ -5,8 +5,8 @@
#include <sysvars.hpp> #include <sysvars.hpp>
#include "embHTML.h" #include "embHTML.h"
#include <encString.hpp> #include <encString.hpp>
#include <FS.h>
#include <definefs.hpp> #include <definefs.hpp>
#include <FS.h>
#ifdef USE_WIFICONFIG_FSEDITOR #ifdef USE_WIFICONFIG_FSEDITOR
# include <SPIFFSEditor.h> # include <SPIFFSEditor.h>
# include <FSWebEditor.h> # include <FSWebEditor.h>
@ -49,7 +49,7 @@ static bool _doReconfig = false; // TODO: mozna nejak elegantneji? Ale zase setr
String WifiConfigAPSSID(void) String WifiConfigAPSSID(void)
{ {
String ssid = SETUP_SSID; String ssid = F(SETUP_SSID);
return ssid; return ssid;
} }
@ -100,15 +100,12 @@ uint8_t * getOurMAC(uint8_t *mac)
WiFiConfigUsrParameter::WiFiConfigUsrParameter(const char *id, const char *label, const char *defaultValue, unsigned int length, storeparam_cb cb) WiFiConfigUsrParameter::WiFiConfigUsrParameter(const char *id, const char *label, const char *defaultValue, unsigned int length, storeparam_cb cb)
{ {
_next = NULL;
_cb = cb; _cb = cb;
_id = id; _id = id;
_label = label; _label = label;
_length = length; _length = length;
_value = new char[length + 1]; _value = new char[length + 1];
for (unsigned int i = 0; i < length; i++) { _value[0] = 0;
_value[i] = 0;
}
if (defaultValue != NULL) { if (defaultValue != NULL) {
strncpy(_value, defaultValue, length); strncpy(_value, defaultValue, length);
} }

View File

@ -134,15 +134,16 @@ private:
int _length; int _length;
storeparam_cb _cb; storeparam_cb _cb;
WiFiConfigUsrParameter *_next; WiFiConfigUsrParameter *_next = nullptr;
friend class WiFiConfig;
}; };
class WiFiConfig class WiFiConfig
{ {
public: public:
WiFiConfig(): _params(nullptr), _timeout(0) {} WiFiConfig()
: _params(nullptr)
, _timeout(0)
{}
wificonfigresult_t begin(int forceConfigure, wificonfig_cb cb); wificonfigresult_t begin(int forceConfigure, wificonfig_cb cb);
wificonfigresult_t begin(int forceConfigure, int timeout, wificonfig_cb cb); wificonfigresult_t begin(int forceConfigure, int timeout, wificonfig_cb cb);
void addParameter(WiFiConfigUsrParameter *p); void addParameter(WiFiConfigUsrParameter *p);