Add main cylcle counter and increase filter alpha for PT1000 to 0.01

This commit is contained in:
2021-08-19 21:25:04 +02:00
parent ffb544e21d
commit a802b5c1b5
6 changed files with 126 additions and 4 deletions

View File

@@ -27,6 +27,7 @@
#include <reflow-controller/digio.h>
#include <stdlib.h>
#include <malloc.h>
#include <inttypes.h>
#include <helper-macros/helper-macros.h>
#include <reflow-controller/systick.h>
#include <stm-periph/unique-id.h>
@@ -43,6 +44,7 @@
#include <reflow-controller/hw-version-detect.h>
#include <reflow-controller/temp-profile/temp-profile-executer.h>
#include <reflow-controller/updater/updater.h>
#include <reflow-controller/main-cycle-counter.h>
#ifndef GIT_VER
#define GIT_VER "VERSION NOT SET"
@@ -790,6 +792,43 @@ shellmatta_retCode_t shell_cmd_execute(const shellmatta_handle_t handle, const c
return SHELLMATTA_CONTINUE;
}
shellmatta_retCode_t shell_cmd_cycle_count (const shellmatta_handle_t handle, const char *args, uint32_t len)
{
uint64_t counter;
(void)args;
(void)len;
char option;
char *argument;
uint32_t arg_len;
int opt_stat;
bool clear = false;
const shellmatta_opt_long_t options[] = {
{"clear", 'c', SHELLMATTA_OPT_ARG_NONE},
{NULL, '\0', SHELLMATTA_OPT_ARG_NONE},
};
while (1) {
opt_stat = shellmatta_opt_long(handle, options, &option, &argument, &arg_len);
if (opt_stat != SHELLMATTA_OK)
break;
switch (option) {
case 'c':
clear = true;
break;
default:
break;
}
}
counter = main_cycle_counter_get();
shellmatta_printf(handle, "%"PRIu64"\r\n", counter);
if (clear)
main_cycle_counter_init();
return SHELLMATTA_OK;
}
//typedef struct shellmatta_cmd
//{
// char *cmd; /**< command name */
@@ -799,7 +838,7 @@ shellmatta_retCode_t shell_cmd_execute(const shellmatta_handle_t handle, const c
// shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
//} shellmatta_cmd_t;
static shellmatta_cmd_t cmd[21] = {
static shellmatta_cmd_t cmd[23] = {
{
.cmd = "version",
.cmdAlias = "ver",
@@ -967,8 +1006,16 @@ static shellmatta_cmd_t cmd[21] = {
.helpText = "Execute Temp Profile",
.usageText = "execute /path/to/script.tpr",
.cmdFct = shell_cmd_execute,
.next = &cmd[21],
},
{
.cmd = "cyclecount",
.cmdAlias = "cc",
.helpText = "Print out the cycle counter of the main loop",
.usageText = "cyclecount [--clear]",
.cmdFct = shell_cmd_cycle_count,
.next = NULL,
}
},
};
shellmatta_handle_t shell_init(shellmatta_write_t write_func)