Skip to content

Commit 8da6ab8

Browse files
committed
modules: main: Poll shadow when location search is done
Shadow polling should only happen when location polling is completed. This is done for two reasons: - To not interrupt location search with network traffic - Reduce number of RRC connections. Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
1 parent 96e4f32 commit 8da6ab8

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

app/src/main.c

+10-11
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ static void task_wdt_callback(int channel_id, void *user_data)
252252
static void sensor_and_poll_triggers_send(void)
253253
{
254254
int err;
255+
struct cloud_msg cloud_msg = {
256+
.type = CLOUD_POLL_SHADOW
257+
};
258+
259+
err = zbus_chan_pub(&CLOUD_CHAN, &cloud_msg, K_SECONDS(1));
260+
if (err) {
261+
LOG_ERR("zbus_chan_pub shadow trigger, error: %d", err);
262+
SEND_FATAL_ERROR();
263+
return;
264+
}
255265

256266
#if defined(CONFIG_APP_REQUEST_NETWORK_QUALITY)
257267
struct network_msg network_msg = {
@@ -478,24 +488,13 @@ static void sample_data_entry(void *o)
478488
{
479489
int err;
480490
enum location_msg_type location_msg = LOCATION_SEARCH_TRIGGER;
481-
struct cloud_msg cloud_msg = {
482-
.type = CLOUD_POLL_SHADOW
483-
};
484491
struct main_state *state_object = (struct main_state *)o;
485492

486-
487493
LOG_DBG("%s", __func__);
488494

489495
/* Record the start time of sampling */
490496
state_object->sample_start_time = k_uptime_seconds();
491497

492-
err = zbus_chan_pub(&CLOUD_CHAN, &cloud_msg, K_SECONDS(1));
493-
if (err) {
494-
LOG_ERR("zbus_chan_pub shadow trigger, error: %d", err);
495-
SEND_FATAL_ERROR();
496-
return;
497-
}
498-
499498
err = zbus_chan_pub(&LOCATION_CHAN, &location_msg, K_SECONDS(1));
500499
if (err) {
501500
LOG_ERR("zbus_chan_pub data sample trigger, error: %d", err);

0 commit comments

Comments
 (0)