Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
MasterFIP - Testing
Project
Project
Details
Activity
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
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
MasterFIP - Testing
Commits
7dabae5e
Commit
7dabae5e
authored
Mar 30, 2017
by
Marek Gumiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test04 has multiple short delays instead of one long one.
parent
3b003c9f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
28 deletions
+35
-28
test04.py
python/test04.py
+35
-28
No files found.
python/test04.py
View file @
7dabae5e
...
...
@@ -13,7 +13,8 @@ import ptsexcept
import
time
REPETITIONS
=
20
DELAY
=
0.5
def
main
(
card
=
None
,
default_directory
=
'.'
,
suite
=
None
,
serial
=
""
):
...
...
@@ -33,45 +34,51 @@ def main (card=None, default_directory='.',suite=None, serial=""):
# any error there causes critical error and test termination
dut
=
fmc
.
fmcmasterfip
(
carrier
,
abspath
,
util
.
FIRMWARE_PATH
)
time
.
sleep
(
10
)
###############################################################################
util
.
section_msg
(
"Reading and verifying unique ID"
)
id
=
dut
.
get_unique_id
()
if
id
!=
-
1
:
util
.
info_msg
(
"Unique ID read from DS18B20:
%.12
X"
%
id
)
else
:
util
.
info_msg
(
"Failed to read unique ID from DS18B20"
%
id
)
test_results
[
'Get ID from DS18B20'
]
=
1
if
id
!=
-
1
else
0
# thermometer is read by gateware in some time intervals
# in order to avert using long sleep
# DS18B20 core is polled in small intervals
for
i
in
xrange
(
REPETITIONS
):
###############################################################################
time
.
sleep
(
DELAY
)
id
=
dut
.
get_unique_id
()
if
(
id
&
0xff
)
!=
0x28
:
util
.
info_msg
(
"Unique IDs LSB: 0x
%
X is different then 0x28 as specified in datasheet"
%
(
id
&
0xff
))
else
:
if
(
id
&
0xff
)
==
0x28
:
util
.
info_msg
(
"Unique IDs match pattern specified in datasheet"
)
test_results
[
'DS18B20 ID verification'
]
=
1
break
;
# if correct ID is not found in 10 repetitions
# it is assumed to be wrong
else
:
util
.
info_msg
(
"Unique IDs LSB: 0x
%
X is different then 0x28 as specified in datasheet"
%
(
id
&
0xff
))
test_results
[
'DS18B20 ID verification'
]
=
0
test_results
[
'DS18B20 ID verification'
]
=
1
if
(
id
&
0xff
)
==
0x28
else
0
###############################################################################
util
.
section_msg
(
"Verification of temperature"
)
temperature
=
dut
.
get_temp
()
for
i
in
xrange
(
REPETITIONS
):
time
.
sleep
(
DELAY
)
temperature
=
dut
.
get_temp
()
util
.
info_msg
(
"Read board temperature:
%
d"
%
temperature
)
if
(
temperature
>=
util
.
mintemp
)
and
(
temperature
<=
util
.
maxtemp
):
util
.
info_msg
(
"Read correct board temperature:
%
d"
%
temperature
)
test_results
[
'Temperature value'
]
=
1
break
else
:
test_results
[
'Temperature value'
]
=
0
if
temperature
>
util
.
maxtemp
:
util
.
err_msg
(
"Temperature exceeds
%
d C"
%
util
.
maxtemp
)
test_results
[
'Temperature value'
]
=
0
elif
temperature
<
util
.
mintemp
:
else
:
util
.
err_msg
(
"Temperature is lower then
%
d C"
%
util
.
mintemp
)
test_results
[
'Temperature value'
]
=
0
else
:
test_results
[
'Temperature value'
]
=
1
###############################################################################
...
...
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