Skip to content
Snippets Groups Projects
Commit 494a7530 authored by Malaurie Bernard's avatar Malaurie Bernard
Browse files

Add a new attributes to syringe_flle (syringe_pump_length_mm)

parent 66e767d8
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
...@@ -18,6 +18,7 @@ SyringeFilled :: SyringeFilled (MotorHardware_t& stepper): Motor(stepper) ...@@ -18,6 +18,7 @@ SyringeFilled :: SyringeFilled (MotorHardware_t& stepper): Motor(stepper)
set_name_syringe("BD_10mL"); set_name_syringe("BD_10mL");
set_screw_thread_mm(4); set_screw_thread_mm(4);
set_clockwise_equals_push(true); set_clockwise_equals_push(true);
set_syringe_pump_length_mm(50);
set_emergency(false); set_emergency(false);
} }
...@@ -58,6 +59,11 @@ void SyringeFilled :: set_clockwise_equals_push(bool clockwise_equals_push) ...@@ -58,6 +59,11 @@ void SyringeFilled :: set_clockwise_equals_push(bool clockwise_equals_push)
syringe_filled_json["clockwise_equals_push"] = clockwise_equals_push; syringe_filled_json["clockwise_equals_push"] = clockwise_equals_push;
} }
void SyringeFilled :: set_syringe_pump_length_mm(float syringe_pump_length_mm)
{
syringe_filled_json["syringe_pump_length_mm"] = syringe_pump_length_mm;
}
void SyringeFilled :: set_emergency(bool emergency) void SyringeFilled :: set_emergency(bool emergency)
{ {
syringe_filled_json["emergency"] = emergency; syringe_filled_json["emergency"] = emergency;
...@@ -97,7 +103,12 @@ float SyringeFilled :: get_screw_thread_mm() ...@@ -97,7 +103,12 @@ float SyringeFilled :: get_screw_thread_mm()
bool SyringeFilled :: get_clockwise_equals_push() bool SyringeFilled :: get_clockwise_equals_push()
{ {
return syringe_filled_json["clockwise_equals_push"].as<float>(); return syringe_filled_json["clockwise_equals_push"].as<bool>();
}
float SyringeFilled :: get_syringe_pump_length_mm()
{
return syringe_filled_json["syringe_pump_length_mm"].as<float>();
} }
bool SyringeFilled :: get_emergency() bool SyringeFilled :: get_emergency()
...@@ -176,11 +187,11 @@ void SyringeFilled :: move() ...@@ -176,11 +187,11 @@ void SyringeFilled :: move()
if (where_step() == 0) //If we are putting the syringe for the first time if (where_step() == 0) //If we are putting the syringe for the first time
{ {
move_to_mm(syringe_pump_length_mm - remaining_volume_mm3/section_mm2); move_to_mm(get_syringe_pump_length_mm() - remaining_volume_mm3/section_mm2);
} }
else else
{ {
float initial_position_mm = syringe_pump_length_mm - remaining_volume_mm3/section_mm2; float initial_position_mm = get_syringe_pump_length_mm() - remaining_volume_mm3/section_mm2;
if (get_push()) //If we want to deliver some liquid if (get_push()) //If we want to deliver some liquid
{ {
......
...@@ -11,7 +11,6 @@ using InterruptLock = esp8266::InterruptLock; ...@@ -11,7 +11,6 @@ using InterruptLock = esp8266::InterruptLock;
#include "common.h" #include "common.h"
#define syringe_pump_length_mm 50
class SyringeFilled : public Motor class SyringeFilled : public Motor
{ {
...@@ -37,6 +36,7 @@ class SyringeFilled : public Motor ...@@ -37,6 +36,7 @@ class SyringeFilled : public Motor
//Syringe_Pump //Syringe_Pump
float _screw_thread_mm; float _screw_thread_mm;
bool _clockwise_equals_push; bool _clockwise_equals_push;
float _syringe_pump_length_mm;
//Limit_Switch //Limit_Switch
bool _emergency; bool _emergency;
...@@ -58,6 +58,7 @@ class SyringeFilled : public Motor ...@@ -58,6 +58,7 @@ class SyringeFilled : public Motor
void set_name_syringe(String name_syringe); void set_name_syringe(String name_syringe);
void set_screw_thread_mm(float screw_thread_mm); void set_screw_thread_mm(float screw_thread_mm);
void set_clockwise_equals_push(bool clockwise_equals_push); void set_clockwise_equals_push(bool clockwise_equals_push);
void set_syringe_pump_length_mm(float syringe_pump_length_mm);
void set_emergency(bool emergency); void set_emergency(bool emergency);
...@@ -69,6 +70,7 @@ class SyringeFilled : public Motor ...@@ -69,6 +70,7 @@ class SyringeFilled : public Motor
String get_name_syringe(); String get_name_syringe();
float get_screw_thread_mm(); float get_screw_thread_mm();
bool get_clockwise_equals_push(); bool get_clockwise_equals_push();
float get_syringe_pump_length_mm();
bool get_emergency(); bool get_emergency();
const StaticJsonDocument<200>& get_syringe_filled_data(); const StaticJsonDocument<200>& get_syringe_filled_data();
......
...@@ -109,7 +109,7 @@ void web_setup () ...@@ -109,7 +109,7 @@ void web_setup ()
//Features //Features
syringe_pump_length_mm_bis = ESPUI.addControl(ControlType::Number, "Longueur totale du pousse-seringue", "50", ControlColor::None, features, syringe_pump_length_mm_callback); syringe_pump_length_mm_value = ESPUI.addControl(ControlType::Number, "Longueur totale du pousse-seringue", "50", ControlColor::None, features, syringe_pump_length_mm_callback);
lead_screw_pitch_mm = ESPUI.addControl(ControlType::Number, "Avance par tour", "0.7", ControlColor::None, features, number_callback); lead_screw_pitch_mm = ESPUI.addControl(ControlType::Number, "Avance par tour", "0.7", ControlColor::None, features, number_callback);
clockwise_equals_push_label = ESPUI.addControl(ControlType::Label, "Sens de rotation du moteur", "Horaire = Injection", ControlColor::None, features); clockwise_equals_push_label = ESPUI.addControl(ControlType::Label, "Sens de rotation du moteur", "Horaire = Injection", ControlColor::None, features);
clockwise_equals_push = ESPUI.addControl(ControlType::Switcher, "Sens de rotation du moteur", "Horaire =", ControlColor::None, clockwise_equals_push_label, clockwise_equals_push_callback); clockwise_equals_push = ESPUI.addControl(ControlType::Switcher, "Sens de rotation du moteur", "Horaire =", ControlColor::None, clockwise_equals_push_label, clockwise_equals_push_callback);
...@@ -602,12 +602,14 @@ void syringe_pump_length_mm_callback(Control* sender, int type) ...@@ -602,12 +602,14 @@ void syringe_pump_length_mm_callback(Control* sender, int type)
-Action : Print the value of the number controller via the serial port. -Action : Print the value of the number controller via the serial port.
***/ ***/
{ {
syringe_filled.set_syringe_pump_length_mm(sender->type);
Serial.println("syringe_pump_lenggth (sender->value)"); Serial.println("syringe_pump_lenggth (sender->value)");
Serial.println(String("Value: ") + String(sender->value)); Serial.println(String("Value: ") + String(sender->value));
Serial.println(String("ID: ") + sender->id); Serial.println(String("ID: ") + sender->id);
Serial.println(""); Serial.println("");
//Serial.println("syringe_pump_length (json value)"); //Serial.println("syringe_pump_length (json value)");
//Serial.println(String("Value: ") + String(syringe_filled.get_syringe_pump_length())); //Serial.println(String("Value: ") + String(syringe_filled.get_syringe_pump_length_mm()));
//Serial.println(""); //Serial.println("");
} }
...@@ -836,7 +838,7 @@ void set_init_style() ...@@ -836,7 +838,7 @@ void set_init_style()
//features //features
style (syringe_pump_length_mm_bis, 3); style (syringe_pump_length_mm_value, 3);
style (lead_screw_pitch_mm, 3); style (lead_screw_pitch_mm, 3);
style (clockwise_equals_push_label, 3); style (clockwise_equals_push_label, 3);
style (clockwise_equals_push, 3); style (clockwise_equals_push, 3);
...@@ -911,7 +913,7 @@ void web_loop () ...@@ -911,7 +913,7 @@ void web_loop ()
//UPDATES //UPDATES
ESPUI.updateSlider(remaining_volume_mL, syringe_filled.step_to_mm(syringe_filled.where_step()*100/syringe_pump_length_mm)); ESPUI.updateSlider(remaining_volume_mL, syringe_filled.step_to_mm(syringe_filled.where_step()*100/syringe_filled.get_syringe_pump_length_mm()));
//syringe_filled.update_remaining_volume(); //syringe_filled.update_remaining_volume();
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <EEPROM.h> #include <EEPROM.h>
#define syringe_pump_length_mm 50
//Create tabs //Create tabs
uint16_t configurations, new_syringe, features; uint16_t configurations, new_syringe, features;
...@@ -44,7 +43,7 @@ uint16_t name_new_syringe, name_new_syringe_label, internal_diameter_mm_new_syri ...@@ -44,7 +43,7 @@ uint16_t name_new_syringe, name_new_syringe_label, internal_diameter_mm_new_syri
String name_new_syringe_value, total_volume_mL_new_syringe_value, internal_diameter_mm_new_syringe_value; String name_new_syringe_value, total_volume_mL_new_syringe_value, internal_diameter_mm_new_syringe_value;
//Features //Features
uint16_t syringe_pump_length_mm_bis; uint16_t syringe_pump_length_mm_value;
uint16_t lead_screw_pitch_mm, clockwise_equals_push_label, clockwise_equals_push; uint16_t lead_screw_pitch_mm, clockwise_equals_push_label, clockwise_equals_push;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment