ESP-WebOTA icon indicating copy to clipboard operation
ESP-WebOTA copied to clipboard

question about updating via curl - terminal

Open Mathteus opened this issue 3 years ago • 7 comments

I am using the lib 'ESP-Web OTA' in my project, and when I go to do the firmware update via curl through the linux terminal, I find the following error.

I add the following lines to init_wifi()

IPAddress local_ip(192,168,1,46); IPAddress getway(168,168,1,1); IPAddress subnet(255,255,0,0); IPAddress primaryDNS(8,8,8,8); IPAddress secondaryDNS(8,8,4,4); if (!WiFi.config(local_ip, getway, subnet, primaryDNS, secondaryDNS)) ESP.restart();

to be able to get it by changing the ip of eps32.

using code in main

#include <WebOTA.h> #include <Arduino.h>

void setup() { Serial.begin(115200); init_wifi("LAb", "test123", "esp-ota"); }

void loop() { webota.handle(); }

image

I did several tests and found that it only works if the ip of the esp32 is 192.168.1.* , when changing the ip of the esp32 does not work with the error 'Timeout for connection'.

I would like to know how to fix this in my code, if I'm doing something wrong.

Mathteus avatar May 23 '22 14:05 Mathteus

That sounds like a local IP/Subnet issue on the sending box. Your ESP32 has a subnet of /16 (255.255.0.0), does your local box also? Are you able to ping the ESP32 when the curl fails?

scottchiefbaker avatar May 23 '22 14:05 scottchiefbaker

I tried to ping the ESP32 right after trying to update the firmware, and I got the following result.

image

About ESP32 having a subnet (255.255.0.0) I don't know if I understood it right, but I manually put it in the init_wifi() function, setting the variable, according to the subnet of my machine.

IPAddress subnet(255,255,0,0);

Mathteus avatar May 23 '22 17:05 Mathteus

Everything looks OK to me. I suspect the issue isn't with WebOTA, but instead with basic IP connectivity between your Linux machine, and your ESP32.

scottchiefbaker avatar May 23 '22 17:05 scottchiefbaker

could you tell why it only works with ip 192.168.1.* ?

Mathteus avatar May 23 '22 17:05 Mathteus

sorry, I clicked wrong and ended up closing the issues

Mathteus avatar May 23 '22 17:05 Mathteus

I suspect the IP and subnet of your Linux machine, and your ESP32 are not the same.

scottchiefbaker avatar May 23 '22 17:05 scottchiefbaker

but if that were the cause then no ip would work. or am i wrong about?

I checked my machine's subnet and it's the same as ESP32

Mathteus avatar May 23 '22 17:05 Mathteus