From c8c6f0145b333c1f57f555e50bacab1e7d874325 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Mon, 25 Nov 2024 11:54:18 +0100 Subject: [PATCH] Add close_open_clean method to Valve This function repeatedly closes and opens the valve. This is meant to ensure the volumes of the valve to properly equilibrate. --- Valve.h | 1 + Valve.ino | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Valve.h b/Valve.h index be9dab2..07051f1 100644 --- a/Valve.h +++ b/Valve.h @@ -28,5 +28,6 @@ class Valve void open(float seconds = 5); void close(float seconds = 5); + void close_open_clean(unsigned int count = 3); }; #endif // VALVE_H diff --git a/Valve.ino b/Valve.ino index ba64d27..35e729d 100644 --- a/Valve.ino +++ b/Valve.ino @@ -60,3 +60,15 @@ void Valve::update_pos() { m_servo.writeMicroseconds(m_usec_current); } + +void Valve::close_open_clean(unsigned int count) +{ + while (count > 0) + { + close(3); + delay(500); + open(3); + delay(500); + --count; + } +} -- 2.30.2