modified: BIlinkerAndHttpsOta.ino

modified:   httpslei.cpp
	modified:   httpslei.h
master
YUNLEI 2022-09-28 00:31:25 +08:00
parent 40856f8cf9
commit 1b8f4625b3
3 changed files with 4 additions and 5 deletions

View File

@ -31,7 +31,6 @@ void setup() {
pinMode(LED_PIN_LEI, OUTPUT); pinMode(LED_PIN_LEI, OUTPUT);
BLINKER_TAST_INIT(); //保持Blinker连接的函数 BLINKER_TAST_INIT(); //保持Blinker连接的函数
Blinker.attachData(none_callback); //绑定数据输入,但是没有绑定的控件的回调函数 Blinker.attachData(none_callback); //绑定数据输入,但是没有绑定的控件的回调函数
httpsOtaTurnOn();
Serial.printf("connect to ssid: %s .\n",ssid); Serial.printf("connect to ssid: %s .\n",ssid);
while (!Blinker.connected()) { while (!Blinker.connected()) {
Serial.printf("."); Serial.printf(".");

View File

@ -13,7 +13,7 @@
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed. * - 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. * - 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/"; String urls = "https://www.lshserver.com:9006/test/";
static const char *server_certificate =\ static const char *server_certificate =\
"-----BEGIN CERTIFICATE-----\n\ "-----BEGIN CERTIFICATE-----\n\
@ -130,8 +130,8 @@ int checkNewOTA(const String version){
} }
return httpCode; return httpCode;
} }
void httpsOtaStart(){ void httpsOtaStart(const String version){
HttpsOTA.onHttpEvent(HttpEvent); //启用https 调试信息 HttpsOTA.onHttpEvent(HttpEvent); //启用https 调试信息
HttpsOTA.begin(url,server_certificate);//开始升级 HttpsOTA.begin(urls+"esp32-"+version+".bin",server_certificate);//开始升级
xTaskCreate(readStaus,"readStaus",2048,NULL,2, NULL);//状态回调 xTaskCreate(readStaus,"readStaus",2048,NULL,2, NULL);//状态回调
} }

View File

@ -5,6 +5,6 @@
#include "HttpsOTAUpdate.h" #include "HttpsOTAUpdate.h"
void HttpEvent(HttpEvent_t*event); void HttpEvent(HttpEvent_t*event);
void readStaus(void *p); void readStaus(void *p);
void httpsOtaStart(void); void httpsOtaStart(const String version);
int checkNewOTA(const String version); int checkNewOTA(const String version);
#endif #endif