Skip to content

Commit

Permalink
Update to ESP-IDF v5.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuelzon committed Apr 20, 2024
1 parent 074749e commit 7bd29fe
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: ESP-IDF Build
uses: espressif/[email protected]
with:
esp_idf_version: v5.0
esp_idf_version: v5.2.1
command: idf.py image

- name: Upload Application Image
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ execute_process(
OUTPUT_VARIABLE PROJECT_VER
OUTPUT_STRIP_TRAILING_WHITESPACE)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
add_compile_definitions(BTA_GATTC_NOTIF_REG_MAX=32)

project(ble2mqtt)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

For example, if a device with a MAC address of `a0:e6:f8:50:72:53` exposes the
Expand Down
3 changes: 2 additions & 1 deletion main/ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,8 @@ int ble_initialize(void)
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
ESP_ERROR_CHECK(esp_bluedroid_init());
esp_bluedroid_config_t bluedroid_cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_bluedroid_init_with_cfg(&bluedroid_cfg));
ESP_ERROR_CHECK(esp_bluedroid_enable());
ESP_ERROR_CHECK(esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT,
ESP_PWR_LVL_P9));
Expand Down
2 changes: 1 addition & 1 deletion main/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int mqtt_subscribe(const char *topic, int qos, mqtt_on_message_received_cb_t cb,
return -1;

ESP_LOGD(TAG, "Subscribing to %s", topic);
if (esp_mqtt_client_subscribe(mqtt_handle, topic, qos) < 0)
if (esp_mqtt_client_subscribe_single(mqtt_handle, topic, qos) < 0)
{
ESP_LOGE(TAG, "Failed subscribing to %s", topic);
return -1;
Expand Down
23 changes: 12 additions & 11 deletions main/wifi.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "wifi.h"
#include <esp_eap_client.h>
#include <esp_err.h>
#include <esp_event.h>
#include <esp_log.h>
#include <esp_wifi.h>
#include <esp_wpa2.h>
#include <arpa/inet.h>
#include <inttypes.h>
#include <string.h>
Expand Down Expand Up @@ -156,36 +156,37 @@ int wifi_connect(const char *ssid, const char *password,
{
if (ca_cert)
{
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_cert,
ESP_ERROR_CHECK(esp_eap_client_set_ca_cert((uint8_t *)ca_cert,
strlen(ca_cert)));
}
if (client_cert)
{
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_cert,
strlen(client_cert), (uint8_t *)client_key,
client_key ? strlen(client_key) : 0, NULL, 0));
ESP_ERROR_CHECK(esp_eap_client_set_certificate_and_key(
(uint8_t *)client_cert, strlen(client_cert),
(uint8_t *)client_key, client_key ? strlen(client_key) : 0,
NULL, 0));
}
if (eap_identity)
{
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)eap_identity,
ESP_ERROR_CHECK(esp_eap_client_set_identity((uint8_t *)eap_identity,
strlen(eap_identity)));
}
if (eap_method == EAP_PEAP || eap_method == EAP_TTLS)
{
if (eap_username || eap_password)
{
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_username((uint8_t *)eap_username,
strlen(eap_username)));
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_password((uint8_t *)eap_password,
strlen(eap_password)));
ESP_ERROR_CHECK(esp_eap_client_set_username(
(uint8_t *)eap_username, strlen(eap_username)));
ESP_ERROR_CHECK(esp_eap_client_set_password(
(uint8_t *)eap_password, strlen(eap_password)));
}
else
{
ESP_LOGE(TAG, "Username and password are required for "
"Tunneled TLS or Protected EAP");
}
}
ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_enable());
ESP_ERROR_CHECK(esp_wifi_sta_enterprise_enable());
}
ESP_LOGI(TAG, "Connecting to SSID %s", wifi_config.sta.ssid);
ESP_ERROR_CHECK(esp_wifi_start());
Expand Down
1 change: 1 addition & 0 deletions sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_BT_ENABLED=y
# CONFIG_BT_GATTS_ENABLE is not set
CONFIG_BT_GATTC_MAX_CACHE_CHAR=100
CONFIG_BT_GATTC_NOTIF_REG_MAX=32
CONFIG_BT_ACL_CONNECTIONS=7
CONFIG_BTDM_CTRL_BLE_MAX_CONN=9
# CONFIG_BTDM_BLE_SCAN_DUPL is not set
Expand Down

0 comments on commit 7bd29fe

Please sign in to comment.