Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
total_control_app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Drechsler
total_control_app
Commits
ab3b000d
Commit
ab3b000d
authored
Aug 28, 2018
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a branch for tidynig up, and for now if daq not found it prints outputs
parent
aa030d56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
52 deletions
+55
-52
ADoutputs.py
ADoutputs.py
+51
-48
myToolbar.py
myToolbar.py
+4
-4
No files found.
ADoutputs.py
View file @
ab3b000d
...
@@ -7,6 +7,7 @@ Created on Wed May 30 15:27:17 2018
...
@@ -7,6 +7,7 @@ Created on Wed May 30 15:27:17 2018
from
__future__
import
absolute_import
,
division
,
print_function
from
__future__
import
absolute_import
,
division
,
print_function
daqfound
=
True
try
:
try
:
from
mcculw
import
ul
from
mcculw
import
ul
...
@@ -20,65 +21,67 @@ try:
...
@@ -20,65 +21,67 @@ try:
except
:
except
:
print
(
'import error: mcculw not installed. In linux this might not be available. '
)
print
(
'import error: mcculw not installed. In linux this might not be available. '
)
daqfound
=
False
#%%
#%%
class
daq_DO
(
object
):
class
daq_DO
(
object
):
def
__init__
(
self
,
out_num
):
def
__init__
(
self
,
out_num
):
global
daqfound
self
.
board_num
=
0
self
.
board_num
=
0
self
.
digital_props
=
DigitalProps
(
self
.
board_num
)
self
.
out_num
=
out_num
if
daqfound
:
# Find the first port that supports output, defaulting to None
self
.
digital_props
=
DigitalProps
(
self
.
board_num
)
# if one is not found.
self
.
port
=
next
(
# Find the first port that supports output, defaulting to None
(
port
for
port
in
self
.
digital_props
.
port_info
# if one is not found.
if
port
.
supports_output
),
None
)
self
.
port
=
next
(
(
port
for
port
in
self
.
digital_props
.
port_info
# If the port is configurable, configure it for output
if
port
.
supports_output
),
None
)
if
self
.
port
!=
None
and
self
.
port
.
is_port_configurable
:
# If the port is configurable, configure it for output
if
self
.
port
!=
None
and
self
.
port
.
is_port_configurable
:
try
:
ul
.
d_config_port
(
self
.
board_num
,
self
.
port
.
type
,
DigitalIODirection
.
OUT
)
except
ULError
as
e
:
self
.
show_ul_error
(
e
)
if
daqfound
:
def
set_out
(
self
,
bit_value
):
try
:
try
:
ul
.
d_config_port
(
# Output the value to the board
self
.
board_num
,
self
.
port
.
type
,
DigitalIODirection
.
OUT
)
ul
.
d_bit_out
(
self
.
board_num
,
self
.
port
.
type
,
self
.
out_num
,
bit_value
)
except
ULError
as
e
:
except
ULError
as
e
:
self
.
show_ul_error
(
e
)
self
.
show_ul_error
(
e
)
else
:
def
set_out
(
self
,
bit_value
):
self
.
out_num
=
out_num
return
bit_value
,
self
.
out_num
def
set_out
(
self
,
bit_value
):
try
:
# Output the value to the board
ul
.
d_bit_out
(
self
.
board_num
,
self
.
port
.
type
,
self
.
out_num
,
bit_value
)
except
ULError
as
e
:
self
.
show_ul_error
(
e
)
def
get_digital_out
(
self
):
try
:
state
=
ul
.
d_bit_in
(
self
.
board_num
,
self
.
port
.
type
,
self
.
out_num
)
print
(
state
)
except
ValueError
:
return
0
class
daq_AO
(
object
):
class
daq_AO
(
object
):
def
__init__
(
self
,
out_num
):
def
__init__
(
self
,
out_num
):
global
daqfound
self
.
board_num
=
0
self
.
board_num
=
0
self
.
ao_props
=
AnalogOutputProps
(
self
.
board_num
)
self
.
out_num
=
out_num
self
.
out_num
=
out_num
if
daqfound
:
def
set_out
(
self
,
value
):
self
.
ao_props
=
AnalogOutputProps
(
self
.
board_num
)
try
:
if
daqfound
:
ul
.
v_out
(
self
.
board_num
,
self
.
out_num
,
ao_range
,
value
)
def
set_out
(
self
,
value
):
except
ULError
as
e
:
try
:
self
.
show_ul_error
(
e
)
ul
.
v_out
(
self
.
board_num
,
self
.
out_num
,
ao_range
,
value
)
except
ULError
as
e
:
self
.
show_ul_error
(
e
)
def
get_analog_out
(
self
):
#ao_range = self.ao_props.available_ranges[0]
try
:
def
get_analog_out
(
self
):
state
=
ul
.
a_in
(
self
.
board_num
,
self
.
out_num
,
ao_range
)
#ao_range = self.ao_props.available_ranges[0]
print
(
state
)
try
:
except
ValueError
:
state
=
ul
.
a_in
(
self
.
board_num
,
self
.
out_num
,
ao_range
)
return
0
print
(
state
)
except
ValueError
:
return
0
else
:
def
set_out
(
self
,
value
):
return
value
,
self
.
out_num
######################################################################################
######################################################################################
myToolbar.py
View file @
ab3b000d
...
@@ -92,11 +92,11 @@ class myToolbarMenu(QWidget):
...
@@ -92,11 +92,11 @@ class myToolbarMenu(QWidget):
settings
.
endGroup
()
settings
.
endGroup
()
def
first_load
(
self
,
aos
):
def
first_load
(
self
,
aos
):
try
:
settings
=
QSettings
(
'C:
\\
Users
\\
Usuario
\\
Documents
\\
control_app
\\
config.ini'
,
QSettings
.
IniFormat
)
settings
=
QSettings
(
'C:
\\
Users
\\
Usuario
\\
Documents
\\
control_app
\\
config.ini'
,
QSettings
.
IniFormat
)
except
:
if
not
settings
:
print
(
'Warning: no config.ini file in control_app folder. Pleace, be kindful and create one'
)
print
(
'Warning: no config.ini file in control_app folder. Pleace, be kindful and create one'
)
return
return
0
settings
.
beginGroup
(
'Ventana'
)
settings
.
beginGroup
(
'Ventana'
)
for
ao
in
aos
:
for
ao
in
aos
:
...
...
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