Issue #17: Add ui-emulate command to shell
This commit is contained in:
parent
0da6925119
commit
f32d1afde5
@ -37,6 +37,7 @@
|
|||||||
#include <reflow-controller/rotary-encoder.h>
|
#include <reflow-controller/rotary-encoder.h>
|
||||||
#include <reflow-controller/safety/safety-controller.h>
|
#include <reflow-controller/safety/safety-controller.h>
|
||||||
#include <reflow-controller/settings/settings.h>
|
#include <reflow-controller/settings/settings.h>
|
||||||
|
#include <reflow-controller/button.h>
|
||||||
|
|
||||||
#ifndef GIT_VER
|
#ifndef GIT_VER
|
||||||
#define GIT_VER "VERSION NOT SET"
|
#define GIT_VER "VERSION NOT SET"
|
||||||
@ -458,6 +459,48 @@ static shellmatta_retCode_t shell_cmd_hang(const shellmatta_handle_t handle, con
|
|||||||
return SHELLMATTA_OK;
|
return SHELLMATTA_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static shellmatta_retCode_t shell_cmd_ui_emulation(const shellmatta_handle_t handle, const char *arguments,
|
||||||
|
uint32_t length)
|
||||||
|
{
|
||||||
|
(void)length;
|
||||||
|
(void)arguments;
|
||||||
|
uint32_t i;
|
||||||
|
uint32_t len;
|
||||||
|
char *buff;
|
||||||
|
|
||||||
|
shellmatta_read(handle, &buff, &len);
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
switch (buff[i]) {
|
||||||
|
case 'W':
|
||||||
|
case 'w':
|
||||||
|
rotary_encoder_override_delta(4);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
case 'S':
|
||||||
|
rotary_encoder_override_delta(-4);
|
||||||
|
break;
|
||||||
|
case '\r':
|
||||||
|
button_override_event(BUTTON_SHORT_RELEASED);
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
case 'L':
|
||||||
|
button_override_event(BUTTON_LONG);
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
case 'K':
|
||||||
|
button_override_event(BUTTON_SHORT);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
case 'R':
|
||||||
|
button_override_event(BUTTON_LONG_RELEASED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SHELLMATTA_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
//typedef struct shellmatta_cmd
|
//typedef struct shellmatta_cmd
|
||||||
//{
|
//{
|
||||||
// char *cmd; /**< command name */
|
// char *cmd; /**< command name */
|
||||||
@ -467,7 +510,7 @@ static shellmatta_retCode_t shell_cmd_hang(const shellmatta_handle_t handle, con
|
|||||||
// shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */
|
// shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */
|
||||||
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
|
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
|
||||||
//} shellmatta_cmd_t;
|
//} shellmatta_cmd_t;
|
||||||
static shellmatta_cmd_t cmd[15] = {
|
static shellmatta_cmd_t cmd[16] = {
|
||||||
{
|
{
|
||||||
.cmd = "version",
|
.cmd = "version",
|
||||||
.cmdAlias = "ver",
|
.cmdAlias = "ver",
|
||||||
@ -586,8 +629,16 @@ static shellmatta_cmd_t cmd[15] = {
|
|||||||
.helpText = "",
|
.helpText = "",
|
||||||
.usageText = "",
|
.usageText = "",
|
||||||
.cmdFct = shell_cmd_hang,
|
.cmdFct = shell_cmd_hang,
|
||||||
|
.next = &cmd[15],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.cmd = "ui-emulate",
|
||||||
|
.cmdAlias = NULL,
|
||||||
|
.helpText = "",
|
||||||
|
.usageText = "",
|
||||||
|
.cmdFct = shell_cmd_ui_emulation,
|
||||||
.next = NULL,
|
.next = NULL,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
shellmatta_handle_t shell_init(shellmatta_write_t write_func)
|
shellmatta_handle_t shell_init(shellmatta_write_t write_func)
|
||||||
|
Loading…
Reference in New Issue
Block a user