Merge branch 'dev' into ui
This commit is contained in:
		@@ -37,6 +37,7 @@
 | 
			
		||||
#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];
 | 
			
		||||
@@ -54,8 +55,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,6 +235,46 @@ 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;
 | 
			
		||||
 | 
			
		||||
	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                           */
 | 
			
		||||
@@ -244,7 +285,7 @@ static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t   handle,
 | 
			
		||||
//    struct shellmatta_cmd   *next;      /**< pointer to next command or NULL        */
 | 
			
		||||
//} shellmatta_cmd_t;
 | 
			
		||||
 | 
			
		||||
static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
static shellmatta_cmd_t cmd[10] = {
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "version",
 | 
			
		||||
		.cmdAlias = "ver",
 | 
			
		||||
@@ -261,13 +302,21 @@ static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
		.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[3],
 | 
			
		||||
		.next = &cmd[4],
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "digio-get",
 | 
			
		||||
@@ -275,7 +324,7 @@ static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
		.helpText = "Read all digital input/output ports",
 | 
			
		||||
		.usageText = NULL,
 | 
			
		||||
		.cmdFct = shell_cmd_digio_get,
 | 
			
		||||
		.next = &cmd[4],
 | 
			
		||||
		.next = &cmd[5],
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "digio-set",
 | 
			
		||||
@@ -283,7 +332,7 @@ static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
		.helpText = "Set DIGIO Port",
 | 
			
		||||
		.usageText = "digio-set <num> <state>",
 | 
			
		||||
		.cmdFct = shell_cmd_digio_set,
 | 
			
		||||
		.next = &cmd[5],
 | 
			
		||||
		.next = &cmd[6],
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "uptime",
 | 
			
		||||
@@ -291,7 +340,7 @@ static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
		.helpText = "Get uptime in seconds",
 | 
			
		||||
		.usageText = "",
 | 
			
		||||
		.cmdFct = shell_cmd_uptime,
 | 
			
		||||
		.next = &cmd[6],
 | 
			
		||||
		.next = &cmd[7],
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "calibrate",
 | 
			
		||||
@@ -299,7 +348,7 @@ static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
		.helpText = "Calibrate resistance measurement",
 | 
			
		||||
		.usageText = "",
 | 
			
		||||
		.cmdFct = shell_cmd_cal,
 | 
			
		||||
		.next = &cmd[7],
 | 
			
		||||
		.next = &cmd[8],
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "get-stack-pointer",
 | 
			
		||||
@@ -307,7 +356,7 @@ static shellmatta_cmd_t cmd[9] = {
 | 
			
		||||
		.helpText = "Get the stack pointer",
 | 
			
		||||
		.usageText = "",
 | 
			
		||||
		.cmdFct = shell_get_sp,
 | 
			
		||||
		.next = &cmd[8],
 | 
			
		||||
		.next = &cmd[9],
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		.cmd = "rotary-encoder",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user