Merge branch 'dev' into ui
This commit is contained in:
		@@ -30,7 +30,7 @@ CFILES += adc-meas.c
 | 
				
			|||||||
# Shellmatta
 | 
					# Shellmatta
 | 
				
			||||||
CFILES += shellmatta/src/shellmatta.c shellmatta/src/shellmatta_autocomplete.c shellmatta/src/shellmatta_escape.c shellmatta/src/shellmatta_history.c shellmatta/src/shellmatta_utils.c shellmatta/src/shellmatta_opt.c shell.c
 | 
					CFILES += shellmatta/src/shellmatta.c shellmatta/src/shellmatta_autocomplete.c shellmatta/src/shellmatta_escape.c shellmatta/src/shellmatta_history.c shellmatta/src/shellmatta_utils.c shellmatta/src/shellmatta_opt.c shell.c
 | 
				
			||||||
INCLUDEPATH += -Ishellmatta/api
 | 
					INCLUDEPATH += -Ishellmatta/api
 | 
				
			||||||
# DEFINES += -DSHELLMATTA_STRIP_PRINTF
 | 
					DEFINES += -DSHELLMATTA_HELP_ALIAS=\"?\"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# RCC Manager
 | 
					# RCC Manager
 | 
				
			||||||
CFILES += stm-periph/clock-enable-manager.c
 | 
					CFILES += stm-periph/clock-enable-manager.c
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -159,7 +159,7 @@ int calibration_sequence_shell_cmd(shellmatta_handle_t shell)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* Check noise values */
 | 
						/* Check noise values */
 | 
				
			||||||
	if (dev > CALIBRATION_MAX_PEAK_PEAK_NOISE_OHM || dev2 > CALIBRATION_MAX_PEAK_PEAK_NOISE_OHM) {
 | 
						if (dev > CALIBRATION_MAX_PEAK_PEAK_NOISE_OHM || dev2 > CALIBRATION_MAX_PEAK_PEAK_NOISE_OHM) {
 | 
				
			||||||
		shellmatta_printf(shell, "Calibration failed! Too much noise. Check you're hardware.\r\n");
 | 
							shellmatta_printf(shell, "Calibration failed! Too much noise. Check your hardware.\r\n");
 | 
				
			||||||
		return -3;
 | 
							return -3;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
#include <reflow-controller/adc-meas.h>
 | 
					#include <reflow-controller/adc-meas.h>
 | 
				
			||||||
#include <reflow-controller/digio.h>
 | 
					#include <reflow-controller/digio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <malloc.h>
 | 
				
			||||||
#include <helper-macros/helper-macros.h>
 | 
					#include <helper-macros/helper-macros.h>
 | 
				
			||||||
#include <reflow-controller/systick.h>
 | 
					#include <reflow-controller/systick.h>
 | 
				
			||||||
#include <stm-periph/unique-id.h>
 | 
					#include <stm-periph/unique-id.h>
 | 
				
			||||||
@@ -201,12 +202,13 @@ static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t   handle,
 | 
				
			|||||||
	return SHELLMATTA_OK;
 | 
						return SHELLMATTA_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t   handle,
 | 
					static shellmatta_retCode_t shell_meminfo(const shellmatta_handle_t   handle,
 | 
				
			||||||
					 const char                  *arguments,
 | 
										 const char                  *arguments,
 | 
				
			||||||
					 uint32_t length)
 | 
										 uint32_t length)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	(void)arguments;
 | 
						(void)arguments;
 | 
				
			||||||
	(void)length;
 | 
						(void)length;
 | 
				
			||||||
 | 
						struct mallinfo mi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	shellmatta_printf(handle,
 | 
						shellmatta_printf(handle,
 | 
				
			||||||
			  "Stack pointer: %p\r\n"
 | 
								  "Stack pointer: %p\r\n"
 | 
				
			||||||
@@ -215,6 +217,15 @@ static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t   handle,
 | 
				
			|||||||
			  read_stack_pointer(),
 | 
								  read_stack_pointer(),
 | 
				
			||||||
			  stack_check_get_usage(),
 | 
								  stack_check_get_usage(),
 | 
				
			||||||
			  stack_check_get_free());
 | 
								  stack_check_get_free());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						mi = mallinfo();
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "\r\nDynamic Memory Management\r\n");
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "Allocated bytes: %d\r\n", mi.arena, mi.arena);
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "Number of free chunks: %d\r\n", mi.ordblks);
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "Top-most, releasable space: %d\r\n", mi.keepcost);
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "Total free space: %d\r\n", mi.fordblks);
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "Total allocated space: %d\r\n", mi.uordblks);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return SHELLMATTA_OK;
 | 
						return SHELLMATTA_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -252,6 +263,8 @@ static shellmatta_retCode_t shell_cmd_pt1000_res_loop(const shellmatta_handle_t
 | 
				
			|||||||
	if (strstr(arg, "--single-line"))
 | 
						if (strstr(arg, "--single-line"))
 | 
				
			||||||
		single_line = true;
 | 
							single_line = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						shellmatta_printf(handle, "\r\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (run_loop) {
 | 
						while (run_loop) {
 | 
				
			||||||
		uart_receive_data_with_dma(&shell_uart, &data , &len);
 | 
							uart_receive_data_with_dma(&shell_uart, &data , &len);
 | 
				
			||||||
		for (i = 0; i < len; i++) {
 | 
							for (i = 0; i < len; i++) {
 | 
				
			||||||
@@ -351,11 +364,11 @@ static shellmatta_cmd_t cmd[10] = {
 | 
				
			|||||||
		.next = &cmd[8],
 | 
							.next = &cmd[8],
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		.cmd = "get-stack-pointer",
 | 
							.cmd = "meminfo",
 | 
				
			||||||
		.cmdAlias = "sp",
 | 
							.cmdAlias = NULL,
 | 
				
			||||||
		.helpText = "Get the stack pointer",
 | 
							.helpText = "Get information about memory usage",
 | 
				
			||||||
		.usageText = "",
 | 
							.usageText = "",
 | 
				
			||||||
		.cmdFct = shell_get_sp,
 | 
							.cmdFct = shell_meminfo,
 | 
				
			||||||
		.next = &cmd[9],
 | 
							.next = &cmd[9],
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -374,7 +387,7 @@ shellmatta_handle_t shell_init(shellmatta_write_t write_func)
 | 
				
			|||||||
	shellmatta_retCode_t ret;
 | 
						shellmatta_retCode_t ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = shellmatta_doInit(&shell, &handle, shell_buffer, sizeof(shell_buffer), history_buffer, sizeof(history_buffer),
 | 
						ret = shellmatta_doInit(&shell, &handle, shell_buffer, sizeof(shell_buffer), history_buffer, sizeof(history_buffer),
 | 
				
			||||||
				"\e[1;32mEnter command:\e[m\r\n", cmd, write_func);
 | 
									"\e[1;32mReflow Controller>\e[m ", cmd, write_func);
 | 
				
			||||||
	if (ret != SHELLMATTA_OK)
 | 
						if (ret != SHELLMATTA_OK)
 | 
				
			||||||
		handle = NULL;
 | 
							handle = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,6 +89,12 @@ int _write(int fd, const void *buf, int count)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (fd == 1)
 | 
						if (fd == 1)
 | 
				
			||||||
		uart_send_array_with_dma(&shell_uart, (char *)buf, count);
 | 
							uart_send_array_with_dma(&shell_uart, (char *)buf, count);
 | 
				
			||||||
 | 
						else if (fd == 2) {
 | 
				
			||||||
 | 
							uart_send_string_with_dma(&shell_uart, "\e[31m");
 | 
				
			||||||
 | 
							uart_send_array_with_dma(&shell_uart, (char *)buf, count);
 | 
				
			||||||
 | 
							uart_send_string_with_dma(&shell_uart, "\e[m");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return count;
 | 
						return count;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user