Skip to content

Fix deprecated ESP-IDF API calls for v5.4 compatibility#60

Merged
albal merged 5 commits intomainfrom
copilot/fix-59
Jul 8, 2025
Merged

Fix deprecated ESP-IDF API calls for v5.4 compatibility#60
albal merged 5 commits intomainfrom
copilot/fix-59

Conversation

Copy link
Contributor

Copilot AI commented Jul 7, 2025

This PR fixes build warnings caused by deprecated API calls when using ESP-IDF v5.4. Two deprecated functions have been replaced with their modern equivalents:

Changes Made

1. Replace esp_log_buffer_hex() with ESP_LOG_BUFFER_HEX() macro

Location: main/main.c:299 in esp_bt_gap_cb() function

// Before (deprecated)
esp_log_buffer_hex(TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);

// After (modern API)
ESP_LOG_BUFFER_HEX(TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);

2. Replace esp_bt_dev_set_device_name() with esp_bt_gap_set_device_name()

Location: main/main.c:1359 in app_main() function

// Before (deprecated)
esp_bt_dev_set_device_name(device_name);

// After (recommended API)
esp_bt_gap_set_device_name(device_name);

Build Warnings Fixed

This resolves the following compiler warnings:

warning: 'esp_log_buffer_hex' is deprecated: Use 'ESP_LOG_BUFFER_HEX' instead [-Wdeprecated-declarations]
warning: 'esp_bt_dev_set_device_name' is deprecated: Please use esp_bt_gap_set_device_name or esp_ble_gap_set_device_name [-Wdeprecated-declarations]

Impact

  • Functionality preserved: Both replacements maintain identical behavior
  • Forward compatibility: Code now uses modern ESP-IDF v5.4+ APIs
  • Minimal changes: Only 2 lines modified, no functional changes
  • Build clean: Eliminates deprecation warnings in latest ESP-IDF

The changes are minimal and surgical, ensuring compatibility with newer ESP-IDF versions while maintaining all existing functionality.

Fixes #59.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

- Replace esp_log_buffer_hex() with ESP_LOG_BUFFER_HEX() macro
- Replace esp_bt_dev_set_device_name() with esp_bt_gap_set_device_name()

Co-authored-by: albal <2963080+albal@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix deprecated calls in v5.4 build Fix deprecated ESP-IDF API calls for v5.4 compatibility Jul 7, 2025
Copilot AI requested a review from albal July 7, 2025 23:39
Copilot finished work on behalf of albal July 7, 2025 23:39
@albal albal marked this pull request as ready for review July 8, 2025 00:24
Copy link
Owner

@albal albal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@albal albal merged commit d5c2481 into main Jul 8, 2025
2 checks passed
@albal albal deleted the copilot/fix-59 branch July 8, 2025 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix deprecated calls in v5.4 build

2 participants