From 89856091c79ba05f909c2f2af4d342ff39f5124e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Wed, 24 Mar 2021 00:48:51 +0100 Subject: [PATCH] application: add command to set channels --- application.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/application.c b/application.c index 7c4f156..fb863ee 100644 --- a/application.c +++ b/application.c @@ -301,6 +301,34 @@ static void command_target_reset(void* argument) } } +/** set first channel of range to scan + * @param[in] argument optional pointer to first channel number + */ +static void command_channel_start(void* argument) +{ + if (argument) { + const uint32_t channel = *(uint32_t*)argument; + if (channel < CHANNEL_NUMBERS && channel < channel_stop) { + channel_start = channel; + } + } + printf("channels to probe: %u-%u\n", channel_start, channel_stop); +} + +/** set last channel of range to scan + * @param[in] argument optional pointer to last channel number + */ +static void command_channel_stop(void* argument) +{ + if (argument) { + const uint32_t channel = *(uint32_t*)argument; + if (channel < CHANNEL_NUMBERS && channel > channel_start) { + channel_stop = channel; + } + } + printf("channels to probe: %u-%u\n", channel_start, channel_stop); +} + /** display available commands * @param[in] argument no argument required */ @@ -568,6 +596,22 @@ static const struct menu_command_t menu_commands[] = { .argument_description = "[0|1|ODL|ODH|PPL|PPH]", .command_handler = &command_target_reset, }, + { + .shortcut = 'c', + .name = "start", + .command_description = "first channel of range to probe", + .argument = MENU_ARGUMENT_UNSIGNED, + .argument_description = "[ch]", + .command_handler = &command_channel_start, + }, + { + .shortcut = 'C', + .name = "stop", + .command_description = "last channel of range to probe", + .argument = MENU_ARGUMENT_UNSIGNED, + .argument_description = "[ch]", + .command_handler = &command_channel_stop, + }, }; static void command_help(void* argument)