Connecting to: XXX.s3.amazonaws.com
Fetching Bin: /XXX.littlefs.bin
Got application/octet-stream payload.
Got 1507328 bytes from server
contentLength : 1507328, isValidContentType : 1
Not enough space to begin OTA
I'm starting on this subject, probably something went unnoticed.
I imagine it should have this file size.
Can someone help me?
- void execOTA() {
- Serial.println("Connecting to: " + String(host));
- if (ota_h_client.connect(host.c_str(), port)) {
- Serial.println("Fetching Bin: " + String(bin2));
- ota_h_client.print(String("GET ") + bin2 + " HTTP/1.1\r\n" +
- "Host: " + host + "\r\n" +
- "Cache-Control: no-cache\r\n" +
- "Connection: close\r\n\r\n");
- unsigned long timeout = millis();
- while (ota_h_client.available() == 0) {
- if (millis() - timeout > 5000) {
- Serial.println("Client Timeout !");
- ota_h_client.stop();
- return;
- }
- }
- while (ota_h_client.available()) {
- String line = ota_h_client.readStringUntil('\n');
- line.trim();
- if (!line.length()) {
- break;
- }
- if (line.startsWith("HTTP/1.1")) {
- if (line.indexOf("200") < 0) {
- Serial.println("Got a non 200 status code from server. Exiting OTA Update.");
- break;
- }
- }
- if (line.startsWith("Content-Length: ")) {
- contentLength = atol((getHeaderValue(line, "Content-Length: ")).c_str());
- Serial.println("Got " + String(contentLength) + " bytes from server");
- }
- if (line.startsWith("Content-Type: ")) {
- String contentType = getHeaderValue(line, "Content-Type: ");
- Serial.println("Got " + contentType + " payload.");
- if (contentType == "application/octet-stream") {
- isValidContentType = true;
- }
- }
- }
- } else {
- Serial.println("Connection to " + String(host) + " failed. Please check your setup");
- }
- Serial.println("contentLength : " + String(contentLength) + ", isValidContentType : " + String(isValidContentType));
- if (contentLength && isValidContentType) {
- bool canBegin = Update.begin(contentLength);
- if (canBegin) {
- Serial.println("Begin OTA. This may take 2 - 5 mins to complete. Things might be quite for a while.. Patience!");
- size_t written = Update.writeStream(ota_h_client);
- if (written == contentLength) {
- Serial.println("Written : " + String(written) + " successfully");
- } else {
- Serial.println("Written only : " + String(written) + "/" + String(contentLength) + ". Retry?" );
- }
- if (Update.end()) {
- Serial.println("OTA done!");
- if (Update.isFinished()) {
- Serial.println("Update successfully completed. Rebooting.");
- ESP.restart();
- } else {
- Serial.println("Update not finished? Something went wrong!");
- }
- } else {
- Serial.println("Error Occurred. Error #: " + String(Update.getError()));
- }
- } else {
- Serial.println("Not enough space to begin OTA");
- ota_h_client.flush();
- }
- } else {
- Serial.println("There was no content in the response");
- ota_h_client.flush();
- }
- }
Using partition scheme from Arduino IDE.
Start: 0x290000
Size : 0x170000
mklittlefs : C:\Users\Rulio\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\tools\mklittlefs.exe
esptool : C:\Users\Rulio\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\3.0.0\esptool.exe
[LittleFS] data : C:\Users\Rulio\Documents\Rulio compartilhada\XXX\data
[LittleFS] offset : 0
[LittleFS] start : 2686976
[LittleFS] size : 1472
[LittleFS] page : 256
[LittleFS] block : 4096
->/787.chunk.js
->/787.chunk.js.map
->/afira_logo2..png
->/asset-manifest.json
->/index.html
->/main.css
->/main.css.map
->/main.js
->/main.js.LICENSE.txt
->/main.js.map
->/manifest.json
->/robots.txt
[LittleFS] upload : C:\Users\Rulio\AppData\Local\Temp\arduino_build_454786/XXX.littlefs.bin
[LittleFS] address: 2686976
[LittleFS] port : COM14
[LittleFS] speed : 921600
[LittleFS] mode : dio
[LittleFS] freq : 80m
->esptool.py v3.0-dev
->Serial port COM14