mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-03 18:30:39 +08:00
Merge pull request #460 from luc-github/2.1-devt
Fix random webupdate failed on ESP01 due to wrong sketch size
This commit is contained in:
commit
3e9097ff94
@ -166,6 +166,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
String parameter;
|
||||
LOG ("Execute Command\r\n")
|
||||
switch (cmd) {
|
||||
|
||||
//STA SSID
|
||||
//[ESP100]<SSID>[pwd=<admin password>]
|
||||
case 100:
|
||||
@ -281,6 +282,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
//AP SSID
|
||||
//[ESP105]<SSID>[pwd=<admin password>]
|
||||
case 105:
|
||||
@ -1554,6 +1556,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
//Get ESP current status in plain or JSON
|
||||
//[ESP420]<plain>
|
||||
case 420: {
|
||||
@ -1588,6 +1591,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
//[ESP500]<gcode>
|
||||
case 500: { //send GCode with check sum caching right line numbering
|
||||
//be sure serial is locked
|
||||
@ -1872,6 +1876,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
ESPCOM::println (CONFIG::formatBytes (SPIFFS.usedBytes() ).c_str(), output, espresponse);
|
||||
#endif
|
||||
break;
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
//get fw version firmare target and fw version
|
||||
//[ESP800]<header answer>
|
||||
case 800: {
|
||||
@ -1945,6 +1950,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
ESPCOM::println ("", output, espresponse);
|
||||
}
|
||||
break;
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
//get fw target
|
||||
//[ESP801]<header answer>
|
||||
case 801:
|
||||
@ -1985,7 +1991,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
default:
|
||||
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
||||
response = false;
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
//version and sources location
|
||||
#define FW_VERSION "2.1.1.b6"
|
||||
#define FW_VERSION "2.1.1.b7"
|
||||
#define REPOSITORY "https://github.com/luc-github/ESP3D"
|
||||
|
||||
//Customize ESP3D ////////////////////////////////////////////////////////////////////////
|
||||
@ -36,9 +36,15 @@
|
||||
//like ESP_XXXXXX (eg:ESP_028E41) to avoid overlap if several ESP3D
|
||||
#define ESP_HOST_NAME ESP_DEFAULT_NAME
|
||||
|
||||
//To allow webupdate using small updater
|
||||
//#define USE_AS_UPDATER_ONLY
|
||||
|
||||
//FEATURES - comment to disable //////////////////////////////////////////////////////////
|
||||
|
||||
//WEB_UPDATE_FEATURE: allow to flash fw using web UI
|
||||
#define WEB_UPDATE_FEATURE
|
||||
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
//Do we use async webserver or not (currntly deprecated do not enable it yet)
|
||||
//#define ASYNCWEBSERVER
|
||||
|
||||
@ -62,14 +68,11 @@
|
||||
#define SSDP_FEATURE
|
||||
|
||||
//NETBIOS_FEATURE: this feature is a discovery protocol, supported on Windows out of the box
|
||||
#define NETBIOS_FEATURE
|
||||
//#define NETBIOS_FEATURE
|
||||
|
||||
//CAPTIVE_PORTAL_FEATURE: In SoftAP redirect all unknow call to main page
|
||||
#define CAPTIVE_PORTAL_FEATURE
|
||||
|
||||
//WEB_UPDATE_FEATURE: allow to flash fw using web UI
|
||||
#define WEB_UPDATE_FEATURE
|
||||
|
||||
//RECOVERY_FEATURE: allow to use GPIO2 pin as hardware reset for EEPROM, add 8s to boot time to let user to jump GPIO2 to GND
|
||||
//#define RECOVERY_FEATURE
|
||||
|
||||
@ -90,7 +93,7 @@
|
||||
|
||||
//TIMESTAMP_FEATURE: Time stamp feature on direct SD files
|
||||
//#define TIMESTAMP_FEATURE
|
||||
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
//Extra features /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Workaround for Marlin 2.X coldstart
|
||||
|
@ -745,22 +745,21 @@ void WebUpdateUpload()
|
||||
#endif
|
||||
size_t flashsize = 0;
|
||||
#if defined ( ARDUINO_ARCH_ESP8266)
|
||||
flashsize = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
|
||||
maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
|
||||
#else
|
||||
|
||||
if (esp_ota_get_running_partition()) {
|
||||
const esp_partition_t* partition = esp_ota_get_next_update_partition(NULL);
|
||||
if (partition) {
|
||||
flashsize = partition->size;
|
||||
maxSketchSpace = partition->size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ((web_interface->web_server).hasArg (sizeargname.c_str()) ) {
|
||||
maxSketchSpace = (web_interface->web_server).arg (sizeargname).toInt();
|
||||
flashsize = (web_interface->web_server).arg (sizeargname).toInt();
|
||||
} else {
|
||||
maxSketchSpace = flashsize;
|
||||
flashsize = maxSketchSpace;
|
||||
}
|
||||
if ((flashsize > flashsize) || (flashsize == 0)) {
|
||||
if ((flashsize > maxSketchSpace) || (flashsize == 0)) {
|
||||
web_interface->_upload_status=UPLOAD_STATUS_FAILED;
|
||||
pushError(ESP_ERROR_NOT_ENOUGH_SPACE, "Upload rejected");
|
||||
}
|
||||
@ -1178,6 +1177,7 @@ void handle_web_command_silent()
|
||||
//Serial SD files list//////////////////////////////////////////////////
|
||||
void handle_serial_SDFileList()
|
||||
{
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
//this is only for admin an user
|
||||
if (web_interface->is_authenticated() == LEVEL_GUEST) {
|
||||
web_interface->_upload_status=UPLOAD_STATUS_NONE;
|
||||
@ -1197,6 +1197,7 @@ void handle_serial_SDFileList()
|
||||
web_interface->web_server.send(200, "application/json", jsonfile);
|
||||
web_interface->blockserial = false;
|
||||
web_interface->_upload_status=UPLOAD_STATUS_NONE;
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
}
|
||||
|
||||
#define NB_RETRY 5
|
||||
@ -1205,6 +1206,7 @@ void handle_serial_SDFileList()
|
||||
//SD file upload by serial
|
||||
void SDFile_serial_upload()
|
||||
{
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
static int32_t lineNb =-1;
|
||||
static String current_line;
|
||||
static bool is_comment = false;
|
||||
@ -1374,6 +1376,7 @@ void SDFile_serial_upload()
|
||||
CloseSerialUpload (true, current_filename, lineNb);
|
||||
cancelUpload();
|
||||
}
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -73,6 +73,8 @@
|
||||
|
||||
long id_connection = 0;
|
||||
|
||||
#ifndef USE_AS_UPDATER_ONLY
|
||||
|
||||
uint8_t Checksum(const char * line, uint16_t lineSize)
|
||||
{
|
||||
uint8_t checksum_val =0;
|
||||
@ -290,7 +292,7 @@ void CloseSerialUpload (bool iserror, String & filename, int32_t linenb)
|
||||
purge_serial();
|
||||
web_interface->blockserial = false;
|
||||
}
|
||||
|
||||
#endif //USE_AS_UPDATER_ONLY
|
||||
|
||||
//constructor
|
||||
WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port) : web_server (port)
|
||||
|
Loading…
x
Reference in New Issue
Block a user