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

Add a few new attrubutes of the syringe pump to the sringe_filled class

parent 2b222c6a
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
...@@ -16,9 +16,11 @@ SyringeFilled :: SyringeFilled (MotorHardware_t& stepper): Motor(stepper) ...@@ -16,9 +16,11 @@ SyringeFilled :: SyringeFilled (MotorHardware_t& stepper): Motor(stepper)
set_remaining_volume_mL(1); set_remaining_volume_mL(1);
set_push(true); set_push(true);
set_name_syringe("BD_10mL"); set_name_syringe("BD_10mL");
set_screw_thread_mm(4);
set_clockwise_equals_push(true); set_clockwise_equals_push(true);
set_lead_screw_pitch_mm(0.7);
set_syringe_pump_length_mm(50); set_syringe_pump_length_mm(50);
set_microstep_configuration(16);
set_motor_steps(200);
set_emergency(false); set_emergency(false);
} }
...@@ -45,13 +47,9 @@ void SyringeFilled :: set_push(bool push) ...@@ -45,13 +47,9 @@ void SyringeFilled :: set_push(bool push)
syringe_filled_json["push"] = push; syringe_filled_json["push"] = push;
} }
void SyringeFilled :: set_name_syringe(String name_syringe){ void SyringeFilled :: set_name_syringe(String name_syringe)
syringe_filled_json["name_syringe"] = name_syringe;
}
void SyringeFilled :: set_screw_thread_mm(float screw_thread_mm)
{ {
syringe_filled_json["screw_thread_mm"] = screw_thread_mm; syringe_filled_json["name_syringe"] = name_syringe;
} }
void SyringeFilled :: set_clockwise_equals_push(bool clockwise_equals_push) void SyringeFilled :: set_clockwise_equals_push(bool clockwise_equals_push)
...@@ -64,6 +62,21 @@ void SyringeFilled :: set_syringe_pump_length_mm(float syringe_pump_length_mm) ...@@ -64,6 +62,21 @@ void SyringeFilled :: set_syringe_pump_length_mm(float syringe_pump_length_mm)
syringe_filled_json["syringe_pump_length_mm"] = syringe_pump_length_mm; syringe_filled_json["syringe_pump_length_mm"] = syringe_pump_length_mm;
} }
void SyringeFilled :: set_lead_screw_pitch_mm(float lead_screw_pitch_mm)
{
syringe_filled_json["lead_screw_pitch_mm"] = lead_screw_pitch_mm;
}
void SyringeFilled :: set_microstep_configuration(int microstep_configuration)
{
syringe_filled_json["microstep_configuration"] = microstep_configuration;
}
void SyringeFilled :: set_motor_steps(int motor_steps)
{
syringe_filled_json["motor_steps"] = motor_steps;
}
void SyringeFilled :: set_emergency(bool emergency) void SyringeFilled :: set_emergency(bool emergency)
{ {
syringe_filled_json["emergency"] = emergency; syringe_filled_json["emergency"] = emergency;
...@@ -96,11 +109,6 @@ String SyringeFilled :: get_name_syringe() ...@@ -96,11 +109,6 @@ String SyringeFilled :: get_name_syringe()
return syringe_filled_json["name_syringe"].as<String>(); return syringe_filled_json["name_syringe"].as<String>();
} }
float SyringeFilled :: get_screw_thread_mm()
{
return syringe_filled_json["screw_thread_mm"].as<float>();
}
bool SyringeFilled :: get_clockwise_equals_push() bool SyringeFilled :: get_clockwise_equals_push()
{ {
return syringe_filled_json["clockwise_equals_push"].as<bool>(); return syringe_filled_json["clockwise_equals_push"].as<bool>();
...@@ -111,6 +119,21 @@ float SyringeFilled :: get_syringe_pump_length_mm() ...@@ -111,6 +119,21 @@ float SyringeFilled :: get_syringe_pump_length_mm()
return syringe_filled_json["syringe_pump_length_mm"].as<float>(); return syringe_filled_json["syringe_pump_length_mm"].as<float>();
} }
float SyringeFilled :: get_lead_screw_pitch_mm()
{
return syringe_filled_json["lead_screw_pitch_mm"].as<float>();
}
int SyringeFilled :: get_microstep_configuration()
{
return syringe_filled_json["microstep_configuration"].as<int>();
}
int SyringeFilled :: get_motor_steps()
{
return syringe_filled_json["motor_steps"].as<int>();
}
bool SyringeFilled :: get_emergency() bool SyringeFilled :: get_emergency()
{ {
return syringe_filled_json["emergency"].as<bool>(); return syringe_filled_json["emergency"].as<bool>();
......
...@@ -37,6 +37,9 @@ class SyringeFilled : public Motor ...@@ -37,6 +37,9 @@ class SyringeFilled : public Motor
float _screw_thread_mm; float _screw_thread_mm;
bool _clockwise_equals_push; bool _clockwise_equals_push;
float _syringe_pump_length_mm; float _syringe_pump_length_mm;
float _lead_screw_pitch_mm;
int _microstep_configuration;
int _motor_steps;
//Limit_Switch //Limit_Switch
bool _emergency; bool _emergency;
......
...@@ -130,6 +130,10 @@ void web_setup () ...@@ -130,6 +130,10 @@ void web_setup ()
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);
ESPUI.updateSwitcher(clockwise_equals_push, true); //set "Horaire = Injection" at the beginning ESPUI.updateSwitcher(clockwise_equals_push, true); //set "Horaire = Injection" at the beginning
microstep_configuration = ESPUI.addControl(ControlType::Number, "Configuration Hardware des microsteps", "16", ControlColor::None, features, microstep_configuration_callback);
motor_steps = ESPUI.addControl(ControlType::Number, "Caractéristique du moteur (nombre de pas possibles ?)", "2000", ControlColor::None, features, motor_steps_callback);
...@@ -636,6 +640,44 @@ void clockwise_equals_push_callback(Control* sender, int value) ...@@ -636,6 +640,44 @@ void clockwise_equals_push_callback(Control* sender, int value)
Serial.println(""); Serial.println("");
} }
void microstep_configuration_callback(Control* sender, int type)
/***
-Argument : Pointer to the controller calling the function, integer according to the controller type.
-Return : /
-Action : Print the value of the number controller via the serial port.
Change the microstep_configuration value.
***/
{
syringe_filled.set_microstep_configuration(sender->type);
syringe_filled.write_Json();
serial_print ("microstep_configuration (sender->value)", sender);
Serial.println("microstep_configuration (json value)");
Serial.println(String("Value: ") + String(syringe_filled.get_microstep_configuration()));
Serial.println("");
}
void motor_steps_callback(Control* sender, int type)
/***
-Argument : Pointer to the controller calling the function, integer according to the controller type.
-Return : /
-Action : Print the value of the number controller via the serial port.
Change the motor_steps value.
***/
{
syringe_filled.set_motor_steps(sender->type);
syringe_filled.write_Json();
serial_print ("motor_steps (sender->value)", sender);
Serial.println("motor_steps (json value)");
Serial.println(String("Value: ") + String(syringe_filled.get_motor_steps()));
Serial.println("");
}
// //
void syringe_selection_callback(Control* sender, int value) void syringe_selection_callback(Control* sender, int value)
...@@ -763,7 +805,8 @@ void set_initial_style() ...@@ -763,7 +805,8 @@ void set_initial_style()
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);
style (microstep_configuration, 3);
style (motor_steps, 3);
// //
...@@ -950,6 +993,17 @@ void web_loop () ...@@ -950,6 +993,17 @@ void web_loop ()
else else
style_syringe_pump_off(); style_syringe_pump_off();
if (syringe_filled.get_emergency())
{
ESPUI.print(status_syringe_pump, "On");
style (status_limit_switch, 1);
}
else
{
ESPUI.print(status_syringe_pump, "Off");
style (status_limit_switch, 2);
}
} }
} }
...@@ -46,7 +46,7 @@ String name_new_syringe_value, total_volume_mL_new_syringe_value, internal_diame ...@@ -46,7 +46,7 @@ String name_new_syringe_value, total_volume_mL_new_syringe_value, internal_diame
//Features //Features
uint16_t syringe_pump_length_mm_value; 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, microstep_configuration, motor_steps;
//Other //Other
...@@ -109,6 +109,8 @@ void add_syringe_callback (Control* sender, int value, void* param); ...@@ -109,6 +109,8 @@ void add_syringe_callback (Control* sender, int value, void* param);
//features : Configurations avancées //features : Configurations avancées
void syringe_pump_length_mm_callback(Control* sender, int type); void syringe_pump_length_mm_callback(Control* sender, int type);
void clockwise_equals_push_callback(Control* sender, int value); void clockwise_equals_push_callback(Control* sender, int value);
void microstep_configuration_callback(Control* sender, int type);
void motor_steps_callback(Control* sender, int type);
// //
void syringe_selection_callback(Control* sender, int value); void syringe_selection_callback(Control* sender, int value);
......
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