* Implement clear flags command for profile language.
This commit is contained in:
Mario Hüttel 2021-05-22 12:13:43 +02:00
parent bc5e4c14df
commit 0b1ce8b614
3 changed files with 25 additions and 1 deletions

View File

@ -41,7 +41,8 @@ static const struct pl_command_list_map cmd_list_map[_PL_NUM_CMDS] = {
{PL_WAIT_FOR_TIME, "wait_time", 1u}, {PL_WAIT_FOR_TIME, "wait_time", 1u},
{PL_SET_RAMP, "temp_ramp", 2u}, {PL_SET_RAMP, "temp_ramp", 2u},
{PL_LOUDSPEAKER_SET, "beep", 1u}, {PL_LOUDSPEAKER_SET, "beep", 1u},
{PL_OFF, "temp_off", 0u} {PL_OFF, "temp_off", 0u},
{PL_CLEAR_FLAGS, "clear_flags", 0u},
}; };
/** /**

View File

@ -32,6 +32,7 @@ enum pl_command_type {
PL_WAIT_FOR_TIME, PL_WAIT_FOR_TIME,
PL_LOUDSPEAKER_SET, PL_LOUDSPEAKER_SET,
PL_OFF, PL_OFF,
PL_CLEAR_FLAGS,
_PL_NUM_CMDS, _PL_NUM_CMDS,
}; };

View File

@ -26,6 +26,8 @@
#include <reflow-controller/adc-meas.h> #include <reflow-controller/adc-meas.h>
#include <reflow-controller/digio.h> #include <reflow-controller/digio.h>
#include <reflow-controller/safety/safety-controller.h>
static struct tpe_current_state IN_SECTION(.ccm.data) state = { static struct tpe_current_state IN_SECTION(.ccm.data) state = {
.status = TPE_OFF, .status = TPE_OFF,
.start_timestamp = 0, .start_timestamp = 0,
@ -161,6 +163,22 @@ static bool cmd_ramp(struct pl_command *cmd, bool cmd_continue)
return ret; return ret;
} }
static void cmd_ack_flags(void)
{
uint32_t flag_cnt;
uint32_t i;
enum safety_flag flag_enum;
bool status;
flag_cnt = safety_controller_get_flag_count();
for (i = 0; i < flag_cnt; i++) {
safety_controller_get_flag_by_index(i, &status, &flag_enum);
if (status)
(void)safety_controller_ack_flag(flag_enum);
}
}
int temp_profile_executer_handle(void) int temp_profile_executer_handle(void)
{ {
struct pl_command *current_cmd; struct pl_command *current_cmd;
@ -222,6 +240,10 @@ int temp_profile_executer_handle(void)
case PL_SET_RAMP: case PL_SET_RAMP:
advance = cmd_ramp(current_cmd, cmd_continue); advance = cmd_ramp(current_cmd, cmd_continue);
break; break;
case PL_CLEAR_FLAGS:
cmd_ack_flags();
advance = true;
break;
default: default:
tpe_abort(); tpe_abort();
advance = true; advance = true;