* added config.h for general configuration

* added option to compile WiFi SSID + PWD to firmware
* added option to configure WiFi access point name and password
* added feature to retry connect to station WiFi (configurable timeouts)
* updated index.html
* added option for factory reset
* added info about project on index.html
* moved "update" and "home" to footer
* fixed #23 HM1200 yield day unit
* fixed DNS name of ESP after setup (some commits before)
This commit is contained in:
lumapu 2022-05-03 21:03:03 +02:00
parent c4b731708a
commit 539d4f73c1
16 changed files with 166 additions and 84 deletions

View file

@ -52,9 +52,10 @@ class Main {
return (crcCheck == crcRd);
}
void eraseSettings(void) {
void eraseSettings(bool all = false) {
uint8_t buf[64] = {0};
uint16_t addr = ADDR_START_SETTINGS, end;
uint16_t addr = (all) ? ADDR_START : ADDR_START_SETTINGS;
uint16_t end;
do {
end = addr += 64;
if(end > (ADDR_SETTINGS_CRC + 2))
@ -63,14 +64,14 @@ class Main {
} while(addr < ADDR_START_SETTINGS);
}
inline bool checkTicker(uint32_t *ticker, uint16_t *interval) {
inline bool checkTicker(uint32_t *ticker, uint32_t interval) {
uint32_t mil = millis();
if(mil >= *ticker) {
*ticker = mil + *interval;
*ticker = mil + interval;
return true;
}
else if(mil < (*ticker - *interval)) {
*ticker = mil + *interval;
else if(mil < (*ticker - interval)) {
*ticker = mil + interval;
return true;
}
@ -87,7 +88,8 @@ class Main {
char mDeviceName[DEVNAME_LEN];
eep *mEep;
uint32_t mTimestamp;
uint32_t mLimit;
uint32_t mNextTryTs;
private:
bool getConfig(void);
@ -100,6 +102,7 @@ class Main {
void showUptime(void);
void showTime(void);
void showCss(void);
void showFactoryRst(void);
time_t getNtpTime(void);
void sendNTPpacket(IPAddress& address);