Fix ADC measurement to run at 1000 Hz and fix wrong error handling for PT1000 Watchdog. Add function for flags to shell
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
#include <fatfs/ff.h>
|
||||
#include <reflow-controller/stack-check.h>
|
||||
#include <reflow-controller/rotary-encoder.h>
|
||||
#include <reflow-controller/safety/safety-adc.h>
|
||||
#include <reflow-controller/safety/safety-controller.h>
|
||||
|
||||
#ifndef GIT_VER
|
||||
#define GIT_VER "VERSION NOT SET"
|
||||
@@ -59,8 +59,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");
|
||||
shellmatta_printf(handle, "Serial: %08X-%08X-%08X", high_id, mid_id, low_id);
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
@@ -339,11 +339,55 @@ static shellmatta_retCode_t shell_cmd_safety_adc(const shellmatta_handle_t handl
|
||||
{
|
||||
(void)length;
|
||||
(void)arguments;
|
||||
enum analog_monitor_status status_vref, status_temp;
|
||||
float vref, uc_temp;
|
||||
|
||||
shellmatta_printf(handle, "VREF:\t%8.2f\tmV\r\n", 2500.0f);
|
||||
shellmatta_printf(handle, "TEMP:\t%8.2f\tdeg. Celsius\r\n", 25.0f);
|
||||
status_vref = safety_controller_get_analog_mon_value(ERR_AMON_VREF, &vref);
|
||||
status_temp = safety_controller_get_analog_mon_value(ERR_AMON_UC_TEMP, &uc_temp);
|
||||
|
||||
shellmatta_printf(handle, "Errors:\t%X", 0);
|
||||
shellmatta_printf(handle, "VREF:\t%8.2f\tmV\r\n", vref);
|
||||
shellmatta_printf(handle, "TEMP:\t%8.2f\tdeg. Celsius\r\n", uc_temp);
|
||||
|
||||
if (status_temp != ANALOG_MONITOR_OK) {
|
||||
shellmatta_printf(handle, "TEMP channel error!\r\n");
|
||||
}
|
||||
if (status_vref != ANALOG_MONITOR_OK) {
|
||||
shellmatta_printf(handle, "VREF channel error!\r\n");
|
||||
}
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handle, const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)length;
|
||||
(void)arguments;
|
||||
uint32_t flag_count;
|
||||
uint32_t i;
|
||||
char name[64];
|
||||
bool flag;
|
||||
int status;
|
||||
|
||||
shellmatta_printf(handle, "Error flags\r\n"
|
||||
"-----------\r\n");
|
||||
|
||||
flag_count = safety_controller_get_flag_count();
|
||||
for (i = 0; i < flag_count; i++) {
|
||||
status = safety_controller_get_flag_name_by_index(i, name, sizeof(name));
|
||||
if (status) {
|
||||
shellmatta_printf(handle, "Error getting flag name %lu\r\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
status = safety_controller_get_flag_by_index(i, &flag, NULL);
|
||||
if (status) {
|
||||
shellmatta_printf(handle, "Error getting flag value %lu\r\n", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
shellmatta_printf(handle, "%2lu) %-20s\t[%s]\r\n", i+1, name, (flag ? "ERR" : "OK"));
|
||||
}
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
@@ -461,8 +505,16 @@ static shellmatta_cmd_t cmd[14] = {
|
||||
.helpText = "",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_safety_adc,
|
||||
.next = NULL,
|
||||
.next = &cmd[13],
|
||||
},
|
||||
{
|
||||
.cmd = "safety-flags",
|
||||
.cmdAlias = "flags",
|
||||
.helpText = "",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_read_flags,
|
||||
.next = NULL,
|
||||
}
|
||||
};
|
||||
|
||||
shellmatta_handle_t shell_init(shellmatta_write_t write_func)
|
||||
|
Reference in New Issue
Block a user