Commit c495f59c authored by 王金亮's avatar 王金亮

Merge branch 'develop' into 'xxh'

# Conflicts:
#   qianjiang/main/main_user.h
parents 731a6d38 9ed2ebe9
{
"configurations": [
{
"name": "ESP-IDF-5.0",
"compilerPath": "/home/u22/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
"compileCommands": "/home/u22/Desktop/GitLab/qj_500-7c/qianjiang/build/compile_commands.json",
"includePath": [
"/home/u22/esp-idf-r50/components/**",
"/home/u22/Desktop/GitLab/qj_500-7c/qianjiang/**"
],
"browse": {
"path": [
"/home/u22/esp-idf-r50/components",
"/home/u22/Desktop/GitLab/qj_500-7c/qianjiang"
],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}
{
"files.associations": {
"protocol_user.h": "c",
"protocol_lib.h": "c",
"protocol_crc16.h": "c",
"gatts_table_creat_demo.h": "c",
"app_ble_user.h": "c",
"main_user.h": "c",
"mcu_core_protocol.h": "c",
"app_bt_user.h": "c",
"bt_app_main.h": "c"
}
}
\ No newline at end of file
build/ build/
sdkconfig.old sdkconfig.old
/.vscode /.vscode
.vscode
*.o *.o
*.s *.s
*.log *.log
......
{
"idf.adapterTargetName": "esp32"
}
\ No newline at end of file
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
# in this exact order for cmake to work correctly # in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
# (Not part of the boilerplate) set(EXTRA_COMPONENT_DIRS "./source/http_user" "./source/wifi_user")
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(QJ500-7C) project(QJ500-7C)
# Embed the server root certificate into the final binary # Embed the server root certificate into the final binary
idf_build_get_property(project_dir PROJECT_DIR) idf_build_get_property(project_dir PROJECT_DIR)
idf_component_register(SRCS "app_BT_User.c" "bt_app_main.c" "bt_app_hf.c" "bt_app_core.c" "gatts_table_creat_demo.c" idf_component_register(SRCS "app_BT_User.c" "bt_app_main.c" "bt_app_hf.c" "bt_app_core.c" "gatts_table_creat_demo.c"
"simple_ota_example.c"
"Protocol_CRC16.c" "Protocol_CRC16.c"
"Protocol_Lib.c" "Protocol_Lib.c"
"Protocol_User.c" "Protocol_User.c"
"MCU_Core_Protocol.c" "MCU_Core_Protocol.c"
"app_Ble_User.c" "app_Ble_User.c"
"main_user.c" "main_user.c"
INCLUDE_DIRS "." INCLUDE_DIRS ".")
EMBED_TXTFILES ${project_dir}/server_certs/ca_cert.pem)
menu "Example Configuration"
config EXAMPLE_FIRMWARE_UPGRADE_URL
string "firmware upgrade url endpoint"
default "https://192.168.0.3:8070/hello_world.bin"
help
URL of server which hosts the firmware
image.
config EXAMPLE_USE_CERT_BUNDLE
bool "Enable certificate bundle"
default y
depends on MBEDTLS_CERTIFICATE_BUNDLE
help
Enable trusted root certificate bundle. This approach allows to have
OTA updates functional with any public server without requirement
to explicitly add its server certificate.
config EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
bool
default y if EXAMPLE_FIRMWARE_UPGRADE_URL = "FROM_STDIN"
config EXAMPLE_SKIP_COMMON_NAME_CHECK
bool "Skip server certificate CN fieldcheck"
default n
help
This allows you to skip the validation of OTA server certificate CN field.
config EXAMPLE_FIRMWARE_UPGRADE_BIND_IF
bool "Support firmware upgrade bind specified interface"
default n
help
This allows you to bind specified interface in OTA example.
choice EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_TYPE
prompt "Choose OTA data bind interface"
default EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_STA
depends on EXAMPLE_FIRMWARE_UPGRADE_BIND_IF
help
Select which interface type of OTA data go through.
config EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_STA
bool "Bind wifi station interface"
depends on EXAMPLE_CONNECT_WIFI
help
Select wifi station interface to pass the OTA data.
config EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_ETH
bool "Bind ethernet interface"
depends on EXAMPLE_CONNECT_ETHERNET
help
Select ethernet interface to pass the OTA data.
endchoice
endmenu
...@@ -669,6 +669,7 @@ void Ble_User_Task_Event(void *pvParameter) ...@@ -669,6 +669,7 @@ void Ble_User_Task_Event(void *pvParameter)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
uint8_t BT_User_HfClient_Req_Cnt;
void Ble_User_Task_Cyc(void *pvParameter) void Ble_User_Task_Cyc(void *pvParameter)
{ {
while (1) while (1)
...@@ -684,8 +685,22 @@ void Ble_User_Task_Cyc(void *pvParameter) ...@@ -684,8 +685,22 @@ void Ble_User_Task_Cyc(void *pvParameter)
} }
Get_Iphone_Fitter_callsts(); Get_Iphone_Fitter_callsts();
Ble_MsgRec_Navi_Timeout(); Ble_MsgRec_Navi_Timeout();
esp_hf_client_query_current_calls();
if(BT_User.Call_Sts != Call_Idle)
{
if(BT_User_HfClient_Req_Cnt ++ >= 15)
{
BT_User_HfClient_Req_Cnt = 0;
esp_hf_client_query_current_calls();
}
}
else
{
BT_User_HfClient_Req_Cnt = 0;
}
BT_User_Process(); BT_User_Process();
if(Wifi_OTA_Request != 0) if(Wifi_OTA_Request != 0)
......
...@@ -456,8 +456,9 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_ ...@@ -456,8 +456,9 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
// call_timer = 0; // call_timer = 0;
// } // }
// break; // break;
if(strstr(param->clcc.number,"10000000") == NULL) if((strstr(param->clcc.number,"10000000") == NULL) && (strstr(param->clcc.number,"00000000") == NULL))
{ {
// printf("%s\n",param->clcc.number);
BT_User.Get_Call_Num = 1; BT_User.Get_Call_Num = 1;
} }
} }
...@@ -508,7 +509,7 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_ ...@@ -508,7 +509,7 @@ void bt_app_hf_client_cb(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_
break; break;
} }
} }
// uint8_t lasttest;
void Get_Iphone_Fitter_callsts(void ) void Get_Iphone_Fitter_callsts(void )
{ {
if(BT_User.Call_Sts == Call_Idle) if(BT_User.Call_Sts == Call_Idle)
...@@ -527,7 +528,11 @@ void Get_Iphone_Fitter_callsts(void ) ...@@ -527,7 +528,11 @@ void Get_Iphone_Fitter_callsts(void )
BT_User.Call_Fitter_sts = Call_Idle; BT_User.Call_Fitter_sts = Call_Idle;
} }
} }
// printf("%d\n",BT_User.Call_Fitter_sts);
// if(BT_User.Call_Fitter_sts != lasttest)
// printf("%d\n",BT_User.Call_Fitter_sts);
// lasttest = BT_User.Call_Fitter_sts;
} }
......
...@@ -119,28 +119,6 @@ void bsp_Uart_Init(void ) ...@@ -119,28 +119,6 @@ void bsp_Uart_Init(void )
xTaskCreatePinnedToCore(Uart_Rx_Task, "Ble_User", 4096, NULL, 4, NULL, 1); xTaskCreatePinnedToCore(Uart_Rx_Task, "Ble_User", 4096, NULL, 4, NULL, 1);
} }
extern void simple_ota_main(void);
void simple_ota_service(void)
{
if(Wifi_OTA_Request == 1)
{
gatts_Ble_User_Task_Event_Del();
vTaskDelay(300);
gatts_App_Ble_DeInit();
simple_ota_main();
Wifi_OTA_Request = 2;
}
}
int gatts_App_Ble_DeInit(void) int gatts_App_Ble_DeInit(void)
{ {
esp_err_t err; esp_err_t err;
......
...@@ -73,8 +73,6 @@ void bsp_Uart_Init(void ); ...@@ -73,8 +73,6 @@ void bsp_Uart_Init(void );
int bsp_Ble_Gatts_Send_Indicate(uint8_t len, uint8_t *data); int bsp_Ble_Gatts_Send_Indicate(uint8_t len, uint8_t *data);
void simple_ota_service(void);
extern uint8_t BT_Device_Name[14]; extern uint8_t BT_Device_Name[14];
void Get_Mac_Init(void ); void Get_Mac_Init(void );
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "app_Ble_User.h" #include "app_Ble_User.h"
#include "app_BT_User.h" #include "app_BT_User.h"
#include "bt_app_hf.h" #include "bt_app_hf.h"
#include "wifi_service.h"
// const float Inter_SW = 1.1; // const float Inter_SW = 1.1;
...@@ -89,9 +89,14 @@ static void Sys_Run_Tasks(void *arg) ...@@ -89,9 +89,14 @@ static void Sys_Run_Tasks(void *arg)
if(SYS_RUN_TASK_1000MS) if(SYS_RUN_TASK_1000MS)
{ {
if(Wifi_OTA_Request == 1)
simple_ota_service(); {
gatts_Ble_User_Task_Event_Del();
vTaskDelay(300);
gatts_App_Ble_DeInit();
(void)wifi_turn_on();
Wifi_OTA_Request = 2;
}
testcnt++; testcnt++;
if(testcnt >= 10) if(testcnt >= 10)
...@@ -123,11 +128,6 @@ static void Sys_Run_Tasks(void *arg) ...@@ -123,11 +128,6 @@ static void Sys_Run_Tasks(void *arg)
} }
} }
if(Wifi_OTA_Request == 2)
{
// break;
}
vTaskDelay(1); vTaskDelay(1);
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#define _MAIN_USER_H_ #define _MAIN_USER_H_
#define BL_INTERNAL_SW_YEAR 0x24 #define BL_INTERNAL_SW_YEAR 0x24
#define BL_INTERNAL_SW_MONTH 0x09 #define BL_INTERNAL_SW_MONTH 0x10
#define BL_INTERNAL_SW_DAY 0x11 #define BL_INTERNAL_SW_DAY 0x29
#endif #endif
\ No newline at end of file
/* OTA example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_ota_ops.h"
#include "esp_http_client.h"
#include "esp_https_ota.h"
#include "protocol_examples_common.h"
#include "string.h"
#ifdef CONFIG_EXAMPLE_USE_CERT_BUNDLE
#include "esp_crt_bundle.h"
#endif
#include "nvs.h"
#include "nvs_flash.h"
#include "protocol_examples_common.h"
#include <sys/socket.h>
#if CONFIG_EXAMPLE_CONNECT_WIFI
#include "esp_wifi.h"
#endif
#define HASH_LEN 32
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF
/* The interface name value can refer to if_desc in esp_netif_defaults.h */
#if CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_ETH
static const char *bind_interface_name = EXAMPLE_NETIF_DESC_ETH;
#elif CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF_STA
static const char *bind_interface_name = EXAMPLE_NETIF_DESC_STA;
#endif
#endif
static const char *TAG = "simple_ota_example";
extern const uint8_t server_cert_pem_start[] asm("_binary_ca_cert_pem_start");
extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end");
#define OTA_URL_SIZE 256
esp_err_t _http_event_handler(esp_http_client_event_t *evt)
{
switch (evt->event_id) {
case HTTP_EVENT_ERROR:
ESP_LOGD(TAG, "HTTP_EVENT_ERROR");
break;
case HTTP_EVENT_ON_CONNECTED:
ESP_LOGD(TAG, "HTTP_EVENT_ON_CONNECTED");
break;
case HTTP_EVENT_HEADER_SENT:
ESP_LOGD(TAG, "HTTP_EVENT_HEADER_SENT");
break;
case HTTP_EVENT_ON_HEADER:
ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
break;
case HTTP_EVENT_ON_DATA:
ESP_LOGD(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
break;
case HTTP_EVENT_ON_FINISH:
ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");
break;
case HTTP_EVENT_DISCONNECTED:
ESP_LOGD(TAG, "HTTP_EVENT_DISCONNECTED");
break;
case HTTP_EVENT_REDIRECT:
ESP_LOGD(TAG, "HTTP_EVENT_REDIRECT");
break;
}
return ESP_OK;
}
void simple_ota_example_task(void *pvParameter)
{
int i = 0;
ESP_LOGI(TAG, "Starting OTA example task");
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF
esp_netif_t *netif = get_example_netif_from_desc(bind_interface_name);
if (netif == NULL) {
ESP_LOGE(TAG, "Can't find netif from interface description");
abort();
}
struct ifreq ifr;
esp_netif_get_netif_impl_name(netif, ifr.ifr_name);
ESP_LOGI(TAG, "Bind interface name is %s", ifr.ifr_name);
#endif
esp_http_client_config_t config = {
.url = CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL,
#ifdef CONFIG_EXAMPLE_USE_CERT_BUNDLE
.crt_bundle_attach = esp_crt_bundle_attach,
#else
.cert_pem = (char *)server_cert_pem_start,
#endif /* CONFIG_EXAMPLE_USE_CERT_BUNDLE */
.event_handler = _http_event_handler,
.keep_alive_enable = true,
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF
.if_name = &ifr,
#endif
};
#ifdef CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL_FROM_STDIN
char url_buf[OTA_URL_SIZE];
if (strcmp(config.url, "FROM_STDIN") == 0) {
example_configure_stdin_stdout();
fgets(url_buf, OTA_URL_SIZE, stdin);
int len = strlen(url_buf);
url_buf[len - 1] = '\0';
config.url = url_buf;
} else {
ESP_LOGE(TAG, "Configuration mismatch: wrong firmware upgrade image url");
abort();
}
#endif
#ifdef CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK
config.skip_cert_common_name_check = true;
#endif
esp_https_ota_config_t ota_config = {
.http_config = &config,
};
ESP_LOGI(TAG, "Attempting to download update from %s", config.url);
esp_err_t ret = esp_https_ota(&ota_config);
if (ret == ESP_OK) {
ESP_LOGI(TAG, "OTA Succeed");
// printf("\n");
// printf("==========================================================\n");
for(i = 5; i > 0; i--)
{
printf("============ System will restart in %d second. ============\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
// printf("============ System rebooting... ============\n");
// printf("==========================================================\n");
// printf("\n");
esp_restart();
} else {
ESP_LOGE(TAG, "Firmware upgrade failed");
for(i = 5; i > 0; i--)
{
printf("============ System will restart in %d second. ============\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
// printf("============ System rebooting... ============\n");
// printf("==========================================================\n");
// printf("\n");
esp_restart();
}
while (1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
static void print_sha256(const uint8_t *image_hash, const char *label)
{
char hash_print[HASH_LEN * 2 + 1];
hash_print[HASH_LEN * 2] = 0;
for (int i = 0; i < HASH_LEN; ++i) {
sprintf(&hash_print[i * 2], "%02x", image_hash[i]);
}
ESP_LOGI(TAG, "%s %s", label, hash_print);
}
static void get_sha256_of_partitions(void)
{
uint8_t sha_256[HASH_LEN] = { 0 };
esp_partition_t partition;
// get sha256 digest for bootloader
partition.address = ESP_BOOTLOADER_OFFSET;
partition.size = ESP_PARTITION_TABLE_OFFSET;
partition.type = ESP_PARTITION_TYPE_APP;
esp_partition_get_sha256(&partition, sha_256);
print_sha256(sha_256, "SHA-256 for bootloader: ");
// get sha256 digest for running partition
esp_partition_get_sha256(esp_ota_get_running_partition(), sha_256);
print_sha256(sha_256, "SHA-256 for current firmware: ");
}
void simple_ota_main(void)
{
ESP_LOGI(TAG, "OTA example app_main start");
// Initialize NVS.
// esp_err_t err = nvs_flash_init();
// if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
// 1.OTA app partition table has a smaller NVS partition size than the non-OTA
// partition table. This size mismatch may cause NVS initialization to fail.
// 2.NVS partition contains data in new format and cannot be recognized by this version of code.
// If this happens, we erase NVS partition and initialize NVS again.
// ESP_ERROR_CHECK(nvs_flash_erase());
// err = nvs_flash_init();
// }
// ESP_ERROR_CHECK(err);
get_sha256_of_partitions();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
* Read "Establishing Wi-Fi or Ethernet Connection" section in
* examples/protocols/README.md for more information about this function.
*/
ESP_ERROR_CHECK(example_connect());
#if CONFIG_EXAMPLE_CONNECT_WIFI
/* Ensure to disable any WiFi power save mode, this allows best throughput
* and hence timings for overall OTA operation.
*/
esp_wifi_set_ps(WIFI_PS_NONE);
#endif // CONFIG_EXAMPLE_CONNECT_WIFI
xTaskCreate(&simple_ota_example_task, "ota_example_task", 8192, NULL, 5, NULL);
}
This diff is collapsed.
...@@ -212,12 +212,12 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y ...@@ -212,12 +212,12 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set
# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set
# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
CONFIG_BOOTLOADER_LOG_LEVEL=1 CONFIG_BOOTLOADER_LOG_LEVEL=3
# #
# Serial Flash Configurations # Serial Flash Configurations
...@@ -314,56 +314,6 @@ CONFIG_PARTITION_TABLE_OFFSET=0xA000 ...@@ -314,56 +314,6 @@ CONFIG_PARTITION_TABLE_OFFSET=0xA000
CONFIG_PARTITION_TABLE_MD5=y CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table # end of Partition Table
#
# Example Configuration
#
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="http://192.168.137.1:3200/Qj500-7C.bin"
# CONFIG_EXAMPLE_USE_CERT_BUNDLE is not set
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
# CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF is not set
# end of Example Configuration
#
# Example Connection Configuration
#
CONFIG_ENV_GPIO_RANGE_MIN=0
CONFIG_ENV_GPIO_RANGE_MAX=39
CONFIG_ENV_GPIO_IN_RANGE_MAX=39
CONFIG_ENV_GPIO_OUT_RANGE_MAX=33
CONFIG_EXAMPLE_CONNECT_WIFI=y
# CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN is not set
CONFIG_EXAMPLE_PROVIDE_WIFI_CONSOLE_CMD=y
CONFIG_EXAMPLE_WIFI_SSID="myssid"
CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword"
CONFIG_EXAMPLE_WIFI_CONN_MAX_RETRY=6
# CONFIG_EXAMPLE_WIFI_SCAN_METHOD_FAST is not set
CONFIG_EXAMPLE_WIFI_SCAN_METHOD_ALL_CHANNEL=y
#
# WiFi Scan threshold
#
CONFIG_EXAMPLE_WIFI_SCAN_RSSI_THRESHOLD=-127
CONFIG_EXAMPLE_WIFI_AUTH_OPEN=y
# CONFIG_EXAMPLE_WIFI_AUTH_WEP is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WPA_PSK is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WPA2_PSK is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WPA_WPA2_PSK is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WPA2_ENTERPRISE is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WPA3_PSK is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WPA2_WPA3_PSK is not set
# CONFIG_EXAMPLE_WIFI_AUTH_WAPI_PSK is not set
# end of WiFi Scan threshold
CONFIG_EXAMPLE_WIFI_CONNECT_AP_BY_SIGNAL=y
# CONFIG_EXAMPLE_WIFI_CONNECT_AP_BY_SECURITY is not set
# CONFIG_EXAMPLE_CONNECT_ETHERNET is not set
CONFIG_EXAMPLE_CONNECT_IPV6=y
CONFIG_EXAMPLE_CONNECT_IPV6_PREF_LOCAL_LINK=y
# CONFIG_EXAMPLE_CONNECT_IPV6_PREF_GLOBAL is not set
# CONFIG_EXAMPLE_CONNECT_IPV6_PREF_SITE_LOCAL is not set
# CONFIG_EXAMPLE_CONNECT_IPV6_PREF_UNIQUE_LOCAL is not set
# end of Example Connection Configuration
# #
# Compiler options # Compiler options
# #
...@@ -454,6 +404,7 @@ CONFIG_BT_GATTC_NOTIF_REG_MAX=5 ...@@ -454,6 +404,7 @@ CONFIG_BT_GATTC_NOTIF_REG_MAX=5
CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3
CONFIG_BT_BLE_SMP_ENABLE=y CONFIG_BT_BLE_SMP_ENABLE=y
# CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set # CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set
# CONFIG_BT_BLE_SMP_ID_RESET_ENABLE is not set
# CONFIG_BT_STACK_NO_LOG is not set # CONFIG_BT_STACK_NO_LOG is not set
# #
...@@ -642,6 +593,7 @@ CONFIG_BT_MAX_DEVICE_NAME_LEN=32 ...@@ -642,6 +593,7 @@ CONFIG_BT_MAX_DEVICE_NAME_LEN=32
# CONFIG_BT_BLE_RPA_SUPPORTED is not set # CONFIG_BT_BLE_RPA_SUPPORTED is not set
CONFIG_BT_BLE_RPA_TIMEOUT=900 CONFIG_BT_BLE_RPA_TIMEOUT=900
# CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set # CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set
# CONFIG_BT_ABORT_WHEN_ALLOCATION_FAILS is not set
# end of Bluedroid Options # end of Bluedroid Options
# #
...@@ -695,12 +647,21 @@ CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=100 ...@@ -695,12 +647,21 @@ CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=100
CONFIG_BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD=0 CONFIG_BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD=0
# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set # CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set
CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y
# CONFIG_BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set
CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y
CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100
CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
CONFIG_BTDM_RESERVE_DRAM=0xdb5c CONFIG_BTDM_RESERVE_DRAM=0xdb5c
CONFIG_BTDM_CTRL_HLI=y CONFIG_BTDM_CTRL_HLI=y
# end of Controller Options # end of Controller Options
# CONFIG_BT_HCI_LOG_DEBUG_EN is not set
#
# Common Options
#
CONFIG_BT_ALARM_MAX_NUM=50
# end of Common Options
# end of Bluetooth # end of Bluetooth
# CONFIG_BLE_MESH is not set # CONFIG_BLE_MESH is not set
...@@ -901,7 +862,7 @@ CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y ...@@ -901,7 +862,7 @@ CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
# #
# HTTP Server # HTTP Server
# #
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024
CONFIG_HTTPD_MAX_URI_LEN=512 CONFIG_HTTPD_MAX_URI_LEN=512
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
CONFIG_HTTPD_PURGE_BUF_LEN=32 CONFIG_HTTPD_PURGE_BUF_LEN=32
...@@ -914,7 +875,7 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32 ...@@ -914,7 +875,7 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
# ESP HTTPS OTA # ESP HTTPS OTA
# #
# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set # CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set
CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP=y # CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set
# end of ESP HTTPS OTA # end of ESP HTTPS OTA
# #
...@@ -1162,6 +1123,7 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y ...@@ -1162,6 +1123,7 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y
# #
CONFIG_ESP32_WIFI_ENABLED=y CONFIG_ESP32_WIFI_ENABLED=y
CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y
# CONFIG_ESP_COEX_POWER_MANAGEMENT is not set
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set
...@@ -1182,13 +1144,13 @@ CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y ...@@ -1182,13 +1144,13 @@ CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set # CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
CONFIG_ESP32_WIFI_IRAM_OPT=y # CONFIG_ESP32_WIFI_IRAM_OPT is not set
CONFIG_ESP32_WIFI_RX_IRAM_OPT=y # CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set
CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y
CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y
# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set
CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y
# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set CONFIG_ESP_WIFI_GMAC_SUPPORT=y
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y
# CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set # CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set
CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7
...@@ -1353,7 +1315,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y ...@@ -1353,7 +1315,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
# #
# LWIP # LWIP
# #
CONFIG_LWIP_LOCAL_HOSTNAME="QJ500-7C" CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
# CONFIG_LWIP_NETIF_API is not set # CONFIG_LWIP_NETIF_API is not set
CONFIG_LWIP_TCPIP_TASK_PRIO=18 CONFIG_LWIP_TCPIP_TASK_PRIO=18
# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set
...@@ -1418,8 +1380,8 @@ CONFIG_LWIP_TCP_MSS=1440 ...@@ -1418,8 +1380,8 @@ CONFIG_LWIP_TCP_MSS=1440
CONFIG_LWIP_TCP_TMR_INTERVAL=250 CONFIG_LWIP_TCP_TMR_INTERVAL=250
CONFIG_LWIP_TCP_MSL=60000 CONFIG_LWIP_TCP_MSL=60000
CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5760
CONFIG_LWIP_TCP_WND_DEFAULT=5744 CONFIG_LWIP_TCP_WND_DEFAULT=5760
CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6
CONFIG_LWIP_TCP_QUEUE_OOSEQ=y CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6
...@@ -1480,7 +1442,7 @@ CONFIG_LWIP_SNTP_MAX_SERVERS=1 ...@@ -1480,7 +1442,7 @@ CONFIG_LWIP_SNTP_MAX_SERVERS=1
CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
# end of SNTP # end of SNTP
CONFIG_LWIP_BRIDGEIF_MAX_PORTS=50 CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7
# #
# DNS # DNS
...@@ -1898,12 +1860,12 @@ CONFIG_WPA_MBEDTLS_TLS_CLIENT=y ...@@ -1898,12 +1860,12 @@ CONFIG_WPA_MBEDTLS_TLS_CLIENT=y
# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set
# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y
# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
CONFIG_LOG_BOOTLOADER_LEVEL=1 CONFIG_LOG_BOOTLOADER_LEVEL=3
# CONFIG_APP_ROLLBACK_ENABLE is not set # CONFIG_APP_ROLLBACK_ENABLE is not set
# CONFIG_FLASH_ENCRYPTION_ENABLED is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set
# CONFIG_FLASHMODE_QIO is not set # CONFIG_FLASHMODE_QIO is not set
...@@ -2145,7 +2107,7 @@ CONFIG_ADC2_DISABLE_DAC=y ...@@ -2145,7 +2107,7 @@ CONFIG_ADC2_DISABLE_DAC=y
# CONFIG_EVENT_LOOP_PROFILING is not set # CONFIG_EVENT_LOOP_PROFILING is not set
CONFIG_POST_EVENTS_FROM_ISR=y CONFIG_POST_EVENTS_FROM_ISR=y
CONFIG_POST_EVENTS_FROM_IRAM_ISR=y CONFIG_POST_EVENTS_FROM_IRAM_ISR=y
CONFIG_OTA_ALLOW_HTTP=y # CONFIG_OTA_ALLOW_HTTP is not set
# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set
CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
...@@ -2242,8 +2204,8 @@ CONFIG_TCP_MAXRTX=12 ...@@ -2242,8 +2204,8 @@ CONFIG_TCP_MAXRTX=12
CONFIG_TCP_SYNMAXRTX=12 CONFIG_TCP_SYNMAXRTX=12
CONFIG_TCP_MSS=1440 CONFIG_TCP_MSS=1440
CONFIG_TCP_MSL=60000 CONFIG_TCP_MSL=60000
CONFIG_TCP_SND_BUF_DEFAULT=5744 CONFIG_TCP_SND_BUF_DEFAULT=5760
CONFIG_TCP_WND_DEFAULT=5744 CONFIG_TCP_WND_DEFAULT=5760
CONFIG_TCP_RECVMBOX_SIZE=6 CONFIG_TCP_RECVMBOX_SIZE=6
CONFIG_TCP_QUEUE_OOSEQ=y CONFIG_TCP_QUEUE_OOSEQ=y
CONFIG_TCP_OVERSIZE_MSS=y CONFIG_TCP_OVERSIZE_MSS=y
......
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_BIND_IF=y
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_EXAMPLE_CONNECT_IPV6=n
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
CONFIG_SECURE_FLASH_ENC_ENABLED=y
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y
CONFIG_SECURE_BOOT_ALLOW_JTAG=y
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y
CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y
CONFIG_PARTITION_TABLE_OFFSET=0x9000
CONFIG_EXAMPLE_CONNECT_ETHERNET=n
CONFIG_EXAMPLE_CONNECT_WIFI=y
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y
# This is required for nvs encryption (which is enabled by default with flash encryption)
CONFIG_PARTITION_TABLE_TWO_OTA_ENCRYPTED_NVS=y
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_EXAMPLE_CONNECT_IPV6=n
# ECDSA is available only in ESP32
CONFIG_IDF_TARGET="esp32"
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
CONFIG_PARTITION_TABLE_OFFSET=0xC000
CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT=y
CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT=y
CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME=y
CONFIG_SECURE_BOOT_SIGNING_KEY="test/secure_boot_signing_key_ecdsa.pem"
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
CONFIG_EXAMPLE_ETH_PHY_IP101=y
CONFIG_EXAMPLE_ETH_MDC_GPIO=23
CONFIG_EXAMPLE_ETH_MDIO_GPIO=18
CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5
CONFIG_EXAMPLE_ETH_PHY_ADDR=1
CONFIG_EXAMPLE_CONNECT_IPV6=y
# ESP32 supports SIGNED_APPS_RSA_SCHEME only in ECO3
CONFIG_ESP32_REV_MIN_3=y
CONFIG_ESP32_REV_MIN=3
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
CONFIG_PARTITION_TABLE_OFFSET=0xC000
CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT=y
CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT=y
CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y
CONFIG_SECURE_BOOT_SIGNING_KEY="test/secure_boot_signing_key.pem"
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
CONFIG_EXAMPLE_ETH_PHY_IP101=y
CONFIG_EXAMPLE_ETH_MDC_GPIO=23
CONFIG_EXAMPLE_ETH_MDIO_GPIO=18
CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5
CONFIG_EXAMPLE_ETH_PHY_ADDR=1
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_EXAMPLE_CONNECT_IPV6=n
CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN"
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
CONFIG_EXAMPLE_ETH_PHY_IP101=y
CONFIG_EXAMPLE_ETH_MDC_GPIO=23
CONFIG_EXAMPLE_ETH_MDIO_GPIO=18
CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5
CONFIG_EXAMPLE_ETH_PHY_ADDR=1
CONFIG_EXAMPLE_CONNECT_IPV6=y
...@@ -2,3 +2,36 @@ ...@@ -2,3 +2,36 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
# #
CONFIG_BT_ENABLED=y CONFIG_BT_ENABLED=y
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="QJ500_7C_partitions_two_ota.csv"
CONFIG_PARTITION_TABLE_FILENAME="QJ500_7C_partitions_two_ota.csv"
CONFIG_PARTITION_TABLE_OFFSET=0xA000
CONFIG_BT_CLASSIC_ENABLED=y
CONFIG_BT_HFP_ENABLE=y
CONFIG_BT_HFP_CLIENT_ENABLE=y
CONFIG_BT_HFP_AG_ENABLE=y
CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM=y
CONFIG_BT_SSP_ENABLED=y
CONFIG_BTDM_CTRL_MODE_BTDM=y
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=2
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1
CONFIG_BTDM_CTRL_PCM_ROLE_EDGE_CONFIG=y
CONFIG_BTDM_CTRL_PCM_ROLE_MASTER=y
CONFIG_BTDM_CTRL_PCM_POLAR_FALLING_EDGE=y
CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y
CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=2
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240
CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4=y
CONFIG_ESP_BROWNOUT_DET_LVL=4
CONFIG_FREERTOS_HZ=1000
# http set
CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32c2"
CONFIG_BT_ENABLED=y
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
# CONFIG_BT_LE_50_FEATURE_SUPPORT is not set
CONFIG_BT_LE_HCI_EVT_BUF_SIZE=257
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32c3"
CONFIG_BT_ENABLED=y
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32h2"
CONFIG_BT_ENABLED=y
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
# CONFIG_BT_LE_50_FEATURE_SUPPORT is not set
CONFIG_RTC_CLK_SRC_EXT_CRYS=y
CONFIG_RTC_CLK_CAL_CYCLES=576
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_BT_ENABLED=y
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
-----BEGIN CERTIFICATE-----
MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ
TjELMAkGA1UECAwCTUgxDDAKBgNVBAcMA1BVTjEMMAoGA1UECgwDRVNQMQwwCgYD
VQQLDANFU1AxDDAKBgNVBAMMA0VTUDEaMBgGCSqGSIb3DQEJARYLZXNwQGVzcC5j
b20wHhcNMjEwNzEyMTIzNjI3WhcNNDEwNzA3MTIzNjI3WjBuMQswCQYDVQQGEwJJ
TjELMAkGA1UECAwCTUgxDDAKBgNVBAcMA1BVTjEMMAoGA1UECgwDRVNQMQwwCgYD
VQQLDANFU1AxDDAKBgNVBAMMA0VTUDEaMBgGCSqGSIb3DQEJARYLZXNwQGVzcC5j
b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDhxF/y7bygndxPwiWL
SwS9LY3uBMaJgup0ufNKVhx+FhGQOu44SghuJAaH3KkPUnt6SOM8jC97/yQuc32W
ukI7eBZoA12kargSnzdv5m5rZZpd+NznSSpoDArOAONKVlzr25A1+aZbix2mKRbQ
S5w9o1N2BriQuSzd8gL0Y0zEk3VkOWXEL+0yFUT144HnErnD+xnJtHe11yPO2fEz
YaGiilh0ddL26PXTugXMZN/8fRVHP50P2OG0SvFpC7vghlLp4VFM1/r3UJnvL6Oz
3ALc6dhxZEKQucqlpj8l1UegszQToopemtIj0qXTHw2+uUnkUyWIPjPC+wdOAoap
rFTRAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAItw24y565k3C/zENZlxyzto44ud
IYPQXN8Fa2pBlLe1zlSIyuaA/rWQ+i1daS8nPotkCbWZyf5N8DYaTE4B0OfvoUPk
B5uGDmbuk6akvlB5BGiYLfQjWHRsK9/4xjtIqN1H58yf3QNROuKsPAeywWS3Fn32
3//OpbWaClQePx6udRYMqAitKR+QxL7/BKZQsX+UyShuq8hjphvXvk0BW8ONzuw9
RcoORxM0FzySYjeQvm4LhzC/P3ZBhEq0xs55aL2a76SJhq5hJy7T/Xz6NFByvlrN
lFJJey33KFrAf5vnV9qcyWFIo7PYy2VsaaEjFeefr7q3sTFSMlJeadexW2Y=
-----END CERTIFICATE-----
idf_component_register(SRCS "http_service.c"
INCLUDE_DIRS "."
PRIV_REQUIRES esp_http_server app_update
EMBED_FILES "html/favicon.ico" "html/ota_app.html")
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<!-- 页面标题 -->
<meta name="head_meta_name" content="width=device-width, initial-scale=1" charset="utf-8">
<title>应用程序更新</title>
<script>
window.addEventListener("DOMContentLoaded", (event) => {
/* 加载完成后禁用升级按钮 */
document.getElementById("id_button_ota_start").disabled = true;
});
</script>
</head>
<body>
<!-- 小标题 -->
<h2>应用程序更新</h2>
<hr>
<!-- 页面重置超链接 -->
<a href="javascript:void(0);" onclick="reset_page()" style="font-size: smaller;">[重置页面]</a><br><br>
<!-- 选择文本按钮 -->
<label for="label_file">选择文件:</label>
<input id="id_input_file" type="file" accept=".bin" onchange="get_file_info()">
<br><br>
<!-- 上传操作 -->
<label for="label_operation">执行操作:</label>
<button id="id_button_ota_start" type="button" onclick="ota_start()">开始升级</button>
<br><br>
<!-- 进度显示 -->
<label for="lable_ota_percent">进度显示:</label>
<input id="id_input_ota_percent" type="text" value="0.00%" style="width: 75px;border: none;font-size:large;">
<progress id="id_progress_ota" value="0" max="100"></progress>
<br><br>
<hr>
<p id="id_p_select_file_name"></p>
<p id="id_p_select_file_size"></p>
<p id="id_p_ota_start"></p>
<p id="id_p_ota_result"></p>
<script>
function reset_page() {
location.replace(location.href);
}
function get_file_size(size) {
var unit = 1024.00;
if (size < unit) {
return size + "B";
}
if (size < Math.pow(unit, 2)) {
return (size / unit).toFixed(2) + "KB";
}
if (size < Math.pow(unit, 3)) {
return (size / Math.pow(unit, 2)).toFixed(2) + "MB";
}
}
function get_file_info() {
var select_file = document.getElementById("id_input_file").files[0];
var select_file_name = select_file.name;
var select_file_size = select_file.size;
var app_size = 2048 * 1024;
if (select_file_size > app_size) {
document.getElementById("id_p_ota_result").innerHTML = "超出最大限制(" + app_size / 1024 + "KB),请重新选择文件";
document.getElementById("id_button_ota_start").disabled = true;
}
else if (select_file_size == 0) {
document.getElementById("id_p_ota_result").innerHTML = "空文件,请重新选择文件";
document.getElementById("id_button_ota_start").disabled = true;
}
else {
document.getElementById("id_p_ota_result").innerHTML = "";
document.getElementById("id_button_ota_start").disabled = false;
}
document.getElementById("id_p_select_file_name").innerHTML = "已加载文件名称:" + select_file_name;
document.getElementById("id_p_select_file_size").innerHTML = "已加载文件大小:" + get_file_size(select_file_size);
}
function ota_start() {
var file_path = document.getElementById("id_input_file").files[0].name;
var ota_path = "/ota/app/" + file_path;
if (typeof (ota_path) != "undefined") {
document.getElementById("id_p_ota_start").innerHTML = "锁定页面,请务必保持WiFi在线,正在上传...";
document.getElementById("id_input_file").disabled = true;
document.getElementById("id_button_ota_start").disabled = true;
var file = document.getElementById("id_input_file").files[0];
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
document.getElementById("id_p_ota_result").innerHTML = "上传成功!";
} else if (xhttp.status == 0) {
document.getElementById("id_p_ota_result").innerHTML = "服务器断开!<br><br>请检查服务器是否在线,刷新页面后重新上传...";
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
}
}
};
let progress_bar = document.getElementById("id_progress_ota");
xhttp.upload.onprogress = function (e) {
var percent_value = (event.loaded * 100.00) / (event.total * 1.00);
percent_value = percent_value.toFixed(2);
progress_bar.value = Math.round(percent_value);
document.getElementById("id_input_ota_percent").value = percent_value + "%";
}
xhttp.open("POST", ota_path, true);
xhttp.send(file);
}
}
</script>
</body>
</html>
\ No newline at end of file
#include <sys/param.h>
#include "esp_log.h"
#include "esp_http_server.h"
#include "esp_ota_ops.h"
#include "http_service.h"
#define MAX_CACHE_SIZE 1024u // HTTP服务接收数据的最大缓存大小
#define MAX_RETRY_COUNT 2 // HTTP服务超时后的最大重试次数
static const char *TAG = "http_service";
httpd_handle_t http_server = NULL;
static void http_resp_favicon_ico(httpd_req_t *req)
{
extern const unsigned char favicon_ico_start[] asm("_binary_favicon_ico_start");
extern const unsigned char favicon_ico_end[] asm("_binary_favicon_ico_end");
const size_t favicon_ico_size = (favicon_ico_end - favicon_ico_start);
ESP_LOGI(TAG, "---- 下载网站图标");
httpd_resp_set_type(req, "image/x-icon");
httpd_resp_send(req, (const char *)favicon_ico_start, favicon_ico_size);
}
static void http_resp_index_html(httpd_req_t *req)
{
extern const unsigned char index_html_start[] asm("_binary_index_html_start");
extern const unsigned char index_html_end[] asm("_binary_index_html_end");
const size_t index_html_size = (index_html_end - index_html_start);
ESP_LOGI(TAG, "---- 固件升级首页");
httpd_resp_set_type(req, "text/HTML");
httpd_resp_send(req, (const char *)index_html_start, index_html_size);
}
static void http_resp_ota_app_html(httpd_req_t *req)
{
extern const unsigned char ota_app_html_start[] asm("_binary_ota_app_html_start");
extern const unsigned char ota_app_html_end[] asm("_binary_ota_app_html_end");
const size_t ota_app_html_size = (ota_app_html_end - ota_app_html_start);
ESP_LOGI(TAG, "---- get into ota app page");
httpd_resp_set_type(req, "text/HTML");
httpd_resp_send(req, (const char *)ota_app_html_start, ota_app_html_size);
}
static esp_err_t http_resp_handler(httpd_req_t *req)
{
const char *uri_get = req->uri;
ESP_LOGI(TAG, "---- request uri: http://192.168.4.1%s", req->uri);
if (strcmp(uri_get, "/") == 0)
{
http_resp_ota_app_html(req);
}
else if (strcmp(uri_get, "/favicon.ico") == 0)
{
http_resp_favicon_ico(req);
}
else if (strcmp(uri_get, "/ota/app") == 0)
{
http_resp_ota_app_html(req);
}
else
{
ESP_LOGI(TAG, "---- unknown uri, back to index page");
http_resp_ota_app_html(req);
}
return ESP_OK;
}
static esp_err_t http_ota_app_handler(httpd_req_t *req)
{
int ret = 0;
int recv_block = 0;
int remaining = req->content_len;
int total = remaining;
double percent = 0.0;
int err_timeout_retry_cnt = 0;
ESP_LOGI(TAG, "---- expect ota data length(bytes): %d", remaining);
esp_ota_handle_t app_update_handle = 0;
const esp_partition_t *app_update_partition = esp_ota_get_next_update_partition(NULL);
esp_err_t err = esp_ota_begin(app_update_partition, OTA_WITH_SEQUENTIAL_WRITES, &app_update_handle);
if (err == ESP_OK)
{
char *http_buffer = (char *)malloc(MAX_CACHE_SIZE);
while (remaining > 0)
{
/* Read the data for the request */
if ((ret = httpd_req_recv(req, http_buffer, MIN(remaining, MAX_CACHE_SIZE))) <= 0)
{
if (ret == HTTPD_SOCK_ERR_TIMEOUT)
{
err_timeout_retry_cnt++;
if (err_timeout_retry_cnt >= MAX_RETRY_COUNT)
{
httpd_resp_send_408(req);
ESP_LOGE(TAG, "---- get ota data timeout, stop ota process, system will reboot after one second.");
break;
}
else
{
/* Retry receiving if timeout occurred */
ESP_LOGW(TAG, "---- get ota data timeout, try it again.");
continue;
}
}
else
{
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to receive file, system will reboot after one second.");
ESP_LOGE(TAG, "---- get ota data error, stop ota process, system will reboot after one second.");
break;
}
}
err_timeout_retry_cnt = 0;
err = esp_ota_write(app_update_handle, http_buffer, ret);
if (err != ESP_OK)
{
ESP_LOGI(TAG, "---- write ota data failed, error message:(%s), system will reboot after one second.", esp_err_to_name(err));
break;
}
else
{
remaining -= ret;
recv_block++;
if ((recv_block % 16) == 0)
{
percent = 100.0 - (double)(remaining * 100) / (double)total;
ESP_LOGI(TAG, "---- ota process: %.2f%%", percent);
}
}
}
free(http_buffer);
if (remaining == 0)
{
err = esp_ota_end(app_update_handle);
if (err == ESP_OK)
{
esp_err_t err = esp_ota_set_boot_partition(app_update_partition);
if (err == ESP_OK)
{
if (err == ESP_OK)
{
ESP_LOGI(TAG, "---- ota process: 100.00%%");
ESP_LOGI(TAG, "---- ota success, reboot after one seconds");
}
else
{
ESP_LOGE(TAG, "---- ota success, but error occurred when write firmware info into eeprom.");
}
}
else
{
ESP_LOGE(TAG, "---- set boot partition failed, error message:(%s), system will reboot after one second.", esp_err_to_name(err));
}
}
else
{
ESP_LOGE(TAG, "---- verify program fail, error message:(%s), system will reboot after one second.", esp_err_to_name(err));
}
}
else
{
ESP_LOGE(TAG, "---- ota data lost, stop ota process, system will reboot after one second.");
}
}
else
{
ESP_LOGE(TAG, "---- can not find next app partition");
}
httpd_resp_send_chunk(req, NULL, 0);
vTaskDelay(pdMS_TO_TICKS(1000));
esp_restart();
return ESP_OK;
}
httpd_handle_t start_webserver(void)
{
httpd_handle_t server = NULL;
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.lru_purge_enable = true;
config.uri_match_fn = httpd_uri_match_wildcard;
// Start the httpd server
ESP_LOGI(TAG, "---- httpd server port: '%d'", config.server_port);
if (httpd_start(&server, &config) == ESP_OK)
{
// Set URI handlers
ESP_LOGI(TAG, "---- Set URI handlers");
// register client GET handle
httpd_uri_t http_resp = {
.uri = "/*",
.method = HTTP_GET,
.handler = http_resp_handler,
.user_ctx = NULL};
httpd_register_uri_handler(server, &http_resp);
// register client ota app handle
httpd_uri_t http_ota_app = {
.uri = "/ota/app/*",
.method = HTTP_POST,
.handler = http_ota_app_handler,
.user_ctx = NULL};
httpd_register_uri_handler(server, &http_ota_app);
return server;
}
ESP_LOGI(TAG, "---- error occurred during server startup");
return NULL;
}
esp_err_t stop_webserver(httpd_handle_t server)
{
return httpd_stop(server);
}
void start_webserver_handler(void *arg)
{
httpd_handle_t *server = (httpd_handle_t *)arg;
if (*server == NULL)
{
ESP_LOGI(TAG, "---- start http server");
*server = start_webserver();
}
}
void stop_webserver_handler(void *arg)
{
httpd_handle_t *server = (httpd_handle_t *)arg;
if (*server)
{
ESP_LOGI(TAG, "---- stop http server");
if (stop_webserver(*server) == ESP_OK)
{
*server = NULL;
}
else
{
ESP_LOGE(TAG, "Failed to stop http server");
}
}
}
#ifndef _HTTP_SERVICE_H_
#define _HTTP_SERVICE_H_
void start_webserver_handler(void *arg);
void stop_webserver_handler(void *arg);
#endif
idf_component_register(SRCS "wifi_service.c"
INCLUDE_DIRS "."
PRIV_REQUIRES esp_event esp_netif esp_wifi esp_http_server http_user)
#include "esp_log.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "esp_wifi.h"
#include "esp_mac.h"
#include "esp_http_server.h"
#include "wifi_service.h"
#include "http_service.h"
static const char* TAG = "wifi_service";
wifi_service_t g_wifi_service;
esp_netif_t* wifi_ap_netif = NULL;
extern httpd_handle_t http_server;
static void wifi_event_handler(void* event_handler_arg, esp_event_base_t event_base, int32_t event_id, void* event_data)
{
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STACONNECTED)
{
wifi_event_ap_staconnected_t* event = (wifi_event_ap_staconnected_t*)event_data;
ESP_LOGI(TAG, "---- 设备加入网络, MAC地址 :" MACSTR ", 编号(AID) = %d.", MAC2STR(event->mac), event->aid);
start_webserver_handler(event_handler_arg);
// wifi_service_stop_timer_clear();
}
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STADISCONNECTED)
{
wifi_event_ap_stadisconnected_t* event = (wifi_event_ap_stadisconnected_t*)event_data;
ESP_LOGI(TAG, "---- 设备退出网络, MAC地址 :" MACSTR ", 编号(AID) = %d.", MAC2STR(event->mac), event->aid);
stop_webserver_handler(event_handler_arg);
// wifi_service_stop_timer_clear();
}
}
void wifi_ap_start(void)
{
// 创建系统事件循环
ESP_LOGI(TAG, "---- 创建系统事件循环...");
ESP_ERROR_CHECK(esp_event_loop_create_default());
// 将WiFi的所有事件作为实例注册进系统事件循环中
ESP_LOGI(TAG, "---- 注册WiFi事件实例...");
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, wifi_event_handler, &http_server));
// 初始化网卡相关的底层配置
ESP_LOGI(TAG, "---- 网卡初始化...");
ESP_ERROR_CHECK(esp_netif_init());
// 以默认的方式创建一个ap类型的网卡
ESP_LOGI(TAG, "---- 创建AP类型网卡...");
wifi_ap_netif = esp_netif_create_default_wifi_ap();
// 初始化WiFi底层配置
ESP_LOGI(TAG, "---- WiFi初始化...");
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
// all configuration will only store in the memory
esp_wifi_set_storage(WIFI_STORAGE_RAM);
// 将WiFi设置成AP模式
ESP_LOGI(TAG, "---- 配置WiFi为AP模式...");
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
// 创建AP配置
ESP_LOGI(TAG, "---- 创建AP配置...");
wifi_config_t wifi_config = {
.ap = {
.ssid = WIFI_AP_SSID,
.password = WIFI_AP_PASSWD,
.ssid_len = strlen(WIFI_AP_SSID),
.channel = 11,
.max_connection = 1,
.authmode = WIFI_AUTH_WPA_WPA2_PSK} };
// 获取当前AP的MAC地址
unsigned char wifi_ap_mac[6];
esp_wifi_get_mac(WIFI_IF_AP, wifi_ap_mac);
// 将MAC地址后两个字节转为字符串
char wifi_ap_temp_str[5];
sprintf(wifi_ap_temp_str, "%02X%02X", wifi_ap_mac[4], wifi_ap_mac[5]);
// 将MAC地址拼接到 ESP_WIFI_SSID 后面
char wifi_ap_ssid[32] = WIFI_AP_SSID;
strcat(wifi_ap_ssid, wifi_ap_temp_str);
// 重新配置 ssid 和 ssid_len
memcpy(wifi_config.ap.ssid, wifi_ap_ssid, sizeof(wifi_config.ap.ssid));
wifi_config.ap.ssid_len = strlen(wifi_ap_ssid);
// 配置AP的属性
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config));
// 关闭WiFi省电模式
esp_wifi_set_ps(WIFI_PS_NONE);
// 设置WiFi功率为最大 20dBm
esp_wifi_set_max_tx_power(20);
// 开启WiFi
ESP_LOGI(TAG, "---- 开启WiFi, 名称 : %s 密码 : %s", wifi_config.ap.ssid, wifi_config.ap.password);
ESP_ERROR_CHECK(esp_wifi_start());
}
void wifi_ap_stop(void)
{
// 关闭WiFi
ESP_LOGI(TAG, "---- 关闭WiFi...");
ESP_ERROR_CHECK(esp_wifi_stop());
// WiFi反初始化
ESP_LOGI(TAG, "---- WiFi反初始化...");
ESP_ERROR_CHECK(esp_wifi_deinit());
// 销毁网卡实例
ESP_LOGI(TAG, "---- 销毁网卡实例...");
esp_netif_destroy_default_wifi(wifi_ap_netif);
// 网卡反初始化 - 官方未实现的功能
// ESP_LOGI(TAG, "---- 网卡反初始化...");
// ESP_ERROR_CHECK(esp_netif_deinit());
// 注销WiFi事件实例
ESP_LOGI(TAG, "---- 注销WiFi事件实例...");
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, wifi_event_handler));
// 删除系统事件循环
ESP_LOGI(TAG, "---- 删除系统事件循环...");
ESP_ERROR_CHECK(esp_event_loop_delete_default());
}
unsigned char wifi_turn_on(void)
{
unsigned char ret;
if (g_wifi_service.status == WIFI_SERVICE_STOP)
{
g_wifi_service.status = WIFI_SERVICE_START;
wifi_ap_start();
ret = WIFI_SERVICE_OK;
}
else if (g_wifi_service.status == WIFI_SERVICE_START)
{
ret = WIFI_SERVICE_START;
}
else
{
ret = WIFI_SERVICE_ERR;
}
return ret;
}
unsigned char wifi_turn_off(void)
{
unsigned char ret;
if (g_wifi_service.status == WIFI_SERVICE_START)
{
g_wifi_service.status = WIFI_SERVICE_STOP;
wifi_ap_stop();
ret = WIFI_SERVICE_OK;
}
else if (g_wifi_service.status == WIFI_SERVICE_STOP)
{
ret = WIFI_SERVICE_STOP;
}
else
{
ret = WIFI_SERVICE_ERR;
}
return ret;
}
void wifi_service_status_init()
{
g_wifi_service.status = WIFI_SERVICE_STOP;
}
#ifndef _WIFI_SERVICE_H_
#define _WIFI_SERVICE_H_
#define WIFI_SERVICE_STOP 0 // WiFi服务已关闭
#define WIFI_SERVICE_INIT 1 // WiFi服务初始化
#define WIFI_SERVICE_START 2 // WiFi服务已开启
#define WIFI_SERVICE_DEINIT 3 // WiFi服务反初始化
#define WIFI_SERVICE_ERR 4 // WiFi服务状态错误
#define WIFI_SERVICE_OK 5 // WiFi服务开启或关闭成功
#define NOTHING_TO_DO 0 // 不执行操作
#define ABOUT_TO_STOP 1 // 即将关闭
#define WIFI_AP_STOP 0 // AP已关闭
#define WIFI_AP_INIT 1 // AP初始化
#define WIFI_AP_START 2 // AP已开启
#define WIFI_AP_DEINIT 3 // AP反初始化
#define WIFI_AP_SSID "QJ500-7C-AP-"
#define WIFI_AP_PASSWD "12345677"
typedef struct
{
unsigned char status; // WiFi状态
} wifi_service_t;
/**
* @brief 开启AP
*/
void wifi_ap_start(void);
/**
* @brief 关闭AP
*/
void wifi_ap_stop(void);
/**
* @brief 初始化WiFi的状态
*/
void wifi_service_status_init();
/**
* @brief 立刻开启 WiFi AP
* @note return: WIFI_SERVICE_OK,正在开启
* @note return: WIFI_SERVICE_ERR,WiFi状态不正确,无法开启
* @note return: WIFI_SERVICE_START, WiFi已开启,无需再开启
*/
unsigned char wifi_turn_on(void);
/**
* @brief 立刻关闭 WiFi AP
* @note return: WIFI_SERVICE_OK,正在关闭
* @note return: WIFI_SERVICE_ERR,WiFi状态不正确,无法关闭
* @note return: WIFI_SERVICE_STOP, WiFi已关闭,无需再关闭
*/
unsigned char wifi_turn_off(void);
#endif
-----BEGIN RSA PRIVATE KEY-----
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
-----END RSA PRIVATE KEY-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIOvP45grF4dSM2fWbOAp4W8PgFm30HIZqtNEK13O5hVHoAoGCCqGSM49
AwEHoUQDQgAE1IL73BARrNpkHj1jG50eHoF2LERCwz1BfbshuAeLcsED5aT92Xgu
gJvq45LN9p6eBi62ZZwr6Z2ZfX3YB3/8KA==
-----END EC PRIVATE KEY-----
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment