Compare commits
No commits in common. "fe51c8024813faa2262ac71496feed5175a13746" and "122a16ad4ec3c14212f52d15a60a39bc95690c27" have entirely different histories.
fe51c80248
...
122a16ad4e
@ -132,7 +132,7 @@ static bool mount_sd_card_if_avail(bool mounted)
|
|||||||
|
|
||||||
const char *oven_controller_hello_world = "Hello world :)\n";
|
const char *oven_controller_hello_world = "Hello world :)\n";
|
||||||
static volatile enum button_state button;
|
static volatile enum button_state button;
|
||||||
static volatile uint32_t main_loops_per_ms;
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
bool sd_card_mounted = false;
|
bool sd_card_mounted = false;
|
||||||
@ -142,9 +142,6 @@ int main()
|
|||||||
shellmatta_handle_t shell_handle;
|
shellmatta_handle_t shell_handle;
|
||||||
int uart_receive_status;
|
int uart_receive_status;
|
||||||
|
|
||||||
uint32_t main_loop_cnt = 0UL;
|
|
||||||
uint64_t ms_stamp = 0ULL;
|
|
||||||
|
|
||||||
static struct pid_controller pid;
|
static struct pid_controller pid;
|
||||||
uint64_t pid_timestamp = 0;
|
uint64_t pid_timestamp = 0;
|
||||||
|
|
||||||
@ -176,11 +173,7 @@ int main()
|
|||||||
pid_zero(&pid);
|
pid_zero(&pid);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (systick_get_global_tick() - ms_stamp >= 1) {
|
|
||||||
ms_stamp = systick_get_global_tick();
|
|
||||||
main_loops_per_ms = main_loop_cnt;
|
|
||||||
main_loop_cnt = 0UL;
|
|
||||||
}
|
|
||||||
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
|
sd_card_mounted = mount_sd_card_if_avail(sd_card_mounted);
|
||||||
|
|
||||||
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
||||||
@ -198,8 +191,6 @@ int main()
|
|||||||
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
|
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
|
||||||
if (uart_receive_status >= 1)
|
if (uart_receive_status >= 1)
|
||||||
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
shell_handle_input(shell_handle, uart_input, uart_input_len);
|
||||||
|
|
||||||
main_loop_cnt++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -330,49 +330,6 @@ static shellmatta_retCode_t shell_cmd_reset(const shellmatta_handle_t handle, co
|
|||||||
|
|
||||||
return SHELLMATTA_BUSY;
|
return SHELLMATTA_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static shellmatta_retCode_t shell_cmd_cat(const shellmatta_handle_t handle, const char *arguments,
|
|
||||||
uint32_t length)
|
|
||||||
{
|
|
||||||
FIL file;
|
|
||||||
char path_buff[256];
|
|
||||||
const char *path;
|
|
||||||
UINT bytes_read;
|
|
||||||
FRESULT res;
|
|
||||||
|
|
||||||
strncpy(path_buff, arguments, MIN(sizeof(path_buff), length));
|
|
||||||
path_buff[MIN(length, sizeof(path_buff)-1)] = 0;
|
|
||||||
path = strtok(path_buff, " ");
|
|
||||||
path = strtok(NULL, " ");
|
|
||||||
|
|
||||||
if (strlen(path) == 0) {
|
|
||||||
shellmatta_printf(handle, "Specify path!\r\n");
|
|
||||||
return SHELLMATTA_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = f_open(&file, path, FA_READ);
|
|
||||||
if (res == FR_OK) {
|
|
||||||
shellmatta_write(handle, "\r\n", 2U);
|
|
||||||
do {
|
|
||||||
res = f_read(&file, path_buff, sizeof(path_buff), &bytes_read);
|
|
||||||
if (bytes_read > 0)
|
|
||||||
shellmatta_write(handle, path_buff, bytes_read);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
} while (res == FR_OK);
|
|
||||||
|
|
||||||
shellmatta_write(handle, "\r\n", 2U);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res != FR_OK) {
|
|
||||||
shellmatta_printf(handle, "Error reading file\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
f_close(&file);
|
|
||||||
|
|
||||||
return SHELLMATTA_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//typedef struct shellmatta_cmd
|
//typedef struct shellmatta_cmd
|
||||||
//{
|
//{
|
||||||
// char *cmd; /**< command name */
|
// char *cmd; /**< command name */
|
||||||
@ -383,7 +340,7 @@ static shellmatta_retCode_t shell_cmd_cat(const shellmatta_handle_t handle, cons
|
|||||||
// 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[13] = {
|
static shellmatta_cmd_t cmd[12] = {
|
||||||
{
|
{
|
||||||
.cmd = "version",
|
.cmd = "version",
|
||||||
.cmdAlias = "ver",
|
.cmdAlias = "ver",
|
||||||
@ -476,16 +433,8 @@ static shellmatta_cmd_t cmd[13] = {
|
|||||||
.cmd = "reset",
|
.cmd = "reset",
|
||||||
.cmdAlias = NULL,
|
.cmdAlias = NULL,
|
||||||
.helpText = "Reset controller",
|
.helpText = "Reset controller",
|
||||||
.usageText = "reset",
|
.usageText = "Resets the controller",
|
||||||
.cmdFct = shell_cmd_reset,
|
.cmdFct = shell_cmd_reset,
|
||||||
.next = &cmd[12],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.cmd = "cat",
|
|
||||||
.cmdAlias = NULL,
|
|
||||||
.helpText = "Print file contents",
|
|
||||||
.usageText = "cat <path>",
|
|
||||||
.cmdFct = shell_cmd_cat,
|
|
||||||
.next = NULL,
|
.next = NULL,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,9 +455,7 @@ shellmatta_handle_t shell_init(shellmatta_write_t write_func)
|
|||||||
|
|
||||||
void shell_print_motd(shellmatta_handle_t shell)
|
void shell_print_motd(shellmatta_handle_t shell)
|
||||||
{
|
{
|
||||||
/* Clear display and set cursor to home position */
|
shellmatta_printf(shell, "\r\nShimatta 仕舞った Reflow Controller ready\r\n\r\n");
|
||||||
shellmatta_printf(shell, "\e[2J\e[H");
|
|
||||||
shellmatta_printf(shell, "Shimatta 仕舞った Reflow Controller ready\r\n\r\n");
|
|
||||||
shell_cmd_ver(shell, NULL, 0UL);
|
shell_cmd_ver(shell, NULL, 0UL);
|
||||||
shell_handle_input(shell, "\r\n", 2UL);
|
shell_handle_input(shell, "\r\n", 2UL);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user