Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main fixups #130

Merged
merged 3 commits into from
Mar 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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>
jtguggedal committed Mar 24, 2025
commit 7e2b4dce0b833d27655556d55dc4115cdd62f27a
21 changes: 10 additions & 11 deletions app/src/main.c
Original file line number Diff line number Diff line change
@@ -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);