From: Lukáš Jiřiště Date: Tue, 26 Nov 2024 10:07:34 +0000 (+0100) Subject: Put wake up sequence out of measurement loop X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=3ae275ee6a5f8b14a444421e9ab2e8fce42fecab;p=Servomatic.git 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. --- 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();