Skip to content

Commit 7bd29fe

Browse files
committed
Update to ESP-IDF v5.2.1
1 parent 074749e commit 7bd29fe

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: ESP-IDF Build
2222
uses: espressif/[email protected]
2323
with:
24-
esp_idf_version: v5.0
24+
esp_idf_version: v5.2.1
2525
command: idf.py image
2626

2727
- name: Upload Application Image

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ execute_process(
55
OUTPUT_VARIABLE PROJECT_VER
66
OUTPUT_STRIP_TRAILING_WHITESPACE)
77
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
8-
add_compile_definitions(BTA_GATTC_NOTIF_REG_MAX=32)
98

109
project(ble2mqtt)
1110

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This project is a BLE to MQTT bridge, i.e. it exposes BLE GATT characteristics
44
as MQTT topics for bidirectional communication. It's developed for the ESP32 SoC
5-
and is based on [ESP-IDF](https://github.com/espressif/esp-idf) release v5.0.
5+
and is based on [ESP-IDF](https://github.com/espressif/esp-idf) release v5.2.1.
66
Note that using any other ESP-IDF version might not be stable or even compile.
77

88
For example, if a device with a MAC address of `a0:e6:f8:50:72:53` exposes the

main/ble.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,8 @@ int ble_initialize(void)
10251025
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
10261026
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
10271027
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
1028-
ESP_ERROR_CHECK(esp_bluedroid_init());
1028+
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
1029+
ESP_ERROR_CHECK(esp_bluedroid_init_with_cfg(&bluedroid_cfg));
10291030
ESP_ERROR_CHECK(esp_bluedroid_enable());
10301031
ESP_ERROR_CHECK(esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT,
10311032
ESP_PWR_LVL_P9));

main/mqtt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int mqtt_subscribe(const char *topic, int qos, mqtt_on_message_received_cb_t cb,
162162
return -1;
163163

164164
ESP_LOGD(TAG, "Subscribing to %s", topic);
165-
if (esp_mqtt_client_subscribe(mqtt_handle, topic, qos) < 0)
165+
if (esp_mqtt_client_subscribe_single(mqtt_handle, topic, qos) < 0)
166166
{
167167
ESP_LOGE(TAG, "Failed subscribing to %s", topic);
168168
return -1;

main/wifi.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "wifi.h"
2+
#include <esp_eap_client.h>
23
#include <esp_err.h>
34
#include <esp_event.h>
45
#include <esp_log.h>
56
#include <esp_wifi.h>
6-
#include <esp_wpa2.h>
77
#include <arpa/inet.h>
88
#include <inttypes.h>
99
#include <string.h>
@@ -156,36 +156,37 @@ int wifi_connect(const char *ssid, const char *password,
156156
{
157157
if (ca_cert)
158158
{
159-
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_cert,
159+
ESP_ERROR_CHECK(esp_eap_client_set_ca_cert((uint8_t *)ca_cert,
160160
strlen(ca_cert)));
161161
}
162162
if (client_cert)
163163
{
164-
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_cert,
165-
strlen(client_cert), (uint8_t *)client_key,
166-
client_key ? strlen(client_key) : 0, NULL, 0));
164+
ESP_ERROR_CHECK(esp_eap_client_set_certificate_and_key(
165+
(uint8_t *)client_cert, strlen(client_cert),
166+
(uint8_t *)client_key, client_key ? strlen(client_key) : 0,
167+
NULL, 0));
167168
}
168169
if (eap_identity)
169170
{
170-
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)eap_identity,
171+
ESP_ERROR_CHECK(esp_eap_client_set_identity((uint8_t *)eap_identity,
171172
strlen(eap_identity)));
172173
}
173174
if (eap_method == EAP_PEAP || eap_method == EAP_TTLS)
174175
{
175176
if (eap_username || eap_password)
176177
{
177-
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_username((uint8_t *)eap_username,
178-
strlen(eap_username)));
179-
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_password((uint8_t *)eap_password,
180-
strlen(eap_password)));
178+
ESP_ERROR_CHECK(esp_eap_client_set_username(
179+
(uint8_t *)eap_username, strlen(eap_username)));
180+
ESP_ERROR_CHECK(esp_eap_client_set_password(
181+
(uint8_t *)eap_password, strlen(eap_password)));
181182
}
182183
else
183184
{
184185
ESP_LOGE(TAG, "Username and password are required for "
185186
"Tunneled TLS or Protected EAP");
186187
}
187188
}
188-
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_enable());
189+
ESP_ERROR_CHECK(esp_wifi_sta_enterprise_enable());
189190
}
190191
ESP_LOGI(TAG, "Connecting to SSID %s", wifi_config.sta.ssid);
191192
ESP_ERROR_CHECK(esp_wifi_start());

sdkconfig.defaults

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CONFIG_COMPILER_OPTIMIZATION_SIZE=y
77
CONFIG_BT_ENABLED=y
88
# CONFIG_BT_GATTS_ENABLE is not set
99
CONFIG_BT_GATTC_MAX_CACHE_CHAR=100
10+
CONFIG_BT_GATTC_NOTIF_REG_MAX=32
1011
CONFIG_BT_ACL_CONNECTIONS=7
1112
CONFIG_BTDM_CTRL_BLE_MAX_CONN=9
1213
# CONFIG_BTDM_BLE_SCAN_DUPL is not set

0 commit comments

Comments
 (0)