diff --git a/.gitignore b/.gitignore index eac47ff6..a8cd17da 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ .git .pio data/* +!data/edit.htm +!data/edit.htm.gz src/user_setups/active/* include/user_config_override.h src/user_config_override.h diff --git a/data/edit.htm b/data/edit.htm new file mode 100644 index 00000000..9e655932 --- /dev/null +++ b/data/edit.htm @@ -0,0 +1,437 @@ + + + + + + File Browser + + + + + + +
+
+
+ + + + \ No newline at end of file diff --git a/data/edit.htm.gz b/data/edit.htm.gz new file mode 100644 index 00000000..d9519e4a Binary files /dev/null and b/data/edit.htm.gz differ diff --git a/platformio.ini b/platformio.ini index c2fffdad..81234770 100644 --- a/platformio.ini +++ b/platformio.ini @@ -96,7 +96,9 @@ board_upload.flash_size=4MB board_upload.maximum_size = 4194304 board_build.partitions = user_setups/esp32/partition_app1704k_spiffs720k.csv board_build.filesystem = littlefs - +board_build.embed_files = + data/edit.htm.gz + ; ----- crash reporter monitor_filters = esp32_exception_decoder diff --git a/src/hasp/hasp_dispatch.h b/src/hasp/hasp_dispatch.h index 270f600c..2748858c 100644 --- a/src/hasp/hasp_dispatch.h +++ b/src/hasp/hasp_dispatch.h @@ -59,6 +59,7 @@ void dispatch_web_update(const char*, const char* espOtaUrl); void dispatch_statusupdate(const char*, const char*); void dispatch_idle(const char*, const char*); void dispatch_calibrate(const char*, const char*); +void dispatch_wakeup(const char*, const char*); void dispatch_gpio_input_event(uint8_t pin, uint8_t group, uint8_t eventid); diff --git a/src/sys/svc/hasp_http.cpp b/src/sys/svc/hasp_http.cpp index 6233f85d..0fcd0da7 100644 --- a/src/sys/svc/hasp_http.cpp +++ b/src/sys/svc/hasp_http.cpp @@ -94,6 +94,8 @@ ESP8266WebServer webServer(80); #include #include WebServer webServer(80); +extern const uint8_t EDIT_HTM_GZ_START[] asm("_binary_data_edit_htm_gz_start"); +extern const uint8_t EDIT_HTM_GZ_END[] asm("_binary_data_edit_htm_gz_end"); #endif // ESP32 HTTPUpload* upload; @@ -901,7 +903,15 @@ bool handleFileRead(String path) file.close(); return true; } + +#ifdef ARDUINO_ARCH_ESP32 + size_t size = EDIT_HTM_GZ_END - EDIT_HTM_GZ_START; + webServer.sendHeader(F("Content-Encoding"), F("gzip")); + webServer.send_P(200, PSTR("text/html"), (const char*)EDIT_HTM_GZ_START, size); + return true; +#else return false; +#endif } void handleFileUpload() @@ -998,11 +1008,18 @@ void handleFileCreate() } } if(webServer.hasArg(F("init"))) { + dispatch_wakeup(NULL, NULL); hasp_init(); } if(webServer.hasArg(F("load"))) { + dispatch_wakeup(NULL, NULL); hasp_load_json(); } + if(webServer.hasArg(F("page"))) { + uint8_t pageid = atoi(webServer.arg(F("page")).c_str()); + dispatch_wakeup(NULL, NULL); + dispatch_set_page(pageid, LV_SCR_LOAD_ANIM_NONE); + } webServer.send(200, PSTR("text/plain"), ""); }