application: add command to set channels

This commit is contained in:
King Kévin 2021-03-24 00:48:51 +01:00
parent ce9d927a5b
commit 89856091c7
1 changed files with 44 additions and 0 deletions

View File

@ -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)