From 1b8f4625b319b67519e9eadf458df23c3764fc10 Mon Sep 17 00:00:00 2001 From: lei <3224404793@qq.com> Date: Wed, 28 Sep 2022 00:31:25 +0800 Subject: [PATCH] modified: BIlinkerAndHttpsOta.ino modified: httpslei.cpp modified: httpslei.h --- BIlinkerAndHttpsOta.ino | 1 - httpslei.cpp | 6 +++--- httpslei.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/BIlinkerAndHttpsOta.ino b/BIlinkerAndHttpsOta.ino index b018abe..e3545a4 100644 --- a/BIlinkerAndHttpsOta.ino +++ b/BIlinkerAndHttpsOta.ino @@ -31,7 +31,6 @@ void setup() { pinMode(LED_PIN_LEI, OUTPUT); BLINKER_TAST_INIT(); //保持Blinker连接的函数 Blinker.attachData(none_callback); //绑定数据输入,但是没有绑定的控件的回调函数 - httpsOtaTurnOn(); Serial.printf("connect to ssid: %s .\n",ssid); while (!Blinker.connected()) { Serial.printf("."); diff --git a/httpslei.cpp b/httpslei.cpp index f5b2459..66b010c 100644 --- a/httpslei.cpp +++ b/httpslei.cpp @@ -13,7 +13,7 @@ * - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed. * - For other return codes, refer OTA documentation in esp-idf's app_update component. */ -static const char *url = "https://www.lshserver.com:9006/test/esp32-v1.bin"; //state url of your firmware image +static const char *url = "https://www.lshserver.com:9006/test/esp32-v4.bin"; //state url of your firmware image String urls = "https://www.lshserver.com:9006/test/"; static const char *server_certificate =\ "-----BEGIN CERTIFICATE-----\n\ @@ -130,8 +130,8 @@ int checkNewOTA(const String version){ } return httpCode; } -void httpsOtaStart(){ +void httpsOtaStart(const String version){ HttpsOTA.onHttpEvent(HttpEvent); //启用https 调试信息 - HttpsOTA.begin(url,server_certificate);//开始升级 + HttpsOTA.begin(urls+"esp32-"+version+".bin",server_certificate);//开始升级 xTaskCreate(readStaus,"readStaus",2048,NULL,2, NULL);//状态回调 } \ No newline at end of file diff --git a/httpslei.h b/httpslei.h index e39ae88..46c10ed 100644 --- a/httpslei.h +++ b/httpslei.h @@ -5,6 +5,6 @@ #include "HttpsOTAUpdate.h" void HttpEvent(HttpEvent_t*event); void readStaus(void *p); - void httpsOtaStart(void); + void httpsOtaStart(const String version); int checkNewOTA(const String version); #endif \ No newline at end of file