From 655ee79b655626d93201b102fd7a962bc0b48e56 Mon Sep 17 00:00:00 2001 From: panweiji <406798106@qq.com> Date: Wed, 17 Jan 2024 10:46:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20=E5=A2=9E=E5=BC=BA=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8FC++=E4=BB=A3=E7=A0=81=E7=9A=84=E5=81=A5?= =?UTF-8?q?=E5=A3=AE=E6=80=A7=E5=92=8C=E5=8F=AF=E7=BB=B4=E6=8A=A4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects-demo/esp32-c3-demo/src/main.cpp | 6 ++++-- projects/car-lock/src/main.cpp | 22 +++++++++++++--------- projects/parking-space-gate/src/common.h | 6 +++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/projects-demo/esp32-c3-demo/src/main.cpp b/projects-demo/esp32-c3-demo/src/main.cpp index 125cf54..4a8e217 100644 --- a/projects-demo/esp32-c3-demo/src/main.cpp +++ b/projects-demo/esp32-c3-demo/src/main.cpp @@ -61,15 +61,17 @@ void setup() { // init_bluetooth("panweiji"); // 初始化WiFi无线网络 init_wifi(); - // WiFi网络版本初始化MQTT消息协议 - init_mqtt(); + // 单片机启动后首先执行OTA升级检测 std::string const &ota_temp_json = std::string("http://") + std::string(STR(FIRMWARE_UPDATE_JSON_URL)); const char *firmware_update_json_url = ota_temp_json.c_str(); Serial.println(firmware_update_json_url); // WIFI要供电稳定 保证电压足够 才能正常工作 // do_firmware_upgrade(FIRMWARE_VERSION, firmware_update_json_url, ""); + // WiFi网络版本初始化MQTT消息协议 + init_mqtt(); + delay(1000); // 初始化日志云上报 // init_insights(); diff --git a/projects/car-lock/src/main.cpp b/projects/car-lock/src/main.cpp index 86346c5..eb00ef2 100644 --- a/projects/car-lock/src/main.cpp +++ b/projects/car-lock/src/main.cpp @@ -39,6 +39,7 @@ using namespace std; #define FIRMWARE_VERSION "CI_OTA_FIRMWARE_VERSION" // 版本号用于OTA升级和远程升级文件对比 判断是否有新版本 每次需要OTA的时候更改设置 CI_OTA_FIRMWARE_VERSION关键字用于CI替换版本号 +#define OTA_EN 1 // 是否开启OTA空中升级 0 关闭 1 开启 #define WIFI_EN 0 // 是否开启WIFI网络功能 0 关闭 1 开启 #define MQTT_EN 1 // 是否开启MQTT消息协议 0 关闭 1 开启 #define PWM_EN 1 // 是否开启PWM脉冲宽度调制功能 0 关闭 1 开启 @@ -95,6 +96,18 @@ void setup() { // const BizConstants bizConstants; // Serial.println(bizConstants.NAME.c_str()); +#if OTA_EN + // 单片机启动后首先执行OTA升级检测 + // OTA升级配置文件 如果https证书有问题 可以使用http协议 + std::string const &ota_temp_json = std::string("http://") + std::string(STR(FIRMWARE_UPDATE_JSON_URL)); + const char *firmware_update_json_url = ota_temp_json.c_str(); + + // WiFi网络版本执行OTA空中升级 + // exec_ota(FIRMWARE_VERSION, firmware_update_json_url); + // WIFI要供电稳定 保证电压足够 才能正常工作 + do_firmware_upgrade(FIRMWARE_VERSION, firmware_update_json_url, ""); +#endif + #if WIFI_EN // 初始化WiFi无线网络 init_wifi(); @@ -143,15 +156,6 @@ void setup() { // 初始化无线射频RF 用于遥控器控制 // rf_init(); - // OTA升级配置文件 如果https证书有问题 可以使用http协议 - std::string const &ota_temp_json = std::string("http://") + std::string(STR(FIRMWARE_UPDATE_JSON_URL)); - const char *firmware_update_json_url = ota_temp_json.c_str(); - - // WiFi网络版本执行OTA空中升级 - // exec_ota(FIRMWARE_VERSION, firmware_update_json_url); - // WIFI要供电稳定 保证电压足够 才能正常工作 - do_firmware_upgrade(FIRMWARE_VERSION, firmware_update_json_url, ""); - /* pinMode(19, INPUT_PULLUP); // 开启外部中断 attachInterrupt(digitalPinToInterrupt(19), isr, FALLING); diff --git a/projects/parking-space-gate/src/common.h b/projects/parking-space-gate/src/common.h index 30e7096..79cce67 100644 --- a/projects/parking-space-gate/src/common.h +++ b/projects/parking-space-gate/src/common.h @@ -1,5 +1,5 @@ -#ifndef GROUND_LOCK_COMMON_H -#define GROUND_LOCK_COMMON_H +#ifndef PARKING_SPACE_GATE_COMMON_H +#define PARKING_SPACE_GATE_COMMON_H /** * @author 潘维吉 @@ -13,4 +13,4 @@ #define PIN_RX_2 19 #define PIN_TX_2 20 -#endif //GROUND_LOCK_COMMON_H +#endif From b317500aee8f490a7dd37c1cadb007def0424281 Mon Sep 17 00:00:00 2001 From: panweiji <406798106@qq.com> Date: Mon, 22 Jan 2024 14:20:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20=E5=A2=9E=E5=BC=BA=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8F=E4=BB=A3=E7=A0=81=E7=9A=84=E5=81=A5=E5=A3=AE?= =?UTF-8?q?=E6=80=A7=E5=92=8C=E5=8F=AF=E7=BB=B4=E6=8A=A4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects-demo/esp32-c3-demo/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects-demo/esp32-c3-demo/platformio.ini b/projects-demo/esp32-c3-demo/platformio.ini index 6e8c5e6..5e7d24b 100644 --- a/projects-demo/esp32-c3-demo/platformio.ini +++ b/projects-demo/esp32-c3-demo/platformio.ini @@ -48,7 +48,7 @@ build_flags = -D ENV_NAME=app1 -D FIRMWARE_UPDATE_JSON_URL="archive-artifacts-pipeline.oss-cn-shanghai.aliyuncs.com/iot/car-lock/app1/prod/car-lockota.json" -D APP_VERSION=2.0.1 - -D MQTT_BROKER=iot-mqtt.pengbocloud.com + -D MQTT_BROKER=mqtt.pb55.cn -D MQTT_USERNAME=admin -D MQTT_PASSWORD=emqx@2022 From a29580467e2b26cda58007c21cfb5e6fffa8fa05 Mon Sep 17 00:00:00 2001 From: panweiji <406798106@qq.com> Date: Mon, 22 Jan 2024 14:49:39 +0800 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20=E5=A2=9E=E5=BC=BA=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8FC++=E4=BB=A3=E7=A0=81=E7=9A=84=E5=81=A5?= =?UTF-8?q?=E5=A3=AE=E6=80=A7=E5=92=8C=E5=8F=AF=E7=BB=B4=E6=8A=A4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/athena-common/http/at_http/at_http.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/athena-common/http/at_http/at_http.cpp b/packages/athena-common/http/at_http/at_http.cpp index 905dad0..b2105a4 100644 --- a/packages/athena-common/http/at_http/at_http.cpp +++ b/packages/athena-common/http/at_http/at_http.cpp @@ -39,7 +39,7 @@ DynamicJsonDocument at_http_get(String url, bool isResponseData) { if (isResponseData) { return get_http_uart_data(); } else { - return (const JsonDocument &) ""; + return (DynamicJsonDocument &&) (const JsonDocument &) ""; } } @@ -114,7 +114,7 @@ DynamicJsonDocument get_http_uart_data() { return json; // } } - return (const JsonDocument &) ""; + return (DynamicJsonDocument &&) (const JsonDocument &) ""; } /** From 948315f82fab3549f433494f12614d1b8f90f3e9 Mon Sep 17 00:00:00 2001 From: panweiji <406798106@qq.com> Date: Mon, 22 Jan 2024 14:51:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20=E5=A2=9E=E5=BC=BA=E5=B5=8C?= =?UTF-8?q?=E5=85=A5=E5=BC=8FC++=E4=BB=A3=E7=A0=81=E7=9A=84=E5=81=A5?= =?UTF-8?q?=E5=A3=AE=E6=80=A7=E5=92=8C=E5=8F=AF=E7=BB=B4=E6=8A=A4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projects/car-lock/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/car-lock/platformio.ini b/projects/car-lock/platformio.ini index 72c6f10..b843ae3 100644 --- a/projects/car-lock/platformio.ini +++ b/projects/car-lock/platformio.ini @@ -54,7 +54,7 @@ build_flags = -D PROJECT_NAME=car-lock-rizhao -D ENV_NAME=rizhao -D FIRMWARE_UPDATE_JSON_URL="archive-artifacts-pipeline.oss-cn-shanghai.aliyuncs.com/iot/car-lock/rizhao/prod/car-lockota.json" - -D MQTT_BROKER=iot-mqtt.pengbocloud.com + -D MQTT_BROKER=mqtt.pb55.cn -D MQTT_USERNAME=admin -D MQTT_PASSWORD=emqx@2022 @@ -64,7 +64,7 @@ build_flags = -D PROJECT_NAME=car-lock-xiaozhuang -D ENV_NAME=xiaozhuang -D FIRMWARE_UPDATE_JSON_URL="archive-artifacts-pipeline.oss-cn-shanghai.aliyuncs.com/iot/car-lock/xiaozhuang/prod/car-lockota.json" - -D MQTT_BROKER=iot-mqtt.pengbocloud.com + -D MQTT_BROKER=mqtt.pb55.cn -D MQTT_USERNAME=admin -D MQTT_PASSWORD=emqx@2022