Rename measure_until to wait_for_equilibrium
authorLukáš Jiřiště <jiriste@icpf.cas.cz>
Tue, 12 Nov 2024 07:57:56 +0000 (08:57 +0100)
committerLukáš Jiřiště <jiriste@icpf.cas.cz>
Tue, 12 Nov 2024 07:57:56 +0000 (08:57 +0100)
Measurement.h
Measurement.ino
Servomatic.ino

index d5b27d4f7dd983f3334bb849630329dabc76fca2..85a32ea0feae241ca533d4f0044baf92de3929c0 100644 (file)
@@ -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
index 3fe75c20360c0fe2ceacdaaa2c9c7403e8698bfc..b882ade16d0565afb792eb4e61ab1f1c00a1832d 100644 (file)
@@ -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())
        {
index 2f721e84dea9457f865627857df8bd03c6b86f20..697f4acd8cb49f92241ee4162db9d2b7fff7c0ea 100644 (file)
@@ -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);
        }
 }