btserver
This commit is contained in:
parent
c78198c985
commit
905f936721
6
.vs/VSWorkspaceState.json
Normal file
6
.vs/VSWorkspaceState.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
BIN
.vs/pile_cm_esp32/v15/.suo
Normal file
BIN
.vs/pile_cm_esp32/v15/.suo
Normal file
Binary file not shown.
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"idf.adapterTargetName": "esp32s3"
|
"idf.adapterTargetName": "esp32s3",
|
||||||
|
"files.associations": {
|
||||||
|
"can_network.h": "c"
|
||||||
|
}
|
||||||
}
|
}
|
1
Makefile
1
Makefile
@ -6,5 +6,6 @@
|
|||||||
PROJECT_NAME := wifi_station
|
PROJECT_NAME := wifi_station
|
||||||
EXTRA_COMPONENT_DIRS += $(IDF_PATH)/examples/common_components
|
EXTRA_COMPONENT_DIRS += $(IDF_PATH)/examples/common_components
|
||||||
EXTRA_COMPONENT_DIRS += $(IDF_PATH)/examples/peripherals/pcnt/rotary_encoder/components
|
EXTRA_COMPONENT_DIRS += $(IDF_PATH)/examples/peripherals/pcnt/rotary_encoder/components
|
||||||
|
COMPONENT_ADD_INCLUDEDIRS := components/include
|
||||||
|
|
||||||
include $(IDF_PATH)/make/project.mk
|
include $(IDF_PATH)/make/project.mk
|
||||||
|
@ -121,7 +121,8 @@ struct rotary_encoder_t {
|
|||||||
* - ESP_FAIL: Create rotary encoder instance failed because of other error
|
* - ESP_FAIL: Create rotary encoder instance failed because of other error
|
||||||
*/
|
*/
|
||||||
esp_err_t rotary_encoder_new_ec11(const rotary_encoder_config_t *config, rotary_encoder_t **ret_encoder);
|
esp_err_t rotary_encoder_new_ec11(const rotary_encoder_config_t *config, rotary_encoder_t **ret_encoder);
|
||||||
esp_err_t ec11_pcnt_clear(pcnt_unit_t);
|
//esp_err_t ec11_pcnt_clear(pcnt_unit_t);
|
||||||
|
// esp_err_t ec11_pcnt_clear(pcnt_unit_t unit);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "sys/lock.h"
|
#include "sys/lock.h"
|
||||||
#include "hal/pcnt_hal.h"
|
#include "hal/pcnt_hal.h"
|
||||||
#include "rotary_encoder.h"
|
#include "rotary_encoder.h"
|
||||||
|
// #include "pcnt.h"
|
||||||
|
|
||||||
static const char *TAG = "rotary_encoder";
|
static const char *TAG = "rotary_encoder";
|
||||||
|
|
||||||
@ -232,7 +233,7 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ec11_pcnt_clear(pcnt_unit_t unit)
|
esp_err_t ec11_pcnt_clear(pcnt_unit_t unit)
|
||||||
{
|
{
|
||||||
return pcnt_counter_clear(unit);
|
return pcnt_counter_clear(unit);
|
||||||
}
|
}
|
@ -1,18 +1,45 @@
|
|||||||
idf_component_register(SRCS "uart_example.c" "main.c"
|
# idf_component_register(SRCS "uart_example.c" "main.c"
|
||||||
"modbus-tcp.c"
|
# "modbus-tcp.c"
|
||||||
"can_network.c"
|
# "can_network.c"
|
||||||
"./stm32/ads1220.c"
|
# "./stm32/ads1220.c"
|
||||||
"./stm32/bl0939.c"
|
# "./stm32/bl0939.c"
|
||||||
"./stm32/capture.c"
|
# "./stm32/capture.c"
|
||||||
"./stm32/comm.c"
|
# "./stm32/comm.c"
|
||||||
"./stm32/depth.c"
|
# "./stm32/depth.c"
|
||||||
"./stm32/fram.c"
|
# "./stm32/fram.c"
|
||||||
"./stm32/flow.c"
|
# "./stm32/flow.c"
|
||||||
"./stm32/utils.c"
|
# "./stm32/utils.c"
|
||||||
"./stm32/config.c"
|
# "./stm32/config.c"
|
||||||
"./stm32/ModbusS.c"
|
# "./stm32/ModbusS.c"
|
||||||
"./stm32/ModbusM.c"
|
# "./stm32/ModbusM.c"
|
||||||
"./stm32/uart0_modbus_slave.c"
|
# "./stm32/uart0_modbus_slave.c"
|
||||||
"wifi_softap.c"
|
# "wifi_softap.c"
|
||||||
INCLUDE_DIRS ".")
|
# "bt_server.c"
|
||||||
|
# INCLUDE_DIRS ".")
|
||||||
|
|
||||||
|
set(SRCS
|
||||||
|
"uart_example.c"
|
||||||
|
"main.c"
|
||||||
|
"modbus-tcp.c"
|
||||||
|
"can_network.c"
|
||||||
|
"./stm32/ads1220.c"
|
||||||
|
"./stm32/bl0939.c"
|
||||||
|
"./stm32/capture.c"
|
||||||
|
"./stm32/comm.c"
|
||||||
|
"./stm32/depth.c"
|
||||||
|
"./stm32/fram.c"
|
||||||
|
"./stm32/flow.c"
|
||||||
|
"./stm32/utils.c"
|
||||||
|
"./stm32/config.c"
|
||||||
|
"./stm32/ModbusS.c"
|
||||||
|
"./stm32/ModbusM.c"
|
||||||
|
"./stm32/uart0_modbus_slave.c"
|
||||||
|
"wifi_softap.c"
|
||||||
|
"bt_server.c"
|
||||||
|
#"C:\Espressif\frameworks\esp-idf-v4.4.5\components\bt\include"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(INCLUDE_DIRS ".")
|
||||||
|
|
||||||
|
idf_component_register(SRCS ${SRCS}
|
||||||
|
INCLUDE_DIRS ${INCLUDE_DIRS})
|
859
main/bt_server.c
Normal file
859
main/bt_server.c
Normal file
@ -0,0 +1,859 @@
|
|||||||
|
/*
|
||||||
|
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 "freertos/event_groups.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
#include "esp_bt.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "esp_gap_ble_api.h"
|
||||||
|
#include "esp_gatts_api.h"
|
||||||
|
#include "esp_bt_defs.h"
|
||||||
|
#include "esp_bt_main.h"
|
||||||
|
#include "bt_server.h"
|
||||||
|
#define SPP_DEBUG_MODE 1
|
||||||
|
|
||||||
|
#define GATTS_TABLE_TAG "GATTS_SPP_DEMO"
|
||||||
|
|
||||||
|
#define SPP_PROFILE_NUM 1
|
||||||
|
#define SPP_PROFILE_APP_IDX 0
|
||||||
|
#define ESP_SPP_APP_ID 0x56
|
||||||
|
#define SAMPLE_DEVICE_NAME "ESP_SPP_SERVER" //The Device Name Characteristics in GAP
|
||||||
|
#define SPP_SVC_INST_ID 0
|
||||||
|
|
||||||
|
/// SPP Service
|
||||||
|
static const uint16_t spp_service_uuid = 0xABF0;
|
||||||
|
/// Characteristic UUID
|
||||||
|
#define ESP_GATT_UUID_SPP_DATA_RECEIVE 0xABF1
|
||||||
|
#define ESP_GATT_UUID_SPP_DATA_NOTIFY 0xABF2
|
||||||
|
#define ESP_GATT_UUID_SPP_COMMAND_RECEIVE 0xABF3
|
||||||
|
#define ESP_GATT_UUID_SPP_COMMAND_NOTIFY 0xABF4
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
#define ESP_GATT_UUID_SPP_HEARTBEAT 0xABF5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*蓝牙的广播数据*/
|
||||||
|
static const uint8_t spp_adv_data[23] = {
|
||||||
|
/* Flags */
|
||||||
|
0x02,0x01,0x06, //表示设备支持LE General Discoverable Mode(可被发现模式)和BR/EDR Not Supported(不支持传统蓝牙)
|
||||||
|
/* Complete List of 16-bit Service Class UUIDs */
|
||||||
|
0x03,0x03,0xF0,0xAB,//广播数据中的16位服务UUID字段,表示设备提供了一个特定的服务,这里是自定义的16位UUID
|
||||||
|
/* Complete Local Name in advertising */
|
||||||
|
0x0F,0x09, 'E', 'S', 'P', '_', 'S', 'P', 'P', '_', 'S', 'E', 'R','V', 'E', 'R'
|
||||||
|
//广播数据中的16位服务UUID字段,表示设备提供了一个特定的服务,这里是自定义的16位UUID
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint16_t spp_mtu_size = 23;
|
||||||
|
uint16_t spp_conn_id = 0xffff;
|
||||||
|
esp_gatt_if_t spp_gatts_if = 0xff;
|
||||||
|
QueueHandle_t spp_uart_queue = NULL;
|
||||||
|
static xQueueHandle cmd_cmd_queue = NULL;
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
static xQueueHandle cmd_heartbeat_queue = NULL;
|
||||||
|
static uint8_t heartbeat_s[9] = {'E','s','p','r','e','s','s','i','f'};
|
||||||
|
static bool enable_heart_ntf = false;
|
||||||
|
static uint8_t heartbeat_count_num = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static bool enable_data_ntf = false;
|
||||||
|
bool is_connected = false;
|
||||||
|
static esp_bd_addr_t spp_remote_bda = {0x0,};
|
||||||
|
|
||||||
|
uint16_t spp_handle_table[SPP_IDX_NB];
|
||||||
|
|
||||||
|
static esp_ble_adv_params_t spp_adv_params = {
|
||||||
|
.adv_int_min = 0x20,
|
||||||
|
.adv_int_max = 0x40,
|
||||||
|
.adv_type = ADV_TYPE_IND,
|
||||||
|
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
|
||||||
|
.channel_map = ADV_CHNL_ALL,
|
||||||
|
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct gatts_profile_inst {
|
||||||
|
esp_gatts_cb_t gatts_cb;
|
||||||
|
uint16_t gatts_if;
|
||||||
|
uint16_t app_id;
|
||||||
|
uint16_t conn_id;
|
||||||
|
uint16_t service_handle;
|
||||||
|
esp_gatt_srvc_id_t service_id;
|
||||||
|
uint16_t char_handle;
|
||||||
|
esp_bt_uuid_t char_uuid;
|
||||||
|
esp_gatt_perm_t perm;
|
||||||
|
esp_gatt_char_prop_t property;
|
||||||
|
uint16_t descr_handle;
|
||||||
|
esp_bt_uuid_t descr_uuid;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct spp_receive_data_node{
|
||||||
|
int32_t len;
|
||||||
|
uint8_t * node_buff;
|
||||||
|
struct spp_receive_data_node * next_node;
|
||||||
|
}spp_receive_data_node_t;
|
||||||
|
|
||||||
|
static spp_receive_data_node_t * temp_spp_recv_data_node_p1 = NULL;
|
||||||
|
static spp_receive_data_node_t * temp_spp_recv_data_node_p2 = NULL;
|
||||||
|
|
||||||
|
typedef struct spp_receive_data_buff{
|
||||||
|
int32_t node_num;
|
||||||
|
int32_t buff_size;
|
||||||
|
spp_receive_data_node_t * first_node;
|
||||||
|
}spp_receive_data_buff_t;
|
||||||
|
|
||||||
|
static spp_receive_data_buff_t SppRecvDataBuff = {
|
||||||
|
.node_num = 0,
|
||||||
|
.buff_size = 0,
|
||||||
|
.first_node = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
|
||||||
|
|
||||||
|
/* One gatt-based profile one app_id and one gatts_if, this array will store the gatts_if returned by ESP_GATTS_REG_EVT */
|
||||||
|
static struct gatts_profile_inst spp_profile_tab[SPP_PROFILE_NUM] = {
|
||||||
|
[SPP_PROFILE_APP_IDX] = {
|
||||||
|
.gatts_cb = gatts_profile_event_handler,
|
||||||
|
.gatts_if = ESP_GATT_IF_NONE, /* Not get the gatt_if, so initial is ESP_GATT_IF_NONE */
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SPP PROFILE ATTRIBUTES
|
||||||
|
****************************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CHAR_DECLARATION_SIZE (sizeof(uint8_t))
|
||||||
|
static const uint16_t primary_service_uuid = ESP_GATT_UUID_PRI_SERVICE; //0x2800
|
||||||
|
static const uint16_t character_declaration_uuid = ESP_GATT_UUID_CHAR_DECLARE; //0x2803
|
||||||
|
static const uint16_t character_client_config_uuid = ESP_GATT_UUID_CHAR_CLIENT_CONFIG; //0x2902
|
||||||
|
|
||||||
|
static const uint8_t char_prop_read_notify = ESP_GATT_CHAR_PROP_BIT_READ|ESP_GATT_CHAR_PROP_BIT_NOTIFY;
|
||||||
|
static const uint8_t char_prop_read_write = ESP_GATT_CHAR_PROP_BIT_WRITE_NR|ESP_GATT_CHAR_PROP_BIT_READ;
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
static const uint8_t char_prop_read_write_notify = ESP_GATT_CHAR_PROP_BIT_READ|ESP_GATT_CHAR_PROP_BIT_WRITE_NR|ESP_GATT_CHAR_PROP_BIT_NOTIFY;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///SPP Service - data receive characteristic, read&write without response
|
||||||
|
static const uint16_t spp_data_receive_uuid = ESP_GATT_UUID_SPP_DATA_RECEIVE; //0xABF1
|
||||||
|
static const uint8_t spp_data_receive_val[20] = {0x00};
|
||||||
|
|
||||||
|
///SPP Service - data notify characteristic, notify&read
|
||||||
|
static const uint16_t spp_data_notify_uuid = ESP_GATT_UUID_SPP_DATA_NOTIFY; //0xABF2
|
||||||
|
static const uint8_t spp_data_notify_val[20] = {0x00};
|
||||||
|
static const uint8_t spp_data_notify_ccc[2] = {0x00, 0x00};
|
||||||
|
|
||||||
|
///SPP Service - command characteristic, read&write without response
|
||||||
|
static const uint16_t spp_command_uuid = ESP_GATT_UUID_SPP_COMMAND_RECEIVE; //0xABF3
|
||||||
|
static const uint8_t spp_command_val[10] = {0x00};
|
||||||
|
|
||||||
|
///SPP Service - status characteristic, notify&read
|
||||||
|
static const uint16_t spp_status_uuid = ESP_GATT_UUID_SPP_COMMAND_NOTIFY; //0xABF4
|
||||||
|
static const uint8_t spp_status_val[10] = {0x00};
|
||||||
|
static const uint8_t spp_status_ccc[2] = {0x00, 0x00};//状态特征值。这个值允许其他设备配置是否接收状态特征通知,这里是禁用
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
///SPP Server - Heart beat characteristic, notify&write&read
|
||||||
|
static const uint16_t spp_heart_beat_uuid = ESP_GATT_UUID_SPP_HEARTBEAT;
|
||||||
|
static const uint8_t spp_heart_beat_val[2] = {0x00, 0x00};
|
||||||
|
static const uint8_t spp_heart_beat_ccc[2] = {0x00, 0x00};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///Full HRS Database Description - Used to add attributes into the database
|
||||||
|
static const esp_gatts_attr_db_t spp_gatt_db[SPP_IDX_NB] =
|
||||||
|
{
|
||||||
|
//SPP - Service Declaration 服务声明
|
||||||
|
[SPP_IDX_SVC] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&primary_service_uuid, //0x2800
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
sizeof(spp_service_uuid), //0xABF0
|
||||||
|
sizeof(spp_service_uuid),
|
||||||
|
(uint8_t *)&spp_service_uuid
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - data receive characteristic Declaration 声明服务中数据接受特征
|
||||||
|
[SPP_IDX_SPP_DATA_RECV_CHAR] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&character_declaration_uuid, //0x2803
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
(uint8_t *)&char_prop_read_write
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - data receive characteristic Value spp服务中数据接收特征值
|
||||||
|
[SPP_IDX_SPP_DATA_RECV_VAL] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&spp_data_receive_uuid, //0xABF1
|
||||||
|
ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
|
||||||
|
SPP_DATA_MAX_LEN,
|
||||||
|
sizeof(spp_data_receive_val),
|
||||||
|
(uint8_t *)spp_data_receive_val //0x00
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - data notify characteristic Declaration spp协议中数据通知特征
|
||||||
|
[SPP_IDX_SPP_DATA_NOTIFY_CHAR] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&character_declaration_uuid, //0x2803
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
(uint8_t *)&char_prop_read_notify
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - data notify characteristic Value 数据通知特征的值
|
||||||
|
[SPP_IDX_SPP_DATA_NTY_VAL] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&spp_data_notify_uuid, //0xABF2
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
SPP_DATA_MAX_LEN,
|
||||||
|
sizeof(spp_data_notify_val),
|
||||||
|
(uint8_t *)spp_data_notify_val //0x00
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - data notify characteristic - Client Characteristic Configuration Descriptor
|
||||||
|
//数据通知特征的客户端特性配置描述符,用于配置特征的行为和交互方式,客户端特性配置描述符用于配置该特征是否可以发送通知给连接的设备
|
||||||
|
[SPP_IDX_SPP_DATA_NTF_CFG] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&character_client_config_uuid, //0x2902
|
||||||
|
ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
|
||||||
|
sizeof(uint16_t),
|
||||||
|
sizeof(spp_data_notify_ccc),
|
||||||
|
(uint8_t *)spp_data_notify_ccc //{0x00, 0x00}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - command characteristic Declaration 命令特征声明
|
||||||
|
[SPP_IDX_SPP_COMMAND_CHAR]= {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&character_declaration_uuid, //0x2803
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
(uint8_t *)&char_prop_read_write
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - command characteristic Value 命令特征值
|
||||||
|
[SPP_IDX_SPP_COMMAND_VAL] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&spp_command_uuid, //0xABF3
|
||||||
|
ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
|
||||||
|
SPP_CMD_MAX_LEN,
|
||||||
|
sizeof(spp_command_val),
|
||||||
|
(uint8_t *)spp_command_val //{0x00}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - status characteristic Declaration
|
||||||
|
[SPP_IDX_SPP_STATUS_CHAR] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&character_declaration_uuid, //0x2803
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
CHAR_DECLARATION_SIZE,
|
||||||
|
(uint8_t *)&char_prop_read_notify
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - status characteristic Value
|
||||||
|
[SPP_IDX_SPP_STATUS_VAL] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&spp_status_uuid, //0xABF4
|
||||||
|
ESP_GATT_PERM_READ,
|
||||||
|
SPP_STATUS_MAX_LEN,
|
||||||
|
sizeof(spp_status_val),
|
||||||
|
(uint8_t *)spp_status_val //{0x00}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//SPP - status characteristic - Client Characteristic Configuration Descriptor
|
||||||
|
[SPP_IDX_SPP_STATUS_CFG] = {
|
||||||
|
{ESP_GATT_AUTO_RSP},
|
||||||
|
{
|
||||||
|
ESP_UUID_LEN_16,
|
||||||
|
(uint8_t *)&character_client_config_uuid, //0x2902
|
||||||
|
ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
|
||||||
|
sizeof(uint16_t),
|
||||||
|
sizeof(spp_status_ccc),
|
||||||
|
(uint8_t *)spp_status_ccc //{0x00, 0x00}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
//SPP - Heart beat characteristic Declaration
|
||||||
|
[SPP_IDX_SPP_HEARTBEAT_CHAR] =
|
||||||
|
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
|
||||||
|
CHAR_DECLARATION_SIZE,CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_read_write_notify}},
|
||||||
|
|
||||||
|
//SPP - Heart beat characteristic Value
|
||||||
|
[SPP_IDX_SPP_HEARTBEAT_VAL] =
|
||||||
|
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&spp_heart_beat_uuid, ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
|
||||||
|
sizeof(spp_heart_beat_val), sizeof(spp_heart_beat_val), (uint8_t *)spp_heart_beat_val}},
|
||||||
|
|
||||||
|
//SPP - Heart beat characteristic - Client Characteristic Configuration Descriptor
|
||||||
|
[SPP_IDX_SPP_HEARTBEAT_CFG] =
|
||||||
|
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_client_config_uuid, ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
|
||||||
|
sizeof(uint16_t),sizeof(spp_data_notify_ccc), (uint8_t *)spp_heart_beat_ccc}},
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/*在 spp_handle_table 数组中查找与给定句柄匹配的特性或描述符,返回其索引值。如果没有找到匹配的值,则返回 0xff*/
|
||||||
|
static uint8_t find_char_and_desr_index(uint16_t handle)
|
||||||
|
{
|
||||||
|
uint8_t error = 0xff;
|
||||||
|
|
||||||
|
for(int i = 0; i < SPP_IDX_NB ; i++){
|
||||||
|
if(handle == spp_handle_table[i]){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*存储写入缓冲区的数据*/
|
||||||
|
static bool store_wr_buffer(esp_ble_gatts_cb_param_t *p_data)
|
||||||
|
{
|
||||||
|
temp_spp_recv_data_node_p1 = (spp_receive_data_node_t *)malloc(sizeof(spp_receive_data_node_t));
|
||||||
|
|
||||||
|
if(temp_spp_recv_data_node_p1 == NULL){
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "malloc error %s %d\n", __func__, __LINE__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(temp_spp_recv_data_node_p2 != NULL){
|
||||||
|
temp_spp_recv_data_node_p2->next_node = temp_spp_recv_data_node_p1;
|
||||||
|
}
|
||||||
|
temp_spp_recv_data_node_p1->len = p_data->write.len;
|
||||||
|
SppRecvDataBuff.buff_size += p_data->write.len;
|
||||||
|
temp_spp_recv_data_node_p1->next_node = NULL;
|
||||||
|
temp_spp_recv_data_node_p1->node_buff = (uint8_t *)malloc(p_data->write.len);
|
||||||
|
temp_spp_recv_data_node_p2 = temp_spp_recv_data_node_p1;
|
||||||
|
memcpy(temp_spp_recv_data_node_p1->node_buff,p_data->write.value,p_data->write.len);
|
||||||
|
if(SppRecvDataBuff.node_num == 0){
|
||||||
|
SppRecvDataBuff.first_node = temp_spp_recv_data_node_p1;
|
||||||
|
SppRecvDataBuff.node_num++;
|
||||||
|
}else{
|
||||||
|
SppRecvDataBuff.node_num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//释放缓冲区内存
|
||||||
|
static void free_write_buffer(void)
|
||||||
|
{
|
||||||
|
temp_spp_recv_data_node_p1 = SppRecvDataBuff.first_node;
|
||||||
|
|
||||||
|
while(temp_spp_recv_data_node_p1 != NULL){
|
||||||
|
temp_spp_recv_data_node_p2 = temp_spp_recv_data_node_p1->next_node;
|
||||||
|
free(temp_spp_recv_data_node_p1->node_buff);
|
||||||
|
free(temp_spp_recv_data_node_p1);
|
||||||
|
temp_spp_recv_data_node_p1 = temp_spp_recv_data_node_p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SppRecvDataBuff.node_num = 0;
|
||||||
|
SppRecvDataBuff.buff_size = 0;
|
||||||
|
SppRecvDataBuff.first_node = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*将缓冲区数据写入uart*/
|
||||||
|
static void print_write_buffer(void)
|
||||||
|
{
|
||||||
|
temp_spp_recv_data_node_p1 = SppRecvDataBuff.first_node;
|
||||||
|
|
||||||
|
while(temp_spp_recv_data_node_p1 != NULL){
|
||||||
|
uart_write_bytes(UART_NUM_2, (char *)(temp_spp_recv_data_node_p1->node_buff), temp_spp_recv_data_node_p1->len);
|
||||||
|
temp_spp_recv_data_node_p1 = temp_spp_recv_data_node_p1->next_node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//蓝牙设备接收到消息后将分组数据通过蓝牙的 GATT Indicate 方式发送给蓝牙连接的设备(也就是蓝牙客户端)
|
||||||
|
void uart_task(void *pvParameters)
|
||||||
|
{
|
||||||
|
uart_event_t event;
|
||||||
|
uint8_t total_num = 0;
|
||||||
|
uint8_t current_num = 0;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
//Waiting for UART event.
|
||||||
|
if (xQueueReceive(spp_uart_queue, (void * )&event, 10/portTICK_PERIOD_MS)) {
|
||||||
|
switch (event.type) {
|
||||||
|
//Event of UART receving data
|
||||||
|
case UART_DATA:
|
||||||
|
if ((event.size)&&(is_connected)) {
|
||||||
|
uint8_t * temp = NULL;
|
||||||
|
uint8_t * ntf_value_p = NULL;
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
if(!enable_heart_ntf){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s do not enable heartbeat Notify\n", __func__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if(!enable_data_ntf){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s do not enable data Notify\n", __func__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
temp = (uint8_t *)malloc(sizeof(uint8_t)*event.size);
|
||||||
|
if(temp == NULL){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s malloc.1 failed\n", __func__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//将数据通过uart串口读入缓冲区
|
||||||
|
memset(temp,0x0,event.size);
|
||||||
|
uart_read_bytes(UART_NUM_2,temp,event.size,10/portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
if(event.size <= (spp_mtu_size - 3)){ //spp_mtu_size - 3是一个分组的最大容量
|
||||||
|
//向gatt发送indicate消息
|
||||||
|
//1.接口号2.连接id 3.特征句柄 4.数据长度 5.数据指针
|
||||||
|
esp_ble_gatts_send_indicate(spp_gatts_if,
|
||||||
|
spp_conn_id,
|
||||||
|
spp_handle_table[4],
|
||||||
|
event.size,
|
||||||
|
temp,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}else if(event.size > (spp_mtu_size - 3)){
|
||||||
|
if((event.size%(spp_mtu_size - 7)) == 0){
|
||||||
|
total_num = event.size/(spp_mtu_size - 7);//spp_mtu_size - 7是有效负载大小
|
||||||
|
}else{
|
||||||
|
total_num = event.size/(spp_mtu_size - 7) + 1;
|
||||||
|
}
|
||||||
|
current_num = 1;
|
||||||
|
ntf_value_p = (uint8_t *)malloc((spp_mtu_size-3)*sizeof(uint8_t));
|
||||||
|
if(ntf_value_p == NULL){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s malloc.2 failed\n", __func__);
|
||||||
|
free(temp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while(current_num <= total_num){
|
||||||
|
if(current_num < total_num){
|
||||||
|
ntf_value_p[0] = '#';
|
||||||
|
ntf_value_p[1] = '#';
|
||||||
|
ntf_value_p[2] = total_num;
|
||||||
|
ntf_value_p[3] = current_num;
|
||||||
|
memcpy(ntf_value_p + 4,temp + (current_num - 1)*(spp_mtu_size-7),(spp_mtu_size-7));
|
||||||
|
esp_ble_gatts_send_indicate(spp_gatts_if,
|
||||||
|
spp_conn_id,
|
||||||
|
spp_handle_table[SPP_IDX_SPP_DATA_NTY_VAL],
|
||||||
|
(spp_mtu_size-3),
|
||||||
|
ntf_value_p,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}else if(current_num == total_num){
|
||||||
|
ntf_value_p[0] = '#';
|
||||||
|
ntf_value_p[1] = '#';
|
||||||
|
ntf_value_p[2] = total_num;
|
||||||
|
ntf_value_p[3] = current_num;
|
||||||
|
memcpy(ntf_value_p + 4,temp + (current_num - 1)*(spp_mtu_size-7),(event.size - (current_num - 1)*(spp_mtu_size - 7)));
|
||||||
|
esp_ble_gatts_send_indicate(spp_gatts_if,
|
||||||
|
spp_conn_id,
|
||||||
|
spp_handle_table[SPP_IDX_SPP_DATA_NTY_VAL],
|
||||||
|
(event.size - (current_num - 1)*(spp_mtu_size - 7) + 4),
|
||||||
|
ntf_value_p,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
vTaskDelay(20 / portTICK_PERIOD_MS);
|
||||||
|
current_num++;
|
||||||
|
}
|
||||||
|
free(ntf_value_p);
|
||||||
|
}
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void spp_uart_init(void)
|
||||||
|
{
|
||||||
|
uart_config_t uart_config = {
|
||||||
|
.baud_rate = 115200,
|
||||||
|
.data_bits = UART_DATA_8_BITS,
|
||||||
|
.parity = UART_PARITY_DISABLE,
|
||||||
|
.stop_bits = UART_STOP_BITS_1,
|
||||||
|
.flow_ctrl = UART_HW_FLOWCTRL_RTS,
|
||||||
|
.rx_flow_ctrl_thresh = 122,
|
||||||
|
.source_clk = UART_SCLK_APB,
|
||||||
|
};
|
||||||
|
|
||||||
|
//Install UART driver, and get the queue.
|
||||||
|
uart_driver_install(UART_NUM_2, 4096, 8192, 10, &spp_uart_queue,0);
|
||||||
|
//Set UART parameters
|
||||||
|
uart_param_config(UART_NUM_2, &uart_config);
|
||||||
|
//Set UART pins
|
||||||
|
uart_set_pin(UART_NUM_2, 14, 21, 47, UART_PIN_NO_CHANGE);
|
||||||
|
xTaskCreate(uart_task, "uTask", 2048, (void*)UART_NUM_2, 8, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
void spp_heartbeat_task(void * arg)
|
||||||
|
{
|
||||||
|
uint16_t cmd_id;
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||||
|
if(xQueueReceive(cmd_heartbeat_queue, &cmd_id, portMAX_DELAY)) {
|
||||||
|
while(1){
|
||||||
|
heartbeat_count_num++;
|
||||||
|
vTaskDelay(5000/ portTICK_PERIOD_MS);
|
||||||
|
if((heartbeat_count_num >3)&&(is_connected)){
|
||||||
|
esp_ble_gap_disconnect(spp_remote_bda);
|
||||||
|
}
|
||||||
|
if(is_connected && enable_heart_ntf){
|
||||||
|
esp_ble_gatts_send_indicate(spp_gatts_if, spp_conn_id, spp_handle_table[SPP_IDX_SPP_HEARTBEAT_VAL],sizeof(heartbeat_s), heartbeat_s, false);
|
||||||
|
}else if(!is_connected){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//通过接收队列获取蓝牙命令数据,进行相应的处理,然后打印到系统日志并释放相关内存
|
||||||
|
void spp_cmd_task(void * arg)
|
||||||
|
{
|
||||||
|
uint8_t * cmd_id;
|
||||||
|
|
||||||
|
for(;;){
|
||||||
|
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||||
|
if(xQueueReceive(cmd_cmd_queue, &cmd_id, 10 / portTICK_PERIOD_MS)) {
|
||||||
|
esp_log_buffer_char(GATTS_TABLE_TAG,(char *)(cmd_id),strlen((char *)cmd_id));
|
||||||
|
free(cmd_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void spp_task_init(void)
|
||||||
|
{
|
||||||
|
spp_uart_init();
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
cmd_heartbeat_queue = xQueueCreate(10, sizeof(uint32_t));
|
||||||
|
xTaskCreate(spp_heartbeat_task, "spp_heartbeat_task", 2048, NULL, 10, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cmd_cmd_queue = xQueueCreate(10, sizeof(uint32_t));
|
||||||
|
xTaskCreate(spp_cmd_task, "spp_cmd_task", 2048, NULL, 10, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*gap事件回调函数*/
|
||||||
|
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
|
||||||
|
{
|
||||||
|
esp_err_t err;
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "GAP_EVT, event %d\n", event);
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
/*表示原始广播数据设置完成*/
|
||||||
|
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
|
||||||
|
/*启动广播,并传递蓝牙广播参数 spp_adv_params*/
|
||||||
|
esp_ble_gap_start_advertising(&spp_adv_params);
|
||||||
|
break;
|
||||||
|
case ESP_GAP_BLE_ADV_START_COMPLETE_EVT:
|
||||||
|
//advertising start complete event to indicate advertising start successfully or failed
|
||||||
|
if((err = param->adv_start_cmpl.status) != ESP_BT_STATUS_SUCCESS) {
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "Advertising start failed: %s\n", esp_err_to_name(err));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*处理gatt事件的回调函数,根据不同的请求执行不同的操作*/
|
||||||
|
static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
|
||||||
|
{
|
||||||
|
esp_ble_gatts_cb_param_t *p_data = (esp_ble_gatts_cb_param_t *) param;
|
||||||
|
uint8_t res = 0xff;
|
||||||
|
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "event = %x\n",event);
|
||||||
|
switch (event) {
|
||||||
|
|
||||||
|
//gatt服务器注册事件
|
||||||
|
case ESP_GATTS_REG_EVT:
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "%s %d\n", __func__, __LINE__);
|
||||||
|
|
||||||
|
//设置蓝牙设备名称
|
||||||
|
esp_ble_gap_set_device_name(SAMPLE_DEVICE_NAME);
|
||||||
|
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "%s %d\n", __func__, __LINE__);
|
||||||
|
|
||||||
|
//配置蓝牙广播数据的原始数据
|
||||||
|
esp_ble_gap_config_adv_data_raw((uint8_t *)spp_adv_data, sizeof(spp_adv_data));
|
||||||
|
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "%s %d\n", __func__, __LINE__);
|
||||||
|
|
||||||
|
//创建gatt服务的属性表
|
||||||
|
esp_ble_gatts_create_attr_tab(spp_gatt_db, gatts_if, SPP_IDX_NB, SPP_SVC_INST_ID);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//收到读取数据的请求
|
||||||
|
case ESP_GATTS_READ_EVT:
|
||||||
|
//找到对应句柄,返回对应索引
|
||||||
|
res = find_char_and_desr_index(p_data->read.handle);
|
||||||
|
if(res == SPP_IDX_SPP_STATUS_VAL){
|
||||||
|
//TODO:client read the status characteristic
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//收到写数据的请求
|
||||||
|
case ESP_GATTS_WRITE_EVT: {
|
||||||
|
res = find_char_and_desr_index(p_data->write.handle);
|
||||||
|
if(p_data->write.is_prep == false){
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_WRITE_EVT : handle = %d\n", res);
|
||||||
|
if(res == SPP_IDX_SPP_COMMAND_VAL){
|
||||||
|
uint8_t * spp_cmd_buff = NULL;
|
||||||
|
spp_cmd_buff = (uint8_t *)malloc((spp_mtu_size - 3) * sizeof(uint8_t));
|
||||||
|
if(spp_cmd_buff == NULL){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s malloc failed\n", __func__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
memset(spp_cmd_buff,0x0,(spp_mtu_size - 3));
|
||||||
|
memcpy(spp_cmd_buff,p_data->write.value,p_data->write.len);
|
||||||
|
xQueueSend(cmd_cmd_queue,&spp_cmd_buff,10/portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
//SPP 数据通知配置
|
||||||
|
}else if(res == SPP_IDX_SPP_DATA_NTF_CFG){
|
||||||
|
//第一个字节为 0x01,第二个字节为 0x00。如果条件满足,则将 enable_data_ntf 设置为 true,表示启用数据通知
|
||||||
|
if((p_data->write.len == 2)&&(p_data->write.value[0] == 0x01)&&(p_data->write.value[1] == 0x00)){
|
||||||
|
enable_data_ntf = true;
|
||||||
|
}else if((p_data->write.len == 2)&&(p_data->write.value[0] == 0x00)&&(p_data->write.value[1] == 0x00)){
|
||||||
|
enable_data_ntf = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
else if(res == SPP_IDX_SPP_HEARTBEAT_CFG){
|
||||||
|
if((p_data->write.len == 2)&&(p_data->write.value[0] == 0x01)&&(p_data->write.value[1] == 0x00)){
|
||||||
|
enable_heart_ntf = true;
|
||||||
|
}else if((p_data->write.len == 2)&&(p_data->write.value[0] == 0x00)&&(p_data->write.value[1] == 0x00)){
|
||||||
|
enable_heart_ntf = false;
|
||||||
|
}
|
||||||
|
}else if(res == SPP_IDX_SPP_HEARTBEAT_VAL){
|
||||||
|
if((p_data->write.len == sizeof(heartbeat_s))&&(memcmp(heartbeat_s,p_data->write.value,sizeof(heartbeat_s)) == 0)){
|
||||||
|
heartbeat_count_num = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if(res == SPP_IDX_SPP_DATA_RECV_VAL){
|
||||||
|
#ifdef SPP_DEBUG_MODE
|
||||||
|
esp_log_buffer_char(GATTS_TABLE_TAG,(char *)(p_data->write.value),p_data->write.len);
|
||||||
|
#else
|
||||||
|
uart_write_bytes(UART_NUM_2, (char *)(p_data->write.value), p_data->write.len);
|
||||||
|
#endif
|
||||||
|
}else{
|
||||||
|
//TODO:
|
||||||
|
}
|
||||||
|
}else if((p_data->write.is_prep == true)&&(res == SPP_IDX_SPP_DATA_RECV_VAL)){
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_PREP_WRITE_EVT : handle = %d\n", res);
|
||||||
|
store_wr_buffer(p_data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//执行写入操作
|
||||||
|
case ESP_GATTS_EXEC_WRITE_EVT:{
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_EXEC_WRITE_EVT\n");
|
||||||
|
if(p_data->exec_write.exec_write_flag){
|
||||||
|
print_write_buffer();
|
||||||
|
free_write_buffer();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ESP_GATTS_MTU_EVT:
|
||||||
|
spp_mtu_size = p_data->mtu.mtu;
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_CONF_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_UNREG_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_DELETE_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_START_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_STOP_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_CONNECT_EVT:
|
||||||
|
spp_conn_id = p_data->connect.conn_id;
|
||||||
|
spp_gatts_if = gatts_if;
|
||||||
|
is_connected = true;
|
||||||
|
memcpy(&spp_remote_bda,&p_data->connect.remote_bda,sizeof(esp_bd_addr_t));
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
uint16_t cmd = 0;
|
||||||
|
xQueueSend(cmd_heartbeat_queue,&cmd,10/portTICK_PERIOD_MS);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_DISCONNECT_EVT:
|
||||||
|
is_connected = false;
|
||||||
|
enable_data_ntf = false;
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
enable_heart_ntf = false;
|
||||||
|
heartbeat_count_num = 0;
|
||||||
|
#endif
|
||||||
|
esp_ble_gap_start_advertising(&spp_adv_params);
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_OPEN_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_CANCEL_OPEN_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_CLOSE_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_LISTEN_EVT:
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_CONGEST_EVT:
|
||||||
|
break;
|
||||||
|
//gatt创建属性表
|
||||||
|
case ESP_GATTS_CREAT_ATTR_TAB_EVT:{
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "The number handle =%x\n",param->add_attr_tab.num_handle);
|
||||||
|
if (param->add_attr_tab.status != ESP_GATT_OK){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "Create attribute table failed, error code=0x%x", param->add_attr_tab.status);
|
||||||
|
}
|
||||||
|
else if (param->add_attr_tab.num_handle != SPP_IDX_NB){
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "Create attribute table abnormally, num_handle (%d) doesn't equal to HRS_IDX_NB(%d)", param->add_attr_tab.num_handle, SPP_IDX_NB);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memcpy(spp_handle_table, param->add_attr_tab.handles, sizeof(spp_handle_table));
|
||||||
|
//启动gatt服务
|
||||||
|
esp_ble_gatts_start_service(spp_handle_table[SPP_IDX_SVC]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*gatt事件回调函数*/ //gatt属于ble的一个协议层
|
||||||
|
static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
|
||||||
|
{
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "EVT %d, gatts if %d\n", event, gatts_if);//打印接口标识符gatts_if
|
||||||
|
|
||||||
|
/* If event is register event, store the gatts_if for each profile */
|
||||||
|
//GATT 注册事件
|
||||||
|
if (event == ESP_GATTS_REG_EVT) {
|
||||||
|
if (param->reg.status == ESP_GATT_OK) {
|
||||||
|
spp_profile_tab[SPP_PROFILE_APP_IDX].gatts_if = gatts_if;
|
||||||
|
} else {
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "Reg app failed, app_id %04x, status %d\n",param->reg.app_id, param->reg.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//循环遍历 spp_profile_tab 结构体中的配置文件,根据条件判断是否需要调用回调函数处理事件
|
||||||
|
do {
|
||||||
|
int idx;
|
||||||
|
for (idx = 0; idx < SPP_PROFILE_NUM; idx++) {
|
||||||
|
|
||||||
|
/* 表示没有指定特定的 gatts_if ,需要调用每个配置文件的回调函数*/
|
||||||
|
if (gatts_if == ESP_GATT_IF_NONE || gatts_if == spp_profile_tab[idx].gatts_if) {
|
||||||
|
if (spp_profile_tab[idx].gatts_cb) {
|
||||||
|
spp_profile_tab[idx].gatts_cb(event, gatts_if, param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_client_init(void)
|
||||||
|
{
|
||||||
|
esp_err_t ret;
|
||||||
|
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
|
||||||
|
|
||||||
|
/*初始化nvs*/
|
||||||
|
// ret = nvs_flash_init();
|
||||||
|
// if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||||
|
// ESP_ERROR_CHECK(nvs_flash_erase());
|
||||||
|
// ret = nvs_flash_init();
|
||||||
|
// }
|
||||||
|
// ESP_ERROR_CHECK( ret );
|
||||||
|
|
||||||
|
/*对 BTDM 控制器的 ROM(只读存储器)数据进行初始化操作*/
|
||||||
|
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));
|
||||||
|
|
||||||
|
/*蓝牙控制器初始化*/
|
||||||
|
ret = esp_bt_controller_init(&bt_cfg);
|
||||||
|
if (ret) {
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(ret));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*蓝牙控制器使能*/
|
||||||
|
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
|
||||||
|
if (ret) {
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(ret));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(GATTS_TABLE_TAG, "%s init bluetooth\n", __func__);
|
||||||
|
|
||||||
|
/*初始化蓝牙协议栈r*/
|
||||||
|
ret = esp_bluedroid_init();
|
||||||
|
if (ret) {
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s init bluetooth failed: %s\n", __func__, esp_err_to_name(ret));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*使能蓝牙协议栈*/
|
||||||
|
ret = esp_bluedroid_enable();
|
||||||
|
if (ret) {
|
||||||
|
ESP_LOGE(GATTS_TABLE_TAG, "%s enable bluetooth failed: %s\n", __func__, esp_err_to_name(ret));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*注册ble的gap和gatt回调函数*/
|
||||||
|
esp_ble_gatts_register_callback(gatts_event_handler);
|
||||||
|
esp_ble_gap_register_callback(gap_event_handler);
|
||||||
|
|
||||||
|
/*注册gatt服务应用*/
|
||||||
|
esp_ble_gatts_app_register(ESP_SPP_APP_ID);
|
||||||
|
|
||||||
|
/*spp任务初始化*/
|
||||||
|
spp_task_init(); //初始化uart,创建消息队列以及任务
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
42
main/bt_server.h
Normal file
42
main/bt_server.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DEFINES
|
||||||
|
****************************************************************************************
|
||||||
|
*/
|
||||||
|
//#define SUPPORT_HEARTBEAT
|
||||||
|
//#define SPP_DEBUG_MODE
|
||||||
|
|
||||||
|
#define spp_sprintf(s,...) sprintf((char*)(s), ##__VA_ARGS__)
|
||||||
|
#define SPP_DATA_MAX_LEN (512)
|
||||||
|
#define SPP_CMD_MAX_LEN (20)
|
||||||
|
#define SPP_STATUS_MAX_LEN (20)
|
||||||
|
#define SPP_DATA_BUFF_MAX_LEN (2*1024)
|
||||||
|
///Attributes State Machine
|
||||||
|
enum{
|
||||||
|
SPP_IDX_SVC,
|
||||||
|
|
||||||
|
SPP_IDX_SPP_DATA_RECV_CHAR,
|
||||||
|
SPP_IDX_SPP_DATA_RECV_VAL,
|
||||||
|
|
||||||
|
SPP_IDX_SPP_DATA_NOTIFY_CHAR,
|
||||||
|
SPP_IDX_SPP_DATA_NTY_VAL,
|
||||||
|
SPP_IDX_SPP_DATA_NTF_CFG,
|
||||||
|
|
||||||
|
SPP_IDX_SPP_COMMAND_CHAR,
|
||||||
|
SPP_IDX_SPP_COMMAND_VAL,
|
||||||
|
|
||||||
|
SPP_IDX_SPP_STATUS_CHAR,
|
||||||
|
SPP_IDX_SPP_STATUS_VAL,
|
||||||
|
SPP_IDX_SPP_STATUS_CFG,
|
||||||
|
|
||||||
|
#ifdef SUPPORT_HEARTBEAT
|
||||||
|
SPP_IDX_SPP_HEARTBEAT_CHAR,
|
||||||
|
SPP_IDX_SPP_HEARTBEAT_VAL,
|
||||||
|
SPP_IDX_SPP_HEARTBEAT_CFG,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SPP_IDX_NB,
|
||||||
|
};
|
28
main/main.c
28
main/main.c
@ -26,6 +26,14 @@
|
|||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "driver/mcpwm.h"
|
#include "driver/mcpwm.h"
|
||||||
|
|
||||||
|
/*蓝牙相关的头文件*/
|
||||||
|
#include "esp_bt.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "esp_gap_ble_api.h"
|
||||||
|
#include "esp_gatts_api.h"
|
||||||
|
#include "esp_bt_defs.h"
|
||||||
|
#include "esp_bt_main.h"
|
||||||
|
|
||||||
/* The examples use WiFi configuration that you can set via project configuration menu
|
/* The examples use WiFi configuration that you can set via project configuration menu
|
||||||
|
|
||||||
If you'd rather not, just change the below entries to strings with
|
If you'd rather not, just change the below entries to strings with
|
||||||
@ -54,7 +62,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FreeRTOS event group to signal when we are connected*/
|
/* FreeRTOS event group to signal when we are connected*/
|
||||||
static EventGroupHandle_t s_wifi_event_group;
|
//static EventGroupHandle_t s_wifi_event_group;
|
||||||
|
|
||||||
/* The event group allows multiple bits for each event, but we only care about two events:
|
/* The event group allows multiple bits for each event, but we only care about two events:
|
||||||
* - we are connected to the AP with an IP
|
* - we are connected to the AP with an IP
|
||||||
@ -65,7 +73,7 @@ static EventGroupHandle_t s_wifi_event_group;
|
|||||||
|
|
||||||
static const char *TAG = "main";
|
static const char *TAG = "main";
|
||||||
|
|
||||||
static int s_retry_num = 0;
|
//static int s_retry_num = 0;
|
||||||
|
|
||||||
extern void wifi_init_softap(void);
|
extern void wifi_init_softap(void);
|
||||||
|
|
||||||
@ -80,6 +88,8 @@ extern void ModBusTCPSlave_init(void);
|
|||||||
extern esp_err_t i2c_master_init(void);
|
extern esp_err_t i2c_master_init(void);
|
||||||
extern void config_load(void);
|
extern void config_load(void);
|
||||||
extern void uart0_modbus_slave_init(void);
|
extern void uart0_modbus_slave_init(void);
|
||||||
|
extern void bt_client_init(void);
|
||||||
|
//extern void ESP32_Uart_Receive_Data(void);
|
||||||
uint32_t rtc_clk_apb_freq;
|
uint32_t rtc_clk_apb_freq;
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
@ -97,16 +107,24 @@ void app_main(void)
|
|||||||
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
|
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
|
||||||
rtc_clk_apb_freq = rtc_clk_apb_freq_get();
|
rtc_clk_apb_freq = rtc_clk_apb_freq_get();
|
||||||
ESP_LOGI(TAG, "rtc_clk_apb_freq=%d", rtc_clk_apb_freq);
|
ESP_LOGI(TAG, "rtc_clk_apb_freq=%d", rtc_clk_apb_freq);
|
||||||
wifi_init_softap();
|
|
||||||
|
wifi_init_softap();//ok
|
||||||
// wifi_init_sta();
|
// wifi_init_sta();
|
||||||
// can_init();
|
// can_init();
|
||||||
|
|
||||||
PWR_4G_Init();
|
PWR_4G_Init();
|
||||||
ModBusTCPSlave_init();
|
ModBusTCPSlave_init();
|
||||||
ads1220_task_start(); // test succeed
|
|
||||||
BL0939_init(); // test succeed
|
ads1220_task_start();
|
||||||
|
BL0939_init();
|
||||||
DEPTH_init();
|
DEPTH_init();
|
||||||
FLOW_init();
|
FLOW_init();
|
||||||
|
|
||||||
uart0_modbus_slave_init();
|
uart0_modbus_slave_init();
|
||||||
|
|
||||||
|
bt_client_init();//ok
|
||||||
|
//ESP32_Uart_Receive_Data();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PWR_4G_Init(void)
|
void PWR_4G_Init(void)
|
||||||
|
@ -12,14 +12,27 @@
|
|||||||
|
|
||||||
static const char *TAG = "config";
|
static const char *TAG = "config";
|
||||||
|
|
||||||
extern cal_4_20ma_t *cal_4_20ma;
|
extern cal_4_20ma_t *cal_4_20ma;//电流数据结构体
|
||||||
extern flow_config_t *flow_config;
|
extern flow_config_t *flow_config;//流量数据结构体
|
||||||
extern depth_config_t *depth_config;
|
extern depth_config_t *depth_config;//深度数据结构体
|
||||||
|
|
||||||
extern float ac_current_coef[3];
|
extern float ac_current_coef[3];//可能表示交流电电流的系数或校准参数 ?
|
||||||
// 三标一号机
|
// 三标一号机
|
||||||
const cal_4_20ma_t default_cal_4_20ma = {0, {{12740, 63845}, {12760, 63953}}};
|
const cal_4_20ma_t default_cal_4_20ma = {0, {{12740, 63845}, {12760, 63953}}};
|
||||||
const flow_config_t default_flow_cfg = {0, 1, {0, 0}, {{0, 10000}, {0, 10000}}, {6944, 6944}}; // 4~20MA 输入6m/H 100.00L/min
|
const flow_config_t default_flow_cfg = {0, 1, {0, 0}, {{0, 10000}, {0, 10000}}, {6944, 6944}}; // 4~20MA 输入6m/H 100.00L/min
|
||||||
|
/*
|
||||||
|
const flow_config_t default_flow_cfg = {
|
||||||
|
.magic = 0,
|
||||||
|
.input_type = 1,
|
||||||
|
.min_flow = {0, 0},
|
||||||
|
.ad_cal = {
|
||||||
|
{ .flow_min = 0, .flow_max = 10000 },
|
||||||
|
{ .flow_min = 0, .flow_max = 10000 },
|
||||||
|
},
|
||||||
|
.pulse_coef = {6944, 6944},
|
||||||
|
.rsv = {0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
*/
|
||||||
// const flow_config_t default_flow_cfg = {0,1,{60,60},{{0,20000},{0,20000}},{6944,6944}}; //脉冲输入 12m/H
|
// const flow_config_t default_flow_cfg = {0,1,{60,60},{{0,20000},{0,20000}},{6944,6944}}; //脉冲输入 12m/H
|
||||||
// const depth_config_t default_depth_cfg = {0, 2,0, 1000, 32, -100, 12000, 100, -100, 1000,500, 500, 100, 150, 150}; // 方向脉冲编码器 10线2倍频
|
// const depth_config_t default_depth_cfg = {0, 2,0, 1000, 32, -100, 12000, 100, -100, 1000,500, 500, 100, 150, 150}; // 方向脉冲编码器 10线2倍频
|
||||||
const depth_config_t default_depth_cfg = {
|
const depth_config_t default_depth_cfg = {
|
||||||
@ -78,10 +91,18 @@ extern void init_comm(void);
|
|||||||
// // HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin,0);
|
// // HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin,0);
|
||||||
// // HAL_Delay(500);
|
// // HAL_Delay(500);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/*fram_read */
|
||||||
|
/*
|
||||||
|
通过 I2C 总线读取 ESP32 上连接的 FRAM(非易失性存储器)芯片中指定地址的数据
|
||||||
|
param:地址
|
||||||
|
param:存储数据的数组
|
||||||
|
param:需要读取的长度
|
||||||
|
*/
|
||||||
void config_load(void)
|
void config_load(void)
|
||||||
{
|
{
|
||||||
uint16_t temp[2];
|
uint16_t temp[2];
|
||||||
fram_read(0, &temp, sizeof(temp));
|
fram_read(0, &temp, sizeof(temp));//通过调用 fram_read 函数将 FRAM 中的两个 uint16_t 数据读取到 temp 数组中,起始地址为 0,长度为两个 uint16_t 的大小
|
||||||
{
|
{
|
||||||
if (temp[0] == MAGIC)
|
if (temp[0] == MAGIC)
|
||||||
{
|
{
|
||||||
|
@ -42,16 +42,16 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int16_t flow_min;
|
int16_t flow_min;
|
||||||
int16_t flow_max;
|
int16_t flow_max;
|
||||||
} ad_flow_cal_t;
|
} ad_flow_cal_t; //存储ad转换的最大流量和最小流量
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint16_t magic;
|
uint16_t magic; //可能是一个用于标识流量配置的特殊字段或标志?
|
||||||
uint16_t input_type; // 1 : 4~20ma 2: 0~3.6K
|
uint16_t input_type; // 1 : 4~20ma 2: 0~3.6K
|
||||||
int16_t min_flow[2]; // 小流量切除
|
int16_t min_flow[2]; // 小流量切除
|
||||||
ad_flow_cal_t ad_cal[2];
|
ad_flow_cal_t ad_cal[2];
|
||||||
uint16_t pulse_coef[2];
|
uint16_t pulse_coef[2]; //可能代表了脉冲输出的系数或倍率?
|
||||||
uint16_t rsv[6];
|
uint16_t rsv[6]; //可能是预留给未来扩展使用的保留字段?
|
||||||
} flow_config_t;
|
} flow_config_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -10,15 +10,25 @@
|
|||||||
#include "fram.h"
|
#include "fram.h"
|
||||||
#include "ModbusM.h"
|
#include "ModbusM.h"
|
||||||
#include "ModbusS.h"
|
#include "ModbusS.h"
|
||||||
|
|
||||||
#include "rotary_encoder.h"
|
#include "rotary_encoder.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "driver/mcpwm.h"
|
#include "driver/mcpwm.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "esp_gatts_api.h"
|
||||||
|
#include "bt_server.h"
|
||||||
|
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "driver/uart.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
static const char *TAG = "depth";
|
static const char *TAG = "depth";
|
||||||
|
|
||||||
@ -46,6 +56,7 @@ typedef struct capture_event
|
|||||||
#define DEPTH_PIN_CTRL 38 // 深度控制GPIO端口 TIM15_CH2
|
#define DEPTH_PIN_CTRL 38 // 深度控制GPIO端口 TIM15_CH2
|
||||||
#define DEPTH_PIN_ENC_A 42 // 深度脉冲GPIO端口 TIM3_CH1
|
#define DEPTH_PIN_ENC_A 42 // 深度脉冲GPIO端口 TIM3_CH1
|
||||||
#define DEPTH_PIN_ENC_B 41 // 深度控制GPIO端口 TIM3_CH2
|
#define DEPTH_PIN_ENC_B 41 // 深度控制GPIO端口 TIM3_CH2
|
||||||
|
#define SEND_DATA_TEST 0
|
||||||
|
|
||||||
// #define DEPTH_PIN_ENC_A 36 // 深度脉冲GPIO端口
|
// #define DEPTH_PIN_ENC_A 36 // 深度脉冲GPIO端口
|
||||||
// #define DEPTH_PIN_ENC_B 35 // 深度控制GPIO端口
|
// #define DEPTH_PIN_ENC_B 35 // 深度控制GPIO端口
|
||||||
@ -56,6 +67,7 @@ extern int get_total_flow_by_time(int ch, uint32_t time);
|
|||||||
extern void zero_totalflow(int ch);
|
extern void zero_totalflow(int ch);
|
||||||
|
|
||||||
extern void reset_depth(void);
|
extern void reset_depth(void);
|
||||||
|
// extern esp_err_t ec11_pcnt_clear(pcnt_unit_t unit);
|
||||||
|
|
||||||
void capture_depth_init();
|
void capture_depth_init();
|
||||||
extern flow_t *pflow;
|
extern flow_t *pflow;
|
||||||
@ -75,7 +87,7 @@ typedef struct
|
|||||||
int16_t max_depth;
|
int16_t max_depth;
|
||||||
uint16_t pile_id;
|
uint16_t pile_id;
|
||||||
uint16_t count;
|
uint16_t count;
|
||||||
uint16_t work_time;
|
//uint16_t work_time;
|
||||||
struct _item
|
struct _item
|
||||||
{
|
{
|
||||||
int16_t speed;
|
int16_t speed;
|
||||||
@ -89,6 +101,26 @@ typedef struct
|
|||||||
} item[10];
|
} item[10];
|
||||||
} record_t;
|
} record_t;
|
||||||
|
|
||||||
|
//18字节
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct {
|
||||||
|
uint8_t TAG;
|
||||||
|
int16_t speed;
|
||||||
|
int16_t depth;
|
||||||
|
int16_t tilt_x;
|
||||||
|
int16_t tilt_y;
|
||||||
|
uint16_t current1;
|
||||||
|
uint16_t current2;
|
||||||
|
}send_to_bt_t1;
|
||||||
|
|
||||||
|
//16字节
|
||||||
|
typedef struct{
|
||||||
|
uint8_t TAG;
|
||||||
|
int16_t flow[2];
|
||||||
|
uint32_t total_flow[2];
|
||||||
|
}send_to_bt_t2;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int16_t up_down; // 12
|
int16_t up_down; // 12
|
||||||
@ -106,18 +138,18 @@ typedef struct
|
|||||||
// uint16_t current3;
|
// uint16_t current3;
|
||||||
} depth_t;
|
} depth_t;
|
||||||
|
|
||||||
|
|
||||||
record_t *record = (record_t *)&gWordVar[RECORD_REG_ADDR];
|
record_t *record = (record_t *)&gWordVar[RECORD_REG_ADDR];
|
||||||
depth_t *depth_data = (depth_t *)&gWordVar[DEPTH_REG_ADDR];
|
depth_t *depth_data = (depth_t *)&gWordVar[DEPTH_REG_ADDR];
|
||||||
|
|
||||||
move_t *pMoveCtx = (move_t *)&gWordVar[MOVE_REG_ADDR];
|
move_t *pMoveCtx = (move_t *)&gWordVar[MOVE_REG_ADDR];
|
||||||
|
|
||||||
depth_config_t *depth_config = (depth_config_t *)&gWordVar[DEPTH_CONFIG_ADDR];
|
depth_config_t *depth_config = (depth_config_t *)&gWordVar[DEPTH_CONFIG_ADDR];
|
||||||
|
|
||||||
|
|
||||||
rotary_encoder_t *encoder = NULL; // 编码器测量深度参数
|
rotary_encoder_t *encoder = NULL; // 编码器测量深度参数
|
||||||
|
|
||||||
static uint32_t cap_val_begin_of_depth = 0;
|
//static uint32_t cap_val_begin_of_depth = 0;
|
||||||
static uint32_t cap_val_end_of_depth = 0;
|
//static uint32_t cap_val_end_of_depth = 0;
|
||||||
extern uint32_t rtc_clk_apb_freq;
|
//extern uint32_t rtc_clk_apb_freq;
|
||||||
/**
|
/**
|
||||||
* @brief this is an ISR callback, we take action according to the captured edge
|
* @brief this is an ISR callback, we take action according to the captured edge
|
||||||
*/
|
*/
|
||||||
@ -254,8 +286,87 @@ int abs_sub(uint32_t enc_update_time, uint32_t _enc_update_time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void depth_task(void)
|
|
||||||
|
send_to_bt_t1 send_to_bt1;
|
||||||
|
send_to_bt_t2 send_to_bt2;
|
||||||
|
extern bool is_connected;
|
||||||
|
extern uint16_t spp_handle_table[SPP_IDX_NB];
|
||||||
|
extern uint16_t spp_conn_id;
|
||||||
|
extern esp_gatt_if_t spp_gatts_if;
|
||||||
|
extern flow_t *pflow ;
|
||||||
|
/*把两个结构体中的数据通过蓝牙发送*/
|
||||||
|
void send_data_to_bt(void){
|
||||||
|
|
||||||
|
#if SEND_DATA_TEST
|
||||||
|
send_to_bt1.TAG = 1;
|
||||||
|
send_to_bt1.speed = 2;
|
||||||
|
send_to_bt1.depth = 3;
|
||||||
|
send_to_bt1.tilt_x = 4;
|
||||||
|
send_to_bt1.tilt_y = 5;
|
||||||
|
send_to_bt1.current1 = 6;
|
||||||
|
send_to_bt1.current2 = 7;
|
||||||
|
|
||||||
|
send_to_bt2.TAG = 2;
|
||||||
|
send_to_bt2.flow[0] = 3;
|
||||||
|
send_to_bt2.flow[1] = 4;
|
||||||
|
send_to_bt2.total_flow[0] = 5;
|
||||||
|
send_to_bt2.total_flow[1] = 6;
|
||||||
|
ESP_LOGI(TAG, "set text data that send to bt\n");
|
||||||
|
#else
|
||||||
|
ESP_LOGI(TAG, "use real time data that send to bt\n");
|
||||||
|
send_to_bt1.TAG = 1;
|
||||||
|
send_to_bt1.tilt_x = (short)gWordVar[TILT_SENSER_ADDR];
|
||||||
|
send_to_bt1.tilt_y = (short)gWordVar[TILT_SENSER_ADDR + 1];
|
||||||
|
send_to_bt1.speed = depth_data->speed;
|
||||||
|
send_to_bt1.depth = depth_data->depth;
|
||||||
|
if (depth_config->move_current_channel == 2){
|
||||||
|
send_to_bt1.current1 = gWordVar[AC_CURRENT_REG_ADDR];
|
||||||
|
send_to_bt1.current2 = gWordVar[AC_CURRENT_REG_ADDR + 1];
|
||||||
|
}
|
||||||
|
else if (depth_config->move_current_channel == 1){
|
||||||
|
send_to_bt1.current1 = gWordVar[AC_CURRENT_REG_ADDR];
|
||||||
|
send_to_bt1.current2 = gWordVar[AC_CURRENT_REG_ADDR + 2];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
send_to_bt1.current1 = gWordVar[AC_CURRENT_REG_ADDR + 1];
|
||||||
|
send_to_bt1.current2 = gWordVar[AC_CURRENT_REG_ADDR + 2];
|
||||||
|
}
|
||||||
|
send_to_bt2.TAG = 2;
|
||||||
|
send_to_bt2.flow[0] = pflow[0].flow;
|
||||||
|
send_to_bt2.flow[1] = pflow[1].flow;
|
||||||
|
send_to_bt2.total_flow[0] = pflow[0].total_flow;
|
||||||
|
send_to_bt2.total_flow[1] = pflow[1].total_flow;
|
||||||
|
#endif
|
||||||
|
ESP_LOGI(TAG, "flow 1 :%d\n",send_to_bt2.flow[0]);
|
||||||
|
ESP_LOGI(TAG, "flow 2 :%d\n",send_to_bt2.flow[1]);
|
||||||
|
ESP_LOGI(TAG, "total_flow 1 :%d\n",send_to_bt2.total_flow[0]);
|
||||||
|
ESP_LOGI(TAG, "total_flow 2 :%d\n",send_to_bt2.total_flow[1]);
|
||||||
|
if(is_connected == true){
|
||||||
|
ESP_LOGI(TAG, "is connected\n");
|
||||||
|
esp_err_t err = esp_ble_gatts_send_indicate(spp_gatts_if,
|
||||||
|
spp_conn_id,
|
||||||
|
spp_handle_table[4],
|
||||||
|
sizeof(send_to_bt1),
|
||||||
|
(uint8*)&send_to_bt1,
|
||||||
|
false);
|
||||||
|
if(err == ESP_OK) ESP_LOGI(TAG, "send data to bt 1 sucessfully\n");
|
||||||
|
else ESP_LOGI(TAG, "send data to bt 1 failed\n");
|
||||||
|
|
||||||
|
err = esp_ble_gatts_send_indicate(spp_gatts_if,
|
||||||
|
spp_conn_id,
|
||||||
|
spp_handle_table[4],
|
||||||
|
sizeof(send_to_bt2),
|
||||||
|
(uint8*)&send_to_bt2,
|
||||||
|
false);
|
||||||
|
if(err == ESP_OK) ESP_LOGI(TAG, "send data to bt 2 sucessfully\n");
|
||||||
|
else ESP_LOGI(TAG, "send data to bt 2 failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void depth_task(void *arg)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "go to depth_task sucessfully\n");
|
||||||
// int enc_value;
|
// int enc_value;
|
||||||
int time_diff = 0;
|
int time_diff = 0;
|
||||||
int speed_timeout = 0;
|
int speed_timeout = 0;
|
||||||
@ -263,42 +374,54 @@ void depth_task(void)
|
|||||||
int speed_enc_update_time = 0; // 上次速度计算的编码器值
|
int speed_enc_update_time = 0; // 上次速度计算的编码器值
|
||||||
int speed_calc_count = 0;
|
int speed_calc_count = 0;
|
||||||
int enc_value = 0;
|
int enc_value = 0;
|
||||||
int count = 0;
|
//int count = 0;
|
||||||
|
int bt_time_count = 0;
|
||||||
depth_data->depth_offset = -depth_config->depth_offset;
|
depth_data->depth_offset = -depth_config->depth_offset;
|
||||||
depth_data->up_down = 1; // 默认工作
|
depth_data->up_down = 1; // 默认工作
|
||||||
|
|
||||||
record->pile_id = ++last_pile_id;
|
record->pile_id = ++last_pile_id;
|
||||||
|
//send_to_bt1.pile_id = ++last_pile_id;
|
||||||
|
|
||||||
gWordVar[LAST_PILE_ID_ADDR] = last_pile_id;
|
gWordVar[LAST_PILE_ID_ADDR] = last_pile_id;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_enc1_update_time != enc1_update_time)
|
if (_enc1_update_time != enc1_update_time)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "_enc1_update_time != enc1_update_time\n");
|
||||||
// int enc_update_time = enc1_update_time;
|
// int enc_update_time = enc1_update_time;
|
||||||
enc_update_time = enc1_update_time;
|
enc_update_time = enc1_update_time;
|
||||||
enc_value = enc1_value;
|
enc_value = enc1_value;
|
||||||
time_diff = abs_sub(enc_update_time, _enc1_update_time);
|
time_diff = abs_sub(enc_update_time, _enc1_update_time);
|
||||||
_enc1_update_time = enc_update_time;
|
_enc1_update_time = enc_update_time;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
if (time_diff != 0)
|
if (time_diff != 0)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "time_diff != 0\n");
|
||||||
int16_t depth = enc_value * depth_config->N / depth_config->M; // 1mm
|
int16_t depth = enc_value * depth_config->N / depth_config->M; // 1mm
|
||||||
depth_data->depth = depth - depth_data->depth_offset;
|
depth_data->depth = depth - depth_data->depth_offset;
|
||||||
if (depth_data->depth > depth_config->max_depth)
|
if (depth_data->depth > depth_config->max_depth)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "depth_data->depth > depth_config->max_depth\n");
|
||||||
depth_data->depth_offset = depth - depth_config->max_depth;
|
depth_data->depth_offset = depth - depth_config->max_depth;
|
||||||
depth_data->depth = depth_config->max_depth;
|
depth_data->depth = depth_config->max_depth;
|
||||||
}
|
}
|
||||||
else if (depth_data->depth < depth_config->min_depth)
|
else if (depth_data->depth < depth_config->min_depth)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "depth_data->depth < depth_config->min_depth\n");
|
||||||
depth_data->depth_offset = depth - depth_config->min_depth;
|
depth_data->depth_offset = depth - depth_config->min_depth;
|
||||||
depth_data->depth = depth_config->min_depth;
|
depth_data->depth = depth_config->min_depth;
|
||||||
}
|
}
|
||||||
if (depth_data->depth > record->max_depth)
|
if (depth_data->depth > record->max_depth)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "depth_data->depth > record->max_depth\n");
|
||||||
record->max_depth = depth_data->depth;
|
record->max_depth = depth_data->depth;
|
||||||
|
//send_to_bt1.max_depth = depth_data->depth;
|
||||||
}
|
}
|
||||||
if (speed_calc_count++ > 50) // 500ms计算一次速度
|
if (speed_calc_count++ > 50) // 500ms计算一次速度
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "speed_calc_count++ > 50\n");
|
||||||
speed_calc_count = 0;
|
speed_calc_count = 0;
|
||||||
int speed_time_diff = abs_sub(enc_update_time, speed_enc_update_time);
|
int speed_time_diff = abs_sub(enc_update_time, speed_enc_update_time);
|
||||||
int time_diff_us = speed_time_diff / (APB_CLK_FREQ / 1000000);
|
int time_diff_us = speed_time_diff / (APB_CLK_FREQ / 1000000);
|
||||||
@ -324,6 +447,7 @@ void depth_task(void)
|
|||||||
}
|
}
|
||||||
if (depth_data->up_down > STOP)
|
if (depth_data->up_down > STOP)
|
||||||
{
|
{
|
||||||
|
ESP_LOGI(TAG, "depth_data->up_down > STOP\n");
|
||||||
if (enc_value > last_enc_value)
|
if (enc_value > last_enc_value)
|
||||||
{ // 下钻,深度增加
|
{ // 下钻,深度增加
|
||||||
if (depth_data->up_down != 1)
|
if (depth_data->up_down != 1)
|
||||||
@ -342,7 +466,7 @@ void depth_task(void)
|
|||||||
if ((prev_depth - depth_data->depth) != 0)
|
if ((prev_depth - depth_data->depth) != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint32_t time = (target_sample_depth - prev_depth) * (enc_update_time - prev_update_time) / (depth_data->depth - prev_depth) + prev_update_time;
|
//uint32_t time = (target_sample_depth - prev_depth) * (enc_update_time - prev_update_time) / (depth_data->depth - prev_depth) + prev_update_time;
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
// int total_flow = get_total_flow_by_time(i, time);
|
// int total_flow = get_total_flow_by_time(i, time);
|
||||||
@ -380,7 +504,7 @@ void depth_task(void)
|
|||||||
if ((prev_depth - depth_data->depth) != 0)
|
if ((prev_depth - depth_data->depth) != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint32_t time = (prev_depth - target_sample_depth) * (enc_update_time - prev_update_time) / (prev_depth - depth_data->depth) + prev_update_time;
|
//uint32_t time = (prev_depth - target_sample_depth) * (enc_update_time - prev_update_time) / (prev_depth - depth_data->depth) + prev_update_time;
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
// int total_flow = get_total_flow_by_time(i, time);
|
// int total_flow = get_total_flow_by_time(i, time);
|
||||||
@ -396,6 +520,7 @@ void depth_task(void)
|
|||||||
depth_data->sample_count++;
|
depth_data->sample_count++;
|
||||||
add_recod_item();
|
add_recod_item();
|
||||||
target_sample_depth -= depth_config->sample_depth;
|
target_sample_depth -= depth_config->sample_depth;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,6 +528,7 @@ void depth_task(void)
|
|||||||
{
|
{
|
||||||
// depth_data->up_down = 0;
|
// depth_data->up_down = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth_data->depth < depth_config->inc_pile_depth) // 小于指定深度时才允许行走清零
|
if (depth_data->depth < depth_config->inc_pile_depth) // 小于指定深度时才允许行走清零
|
||||||
{
|
{
|
||||||
if (pMoveCtx->pile_inc_req == 1)
|
if (pMoveCtx->pile_inc_req == 1)
|
||||||
@ -423,7 +549,14 @@ void depth_task(void)
|
|||||||
prev_update_time = enc_update_time;
|
prev_update_time = enc_update_time;
|
||||||
last_enc_value = enc_value;
|
last_enc_value = enc_value;
|
||||||
}
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//每隔500ms向蓝牙发送一次数据
|
||||||
|
if(bt_time_count++ > 50){
|
||||||
|
ESP_LOGI(TAG, "bt_time_count++ > 50\n");
|
||||||
|
bt_time_count = 0;
|
||||||
|
send_data_to_bt();
|
||||||
|
}
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
// if (++count > 100)
|
// if (++count > 100)
|
||||||
// {
|
// {
|
||||||
// count = 0;
|
// count = 0;
|
||||||
@ -435,12 +568,14 @@ void depth_task(void)
|
|||||||
|
|
||||||
void add_recod_item(void)
|
void add_recod_item(void)
|
||||||
{
|
{
|
||||||
|
//每10cm计算一次
|
||||||
record->count = depth_data->sample_count;
|
record->count = depth_data->sample_count;
|
||||||
memmove(&record->item[1], &record->item[0], sizeof(record->item[0]) * 9);
|
memmove(&record->item[1], &record->item[0], sizeof(record->item[0]) * 9);
|
||||||
record->item[0].flow[0] = depth_data->depth_flow[0];
|
record->item[0].flow[0] = depth_data->depth_flow[0];
|
||||||
record->item[0].flow[1] = depth_data->depth_flow[1];
|
record->item[0].flow[1] = depth_data->depth_flow[1];
|
||||||
record->item[0].total_flow[0] = depth_data->last_total_flow[0];
|
record->item[0].total_flow[0] = depth_data->last_total_flow[0];
|
||||||
record->item[0].total_flow[1] = depth_data->last_total_flow[1];
|
record->item[0].total_flow[1] = depth_data->last_total_flow[1];
|
||||||
|
|
||||||
if (depth_config->move_current_channel == 2) // 1
|
if (depth_config->move_current_channel == 2) // 1
|
||||||
{
|
{
|
||||||
record->item[0].current1 = gWordVar[AC_CURRENT_REG_ADDR];
|
record->item[0].current1 = gWordVar[AC_CURRENT_REG_ADDR];
|
||||||
@ -459,14 +594,15 @@ void add_recod_item(void)
|
|||||||
|
|
||||||
record->item[0].tilt_x = (short)gWordVar[TILT_SENSER_ADDR];
|
record->item[0].tilt_x = (short)gWordVar[TILT_SENSER_ADDR];
|
||||||
record->item[0].tilt_y = (short)gWordVar[TILT_SENSER_ADDR + 1];
|
record->item[0].tilt_y = (short)gWordVar[TILT_SENSER_ADDR + 1];
|
||||||
record->item[0].speed = depth_data->speed;
|
|
||||||
record->item[0].depth = depth_data->depth;
|
record->item[0].speed = depth_data->speed; //每500ms计算一次
|
||||||
|
record->item[0].depth = depth_data->depth; //每10ms计算一次
|
||||||
}
|
}
|
||||||
extern int zero_totalflow_req;
|
extern int zero_totalflow_req;
|
||||||
extern void save_pile_id(void);
|
extern void save_pile_id(void);
|
||||||
void reset_depth(void)
|
void reset_depth(void)
|
||||||
{
|
{
|
||||||
uint16_t pile_id;
|
//uint16_t pile_id;
|
||||||
last_sample_depth = 0;
|
last_sample_depth = 0;
|
||||||
last_flow[0] = 0;
|
last_flow[0] = 0;
|
||||||
last_flow[1] = 0;
|
last_flow[1] = 0;
|
||||||
@ -488,7 +624,7 @@ void reset_depth(void)
|
|||||||
}
|
}
|
||||||
memset(record, 0, sizeof(*record));
|
memset(record, 0, sizeof(*record));
|
||||||
record->pile_id = last_pile_id;
|
record->pile_id = last_pile_id;
|
||||||
ec11_pcnt_clear(0);
|
//ec11_pcnt_clear(0);
|
||||||
depth_data->depth_offset = -depth_config->depth_offset;
|
depth_data->depth_offset = -depth_config->depth_offset;
|
||||||
depth_data->depth = depth_config->depth_offset;
|
depth_data->depth = depth_config->depth_offset;
|
||||||
enc1_value = 0;
|
enc1_value = 0;
|
||||||
@ -505,3 +641,5 @@ void DEPTH_init()
|
|||||||
capture_depth_init();
|
capture_depth_init();
|
||||||
xTaskCreate(depth_task, "depth_task", 4096, NULL, 10, NULL);
|
xTaskCreate(depth_task, "depth_task", 4096, NULL, 10, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ typedef struct
|
|||||||
mcpwm_capture_signal_t sel_cap_signal;
|
mcpwm_capture_signal_t sel_cap_signal;
|
||||||
} capture;
|
} capture;
|
||||||
|
|
||||||
static uint32_t cap_val_begin_of_flow1 = 0;
|
// static uint32_t cap_val_begin_of_flow1 = 0;
|
||||||
static uint32_t cap_val_end_of_flow1 = 0;
|
// static uint32_t cap_val_end_of_flow1 = 0;
|
||||||
static uint32_t cap_val_begin_of_flow2 = 0;
|
// static uint32_t cap_val_begin_of_flow2 = 0;
|
||||||
static uint32_t cap_val_end_of_flow2 = 0;
|
// static uint32_t cap_val_end_of_flow2 = 0;
|
||||||
|
|
||||||
static xQueueHandle cap_queue;
|
//static xQueueHandle cap_queue;
|
||||||
extern uint32_t rtc_clk_apb_freq;
|
extern uint32_t rtc_clk_apb_freq;
|
||||||
uint32_t volatile t15_ccr[2];
|
uint32_t volatile t15_ccr[2];
|
||||||
uint16_t volatile t15_ccr_times[2];
|
uint16_t volatile t15_ccr_times[2];
|
||||||
@ -49,6 +49,7 @@ uint16_t volatile t15_ccr_times[2];
|
|||||||
cal_4_20ma_t *cal_4_20ma = (cal_4_20ma_t *)&gWordVar[CAL_4_20MA_ADDR];
|
cal_4_20ma_t *cal_4_20ma = (cal_4_20ma_t *)&gWordVar[CAL_4_20MA_ADDR];
|
||||||
flow_config_t *flow_config = (flow_config_t *)&gWordVar[FLOW_CONFIG_ADDR];
|
flow_config_t *flow_config = (flow_config_t *)&gWordVar[FLOW_CONFIG_ADDR];
|
||||||
flow_t *pflow = (flow_t *)&gWordVar[FLOW_REG_ADDR];
|
flow_t *pflow = (flow_t *)&gWordVar[FLOW_REG_ADDR];
|
||||||
|
|
||||||
void capture_flow1_init();
|
void capture_flow1_init();
|
||||||
void capture_flow2_init();
|
void capture_flow2_init();
|
||||||
extern void ADS1220_Init(void);
|
extern void ADS1220_Init(void);
|
||||||
@ -171,11 +172,11 @@ void flow_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
extern void zero_totalflow(int ch);
|
extern void zero_totalflow(int ch);
|
||||||
void flow_task(void)
|
void flow_task(void *arg)
|
||||||
{
|
{
|
||||||
static uint32_t cp_flow_tick = 0;
|
static uint32_t cp_flow_tick = 0;
|
||||||
static uint32_t ad_flow_tick = 100;
|
static uint32_t ad_flow_tick = 100;
|
||||||
int lock_time_out = 0;
|
//int lock_time_out = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
vTaskDelay(50);
|
vTaskDelay(50);
|
||||||
|
@ -20,7 +20,7 @@ static const char *TAG = "UART0";
|
|||||||
#define BAUD_RATE (115200)
|
#define BAUD_RATE (115200)
|
||||||
#define UART_PORT_NUM (0)
|
#define UART_PORT_NUM (0)
|
||||||
#define BUF_SIZE (256)
|
#define BUF_SIZE (256)
|
||||||
#define UART_READ_TOUT (5 / portTICK_RATE_MS)
|
#define UART_READ_TOUT (50 / portTICK_RATE_MS)
|
||||||
|
|
||||||
#define LED1_GPIO_PIN 9
|
#define LED1_GPIO_PIN 9
|
||||||
|
|
||||||
@ -53,7 +53,8 @@ void uart0_init(void)
|
|||||||
ESP_ERROR_CHECK(uart_param_config(uart_num, &uart_config));
|
ESP_ERROR_CHECK(uart_param_config(uart_num, &uart_config));
|
||||||
ESP_LOGI(TAG, "UART set pins, mode and install driver.");
|
ESP_LOGI(TAG, "UART set pins, mode and install driver.");
|
||||||
// Set UART pins as per KConfig settings
|
// Set UART pins as per KConfig settings
|
||||||
// ESP_ERROR_CHECK(uart_set_pin(uart_num, UART_TXD_PIN, UART_RXD_PIN, UART_RTS_PIN, UART_CTS_PIN));
|
//ESP_ERROR_CHECK(uart_set_pin(uart_num, UART_TXD_PIN, UART_RXD_PIN, UART_RTS_PIN, UART_CTS_PIN));之前没解开注释
|
||||||
|
//ESP_ERROR_CHECK(uart_set_pin(uart_num, 11, 13, 12, -1));
|
||||||
// Set RS485 half duplex mode
|
// Set RS485 half duplex mode
|
||||||
ESP_ERROR_CHECK(uart_set_mode(uart_num, UART_MODE_RS485_HALF_DUPLEX));
|
ESP_ERROR_CHECK(uart_set_mode(uart_num, UART_MODE_RS485_HALF_DUPLEX));
|
||||||
// Set read timeout of UART TOUT feature
|
// Set read timeout of UART TOUT feature
|
||||||
@ -75,7 +76,7 @@ void LED1_Toggle(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uart0_modbus_slave_task(void)
|
void uart0_modbus_slave_task(void *arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@ -83,7 +84,7 @@ void uart0_modbus_slave_task(void)
|
|||||||
// Read data from UART
|
// Read data from UART
|
||||||
int txlen = 0;
|
int txlen = 0;
|
||||||
int len = uart_read_bytes(UART_PORT_NUM, rxbuf, BUF_SIZE, UART_READ_TOUT);
|
int len = uart_read_bytes(UART_PORT_NUM, rxbuf, BUF_SIZE, UART_READ_TOUT);
|
||||||
uint32_t tick = xTaskGetTickCount();
|
/*uint32_t tick = */xTaskGetTickCount();
|
||||||
// Write data back to UART
|
// Write data back to UART
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
522
sdkconfig
522
sdkconfig
@ -103,14 +103,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
|||||||
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
|
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
|
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set
|
||||||
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
|
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
|
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||||
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
||||||
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
||||||
@ -133,12 +133,12 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
|||||||
#
|
#
|
||||||
# Partition Table
|
# Partition Table
|
||||||
#
|
#
|
||||||
CONFIG_PARTITION_TABLE_SINGLE_APP=y
|
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
|
||||||
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
|
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
|
||||||
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
||||||
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
# CONFIG_PARTITION_TABLE_CUSTOM is not set
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
|
||||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
CONFIG_PARTITION_TABLE_MD5=y
|
CONFIG_PARTITION_TABLE_MD5=y
|
||||||
# end of Partition Table
|
# end of Partition Table
|
||||||
@ -146,8 +146,8 @@ CONFIG_PARTITION_TABLE_MD5=y
|
|||||||
#
|
#
|
||||||
# Example Configuration
|
# Example Configuration
|
||||||
#
|
#
|
||||||
CONFIG_ESP_WIFI_SSID="CMCC-xRSZ"
|
CONFIG_ESP_WIFI_SSID="myssid"
|
||||||
CONFIG_ESP_WIFI_PASSWORD="dughk9gm"
|
CONFIG_ESP_WIFI_PASSWORD="mypassword"
|
||||||
CONFIG_ESP_MAXIMUM_RETRY=5
|
CONFIG_ESP_MAXIMUM_RETRY=5
|
||||||
CONFIG_ESP_WIFI_AUTH_OPEN=y
|
CONFIG_ESP_WIFI_AUTH_OPEN=y
|
||||||
# CONFIG_ESP_WIFI_AUTH_WEP is not set
|
# CONFIG_ESP_WIFI_AUTH_WEP is not set
|
||||||
@ -204,9 +204,300 @@ CONFIG_APPTRACE_LOCK_ENABLE=y
|
|||||||
#
|
#
|
||||||
# Bluetooth
|
# Bluetooth
|
||||||
#
|
#
|
||||||
# CONFIG_BT_ENABLED is not set
|
CONFIG_BT_ENABLED=y
|
||||||
|
CONFIG_BT_SOC_SUPPORT_5_0=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bluetooth controller
|
||||||
|
#
|
||||||
|
CONFIG_BT_CTRL_MODE_EFF=1
|
||||||
|
CONFIG_BT_CTRL_BLE_MAX_ACT=6
|
||||||
|
CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=6
|
||||||
|
CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0
|
||||||
|
CONFIG_BT_CTRL_PINNED_TO_CORE_0=y
|
||||||
|
# CONFIG_BT_CTRL_PINNED_TO_CORE_1 is not set
|
||||||
|
CONFIG_BT_CTRL_PINNED_TO_CORE=0
|
||||||
|
CONFIG_BT_CTRL_HCI_MODE_VHCI=y
|
||||||
|
# CONFIG_BT_CTRL_HCI_MODE_UART_H4 is not set
|
||||||
|
CONFIG_BT_CTRL_HCI_TL=1
|
||||||
|
CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30
|
||||||
|
# CONFIG_BT_CTRL_HW_CCA is not set
|
||||||
|
CONFIG_BT_CTRL_HW_CCA_VAL=20
|
||||||
|
CONFIG_BT_CTRL_HW_CCA_EFF=0
|
||||||
|
CONFIG_BT_CTRL_CE_LENGTH_TYPE_ORIG=y
|
||||||
|
# CONFIG_BT_CTRL_CE_LENGTH_TYPE_CE is not set
|
||||||
|
# CONFIG_BT_CTRL_CE_LENGTH_TYPE_SD is not set
|
||||||
|
CONFIG_BT_CTRL_CE_LENGTH_TYPE_EFF=0
|
||||||
|
CONFIG_BT_CTRL_TX_ANTENNA_INDEX_0=y
|
||||||
|
# CONFIG_BT_CTRL_TX_ANTENNA_INDEX_1 is not set
|
||||||
|
CONFIG_BT_CTRL_TX_ANTENNA_INDEX_EFF=0
|
||||||
|
CONFIG_BT_CTRL_RX_ANTENNA_INDEX_0=y
|
||||||
|
# CONFIG_BT_CTRL_RX_ANTENNA_INDEX_1 is not set
|
||||||
|
CONFIG_BT_CTRL_RX_ANTENNA_INDEX_EFF=0
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N24 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N21 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N18 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N15 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N12 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N9 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N6 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N3 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N0 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P3 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P6 is not set
|
||||||
|
CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P9=y
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P12 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P15 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P18 is not set
|
||||||
|
# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P21 is not set
|
||||||
|
CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=11
|
||||||
|
CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y
|
||||||
|
CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100
|
||||||
|
CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
|
||||||
|
CONFIG_BT_CTRL_BLE_SCAN_DUPL=y
|
||||||
|
CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DEVICE=y
|
||||||
|
# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA is not set
|
||||||
|
# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE is not set
|
||||||
|
CONFIG_BT_CTRL_SCAN_DUPL_TYPE=0
|
||||||
|
CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE=100
|
||||||
|
CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD=0
|
||||||
|
# CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN is not set
|
||||||
|
# CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN is not set
|
||||||
|
CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS=y
|
||||||
|
CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0
|
||||||
|
|
||||||
|
#
|
||||||
|
# MODEM SLEEP Options
|
||||||
|
#
|
||||||
|
# CONFIG_BT_CTRL_MODEM_SLEEP is not set
|
||||||
|
# end of MODEM SLEEP Options
|
||||||
|
|
||||||
|
CONFIG_BT_CTRL_SLEEP_MODE_EFF=0
|
||||||
|
CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0
|
||||||
|
CONFIG_BT_CTRL_HCI_TL_EFF=1
|
||||||
|
# CONFIG_BT_CTRL_AGC_RECORRECT_EN is not set
|
||||||
|
# CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set
|
||||||
|
# end of Bluetooth controller
|
||||||
|
|
||||||
|
CONFIG_BT_BLUEDROID_ENABLED=y
|
||||||
|
# CONFIG_BT_NIMBLE_ENABLED is not set
|
||||||
|
# CONFIG_BT_CONTROLLER_ONLY is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bluedroid Options
|
||||||
|
#
|
||||||
|
CONFIG_BT_BTC_TASK_STACK_SIZE=3072
|
||||||
|
CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y
|
||||||
|
# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set
|
||||||
|
CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0
|
||||||
|
CONFIG_BT_BTU_TASK_STACK_SIZE=4096
|
||||||
|
# CONFIG_BT_BLUEDROID_MEM_DEBUG is not set
|
||||||
|
CONFIG_BT_BLE_ENABLED=y
|
||||||
|
CONFIG_BT_GATTS_ENABLE=y
|
||||||
|
# CONFIG_BT_GATTS_PPCP_CHAR_GAP is not set
|
||||||
|
# CONFIG_BT_BLE_BLUFI_ENABLE is not set
|
||||||
|
CONFIG_BT_GATT_MAX_SR_PROFILES=8
|
||||||
|
CONFIG_BT_GATT_MAX_SR_ATTRIBUTES=100
|
||||||
|
# CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set
|
||||||
|
CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_AUTO=y
|
||||||
|
CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0
|
||||||
|
CONFIG_BT_GATTC_ENABLE=y
|
||||||
|
CONFIG_BT_GATTC_MAX_CACHE_CHAR=40
|
||||||
|
# CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set
|
||||||
|
CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3
|
||||||
|
CONFIG_BT_BLE_SMP_ENABLE=y
|
||||||
|
# CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set
|
||||||
|
# CONFIG_BT_STACK_NO_LOG is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# BT DEBUG LOG LEVEL
|
||||||
|
#
|
||||||
|
# CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_HCI_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_HCI_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_HCI_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_HCI_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_HCI_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_HCI_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_HCI_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_BTM_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_BTM_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_BTM_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_BTM_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_BTM_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_BTM_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_BTM_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_L2CAP_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_SDP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_SDP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_SDP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_SDP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_SDP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_SDP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_SDP_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_GAP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_GAP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_GAP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_GAP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_GAP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_GAP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_GAP_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_BNEP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_BNEP_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_PAN_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_PAN_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_PAN_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_PAN_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_PAN_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_PAN_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_PAN_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_A2D_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_A2D_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_A2D_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_A2D_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_A2D_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_A2D_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_A2D_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_AVDT_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_AVDT_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_AVCT_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_AVCT_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_AVRC_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_AVRC_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_MCA_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_MCA_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_MCA_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_MCA_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_MCA_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_MCA_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_MCA_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_HID_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_HID_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_HID_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_HID_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_HID_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_HID_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_HID_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_APPL_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_APPL_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_APPL_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_APPL_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_APPL_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_APPL_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_APPL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_GATT_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_GATT_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_GATT_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_GATT_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_GATT_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_GATT_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_GATT_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_SMP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_SMP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_SMP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_SMP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_SMP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_SMP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_SMP_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_BTIF_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_BTIF_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_BTC_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_BTC_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_BTC_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_BTC_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_BTC_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_BTC_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_BTC_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_OSI_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_OSI_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_OSI_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_OSI_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_OSI_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_OSI_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_OSI_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BT_LOG_BLUFI_TRACE_LEVEL=2
|
||||||
|
# end of BT DEBUG LOG LEVEL
|
||||||
|
|
||||||
|
CONFIG_BT_ACL_CONNECTIONS=4
|
||||||
|
CONFIG_BT_MULTI_CONNECTION_ENBALE=y
|
||||||
|
# CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST is not set
|
||||||
|
# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set
|
||||||
|
# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set
|
||||||
|
CONFIG_BT_SMP_ENABLE=y
|
||||||
|
# CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN is not set
|
||||||
|
CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30
|
||||||
|
CONFIG_BT_MAX_DEVICE_NAME_LEN=32
|
||||||
|
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set
|
||||||
|
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
|
||||||
|
# end of Bluedroid Options
|
||||||
# end of Bluetooth
|
# end of Bluetooth
|
||||||
|
|
||||||
|
# CONFIG_BLE_MESH is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# CoAP Configuration
|
# CoAP Configuration
|
||||||
#
|
#
|
||||||
@ -225,6 +516,7 @@ CONFIG_COAP_LOG_DEFAULT_LEVEL=0
|
|||||||
#
|
#
|
||||||
# CONFIG_ADC_FORCE_XPD_FSM is not set
|
# CONFIG_ADC_FORCE_XPD_FSM is not set
|
||||||
CONFIG_ADC_DISABLE_DAC=y
|
CONFIG_ADC_DISABLE_DAC=y
|
||||||
|
# CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3 is not set
|
||||||
# end of ADC configuration
|
# end of ADC configuration
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -246,6 +538,7 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
|
|||||||
# TWAI configuration
|
# TWAI configuration
|
||||||
#
|
#
|
||||||
# CONFIG_TWAI_ISR_IN_IRAM is not set
|
# CONFIG_TWAI_ISR_IN_IRAM is not set
|
||||||
|
# CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set
|
||||||
# end of TWAI configuration
|
# end of TWAI configuration
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -284,6 +577,14 @@ CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y
|
|||||||
#
|
#
|
||||||
# ESP32S3-Specific
|
# ESP32S3-Specific
|
||||||
#
|
#
|
||||||
|
CONFIG_ESP32S3_REV_MIN_0=y
|
||||||
|
# CONFIG_ESP32S3_REV_MIN_1 is not set
|
||||||
|
# CONFIG_ESP32S3_REV_MIN_2 is not set
|
||||||
|
CONFIG_ESP32S3_REV_MIN_FULL=0
|
||||||
|
CONFIG_ESP_REV_MIN_FULL=0
|
||||||
|
CONFIG_ESP32S3_REV_MAX_FULL_STR_OPT=y
|
||||||
|
CONFIG_ESP32S3_REV_MAX_FULL=99
|
||||||
|
CONFIG_ESP_REV_MAX_FULL=99
|
||||||
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set
|
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set
|
||||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160=y
|
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160=y
|
||||||
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set
|
# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240 is not set
|
||||||
@ -341,7 +642,6 @@ CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC=y
|
|||||||
# CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set
|
# CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set
|
||||||
CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024
|
CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024
|
||||||
CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000
|
CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000
|
||||||
# CONFIG_ESP32S3_NO_BLOBS is not set
|
|
||||||
# CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM is not set
|
# CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM is not set
|
||||||
# CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set
|
# CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set
|
||||||
# end of ESP32S3-Specific
|
# end of ESP32S3-Specific
|
||||||
@ -482,6 +782,10 @@ CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
|||||||
CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20
|
CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20
|
||||||
CONFIG_ESP_PHY_MAX_TX_POWER=20
|
CONFIG_ESP_PHY_MAX_TX_POWER=20
|
||||||
CONFIG_ESP_PHY_ENABLE_USB=y
|
CONFIG_ESP_PHY_ENABLE_USB=y
|
||||||
|
CONFIG_ESP_PHY_RF_CAL_PARTIAL=y
|
||||||
|
# CONFIG_ESP_PHY_RF_CAL_NONE is not set
|
||||||
|
# CONFIG_ESP_PHY_RF_CAL_FULL is not set
|
||||||
|
CONFIG_ESP_PHY_CALIBRATION_MODE=0
|
||||||
# end of PHY
|
# end of PHY
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -560,6 +864,7 @@ CONFIG_ESP_TIMER_IMPL_SYSTIMER=y
|
|||||||
# Wi-Fi
|
# Wi-Fi
|
||||||
#
|
#
|
||||||
CONFIG_ESP32_WIFI_ENABLED=y
|
CONFIG_ESP32_WIFI_ENABLED=y
|
||||||
|
CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y
|
||||||
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
|
||||||
@ -763,6 +1068,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
|
|||||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
||||||
# CONFIG_LWIP_NETIF_API is not set
|
# CONFIG_LWIP_NETIF_API is not set
|
||||||
# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set
|
# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set
|
||||||
|
# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set
|
||||||
CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y
|
CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y
|
||||||
# CONFIG_LWIP_L2_TO_L3_COPY is not set
|
# CONFIG_LWIP_L2_TO_L3_COPY is not set
|
||||||
# CONFIG_LWIP_IRAM_OPTIMIZATION is not set
|
# CONFIG_LWIP_IRAM_OPTIMIZATION is not set
|
||||||
@ -783,12 +1089,15 @@ CONFIG_LWIP_IP6_FRAG=y
|
|||||||
# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
|
# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
|
||||||
CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
|
CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
|
||||||
CONFIG_LWIP_GARP_TMR_INTERVAL=60
|
CONFIG_LWIP_GARP_TMR_INTERVAL=60
|
||||||
|
CONFIG_LWIP_ESP_MLDV6_REPORT=y
|
||||||
|
CONFIG_LWIP_MLDV6_TMR_INTERVAL=40
|
||||||
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
|
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
|
||||||
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
||||||
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
|
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
|
||||||
CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y
|
CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y
|
||||||
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
|
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
|
||||||
CONFIG_LWIP_DHCP_OPTIONS_LEN=68
|
CONFIG_LWIP_DHCP_OPTIONS_LEN=68
|
||||||
|
CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1
|
||||||
|
|
||||||
#
|
#
|
||||||
# DHCP server
|
# DHCP server
|
||||||
@ -1219,6 +1528,15 @@ CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=256
|
|||||||
CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y
|
CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y
|
||||||
# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set
|
# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set
|
||||||
# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set
|
# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Root Hub configuration
|
||||||
|
#
|
||||||
|
CONFIG_USB_HOST_DEBOUNCE_DELAY_MS=250
|
||||||
|
CONFIG_USB_HOST_RESET_HOLD_MS=30
|
||||||
|
CONFIG_USB_HOST_RESET_RECOVERY_MS=30
|
||||||
|
CONFIG_USB_HOST_SET_ADDR_RECOVERY_MS=10
|
||||||
|
# end of Root Hub configuration
|
||||||
# end of USB-OTG
|
# end of USB-OTG
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1250,7 +1568,9 @@ CONFIG_WL_SECTOR_SIZE=4096
|
|||||||
#
|
#
|
||||||
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
|
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
|
||||||
CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
|
CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
|
||||||
|
# CONFIG_WIFI_PROV_BLE_BONDING is not set
|
||||||
# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set
|
# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set
|
||||||
|
# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set
|
||||||
# end of Wi-Fi Provisioning Manager
|
# end of Wi-Fi Provisioning Manager
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1314,6 +1634,187 @@ CONFIG_STACK_CHECK_NONE=y
|
|||||||
# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set
|
# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set
|
||||||
CONFIG_ESP32_APPTRACE_DEST_NONE=y
|
CONFIG_ESP32_APPTRACE_DEST_NONE=y
|
||||||
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
|
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
|
||||||
|
CONFIG_BLUEDROID_ENABLED=y
|
||||||
|
# CONFIG_NIMBLE_ENABLED is not set
|
||||||
|
CONFIG_BTC_TASK_STACK_SIZE=3072
|
||||||
|
CONFIG_BLUEDROID_PINNED_TO_CORE_0=y
|
||||||
|
# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set
|
||||||
|
CONFIG_BLUEDROID_PINNED_TO_CORE=0
|
||||||
|
CONFIG_BTU_TASK_STACK_SIZE=4096
|
||||||
|
# CONFIG_BLUEDROID_MEM_DEBUG is not set
|
||||||
|
CONFIG_GATTS_ENABLE=y
|
||||||
|
# CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set
|
||||||
|
CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y
|
||||||
|
CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0
|
||||||
|
CONFIG_GATTC_ENABLE=y
|
||||||
|
# CONFIG_GATTC_CACHE_NVS_FLASH is not set
|
||||||
|
CONFIG_BLE_SMP_ENABLE=y
|
||||||
|
# CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set
|
||||||
|
# CONFIG_HCI_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_HCI_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_HCI_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_HCI_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_HCI_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_HCI_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_HCI_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_HCI_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BTM_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BTM_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BTM_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BTM_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BTM_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BTM_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BTM_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BTM_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_L2CAP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_L2CAP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_L2CAP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_L2CAP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_L2CAP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_L2CAP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_L2CAP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_L2CAP_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_RFCOMM_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_RFCOMM_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_RFCOMM_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_RFCOMM_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_RFCOMM_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_RFCOMM_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_RFCOMM_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_RFCOMM_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_SDP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_SDP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_SDP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_SDP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_SDP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_SDP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_SDP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BTH_LOG_SDP_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_GAP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_GAP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_GAP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_GAP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_GAP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_GAP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_GAP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_GAP_INITIAL_TRACE_LEVEL=2
|
||||||
|
CONFIG_BNEP_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_PAN_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_PAN_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_PAN_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_PAN_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_PAN_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_PAN_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_PAN_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_PAN_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_A2D_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_A2D_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_A2D_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_A2D_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_A2D_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_A2D_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_A2D_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_A2D_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_AVDT_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_AVDT_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_AVDT_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_AVDT_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_AVDT_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_AVDT_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_AVDT_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_AVDT_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_AVCT_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_AVCT_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_AVCT_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_AVCT_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_AVCT_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_AVCT_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_AVCT_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_AVCT_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_AVRC_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_AVRC_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_AVRC_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_AVRC_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_AVRC_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_AVRC_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_AVRC_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_AVRC_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_MCA_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_MCA_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_MCA_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_MCA_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_MCA_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_MCA_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_MCA_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_MCA_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_HID_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_HID_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_HID_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_HID_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_HID_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_HID_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_HID_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_HID_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_APPL_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_APPL_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_APPL_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_APPL_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_APPL_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_APPL_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_APPL_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_APPL_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_GATT_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_GATT_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_GATT_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_GATT_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_GATT_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_GATT_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_GATT_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_GATT_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_SMP_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_SMP_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_SMP_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_SMP_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_SMP_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_SMP_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_SMP_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_SMP_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BTIF_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BTIF_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BTIF_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BTIF_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BTIF_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BTIF_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BTIF_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BTIF_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BTC_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BTC_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BTC_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BTC_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BTC_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BTC_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BTC_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BTC_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_OSI_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_OSI_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_OSI_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_OSI_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_OSI_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_OSI_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_OSI_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_OSI_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BLUFI_TRACE_LEVEL_NONE is not set
|
||||||
|
# CONFIG_BLUFI_TRACE_LEVEL_ERROR is not set
|
||||||
|
CONFIG_BLUFI_TRACE_LEVEL_WARNING=y
|
||||||
|
# CONFIG_BLUFI_TRACE_LEVEL_API is not set
|
||||||
|
# CONFIG_BLUFI_TRACE_LEVEL_EVENT is not set
|
||||||
|
# CONFIG_BLUFI_TRACE_LEVEL_DEBUG is not set
|
||||||
|
# CONFIG_BLUFI_TRACE_LEVEL_VERBOSE is not set
|
||||||
|
CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2
|
||||||
|
# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set
|
||||||
|
CONFIG_SMP_ENABLE=y
|
||||||
|
# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set
|
||||||
|
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30
|
||||||
CONFIG_ADC2_DISABLE_DAC=y
|
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
|
||||||
@ -1348,6 +1849,7 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
|||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
||||||
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set
|
||||||
CONFIG_TIMER_TASK_STACK_SIZE=3584
|
CONFIG_TIMER_TASK_STACK_SIZE=3584
|
||||||
|
CONFIG_SW_COEXIST_ENABLE=y
|
||||||
# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set
|
# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set
|
||||||
# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set
|
# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set
|
||||||
CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
|
CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
|
||||||
|
1595
sdkconfig.old
Normal file
1595
sdkconfig.old
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user