[GH-ISSUE #1154] size of the lib #988

Open
opened 2026-02-28 01:27:59 +03:00 by kerem · 39 comments
Owner

Originally created by @sebosfato on GitHub (Nov 30, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1154

Hello i was using old version of the lib and it was only for esp8266 i guess and it consumed 40kb less memory from my esp01 very small memory available.. upon moving to new updated lib with non blocking function it dont fit within the memory with enough space left for httpupdate...

my question is there a way to edit the lib for use separete for esp8266 from esp32 or perhaps reduce the size of the wifi signal streght image to fit ?

anybody help please?

Originally created by @sebosfato on GitHub (Nov 30, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1154 Hello i was using old version of the lib and it was only for esp8266 i guess and it consumed 40kb less memory from my esp01 very small memory available.. upon moving to new updated lib with non blocking function it dont fit within the memory with enough space left for httpupdate... my question is there a way to edit the lib for use separete for esp8266 from esp32 or perhaps reduce the size of the wifi signal streght image to fit ? anybody help please?
Author
Owner

@Daemach commented on GitHub (Nov 30, 2020):

FWIW - just noticed this on gitter: https://www.screencast.com/t/nlFyjjfUX

On Mon, Nov 30, 2020 at 3:14 PM sebosfato notifications@github.com wrote:

Hello i was using old version of the lib and it was only for esp8266 i
guess and it consumed 40kb less memory from my esp01 very small memory
available.. upon moving to new updated lib with non blocking function it
dont fit within the memory with enough space left for httpupdate...

my question is there a way to edit the lib for use separete for esp8266
from esp32 or perhaps reduce the size of the wifi signal streght image to
fit ?

anybody help please?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/1154, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC7Y5YJH5CYRM24OR5QJMFLSSQRN3ANCNFSM4UIHG4DA
.

<!-- gh-comment-id:736117771 --> @Daemach commented on GitHub (Nov 30, 2020): FWIW - just noticed this on gitter: https://www.screencast.com/t/nlFyjjfUX On Mon, Nov 30, 2020 at 3:14 PM sebosfato <notifications@github.com> wrote: > Hello i was using old version of the lib and it was only for esp8266 i > guess and it consumed 40kb less memory from my esp01 very small memory > available.. upon moving to new updated lib with non blocking function it > dont fit within the memory with enough space left for httpupdate... > > my question is there a way to edit the lib for use separete for esp8266 > from esp32 or perhaps reduce the size of the wifi signal streght image to > fit ? > > anybody help please? > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/1154>, or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AC7Y5YJH5CYRM24OR5QJMFLSSQRN3ANCNFSM4UIHG4DA> > . >
Author
Owner

@sebosfato commented on GitHub (Dec 1, 2020):

FWIW - just noticed this on gitter: https://www.screencast.com/t/nlFyjjfUX

you mean could be possible to update from a compressed file?

i tried to delete all the esp32 ifdef elif etc from the cpp file but didnt reduced much, it seems to me that the main alternatives would be to reduce the size of the png file or maybe delete the debug options... those seems to be related to this great increase in size of the lib... when i tried to delete the debug lines it broke the code..

<!-- gh-comment-id:736148500 --> @sebosfato commented on GitHub (Dec 1, 2020): > FWIW - just noticed this on gitter: https://www.screencast.com/t/nlFyjjfUX you mean could be possible to update from a compressed file? i tried to delete all the esp32 ifdef elif etc from the cpp file but didnt reduced much, it seems to me that the main alternatives would be to reduce the size of the png file or maybe delete the debug options... those seems to be related to this great increase in size of the lib... when i tried to delete the debug lines it broke the code..
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

Nice I have been meaning to look into gzip, at least for the css.

I can see what I can remove, I am going to make the info details optional or reduce them back down, and fix up debug environment (for prod) to not always compile, some of the css can be reduced and you can remove the icons

I would not even consider running this on an 01
But I will make a branch and take a look

<!-- gh-comment-id:736186792 --> @tablatronix commented on GitHub (Dec 1, 2020): Nice I have been meaning to look into gzip, at least for the css. I can see what I can remove, I am going to make the info details optional or reduce them back down, and fix up debug environment (for prod) to not always compile, some of the css can be reduced and you can remove the icons I would not even consider running this on an 01 But I will make a branch and take a look
Author
Owner

@sebosfato commented on GitHub (Dec 1, 2020):

Would be lovely to use it with the 01... the older version even run but if i get over 406kb of sketch space the http update wont run... im using it at the limit of space... counting variables to try reduce it...

i think that wifi signal strenght icon could be reduced with no loss in apearance maybe

thanks in advance for developing all this!

<!-- gh-comment-id:736195270 --> @sebosfato commented on GitHub (Dec 1, 2020): Would be lovely to use it with the 01... the older version even run but if i get over 406kb of sketch space the http update wont run... im using it at the limit of space... counting variables to try reduce it... i think that wifi signal strenght icon could be reduced with no loss in apearance maybe thanks in advance for developing all this!
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

Nah I already optimized the sprite png, svg was larger. But I am open to optimizations, or ascii?

I also added some public helpers, which many might not need, I can wrap those in a light define to remove them

<!-- gh-comment-id:736506283 --> @tablatronix commented on GitHub (Dec 1, 2020): Nah I already optimized the sprite png, svg was larger. But I am open to optimizations, or ascii? I also added some public helpers, which many might not need, I can wrap those in a light define to remove them
Author
Owner

@Daemach commented on GitHub (Dec 1, 2020):

Should try that gzip method for the best across-the-board results... It
looks like the simplest solution based on that forum post. And it will get
lost soon as gitter is an active board.

On Tue, Dec 1, 2020 at 3:57 AM Shawn A notifications@github.com wrote:

Nah I already optimized the sprite png, svg was larger. But I am open to
optimizations, or ascii?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/1154#issuecomment-736506283,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC7Y5YJA65HU6NGXB7TSVVLSSTKZHANCNFSM4UIHG4DA
.

<!-- gh-comment-id:736509074 --> @Daemach commented on GitHub (Dec 1, 2020): Should try that gzip method for the best across-the-board results... It looks like the simplest solution based on that forum post. And it will get lost soon as gitter is an active board. On Tue, Dec 1, 2020 at 3:57 AM Shawn A <notifications@github.com> wrote: > Nah I already optimized the sprite png, svg was larger. But I am open to > optimizations, or ascii? > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/1154#issuecomment-736506283>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AC7Y5YJA65HU6NGXB7TSVVLSSTKZHANCNFSM4UIHG4DA> > . >
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

The main issue is that alot of the code is templated and dynamic, not much is actually static

<!-- gh-comment-id:736512697 --> @tablatronix commented on GitHub (Dec 1, 2020): The main issue is that alot of the code is templated and dynamic, not much is actually static
Author
Owner

@sebosfato commented on GitHub (Dec 1, 2020):

in the mean while i found some few special kilobytes reduction by setting the iwipvariants to high bandwidth no features.. do you know guys what features are this? could not find documentation about

my sketch varies from 412k with to 402k with no features...

I think most of the increase of the lib size may be the debug function that is being compiled together... if we could simply deactivate the debug stuff from being compiled would turn out very much smaller...

the original wifimanager cpp i was using had 22kb the new had 90kb
taking all the esp32 configurations only released 10kb... so i think the diference may be the debug...

just my guess

<!-- gh-comment-id:736528688 --> @sebosfato commented on GitHub (Dec 1, 2020): in the mean while i found some few special kilobytes reduction by setting the iwipvariants to high bandwidth no features.. do you know guys what features are this? could not find documentation about my sketch varies from 412k with to 402k with no features... I think most of the increase of the lib size may be the debug function that is being compiled together... if we could simply deactivate the debug stuff from being compiled would turn out very much smaller... the original wifimanager cpp i was using had 22kb the new had 90kb taking all the esp32 configurations only released 10kb... so i think the diference may be the debug... just my guess
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

That is a good question, I am not sure about the new lwip variants, quick search found not much info

<!-- gh-comment-id:736578570 --> @tablatronix commented on GitHub (Dec 1, 2020): That is a good question, I am not sure about the new lwip variants, quick search found not much info
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

I moved all debug strings to flash, there were some that were not still
And added some testing for no debug
Testing basic.ino, not sure a 1-2% was worth it, I will look for another 1-2% by removing helper functions that are not internally used, you can also remove the help section, a few kb, the icons are negligible, 150kb maybe, you can easily just comment those out in the strings file and see if it helps

BEFORE
RAM: [==== ] 35.9% (used 29392 bytes from 81920 bytes)
Flash: [=== ] 31.9% (used 333456 bytes from 1044464 bytes)

AFTER

RAM: [=== ] 34.7% (used 28464 bytes from 81920 bytes)
Flash: [=== ] 31.8% (used 332580 bytes from 1044464 bytes)

WM_NODEBUG
RAM: [=== ] 34.7% (used 28416 bytes from 81920 bytes)
Flash: [=== ] 30.9% (used 322744 bytes from 1044464 bytes)

<!-- gh-comment-id:736727051 --> @tablatronix commented on GitHub (Dec 1, 2020): I moved all debug strings to flash, there were some that were not still And added some testing for no debug Testing basic.ino, not sure a 1-2% was worth it, I will look for another 1-2% by removing helper functions that are not internally used, you can also remove the help section, a few kb, the icons are negligible, 150kb maybe, you can easily just comment those out in the strings file and see if it helps **BEFORE** RAM: [==== ] 35.9% (used 29392 bytes from 81920 bytes) Flash: [=== ] 31.9% (used 333456 bytes from 1044464 bytes) **AFTER** RAM: [=== ] 34.7% (used 28464 bytes from 81920 bytes) Flash: [=== ] 31.8% (used 332580 bytes from 1044464 bytes) **_WM_NODEBUG_** RAM: [=== ] 34.7% (used 28416 bytes from 81920 bytes) Flash: [=== ] 30.9% (used 322744 bytes from 1044464 bytes)
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

Master

RAM: [==== ] 35.5% (used 29052 bytes from 81920 bytes)
Flash: [=== ] 28.1% (used 293260 bytes from 1044464 bytes)

Where are you getting your numbers from , cpp filesize is irrelevant, its not compiled and includes esp32

<!-- gh-comment-id:736798946 --> @tablatronix commented on GitHub (Dec 1, 2020): Master RAM: [==== ] 35.5% (used 29052 bytes from 81920 bytes) Flash: [=== ] 28.1% (used 293260 bytes from 1044464 bytes) Where are you getting your numbers from , cpp filesize is irrelevant, its not compiled and includes esp32
Author
Owner

@sebosfato commented on GitHub (Dec 1, 2020):

when i compile with the new alpha version it come out with 438kb and with the old one 410..

something is going wrong with the updates... thats why i was trying to reduce things without loosing functionality

my 01 is 1mb so it should be able to get updates up to 470kb doesnt it?

what could be going wrong?

spiffs aparently update well but not the sketch it fails and reboot

using nodemcu for same file works well.. i was trying with the 01 cause is much cheaper

<!-- gh-comment-id:736811594 --> @sebosfato commented on GitHub (Dec 1, 2020): when i compile with the new alpha version it come out with 438kb and with the old one 410.. something is going wrong with the updates... thats why i was trying to reduce things without loosing functionality my 01 is 1mb so it should be able to get updates up to 470kb doesnt it? what could be going wrong? spiffs aparently update well but not the sketch it fails and reboot using nodemcu for same file works well.. i was trying with the 01 cause is much cheaper
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

What all are you loading ? Additional libraries?

<!-- gh-comment-id:736824775 --> @tablatronix commented on GitHub (Dec 1, 2020): What all are you loading ? Additional libraries?
Author
Owner

@sebosfato commented on GitHub (Dec 1, 2020):

Im using lots of libraries, let me show you

#include <FS.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#include <ESP_EEPROM.h>
#include <WiFiUdp.h>
#include <WiFiManager.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <NTPClient.h>
#include <TaskScheduler.h>
#include <RTCVars.h>
#include "SAVE.h"
#include "SERVERON.h"
//#define ATOMIC_FS_UPDATE
RTCVars state;

each is needed by a function called in the messy code...

and the code is more than 1000 lines long...

<!-- gh-comment-id:736837682 --> @sebosfato commented on GitHub (Dec 1, 2020): Im using lots of libraries, let me show you #include <FS.h> #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266HTTPClient.h> #include <ESP8266httpUpdate.h> #include <ESP_EEPROM.h> #include <WiFiUdp.h> #include <WiFiManager.h> #include <ESP8266mDNS.h> #include <ESP8266WebServer.h> #include <DNSServer.h> #include <NTPClient.h> #include <TaskScheduler.h> #include <RTCVars.h> #include "SAVE.h" #include "SERVERON.h" //#define ATOMIC_FS_UPDATE RTCVars state; each is needed by a function called in the messy code... and the code is more than 1000 lines long...
Author
Owner

@tablatronix commented on GitHub (Dec 1, 2020):

28K more ?
I have no idea , are you using params?

<!-- gh-comment-id:736884049 --> @tablatronix commented on GitHub (Dec 1, 2020): 28K more ? I have no idea , are you using params?
Author
Owner

@sebosfato commented on GitHub (Dec 2, 2020):

from the wifimanager lib im using
the wm.autoconnect on demand non blocking and set timeout
and there is a function to be called to call the wifi portal by the user
also the acess point have names on it... is this the parameters?

wm gives a lot of debuging info on the serial monitor... maybe thats whats calling so much memory on the new version
it may be interesting to know whats is going but perhaps would work even better lighter =)

i found that taking printf comands out takes some bits out...

<!-- gh-comment-id:736909392 --> @sebosfato commented on GitHub (Dec 2, 2020): from the wifimanager lib im using the wm.autoconnect on demand non blocking and set timeout and there is a function to be called to call the wifi portal by the user also the acess point have names on it... is this the parameters? wm gives a lot of debuging info on the serial monitor... maybe thats whats calling so much memory on the new version it may be interesting to know whats is going but perhaps would work even better lighter =) i found that taking printf comands out takes some bits out...
Author
Owner

@tablatronix commented on GitHub (Dec 2, 2020):

I already removed the debug as I stated above, it should save you like 11k
You will have to use the github version

<!-- gh-comment-id:736972077 --> @tablatronix commented on GitHub (Dec 2, 2020): I already removed the debug as I stated above, it should save you like 11k You will have to use the github version
Author
Owner

@tablatronix commented on GitHub (Dec 2, 2020):

2k more if I remove vector

<!-- gh-comment-id:736979344 --> @tablatronix commented on GitHub (Dec 2, 2020): 2k more if I remove vector
Author
Owner

@sebosfato commented on GitHub (Dec 2, 2020):

with the new version you changed i tried and it reduced from 430 to 427 kb size of the ino.bin file its great already because it dont show those parameters at startup...

<!-- gh-comment-id:737333631 --> @sebosfato commented on GitHub (Dec 2, 2020): with the new version you changed i tried and it reduced from 430 to 427 kb size of the ino.bin file its great already because it dont show those parameters at startup...
Author
Owner

@tablatronix commented on GitHub (Dec 2, 2020):

Is that with or without debugging ?

WM_NODEBUG

<!-- gh-comment-id:737363709 --> @tablatronix commented on GitHub (Dec 2, 2020): Is that with or without debugging ? WM_NODEBUG
Author
Owner

@tablatronix commented on GitHub (Dec 2, 2020):

I am about to merge in OTA, I hope it doesn't make it that much bigger... lol

<!-- gh-comment-id:737369109 --> @tablatronix commented on GitHub (Dec 2, 2020): I am about to merge in OTA, I hope it doesn't make it that much bigger... lol
Author
Owner

@sebosfato commented on GitHub (Dec 2, 2020):

Is that with or without debugging ?

WM_NODEBUG

i tried this wm.setDebugOutput(false); how do you set this wm_nodebug?

<!-- gh-comment-id:737534316 --> @sebosfato commented on GitHub (Dec 2, 2020): > Is that with or without debugging ? > > WM_NODEBUG i tried this wm.setDebugOutput(false); how do you set this wm_nodebug?
Author
Owner

@tablatronix commented on GitHub (Dec 2, 2020):

Are you using arduino? You might have to edit the .h file and add it. In pio you can add it to build flags. For now debug is enabled for dev reasons

<!-- gh-comment-id:737551916 --> @tablatronix commented on GitHub (Dec 2, 2020): Are you using arduino? You might have to edit the .h file and add it. In pio you can add it to build flags. For now debug is enabled for dev reasons
Author
Owner

@sebosfato commented on GitHub (Dec 3, 2020):

im using the last arduino ide

esp 01 im trying to add to see what happens i tried #define WM_NODEBUG nothing changed

<!-- gh-comment-id:737584986 --> @sebosfato commented on GitHub (Dec 3, 2020): im using the last arduino ide esp 01 im trying to add to see what happens i tried #define WM_NODEBUG nothing changed
Author
Owner

@tablatronix commented on GitHub (Dec 3, 2020):

Nah if you do it in your sketch it wont work, Ill cut a new branch with no debug for you to try

<!-- gh-comment-id:737587941 --> @tablatronix commented on GitHub (Dec 3, 2020): Nah if you do it in your sketch it wont work, Ill cut a new branch with no debug for you to try
Author
Owner

@sebosfato commented on GitHub (Dec 3, 2020):

Nah if you do it in your sketch it wont work, Ill cut a new branch with no debug for you to try

great..thanks a million where can we find?

<!-- gh-comment-id:737629426 --> @sebosfato commented on GitHub (Dec 3, 2020): > Nah if you do it in your sketch it wont work, Ill cut a new branch with no debug for you to try great..thanks a million where can we find?
Author
Owner

@tablatronix commented on GitHub (Dec 3, 2020):

Just pushed it, branch dev_nodebug
let me know how much smaller it is

<!-- gh-comment-id:737632953 --> @tablatronix commented on GitHub (Dec 3, 2020): Just pushed it, branch dev_nodebug let me know how much smaller it is
Author
Owner

@sebosfato commented on GitHub (Dec 3, 2020):

Hey i just tested it worked now it takes 13kb less memory

thanks a milion times saved the day....

i have a question dont know if is related but my http updates are working well but i get no response for the sketck ok updated

i tried all here and there but it seems that is interfering with something on memory because with nodemcu that has 4mspiff it works..

when the sketch finish uploading the serial monitor prints some blank spaces...

do you know what could it be?: i googled it but didnt found solution

problem is that i would like to update eprom before reset and is reseting before the switch ret so i have no chance to save..

<!-- gh-comment-id:737640875 --> @sebosfato commented on GitHub (Dec 3, 2020): Hey i just tested it worked now it takes 13kb less memory thanks a milion times saved the day.... i have a question dont know if is related but my http updates are working well but i get no response for the sketck ok updated i tried all here and there but it seems that is interfering with something on memory because with nodemcu that has 4mspiff it works.. when the sketch finish uploading the serial monitor prints some blank spaces... do you know what could it be?: i googled it but didnt found solution problem is that i would like to update eprom before reset and is reseting before the switch ret so i have no chance to save..
Author
Owner

@tablatronix commented on GitHub (Dec 3, 2020):

I get caught by this now and then, it might be the same issue,sometimes you have to restart the esp after ota as it does not do a real restart, only a soft.

<!-- gh-comment-id:737651990 --> @tablatronix commented on GitHub (Dec 3, 2020): I get caught by this now and then, it might be the same issue,sometimes you have to restart the esp after ota as it does not do a real restart, only a soft.
Author
Owner

@tablatronix commented on GitHub (Dec 3, 2020):

ALso try clean erasing flash if you have been switching esp lib versions

<!-- gh-comment-id:737652322 --> @tablatronix commented on GitHub (Dec 3, 2020): ALso try clean erasing flash if you have been switching esp lib versions
Author
Owner

@sebosfato commented on GitHub (Dec 3, 2020):

i tried everything you can imagine even changing the order of libs and how the things are called in setup i suspect it may have to to with the conversion toFloat() or something because the led build in is one of the serial gpio1 or is because task manager
the update is going on so im able to change the file version for the update to validade but i have to change in the sketch every time
its strange because on the nodemcu with 4mb works no problem.. therefore i only need to change the version on a php file

variables versao, versaofs are float and versaoatual is a string that is result of the first request thats why i have to transform to float to compare.. doing exact the same on node mcu

void UPDATE(){
//check version of update
HTTPClient http;

http.begin(client, versaoatualphp);
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
int httpCode = http.GET(); //Send the request

Serial.println(httpCode); //Print HTTP return code
if (httpCode==200 && (http.getString()!="") ){
versaoatual = http.getString();
Serial.println("versao atual " + versaoatual);
Serial.print("versao ");
Serial.println(versao);
http.end();

if (versao==versaofs){
Serial.println("versao atual " + versaoatual);
UPDATEFS();
}

else if (versao != versaoatual.toFloat()) {

Serial.println("versao da atualização ");
Serial.println(versaoatual);
Serial.print("checando update versao instalada ");
Serial.println(versao);
Serial.println("Update Sketch...");

// Serial.end();

ESPhttpUpdate.setLedPin(LED, LOW);
t_httpUpdate_return ret = ESPhttpUpdate.update(client, updatesketch);

if (ret == HTTP_UPDATE_OK) {
EEPROM.put(102, versaofs); EEPROM.commit();
// Serial.println("Updated spiff okkkk...");
}
switch(ret) {
case HTTP_UPDATE_FAILED:
Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
break;

              case HTTP_UPDATE_NO_UPDATES:
                Serial.println("HTTP_UPDATE_NO_UPDATES");
                break;
              
              case HTTP_UPDATE_OK:
                  //versao=versaofs;
                  EEPROM.put(102, versaofs);  EEPROM.commit();
                  Serial.println("HTTP_UPDATE_OK");
                break;
                }
                http.end();
                }
                  Serial.println("A versao era igual a fonte");
                }else{
              Serial.println("conexao falhou");

}}

`

here in this part works nice it prints the output

void UPDATEFS (){
if (versao == versaofs ) {
//check version of update
//HTTPClient http;
Serial.println("Update SPIFFS...");

HTTPClient http;
ESPhttpUpdate.setLedPin(LED, LOW);
t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs(spiffslink);
if (ret == HTTP_UPDATE_OK) {
Serial.println("Updated spiff okkkk...");

  switch (ret) {
    case HTTP_UPDATE_FAILED:
      Serial.printf("HTTP_UPDATE_FAILED Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
      break;

    case HTTP_UPDATE_NO_UPDATES:
      Serial.println("HTTP_UPDATE_NO_UPDATES");
      break;

    case HTTP_UPDATE_OK:
      versao=versaoatual.toFloat();
      EEPROM.put(102, versao);  // long - so 8 bytes (next address would be '12')
      //digitalWrite(LED, LOW);
      // commit (write) the data to EEPROM - only actually writes if there has been a change
      EEPROM.commit(); //Serial.println((ok43) ? "43 commit OK" : "Commit 43 failed");
      Serial.println("HTTP_UPDATE_OK");
       variavel="versao";
          valor=versao;
     // POSTDATA();
     break;
      }
      http.end();
      } 
     }else{
   
    }
     
      ESP.restart();
    }

here is the serial output for the part that fails

07:38:22.676 -> 200
07:38:22.676 -> versao atual 1.01
07:38:22.676 ->
07:38:22.676 ->
07:38:22.676 ->
07:38:22.676 ->
07:38:22.676 -> versao 1.00
07:38:22.676 -> versao da atualização
07:38:22.676 -> 1.01
07:38:22.676 ->
07:38:22.676 ->
07:38:22.676 ->
07:38:22.676 ->
07:38:22.676 -> checando update versao instalada 1.00
07:38:22.676 -> Update Sketch...
07:38:23.998 ->

<!-- gh-comment-id:737805173 --> @sebosfato commented on GitHub (Dec 3, 2020): i tried everything you can imagine even changing the order of libs and how the things are called in setup i suspect it may have to to with the conversion toFloat() or something because the led build in is one of the serial gpio1 or is because task manager the update is going on so im able to change the file version for the update to validade but i have to change in the sketch every time its strange because on the nodemcu with 4mb works no problem.. therefore i only need to change the version on a php file variables versao, versaofs are float and versaoatual is a string that is result of the first request thats why i have to transform to float to compare.. doing exact the same on node mcu void UPDATE(){ //check version of update HTTPClient http; http.begin(client, versaoatualphp); http.addHeader("Content-Type", "application/x-www-form-urlencoded"); int httpCode = http.GET(); //Send the request Serial.println(httpCode); //Print HTTP return code if (httpCode==200 && (http.getString()!="") ){ versaoatual = http.getString(); Serial.println("versao atual " + versaoatual); Serial.print("versao "); Serial.println(versao); http.end(); if (versao==versaofs){ Serial.println("versao atual " + versaoatual); UPDATEFS(); } else if (versao != versaoatual.toFloat()) { Serial.println("versao da atualização "); Serial.println(versaoatual); Serial.print("checando update versao instalada "); Serial.println(versao); Serial.println("Update Sketch..."); // Serial.end(); ESPhttpUpdate.setLedPin(LED, LOW); t_httpUpdate_return ret = ESPhttpUpdate.update(client, updatesketch); if (ret == HTTP_UPDATE_OK) { EEPROM.put(102, versaofs); EEPROM.commit(); // Serial.println("Updated spiff okkkk..."); } switch(ret) { case HTTP_UPDATE_FAILED: Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str()); break; case HTTP_UPDATE_NO_UPDATES: Serial.println("HTTP_UPDATE_NO_UPDATES"); break; case HTTP_UPDATE_OK: //versao=versaofs; EEPROM.put(102, versaofs); EEPROM.commit(); Serial.println("HTTP_UPDATE_OK"); break; } http.end(); } Serial.println("A versao era igual a fonte"); }else{ Serial.println("conexao falhou"); }} ` here in this part works nice it prints the output void UPDATEFS (){ if (versao == versaofs ) { //check version of update //HTTPClient http; Serial.println("Update SPIFFS..."); HTTPClient http; ESPhttpUpdate.setLedPin(LED, LOW); t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs(spiffslink); if (ret == HTTP_UPDATE_OK) { Serial.println("Updated spiff okkkk..."); switch (ret) { case HTTP_UPDATE_FAILED: Serial.printf("HTTP_UPDATE_FAILED Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str()); break; case HTTP_UPDATE_NO_UPDATES: Serial.println("HTTP_UPDATE_NO_UPDATES"); break; case HTTP_UPDATE_OK: versao=versaoatual.toFloat(); EEPROM.put(102, versao); // long - so 8 bytes (next address would be '12') //digitalWrite(LED, LOW); // commit (write) the data to EEPROM - only actually writes if there has been a change EEPROM.commit(); //Serial.println((ok43) ? "43 commit OK" : "Commit 43 failed"); Serial.println("HTTP_UPDATE_OK"); variavel="versao"; valor=versao; // POSTDATA(); break; } http.end(); } }else{ } ESP.restart(); } here is the serial output for the part that fails 07:38:22.676 -> 200 07:38:22.676 -> versao atual 1.01 07:38:22.676 -> 07:38:22.676 -> 07:38:22.676 -> 07:38:22.676 -> 07:38:22.676 -> versao 1.00 07:38:22.676 -> versao da atualização 07:38:22.676 -> 1.01 07:38:22.676 -> 07:38:22.676 -> 07:38:22.676 -> 07:38:22.676 -> 07:38:22.676 -> checando update versao instalada 1.00 07:38:22.676 -> Update Sketch... 07:38:23.998 ->
Author
Owner

@sebosfato commented on GitHub (Dec 3, 2020):

ALso try clean erasing flash if you have been switching esp lib versions

what exactly you mean here? by the way great job on the lib!!! thanks again its opening the doors for most people working with those chips

<!-- gh-comment-id:737842223 --> @sebosfato commented on GitHub (Dec 3, 2020): > ALso try clean erasing flash if you have been switching esp lib versions what exactly you mean here? by the way great job on the lib!!! thanks again its opening the doors for most people working with those chips
Author
Owner

@tablatronix commented on GitHub (Dec 3, 2020):

Full flash erase from esptool or arduino, sometimes the flash gets corrupted

<!-- gh-comment-id:738458073 --> @tablatronix commented on GitHub (Dec 3, 2020): Full flash erase from esptool or arduino, sometimes the flash gets corrupted
Author
Owner

@sebosfato commented on GitHub (Dec 4, 2020):

was working flawless on node mcu now is not working...not sure what is going... same code same problem...

i tried switching back to the standard wifimanager to see if this was the diference ... not a clue...

=(

<!-- gh-comment-id:738483695 --> @sebosfato commented on GitHub (Dec 4, 2020): was working flawless on node mcu now is not working...not sure what is going... same code same problem... i tried switching back to the standard wifimanager to see if this was the diference ... not a clue... =(
Author
Owner

@sebosfato commented on GitHub (Dec 4, 2020):

i just managed it to work by seting this flag ESPhttpUpdate.rebootOnUpdate(false);

ESPhttpUpdate.rebootOnUpdate(false);

but i would like to understand why it stoped working ... not sure if they changed the lib... i think i updated my arduino ide few days ago...

<!-- gh-comment-id:738604161 --> @sebosfato commented on GitHub (Dec 4, 2020): i just managed it to work by seting this flag ESPhttpUpdate.rebootOnUpdate(false); ESPhttpUpdate.rebootOnUpdate(false); but i would like to understand why it stoped working ... not sure if they changed the lib... i think i updated my arduino ide few days ago...
Author
Owner

@sebosfato commented on GitHub (Dec 4, 2020):

i found it because i found how to turn on the debug from httpupdate on the preferences and it was returning the ok but not printing because maybe some function changed

so i found this boolean function ESPhttpUpdate.rebootOnUpdate(false); inside the .h file of this lib
the code end up like this :

ESPhttpUpdate.rebootOnUpdate(false);
Serial.println("Update Sketch...");
ESPhttpUpdate.setLedPin(LED, LOW);
t_httpUpdate_return Ret = ESPhttpUpdate.update(client, "http://www.update.....");
switch (Ret) {
case HTTP_UPDATE_FAILED:
Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
break;

  case HTTP_UPDATE_NO_UPDATES:
    Serial.println("HTTP_UPDATE_NO_UPDATES");
    break;

  case HTTP_UPDATE_OK:
      versao=versaofs;
      variavel="versao";
      valor=versao;
      POSTDATA();
      digitalWrite(LED, LOW);
      Serial.println("HTTP_UPDATE_OK");
      Serial.println("Updated Sketch ooooookkk...");
      EEPROM.put(198, versao);  // long - so 8 bytes (next address would be '12')
      digitalWrite(LED, LOW);
      // commit (write) the data to EEPROM - only actually writes if there has been a change
      boolean ok43 = EEPROM.commit(); Serial.println((ok43) ? "43 commit OK" : "Commit 43 failed");
       EEPROM.put(170, userid);  // long - so 8 bytes (next address would be '12')
      boolean ok49 = EEPROM.commit(); Serial.println((ok49) ? "43 commit OK" : "Commit 43 failed");
      Serial.println("HTTP_UPDATE_OK");
      Serial.println("versao atualizada"+ String(versao));
      ESP.restart();
      break;
      
      } } Serial.println("A versao era igual a fonte");
}else{
  Serial.println("falhou");

}
//http.end();

<!-- gh-comment-id:738614956 --> @sebosfato commented on GitHub (Dec 4, 2020): i found it because i found how to turn on the debug from httpupdate on the preferences and it was returning the ok but not printing because maybe some function changed so i found this boolean function ESPhttpUpdate.rebootOnUpdate(false); inside the .h file of this lib the code end up like this : ESPhttpUpdate.rebootOnUpdate(false); Serial.println("Update Sketch..."); ESPhttpUpdate.setLedPin(LED, LOW); t_httpUpdate_return Ret = ESPhttpUpdate.update(client, "http://www.update....."); switch (Ret) { case HTTP_UPDATE_FAILED: Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str()); break; case HTTP_UPDATE_NO_UPDATES: Serial.println("HTTP_UPDATE_NO_UPDATES"); break; case HTTP_UPDATE_OK: versao=versaofs; variavel="versao"; valor=versao; POSTDATA(); digitalWrite(LED, LOW); Serial.println("HTTP_UPDATE_OK"); Serial.println("Updated Sketch ooooookkk..."); EEPROM.put(198, versao); // long - so 8 bytes (next address would be '12') digitalWrite(LED, LOW); // commit (write) the data to EEPROM - only actually writes if there has been a change boolean ok43 = EEPROM.commit(); Serial.println((ok43) ? "43 commit OK" : "Commit 43 failed"); EEPROM.put(170, userid); // long - so 8 bytes (next address would be '12') boolean ok49 = EEPROM.commit(); Serial.println((ok49) ? "43 commit OK" : "Commit 43 failed"); Serial.println("HTTP_UPDATE_OK"); Serial.println("versao atualizada"+ String(versao)); ESP.restart(); break; } } Serial.println("A versao era igual a fonte"); }else{ Serial.println("falhou"); } //http.end();
Author
Owner

@tablatronix commented on GitHub (Dec 4, 2020):

Yeah I am not entirely sure how ESPhttpUpdate relates to this issue , but you should check that out with the esp guys, ask on gitter

<!-- gh-comment-id:738841799 --> @tablatronix commented on GitHub (Dec 4, 2020): Yeah I am not entirely sure how ESPhttpUpdate relates to this issue , but you should check that out with the esp guys, ask on gitter
Author
Owner

@sebosfato commented on GitHub (Dec 5, 2020):

i tried to ask them there lets see what comes out... thanks a lot bro!

<!-- gh-comment-id:739373164 --> @sebosfato commented on GitHub (Dec 5, 2020): i tried to ask them there lets see what comes out... thanks a lot bro!
Author
Owner

@tablatronix commented on GitHub (Apr 15, 2021):

What board are you using ?
ESP01?

<!-- gh-comment-id:819999801 --> @tablatronix commented on GitHub (Apr 15, 2021): What board are you using ? ESP01?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#988
No description provided.