Add reset-cal shell command and modify cal command to show existing calibration
This commit is contained in:
parent
d176389711
commit
37bc397e9a
@ -189,12 +189,17 @@ shellmatta_retCode_t calibration_sequence_shell_cmd(shellmatta_handle_t shell, c
|
|||||||
static volatile int flag;
|
static volatile int flag;
|
||||||
char *stdin_data;
|
char *stdin_data;
|
||||||
uint32_t stdin_len;
|
uint32_t stdin_len;
|
||||||
|
bool cal_active;
|
||||||
|
|
||||||
switch (cal_state) {
|
switch (cal_state) {
|
||||||
case CAL_START:
|
case CAL_START:
|
||||||
/* Clear errors of PT1000 reading */
|
/* Clear errors of PT1000 reading */
|
||||||
safety_controller_ack_flag(ERR_FLAG_MEAS_ADC_WATCHDOG);
|
safety_controller_ack_flag(ERR_FLAG_MEAS_ADC_WATCHDOG);
|
||||||
|
adc_pt1000_get_resistance_calibration(&offset, &sens_dev, &cal_active);
|
||||||
|
if (cal_active) {
|
||||||
|
shellmatta_printf(shell, "Already calibrated.\r\n\tOffset: %f\r\n\tSens: %f\r\n", offset, sens_dev);
|
||||||
|
shellmatta_printf(shell, "Press CTRL-C to abort new calibration.\r\n");
|
||||||
|
}
|
||||||
shellmatta_printf(shell, "Starting calibration: Insert 1000 Ohm calibration resistor and press ENTER\r\n");
|
shellmatta_printf(shell, "Starting calibration: Insert 1000 Ohm calibration resistor and press ENTER\r\n");
|
||||||
cal_state = CAL_WAIT_RES1;
|
cal_state = CAL_WAIT_RES1;
|
||||||
ret_val = SHELLMATTA_CONTINUE;
|
ret_val = SHELLMATTA_CONTINUE;
|
||||||
|
@ -648,6 +648,17 @@ static shellmatta_retCode_t shell_cmd_dump_safety_mem(const shellmatta_handle_t
|
|||||||
return SHELLMATTA_BUSY;
|
return SHELLMATTA_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shellmatta_retCode_t shell_cmd_reset_cal(const shellmatta_handle_t handle, const char *arguments, uint32_t length)
|
||||||
|
{
|
||||||
|
(void)handle;
|
||||||
|
(void)arguments;
|
||||||
|
(void)length;
|
||||||
|
|
||||||
|
adc_pt1000_set_resistance_calibration(0.0f, 0.0f, false);
|
||||||
|
|
||||||
|
return SHELLMATTA_OK;
|
||||||
|
}
|
||||||
|
|
||||||
//typedef struct shellmatta_cmd
|
//typedef struct shellmatta_cmd
|
||||||
//{
|
//{
|
||||||
// char *cmd; /**< command name */
|
// char *cmd; /**< command name */
|
||||||
@ -657,7 +668,7 @@ static shellmatta_retCode_t shell_cmd_dump_safety_mem(const shellmatta_handle_t
|
|||||||
// shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */
|
// shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */
|
||||||
// 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[18] = {
|
static shellmatta_cmd_t cmd[19] = {
|
||||||
{
|
{
|
||||||
.cmd = "version",
|
.cmd = "version",
|
||||||
.cmdAlias = "ver",
|
.cmdAlias = "ver",
|
||||||
@ -800,8 +811,16 @@ static shellmatta_cmd_t cmd[18] = {
|
|||||||
.helpText = "",
|
.helpText = "",
|
||||||
.usageText = "safety-mem-dump [output-file]",
|
.usageText = "safety-mem-dump [output-file]",
|
||||||
.cmdFct = shell_cmd_dump_safety_mem,
|
.cmdFct = shell_cmd_dump_safety_mem,
|
||||||
.next = NULL,
|
.next = &cmd[18],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.cmd = "reset-cal",
|
||||||
|
.cmdAlias = NULL,
|
||||||
|
.helpText = "Reset Calibration",
|
||||||
|
.usageText = "",
|
||||||
|
.cmdFct = shell_cmd_reset_cal,
|
||||||
|
.next = NULL,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
shellmatta_handle_t shell_init(shellmatta_write_t write_func)
|
shellmatta_handle_t shell_init(shellmatta_write_t write_func)
|
||||||
|
Loading…
Reference in New Issue
Block a user