From 087764bddee14af7ac885eee8efbbc47afc585e1 Mon Sep 17 00:00:00 2001
From: Malaurie Bernard <mbernard@kinouby>
Date: Thu, 24 Aug 2023 11:13:03 +0200
Subject: [PATCH] Caging the clockwise_equals_push to clockwise_equals_forward
 and adapt fast/slow forward/backward bbutton for them to really work with
 this new feature

---
 web.cpp | 49 +++++++++++++++++--------------------------------
 web.h   |  2 +-
 2 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/web.cpp b/web.cpp
index 53b7613..a13a285 100644
--- a/web.cpp
+++ b/web.cpp
@@ -246,13 +246,12 @@ void Web :: fast_backward_callback (Control *sender, int type)
 
         digitalWrite(SLEEP, LOW);
 
-        syringe_filled.move_to_mm(syringe_filled.get_clockwise_equals_push()? -50:50);
+        syringe_filled.move_to_mm(-50);
         syringe_filled.set_speed_mm_per_sec(50);
 
         break;
 
     case B_UP:
-        
         style_syringe_pump_off();
 
         motor_release_action();
@@ -278,18 +277,15 @@ void Web :: fast_forward_callback (Control *sender, int type)
 
         digitalWrite(SLEEP, LOW);
 
-        syringe_filled.move_to_mm(syringe_filled.get_clockwise_equals_push()? 50:-50);
+        syringe_filled.move_to_mm(50);
         syringe_filled.set_speed_mm_per_sec(50);
 
         break;
 
     case B_UP:
-        
         style_syringe_pump_off();
-        
         motor_release_action();
 
-
         break;
     }
 
@@ -308,19 +304,16 @@ void Web :: slow_backward_callback (Control *sender, int type)
     case B_DOWN:
 
         digitalWrite(SLEEP, LOW);
-            
-        syringe_filled.move_to_mm(syringe_filled.get_clockwise_equals_push()? -50:50);
+
+        syringe_filled.move_to_mm(-50);
         syringe_filled.set_speed_mm_per_sec(0.5);
 
         break;
 
     case B_UP:
-        
         style_syringe_pump_off();
-        
         motor_release_action();
 
-
         break;
     }
 
@@ -340,21 +333,18 @@ void Web :: slow_forward_callback (Control *sender, int type)
     case B_DOWN:
 
         digitalWrite(SLEEP, LOW);
-            
-        syringe_filled.move_to_mm(syringe_filled.get_clockwise_equals_push()? 50:-50);
+
+        syringe_filled.move_to_mm(50);
         syringe_filled.set_speed_mm_per_sec(0.5);
 
         break;
 
     case B_UP:
-        
         style_syringe_pump_off();
-        
         motor_release_action();
 
         break;
     }
-    
     serial_print ("Slow_forward", sender);
 }
 
@@ -684,34 +674,33 @@ void Web :: syringe_pump_length_mm_callback(Control* sender, int type)
     Serial.println("");
 }
 
-void Web :: clockwise_equals_push_callback(Control* sender, int value)
+void Web :: clockwise_equals_forward_callback(Control* sender, int value)
 /***
 -Argument : Pointer to the controller calling the function, integer according to the controller type.
 -Return   : /
 -Action   : Print the value of the convention chosen via the serial port.
-            Change the clockwise_equals_push_label to display the information.
+            Change the clockwise_equals_forward_label to display the information.
 ***/
 {
     switch (value)
     {
     case S_ACTIVE:
-        syringe_filled.set_clockwise_equals_push(true);
-        ESPUI.print(clockwise_equals_push_label, "Horaire = Injection");
+        syringe_filled.set_clockwise_equals_forward(true);
+        ESPUI.print(clockwise_equals_forward_label, "Horaire = Injection");
         syringe_filled.save_json();
-        
         break;
 
     case S_INACTIVE:
-        syringe_filled.set_clockwise_equals_push(false);
-        ESPUI.print(clockwise_equals_push_label, "Horaire = Aspiration");
+        syringe_filled.set_clockwise_equals_forward(false);
+        ESPUI.print(clockwise_equals_forward_label, "Horaire = Aspiration");
         syringe_filled.save_json();
         break;
     }
 
-    serial_print ("clockwise_equals_push (sender->value)", sender);
+    serial_print ("clockwise_equals_forward (sender->value)", sender);
 
-    Serial.println("clockwise_equals_push (json value)");
-    Serial.println(String("Value: ") + String(syringe_filled.get_clockwise_equals_push()));
+    Serial.println("clockwise_equals_forward (json value)");
+    Serial.println(String("Value: ") + String(syringe_filled.get_clockwise_equals_forward()));
     Serial.println("");
 }
 
@@ -893,20 +882,16 @@ void Web :: set_initial_style()
 
 
 
-    
-
-
     //features
     style (syringe_pump_length_mm_value, 3);
     style (lead_screw_pitch_mm, 3);
-    style (clockwise_equals_push_label, 3);
-    style (clockwise_equals_push, 3);
+    style (clockwise_equals_forward_label, 3);
+    style (clockwise_equals_forward, 3);
     style (microstep_configuration, 3);
     style (motor_steps, 3);
     style (motor_release_label, 3);
     style (motor_release, 3);
 
-
     //
     style (syringe_selection, 3);
 
diff --git a/web.h b/web.h
index 647457f..0a21996 100644
--- a/web.h
+++ b/web.h
@@ -112,7 +112,7 @@ uint16_t get_id_status_limit_switch();
 
 //features : Configurations avancées
  void syringe_pump_length_mm_callback(Control* sender, int type);
- void clockwise_equals_push_callback(Control* sender, int value);
+ void clockwise_equals_forward_callback(Control* sender, int value);
  void microstep_configuration_callback(Control* sender, int type);
  void motor_steps_callback(Control* sender, int type);
  void motor_release_callback(Control* sender, int type);
-- 
GitLab