Skip to content

Commit f91bb3d

Browse files
plskeggsmbolivar-nordic
authored andcommitted
samples: nrf9160: modem_shell: integrate with P-GPS partition
If the P-GPS partition in flash is enabled, there is no need to pass the PM_MCUBOOT_SECONDARY_ADDRESS or _SIZE to the init function. Start using P-GPS partition so MCUboot is not required. Once P-GPS response has been processed, also call nrf_cloud_pgps_notify_prediction() so that the current prediction actually gets injected to the GNSS unit. If a prediction is ready right after P-GPS initialization, go ahead and inject it. Signed-off-by: Pete Skeggs <[email protected]>
1 parent 1a6f5d2 commit f91bb3d

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

samples/nrf9160/modem_shell/overlay-pgps.conf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ CONFIG_SETTINGS=y
2121
CONFIG_SETTINGS_FCB=y
2222
CONFIG_MPU_ALLOW_FLASH_WRITE=y
2323

24-
# MCUBOOT - for partition containing PM_MCUBOOT_SECONDARY_ADDRESS
25-
CONFIG_BOOTLOADER_MCUBOOT=y
26-
CONFIG_IMG_MANAGER=y
27-
CONFIG_MCUBOOT_IMG_MANAGER=y
28-
2924
# Library that maintains the current date and UTC time
3025
CONFIG_DATE_TIME=y
3126

samples/nrf9160/modem_shell/src/gnss/gnss.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <net/nrf_cloud_agps.h>
2222
#endif /* CONFIG_NRF_CLOUD_AGPS */
2323
#if defined(CONFIG_NRF_CLOUD_PGPS)
24-
#include <pm_config.h>
2524
#include <net/nrf_cloud_pgps.h>
2625
#endif /* CONFIG_NRF_CLOUD_PGPS */
2726
#endif /* CONFIG_NRF_CLOUD_AGPS || CONFIG_NRF_CLOUD_PGPS */
@@ -786,6 +785,15 @@ static void get_pgps_data_work_fn(struct k_work *work)
786785
}
787786

788787
mosh_print("GNSS: P-GPS response processed");
788+
789+
err = nrf_cloud_pgps_notify_prediction();
790+
if (err) {
791+
mosh_error("GNSS: Failed to request current prediction, error: %d", err);
792+
793+
return;
794+
}
795+
796+
mosh_print("GNSS: P-GPS prediction requested");
789797
}
790798

791799
static void inject_pgps_data_work_fn(struct k_work *work)
@@ -810,10 +818,13 @@ static void inject_pgps_data_work_fn(struct k_work *work)
810818
static void pgps_event_handler(struct nrf_cloud_pgps_event *event)
811819
{
812820
switch (event->type) {
821+
case PGPS_EVT_READY:
813822
case PGPS_EVT_AVAILABLE:
814-
prediction = event->prediction;
823+
if (event->prediction != NULL) {
824+
prediction = event->prediction;
815825

816-
k_work_submit_to_queue(&gnss_work_q, &inject_pgps_data_work);
826+
k_work_submit_to_queue(&gnss_work_q, &inject_pgps_data_work);
827+
}
817828
break;
818829

819830
case PGPS_EVT_REQUEST:
@@ -1396,8 +1407,9 @@ int gnss_enable_pgps(void)
13961407

13971408
struct nrf_cloud_pgps_init_param pgps_param = {
13981409
.event_handler = pgps_event_handler,
1399-
.storage_base = PM_MCUBOOT_SECONDARY_ADDRESS,
1400-
.storage_size = PM_MCUBOOT_SECONDARY_SIZE
1410+
/* storage is defined by CONFIG_NRF_CLOUD_PGPS_STORAGE */
1411+
.storage_base = 0u,
1412+
.storage_size = 0u
14011413
};
14021414

14031415
err = nrf_cloud_pgps_init(&pgps_param);

0 commit comments

Comments
 (0)