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

app: enable GNSS based on device shadow config #165

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

gregersrygg
Copy link
Collaborator

This commit enables GNSS in kconfig and dynamically requests gnss from the location library depending on the config from the device shadow.

@gregersrygg gregersrygg requested a review from simensrostad June 12, 2024 11:52
@gregersrygg gregersrygg self-assigned this Jun 12, 2024
@gregersrygg gregersrygg force-pushed the add-gnss-from-config branch from edba646 to dcdb0c8 Compare June 12, 2024 12:05
Copy link
Collaborator

@simensrostad simensrostad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, added a few comments to consider.

app/prj.conf Outdated
CONFIG_LOCATION_METHOD_GNSS=n
CONFIG_LOCATION_METHOD_GNSS=y
CONFIG_LOCATION_SERVICE_NRF_CLOUD_GNSS_POS_SEND=y
CONFIG_LOCATION_SERVICE_HERE=n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this one already defaults n?

CONFIG_LOCATION_REQUEST_DEFAULT_GNSS_TIMEOUT=200000
CONFIG_LOCATION_REQUEST_DEFAULT_TIMEOUT=300000
CONFIG_LTE_NETWORK_MODE_LTE_M_NBIOT_GPS=y
# CONFIG_LOCATION_LOG_LEVEL_DBG=y
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, should we just remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been turning it on and off multiple times, and I figured it would be handy to have there easily available during development. We can remove it before launch.

/* GNSS has to be enabled after the modem is initialized and enabled */
err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_ACTIVATE_GNSS);
if (err) {
LOG_ERR("Unable to init GNSS: %d", err);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be an irrecoverable error. I suggest treating it as such.


if (status == NETWORK_CONNECTED) {
/* GNSS has to be enabled after the modem is initialized and enabled */
err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_ACTIVATE_GNSS);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function only needs to be called once. Having a guard here saves few cycles in the long run. No big deal though.

@simensrostad
Copy link
Collaborator

There is also a few sonarcloud issues that might be worth looking into

@gregersrygg gregersrygg force-pushed the add-gnss-from-config branch 2 times, most recently from c428417 to cd67822 Compare June 13, 2024 11:03
This commit enables GNSS in kconfig and dynamically requests gnss from
the location library depending on the config from the device shadow.

Co-Authored-By: Simen S. Røstad <[email protected]>
Signed-off-by: Gregers Gram Rygg <[email protected]>
@gregersrygg gregersrygg force-pushed the add-gnss-from-config branch from cd67822 to 5cc032b Compare June 13, 2024 11:18
Copy link

@gregersrygg gregersrygg merged commit 461b3cc into main Jun 13, 2024
5 checks passed
@gregersrygg gregersrygg deleted the add-gnss-from-config branch June 13, 2024 11:30
}

if (status == NETWORK_CONNECTED) {
/* GNSS has to be enabled after the modem is initialized and enabled */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For OOB this is fine, but for trackers with buffering capabilities we probably want to use GNSS before we have connectivity (i.e if we are out of coverage)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. This was just the easiest way to enable gnss when the modem was ready. The modem_init (or similarly named) callback was triggered before the modem was ready to enable gnss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants