kopia lustrzana https://github.com/pjalocha/esp32-ogn-tracker
Progress on BLE but far from ready yet
rodzic
88ea6f851b
commit
1a4e4398b2
194
main/bt.cpp
194
main/bt.cpp
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
#ifdef WITH_BT_SPP
|
#include "format.h"
|
||||||
|
#include "fifo.h"
|
||||||
|
|
||||||
|
#ifdef WITH_BT_SPP // classic BT
|
||||||
|
|
||||||
#include "esp_bt.h"
|
#include "esp_bt.h"
|
||||||
#include "esp_bt_main.h"
|
#include "esp_bt_main.h"
|
||||||
|
@ -12,9 +15,6 @@
|
||||||
#include "esp_bt_device.h"
|
#include "esp_bt_device.h"
|
||||||
#include "esp_spp_api.h"
|
#include "esp_spp_api.h"
|
||||||
|
|
||||||
#include "format.h"
|
|
||||||
#include "fifo.h"
|
|
||||||
|
|
||||||
static const esp_spp_mode_t esp_spp_mode = ESP_SPP_MODE_CB;
|
static const esp_spp_mode_t esp_spp_mode = ESP_SPP_MODE_CB;
|
||||||
static const esp_spp_sec_t sec_mask = ESP_SPP_SEC_AUTHENTICATE;
|
static const esp_spp_sec_t sec_mask = ESP_SPP_SEC_AUTHENTICATE;
|
||||||
static const esp_spp_role_t role_slave = ESP_SPP_ROLE_SLAVE;
|
static const esp_spp_role_t role_slave = ESP_SPP_ROLE_SLAVE;
|
||||||
|
@ -53,7 +53,7 @@ static size_t BT_SPP_TxPush(size_t MaxLen=128) // transmit pa
|
||||||
return Len; } // return number of transmitted bytes
|
return Len; } // return number of transmitted bytes
|
||||||
|
|
||||||
static void esp_spp_cb(esp_spp_cb_event_t Event, esp_spp_cb_param_t *Param)
|
static void esp_spp_cb(esp_spp_cb_event_t Event, esp_spp_cb_param_t *Param)
|
||||||
{ switch (Event)
|
{ switch(Event)
|
||||||
{ case ESP_SPP_INIT_EVT: // [0]
|
{ case ESP_SPP_INIT_EVT: // [0]
|
||||||
esp_bt_dev_set_device_name(Parameters.BTname);
|
esp_bt_dev_set_device_name(Parameters.BTname);
|
||||||
// esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE); // for older ESP-IDF
|
// esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE); // for older ESP-IDF
|
||||||
|
@ -124,7 +124,7 @@ static void esp_spp_cb(esp_spp_cb_event_t Event, esp_spp_cb_param_t *Param)
|
||||||
|
|
||||||
static void esp_bt_gap_cb(esp_bt_gap_cb_event_t Event, esp_bt_gap_cb_param_t *Param)
|
static void esp_bt_gap_cb(esp_bt_gap_cb_event_t Event, esp_bt_gap_cb_param_t *Param)
|
||||||
{
|
{
|
||||||
switch (Event) // event numbers are in esp-idf/components/bt/bluedroid/api/include/api/esp_gap_bt_api.h
|
switch(Event) // event numbers are in esp-idf/components/bt/bluedroid/api/include/api/esp_gap_bt_api.h
|
||||||
{
|
{
|
||||||
case ESP_BT_GAP_AUTH_CMPL_EVT:
|
case ESP_BT_GAP_AUTH_CMPL_EVT:
|
||||||
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
@ -187,9 +187,11 @@ int BT_SPP_Init(void)
|
||||||
if(Parameters.BTname[0]==0) return Err;
|
if(Parameters.BTname[0]==0) return Err;
|
||||||
|
|
||||||
esp_bt_controller_config_t BTconf = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); // the default mode is defined by the menuconfig settings
|
esp_bt_controller_config_t BTconf = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); // the default mode is defined by the menuconfig settings
|
||||||
Err = esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
|
BTconf.mode = ESP_BT_MODE_CLASSIC_BT;
|
||||||
|
// Err = esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
|
||||||
Err = esp_bt_controller_init(&BTconf); if(Err!=ESP_OK) return Err;
|
Err = esp_bt_controller_init(&BTconf); if(Err!=ESP_OK) return Err;
|
||||||
Err = esp_bt_controller_enable((esp_bt_mode_t)BTconf.mode); if(Err!=ESP_OK) return Err; // mode must be same as in BTconf
|
Err = esp_bt_controller_enable((esp_bt_mode_t)BTconf.mode); if(Err!=ESP_OK) return Err; // mode must be same as in BTconf
|
||||||
|
// Err = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT); if(Err!=ESP_OK) return Err;
|
||||||
Err = esp_bluedroid_init(); if(Err!=ESP_OK) return Err; // init the BT stack
|
Err = esp_bluedroid_init(); if(Err!=ESP_OK) return Err; // init the BT stack
|
||||||
Err = esp_bluedroid_enable(); if(Err!=ESP_OK) return Err; // enable the BT stack
|
Err = esp_bluedroid_enable(); if(Err!=ESP_OK) return Err; // enable the BT stack
|
||||||
Err = esp_bt_gap_register_callback(esp_bt_gap_cb); if(Err!=ESP_OK) return Err;
|
Err = esp_bt_gap_register_callback(esp_bt_gap_cb); if(Err!=ESP_OK) return Err;
|
||||||
|
@ -217,4 +219,182 @@ int BT_SPP_Init(void)
|
||||||
|
|
||||||
#endif // WITH_BT_SPP
|
#endif // WITH_BT_SPP
|
||||||
|
|
||||||
|
#ifdef WITH_BLE_SPP // BLE BT
|
||||||
|
|
||||||
|
#include "esp_bt.h"
|
||||||
|
#include "esp_bt_defs.h"
|
||||||
|
#include "esp_bt_main.h"
|
||||||
|
#include "esp_gap_bt_api.h"
|
||||||
|
#include "esp_bt_device.h"
|
||||||
|
#include "esp_gap_ble_api.h"
|
||||||
|
#include "esp_gatts_api.h"
|
||||||
|
#include "esp_gatt_defs.h"
|
||||||
|
|
||||||
|
#define ESP_SPP_APP_ID 0x56
|
||||||
|
#define SPP_SVC_INST_ID 0
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t spp_adv_data[23] =
|
||||||
|
{ 0x02, 0x01, 0x06,
|
||||||
|
0x03, 0x03, 0xF0, 0xAB,
|
||||||
|
0x0F, 0x09, 0x45, 0x53, 0x50, 0x5f, 0x53, 0x50, 0x50, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52 };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static FIFO<char, 1024> BT_SPP_TxFIFO; // buffer for console output to be sent over BT
|
||||||
|
static FIFO<uint8_t, 256> BT_SPP_RxFIFO; // buffer for BT data to be send to the console
|
||||||
|
static uint32_t BT_SPP_Conn = 0; // BT incoming connection handle
|
||||||
|
static uint32_t BT_SPP_TxCong = 0; // congestion control
|
||||||
|
|
||||||
|
bool BT_SPP_isConnected(void) { return BT_SPP_Conn; } // is a client connected to BT_SPP ?
|
||||||
|
|
||||||
|
static void setPilotID(esp_bd_addr_t MAC, size_t Len=6) // set PilotID in the parameters from the BT SPP client MAC (thus Pilot's smartphone)
|
||||||
|
{ char *ID = Parameters.PilotID;
|
||||||
|
ID[0]='B'; ID[1]='T'; ID[2]='_'; ID+=3;
|
||||||
|
for(int Idx=0; Idx<Len; Idx++)
|
||||||
|
{ Format_Hex(ID, MAC[Idx]); ID+=2; }
|
||||||
|
ID[0]=0; }
|
||||||
|
|
||||||
|
static void clrPilotID(void) // clear the Pilot_ID when BT SPP gets disconnected
|
||||||
|
{ Parameters.PilotID[0]=0; }
|
||||||
|
|
||||||
|
static size_t BT_SPP_TxPush(size_t MaxLen=128) // transmit part of the TxFIFO to the BT link
|
||||||
|
{ // BT_SPP_LastTxPush = xTaskGetTickCount(); // [ms] remember last time the TxPush was done
|
||||||
|
char *Data; size_t Len=BT_SPP_TxFIFO.getReadBlock(Data); // see how much data is there in the queue for transmission
|
||||||
|
if(Len==0) return 0; // if block is empty then give up
|
||||||
|
if(Len>MaxLen) Len=MaxLen; // limit the block size
|
||||||
|
// esp_err_t Ret=esp_spp_write(BT_SPP_Conn, Len, (uint8_t *)Data); // write the block to the BT
|
||||||
|
// if(Ret!=ESP_OK) return 0; // if an error then give up
|
||||||
|
BT_SPP_TxFIFO.flushReadBlock(Len); // remove the transmitted block from the FIFO
|
||||||
|
return Len; } // return number of transmitted bytes
|
||||||
|
|
||||||
|
static void esp_ble_gatts_cb(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;
|
||||||
|
switch(Event)
|
||||||
|
{ case ESP_GATTS_REG_EVT: // #0
|
||||||
|
esp_ble_gap_set_device_name(Parameters.BTname);
|
||||||
|
esp_ble_gap_config_adv_data_raw((uint8_t *)spp_adv_data, sizeof(spp_adv_data));
|
||||||
|
// esp_ble_gatts_create_attr_tab(spp_gatt_db, gatts_if, SPP_IDX_NB, SPP_SVC_INST_ID);
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_UNREG_EVT: // #6
|
||||||
|
break;
|
||||||
|
case ESP_GATTS_MTU_EVT: // #4
|
||||||
|
// spp_mtu_size = p_data->mtu.mtu;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
Format_String(CONS_UART_Write, "BLE_GATTS: Event ");
|
||||||
|
Format_UnsDec(CONS_UART_Write, (uint32_t)Event);
|
||||||
|
Format_String(CONS_UART_Write, "\n");
|
||||||
|
xSemaphoreGive(CONS_Mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void esp_ble_gap_cb(esp_gap_ble_cb_event_t Event, esp_ble_gap_cb_param_t *Param)
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{ case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
|
||||||
|
esp_ble_gap_start_advertising(&spp_adv_params);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
Format_String(CONS_UART_Write, "BLE_GAP: Event ");
|
||||||
|
Format_UnsDec(CONS_UART_Write, (uint32_t)Event);
|
||||||
|
Format_String(CONS_UART_Write, "\n");
|
||||||
|
xSemaphoreGive(CONS_Mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef OBSOLETE
|
||||||
|
static void esp_bt_gap_cb(esp_bt_gap_cb_event_t Event, esp_bt_gap_cb_param_t *Param)
|
||||||
|
{
|
||||||
|
switch(Event) // event numbers are in esp-idf/components/bt/bluedroid/api/include/api/esp_gap_bt_api.h
|
||||||
|
{
|
||||||
|
case ESP_BT_GAP_AUTH_CMPL_EVT:
|
||||||
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
if (Param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS)
|
||||||
|
{ Format_String(CONS_UART_Write, "BT_GAP: ");
|
||||||
|
Format_String(CONS_UART_Write, (const char *)Param->auth_cmpl.device_name);
|
||||||
|
Format_String(CONS_UART_Write, " authenticated\n"); }
|
||||||
|
else
|
||||||
|
{ Format_String(CONS_UART_Write, "BT_GAP: Authentication failure (");
|
||||||
|
Format_SignDec(CONS_UART_Write, Param->auth_cmpl.stat);
|
||||||
|
Format_String(CONS_UART_Write, ")\n"); }
|
||||||
|
// ESP_LOGI(SPP_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||||
|
// esp_log_buffer_hex(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||||
|
// ESP_LOGE(SPP_TAG, "authentication failed, status:%d", param->auth_cmpl.stat);
|
||||||
|
xSemaphoreGive(CONS_Mutex);
|
||||||
|
break;
|
||||||
|
case ESP_BT_GAP_PIN_REQ_EVT:
|
||||||
|
/*
|
||||||
|
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_PIN_REQ_EVT min_16_digit:%d", param->pin_req.min_16_digit);
|
||||||
|
if (param->pin_req.min_16_digit) {
|
||||||
|
ESP_LOGI(SPP_TAG, "Input pin code: 0000 0000 0000 0000");
|
||||||
|
esp_bt_pin_code_t pin_code = {0};
|
||||||
|
esp_bt_gap_pin_reply(param->pin_req.bda, true, 16, pin_code);
|
||||||
|
} else {
|
||||||
|
ESP_LOGI(SPP_TAG, "Input pin code: 1234");
|
||||||
|
esp_bt_pin_code_t pin_code;
|
||||||
|
pin_code[0] = '1';
|
||||||
|
pin_code[1] = '2';
|
||||||
|
pin_code[2] = '3';
|
||||||
|
pin_code[3] = '4';
|
||||||
|
esp_bt_gap_pin_reply(param->pin_req.bda, true, 4, pin_code);
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
Format_String(CONS_UART_Write, "BT_GAP: Event ");
|
||||||
|
Format_UnsDec(CONS_UART_Write, (uint32_t)Event);
|
||||||
|
Format_String(CONS_UART_Write, "\n");
|
||||||
|
xSemaphoreGive(CONS_Mutex);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int BT_SPP_Read (uint8_t &Byte) // read a character from the BT serial port (buffer)
|
||||||
|
{ // if(!BT_SPP_Conn) return 0;
|
||||||
|
return BT_SPP_RxFIFO.Read(Byte); }
|
||||||
|
|
||||||
|
void BT_SPP_Write (char Byte) // send a character to the BT serial port
|
||||||
|
{ if(!BT_SPP_Conn) return; // if BT connection is active
|
||||||
|
BT_SPP_TxFIFO.Write(Byte); // write the byte into the TxFIFO
|
||||||
|
|
||||||
|
if( (BT_SPP_TxCong==0) && ( (Byte=='\n') || (BT_SPP_TxFIFO.Full()>=64) ) ) // if no congestion and EOL or 64B waiting $
|
||||||
|
{ BT_SPP_TxPush(); } // read a block from TxFIFO ad push it into$
|
||||||
|
}
|
||||||
|
|
||||||
|
int BT_SPP_Init(void)
|
||||||
|
{ esp_err_t Err=ESP_OK;
|
||||||
|
if(Parameters.BTname[0]==0) return Err;
|
||||||
|
|
||||||
|
esp_bt_controller_config_t BTconf = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); // the default mode is defined by the men$
|
||||||
|
BTconf.mode = ESP_BT_MODE_BLE;
|
||||||
|
// Err = esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
|
||||||
|
Err = esp_bt_controller_init(&BTconf); if(Err!=ESP_OK) return Err;
|
||||||
|
Err = esp_bt_controller_enable((esp_bt_mode_t)BTconf.mode); if(Err!=ESP_OK) return Err; // mode must be same as in BTconf
|
||||||
|
Err = esp_bluedroid_init(); if(Err!=ESP_OK) return Err; // init the BT stack
|
||||||
|
Err = esp_bluedroid_enable(); if(Err!=ESP_OK) return Err; // enable the BT stack
|
||||||
|
Err = esp_ble_gap_register_callback(esp_ble_gap_cb); if(Err!=ESP_OK) return Err;
|
||||||
|
Err = esp_ble_gatts_register_callback(esp_ble_gatts_cb); if(Err!=ESP_OK) return Err;
|
||||||
|
Err = esp_ble_gatts_app_register(ESP_SPP_APP_ID); if(Err!=ESP_OK) return Err;
|
||||||
|
|
||||||
|
return Err; }
|
||||||
|
|
||||||
|
#endif // WITH_BLE_SPP
|
||||||
|
|
||||||
// ========================================================================================================
|
// ========================================================================================================
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_freertos_hooks.h"
|
#include "esp_freertos_hooks.h"
|
||||||
|
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
#include "bt.h"
|
#include "bt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ bool CONS_InpReady(void)
|
||||||
void CONS_UART_Write (char Byte)
|
void CONS_UART_Write (char Byte)
|
||||||
{ uart_write_bytes (CONS_UART, &Byte, 1);
|
{ uart_write_bytes (CONS_UART, &Byte, 1);
|
||||||
// putchar(Byte);
|
// putchar(Byte);
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
BT_SPP_Write(Byte);
|
BT_SPP_Write(Byte);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_AP
|
#ifdef WITH_AP
|
||||||
|
@ -686,7 +686,7 @@ void CONS_UART_Write (char Byte)
|
||||||
int CONS_UART_Read (uint8_t &Byte)
|
int CONS_UART_Read (uint8_t &Byte)
|
||||||
{ int Ret=uart_read_bytes (CONS_UART, &Byte, 1, 0); if(Ret==1) return 1;
|
{ int Ret=uart_read_bytes (CONS_UART, &Byte, 1, 0); if(Ret==1) return 1;
|
||||||
// int Ret=getchar(); if(Ret>=0) { Byte=Ret; return 1; }
|
// int Ret=getchar(); if(Ret>=0) { Byte=Ret; return 1; }
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
Ret=BT_SPP_Read(Byte); if(Ret>0) { return 1; }
|
Ret=BT_SPP_Read(Byte); if(Ret>0) { return 1; }
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_STRATUX
|
#ifdef WITH_STRATUX
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "stratux.h"
|
#include "stratux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
#include "bt.h"
|
#include "bt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void app_main(void)
|
||||||
|
|
||||||
CONS_UART_SetBaudrate(Parameters.CONbaud);
|
CONS_UART_SetBaudrate(Parameters.CONbaud);
|
||||||
|
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
{ int32_t Err=BT_SPP_Init(); // start BT SPP
|
{ int32_t Err=BT_SPP_Init(); // start BT SPP
|
||||||
// #ifdef DEBUG_PRINT
|
// #ifdef DEBUG_PRINT
|
||||||
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
|
||||||
|
|
|
@ -126,7 +126,7 @@ class FlashParameters
|
||||||
|
|
||||||
uint32_t PageMask; // enable/disable individual pages on the LCD or OLED screen
|
uint32_t PageMask; // enable/disable individual pages on the LCD or OLED screen
|
||||||
|
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
char BTname[16];
|
char BTname[16];
|
||||||
// char BTpin[16];
|
// char BTpin[16];
|
||||||
#endif
|
#endif
|
||||||
|
@ -269,7 +269,7 @@ uint16_t StratuxPort;
|
||||||
#ifdef WITH_ENCRYPT
|
#ifdef WITH_ENCRYPT
|
||||||
for(uint8_t Idx=0; Idx<4; Idx++) EncryptKey[Idx]=0;
|
for(uint8_t Idx=0; Idx<4; Idx++) EncryptKey[Idx]=0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
getAprsCall(BTname);
|
getAprsCall(BTname);
|
||||||
// strcpy(BTpin, "1234");
|
// strcpy(BTpin, "1234");
|
||||||
#endif
|
#endif
|
||||||
|
@ -706,7 +706,7 @@ uint16_t StratuxPort;
|
||||||
for(uint8_t Idx=0; Idx<InfoParmNum; Idx++)
|
for(uint8_t Idx=0; Idx<InfoParmNum; Idx++)
|
||||||
{ if(strcmp(Name, OGN_Packet::InfoParmName(Idx))==0)
|
{ if(strcmp(Name, OGN_Packet::InfoParmName(Idx))==0)
|
||||||
return Read_String(InfoParmValue(Idx), Value, 16)<=0; }
|
return Read_String(InfoParmValue(Idx), Value, 16)<=0; }
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
if(strcmp(Name, "BTname")==0) return Read_String(BTname, Value, 16)<=0;
|
if(strcmp(Name, "BTname")==0) return Read_String(BTname, Value, 16)<=0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_AP
|
#ifdef WITH_AP
|
||||||
|
@ -855,7 +855,7 @@ uint16_t StratuxPort;
|
||||||
#endif
|
#endif
|
||||||
for(uint8_t Idx=0; Idx<InfoParmNum; Idx++)
|
for(uint8_t Idx=0; Idx<InfoParmNum; Idx++)
|
||||||
{ Write_String (Line, OGN_Packet::InfoParmName(Idx), InfoParmValue(Idx)); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF; }
|
{ Write_String (Line, OGN_Packet::InfoParmName(Idx), InfoParmValue(Idx)); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF; }
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
strcpy(Line, "BTname = "); strcat(Line, BTname); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF;
|
strcpy(Line, "BTname = "); strcat(Line, BTname); strcat(Line, "; # [char]\n"); if(fputs(Line, File)==EOF) return EOF;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_AP
|
#ifdef WITH_AP
|
||||||
|
@ -919,7 +919,7 @@ uint16_t StratuxPort;
|
||||||
#ifdef WITH_BT_PWR
|
#ifdef WITH_BT_PWR
|
||||||
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); Format_String(Output, Line);
|
Write_UnsDec (Line, "Bluetooth" , BT_ON ); strcat(Line, " # [ 1|0]\n"); Format_String(Output, Line);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_BT_SPP
|
#if defined(WITH_BT_SPP) || defined(WITH_BLE_SPP)
|
||||||
strcpy(Line, "BTname = "); strcat(Line, BTname); strcat(Line, "; # [char]\n"); Format_String(Output, Line);
|
strcpy(Line, "BTname = "); strcat(Line, BTname); strcat(Line, "; # [char]\n"); Format_String(Output, Line);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_AP
|
#ifdef WITH_AP
|
||||||
|
|
43
sdkconfig
43
sdkconfig
|
@ -168,14 +168,16 @@ CONFIG_BT_ENABLED=y
|
||||||
# Bluetooth controller
|
# Bluetooth controller
|
||||||
#
|
#
|
||||||
# CONFIG_BTDM_CTRL_MODE_BLE_ONLY is not set
|
# CONFIG_BTDM_CTRL_MODE_BLE_ONLY is not set
|
||||||
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=y
|
# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set
|
||||||
# CONFIG_BTDM_CTRL_MODE_BTDM is not set
|
CONFIG_BTDM_CTRL_MODE_BTDM=y
|
||||||
|
CONFIG_BTDM_CTRL_BLE_MAX_CONN=2
|
||||||
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2
|
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2
|
||||||
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=0
|
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=0
|
||||||
# CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI is not set
|
# CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI is not set
|
||||||
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y
|
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y
|
||||||
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1
|
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1
|
||||||
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0
|
# CONFIG_BTDM_CTRL_AUTO_LATENCY is not set
|
||||||
|
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=2
|
||||||
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2
|
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2
|
||||||
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
|
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
|
||||||
CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
|
CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
|
||||||
|
@ -191,8 +193,21 @@ CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG=y
|
||||||
CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL=y
|
CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL=y
|
||||||
# end of MODEM SLEEP Options
|
# end of MODEM SLEEP Options
|
||||||
|
|
||||||
|
CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y
|
||||||
CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
|
CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
|
||||||
# CONFIG_BTDM_COEX_BT_OPTIONS is not set
|
CONFIG_BTDM_BLE_SCAN_DUPL=y
|
||||||
|
CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y
|
||||||
|
# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set
|
||||||
|
# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set
|
||||||
|
CONFIG_BTDM_SCAN_DUPL_TYPE=0
|
||||||
|
CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=200
|
||||||
|
# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set
|
||||||
|
CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y
|
||||||
|
CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y
|
||||||
|
CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100
|
||||||
|
CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
|
||||||
|
CONFIG_BTDM_COEX_BT_OPTIONS=y
|
||||||
|
CONFIG_BTDM_COEX_BLE_ADV_HIGH_PRIORITY=y
|
||||||
# end of Bluetooth controller
|
# end of Bluetooth controller
|
||||||
|
|
||||||
CONFIG_BT_BLUEDROID_ENABLED=y
|
CONFIG_BT_BLUEDROID_ENABLED=y
|
||||||
|
@ -401,6 +416,7 @@ CONFIG_BT_ACL_CONNECTIONS=4
|
||||||
# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set
|
# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set
|
||||||
# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set
|
# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set
|
||||||
CONFIG_BT_SMP_ENABLE=y
|
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_BLE_ESTAB_LINK_CONN_TOUT=30
|
||||||
CONFIG_BT_RESERVE_DRAM=0xdb5c
|
CONFIG_BT_RESERVE_DRAM=0xdb5c
|
||||||
# end of Bluedroid Options
|
# end of Bluedroid Options
|
||||||
|
@ -1221,17 +1237,29 @@ CONFIG_DISABLE_GCC8_WARNINGS=y
|
||||||
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_BTDM_CONTROLLER_MODE_BLE_ONLY is not set
|
# CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY is not set
|
||||||
CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=y
|
# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set
|
||||||
# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set
|
CONFIG_BTDM_CONTROLLER_MODE_BTDM=y
|
||||||
|
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=2
|
||||||
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2
|
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2
|
||||||
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0
|
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0
|
||||||
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=0
|
CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=2
|
||||||
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2
|
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2
|
||||||
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0
|
CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0
|
||||||
CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0
|
CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0
|
||||||
CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y
|
CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y
|
||||||
# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set
|
# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set
|
||||||
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y
|
CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y
|
||||||
|
CONFIG_BLE_SCAN_DUPLICATE=y
|
||||||
|
CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y
|
||||||
|
# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA is not set
|
||||||
|
# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR is not set
|
||||||
|
CONFIG_SCAN_DUPLICATE_TYPE=0
|
||||||
|
CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200
|
||||||
|
# CONFIG_BLE_MESH_SCAN_DUPLICATE_EN is not set
|
||||||
|
CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y
|
||||||
|
CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y
|
||||||
|
CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100
|
||||||
|
CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
|
||||||
CONFIG_BLUEDROID_ENABLED=y
|
CONFIG_BLUEDROID_ENABLED=y
|
||||||
# CONFIG_NIMBLE_ENABLED is not set
|
# CONFIG_NIMBLE_ENABLED is not set
|
||||||
CONFIG_BTC_TASK_STACK_SIZE=3072
|
CONFIG_BTC_TASK_STACK_SIZE=3072
|
||||||
|
@ -1412,6 +1440,7 @@ CONFIG_BLUFI_TRACE_LEVEL_WARNING=y
|
||||||
CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2
|
CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2
|
||||||
# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set
|
# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set
|
||||||
CONFIG_SMP_ENABLE=y
|
CONFIG_SMP_ENABLE=y
|
||||||
|
# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set
|
||||||
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30
|
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30
|
||||||
CONFIG_ADC2_DISABLE_DAC=y
|
CONFIG_ADC2_DISABLE_DAC=y
|
||||||
# CONFIG_SPIRAM_SUPPORT is not set
|
# CONFIG_SPIRAM_SUPPORT is not set
|
||||||
|
|
Ładowanie…
Reference in New Issue