From e3e12a1146eb462b535ac472252d7e0631c3ea14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20S=2E=20R=C3=B8stad?= Date: Mon, 3 Jun 2024 09:18:13 +0200 Subject: [PATCH] modules: Handle desired configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle desired configurations set in the shadow: - Add cddl schema for configurations set in the shadow - Add configuration channel that interested modules can subscribe to - Enable PWM and set RGB values according to the shadow configurations - Update trigger module to only use system workqueue, this is ok since we are not blocking the system workqueue for long periods of time and its simplifies the module quite a bit. - The trigger will only run as long as we are connected. Missing: - Adopting gnss enable. This depends on GNSS being sent internally from the location module. Signed-off-by: Simen S. Røstad --- app/prj.conf | 7 +- app/src/common/message_channel.c | 8 +- app/src/common/message_channel.h | 11 +- app/src/modules/app/CMakeLists.txt | 27 +++++ app/src/modules/app/Kconfig.app | 2 +- app/src/modules/app/app.c | 117 +++++++++++++------- app/src/modules/app/app_object.cddl | 41 +++++++ app/src/modules/led/led.c | 59 +++++++++- app/src/modules/transport/Kconfig.transport | 1 - app/src/modules/transport/transport.c | 5 +- app/src/modules/trigger/Kconfig.trigger | 12 +- app/src/modules/trigger/trigger.c | 83 +++++++------- lib/simple_config/simple_config.c | 2 +- tests/lib/simple_config/src/main.c | 2 +- tests/module/environmental/src/main.c | 3 + west.yml | 2 +- 16 files changed, 264 insertions(+), 118 deletions(-) create mode 100644 app/src/modules/app/app_object.cddl diff --git a/app/prj.conf b/app/prj.conf index b1e0d1b9..d728e51d 100644 --- a/app/prj.conf +++ b/app/prj.conf @@ -6,6 +6,8 @@ CONFIG_NCS_SAMPLES_DEFAULTS=y CONFIG_RESET_ON_FATAL_ERROR=y +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y # Heap and stacks # Extended AT host/monitor stack/heap sizes since some nrf_cloud credentials are longer than 1024 bytes. @@ -105,11 +107,6 @@ CONFIG_NRF_CLOUD_COAP_SEC_TAG=4242 #Required if device is provisioned to nRF Cloud using attestation token #CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y -CONFIG_SIMPLE_CONFIG=y -CONFIG_DK_LIBRARY=y - -CONFIG_SIMPLE_CONFIG_LOG_LEVEL_DBG=y - # needed for processing floats CONFIG_PICOLIBC=y CONFIG_FPU=y diff --git a/app/src/common/message_channel.c b/app/src/common/message_channel.c index 34d32fc0..af333bc6 100644 --- a/app/src/common/message_channel.c +++ b/app/src/common/message_channel.c @@ -50,11 +50,11 @@ ZBUS_CHAN_DEFINE(FATAL_ERROR_CHAN, ZBUS_MSG_INIT(0) ); -ZBUS_CHAN_DEFINE(LED_CHAN, - int, +ZBUS_CHAN_DEFINE(CONFIG_CHAN, + struct configuration, NULL, NULL, - ZBUS_OBSERVERS(led), + ZBUS_OBSERVERS(led, trigger), ZBUS_MSG_INIT(0) ); @@ -62,6 +62,6 @@ ZBUS_CHAN_DEFINE(CLOUD_CHAN, enum cloud_status, NULL, NULL, - ZBUS_OBSERVERS(fota, app, location), + ZBUS_OBSERVERS(fota, app, location, trigger), CLOUD_DISCONNECTED ); diff --git a/app/src/common/message_channel.h b/app/src/common/message_channel.h index e04440f6..1b842dcf 100644 --- a/app/src/common/message_channel.h +++ b/app/src/common/message_channel.h @@ -42,6 +42,14 @@ enum cloud_status { CLOUD_DISCONNECTED, }; +struct configuration { + int led_red; + int led_green; + int led_blue; + bool gnss; + uint64_t update_interval; +}; + ZBUS_CHAN_DECLARE( TRIGGER_CHAN, PAYLOAD_CHAN, @@ -49,7 +57,8 @@ ZBUS_CHAN_DECLARE( FATAL_ERROR_CHAN, LED_CHAN, CLOUD_CHAN, - FOTA_ONGOING_CHAN + FOTA_ONGOING_CHAN, + CONFIG_CHAN ); #ifdef __cplusplus diff --git a/app/src/modules/app/CMakeLists.txt b/app/src/modules/app/CMakeLists.txt index 969d8d82..eed9fbf8 100644 --- a/app/src/modules/app/CMakeLists.txt +++ b/app/src/modules/app/CMakeLists.txt @@ -5,3 +5,30 @@ # target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/app.c) + +# generate encoder code using zcbor +set(zcbor_command + zcbor code # Invoke code generation + --cddl ${ZEPHYR_BASE}/subsys/net/lib/lwm2m/lwm2m_senml_cbor.cddl + --cddl ${CMAKE_CURRENT_SOURCE_DIR}/app_object.cddl + --decode # Generate decoding functions + --short-names # Attempt to make generated symbol names shorter (at the risk of collision) + -t app-object # Create a public API for decoding the "app_object" type from the cddl file + --output-cmake ${CMAKE_CURRENT_BINARY_DIR}/app_object.cmake # The generated cmake file will be placed here +) +execute_process(COMMAND ${zcbor_command} COMMAND_ERROR_IS_FATAL ANY) + +# Include the cmake file generated by zcbor. It adds the +# generated code and the necessary zcbor C code files. +include(${CMAKE_CURRENT_BINARY_DIR}/app_object.cmake) + +# Ensure that the cmake reconfiguration is triggerred everytime the cddl file changes. +# This ensures that the codec generation is triggered. +set_property( + DIRECTORY + PROPERTY + CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/app_object.cddl +) + +zephyr_link_libraries(app_object) +target_link_libraries(app_object PRIVATE zephyr_interface) diff --git a/app/src/modules/app/Kconfig.app b/app/src/modules/app/Kconfig.app index ebfb5c66..d7bd9a4d 100644 --- a/app/src/modules/app/Kconfig.app +++ b/app/src/modules/app/Kconfig.app @@ -6,7 +6,7 @@ menu "App" config APP_MODULE_THREAD_STACK_SIZE int "Thread stack size" - default 4096 + default 8192 config APP_MODULE_MESSAGE_QUEUE_SIZE int "Message queue size" diff --git a/app/src/modules/app/app.c b/app/src/modules/app/app.c index 84d38942..50f42134 100644 --- a/app/src/modules/app/app.c +++ b/app/src/modules/app/app.c @@ -7,10 +7,12 @@ #include #include #include -#include #include +#include +#include #include "message_channel.h" +#include "app_object_decode.h" /* change this to config object and add led object here */ /* Register log module */ LOG_MODULE_REGISTER(app, CONFIG_APP_LOG_LEVEL); @@ -21,45 +23,86 @@ ZBUS_SUBSCRIBER_DEFINE(app, CONFIG_APP_MODULE_MESSAGE_QUEUE_SIZE); BUILD_ASSERT(CONFIG_APP_MODULE_WATCHDOG_TIMEOUT_SECONDS > CONFIG_APP_MODULE_EXEC_TIME_SECONDS_MAX, "Watchdog timeout must be greater than maximum execution time"); -int config_cb(const char *key, const struct simple_config_val *val) +static void shadow_get(bool get_desired) { int err; - - if (val->type == SIMPLE_CONFIG_VAL_STRING) { - LOG_DBG("\"%s\" = %s", key, val->val._str); - } else if (val->type == SIMPLE_CONFIG_VAL_BOOL) { - LOG_DBG("\"%s\" = %s", key, val->val._bool ? "true" : "false"); - } else if (val->type == SIMPLE_CONFIG_VAL_DOUBLE) { - LOG_DBG("\"%s\" = %f", key, val->val._double); - } else { - return -EINVAL; + struct app_object app_object = { 0 }; + uint8_t buf_cbor[512] = { 0 }; + uint8_t buf_json[512] = { 0 }; + size_t buf_cbor_len = sizeof(buf_cbor); + size_t buf_json_len = sizeof(buf_json); + size_t not_used; + + /* Request shadow delta, request only changes by setting delta parameter to true. */ + err = nrf_cloud_coap_shadow_get(buf_json, &buf_json_len, !get_desired, + COAP_CONTENT_FORMAT_APP_JSON); + if (err == -EACCES) { + LOG_WRN("Not connected"); + return; + } else if (err) { + LOG_ERR("Failed to request shadow delta: %d", err); + SEND_FATAL_ERROR(); + return; } - if (strcmp(key, "led_blue") == 0) { - int status = val->val._bool; - - err = zbus_chan_pub(&LED_CHAN, &status, K_NO_WAIT); - if (err) { - LOG_ERR("zbus_chan_pub, error:%d", err); - SEND_FATAL_ERROR(); - return err; - } + if (buf_json_len == 0 || strlen(buf_json) == 0) { + LOG_WRN("No shadow delta changes available"); + return; + } - return 0; + /* Shadow available, fetch CBOR encoded desired section. */ + err = nrf_cloud_coap_shadow_get(buf_cbor, &buf_cbor_len, false, + COAP_CONTENT_FORMAT_APP_CBOR); + if (err == -EACCES) { + LOG_WRN("Not connected"); + return; + } else if (err) { + LOG_ERR("Failed to request shadow delta: %d", err); + SEND_FATAL_ERROR(); + return; } - return -EINVAL; -} + err = cbor_decode_app_object(buf_cbor, buf_cbor_len, &app_object, ¬_used); + if (err) { + LOG_ERR("Failed to decode app object, error: %d", err); + SEND_FATAL_ERROR(); + return; + } -static void init_app_settings(void) -{ - struct simple_config_val val = {.type = SIMPLE_CONFIG_VAL_BOOL, .val._bool = true}; - int err = simple_config_set("blue_led", &val); + struct configuration configuration = { + .led_red = app_object.lwm2m._1424010._0._0, + .led_green = app_object.lwm2m._1424010._0._1, + .led_blue = app_object.lwm2m._1424010._0._2, + .gnss = app_object.lwm2m._1430110._0._1, + .update_interval = app_object.lwm2m._1430110._0._0, + }; + + LOG_DBG("LED object (1424010) values received from cloud:"); + LOG_DBG("R: %d", app_object.lwm2m._1424010._0._0); + LOG_DBG("G: %d", app_object.lwm2m._1424010._0._1); + LOG_DBG("B: %d", app_object.lwm2m._1424010._0._2); + LOG_DBG("Timestamp: %lld", app_object.lwm2m._1424010._0._99); + + LOG_DBG("Application configuration object (1430110) values received from cloud:"); + LOG_DBG("Update interval: %lld", app_object.lwm2m._1430110._0._0); + LOG_DBG("GNSS: %d", app_object.lwm2m._1430110._0._1); + LOG_DBG("Timestamp: %lld", app_object.lwm2m._1430110._0._99); + + /* Distribute configuration */ + err = zbus_chan_pub(&CONFIG_CHAN, &configuration, K_SECONDS(1)); if (err) { - LOG_ERR("simple_config_set, error: %d", err); + LOG_ERR("zbus_chan_pub, error: %d", err); SEND_FATAL_ERROR(); return; } + + /* Send the received configuration back to the reported shadow section. */ + err = nrf_cloud_coap_shadow_state_update(buf_json); + if (err < 0) { + LOG_ERR("Failed to send PATCH request: %d", err); + } else if (err > 0) { + LOG_ERR("Error from server: %d", err); + } } static void task_wdt_callback(int channel_id, void *user_data) @@ -84,12 +127,6 @@ static void app_task(void) task_wdt_id = task_wdt_add(wdt_timeout_ms, task_wdt_callback, (void *)k_current_get()); - /* Set up callback for runtime config changes from cloud */ - simple_config_set_callback(config_cb); - - /* Set initial settting values (can be skipped if cloud initializes shadow) */ - init_app_settings(); - while (true) { err = task_wdt_feed(task_wdt_id); if (err) { @@ -118,19 +155,15 @@ static void app_task(void) } if (cloud_status == CLOUD_CONNECTED) { - LOG_INF("Cloud connected"); - LOG_INF("Getting latest device configuration from cloud"); + LOG_DBG("Cloud connected"); + LOG_DBG("Getting latest device configuration from device shadow"); - simple_config_update(); - } else { - LOG_INF("Cloud disconnected"); + shadow_get(true); } } if ((&TRIGGER_CHAN == chan) && (cloud_status == CLOUD_CONNECTED)) { - LOG_INF("Getting latest device configuration from cloud"); - - simple_config_update(); + shadow_get(false); } } } diff --git a/app/src/modules/app/app_object.cddl b/app/src/modules/app/app_object.cddl new file mode 100644 index 00000000..ae7aa4a2 --- /dev/null +++ b/app/src/modules/app/app_object.cddl @@ -0,0 +1,41 @@ +; Define the basic structure of the JSON object +app-object = { + "nrfcloud_mqtt_topic_prefix": tstr, + "pairing": pairing-type, + "lwm2m": lwm2m-map +} + +; Define the pairing object with nested topics +pairing-type = { + "state": tstr, + "topics": { + "d2c": tstr, + "c2d": tstr + } +} + +lwm2m-map = { + "14240:1.0": led, + "14301:1.0": config +} + +led = { + "0": lwm2m_inner_object_1 +} + +lwm2m_inner_object_1 = { + "0": int .size 4, + "1": int .size 4, + "2": int .size 4, + "99": int .size 8 +} + +config = { + "0": lwm2m_inner_object +} + +lwm2m_inner_object = { + "0": int .size 8, + "1": bool, + "99": int .size 8 +} diff --git a/app/src/modules/led/led.c b/app/src/modules/led/led.c index 3bba725a..22ae3e13 100644 --- a/app/src/modules/led/led.c +++ b/app/src/modules/led/led.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include "message_channel.h" @@ -14,19 +16,64 @@ /* Register log module */ LOG_MODULE_REGISTER(led, CONFIG_APP_LED_LOG_LEVEL); +#define PWM_LED0_NODE DT_ALIAS(pwm_led0) +#define PWM_LED1_NODE DT_ALIAS(pwm_led1) +#define PWM_LED2_NODE DT_ALIAS(pwm_led2) + +#if DT_NODE_HAS_STATUS(PWM_LED0_NODE, okay) +static const struct pwm_dt_spec led0 = PWM_DT_SPEC_GET(PWM_LED0_NODE); +#else +#error "Unsupported board: pwm-led 0 devicetree alias is not defined" +#endif +#if DT_NODE_HAS_STATUS(PWM_LED1_NODE, okay) +static const struct pwm_dt_spec led1 = PWM_DT_SPEC_GET(PWM_LED1_NODE); +#else +#error "Unsupported board: pwm-led 1 devicetree alias is not defined" +#endif +#if DT_NODE_HAS_STATUS(PWM_LED2_NODE, okay) +static const struct pwm_dt_spec led2 = PWM_DT_SPEC_GET(PWM_LED2_NODE); +#else +#error "Unsupported board: pwm-led 2 devicetree alias is not defined" +#endif + +#define PWM_PERIOD 20000U +#define LIGHTNESS_MAX UINT8_MAX + void led_callback(const struct zbus_channel *chan) { int err; - const int *status; - if (&LED_CHAN == chan) { - /* Get LED status from channel. */ - status = zbus_chan_const_msg(chan); + if (&CONFIG_CHAN == chan) { + /* Get LED configuration from channel. */ + + const struct configuration *config = zbus_chan_const_msg(chan); + + LOG_DBG("LED configuration: red:%d, green:%d, blue:%d", + config->led_red, config->led_green, config->led_blue); + + /* Red LED */ + err = pwm_set_dt(&led0, PWM_USEC(PWM_PERIOD), + PWM_USEC((PWM_PERIOD * config->led_red) / LIGHTNESS_MAX)); + if (err) { + LOG_ERR("pwm_set_dt, error:%d", err); + SEND_FATAL_ERROR(); + return; + } /* Blue LED */ - err = dk_set_led(DK_LED2, *status); + err = pwm_set_dt(&led1, PWM_USEC(PWM_PERIOD), + PWM_USEC((PWM_PERIOD * config->led_blue) / LIGHTNESS_MAX)); + if (err) { + LOG_ERR("pwm_set_dt, error:%d", err); + SEND_FATAL_ERROR(); + return; + } + + /* Green LED */ + err = pwm_set_dt(&led2, PWM_USEC(PWM_PERIOD), + PWM_USEC((PWM_PERIOD * config->led_green) / LIGHTNESS_MAX)); if (err) { - LOG_ERR("dk_set_led, error:%d", err); + LOG_ERR("pwm_set_dt, error:%d", err); SEND_FATAL_ERROR(); return; } diff --git a/app/src/modules/transport/Kconfig.transport b/app/src/modules/transport/Kconfig.transport index 342c0f23..3a99f244 100644 --- a/app/src/modules/transport/Kconfig.transport +++ b/app/src/modules/transport/Kconfig.transport @@ -6,7 +6,6 @@ menu "Transport" depends on NRF_CLOUD_COAP - depends on SIMPLE_CONFIG config APP_TRANSPORT_RECONNECTION_TIMEOUT_SECONDS int "Reconnection timeout in seconds" diff --git a/app/src/modules/transport/transport.c b/app/src/modules/transport/transport.c index eb12f39c..ba6c7762 100644 --- a/app/src/modules/transport/transport.c +++ b/app/src/modules/transport/transport.c @@ -146,10 +146,7 @@ static void disconnected_entry(void *o) if (user_object->status == NETWORK_CONNECTED) { k_work_reschedule_for_queue(&transport_queue, &connect_work, K_NO_WAIT); } else { - err = nrf_cloud_coap_disconnect(); - if (err && (err != -ENOTCONN)) { - LOG_ERR("nrf_cloud_coap_disconnect, error: %d", err); - } + (void)nrf_cloud_coap_disconnect(); } } diff --git a/app/src/modules/trigger/Kconfig.trigger b/app/src/modules/trigger/Kconfig.trigger index 584e8354..5b8d84c7 100644 --- a/app/src/modules/trigger/Kconfig.trigger +++ b/app/src/modules/trigger/Kconfig.trigger @@ -6,19 +6,9 @@ menu "Trigger" -config APP_TRIGGER_THREAD_STACK_SIZE - int "Thread stack size" - default 2048 - config APP_TRIGGER_TIMEOUT_SECONDS int "Trigger timer timeout" - default 300 - -config APP_TRIGGER_WATCHDOG_TIMEOUT_SECONDS - int "Watchdog timeout seconds" - default 330 - help - Timeout in seconds for the watchdog timer. Has to be larger than APP_TRIGGER_TIMEOUT_SECONDS. + default 10 module = APP_TRIGGER module-str = Trigger diff --git a/app/src/modules/trigger/trigger.c b/app/src/modules/trigger/trigger.c index 46a08d2b..ff4a2818 100644 --- a/app/src/modules/trigger/trigger.c +++ b/app/src/modules/trigger/trigger.c @@ -8,9 +8,7 @@ #include #include #include -#if CONFIG_DK_LIBRARY #include -#endif /* CONFIG_DK_LIBRARY */ #include "message_channel.h" @@ -18,23 +16,20 @@ LOG_MODULE_REGISTER(trigger, CONFIG_APP_TRIGGER_LOG_LEVEL); #define MSG_SEND_TIMEOUT_SECONDS 1 -BUILD_ASSERT(CONFIG_APP_TRIGGER_WATCHDOG_TIMEOUT_SECONDS > - (CONFIG_APP_TRIGGER_TIMEOUT_SECONDS + MSG_SEND_TIMEOUT_SECONDS), - "Watchdog timeout must be greater than maximum execution time"); +/* Forward declarations */ +static void trigger_work_fn(struct k_work *work); -static void task_wdt_callback(int channel_id, void *user_data) -{ - LOG_ERR("Watchdog expired, Channel: %d, Thread: %s", - channel_id, k_thread_name_get((k_tid_t)user_data)); +/* Delayable work used to schedule triggers. */ +static K_WORK_DELAYABLE_DEFINE(trigger_work, trigger_work_fn); - SEND_FATAL_ERROR(); -} +/* Set default update interval */ +k_timeout_t update_interval = K_SECONDS(CONFIG_APP_TRIGGER_TIMEOUT_SECONDS); -static void message_send(void) +static void trigger_work_fn(struct k_work *work) { - int not_used = -1; int err; + int not_used = -1; bool fota_ongoing = true; err = zbus_chan_read(&FOTA_ONGOING_CHAN, &fota_ongoing, K_NO_WAIT); @@ -50,52 +45,60 @@ static void message_send(void) } LOG_DBG("Sending trigger message"); + err = zbus_chan_pub(&TRIGGER_CHAN, ¬_used, K_SECONDS(MSG_SEND_TIMEOUT_SECONDS)); if (err) { LOG_ERR("zbus_chan_pub, error: %d", err); SEND_FATAL_ERROR(); + return; } + + k_work_reschedule(&trigger_work, update_interval); } -#if CONFIG_DK_LIBRARY static void button_handler(uint32_t button_states, uint32_t has_changed) { if (has_changed & button_states) { - message_send(); + trigger_work_fn(NULL); } } -#endif /* CONFIG_DK_LIBRARY */ -static void trigger_task(void) +void trigger_callback(const struct zbus_channel *chan) { - int task_wdt_id; - const uint32_t wdt_timeout_ms = (CONFIG_APP_TRIGGER_WATCHDOG_TIMEOUT_SECONDS * MSEC_PER_SEC); + if (&CONFIG_CHAN == chan) { + /* Get update interval configuration from channel. */ + const struct configuration *config = zbus_chan_const_msg(chan); - task_wdt_id = task_wdt_add(wdt_timeout_ms, task_wdt_callback, k_current_get()); + LOG_DBG("New update interval: %lld", config->update_interval); -#if CONFIG_DK_LIBRARY - int err = dk_buttons_init(button_handler); + update_interval = K_SECONDS(config->update_interval); - if (err) { - LOG_ERR("dk_buttons_init, error: %d", err); - SEND_FATAL_ERROR(); - return; + /* Reschedule work */ + k_work_reschedule(&trigger_work, update_interval); } -#endif /* CONFIG_DK_LIBRARY */ - - while (true) { - err = task_wdt_feed(task_wdt_id); - if (err) { - LOG_ERR("task_wdt_feed, error: %d", err); - SEND_FATAL_ERROR(); - return; - } - message_send(); - k_sleep(K_SECONDS(CONFIG_APP_TRIGGER_TIMEOUT_SECONDS)); + if (&CLOUD_CHAN == chan) { + LOG_DBG("Cloud connection status received"); + + const enum cloud_status *status = zbus_chan_const_msg(chan); + + if (*status == CLOUD_CONNECTED) { + LOG_DBG("Cloud connected, starting trigger"); + k_work_reschedule(&trigger_work, update_interval); + } else { + LOG_DBG("Cloud disconnected, stopping trigger"); + k_work_cancel_delayable(&trigger_work); + } } } -K_THREAD_DEFINE(trigger_task_id, - CONFIG_APP_TRIGGER_THREAD_STACK_SIZE, - trigger_task, NULL, NULL, NULL, 3, 0, 0); +ZBUS_LISTENER_DEFINE(trigger, trigger_callback); + +static int trigger_init(void) +{ + __ASSERT((dk_buttons_init(button_handler) == 0), "Task watchdog init failure"); + + return 0; +} + +SYS_INIT(trigger_init, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/lib/simple_config/simple_config.c b/lib/simple_config/simple_config.c index 82b77a97..91d2e159 100644 --- a/lib/simple_config/simple_config.c +++ b/lib/simple_config/simple_config.c @@ -44,7 +44,7 @@ int simple_config_handle_incoming_settings(char *buf, size_t buf_len) } LOG_INF("Checking for shadow delta..."); - err = nrf_cloud_coap_shadow_get(buf, buf_len, request_delta); + err = nrf_cloud_coap_shadow_get(buf, &buf_len, request_delta, COAP_CONTENT_FORMAT_APP_JSON); if (err == -EACCES) { LOG_DBG("Not connected yet."); return err; diff --git a/tests/lib/simple_config/src/main.c b/tests/lib/simple_config/src/main.c index ca4b39f4..6281bfbb 100644 --- a/tests/lib/simple_config/src/main.c +++ b/tests/lib/simple_config/src/main.c @@ -32,7 +32,7 @@ FAKE_VALUE_FUNC(cJSON_bool, cJSON_IsObject, const cJSON * const) FAKE_VALUE_FUNC(cJSON *, cJSON_GetObjectItem, const cJSON * const, const char * const) /* nRF Cloud functions */ -FAKE_VALUE_FUNC(int, nrf_cloud_coap_shadow_get, char *, size_t, bool) +FAKE_VALUE_FUNC(int, nrf_cloud_coap_shadow_get, char *, size_t *, bool) /* fake callback */ FAKE_VALUE_FUNC(int, simple_config_callback, const char *, const struct simple_config_val *); diff --git a/tests/module/environmental/src/main.c b/tests/module/environmental/src/main.c index 6679a48d..4b031102 100644 --- a/tests/module/environmental/src/main.c +++ b/tests/module/environmental/src/main.c @@ -33,7 +33,10 @@ void transport_callback(const struct zbus_channel *chan) } } +void trigger_callback(const struct zbus_channel *chan) {}; + ZBUS_LISTENER_DEFINE(transport, transport_callback); +ZBUS_LISTENER_DEFINE(trigger, trigger_callback); /* define unused subscribers */ ZBUS_SUBSCRIBER_DEFINE(location, 1); diff --git a/west.yml b/west.yml index 19691ba5..eb12459b 100644 --- a/west.yml +++ b/west.yml @@ -14,5 +14,5 @@ manifest: - name: nrf remote: ncs repo-path: sdk-nrf - revision: ca9fd500085adefe4b742fba8166bd692e07f808 + revision: pull/15669/head import: true