Skip to content

Commit eb99a81

Browse files
committed
Add capture timeout command
Add capture timeout subcommand to radio test sample to fix dynamic packet capture command. Signed-off-by: Prasun Sinha <Prasun.Sinha@nordicsemi.no>
1 parent 758d296 commit eb99a81

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

samples/radio_test_bm/src/nrf_wifi_radio_test_shell.c

+38
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,29 @@ static int nrf_wifi_radio_test_set_rx_capture_length(size_t argc,
760760
return 0;
761761
}
762762

763+
static int nrf_wifi_radio_test_set_rx_capture_timeout(size_t argc,
764+
const char *argv[]) {
765+
char *ptr = NULL;
766+
unsigned short int val = 0;
767+
768+
val = strtoul(argv[1], &ptr, 10);
769+
770+
if (val > CAPTURE_DURATION_IN_SEC) {
771+
RT_SHELL_PRINTF_ERROR(
772+
"'capture_timeout' has to be less than or equal to %d seconds\n",
773+
CAPTURE_DURATION_IN_SEC);
774+
return -ENOEXEC;
775+
}
776+
777+
if (!check_test_in_prog()) {
778+
return -ENOEXEC;
779+
}
780+
781+
ctx->conf_params.capture_timeout = val;
782+
783+
return 0;
784+
}
785+
763786
static int nrf_wifi_radio_test_set_ru_tone(size_t argc, const char *argv[]) {
764787
char *ptr = NULL;
765788
unsigned long val = 0;
@@ -1055,6 +1078,14 @@ static int nrf_wifi_radio_test_rx_cap(size_t argc, const char *argv[]) {
10551078
goto out;
10561079
}
10571080

1081+
if (rx_cap_type == NRF_WIFI_RF_TEST_RX_DYN_PKT_CAP) {
1082+
if (!ctx->conf_params.capture_timeout) {
1083+
RT_SHELL_PRINTF_ERROR("%s: Invalid rx_capture_timeout %d\n",__func__,
1084+
ctx->conf_params.capture_timeout);
1085+
goto out;
1086+
}
1087+
}
1088+
10581089
if (!check_test_in_prog()) {
10591090
goto out;
10601091
}
@@ -1445,6 +1476,7 @@ static int nrf_wifi_radio_test_show_cfg(size_t argc, const char *argv[]) {
14451476

14461477
RT_SHELL_PRINTF_INFO("rx_capture_length = %d\n", conf_params->capture_length);
14471478

1479+
RT_SHELL_PRINTF_INFO("rx_capture_timeout = %d\n", conf_params->capture_timeout);
14481480
#if defined(CONFIG_BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP) || \
14491481
defined(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP)
14501482
RT_SHELL_PRINTF_INFO("sr_ant_switch_ctrl = %d\n",
@@ -1652,6 +1684,7 @@ DEFINE_CMD_HANDLER(nrf_wifi_radio_test_sr_ant_switch_ctrl)
16521684
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_lna_gain)
16531685
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_bb_gain)
16541686
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_capture_length)
1687+
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_capture_timeout)
16551688
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_rx_cap)
16561689
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_tx_tone_freq)
16571690
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_tx_tone)
@@ -1791,6 +1824,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
17911824
"Max allowed length is 16384 complex samples",
17921825
RTSH(nrf_wifi_radio_test_set_rx_capture_length), 2,
17931826
0),
1827+
SHELL_CMD_ARG(rx_capture_timeout, NULL,
1828+
"<val> - Wait time allowed in seconds\n"
1829+
"Max timeout allowed is 600 seconds",
1830+
RTSH(nrf_wifi_radio_test_set_rx_capture_timeout), 2,
1831+
0),
17941832
SHELL_CMD_ARG(rx_cap, NULL,
17951833
"0 = ADC capture\n"
17961834
"1 = Static packet capture\n"

0 commit comments

Comments
 (0)