Skip to content

Commit

Permalink
samples: tutorial: Fix global context
Browse files Browse the repository at this point in the history
Signed-off-by: Gerson Fernando Budke <[email protected]>
  • Loading branch information
nandojve authored and otavio committed Nov 19, 2024
1 parent 6165cee commit 2bc3b22
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ zephyrbt_action_init_tree_init(struct zephyrbt_context *ctx,
struct tutorial_context *global_ctx;

global_ctx = k_malloc(sizeof(struct tutorial_context));
self->ctx = global_ctx;
ctx->user_data = global_ctx;

if (global_ctx == NULL) {
LOG_ERR("Context can not be allocate. Need more memory!!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ zephyrbt_action_init_tree_init(struct zephyrbt_context *ctx,
struct tutorial_context *global_ctx;

global_ctx = k_malloc(sizeof(struct tutorial_context));
self->ctx = global_ctx;
ctx->user_data = global_ctx;

if (global_ctx == NULL) {
LOG_ERR("Context can not be allocate. Need more memory!!");
Expand Down
1 change: 1 addition & 0 deletions samples/subsys/zephyrbt/tutorial/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CONFIG_ZEPHYR_BEHAVIOUR_TREE_DYNAMIC=y
CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INFO=y
CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_INIT=y
CONFIG_ZEPHYR_BEHAVIOUR_TREE_NODE_CONTEXT=y
CONFIG_ZEPHYR_BEHAVIOUR_TREE_USER_DATA=y
CONFIG_ZEPHYR_BEHAVIOUR_TREE_LOG_LEVEL_DBG=y

CONFIG_DYNAMIC_THREAD=y
Expand Down

0 comments on commit 2bc3b22

Please sign in to comment.