From 4677a4b1a25529e7a2aee027fccbaed3ba0db2da Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:04:07 -0400 Subject: [PATCH 1/3] send warning when door/reed state change --- include/bootloader/core/ids.h | 2 ++ include/can/core/ids.hpp | 2 ++ include/hepa-uv/core/uv_task.hpp | 17 ++++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/bootloader/core/ids.h b/include/bootloader/core/ids.h index 76f61f012..e51d6cbb6 100644 --- a/include/bootloader/core/ids.h +++ b/include/bootloader/core/ids.h @@ -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. */ diff --git a/include/can/core/ids.hpp b/include/can/core/ids.hpp index 552bcc3ac..db884f803 100644 --- a/include/can/core/ids.hpp +++ b/include/can/core/ids.hpp @@ -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. */ diff --git a/include/hepa-uv/core/uv_task.hpp b/include/hepa-uv/core/uv_task.hpp index b0185bb0c..724ad11c2 100644 --- a/include/hepa-uv/core/uv_task.hpp +++ b/include/hepa-uv/core/uv_task.hpp @@ -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::warning, + .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; From b11fd3d19e8c6ff13bc197dd5c923ac596e7a646 Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:25:32 -0400 Subject: [PATCH 2/3] make unrecoverable until further notice --- include/hepa-uv/core/uv_task.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hepa-uv/core/uv_task.hpp b/include/hepa-uv/core/uv_task.hpp index 724ad11c2..dd7ab3396 100644 --- a/include/hepa-uv/core/uv_task.hpp +++ b/include/hepa-uv/core/uv_task.hpp @@ -105,7 +105,7 @@ class UVMessageHandler { // is on auto resp = can::messages::ErrorMessage{ .message_index = 0, - .severity = can::ids::ErrorSeverity::warning, + .severity = can::ids::ErrorSeverity::unrecoverable, .error_code = !door_closed ? can::ids::ErrorCode::door_open : can::ids::ErrorCode::reed_open, }; From f9c5e87300d9512ac6f5b3287c55ea1f810836cc Mon Sep 17 00:00:00 2001 From: vegano1 Date: Mon, 18 Mar 2024 22:48:17 -0400 Subject: [PATCH 3/3] fix(hepa-uv): Set the UV pushbutton status led correctly. --- include/hepa-uv/core/uv_task.hpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/hepa-uv/core/uv_task.hpp b/include/hepa-uv/core/uv_task.hpp index dd7ab3396..81981809b 100644 --- a/include/hepa-uv/core/uv_task.hpp +++ b/include/hepa-uv/core/uv_task.hpp @@ -101,9 +101,9 @@ class UVMessageHandler { 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{ + // 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 @@ -111,10 +111,14 @@ class UVMessageHandler { }; 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)); + // Set the push button LED's to user intervention (blue) when + // attempting to turn on the uv light while the door is opened or + // reed switch is not set. + if (light_on) { + led_control_client.send_led_control_message( + led_control_task_messages::PushButtonLED(UV_BUTTON, 0, 0, + 50, 0)); + } uv_push_button = false; uv_light_on = false; return;