From 921ea7909bb477a7ee14e629ad849acf5ff1b7c2 Mon Sep 17 00:00:00 2001
From: Malaurie Bernard <mbernard@kinouby>
Date: Fri, 28 Jul 2023 10:56:57 +0200
Subject: [PATCH] Add a button to confirm position(initialisation)

---
 web.cpp | 34 ++++++++++++++++++++++++++++++++++
 web.h   |  3 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/web.cpp b/web.cpp
index f57fdd2..bbf1eb6 100644
--- a/web.cpp
+++ b/web.cpp
@@ -38,6 +38,11 @@ void web_setup ()
     slow_forward = ESPUI.addControl(ControlType::Button, "Initialisation", "\u2BC8", ControlColor::None, fast_backward, slow_forward_callback);
     fast_forward =  ESPUI.addControl(ControlType::Button, "Initialisation", "\u2BC8 \u2BC8", ControlColor::None, fast_backward, fast_forward_callback);
 
+    confirm_initialisation = ESPUI.button("Valider l'initialisation", confirm_initialisation_callback, ControlColor::None, "\u2714");
+
+
+
+
     ESPUI.addControl(ControlType::Separator, "", "", ControlColor::None);
 
     //Exchange_values_wanted
@@ -329,6 +334,32 @@ void slow_forward_callback (Control *sender, int type)
     Serial.println("");
 }
 
+void confirm_initialisation_callback (Control *sender, int type) 
+/***
+-Argument : Pointer to the controller calling the function, integer according to the controller type.
+-Return   : /
+-Action   : 
+***/
+{
+    switch (type)
+    {
+    case B_DOWN:
+
+
+        break;
+
+    case B_UP:
+
+        break;
+    }
+    
+    Serial.println("confirm_initialisation");
+    Serial.println(String("Value: ") + String(sender->type));
+    Serial.println(String("ID: ") + sender->id);
+    Serial.println("");
+}
+
+
 void volume_exchange_mL_callback (Control* sender, int value, void* param)
 /***
 -Argument : Pointer to the controller calling the function, integer according to the controller type.
@@ -803,6 +834,9 @@ void set_init_style()
     style (slow_forward, 3);
     style (slow_backward, 3);
 
+    style (confirm_initialisation, 3);
+
+
     style (initial_volume_mL, 1);
     style (initial_volume_mL_label, 1);
     style (volume_exchange_mL_label, 1);
diff --git a/web.h b/web.h
index 0520114..2604e93 100644
--- a/web.h
+++ b/web.h
@@ -26,7 +26,7 @@ uint16_t syringe_filled_placement;
 
 int status_limit_switch;
 
-uint16_t calibration, fast_backward, fast_forward, slow_backward, slow_forward;
+uint16_t calibration, fast_backward, fast_forward, slow_backward, slow_forward, confirm_initialisation;
 
 uint16_t volume_exchange_mL_label, volume_exchange_mL, exchange_throughtput_uL_per_sec_label, exchange_throughtput_uL_per_sec, label_push_pull_choice, switch_push_pull_choice, start_exchange;
 
@@ -89,6 +89,7 @@ void fast_backward_callback (Control *sender, int type);
 void fast_forward_callback (Control *sender, int type);
 void slow_backward_callback (Control *sender, int type);
 void slow_forward_callback (Control *sender, int type);
+void confirm_initialisation_callback (Control *sender, int type);
 void volume_exchange_mL_callback (Control* sender, int value, void* param);
 void exchange_throughtput_uL_per_sec_callback (Control* sender, int value, void* param);
 void switch_push_pull_choice_callback (Control* sender, int value, void* param);
-- 
GitLab