arduino-home-assistant icon indicating copy to clipboard operation
arduino-home-assistant copied to clipboard

Add support for std::function on the ESP devices

Open KSDaemon opened this issue 10 months ago • 4 comments
trafficstars

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.

KSDaemon avatar Dec 29 '24 21:12 KSDaemon

Jentle ping @dawidchyrzynski .... WDYT?

KSDaemon avatar Jan 06 '25 09:01 KSDaemon

Hi @KSDaemon, Thank you for your contribution. I'll review it shortly. Have you tested backward compatibility?

dawidchyrzynski avatar Jan 18 '25 16:01 dawidchyrzynski

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.

KSDaemon avatar Jan 19 '25 13:01 KSDaemon

Jentle ping @dawidchyrzynski

KSDaemon avatar Feb 11 '25 18:02 KSDaemon

Way more jentle ping @dawidchyrzynski :)

KSDaemon avatar Jul 04 '25 18:07 KSDaemon

I’ll merge it into develop since I need to implement a few improvements to this logic. I plan to release it next week.

dawidchyrzynski avatar Jul 06 '25 11:07 dawidchyrzynski

Sure! Thank you for merging!

KSDaemon avatar Jul 06 '25 19:07 KSDaemon