diff --git a/README.md b/README.md index 7c921e1e..552a73d9 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,5 @@ The template is open-source for a reason, and we encourage users to contribute b - [Button](docs/modules/button.md) - [Cloud](docs/modules/cloud.md) - [Environmental](docs/modules/environmental.md) -- [Main](docs/modules/main.md) - [Network](docs/modules/network.md) - [Power](docs/modules/power.md) diff --git a/app/src/main.c b/app/src/main.c index b61c4cd1..fff0ce0c 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -252,6 +252,16 @@ static void task_wdt_callback(int channel_id, void *user_data) static void sensor_and_poll_triggers_send(void) { int err; + struct cloud_msg cloud_msg = { + .type = CLOUD_POLL_SHADOW + }; + + err = zbus_chan_pub(&CLOUD_CHAN, &cloud_msg, K_SECONDS(1)); + if (err) { + LOG_ERR("zbus_chan_pub shadow trigger, error: %d", err); + SEND_FATAL_ERROR(); + return; + } #if defined(CONFIG_APP_REQUEST_NETWORK_QUALITY) struct network_msg network_msg = { @@ -478,24 +488,13 @@ static void sample_data_entry(void *o) { int err; enum location_msg_type location_msg = LOCATION_SEARCH_TRIGGER; - struct cloud_msg cloud_msg = { - .type = CLOUD_POLL_SHADOW - }; struct main_state *state_object = (struct main_state *)o; - LOG_DBG("%s", __func__); /* Record the start time of sampling */ state_object->sample_start_time = k_uptime_seconds(); - err = zbus_chan_pub(&CLOUD_CHAN, &cloud_msg, K_SECONDS(1)); - if (err) { - LOG_ERR("zbus_chan_pub shadow trigger, error: %d", err); - SEND_FATAL_ERROR(); - return; - } - err = zbus_chan_pub(&LOCATION_CHAN, &location_msg, K_SECONDS(1)); if (err) { LOG_ERR("zbus_chan_pub data sample trigger, error: %d", err); diff --git a/tests/module/main/src/main.c b/tests/module/main/src/main.c index fa6bdc06..ea1a74f1 100644 --- a/tests/module/main/src/main.c +++ b/tests/module/main/src/main.c @@ -262,11 +262,11 @@ void test_trigger_interval_change_in_connected(void) send_location_search_done(); check_location_event(LOCATION_SEARCH_DONE); + check_network_event(NETWORK_QUALITY_SAMPLE_REQUEST); + check_power_event(POWER_BATTERY_PERCENTAGE_SAMPLE_REQUEST); } /* Cleanup */ - purge_all_events(); - send_cloud_disconnected(); check_no_events(WEEK_IN_SECONDS); } @@ -310,8 +310,6 @@ void test_trigger_disconnect_and_connect_when_triggering(void) } /* Cleanup */ - purge_all_events(); - send_cloud_disconnected(); check_no_events(WEEK_IN_SECONDS); }