From 3ae275ee6a5f8b14a444421e9ab2e8fce42fecab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Tue, 26 Nov 2024 11:07:34 +0100 Subject: [PATCH] Put wake up sequence out of measurement loop Before this change the long evacuation would happen every time the program switched from desorption to absorption measurement. Now it only happens when turned on. --- Servomatic.ino | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Servomatic.ino b/Servomatic.ino index 01787b6..7e59678 100644 --- a/Servomatic.ino +++ b/Servomatic.ino @@ -51,19 +51,20 @@ void main_loop() gas_threeway_valve.open(); while (1) { + if (!interrupt_happened && digitalRead(SWITCH_PIN) == HIGH) + // aparature initialization - valve positioning, evacuation + vacuum_valve.open(); + gas_threeway_valve.open(); + cell_valve.open_barely(); + delay(CELL_BARELY_OPEN_EQUILIBRATION_MS); + cell_valve.open(); + cell_valve.close_open_clean(); + vacuum_valve.close_open_clean(); + interruptable_delay(EVACUATION_LONG_MS); + vacuum_valve.close(); + cell_valve.close(); while (!interrupt_happened && digitalRead(SWITCH_PIN) == HIGH) { - // aparature initialization - valve positioning, evacuation - vacuum_valve.open(); - gas_threeway_valve.open(); - cell_valve.open_barely(); - delay(CELL_BARELY_OPEN_EQUILIBRATION_MS); - cell_valve.open(); - cell_valve.close_open_clean(); - vacuum_valve.close_open_clean(); - interruptable_delay(EVACUATION_LONG_MS); - vacuum_valve.close(); - cell_valve.close(); while (!interrupt_happened && sensor_1.get_pressure() < MEASUREMENT_UPPER_LIMIT) { @@ -72,8 +73,6 @@ void main_loop() cell_valve.open_barely(); delay(CELL_BARELY_OPEN_EQUILIBRATION_MS); cell_valve.open(); - measurement.get_measurement(); - cell_valve.close_open_clean(); measurement.wait_for_equilibrium(0.01); measurement.clear(); cell_valve.close(); @@ -89,8 +88,6 @@ void main_loop() cell_valve.open_barely(); delay(CELL_BARELY_OPEN_EQUILIBRATION_MS); cell_valve.open(); - measurement.get_measurement(); - cell_valve.close_open_clean(); measurement.wait_for_equilibrium(0.01); measurement.clear(); cell_valve.close(); -- 2.30.2