mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Fix ошибок и под esp8266
This commit is contained in:
@@ -211,9 +211,10 @@ public:
|
||||
if (!updated)
|
||||
{
|
||||
SerialPrint("I", F("NextionUpdate"), "connecting to " + (String)_host);
|
||||
HTTPClient http;
|
||||
HTTPClient http;
|
||||
#if defined ESP8266
|
||||
if (!http.begin(_host, 80, _url))
|
||||
WiFiClient client;
|
||||
if (!http.begin(client, _host, 80, _url))
|
||||
SerialPrint("I", F("NextionUpdate"), "connection failed ");
|
||||
#elif defined ESP32
|
||||
if (!http.begin(String("http://") + _host + _url))
|
||||
|
||||
@@ -87,12 +87,7 @@
|
||||
},
|
||||
"defActive": false,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [],
|
||||
"esp32_4mb3f": [],
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
"esp8285_1mb": [],
|
||||
"esp8285_1mb_ota": []
|
||||
"esp32*": [],
|
||||
"esp82*": []
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
HTTPClient http;
|
||||
|
||||
#if defined ESP8266
|
||||
if (!http.begin(_host, 80, _url))
|
||||
WiFiClient client;
|
||||
if (!http.begin(client, _host, 80, _url))
|
||||
{
|
||||
// Serial.println("connection failed");
|
||||
SerialPrint("I", F("NextionUpdate"), "connection failed ");
|
||||
@@ -118,7 +119,13 @@ public:
|
||||
int contentLength = http.getSize();
|
||||
SerialPrint("I", F("NextionUpdate"), "File received. Update Nextion... ");
|
||||
bool result;
|
||||
ESPNexUpload nextion(115200, _NEXT_RX, _NEXT_TX);
|
||||
#ifdef ESP8266
|
||||
ESPNexUpload nextion(115200, -1, _NEXT_RX, _NEXT_TX);
|
||||
#elif defined(esp32c3m_4mb) || defined(esp32s2_4mb)
|
||||
ESPNexUpload nextion(115200, 1, _NEXT_RX, _NEXT_TX);
|
||||
#else
|
||||
ESPNexUpload nextion(115200, 2, _NEXT_RX, _NEXT_TX);
|
||||
#endif
|
||||
nextion.setUpdateProgressCallback([]()
|
||||
{ SerialPrint("I", F("NextionUpdate"), "... "); });
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <TM1637.h>
|
||||
#include <TM1638.h>
|
||||
#include <TM16xxDisplay.h>
|
||||
#include <TM16xxbuttons.h>
|
||||
#include <TM16xxButtons.h>
|
||||
|
||||
|
||||
TM16xxButtons* buttons = nullptr; // указатель на объект управления кнопками для TM1638 иначе nullptr
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
// #include <GyverGFX.h>
|
||||
// #include <CharPlot.h>
|
||||
// #include "esp_camera.h"
|
||||
|
||||
#ifdef ESP8266
|
||||
#define FB_DYNAMIC
|
||||
#endif
|
||||
#include <FastBot.h>
|
||||
#include <map>
|
||||
|
||||
@@ -93,6 +95,7 @@ public:
|
||||
if (fl_rollback)
|
||||
{
|
||||
_myBot->tickManual(); // Чтобы отметить сообщение прочитанным
|
||||
#ifdef ESP32
|
||||
if (Update.rollBack())
|
||||
{
|
||||
SerialPrint("I", F("Update"), F("Откат OTA успешно выполнен"));
|
||||
@@ -104,6 +107,7 @@ public:
|
||||
SerialPrint("E", F("Update"), F("Откат OTA не выполнен!"));
|
||||
_myBot->sendMessage("Откат OTA не выполнен!", _chatID);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// была попытка OTA обновления. Обновляемся после ответа серверу!
|
||||
if (_OTAstate >= 0)
|
||||
@@ -369,10 +373,16 @@ public:
|
||||
// -------------------------------------------------------------------------
|
||||
if (msg.text.indexOf("/rollback") != -1 && msg.chatID == _chatID)
|
||||
{
|
||||
#ifdef ESP32
|
||||
_myBot->inlineMenu("Вы уверены, что хотите откатить прошивку? " + jsonReadStr(settingsFlashJson, F("name")) + " \n OTA_roll", F("Rollback \t Cancel"));
|
||||
#elif ESP8266
|
||||
SerialPrint("E", F("Update"), F("Откат OTA не поддерживается на esp8266!"));
|
||||
_myBot->sendMessage("Откат OTA не поддерживается на esp8266!", _chatID);
|
||||
#endif
|
||||
}
|
||||
else if (msg.text.indexOf("OTA_roll") != -1)
|
||||
{
|
||||
#ifdef ESP32
|
||||
// удаляем последнее сообщение от бота
|
||||
_myBot->deleteMessage(_myBot->lastBotMsg());
|
||||
if (msg.data.indexOf("Rollback") != -1)
|
||||
@@ -387,6 +397,7 @@ public:
|
||||
_myBot->sendMessage("Откат OTA не возможен!", _chatID);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// -------------- Обработка файлов *.bin для прошивки по OTA --------------
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user