Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Commit c450d40

Browse files
author
github-actions[bot]
committed
1 parent 995ca8b commit c450d40

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

src/modules/gnss_module.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,24 @@ static int setup(void)
524524
/* Message handler for STATE_INIT. */
525525
static void on_state_init(struct gnss_msg_data *msg)
526526
{
527-
if (IS_EVENT(msg, data, DATA_EVT_CONFIG_INIT)) {
528-
gnss_timeout = msg->module.data.data.cfg.gnss_timeout;
527+
if (IS_EVENT(msg, modem, MODEM_EVT_INITIALIZED)) {
528+
int err;
529+
530+
err = setup();
531+
if (err) {
532+
LOG_ERR("setup, error: %d", err);
533+
SEND_ERROR(gnss, GNSS_EVT_ERROR_CODE, err);
534+
}
535+
536+
state_set(STATE_RUNNING);
529537
}
530538
}
531539

532540
/* Message handler for STATE_RUNNING. */
533541
static void on_state_running(struct gnss_msg_data *msg)
534542
{
535-
if (IS_EVENT(msg, data, DATA_EVT_CONFIG_READY)) {
543+
if ((IS_EVENT(msg, data, DATA_EVT_CONFIG_INIT)) ||
544+
(IS_EVENT(msg, data, DATA_EVT_CONFIG_READY))) {
536545
gnss_timeout = msg->module.data.data.cfg.gnss_timeout;
537546
}
538547
}
@@ -588,18 +597,6 @@ static void on_all_states(struct gnss_msg_data *msg)
588597
state_set(STATE_INIT);
589598
}
590599

591-
if (IS_EVENT(msg, modem, MODEM_EVT_INITIALIZED)) {
592-
int err;
593-
594-
err = setup();
595-
if (err) {
596-
LOG_ERR("setup, error: %d", err);
597-
SEND_ERROR(gnss, GNSS_EVT_ERROR_CODE, err);
598-
}
599-
600-
state_set(STATE_RUNNING);
601-
}
602-
603600
if (IS_EVENT(msg, util, UTIL_EVT_SHUTDOWN_REQUEST)) {
604601
/* The module doesn't have anything to shut down and can
605602
* report back immediately.

src/modules/modem_module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,12 @@ static inline int adjust_rsrp(int input, enum sample_type type)
491491
switch (type) {
492492
case NEIGHBOR_CELL:
493493
if (IS_ENABLED(CONFIG_MODEM_NEIGHBOR_CELLS_DATA_CONVERT_RSRP_TO_DBM)) {
494-
return input - 140;
494+
return RSRP_IDX_TO_DBM(input);
495495
}
496496
break;
497497
case MODEM_DYNAMIC:
498498
if (IS_ENABLED(CONFIG_MODEM_DYNAMIC_DATA_CONVERT_RSRP_TO_DBM)) {
499-
return input - 140;
499+
return RSRP_IDX_TO_DBM(input);
500500
}
501501
break;
502502
default:
@@ -510,7 +510,7 @@ static inline int adjust_rsrp(int input, enum sample_type type)
510510
static inline int adjust_rsrq(int input)
511511
{
512512
if (IS_ENABLED(CONFIG_MODEM_NEIGHBOR_CELLS_DATA_CONVERT_RSRQ_TO_DB)) {
513-
return round(input * 0.5 - 19.5);
513+
return round(RSRQ_IDX_TO_DB(input));
514514
}
515515

516516
return input;

0 commit comments

Comments
 (0)