Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
HPIB
Commits
ffce98a7
Commit
ffce98a7
authored
May 06, 2018
by
Tammo Jan Dijkema
Browse files
Make checking of frequency optional
parent
e6bcc19f
Changes
1
Hide whitespace changes
Inline
Side-by-side
camrasdevices.py
View file @
ffce98a7
...
@@ -10,8 +10,9 @@ class CamrasHpibDevice(object):
...
@@ -10,8 +10,9 @@ class CamrasHpibDevice(object):
command_thread
=
None
command_thread
=
None
def
__init__
(
self
,
address
):
def
__init__
(
self
,
address
,
check_frequency
=
True
):
self
.
hpib_address
=
address
self
.
hpib_address
=
address
self
.
_check_frequency
=
check_frequency
if
not
CamrasHpibDevice
.
command_thread
:
if
not
CamrasHpibDevice
.
command_thread
:
serial_port
=
serial
.
Serial
(
"/dev/ttyUSB0"
)
serial_port
=
serial
.
Serial
(
"/dev/ttyUSB0"
)
...
@@ -54,7 +55,7 @@ class CamrasHpibDevice(object):
...
@@ -54,7 +55,7 @@ class CamrasHpibDevice(object):
CamrasHpibDevice
.
command_thread
.
protocol
.
command
(
"freq {:d} Hz"
.
format
(
int
(
freq
)),
CamrasHpibDevice
.
command_thread
.
protocol
.
command
(
"freq {:d} Hz"
.
format
(
int
(
freq
)),
address
=
self
.
hpib_address
)
address
=
self
.
hpib_address
)
new_freq
=
self
.
frequency
new_freq
=
self
.
frequency
if
new_freq
.
to
(
u
.
Hz
).
value
!=
int
(
freq
):
if
self
.
_check_frequency
and
new_freq
.
to
(
u
.
Hz
).
value
!=
int
(
freq
):
raise
RuntimeError
(
"Setting frequency failed: tried to set to {}, it is now {}"
.
format
(
raise
RuntimeError
(
"Setting frequency failed: tried to set to {}, it is now {}"
.
format
(
freq
,
new_freq
))
freq
,
new_freq
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment