2525#define CONFIG_BACNET_BASIC_SERVER_STACK_SIZE 8192
2626#endif
2727
28- #ifndef CONFIG_BACNET_BASIC_SERVER_PRIORITY
29- #define CONFIG_BACNET_BASIC_SERVER_PRIORITY 10
28+ /* note: init runs in main thread with sub-priority of 0..99 */
29+ #ifndef CONFIG_BACNET_BASIC_SERVER_INIT_PRIORITY
30+ #define CONFIG_BACNET_BASIC_SERVER_INIT_PRIORITY 50
3031#endif
3132
32- #ifndef CONFIG_BACNET_BASIC_SERVER_APP_PRIORITY
33- #define CONFIG_BACNET_BASIC_SERVER_APP_PRIORITY 90
33+ /* note: thread preemptive priority 0..15 */
34+ #ifndef CONFIG_BACNET_BASIC_SERVER_THREAD_PRIORITY
35+ #define CONFIG_BACNET_BASIC_SERVER_THREAD_PRIORITY 10
3436#endif
3537
38+ /* note: sleep time in main loop in milliseconds */
3639#ifndef CONFIG_BACNET_BASIC_SERVER_KSLEEP
3740#define CONFIG_BACNET_BASIC_SERVER_KSLEEP 10
3841#endif
@@ -67,7 +70,7 @@ static void server_thread(void)
6770 LOG_INF ("Server: thread stack=%u bytes" ,
6871 CONFIG_BACNET_BASIC_SERVER_STACK_SIZE );
6972 LOG_INF ("Server: thread priority=%u" ,
70- CONFIG_BACNET_BASIC_SERVER_PRIORITY );
73+ CONFIG_BACNET_BASIC_SERVER_THREAD_PRIORITY );
7174 LOG_INF ("Server: thread sleep=%u milliseconds" ,
7275 CONFIG_BACNET_BASIC_SERVER_KSLEEP );
7376 LOG_INF ("Server: initialized" );
@@ -86,12 +89,12 @@ static int server_init(void)
8689 k_thread_create (& server_thread_data , server_thread_stack ,
8790 K_THREAD_STACK_SIZEOF (server_thread_stack ),
8891 (k_thread_entry_t )server_thread , NULL , NULL , NULL ,
89- K_PRIO_PREEMPT (CONFIG_BACNET_BASIC_SERVER_PRIORITY ), 0 ,
92+ K_PRIO_PREEMPT (CONFIG_BACNET_BASIC_SERVER_THREAD_PRIORITY ), 0 ,
9093 K_NO_WAIT );
9194 k_thread_name_set (& server_thread_data , "bacnet_server" );
9295
9396 return 0 ;
9497}
9598
9699SYS_INIT (server_init , APPLICATION ,
97- CONFIG_BACNET_BASIC_SERVER_APP_PRIORITY );
100+ CONFIG_BACNET_BASIC_SERVER_INIT_PRIORITY );
0 commit comments