-
Notifications
You must be signed in to change notification settings - Fork 8
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: location: Use zbus subscriber instead of listener #132
Conversation
dc13ac9
to
6fda775
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good,
I get an unknown event when testing, was fixed by adding a handler case for:
case **LOCATION_EVT_STARTED**:
LOG_WRN("Getting location started");
break;
default:
LOG_DBG("Unknown event %d", event_data->id);
break;
@@ -59,74 +72,49 @@ void location_task(void) | |||
} | |||
|
|||
err = location_init(location_event_handler); | |||
if (err) | |||
{ | |||
if (err) { | |||
LOG_ERR("Unable to init location library: %d", err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG_ERR("Unable to init location library: %d", err); | |
LOG_ERR("Unable to init location library: %d", err); | |
SEND_FATAL_ERROR(); | |
return; |
static K_SEM_DEFINE(location_lib_sem, 1, 1); | ||
static K_SEM_DEFINE(modem_init_sem, 0, 1); | ||
static K_SEM_DEFINE(trigger_sem, 0, 1); | ||
ZBUS_SUBSCRIBER_DEFINE(location, CONFIG_APP_LOCATION_ZBUS_QUEUE_SIZE); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* Forward declarations */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to the PR.
@@ -22,13 +22,10 @@ | |||
LOG_MODULE_REGISTER(location_module, CONFIG_APP_LOCATION_LOG_LEVEL); | |||
|
|||
BUILD_ASSERT(CONFIG_APP_LOCATION_WATCHDOG_TIMEOUT_SECONDS > | |||
CONFIG_APP_LOCATION_TRIGGER_TIMEOUT_SECONDS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Some alignment issues here it looks like. Could align with CONFIG_APP_LOCATION
app/src/modules/location/location.c
Outdated
{ | ||
LOG_ERR("Unable to send location request: %d", err); | ||
if (&TRIGGER_CHAN == chan) { | ||
LOG_WRN("Trigger received"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG_WRN("Trigger received"); | |
LOG_DBG("Trigger received"); |
0b00ddb
to
a0272de
Compare
Updated the location module to use zbus subscribe instead of a listener for consistency and easier logic. Removed semaphores and modem lib connection handling. Connection handling might be needed unless the location lib doesn't handle this internally, but it should probably be dealt with using the Zephyr State Machine Framework. Signed-off-by: Gregers Gram Rygg <[email protected]>
a0272de
to
f0545bd
Compare
Quality Gate passedIssues Measures |
Updated the location module to use zbus subscribe instead of a listener for consistency and easier logic. Removed semaphores and modem lib connection handling. Connection handling might be needed unless the location lib doesn't handle this internally, but it should probably be dealt with using the Zephyr State Machine Framework.