Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
ptblab
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
Daniele Nicolodi
ptblab
Commits
fb52346c
Commit
fb52346c
authored
1 year ago
by
Daniele Nicolodi
Browse files
Options
Downloads
Patches
Plain Diff
meerstetterTEC: Implement setpoint and enable commands
parent
0ce5e68e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
meerstetterTEC.py
+54
-34
54 additions, 34 deletions
meerstetterTEC.py
with
54 additions
and
34 deletions
meerstetterTEC.py
+
54
−
34
View file @
fb52346c
...
@@ -134,6 +134,42 @@ class MeCom:
...
@@ -134,6 +134,42 @@ class MeCom:
return
self
.
recv
(
crc
)
return
self
.
recv
(
crc
)
class
Status
(
enum
.
IntEnum
):
OFF
=
0
ON
=
1
LIVE
=
2
HWENABLE
=
3
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
self
.
name
@classmethod
def
loads
(
cls
,
data
):
return
cls
(
int32
.
loads
(
data
))
class
DeviceStatus
(
enum
.
IntEnum
):
INIT
=
0
READY
=
1
RUN
=
2
ERROR
=
3
BOOTL
=
4
RESET
=
5
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
self
.
name
@classmethod
def
loads
(
cls
,
data
):
return
cls
(
int32
.
loads
(
data
))
class
MeerstetterTEC
(
MeCom
):
class
MeerstetterTEC
(
MeCom
):
"""
Meerstetter TEC Controller.
"""
"""
Meerstetter TEC Controller.
"""
...
@@ -146,40 +182,6 @@ class MeerstetterTEC(MeCom):
...
@@ -146,40 +182,6 @@ class MeerstetterTEC(MeCom):
if
idn
!=
b
'
8065-TEC SW G01
'
:
if
idn
!=
b
'
8065-TEC SW G01
'
:
raise
NotImplementedError
(
idn
)
raise
NotImplementedError
(
idn
)
class
Status
(
enum
.
IntEnum
):
OFF
=
0
ON
=
1
LIVE
=
2
HWENABLE
=
3
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
self
.
name
@classmethod
def
loads
(
cls
,
data
):
return
cls
(
int32
.
loads
(
data
))
class
DeviceStatus
(
enum
.
IntEnum
):
INIT
=
0
READY
=
1
RUN
=
2
ERROR
=
3
BOOTL
=
4
RESET
=
5
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
self
.
name
@classmethod
def
loads
(
cls
,
data
):
return
cls
(
int32
.
loads
(
data
))
def
read
(
self
,
*
args
):
def
read
(
self
,
*
args
):
return
super
().
read
(
*
args
)
return
super
().
read
(
*
args
)
...
@@ -249,6 +251,24 @@ def status(obj):
...
@@ -249,6 +251,24 @@ def status(obj):
print
(
'
{:4d}#{:05d} {:s} {!s:>5s} {!s:>3s} {:9.6f} {:9.6f} {: 9.6f}
'
.
format
(
*
row
))
print
(
'
{:4d}#{:05d} {:s} {!s:>5s} {!s:>3s} {:9.6f} {:9.6f} {: 9.6f}
'
.
format
(
*
row
))
@main.command
@click.argument
(
'
value
'
,
type
=
float
)
@click.pass_obj
def
setpoint
(
obj
,
value
):
"""
Set target temperature.
"""
obj
.
write
(
3000
,
1
,
float32
,
value
)
print
(
'
'
.
join
(
f
'
{
x
:
.
6
f
}
'
for
x
in
obj
.
read
(
3000
,
1
,
float32
)))
@main.command
@click.argument
(
'
status
'
,
type
=
bool
,
required
=
False
,
default
=
True
)
@click.pass_obj
def
enable
(
obj
,
status
):
"""
Set temperature control status.
"""
obj
.
set_status
(
Status
.
ON
if
status
else
Status
.
OFF
)
print
(
'
'
.
join
(
str
(
x
)
for
x
in
obj
.
get_status
()))
@main.command
@main.command
@click.pass_obj
@click.pass_obj
@click.option
(
'
--datadir
'
,
type
=
click
.
Path
(),
help
=
'
Data folder for datalogger mode.
'
)
@click.option
(
'
--datadir
'
,
type
=
click
.
Path
(),
help
=
'
Data folder for datalogger mode.
'
)
...
...
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