From 279f920a965e4213630fd93dfbc9542b2b1a0f2f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Tue, 12 Nov 2024 08:57:56 +0100 Subject: [PATCH] Rename measure_until to wait_for_equilibrium --- Measurement.h | 2 +- Measurement.ino | 2 +- Servomatic.ino | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Measurement.h b/Measurement.h index d5b27d4..85a32ea 100644 --- a/Measurement.h +++ b/Measurement.h @@ -33,7 +33,7 @@ class Measurement void get_measurement(); void thin_out(); void clear(); - void measure_until(float threshold = 0.01); + void wait_for_equilibrium(float threshold = 0.01); }; #endif // MEASUREMENT_H diff --git a/Measurement.ino b/Measurement.ino index 3fe75c2..b882ade 100644 --- a/Measurement.ino +++ b/Measurement.ino @@ -66,7 +66,7 @@ void Measurement::clear() // Using this we can then numerically optimize p_e. Interval halving is used // because it is foolproof, the precision needed is low and the evaluation is // not computationally demanding. -void Measurement::measure_until(float threshold = 0.01) +void Measurement::wait_for_equilibrium(float threshold = 0.01) { while (m_size < 20 || threshold < calc_equilibrium_dist()) { diff --git a/Servomatic.ino b/Servomatic.ino index 2f721e8..697f4ac 100644 --- a/Servomatic.ino +++ b/Servomatic.ino @@ -1,5 +1,6 @@ #include "PressureSensor.h" #include "Valve.h" +#include "Measurement.h" static const int PRESSURE_SENSOR1_PIN = A1; static const int PRESSURE_SENSOR2_PIN = A2; @@ -29,9 +30,7 @@ void main_loop() while (1) { - measurement.measure_until(); - test_valve.open(10); - measurement.measure_until(); - test_valve.close(100); + measurement.wait_for_equilibrium(); + delay(10000); } } -- 2.30.2