When I call the function after connecting to the thread network I get a NoBufs error:
openthread_context *threadContext = openthread_get_default_context();
error = otSetStateChangedCallback(gInstance, HandleThreadStateChanged, threadContext);
if (error != OT_ERROR_NONE) {
LOG_ERR("Failed to set state changed callback: %s", otThreadErrorToString(error));
return;
}My handler:
void HandleThreadStateChanged(otChangedFlags flags, void *context)
{
if (flags & OT_CHANGED_THREAD_ROLE)
{
otDeviceRole role = otThreadGetDeviceRole(static_cast<otInstance *>(context));
LOG_INF("Thread role changed: %d", role);
switch (role)
{
case OT_DEVICE_ROLE_DISABLED:
LOG_INF("Thread network is disabled");
break;
case OT_DEVICE_ROLE_DETACHED:
LOG_INF("Thread network is detached");
break;
case OT_DEVICE_ROLE_CHILD:
LOG_INF("Thread network is connected as a child");
break;
case OT_DEVICE_ROLE_ROUTER:
LOG_INF("Thread network is connected as a router");
break;
case OT_DEVICE_ROLE_LEADER:
LOG_INF("Thread network is connected as a leader");
break;
default:
LOG_INF("Unknown Thread role");
break;
}
}
}I'm using an nrf52840-DK and am guessing that it needs more resources, does anyone know which configs to update?