Closed emrahduruer closed 5 years ago
You’re running out of memory. I see that when pairing starts you have only ~20KB of RAM. Pairing process requires at least 23-24KB (that memory is used only during pairing and will be freed back afterwards. Code -2 during crypto actually means “out of memory”.
Normally with recent ESP8266 you have around 36-38KB of RAM so this is not a provlem, unless you allocate it for your own needs. I suggest postponing your accessory real initialization to when device has paired. You can use homekit_server_config_t.on_event callback and homekit_is_paired() to detect when pairing needs to be done and doing a “light” initialization of your accessory (the one that provides simplified behavior if any at all and does not require allocating a lot of memory).
Thank you. You solved my problem.
hi maxim i have the same error. i have to postponed hardware init or homekit_server_init(&config) when homekit is paired? right? thanks
If you're getting error -2 during pairing process, that means you're running out of memory. You should postpone your other tasks startup to a point after pairing (after pairing you won't need that many memory to run HomeKit server) or use non-task-based solutions (timers/interrupt triggers). You can use homekit event callback to get notified when pairing is added/removed.
Hello,
First time, I am trying to implement with this library. I am having pairing issues. Does anyone experience a similar or the same problem?
Please advice.
`>>> HomeKit: Configuring mDNS