Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CoincellExperimentController
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klemm, Carl Philipp
CoincellExperimentController
Commits
bc543f19
Commit
bc543f19
authored
1 year ago
by
Carl Philipp Klemm
Browse files
Options
Downloads
Patches
Plain Diff
add the ability to read the enabled state per device
parent
18196e81
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
coincell.cpp
+5
-0
5 additions, 0 deletions
coincell.cpp
coincell.h
+1
-0
1 addition, 0 deletions
coincell.h
heater.cpp
+38
-0
38 additions, 0 deletions
heater.cpp
heaters.h
+3
-0
3 additions, 0 deletions
heaters.h
test.cpp
+9
-5
9 additions, 5 deletions
test.cpp
with
56 additions
and
5 deletions
coincell.cpp
+
5
−
0
View file @
bc543f19
...
...
@@ -72,6 +72,11 @@ bool CoinCell::getSetpoint(float& temperature)
return
ret
;
}
bool
CoinCell
::
getEnabled
()
{
return
heaters
->
getHeaterEnabled
(
heaterId
);
}
bool
CoinCell
::
setConnected
(
bool
connected
)
{
bool
ret
=
true
;
...
...
This diff is collapsed.
Click to expand it.
coincell.h
+
1
−
0
View file @
bc543f19
...
...
@@ -36,6 +36,7 @@ public:
bool
isShorted
(
bool
&
detected
);
bool
measureEis
(
std
::
filesystem
::
path
path
,
std
::
string
userStr
=
""
);
bool
setEnabled
(
bool
enable
);
bool
getEnabled
();
double
getLastKnownCapacity
();
void
setLastKnownCapacity
(
double
cap
);
double
getFullVoltage
();
...
...
This diff is collapsed.
Click to expand it.
heater.cpp
+
38
−
0
View file @
bc543f19
...
...
@@ -299,6 +299,44 @@ bool Heaters::getSetpoint(int heater, float& temperature)
return
true
;
}
bool
Heaters
::
getHeaterState
(
int
heater
,
struct
heater_state
&
state
)
{
int
device
=
getAddress
(
heater
).
first
;
int
heaterId
=
getAddress
(
heater
).
second
;
if
(
devices
.
size
()
<=
device
)
return
false
;
if
(
deviceBad
(
device
))
return
false
;
devices
[
device
].
mutex
->
lock
();
int
ret
=
coincellhell_get_state
(
&
devices
[
device
].
device
,
heaterId
,
&
state
);
devices
[
device
].
mutex
->
unlock
();
if
(
ret
!=
0
)
{
deviceError
(
device
,
ERR_CONNECTION
);
if
(
deviceBad
(
device
))
{
return
false
;
}
else
{
return
getHeaterState
(
heater
,
state
);
}
}
return
true
;
}
bool
Heaters
::
getHeaterEnabled
(
int
heater
)
{
struct
heater_state
state
;
bool
ret
=
getHeaterState
(
heater
,
state
);
if
(
!
ret
)
return
false
;
else
return
state
.
enabled
;
}
bool
Heaters
::
getTemperature
(
int
heater
,
float
&
temperature
)
{
...
...
This diff is collapsed.
Click to expand it.
heaters.h
+
3
−
0
View file @
bc543f19
...
...
@@ -45,6 +45,8 @@ private:
bool
heaterBad
(
int
heater
);
void
recoverDevice
(
int
device
);
bool
getHeaterState
(
int
heater
,
struct
heater_state
&
state
);
public
:
Heaters
(
const
std
::
vector
<
uint16_t
>
serials
,
...
...
@@ -56,6 +58,7 @@ public:
void
reconnectDevices
();
bool
setHeaterEnabled
(
int
heater
,
bool
enabled
);
bool
getHeaterEnabled
(
int
heater
);
bool
setSetpoint
(
int
heater
,
float
temperature
);
bool
getSetpoint
(
int
heater
,
float
&
temperature
);
bool
setRamp
(
int
heater
,
time_t
endTime
,
float
temperature
);
...
...
This diff is collapsed.
Click to expand it.
test.cpp
+
9
−
5
View file @
bc543f19
...
...
@@ -168,6 +168,10 @@ int main(int argc, char** argv)
else
Log
(
Log
::
INFO
,
true
,
false
)
<<
"Cell "
<<
i
<<
" temperature: "
<<
temperature
;
}
auto
connected
=
multiplexers
.
getConnected
();
for
(
size_t
i
=
0
;
i
<
connected
.
size
();
++
i
)
Log
(
Log
::
INFO
,
true
,
false
)
<<
"multiplexer channel "
<<
i
<<
' '
<<
(
connected
[
i
]
?
"connected"
:
"disconnected"
);
}
else
{
...
...
@@ -188,12 +192,12 @@ int main(int argc, char** argv)
continue
;
}
Log
(
Log
::
ERROR
,
true
,
false
)
<<
"Cell "
<<
coincellId
<<
" temperature: "
<<
temperature
<<
" setpoint: "
<<
setpoint
;
}
bool
enabled
=
coinCells
[
coincellId
]
->
getEnabled
();
auto
connected
=
multiplexers
.
getConnected
();
for
(
size_t
i
=
0
;
i
<
connected
.
size
();
++
i
)
Log
(
Log
::
INFO
,
true
,
false
)
<<
"multiplexer channel "
<<
i
<<
' '
<<
(
connected
[
i
]
?
"connected"
:
"disconnected"
);
Log
(
Log
::
ERROR
,
true
,
false
)
<<
"Cell "
<<
coincellId
<<
':'
;
Log
(
Log
::
ERROR
,
true
,
false
)
<<
"
\t
temperature: "
<<
temperature
<<
"
\n\t
setpoint: "
<<
setpoint
<<
"
\t\n
enabled: "
<<
enabled
;
}
}
else
if
(
tokens
[
0
]
==
"clear"
)
{
...
...
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