From 6f4f01a872006388d38278215248dbc33897f854 Mon Sep 17 00:00:00 2001
From: Malaurie Bernard <mbernard@kinouby>
Date: Fri, 28 Jul 2023 12:48:44 +0200
Subject: [PATCH] Adding code so the motor turns in function of the clockwise
 equals push attribute

---
 syringefilled.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/syringefilled.cpp b/syringefilled.cpp
index b278c73..a643495 100644
--- a/syringefilled.cpp
+++ b/syringefilled.cpp
@@ -186,11 +186,11 @@ void SyringeFilled :: start_exchange()
     
     if (get_push()) //If we want to deliver some liquid
     {
-        move_mm_limit_switch(exchange_volume_mm3/section_mm2);
+        move_mm_limit_switch(_clockwise_equals_push? exchange_volume_mm3/section_mm2: -exchange_volume_mm3/section_mm2);
     }
     else //If we want to recover some liquid
     {
-        move_to_mm_limit_switch(exchange_volume_mm3/section_mm2);
+        move_to_mm_limit_switch(_clockwise_equals_push? -exchange_volume_mm3/section_mm2: exchange_volume_mm3/section_mm2);
     }
     
 
@@ -213,7 +213,7 @@ void SyringeFilled :: go_to_zero()
     {
     set_speed_mm_per_sec(-1);
     reset_position();
-    move_to_mm_limit_switch(-200);
+    move_to_mm_limit_switch(_clockwise_equals_push? -200: 200);
     }
 
 }
@@ -264,7 +264,7 @@ if (get_emergency())
         Serial.printf("EMERGENCY: running away slowly\n");
         set_speed_mm_per_sec(-1);
         reset_position();
-        move_to_mm_limit_switch(200);
+        move_to_mm_limit_switch(_clockwise_equals_push? 200: -200);
     }
 
 }
-- 
GitLab