Skip to content

Commit 1f34d55

Browse files
maxd-nordicjhn-nordic
authored andcommitted
lib: net: nrf_cloud: Fix PGPS header scanning
Previous implementation hinted at corrupted P-GPS when it was just not populated yet. Signed-off-by: Maximilian Deubel <[email protected]>
1 parent 3557ba6 commit 1f34d55

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

subsys/net/lib/nrf_cloud/src/nrf_cloud_pgps.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,13 @@ static bool validate_pgps_header(const struct nrf_cloud_pgps_header *header)
239239
(header->prediction_period_min != PREDICTION_PERIOD) ||
240240
(header->prediction_count <= 0) ||
241241
(header->prediction_count > NUM_PREDICTIONS)) {
242-
if ((((uint8_t)header->schema_version) == 0xff) &&
243-
(((uint8_t)header->array_type) == 0xff)) {
244-
LOG_WRN("Flash is erased.");
242+
if ((((uint8_t)header->schema_version) == 0x00) &&
243+
(((uint8_t)header->array_type) == 0x00)) {
244+
LOG_WRN("No P-GPS data downloaded yet.");
245245
} else {
246-
LOG_WRN("One or more fields are wrong");
246+
LOG_HEXDUMP_WRN(
247+
header, sizeof(struct nrf_cloud_pgps_header),
248+
"P-GPS data corrupted; header:");
247249
}
248250
return false;
249251
}

0 commit comments

Comments
 (0)