Preklad bez chyb.
This commit is contained in:
parent
691ecffe39
commit
8f0def0263
@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
#define DEBUG_BUILD // **** ladici varianta s Arduino OTA
|
#define DEBUG_BUILD // **** ladici varianta s Arduino OTA
|
||||||
|
|
||||||
#define HTTP_UPDATE // **** moznost aktualizace firmware pres www server pomoci http://%s.local/update
|
// #define HTTP_UPDATE // **** moznost aktualizace firmware pres www server pomoci http://%s.local/update
|
||||||
#define HTTP_UPDATE_USERNAME "admin" // **** uzivatelske jmeno pro update firmware (zapoznamkovanim teto definice vypneme nutnost prihlasovani)
|
#define HTTP_UPDATE_USERNAME "admin" // **** uzivatelske jmeno pro update firmware (zapoznamkovanim teto definice vypneme nutnost prihlasovani)
|
||||||
#define HTTP_UPDATE_PASSWORD "nimda" // **** uzivatelske heslo pro update firmware
|
#define HTTP_UPDATE_PASSWORD "nimda" // **** uzivatelske heslo pro update firmware
|
||||||
|
|
||||||
//#define USE_SPIFFS // **** podpora pro praci s SPIFFS souborovym systemem (webovy server dokaze servirovat stranky z SPIFFS)
|
#define USE_SPIFFS // **** podpora pro praci s SPIFFS souborovym systemem (webovy server dokaze servirovat stranky z SPIFFS)
|
||||||
|
|
||||||
#define FORCE_CONFIG_BUTTON_PIN NO_PIN // **** I/O pin, pouzity pro vynuceni konfigurace
|
#define FORCE_CONFIG_BUTTON_PIN NO_PIN // **** I/O pin, pouzity pro vynuceni konfigurace
|
||||||
|
|
||||||
|
41
src/web.ino
41
src/web.ino
@ -65,28 +65,30 @@ void handleNotFound(AsyncWebServerRequest *request)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
String message;
|
|
||||||
|
|
||||||
message.reserve(1024);
|
|
||||||
|
|
||||||
message = F("Page Not Found\r\n\r\nURI:");
|
|
||||||
message.concat(request->url());
|
|
||||||
message.concat(F("\r\nMethod: "));
|
|
||||||
message.concat((request->method() == HTTP_GET) ? F("GET") : F("POST"));
|
|
||||||
message.concat(F("\r\nParams: "));
|
|
||||||
message.concat(request->params());
|
|
||||||
message.concat(F("\r\n"));
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < request->params(); i++ )
|
|
||||||
{
|
{
|
||||||
AsyncWebParameter *p = request->getParam(i);
|
String message;
|
||||||
message.concat(F(" "));
|
|
||||||
message.concat(p->name());
|
message.reserve(1024);
|
||||||
message.concat(F(": "));
|
|
||||||
message.concat(p->value());
|
message = F("Page Not Found\r\n\r\nURI:");
|
||||||
|
message.concat(request->url());
|
||||||
|
message.concat(F("\r\nMethod: "));
|
||||||
|
message.concat((request->method() == HTTP_GET) ? F("GET") : F("POST"));
|
||||||
|
message.concat(F("\r\nParams: "));
|
||||||
|
message.concat(request->params());
|
||||||
message.concat(F("\r\n"));
|
message.concat(F("\r\n"));
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < request->params(); i++ )
|
||||||
|
{
|
||||||
|
AsyncWebParameter *p = request->getParam(i);
|
||||||
|
message.concat(F(" "));
|
||||||
|
message.concat(p->name());
|
||||||
|
message.concat(F(": "));
|
||||||
|
message.concat(p->value());
|
||||||
|
message.concat(F("\r\n"));
|
||||||
|
}
|
||||||
|
request->send(404, FPSTR(TEXTPLAIN), message);
|
||||||
}
|
}
|
||||||
request->send(404, FPSTR(TEXTPLAIN), message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void www_onUpgrade(AsyncWebServerRequest *request)
|
void www_onUpgrade(AsyncWebServerRequest *request)
|
||||||
@ -189,7 +191,6 @@ void webserver_init(void)
|
|||||||
#ifdef HTTP_UPDATE
|
#ifdef HTTP_UPDATE
|
||||||
httpUpdater.setup(&www);
|
httpUpdater.setup(&www);
|
||||||
#endif
|
#endif
|
||||||
// TRACE_ADDWEB(&www); // ladici stranka
|
|
||||||
#ifdef USE_CRASHDUMP
|
#ifdef USE_CRASHDUMP
|
||||||
www.on("/crash", handleCrash);
|
www.on("/crash", handleCrash);
|
||||||
www.on("/crashclear", handleCrashClear);
|
www.on("/crashclear", handleCrashClear);
|
||||||
|
@ -52,12 +52,16 @@
|
|||||||
|
|
||||||
// Definice obsazeni EEPROM
|
// Definice obsazeni EEPROM
|
||||||
#define elementSize(type, element) sizeof(((type *)0)->element)
|
#define elementSize(type, element) sizeof(((type *)0)->element)
|
||||||
|
#define countof(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
wificonfigarea_t wc; // oblast, vyhrazena pro konfiguraci WiFi
|
wificonfigarea_t wc; // oblast, vyhrazena pro konfiguraci WiFi
|
||||||
// **** sem pokracuji dalsi polozky, ukladane do EEPROM
|
#ifdef USE_CRASHDUMP
|
||||||
|
#warning CRASHDUMP save memory allocated!
|
||||||
} eepromdata_t;
|
uint8_t sc[SAVE_CRASH_SPACE_SIZE]; // misto pro uschovani padu aplikace
|
||||||
|
#endif
|
||||||
|
}eepromconfig_t;
|
||||||
|
|
||||||
#if (LED_PIN != NO_PIN)
|
#if (LED_PIN != NO_PIN)
|
||||||
LED led(LED_PIN, LOW, HIGH);
|
LED led(LED_PIN, LOW, HIGH);
|
||||||
@ -146,7 +150,7 @@ void ICACHE_FLASH_ATTR setup()
|
|||||||
int _fc;
|
int _fc;
|
||||||
|
|
||||||
TRACE_INIT; // inicializace ladeni
|
TRACE_INIT; // inicializace ladeni
|
||||||
EEPROM.begin(sizeof(eepromdata_t) + 10); // zahajujeme praci s EEPROM (10 bytu je jen rezerva)
|
EEPROM.begin(sizeof(eepromconfig_t) + 10); // zahajujeme praci s EEPROM (10 bytu je jen rezerva)
|
||||||
#if (LED_PIN != NO_PIN)
|
#if (LED_PIN != NO_PIN)
|
||||||
led.begin(); // inicializace signalizace
|
led.begin(); // inicializace signalizace
|
||||||
#endif
|
#endif
|
||||||
@ -161,7 +165,7 @@ void ICACHE_FLASH_ATTR setup()
|
|||||||
{
|
{
|
||||||
WiFiConfig wifi; // konfigurace WiFi casti ESP modulu
|
WiFiConfig wifi; // konfigurace WiFi casti ESP modulu
|
||||||
|
|
||||||
if (WCR_OK != wifi.begin(offsetof(eepromdata_t, wc), _fc, 60, wificfgcb)) // startujeme pripojeni
|
if (WCR_OK != wifi.begin(offsetof(eepromconfig_t, wc), _fc, 60, wificfgcb)) // startujeme pripojeni
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
if (ESP.getFlashChipRealSize() > 1000000)
|
if (ESP.getFlashChipRealSize() > 1000000)
|
||||||
@ -188,15 +192,6 @@ void ICACHE_FLASH_ATTR setup()
|
|||||||
TRACE(TRACE_ERROR, F("SPIFFS neni pripojeny!"));
|
TRACE(TRACE_ERROR, F("SPIFFS neni pripojeny!"));
|
||||||
#endif
|
#endif
|
||||||
// Start weboveho serveru - sem je mozno pridavat odkazy na dalsi stranky
|
// Start weboveho serveru - sem je mozno pridavat odkazy na dalsi stranky
|
||||||
|
|
||||||
#ifdef HTTP_UPDATE
|
|
||||||
#ifndef HTTP_UPDATE_USERNAME
|
|
||||||
httpUpdater.setup(&www);
|
|
||||||
#else
|
|
||||||
httpUpdater.setup(&www, _huuser.decrypt(), _hupass.decrypt());
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
webserver_init(); // startujeme webovy server
|
webserver_init(); // startujeme webovy server
|
||||||
vsp_init();
|
vsp_init();
|
||||||
// **** dalsi uzivatelska inicializace
|
// **** dalsi uzivatelska inicializace
|
||||||
|
Loading…
Reference in New Issue
Block a user