arduino-home-assistant
arduino-home-assistant copied to clipboard
Add support for std::function on the ESP devices
Hi! Merry Christmas and Happy New Year!
This PR adds conditional compilation flow for ESP32/ESP8266 platforms to allow using the std::function as a command callback.
I hope I've found all the places. But if it's not true — please point me and I'll update the missing places.
This closes #143.
Jentle ping @dawidchyrzynski .... WDYT?
Hi @KSDaemon, Thank you for your contribution. I'll review it shortly. Have you tested backward compatibility?
Hi @dawidchyrzynski ! Great to hear from you! Yeah... Indeed, the original proposed changes were not backward compatible! My bad and laziness. But I absolutely agree with you, it's a library not client-side code, so we should preserve backward compatibility whenever it is possible for the sake of DX. So I updated the PR and made it backward compatible: now, on ESP* platforms, it would be possible to use any callbacks (pointers to void() or any std::functions-compatible things), while using only pointers to void() on other platforms.
Jentle ping @dawidchyrzynski
Way more jentle ping @dawidchyrzynski :)
I’ll merge it into develop since I need to implement a few improvements to this logic. I plan to release it next week.
Sure! Thank you for merging!