Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hepa-uv): add error code for door & reed state change during uv task #758

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/bootloader/core/ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ typedef enum {
can_errorcode_motor_busy = 0xb,
can_errorcode_stop_requested = 0xc,
can_errorcode_over_pressure = 0xd,
can_errorcode_door_open = 0xe,
can_errorcode_reed_open = 0xf,
} CANErrorCode;

/** Tool types detected on Head. */
Expand Down
2 changes: 2 additions & 0 deletions include/can/core/ids.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ enum class ErrorCode {
motor_busy = 0xb,
stop_requested = 0xc,
over_pressure = 0xd,
door_open = 0xe,
reed_open = 0xf,
};

/** Error Severity levels. */
Expand Down
17 changes: 14 additions & 3 deletions include/hepa-uv/core/uv_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,23 @@ class UVMessageHandler {
// reset push button state if the door is opened or the reed switch is
// not set
if (!door_closed || !reed_switch_set) {
gpio::reset(drive_pins.uv_on_off);
// Set the push button LED's to user intervention (blue)
if (_timer.is_running()) {
gpio::reset(drive_pins.uv_on_off);
_timer.stop();
// send error message when door/reed state change while uv
// is on
auto resp = can::messages::ErrorMessage{
.message_index = 0,
.severity = can::ids::ErrorSeverity::unrecoverable,
.error_code = !door_closed ? can::ids::ErrorCode::door_open
: can::ids::ErrorCode::reed_open,
};
can_client.send_can_message(can::ids::NodeId::host, resp);
}
led_control_client.send_led_control_message(
// Set the push button LED's to user intervention (blue)
led_control_task_messages::PushButtonLED(UV_BUTTON, 0, 0, 50,
0));
if (_timer.is_running()) _timer.stop();
uv_push_button = false;
uv_light_on = false;
return;
Expand Down
3 changes: 2 additions & 1 deletion include/motor-control/core/tasks/messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ using MotionControlTaskMessage = std::variant<
can::messages::MotorPositionRequest, can::messages::ReadLimitSwitchRequest,
can::messages::HomeRequest,
can::messages::UpdateMotorPositionEstimationRequest,
can::messages::GetMotorUsageRequest, can::messages::AddSensorMoveRequest>;
can::messages::GetMotorUsageRequest, can::messages::MotorStatusRequest,
can::messages::AddSensorMoveRequest>;

using MoveGroupTaskMessage =
std::variant<std::monostate, can::messages::AddLinearMoveRequest,
Expand Down
Loading