Skip to content

Commit

Permalink
fix(hepa-uv): assume safety relay pin is true for rev b boards withou…
Browse files Browse the repository at this point in the history
…t a safety relay. (#809)
  • Loading branch information
vegano1 authored Oct 11, 2024
1 parent d0285bd commit 79df497
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions include/hepa-uv/core/uv_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ class UVMessageHandler {

// Helper to update safety relay state
void update_safety_relay_state() {
if (drive_pins.safety_relay_active.has_value())
if (drive_pins.safety_relay_active.has_value()) {
safety_relay_active =
gpio::is_set(drive_pins.safety_relay_active.value());
} else {
// rev b1 units have no safety relay so always return true.
safety_relay_active = true;
}
}

void visit(const std::monostate &) {}
Expand Down Expand Up @@ -149,9 +153,10 @@ class UVMessageHandler {
return;
}

// The safety relay needs to be active (Door Closed, Reed Switch set, and
// Push Button pressed) in order to turn on the UV Light. So Send an
// error if the safety relay is not active when trying to turn on the light.
// The safety relay needs to be active (Door Closed, Reed Switch set,
// and Push Button pressed) in order to turn on the UV Light. So Send an
// error if the safety relay is not active when trying to turn on the
// light.
update_safety_relay_state();
if (light_on && !safety_relay_active) {
if (_timer.is_running()) _timer.stop();
Expand Down

0 comments on commit 79df497

Please sign in to comment.