Hi Peter. Thank you for your help.
Hi everybody.
I think I solved it, using another update code.
Arduino 1.8.19. ESP8266 board 3.0.2. BlynkSimpleEsp8266.h.
I was able to update via BlynkAir, even with the option of Lower Firmware version or No condition.
And here is the code I used, and the details of the results.
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN "X8q5lh0pfypriO7b5zAFNEiJoi1_S6zb"
#define BLYNK_FIRMWARE_VERSION "9.4.0"
#define BLYNK_PRINT Serial
//ESP32
//#include <Update.h>
//#include <HTTPClient.h>
//ESP8266
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266Ping.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#include <ESP8266HTTPUpdateServer.h>
#include <WiFiClient.h>
//________________________________________________________________
String overTheAirURL = "";
#define WIFI_SSID "HIEU VAI THANH" //Enter Wifi Name
#define WIFI_PASS "passathai96" //Enter wifi Password
boolean setBlynk = 0;
void setup() {
Serial.begin(115200);
Serial.print("BLYNK_FIRMWARE_VERSION = ");
Serial.println(BLYNK_FIRMWARE_VERSION);
checkConnection();
checkInternet();
pinMode(D4,OUTPUT);
}
boolean checkConnection() {
Serial.print("Check connecting to ");
Serial.println(WIFI_SSID);
WiFi.disconnect();
WiFi.mode(WIFI_AP_STA);
WiFi.begin(WIFI_SSID,WIFI_PASS);
int count=0;
while(count < 20){
if(WiFi.status() == WL_CONNECTED){
Serial.print("Connected to ");
Serial.println(WIFI_SSID);
Serial.print("Web Server IP Address: ");
Serial.println(WiFi.localIP());
Serial.println("");
return true;
}
delay(5000);
Serial.print(".");
count++;
}
Serial.println("Timed out........ hiddenAP = 0;");
Serial.println("");
return false;
}
void checkInternet(){
Serial.println("");
bool ret = Ping.ping("www.google.com");
if(ret){
if(setBlynk == 0){
Serial.println("ket noi NEW BLYNK NEW");
Blynk.config(BLYNK_AUTH_TOKEN);
setBlynk = 1;
}
if(!Blynk.connected()){
Serial.println("Not connected to Blynk server");
Blynk.connect(); // try to connect to server with default timeout
}else{
Serial.println("Connected to Blynk server");
}
Serial.println("");
}
}
void loop(){
Blynk.run();
if(!Blynk.connected()){
int count=0;
while(count < 3){//5 lan chay 6s Blynk.run la 30s
Blynk.run();//thoi gian chay 6s
if(Blynk.connected()){
Serial.println("!Blynk.connected(); Blynk.connected())");Serial.println("");
delay(500);
return;
}
delay(1000);
Serial.print(".");
count++;
}
Serial.println("!Blynk.connected(); internetState = 0;");Serial.println("");
delay(500);
}
}
BLYNK_CONNECTED() {
// Request the latest state from the server
Blynk.syncVirtual(V4);
}
BLYNK_WRITE(V4) {
int stateD4 = param.asInt();
digitalWrite(D4, stateD4);
}
BLYNK_WRITE(InternalPinOTA) {
Serial.println("OTA Started");
overTheAirURL = param.asString();
Serial.print("overTheAirURL = ");
Serial.println(overTheAirURL);
//HTTPClient http;
//http.begin(overTheAirURL);
WiFiClient my_wifi_client;
HTTPClient http;
http.begin(my_wifi_client, overTheAirURL);
t_httpUpdate_return ret = ESPhttpUpdate.update(my_wifi_client, overTheAirURL);
switch(ret) {
case HTTP_UPDATE_FAILED:
Serial.println("[update] Update failed.");
break;
case HTTP_UPDATE_NO_UPDATES:
Serial.println("[update] Update no Update.");
break;
case HTTP_UPDATE_OK:
Serial.println("[update] Update ok."); // may not be called since we reboot the ESP
break;
}
}
21:38:25.739 -> .Connected to HIEU VAI THANH
21:38:25.739 -> Web Server IP Address: 192.168.1.21
21:38:25.739 ->
21:38:25.739 ->
21:38:30.801 -> ket noi NEW BLYNK NEW
21:38:30.801 -> [10165]
21:38:30.801 -> ___ __ __
21:38:30.801 -> / _ )/ /_ _____ / /__
21:38:30.847 -> / _ / / // / _ \/ '_/
21:38:30.847 -> /____/_/\_, /_//_/_/\_\
21:38:30.847 -> /___/ v1.1.0 on ESP8266
21:38:30.847 ->
21:38:30.847 -> #StandWithUkraine https://bit.ly/swua
21:38:30.847 ->
21:38:30.847 ->
21:38:30.847 -> Not connected to Blynk server
21:38:30.847 -> [10175] Connecting to blynk.cloud:80
21:38:31.081 -> [10403] Ready (ping: 63ms).
21:38:31.174 ->
21:39:44.176 -> OTA Started
21:39:44.176 -> overTheAirURL = http://sgp1.blynk.cloud/static/fw_8861998046749586401_-838595071.bin?token=EWvl4L6F4FuusgoQ79c0J8YD_zBXIKl0
21:39:56.983 ->
21:39:56.983 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)
21:39:56.983 ->
21:39:56.983 -> load 0x4010f000, len 3460, room 16
21:39:56.983 -> tail 4
21:39:56.983 -> chksum 0xcc
21:39:56.983 -> load 0x3fff20b8, len 40, room 4
21:39:56.983 -> tail 4
21:39:56.983 -> chksum 0xc9
21:39:56.983 -> csum 0xc9
21:39:56.983 -> v0004ced0
21:39:56.983 -> @cp:B0
21:40:02.268 -> ld
21:40:02.348 -> Check connecting to HIEU VAI THANH
21:40:07.359 -> .Connected to HIEU VAI THANH
21:40:07.359 -> Web Server IP Address: 192.168.1.21
21:40:07.359 ->
21:40:07.359 ->
21:40:11.559 -> ket noi NEW BLYNK NEW
21:40:11.559 -> [14574]
21:40:11.559 -> ___ __ __
21:40:11.559 -> / _ )/ /_ _____ / /__
21:40:11.559 -> / _ / / // / _ \/ '_/
21:40:11.559 -> /____/_/\_, /_//_/_/\_\
21:40:11.559 -> /___/ v1.1.0 on ESP8266
21:40:11.559 ->
21:40:11.559 -> #StandWithUkraine https://bit.ly/swua
21:40:11.559 ->
21:40:11.559 ->
21:40:11.559 -> Not connected to Blynk server
21:40:11.598 -> [14585] Connecting to blynk.cloud:80
21:40:11.729 -> [14717] Ready (ping: 36ms).
21:40:11.846 ->
21:45:19.424 -> OTA Started
21:45:19.424 -> overTheAirURL = http://sgp1.blynk.cloud/static/fw_14483877767671016810_-838595071.bin?token=4gCroqeGQShaN-HW3uwnraMoguXYDh_O
21:45:34.288 ->
21:45:34.288 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)
21:45:34.288 ->
21:45:34.288 -> load 0x4010f000, len 3460, room 16
21:45:34.288 -> tail 4
21:45:34.288 -> chksum 0xcc
21:45:34.288 -> load 0x3fff20b8, len 40, room 4
21:45:34.288 -> tail 4
21:45:34.288 -> chksum 0xc9
21:45:34.288 -> csum 0xc9
21:45:34.288 -> v0004ced0
21:45:34.288 -> @cp:B0
21:45:39.588 -> ld
21:45:39.638 -> Check connecting to HIEU VAI THANH
21:45:44.668 -> .Connected to HIEU VAI THANH
21:45:44.668 -> Web Server IP Address: 192.168.1.21
21:45:44.668 ->
21:45:44.668 ->
21:45:48.818 -> ket noi NEW BLYNK NEW
21:45:48.818 -> [14541]
21:45:48.818 -> ___ __ __
21:45:48.818 -> / _ )/ /_ _____ / /__
21:45:48.818 -> / _ / / // / _ \/ '_/
21:45:48.818 -> /____/_/\_, /_//_/_/\_\
21:45:48.818 -> /___/ v1.1.0 on ESP8266
21:45:48.818 ->
21:45:48.818 -> #StandWithUkraine https://bit.ly/swua
21:45:48.858 ->
21:45:48.858 ->
21:45:48.858 -> Not connected to Blynk server
21:45:48.858 -> [14552] Connecting to blynk.cloud:80
21:45:48.973 -> [14707] Ready (ping: 38ms).
21:45:49.128 ->
21:49:32.571 -> OTA Started
21:49:32.571 -> overTheAirURL = http://sgp1.blynk.cloud/static/fw_5800073477836424206_-838595071.bin?token=-J3KrC3e9FTBYDhIhGNUq3wxmTKfOi6Q
21:49:46.868 ->
21:49:46.868 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)
21:49:46.868 ->
21:49:46.868 -> load 0x4010f000, len 3460, room 16
21:49:46.908 -> tail 4
21:49:46.908 -> chksum 0xcc
21:49:46.908 -> load 0x3fff20b8, len 40, room 4
21:49:46.908 -> tail 4
21:49:46.908 -> chksum 0xc9
21:49:46.908 -> csum 0xc9
21:49:46.908 -> v0004ccc0
21:49:46.908 -> @cp:B0
21:49:52.208 -> ld
21:49:52.248 -> BLYNK_FIRMWARE_VERSION = 9.4.1
21:49:52.248 -> Check connecting to HIEU VAI THANH
21:49:57.248 -> .Connected to HIEU VAI THANH
21:49:57.248 -> Web Server IP Address: 192.168.1.21
21:49:57.288 ->
21:49:57.288 ->
21:50:02.398 -> ket noi NEW BLYNK NEW
21:50:02.398 -> [15505]
21:50:02.398 -> ___ __ __
21:50:02.398 -> / _ )/ /_ _____ / /__
21:50:02.398 -> / _ / / // / _ \/ '_/
21:50:02.398 -> /____/_/\_, /_//_/_/\_\
21:50:02.398 -> /___/ v1.1.0 on ESP8266
21:50:02.398 ->
21:50:02.398 -> #StandWithUkraine https://bit.ly/swua
21:50:02.398 ->
21:50:02.398 ->
21:50:02.398 -> Not connected to Blynk server
21:50:02.438 -> [15515] Connecting to blynk.cloud:80
21:50:02.638 -> [15731] Ready (ping: 39ms).
21:50:02.770 ->
And the error “Firmware type mismatch”, because i used the same code for the next shipping. We must edit just a little before creating the bin file.