Page 1 of 1

ESP32 freeze when t_httpUpdate_return ret

Posted: Thu Mar 09, 2023 3:52 pm
by AnakinO7
Hi, I am from Spain and I am trying to code an skecth to control an aquarium. Then I would like that users can update it from github. I have been testing HTTPClient.h library but the ESP32 gest freeze when it run that line:
t_httpUpdate_return ret = httpUpdate.update(client, URL_fw_Bin);
I can not see any error in serial port...

My code is too big so I will try to show you the afected parts.

Code: Select all


void firmwareUpdate(void) { 
    WiFiClientSecure client;
    client.setCACert(rootCACertificate);
    Serial.println("FIRMWARE UPDATE");
    t_httpUpdate_return ret = httpUpdate.update(client, URL_fw_Bin);
    Serial.println("1");
    switch (ret) {
    case HTTP_UPDATE_FAILED:
    Serial.println("2");
        Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
        break;

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

    case HTTP_UPDATE_OK:
        Serial.println("HTTP_UPDATE_OK vvv");
        break;
    }
}

Code: Select all

//#include <DNSServer.h>
#include <ESPUI.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Preferences.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <HTTPUpdate.h>
//#include <WiFiClientSecure.h>
#include "cert.h"
#include "soc/timer_group_struct.h"
#include "soc/timer_group_reg.h"
#include "time.h"

Code: Select all

void setup(void)
{
    Serial.begin(115200);
    Serial.setDebugOutput(true);
    sensors.begin();
    nvs.begin("datos",false); // use "datos" namespace
    READfromNVS();
//   ESPUI.setVerbosity(Verbosity::VerboseJSON); //Turn ON verbose debugging
    connectWIFI();
    timeClient.begin(); // Initialize a NTPClient to get time
    timeClient.setTimeOffset(3600); // Set offset time in seconds to adjust for your timezone, for example:
    // GMT +1 = 3600
    timeClient.update();

https://github.com/AnakinSpain/Anakino_Aquarium_ESPUI

this is my full code