From: Lukáš Jiřiště Date: Tue, 12 Nov 2024 07:57:56 +0000 (+0100) Subject: Rename measure_until to wait_for_equilibrium X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=279f920a965e4213630fd93dfbc9542b2b1a0f2f;p=Servomatic.git Rename measure_until to wait_for_equilibrium --- 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); } }