diff --git a/.travis.yml b/.travis.yml index 360222d..ecf4252 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,10 @@ install: before_script: - platformio update + - cd $TRAVIS_BUILD_DIR - git clone -b bugfix-2.0.x https://github.com/MarlinFirmware/Marlin.git Marlin - cd Marlin + - sed -i "s/default_envs = mega2560/default_envs = esp32/g" ./platformio.ini - sed -i "s/#define WIFISUPPORT/\/\/#define WIFISUPPORT/g" ./Marlin/Configuration_adv.h - sed -i "s/\/\/#define ESP3D_WIFISUPPORT/#define ESP3D_WIFISUPPORT/g" ./Marlin/Configuration_adv.h - sed -i "s/\/\/#define WEBSUPPORT/#define WEBSUPPORT/g" ./Marlin/Configuration_adv.h @@ -28,8 +30,12 @@ before_script: - sed -i "s/\/\/#define CUSTOM_COMMAND/#define CUSTOM_COMMAND/g" ./Marlin/Configuration_adv.h - sed -i "s/#define MOTHERBOARD BOARD_RAMPS_14_EFB/#define MOTHERBOARD BOARD_MRR_ESPE/g" ./Marlin/Configuration.h - cat ./Marlin/Configuration.h + - cp $TRAVIS_BUILD_DIR/extra_script.py . script: - - platformio run -e esp32 + - platformio run -e esp32 || true + - rm -fr $TRAVIS_BUILD_DIR/Marlin/.pio/libdeps/esp32/ESP3DLib/src + - cp -r $TRAVIS_BUILD_DIR/src $TRAVIS_BUILD_DIR/Marlin/.pio/libdeps/esp32/ESP3DLib/ + - platformio run -e esp32 notifications: email: diff --git a/extra_script.py b/extra_script.py new file mode 100644 index 0000000..938f3fb --- /dev/null +++ b/extra_script.py @@ -0,0 +1,4 @@ +import shutil +shutil.rmtree("$TRAVIS_BUILD_DIR/Marlin/.pio/libdeps/esp32/ESP3DLib/src") +shutil.copytree("$TRAVIS_BUILD_DIR/src", "$TRAVIS_BUILD_DIR/Marlin/.pio/libdeps/esp32/ESP3DLib/") +print("Update ESP3DLib files") diff --git a/library.properties b/library.properties index 0630d2f..a9ab51e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP3DLib -version=1.0.0 +version=1.0.8 author=Luc Lebosse maintainer=Luc Lebosse, sentence=A 3D printer front end for ESP boards. diff --git a/src/command.cpp b/src/command.cpp index 6ddcbf2..8aa46fb 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -36,6 +36,7 @@ #include #endif //HTTP_FEATURE #include "serial2socket.h" +#include #include MARLIN_PATH(inc/Version.h) String COMMAND::get_param (String & cmd_params, const char * id, bool withspace) @@ -1208,12 +1209,18 @@ bool COMMAND::execute_internal_command (int cmd, String cmd_params, level_authen espresponse->print (ESPResponseStream::formatBytes (ESP.getFlashChipSize()).c_str()); espresponse->print ("\n"); espresponse->print ("Available Size for update: "); - //Not OTA on 2Mb board per spec - if (ESP.getFlashChipSize() > 0x20000) { - espresponse->print (ESPResponseStream::formatBytes (0x140000).c_str()); - } else { - espresponse->print (ESPResponseStream::formatBytes (0x0).c_str()); + size_t flashsize = 0; + const esp_partition_t* mainpartition = esp_ota_get_running_partition(); + if (mainpartition) { + const esp_partition_t* partition = esp_ota_get_next_update_partition(mainpartition); + if (partition) { + const esp_partition_t* partition2 = esp_ota_get_next_update_partition(partition); + if (partition2 && (partition->address!=partition2->address)) { + flashsize = partition2->size; + } + } } + espresponse->print (ESPResponseStream::formatBytes (flashsize).c_str()); espresponse->print ("\n"); espresponse->print ("Available Size for SPIFFS: "); espresponse->print (ESPResponseStream::formatBytes (SPIFFS.totalBytes()).c_str()); diff --git a/src/esp3dlib.cpp b/src/esp3dlib.cpp index 4ab7745..f6e3648 100644 --- a/src/esp3dlib.cpp +++ b/src/esp3dlib.cpp @@ -58,11 +58,11 @@ void Esp3DLib::init() xTaskCreatePinnedToCore( ESP3DLibTaskfn, /* Task function. */ "ESP3DLib Task", /* name of task. */ - 10000, /* Stack size of task */ + 8192, /* Stack size of task */ NULL, /* parameter of the task */ ESP3DLIB_RUNNING_PRIORITY, /* priority of the task */ NULL, /* Task handle to keep track of created task */ - ESP3DLIB_RUNNING_CORE /* Core to run the task */ + ESP3DLIB_RUNNING_CORE /* Core to run the task */ ); } //Parse command diff --git a/src/esp3dlibconfig.cpp b/src/esp3dlibconfig.cpp index 22a2140..f9bbd0d 100644 --- a/src/esp3dlibconfig.cpp +++ b/src/esp3dlibconfig.cpp @@ -38,14 +38,8 @@ bool Esp3DLibConfig::restart_ESP_module = false; */ void Esp3DLibConfig::wait(uint32_t milliseconds) { - uint32_t timeout = millis(); - vTaskDelay(1 / portTICK_RATE_MS); // Yield to other tasks esp_task_wdt_reset(); //for a wait 0; - //wait feeding WDT - while ( (millis() - timeout) < milliseconds) { - esp_task_wdt_reset(); - vTaskDelay(1 / portTICK_RATE_MS); // Yield to other tasks - } + vTaskDelay((milliseconds>0?milliseconds:1) / portTICK_RATE_MS); // Yield to other tasks } /** diff --git a/src/esp3dlibconfig.h b/src/esp3dlibconfig.h index ea13309..b9ec66e 100644 --- a/src/esp3dlibconfig.h +++ b/src/esp3dlibconfig.h @@ -28,15 +28,15 @@ #undef DISABLED #undef _BV //version -#define LIB_VERSION "1.0.7" +#define LIB_VERSION "1.0.8" //Allow to override the default core used by ESP3DLIB -#ifndef ESP3DLIB_RUNNING_CORE +#ifndef ESP3DLIB_RUNNING_CORE #define ESP3DLIB_RUNNING_CORE 0 #endif //ESP3DLIB_RUNNING_CORE //Allow to override the default priority task used by ESP3DLIB_RUNNING_PRIORITY -#ifndef ESP3DLIB_RUNNING_PRIORITY +#ifndef ESP3DLIB_RUNNING_PRIORITY #define ESP3DLIB_RUNNING_PRIORITY 1 #endif //ESP3DLIB_RUNNING_PRIORITY diff --git a/src/espcom.cpp b/src/espcom.cpp index d805da4..858f7c0 100644 --- a/src/espcom.cpp +++ b/src/espcom.cpp @@ -26,7 +26,16 @@ #if HAS_GRAPHICAL_LCD #include #endif +//for 2.0.x +#if defined __has_include +#if __has_include (MARLIN_PATH(lcd/ultralcd.h)) #include MARLIN_PATH(lcd/ultralcd.h) +#endif +//for bugfix-2.0.x +#if __has_include (MARLIN_PATH(lcd/marlinui.h)) +#include MARLIN_PATH(lcd/marlinui.h) +#endif +#endif #include "espcom.h" #if defined(HTTP_FEATURE) #include @@ -35,11 +44,13 @@ void Esp3DCom::echo(const char * data) { SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("", data); +#if HAS_DISPLAY if (strlen(data)) { ui.set_status(data); } else { ui.reset_status(); } +#endif //HAS_DISPLAY } long ESPResponseStream::baudRate() { diff --git a/src/web_server.cpp b/src/web_server.cpp index ff12f26..4d18016 100644 --- a/src/web_server.cpp +++ b/src/web_server.cpp @@ -1160,10 +1160,14 @@ void Web_Server::WebUpdateUpload () } //check space size_t flashsize = 0; - if (esp_ota_get_running_partition()) { - const esp_partition_t* partition = esp_ota_get_next_update_partition(NULL); + const esp_partition_t* mainpartition = esp_ota_get_running_partition(); + if (mainpartition) { + const esp_partition_t* partition = esp_ota_get_next_update_partition(mainpartition); if (partition) { - flashsize = partition->size; + const esp_partition_t* partition2 = esp_ota_get_next_update_partition(partition); + if (partition2 && (partition->address!=partition2->address)) { + flashsize = partition2->size; + } } } if (flashsize < maxSketchSpace) {