mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
ESP32 target
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
#include "UpgradeFirm.h"
|
||||
#include "Upgrade.h"
|
||||
|
||||
#include "Class/NotAsinc.h"
|
||||
#ifdef ESP8266
|
||||
#include "ESP8266.h"
|
||||
#else
|
||||
#include <HTTPUpdate.h>
|
||||
#endif
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
void upgradeInit() {
|
||||
@@ -78,8 +83,13 @@ bool upgradeFS() {
|
||||
WiFiClient wifiClient;
|
||||
bool ret = false;
|
||||
Serial.println("Start upgrade LittleFS, please wait...");
|
||||
#ifdef ESP8266
|
||||
ESPhttpUpdate.rebootOnUpdate(false);
|
||||
t_httpUpdate_return retFS = ESPhttpUpdate.updateSpiffs(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/littlefs/littlefs.bin"));
|
||||
#else
|
||||
httpUpdate.rebootOnUpdate(false);
|
||||
HTTPUpdateResult retFS = httpUpdate.updateSpiffs(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/littlefs/littlefs.bin"));
|
||||
#endif
|
||||
if (retFS == HTTP_UPDATE_OK) { //если FS обновилась успешно
|
||||
SerialPrint("I", "Update", "LittleFS upgrade done!");
|
||||
ret = true;
|
||||
@@ -91,8 +101,15 @@ bool upgradeBuild() {
|
||||
WiFiClient wifiClient;
|
||||
bool ret = false;
|
||||
Serial.println("Start upgrade BUILD, please wait...");
|
||||
|
||||
#ifdef ESP8266
|
||||
ESPhttpUpdate.rebootOnUpdate(false);
|
||||
t_httpUpdate_return retBuild = ESPhttpUpdate.update(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/firmware/firmware.bin"));
|
||||
#else
|
||||
httpUpdate.rebootOnUpdate(false);
|
||||
HTTPUpdateResult retBuild = httpUpdate.update(wifiClient, F("http://95.128.182.133/projects/iotmanager/esp8266/firmware/firmware.bin"));
|
||||
#endif
|
||||
|
||||
if (retBuild == HTTP_UPDATE_OK) { //если BUILD обновился успешно
|
||||
SerialPrint("I", "Update", "BUILD upgrade done!");
|
||||
ret = true;
|
||||
|
||||
Reference in New Issue
Block a user