Skip to content

Commit

Permalink
Merge pull request #12 from DreamPWJ/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DreamPWJ authored Feb 2, 2024
2 parents 131c02e + 948315f commit 0adf5d6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/athena-common/http/at_http/at_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &) "";
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ DynamicJsonDocument get_http_uart_data() {
return json;
// }
}
return (const JsonDocument &) "";
return (DynamicJsonDocument &&) (const JsonDocument &) "";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion projects-demo/esp32-c3-demo/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions projects-demo/esp32-c3-demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions projects/car-lock/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
22 changes: 13 additions & 9 deletions projects/car-lock/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 开启
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions projects/parking-space-gate/src/common.h
Original file line number Diff line number Diff line change
@@ -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 潘维吉
Expand All @@ -13,4 +13,4 @@
#define PIN_RX_2 19
#define PIN_TX_2 20

#endif //GROUND_LOCK_COMMON_H
#endif

0 comments on commit 0adf5d6

Please sign in to comment.