Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pousseseringue-arduino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FabLAAS
PousseSeringue
pousseseringue-arduino
Commits
d9cc5a8e
Commit
d9cc5a8e
authored
1 year ago
by
Malaurie Bernard
Browse files
Options
Downloads
Patches
Plain Diff
Complete modification of the syringe class with basic functions (setters and getters)
parent
a16256bf
No related branches found
No related tags found
1 merge request
!17
Malaurie's work on UI + CLI interface + AccelStepper interface
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
syringe.h
+21
-107
21 additions, 107 deletions
syringe.h
with
21 additions
and
107 deletions
syringe.h
+
21
−
107
View file @
d9cc5a8e
...
...
@@ -3,119 +3,33 @@
#include
"motor.h"
class
Syringe
:
public
Motor
{
public:
/************** STRUCTURE **************/
typedef
struct
{
float
diameter_mm
;
float
capacity_ul
;
float
rate_ul_per_s
;
float
volume_value
;
// see volume_unit_ul /***************************a quoi sert cette variable ? pk pas avoir directement fait volume_in_ul**************/
float
volume_unit_ul
;
// volume in ul = volume_value * volume_unit_ul
int
direction
;
}
Syringe_configuration_t
;
/************** METHODES **************/
private
:
float
volumeToDistance
(
float
volume
);
void
moveMotor
(
bool
direction
,
float
duration
,
float
speed
);
public
:
Syringe
(
MotorHardware_t
&
stepper
)
:
Motor
(
stepper
)
{
}
void
setPhysical
(
int
stepsPerRevolution
,
float
mmPerRevolution
,
bool
forwardClockwise
,
bool
emergencySensorBehind
)
{
Motor
::
setPhysical
(
stepsPerRevolution
,
mmPerRevolution
,
forwardClockwise
);
_emergencySensorBehind
=
emergencySensorBehind
;
}
/***CONFIGURATION***/
void
showConfiguration
(
const
Syringe_configuration_t
&
conf
);
const
Syringe_configuration_t
&
configuration
()
const
{
return
current_configuration
;
};
bool
infusing
()
{
return
current_configuration
.
direction
==
1
;
}
bool
configureSyringe
(
const
Syringe_configuration_t
&
config
);
void
setInitialContent
(
float
initial_volume
);
void
setPushClockwise
(
bool
clockwise
)
{
setForwardClockwise
(
clockwise
);
}
bool
getPushClockwise
()
{
return
getForwardClockwise
();
}
/***EMERGENCY***/
/*(=limit switch management)*/
void
setEmergency
(
bool
emergency
=
true
)
{
_emergency
=
emergency
;
}
bool
emergency
()
const
{
return
_emergency
;
}
void
manageEmergency
(
bool
pressed
,
bool
stepperMoving
);
void
runFromEmergency
(
float
mmPerSec
=
0.1
,
float
maxCourseMm
=
10
);
#include
<ArduinoJson.h>
/***POSITION***/
void
resetPosition
();
void
findZero
(
float
mmPerSec
=
-
1
,
float
maxCourseMm
=
200
);
//Provoque le déplacement jusqu'au capteur
float
currentPosition
();
void
updateValue
();
bool
isRunning
();
/***CONVERSIONS***/
float
mm3ToMm
(
float
mm3
)
const
;
float
mmToMm3
(
float
mm
)
const
;
float
confToMm
()
const
;
float
confToMm3
()
const
;
float
sectionMm2
()
const
;
/***ACTIONS***/
void
fill
();
//lance le déplacement du pousse-seringue a partir des spécifications de la configuration
#if 0
void push(float volume, float throughput);
void pushAll(float throughput);
void pushFor(float duration, float throughput);
void pushVol(float volume, float duration);
void pull(float volume, float throughput);
void pullAll(float throughput);
void pullFor(float duration, float throughput);
void pullVol(float volume, float duration);
#endif
/************** ATTRIBUTS **************/
private
:
/***CONFIGURATION***/
Syringe_configuration_t
current_configuration
=
{
.
diameter_mm
=
10
,
.
capacity_ul
=
1000
,
.
rate_ul_per_s
=
100
,
//a enlever d'ici
.
volume_value
=
50
,
.
volume_unit_ul
=
1
,
.
direction
=
1
,
// 1 = push, -1 = pull
};
bool
is_configured
=
false
;
/***EMERGENCY***/
bool
_emergency
=
false
;
class
Syringe
:
public
Motor
{
private
:
float
_total_volume_mL
;
float
_internal_diameter_mm
;
int
_id
;
/***INITIALISATION***/
float
remaining_volume
=
0
;
float
piston_surface
=
0
;
public
:
//SET METHODS
void
set_total_volume_mL
(
float
total_volume_mL
);
#include
"syringefilled.h"
void
set_internal_diameter_mm
(
float
internal_diameter_mm
);
void
set_id
(
int
id
);
//GET METHODS
float
get_total_volume_mL
();
float
get_internal_diameter_mm
();
int
get_id
();
//JSON DOCUMENT
StaticJsonDocument
<
200
>
SyringeJSON
;
//200 = RAM allocated to this document
void
setupJsonSyringe
(
float
total_volume_mL
,
float
internal_diameter_mm
,
int
id
);
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment