From bfc446d82caa7505bf7bf104d9db2a09a8548a7c Mon Sep 17 00:00:00 2001
From: Malaurie Bernard <mbernard@kinouby>
Date: Fri, 28 Jul 2023 11:15:04 +0200
Subject: [PATCH] Changing method move from syringe_filled to start_exchange to
 make it easier to use (and more adapted to our need now.

---
 syringefilled.cpp | 25 ++++++++-----------------
 syringefilled.h   |  2 +-
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/syringefilled.cpp b/syringefilled.cpp
index f65ccfc..b278c73 100644
--- a/syringefilled.cpp
+++ b/syringefilled.cpp
@@ -166,7 +166,7 @@ bool SyringeFilled :: is_running ()  //return true if the motor is currently run
     return motor_is_running();
 }
 
-void SyringeFilled :: move()
+void SyringeFilled :: start_exchange()
 /***
 -Argument : / (We're using informations stored in the class itself)
 -Return   : /
@@ -174,7 +174,6 @@ void SyringeFilled :: move()
 ***/
 {
     //Conversions of volumes
-    float remaining_volume_mm3 = get_remaining_volume_mL()*1000;
     float exchange_volume_mm3 = get_exchange_volume_mL()*1000;
 
     //Find the section
@@ -184,24 +183,16 @@ void SyringeFilled :: move()
 
     set_speed_mm_per_sec(get_exchange_throughput_uL_per_sec()/section_mm2);
 
-
-    if (where_step() == 0) //If we are putting the syringe for the first time
+    
+    if (get_push()) //If we want to deliver some liquid
     {
-        move_to_mm_limit_switch(get_syringe_pump_length_mm() - remaining_volume_mm3/section_mm2);
+        move_mm_limit_switch(exchange_volume_mm3/section_mm2);
     }
-    else 
+    else //If we want to recover some liquid
     {
-        float initial_position_mm = get_syringe_pump_length_mm() - remaining_volume_mm3/section_mm2;
-        
-        if (get_push()) //If we want to deliver some liquid
-        {
-            move_to_mm_limit_switch(initial_position_mm + exchange_volume_mm3/section_mm2);
-        }
-        else //If we want to recover some liquid
-        {
-            move_to_mm_limit_switch(initial_position_mm - exchange_volume_mm3/section_mm2);
-        }
-        }
+        move_to_mm_limit_switch(exchange_volume_mm3/section_mm2);
+    }
+    
 
 }
 
diff --git a/syringefilled.h b/syringefilled.h
index 4a5e224..e559d63 100644
--- a/syringefilled.h
+++ b/syringefilled.h
@@ -83,7 +83,7 @@ class SyringeFilled : public Motor
 
     //MOVEMENTS
     bool is_running ();
-    void move();
+    void start_exchange();
     void go_to_zero(); //CLI
 
     //LIMIT SWITCH
-- 
GitLab