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
34167208
Commit
34167208
authored
1 year ago
by
Malaurie Bernard
Browse files
Options
Downloads
Patches
Plain Diff
!changing names of json document so there is no capital letter anymore to respect snake_case
parent
f3bd5d87
No related branches found
Branches containing commit
No related tags found
1 merge request
!17
Malaurie's work on UI + CLI interface + AccelStepper interface
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
syringe.cpp
+15
-15
15 additions, 15 deletions
syringe.cpp
syringe.h
+1
-1
1 addition, 1 deletion
syringe.h
syringefilled.cpp
+27
-27
27 additions, 27 deletions
syringefilled.cpp
syringefilled.h
+1
-1
1 addition, 1 deletion
syringefilled.h
with
44 additions
and
44 deletions
syringe.cpp
+
15
−
15
View file @
34167208
...
...
@@ -3,7 +3,7 @@
#include
"syringe.h"
StaticJsonDocument
<
200
>
Syringe
::
S
yringe
JSON
;
//200 = RAM allocated to this document
StaticJsonDocument
<
200
>
Syringe
::
s
yringe
_json
;
//200 = RAM allocated to this document
//CONSTRUCTORS
Syringe
::
Syringe
()
...
...
@@ -27,7 +27,7 @@ Syringe :: Syringe(String name, string ref, string brand, float total_volume_mL,
//SET METHODS
void
Syringe
::
set_syringe
(
String
name
,
string
ref
,
string
brand
,
float
total_volume_mL
,
float
internal_diameter_mm
)
{
S
yringe
JSON
[
"name"
]
=
name
;
s
yringe
_json
[
"name"
]
=
name
;
set_ref
(
name
,
ref
);
set_brand
(
name
,
brand
);
set_total_volume_mL
(
name
,
total_volume_mL
);
...
...
@@ -36,22 +36,22 @@ void Syringe :: set_syringe(String name, string ref, string brand, float total_v
void
Syringe
::
set_ref
(
String
name
,
string
ref
)
{
S
yringe
JSON
[
name
][
"ref"
]
=
ref
;
s
yringe
_json
[
name
][
"ref"
]
=
ref
;
}
void
Syringe
::
set_brand
(
String
name
,
string
brand
)
{
S
yringe
JSON
[
name
][
"brand"
]
=
brand
;
s
yringe
_json
[
name
][
"brand"
]
=
brand
;
}
void
Syringe
::
set_total_volume_mL
(
String
name
,
float
total_volume_mL
)
{
S
yringe
JSON
[
name
][
"total_volume_mL"
]
=
total_volume_mL
;
s
yringe
_json
[
name
][
"total_volume_mL"
]
=
total_volume_mL
;
}
void
Syringe
::
set_internal_diameter_mm
(
String
name
,
float
internal_diameter_mm
)
{
S
yringe
JSON
[
name
][
"internal_diameter_mm"
]
=
internal_diameter_mm
;
s
yringe
_json
[
name
][
"internal_diameter_mm"
]
=
internal_diameter_mm
;
}
...
...
@@ -61,36 +61,36 @@ void Syringe :: set_internal_diameter_mm(String name, float internal_diameter_mm
//GET METHODS
string
Syringe
::
get_ref
(
String
name
)
{
return
S
yringe
JSON
[
name
][
"ref"
].
as
<
string
>
();
return
s
yringe
_json
[
name
][
"ref"
].
as
<
string
>
();
}
string
Syringe
::
get_brand
(
String
name
)
{
return
S
yringe
JSON
[
name
][
"brand"
].
as
<
string
>
();
return
s
yringe
_json
[
name
][
"brand"
].
as
<
string
>
();
}
float
Syringe
::
get_total_volume_mL
(
String
name
)
{
return
S
yringe
JSON
[
name
][
"total_volume_mL"
].
as
<
float
>
();
return
s
yringe
_json
[
name
][
"total_volume_mL"
].
as
<
float
>
();
}
float
Syringe
::
get_internal_diameter_mm
(
String
name
)
{
return
S
yringe
JSON
[
name
][
"internal_diameter_mm"
].
as
<
float
>
();
return
s
yringe
_json
[
name
][
"internal_diameter_mm"
].
as
<
float
>
();
}
const
StaticJsonDocument
<
200
>&
Syringe
::
get_syringe_database
()
{
return
S
yringe
JSON
;
return
s
yringe
_json
;
}
//CONFIGURATION
bool
Syringe
::
check_configuration
(
String
name
)
{
if
(
S
yringe
JSON
[
name
][
"total_volume_mL"
]
<
0
)
if
(
s
yringe
_json
[
name
][
"total_volume_mL"
]
<
0
)
return
false
;
else
if
(
S
yringe
JSON
[
name
][
"internal_diameter_mm"
]
<
0
)
else
if
(
s
yringe
_json
[
name
][
"internal_diameter_mm"
]
<
0
)
return
false
;
else
...
...
@@ -113,7 +113,7 @@ void Syringe :: write_Json (Stream& output_stream)
***/
InterruptLock
lock
;
//useful thanks to its constructor (so a is not visible in the code)
serializeJson
(
S
yringe
JSON
,
output_stream
);
serializeJson
(
s
yringe
_json
,
output_stream
);
}
...
...
@@ -128,7 +128,7 @@ void Syringe :: read_Json (Stream& input_stream)
***/
InterruptLock
lock
;
//useful thanks to its constructor (so a is not visible in the code)
deserializeJson
(
S
yringe
JSON
,
input_stream
);
deserializeJson
(
s
yringe
_json
,
input_stream
);
}
...
...
This diff is collapsed.
Click to expand it.
syringe.h
+
1
−
1
View file @
34167208
...
...
@@ -22,7 +22,7 @@ class Syringe
float
_internal_diameter_mm
;
//JSON DOCUMENT
static
StaticJsonDocument
<
200
>
S
yringe
JSON
;
//200 = RAM allocated to this document
static
StaticJsonDocument
<
200
>
s
yringe
_json
;
//200 = RAM allocated to this document
public
:
...
...
This diff is collapsed.
Click to expand it.
syringefilled.cpp
+
27
−
27
View file @
34167208
#include
"syringefilled.h"
StaticJsonDocument
<
200
>
SyringeFilled
::
S
yringe
F
illed
JSON
;
//200 = RAM allocated to this document
StaticJsonDocument
<
200
>
SyringeFilled
::
s
yringe
_f
illed
_json
;
//200 = RAM allocated to this document
//CONSTRUCTORS
...
...
@@ -22,92 +22,92 @@ SyringeFilled :: SyringeFilled (MotorHardware_t& stepper): Motor(stepper)
//SET METHODS
void
SyringeFilled
::
set_exchange_throughput_uL_per_sec
(
float
exchange_throughput_uL_per_sec
)
{
S
yringe
F
illed
JSON
[
"exchange_throughput_uL_per_sec"
]
=
exchange_throughput_uL_per_sec
;
s
yringe
_f
illed
_json
[
"exchange_throughput_uL_per_sec"
]
=
exchange_throughput_uL_per_sec
;
}
void
SyringeFilled
::
set_exchange_volume_mL
(
float
exchange_volume_mL
)
{
S
yringe
F
illed
JSON
[
"exchange_volume_mL"
]
=
exchange_volume_mL
;
s
yringe
_f
illed
_json
[
"exchange_volume_mL"
]
=
exchange_volume_mL
;
}
void
SyringeFilled
::
set_remaining_volume_mL
(
float
remaining_volume_mL
)
{
S
yringe
F
illed
JSON
[
"remaining_volume_mL"
]
=
remaining_volume_mL
;
s
yringe
_f
illed
_json
[
"remaining_volume_mL"
]
=
remaining_volume_mL
;
}
void
SyringeFilled
::
set_push
(
bool
push
)
{
S
yringe
F
illed
JSON
[
"push"
]
=
push
;
s
yringe
_f
illed
_json
[
"push"
]
=
push
;
}
void
SyringeFilled
::
set_name_syringe
(
Syringe
*
name_syringe
){
S
yringe
F
illed
JSON
[
"name_syringe"
]
=
name_syringe
;
s
yringe
_f
illed
_json
[
"name_syringe"
]
=
name_syringe
;
}
void
SyringeFilled
::
set_screw_thread_mm
(
float
screw_thread_mm
)
{
S
yringe
F
illed
JSON
[
"screw_thread_mm"
]
=
screw_thread_mm
;
s
yringe
_f
illed
_json
[
"screw_thread_mm"
]
=
screw_thread_mm
;
}
void
SyringeFilled
::
set_clockwise_equals_push
(
bool
clockwise_equals_push
)
{
S
yringe
F
illed
JSON
[
"clockwise_equals_push"
]
=
clockwise_equals_push
;
s
yringe
_f
illed
_json
[
"clockwise_equals_push"
]
=
clockwise_equals_push
;
}
void
SyringeFilled
::
set_emergency
(
bool
emergency
)
{
S
yringe
F
illed
JSON
[
"emergency"
]
=
emergency
;
s
yringe
_f
illed
_json
[
"emergency"
]
=
emergency
;
}
//GET METHODS
float
SyringeFilled
::
get_exchange_throughput_uL_per_sec
()
{
return
S
yringe
F
illed
JSON
[
"exchange_throughput_uL_per_sec"
].
as
<
float
>
();
return
s
yringe
_f
illed
_json
[
"exchange_throughput_uL_per_sec"
].
as
<
float
>
();
}
float
SyringeFilled
::
get_exchange_volume_mL
()
{
return
S
yringe
F
illed
JSON
[
"exchange_volume_mL"
].
as
<
float
>
();
return
s
yringe
_f
illed
_json
[
"exchange_volume_mL"
].
as
<
float
>
();
}
float
SyringeFilled
::
get_remaining_volume_mL
()
{
return
S
yringe
F
illed
JSON
[
"remaining_volume_mL"
].
as
<
float
>
();
return
s
yringe
_f
illed
_json
[
"remaining_volume_mL"
].
as
<
float
>
();
}
bool
SyringeFilled
::
get_push
()
{
return
S
yringe
F
illed
JSON
[
"push"
].
as
<
bool
>
();
return
s
yringe
_f
illed
_json
[
"push"
].
as
<
bool
>
();
}
String
SyringeFilled
::
get_name_syringe
()
{
return
S
yringe
F
illed
JSON
[
"name_syringe"
].
as
<
String
>
();
return
s
yringe
_f
illed
_json
[
"name_syringe"
].
as
<
String
>
();
}
float
SyringeFilled
::
get_screw_thread_mm
()
{
return
S
yringe
F
illed
JSON
[
"screw_thread_mm"
].
as
<
float
>
();
return
s
yringe
_f
illed
_json
[
"screw_thread_mm"
].
as
<
float
>
();
}
bool
SyringeFilled
::
get_clockwise_equals_push
()
{
return
S
yringe
F
illed
JSON
[
"clockwise_equals_push"
].
as
<
float
>
();
return
s
yringe
_f
illed
_json
[
"clockwise_equals_push"
].
as
<
float
>
();
}
bool
SyringeFilled
::
get_emergency
()
{
return
S
yringe
F
illed
JSON
[
"emergency"
].
as
<
bool
>
();
return
s
yringe
_f
illed
_json
[
"emergency"
].
as
<
bool
>
();
}
const
StaticJsonDocument
<
200
>&
SyringeFilled
::
get_syringe_filled_data
()
{
return
S
yringe
F
illed
JSON
;
return
s
yringe
_f
illed
_json
;
}
//CONVERSIONS
StaticJsonDocument
<
200
>
S
yringe
F
illed
JSON
;
//200 = RAM allocated to this document
StaticJsonDocument
<
200
>
s
yringe
_f
illed
_json
;
//200 = RAM allocated to this document
float
SyringeFilled
::
volume_to_distance
(
float
volume_mL
)
/***
-Argument : Volume in mL.
...
...
@@ -117,7 +117,7 @@ float SyringeFilled::volume_to_distance(float volume_mL)
{
float
volume_mm3
=
1000
*
volume_mL
;
//mL->mm3
float
piston_surface_mm2
=
Syringe
::
get_syringe_database
()[
S
yringe
F
illed
JSON
[
"name_syringe"
]][
"internal_diameter"
];
float
piston_surface_mm2
=
Syringe
::
get_syringe_database
()[
s
yringe
_f
illed
_json
[
"name_syringe"
]][
"internal_diameter"
];
float
distance_mm
=
volume_mm3
/
piston_surface_mm2
;
...
...
@@ -131,7 +131,7 @@ float SyringeFilled::distance_to_volume(float distance_mm)
-Action : /
***/
{
float
piston_surface_mm2
=
Syringe
::
get_syringe_database
()[
S
yringe
F
illed
JSON
[
"name_syringe"
]][
"internal_diameter"
];
float
piston_surface_mm2
=
Syringe
::
get_syringe_database
()[
s
yringe
_f
illed
_json
[
"name_syringe"
]][
"internal_diameter"
];
float
volume_mm3
=
distance_mm
*
piston_surface_mm2
;
...
...
@@ -153,7 +153,7 @@ float SyringeFilled :: move()
float
exchange_volume_mm3
=
get_exchange_volume_mL
()
*
1000
;
//Find the section
float
radius
=
Syringe
::
get_syringe_database
()[
S
yringe
F
illed
JSON
[
"name_syringe"
]][
"internal_diameter_mm"
];
float
radius
=
Syringe
::
get_syringe_database
()[
s
yringe
_f
illed
_json
[
"name_syringe"
]][
"internal_diameter_mm"
];
float
section_mm2
=
M_PI
*
radius
*
radius
;
...
...
@@ -258,7 +258,7 @@ bool SyringeFilled :: check_configuration()
-Action : Check if the values are correct.
***/
{
if
(
Syringe
::
get_syringe_database
()[
S
yringe
F
illed
JSON
[
"name_syringe"
]][
"internal_diameter"
]
<=
0
)
if
(
Syringe
::
get_syringe_database
()[
s
yringe
_f
illed
_json
[
"name_syringe"
]][
"internal_diameter"
]
<=
0
)
return
false
;
if
(
get_exchange_volume_mL
()
<
0
)
...
...
@@ -294,8 +294,8 @@ void SyringeFilled :: show_configuration()
"# emergency: %d
\n
"
"# current position: %g mm
\n
"
,
get_clockwise_equals_push
()
?
"yes"
:
"no"
,
Syringe
::
get_syringe_database
()[
S
yringe
F
illed
JSON
[
"name_syringe"
]][
"internal_diameter"
],
Syringe
::
get_syringe_database
()[
S
yringe
F
illed
JSON
[
"name_syringe"
]][
"total_volume_mL"
],
Syringe
::
get_syringe_database
()[
s
yringe
_f
illed
_json
[
"name_syringe"
]][
"internal_diameter"
],
Syringe
::
get_syringe_database
()[
s
yringe
_f
illed
_json
[
"name_syringe"
]][
"total_volume_mL"
],
get_exchange_throughput_uL_per_sec
(),
volume_to_distance
(
get_exchange_throughput_uL_per_sec
()),
get_remaining_volume_mL
(),
...
...
@@ -315,7 +315,7 @@ void SyringeFilled :: write_Json (Stream& output_stream) //file_name sera le nom
***/
InterruptLock
lock
;
//useful thanks to its constructor (so a is not visible in the code)
serializeJson
(
S
yringe
F
illed
JSON
,
output_stream
);
serializeJson
(
s
yringe
_f
illed
_json
,
output_stream
);
}
...
...
@@ -330,7 +330,7 @@ void SyringeFilled :: read_Json (Stream& input_stream) //file_name sera le nom d
***/
InterruptLock
lock
;
//useful thanks to its constructor (so a is not visible in the code)
deserializeJson
(
S
yringe
F
illed
JSON
,
input_stream
);
deserializeJson
(
s
yringe
_f
illed
_json
,
input_stream
);
}
This diff is collapsed.
Click to expand it.
syringefilled.h
+
1
−
1
View file @
34167208
...
...
@@ -39,7 +39,7 @@ class SyringeFilled : public Motor
bool
_emergency
;
//JSON DOCUMENT
static
StaticJsonDocument
<
200
>
S
yringe
F
illed
JSON
;
//200 = RAM allocated to this document
static
StaticJsonDocument
<
200
>
s
yringe
_f
illed
_json
;
//200 = RAM allocated to this document
public
:
...
...
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