From a63a51004e946036a7fdb8739d188fd5eb3f815c Mon Sep 17 00:00:00 2001
From: Malaurie Bernard <mbernard@kinouby>
Date: Tue, 4 Jul 2023 14:06:41 +0200
Subject: [PATCH] Changing pousse-seringue.cpp to make it fit new class and
 methods.

---
 pousseseringue-arduino.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pousseseringue-arduino.cpp b/pousseseringue-arduino.cpp
index 1787a18..b87c4af 100644
--- a/pousseseringue-arduino.cpp
+++ b/pousseseringue-arduino.cpp
@@ -56,6 +56,7 @@ SSD1306AsciiWire oled;
 #include "motor.h"
 #include "Debouncer.h"          // local, debouncer, short counter, long detector
 #include "syringe.h"
+#include "syringefilled.h"
 #include "cli.h"
 #include "common.h"
 #include "fs.h"
@@ -88,8 +89,8 @@ float stepsPerSeconds2rpm () { return 60.0 * stepsPerSeconds / (MOTOR_STEPS * MI
 int rpming = 0; // -1, 0 or +1
 
 // single syringe global instance
-Syringe syringe(stepper);
-Cli console(syringe);
+SyringeFilled syringefilled(stepper);
+Cli console(syringe_filled);
 
 const char* oledMode ()
 {
@@ -178,7 +179,7 @@ void buttons (int shortp, int longp)
     // log debug on serial console
     Serial.printf("button change: short:%d long:%d\n", shortp, longp);
 
-    syringe.stop();
+    syringe_filled.stop();
 
 	auto oldrpming = rpming;
     rpming = 0; // anything stops rpming
@@ -272,7 +273,7 @@ void setup()
     oled.println("Booting...\n");
 
     //syringe.setPhysical(MOTOR_STEPS * MICROSTEPS_CONF, M4_MMREV, /*forwardClockWise*/true, /*emergencySensorBehind*/false);
-    syringe.setPhysical(MOTOR_STEPS * MICROSTEPS_CONF, M5_MMREV, /*forwardClockWise*/false, /*emergencySensorBehind*/true);
+    syringe_filled.setPhysical(MOTOR_STEPS * MICROSTEPS_CONF, M5_MMREV, /*forwardClockWise*/false);
 
     pinMode(SLEEP, OUTPUT);
     digitalWrite(SLEEP, 0);
@@ -354,7 +355,7 @@ void loop()
 {
     if (bEmergency.update(digitalRead(COURSE)))
     {
-        syringe.manageEmergency(bEmergency.pressed(), !!stepper.distanceToGo());
+        syringefilled.manage_emergency(bEmergency.pressed(), !!stepper.distanceToGo());
         Serial.printf("%sEmergency=%u (remaining steps = %lu)\n", msgHeader, bEmergency.pressed(), stepper.distanceToGo());
     }
 
-- 
GitLab