Skip to content

Commit 7593939

Browse files
prsi98sachinthegreen
authored andcommitted
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 c3fc92c commit 7593939

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

samples/radio_test_bm/src/nrf_wifi_radio_test_shell.c

+36
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,27 @@ 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("'capture_timeout' has to be less than or equal to %d seconds\n", CAPTURE_DURATION_IN_SEC);
772+
return -ENOEXEC;
773+
}
774+
775+
if (!check_test_in_prog()) {
776+
return -ENOEXEC;
777+
}
778+
779+
ctx->conf_params.capture_timeout = val;
780+
781+
return 0;
782+
}
783+
763784
static int nrf_wifi_radio_test_set_ru_tone(size_t argc, const char *argv[]) {
764785
char *ptr = NULL;
765786
unsigned long val = 0;
@@ -1055,6 +1076,14 @@ static int nrf_wifi_radio_test_rx_cap(size_t argc, const char *argv[]) {
10551076
goto out;
10561077
}
10571078

1079+
if (rx_cap_type == NRF_WIFI_RF_TEST_RX_DYN_PKT_CAP) {
1080+
if (!ctx->conf_params.capture_timeout) {
1081+
RT_SHELL_PRINTF_ERROR("%s: Invalid rx_capture_timeout %d\n",__func__,
1082+
ctx->conf_params.capture_timeout);
1083+
goto out;
1084+
}
1085+
}
1086+
10581087
if (!check_test_in_prog()) {
10591088
goto out;
10601089
}
@@ -1445,6 +1474,7 @@ static int nrf_wifi_radio_test_show_cfg(size_t argc, const char *argv[]) {
14451474

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

1477+
RT_SHELL_PRINTF_INFO("rx_capture_timeout = %d\n", conf_params->capture_timeout);
14481478
#if defined(CONFIG_BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP) || \
14491479
defined(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP)
14501480
RT_SHELL_PRINTF_INFO("sr_ant_switch_ctrl = %d\n",
@@ -1652,6 +1682,7 @@ DEFINE_CMD_HANDLER(nrf_wifi_radio_test_sr_ant_switch_ctrl)
16521682
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_lna_gain)
16531683
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_bb_gain)
16541684
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_capture_length)
1685+
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_rx_capture_timeout)
16551686
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_rx_cap)
16561687
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_set_tx_tone_freq)
16571688
DEFINE_CMD_HANDLER(nrf_wifi_radio_test_tx_tone)
@@ -1791,6 +1822,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
17911822
"Max allowed length is 16384 complex samples",
17921823
RTSH(nrf_wifi_radio_test_set_rx_capture_length), 2,
17931824
0),
1825+
SHELL_CMD_ARG(rx_capture_timeout, NULL,
1826+
"<val> - Wait time allowed in seconds\n"
1827+
"Max timeout allowed is 600 seconds",
1828+
RTSH(nrf_wifi_radio_test_set_rx_capture_timeout), 2,
1829+
0),
17941830
SHELL_CMD_ARG(rx_cap, NULL,
17951831
"0 = ADC capture\n"
17961832
"1 = Static packet capture\n"

0 commit comments

Comments
 (0)