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

Implementation of the method run_from_emergency and change

manage_emergency to take it into account.
parent f3d74877
No related branches found
No related tags found
1 merge request!17Malaurie's work on UI + CLI interface + AccelStepper interface
......@@ -179,21 +179,20 @@ void SyringeFilled::manage_emergency (bool pressed, bool at_zero)
{
if (pressed) //if the limit switch is pressed
{
set_emergency(true);
if (at_zero) //if we are at te initialisation place
{
Serial.printf("EMERGENCY: running away slowly\n");
setSpeedMmPerSec(-1);
resetPosition();
moveToMm(syringe_pump_length_mm);
run_from_emergency()
}
else
{
Serial.printf("EMERGENCY: Pressed by someone\n");
Serial.printf("EMERGENCY: Pressed by someone\n");
}
}
else
{
set_emergency(false);
Serial.printf("EMERGENCY: released\n");
stayHere();
resetPosition(); //zero is here again
......@@ -202,3 +201,19 @@ void SyringeFilled::manage_emergency (bool pressed, bool at_zero)
}
void SyringeFilled::run_from_emergency()
/***
-Argument : /
-Return : /
-Action : Move the pump sloowly until the limit switch is released
***/
{
if (get_emergency())
{
Serial.printf("EMERGENCY: running away slowly\n");
setSpeedMmPerSec(-1);
resetPosition();
moveToMm(syringe_pump_length_mm);
}
}
\ No newline at end of file
......@@ -48,7 +48,7 @@ class SyringeFilled : public Motor
void set_push(bool push);
void set_id_syringe(Syringe* id_syringe);
void set_screw_thread_mm(float screw_thread_mm);
void set_clockwise_equals_forward(bool clockwise_equals_forward);
void set_clockwise_equals_push(bool clockwise_equals_push);
void set_emergency(bool emergency);
......@@ -83,8 +83,7 @@ class SyringeFilled : public Motor
bool check_configuration(); //a implementer
void show_configuration(); //a implementer
float distance_to_volume(float distance, Syringe* id_syringe); //a implementer
//set_emergency ? emergency() ? =ajouter un membre emergency
//runfromEmergency ?
void run_from_emergency();
};
......
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