Hi,
I have have certain thread that I would like to be active during a ble connection. I can suspend it when not needed and resume when connected. But as long as the thread is running it does no sleeping at all.
But as long as the thread is running, no logging is coming through. And a soon as I disconnect the ble all the data is visible. I am using a RTT console.
As long as I add a small periodic delay (k_sleep) in my thread, I do get the data. So it seems my thread is blocking the log thread. Or am I maybe missing something?
#define TASK_PRIORITY 7
#define TASK_STACKSIZE 1024
static void task(void);
K_THREAD_DEFINE(ble_thread_id, TASK_STACKSIZE, task, NULL, NULL, NULL, TASK_PRIORITY, K_ESSENTIAL, 0);
static void task(void)
{
LOG_INF("Thread started");
/* run forever from this point. */
for (;;)
{
// is a connection active?
if( s_ble_conn == NULL )
{
LOG_INF("Thread suspended");
// no connection active, stop doing anything
k_thread_suspend(ble_thread_id);
LOG_INF("Thread restarted");
}
// more code...
}
}