Skip to content

Commit 73180e9

Browse files
committed
ci: fix red nightly
- Make sure GNSS is disabled when provisioning starts. - Enable external antenna configuration for the DK in CI Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent 55dd832 commit 73180e9

File tree

5 files changed

+22
-31
lines changed

5 files changed

+22
-31
lines changed

.github/actions/build-step/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ runs:
6868
if [[ "${{ inputs.modem_trace }}" == "true" ]]; then
6969
params+=("-Dapp_SNIPPET=nrf91-modem-trace-uart")
7070
fi
71+
if [[ "${{ inputs.board }}" == "nrf9151dk"* ]]; then
72+
echo CONFIG_MODEM_ANTENNA_GNSS_EXTERNAL=y >> overlay-nrf9151dk.conf
73+
params+=("-DEXTRA_CONF_FILE=overlay-nrf9151dk.conf")
74+
fi
7175
west build -b ${{ inputs.board }} \
7276
-d build \
7377
-p --sysbuild -- \

app/src/modules/cloud/cloud.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,11 +837,24 @@ static void state_connecting_provisioned_run(void *obj)
837837
static void state_connecting_provisioning_entry(void *obj)
838838
{
839839
int err;
840-
841840
struct cloud_state_object *state_object = obj;
841+
struct location_msg location_msg = {
842+
.type = LOCATION_SEARCH_CANCEL,
843+
};
842844

843845
LOG_DBG("%s", __func__);
844846

847+
/* Cancel any ongoing location search during provisioning to allow writing credentials,
848+
* which requires offline LTE functional mode.
849+
*/
850+
err = zbus_chan_pub(&LOCATION_CHAN, &location_msg, K_SECONDS(1));
851+
if (err) {
852+
LOG_ERR("zbus_chan_pub, error: %d", err);
853+
854+
SEND_FATAL_ERROR();
855+
return;
856+
}
857+
845858
state_object->provisioning_ongoing = true;
846859

847860
err = nrf_provisioning_trigger_manually();

app/src/modules/location/location.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ static void handle_location_chan(const struct location_msg *location_msg)
212212
LOG_ERR("Unable to cancel location request: %d", err);
213213
} else {
214214
LOG_DBG("Location request cancelled successfully");
215+
216+
gnss_disable();
215217
}
216218
}
217219
}

tests/on_target/tests/test_gnss/test_gnss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import os
77
import pytest
8-
from utils.flash_tools import flash_device, reset_device, recover_device
8+
from utils.flash_tools import flash_device, reset_device
99
import sys
1010
sys.path.append(os.getcwd())
1111
from utils.logger import get_logger
@@ -44,6 +44,6 @@ def test_gnss(dut_board, hex_file):
4444
assert abs(lat - 61.493219) < 0.1, f"Latitude {lat} is not within expected range of 61.493219"
4545
assert abs(lon - 23.771307) < 0.1, f"Longitude {lon} is not within expected range of 23.771307"
4646
assert acc > 0, f"Accuracy {acc} should be greater than 0"
47-
assert "Cellular" in method, f"Method '{method}' should be 'Cellular'"
47+
assert "GNSS" in method, f"Method '{method}' should be 'GNSS'"
4848

4949
logger.info(f"Got location: lat: {lat}, lon: {lon}, acc: {acc}, method: {method}")

tests/on_target/tests/test_provisioning/test_provisioning.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -145,32 +145,6 @@ def _wait_for_provisioning_completion_and_cloud_connection(
145145
logger.info("Device provisioned and connected to nRF Cloud.")
146146

147147

148-
def _verify_device_location_data(
149-
dut_cloud,
150-
expected_lat: float = 61.5,
151-
expected_lon: float = 10.5,
152-
lat_tolerance: float = 2.0,
153-
lon_tolerance: float = 1.0,
154-
timeout: int = 300,
155-
):
156-
logger.info("Verifying device location data...")
157-
158-
values = dut_cloud.uart.wait_for_str_re(
159-
r"Got location: lat: ([\d.-]+), lon: ([\d.-]+), acc: ([\d.-]+), method:",
160-
timeout=timeout
161-
)
162-
assert values, "Failed to get location data from device."
163-
164-
lat_str, lon_str, acc_str = values
165-
lat, lon = float(lat_str), float(lon_str)
166-
logger.info(f"Received location: Lat={lat}, Lon={lon}, Accuracy={acc_str}")
167-
168-
assert abs(lat - expected_lat) < lat_tolerance, f"Latitude {lat} out of range."
169-
assert abs(lon - expected_lon) < lon_tolerance, f"Longitude {lon} out of range."
170-
171-
logger.info("Device location data verified.")
172-
173-
174148
def _trigger_device_reprovisioning_with_new_credentials(dut_cloud, sec_tag: int):
175149
"""
176150
Initiates the reprovisioning process on the device by:
@@ -249,7 +223,6 @@ def _run_initial_provisioning(dut_cloud, hex_file):
249223
_connect_to_network_and_wait_for_claiming_prompt(dut_cloud)
250224
_claim_device_on_nrf_cloud(dut_cloud, attestation_token)
251225
_wait_for_provisioning_completion_and_cloud_connection(dut_cloud)
252-
_verify_device_location_data(dut_cloud)
253226

254227
logger.info("--- Phase 1: Initial Device Provisioning Completed Successfully ---")
255228

@@ -262,7 +235,6 @@ def _run_reprovisioning(dut_cloud):
262235
_trigger_device_reprovisioning_with_new_credentials(dut_cloud, SEC_TAG)
263236
# Wait for the device to process the command, reprovision, and reconnect
264237
_wait_for_provisioning_completion_and_cloud_connection(dut_cloud, timeout=300)
265-
_verify_device_location_data(dut_cloud)
266238

267239
logger.info(
268240
"--- Phase 2: Reprovisioning with New Credentials Completed Successfully ---"

0 commit comments

Comments
 (0)