app: add dials command
This commit is contained in:
parent
0e92b46c3e
commit
851c25ffe0
@ -621,6 +621,24 @@ static void command_strip_white(void* argument)
|
||||
printf("white channel set to %u%%\n", set);
|
||||
}
|
||||
|
||||
static void command_dials(void* argument)
|
||||
{
|
||||
if (argument) {
|
||||
const uint32_t seconds = *(uint32_t*)argument; // get provide value
|
||||
if (seconds < 12 * 60 * 60) {
|
||||
const uint32_t goal = DIAL_CYCLE_STEPS * seconds * 1.0 / (12 * 60 * 60);
|
||||
if (goal != drv8825_goal) {
|
||||
drv8825_goal = goal; // set new goal
|
||||
uint32_t speed = 300;
|
||||
command_speed(&speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("dial position/goal: %u/%u\n", drv8825_steps, drv8825_goal);
|
||||
}
|
||||
|
||||
|
||||
/** list of all supported commands */
|
||||
static const struct menu_command_t menu_commands[] = {
|
||||
{
|
||||
@ -735,6 +753,14 @@ static const struct menu_command_t menu_commands[] = {
|
||||
.argument_description = "%",
|
||||
.command_handler = &command_strip_white,
|
||||
},
|
||||
{
|
||||
.shortcut = 'd',
|
||||
.name = "dial",
|
||||
.command_description = "set dial position",
|
||||
.argument = MENU_ARGUMENT_UNSIGNED,
|
||||
.argument_description = "[sec]",
|
||||
.command_handler = &command_dials,
|
||||
},
|
||||
};
|
||||
|
||||
static void command_help(void* argument)
|
||||
|
Loading…
Reference in New Issue
Block a user