maximkulkin / esp-homekit-demo

Demo of Apple HomeKit accessory server library
MIT License
809 stars 233 forks source link

Add example for irrigation system #251

Open buschco opened 4 years ago

buschco commented 4 years ago

Hey I did my best to implement an irrigation homekit service. It is similar to the dynamic_services example. Feedback is welcome 🙂

buschco commented 4 years ago

I improved some points you mentioned.

buschco commented 4 years ago

Over the last weeks I improved my code a lot. As far I can see these points are not fixed right now:

1. Pre-cache characteristics

Or even pre-cache it inside gate structure for improved performance.

I don't quite understand how to implement this.

2. Use vTaskGetInfo() instead of storing task state in a variable

I use task_running to determine if the task is suspended or running. I saw vTaskGetInfo() in the freertos docs, but the compiler warned me: type undefined reference to vTaskGetInfo

3. Create characteristics first

How about saving some CPU cycles and creating characteristics first.

I don't quite understand how to implement this.

4. Use valve_count instead of hard coding array length

This might be a no-brainer but I am quite lost at this one 🙈