Skip to content

Comments

ESPHome 2022.11.0 compatibility#3

Closed
ashmckenzie wants to merge 1 commit intoWeekendWarrior1:powerpal_blefrom
ashmckenzie:ashmckenzie/esphome-2022-11-0
Closed

ESPHome 2022.11.0 compatibility#3
ashmckenzie wants to merge 1 commit intoWeekendWarrior1:powerpal_blefrom
ashmckenzie:ashmckenzie/esphome-2022-11-0

Conversation

@ashmckenzie
Copy link

What does this implement/fix?

This PR aims to fix compilation issues after I upgraded to use ESPHome 2022.11.0:

--snip---
Compiling .pioenvs/power-pal/src/esphome/components/ble_client/ble_client.cpp.o
Compiling .pioenvs/power-pal/src/esphome/components/powerpal_ble/powerpal_ble.cpp.o
Compiling .pioenvs/power-pal/src/main.cpp.o
In file included from src/esphome/components/ble_client/ble_client.cpp:5:0:
src/esphome/components/ble_client/ble_client.h:89:8: error: conflicting return type specified for 'virtual void esphome::ble_client::BLEClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
   void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
        ^
In file included from src/esphome/components/ble_client/ble_client.cpp:4:0:
src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.h:162:16: error:   overriding 'virtual bool esphome::esp32_ble_tracker::ESPBTClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
   virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
                ^
In file included from src/esphome/components/powerpal_ble/powerpal_ble.h:4:0,
                 from src/esphome/components/powerpal_ble/powerpal_ble.cpp:1:
src/esphome/components/ble_client/ble_client.h:89:8: error: conflicting return type specified for 'virtual void esphome::ble_client::BLEClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
   void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
        ^
In file included from src/esphome/components/ble_client/ble_client.h:5:0,
                 from src/esphome/components/powerpal_ble/powerpal_ble.h:4,
                 from src/esphome/components/powerpal_ble/powerpal_ble.cpp:1:
src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.h:162:16: error:   overriding 'virtual bool esphome::esp32_ble_tracker::ESPBTClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
   virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
                ^
*** [.pioenvs/power-pal/src/esphome/components/powerpal_ble/powerpal_ble.cpp.o] Error 1
*** [.pioenvs/power-pal/src/esphome/components/ble_client/ble_client.cpp.o] Error 1
In file included from src/esphome/components/ble_client/automation.h:4:0,
                 from src/esphome.h:15,
                 from src/main.cpp:3:
src/esphome/components/ble_client/ble_client.h:89:8: error: conflicting return type specified for 'virtual void esphome::ble_client::BLEClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
   void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
        ^
In file included from src/esphome/components/ble_client/ble_client.h:5:0,
                 from src/esphome/components/ble_client/automation.h:4,
                 from src/esphome.h:15,
                 from src/main.cpp:3:
src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.h:162:16: error:   overriding 'virtual bool esphome::esp32_ble_tracker::ESPBTClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
   virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
                ^
*** [.pioenvs/power-pal/src/main.cpp.o] Error 1
--snip--

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@ashmckenzie
Copy link
Author

ashmckenzie commented Nov 17, 2022

@WeekendWarrior1 this is a rather naive fix on my part, but it does compile and appears to work 🙂

@ashmckenzie
Copy link
Author

cc @tathamoddie

@starryalley
Copy link

Looks like I need to fix the return type mismatch in more places. I'm on 2022.11.3. This compiles for me:
https://github.com/starryalley/esphome/commits/powerpal_ble_fix_compile_error

@compacthack
Copy link

Hi Guys, just checking if there was any updates on the fail to compile issue since 2022.11.0 ? Bad timing for me I got my Powerpal a couple of weeks ago with plans to integrate into HA, I'm not much of a coder but I've tried using @starryalley version of powerpal_ble & ble_client and compiling as a local source and it still fails when it gets to [.pioenvs/powerpal/src/esphome/components/ble_client/automation.cpp.o] and [.pioenvs/powerpal/src/esphome/components/ble_client/ble_client.cpp.o]

There is a good chance that I'm not doing something right !, but it comes back with these.

virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^
virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^

@johnmacfadyen
Copy link

Looks like I need to fix the return type mismatch in more places. I'm on 2022.11.3. This compiles for me: https://github.com/starryalley/esphome/commits/powerpal_ble_fix_compile_error

Cheers, this has worked for me too.

@ashmckenzie ashmckenzie closed this Jul 3, 2023
@ashmckenzie
Copy link
Author

This fix and a separate fix for 2023.5.5 has been created in #6

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.

4 participants