Compare commits

..

No commits in common. "66d6a76e1af0c340ed71ad37158dd84dbe0ac64e" and "c745f865bd8c787ddc4dd5c52f2774234e0f7ff0" have entirely different histories.

View File

@ -37,7 +37,6 @@
#define GIT_VER "VERSION NOT SET"
#endif
extern struct stm_uart shell_uart;
static shellmatta_instance_t shell;
static char shell_buffer[512];
static char history_buffer[1024];
@ -55,8 +54,8 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
unique_id_get(&high_id, &mid_id, &low_id);
shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n"
"Compiled: " __DATE__ " at " __TIME__ "\r\n"
"Serial: %08X-%08X-%08X", high_id, mid_id, low_id);
"Compiled: " __DATE__ " at " __TIME__ "\r\n"
"Serial: %08X-%08X-%08X", high_id, mid_id, low_id);
return SHELLMATTA_OK;
}
@ -234,48 +233,6 @@ static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
return SHELLMATTA_OK;
}
static shellmatta_retCode_t shell_cmd_pt1000_res_loop(const shellmatta_handle_t handle, const char *arguments,
uint32_t length)
{
char arg[20];
size_t arg_len;
int led_status = 0;
bool run_loop = true;
bool single_line = false;
const char *data;
size_t len;
unsigned int i;
arg_len = (sizeof(arg) < length ? sizeof(arg) : length);
strncpy(arg, arguments, arg_len);
if (strstr(arg, "--single-line"))
single_line = true;
shellmatta_printf(handle, "\r\n");
while (run_loop) {
uart_receive_data_with_dma(&shell_uart, &data , &len);
for (i = 0; i < len; i++) {
if (data[i] == '\x03')
run_loop = false;
}
if (single_line)
shellmatta_printf(handle, "\x1b[1A\x1b[150D\x1b[K");
shell_cmd_pt1000_res(handle, "", 0UL);
led_set(0, led_status);
led_set(1, !led_status);
led_status ^= 0x1;
systick_wait_ms(150);
}
led_set(0, 0);
led_set(1, 0);
return SHELLMATTA_OK;
}
//typedef struct shellmatta_cmd
//{
// char *cmd; /**< command name */
@ -286,7 +243,7 @@ static shellmatta_retCode_t shell_cmd_pt1000_res_loop(const shellmatta_handle_t
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
//} shellmatta_cmd_t;
static shellmatta_cmd_t cmd[10] = {
static shellmatta_cmd_t cmd[9] = {
{
.cmd = "version",
.cmdAlias = "ver",
@ -303,21 +260,13 @@ static shellmatta_cmd_t cmd[10] = {
.cmdFct = shell_cmd_pt1000_res,
.next = &cmd[2],
},
{
.cmd = "pt1000-dump",
.cmdAlias = "ptdump",
.helpText = "Get current filtered and calibrated PT1000 resistance in a loop",
.usageText = "pt1000-dump [--single-line]",
.cmdFct = shell_cmd_pt1000_res_loop,
.next = &cmd[3],
},
{
.cmd = "pt1000-clear-error",
.cmdAlias = "pt-clear",
.helpText = "Clear error status of PT1000 reading",
.usageText = NULL,
.cmdFct = shell_cmd_clear_error_status,
.next = &cmd[4],
.next = &cmd[3],
},
{
.cmd = "digio-get",
@ -325,7 +274,7 @@ static shellmatta_cmd_t cmd[10] = {
.helpText = "Read all digital input/output ports",
.usageText = NULL,
.cmdFct = shell_cmd_digio_get,
.next = &cmd[5],
.next = &cmd[4],
},
{
.cmd = "digio-set",
@ -333,7 +282,7 @@ static shellmatta_cmd_t cmd[10] = {
.helpText = "Set DIGIO Port",
.usageText = "digio-set <num> <state>",
.cmdFct = shell_cmd_digio_set,
.next = &cmd[6],
.next = &cmd[5],
},
{
.cmd = "uptime",
@ -341,7 +290,7 @@ static shellmatta_cmd_t cmd[10] = {
.helpText = "Get uptime in seconds",
.usageText = "",
.cmdFct = shell_cmd_uptime,
.next = &cmd[7],
.next = &cmd[6],
},
{
.cmd = "calibrate",
@ -349,7 +298,7 @@ static shellmatta_cmd_t cmd[10] = {
.helpText = "Calibrate resistance measurement",
.usageText = "",
.cmdFct = shell_cmd_cal,
.next = &cmd[8],
.next = &cmd[7],
},
{
.cmd = "get-stack-pointer",
@ -357,7 +306,7 @@ static shellmatta_cmd_t cmd[10] = {
.helpText = "Get the stack pointer",
.usageText = "",
.cmdFct = shell_get_sp,
.next = &cmd[9],
.next = &cmd[8],
},
{
.cmd = "rotary-encoder",
@ -375,7 +324,7 @@ shellmatta_handle_t shell_init(shellmatta_write_t write_func)
shellmatta_retCode_t ret;
ret = shellmatta_doInit(&shell, &handle, shell_buffer, sizeof(shell_buffer), history_buffer, sizeof(history_buffer),
"\e[1;32mReflow Controller>\e[m ", cmd, write_func);
"\e[1;32mEnter command:\e[m\r\n", cmd, write_func);
if (ret != SHELLMATTA_OK)
handle = NULL;