Skip to content

Commit

Permalink
cancel timer if already running
Browse files Browse the repository at this point in the history
  • Loading branch information
vegano1 committed Jan 18, 2024
1 parent 96b5eb7 commit 1b1997f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/hepa-uv/core/uv_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ class UVMessageHandler {
if (door_closed && reed_switch_set && uv_push_button) {
gpio::set(drive_pins.uv_on_off);
// start the turn off timer
if (_timer.is_running()) _timer.stop();
_timer.start();
uv_fan_on = true;
} else {
gpio::reset(drive_pins.uv_on_off);
_timer.stop();
if (_timer.is_running()) _timer.stop();
uv_fan_on = false;
}

Expand Down

0 comments on commit 1b1997f

Please sign in to comment.