Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL RS485 - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
Conv TTL RS485 - Testing
Commits
5a50f942
Commit
5a50f942
authored
Nov 06, 2014
by
Theodor-Adrian Stana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: Started work on changing output of therm_id.py
parent
431d5050
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
therm_id.py
pts/python/therm_id.py
+9
-2
No files found.
pts/python/therm_id.py
View file @
5a50f942
...
...
@@ -227,6 +227,9 @@ class CDS18B20:
temp
=
temp
/
16.0
return
temp
def
crc
(
self
,
val
):
ret
=
0
for
i
in
range
(
64
):
##-------------------------------------------------------------------------------------------------
## main --
...
...
@@ -250,11 +253,14 @@ def main(bus,tname,inf,log):
# Reading of unique ID
unique_id
=
ds18b20
.
read_serial_number
()
family_code
=
unique_id
&
0xff
crc
=
(
unique_id
&
0xff00000000000000
)
>>
56
if
(
unique_id
==
-
1
):
msg
=
"ERROR: TempID IC22: Unable to read 1-wire thermometer"
pel
.
set
(
msg
)
else
:
inf
.
write
(
"Unique ID:
%.12
X
\n
"
%
(
unique_id
))
unique_id
&=
0x00ffffffffffff00
inf
.
write
(
"Unique ID:
%012
X
\n
"
%
(
unique_id
))
# Reading of temperature
temp
=
ds18b20
.
read_temp
(
unique_id
)
...
...
@@ -267,7 +273,8 @@ def main(bus,tname,inf,log):
if
((
unique_id
&
0xFF
)
!=
FAMILY_CODE
):
family_code
=
unique_id
&
0xFF
msg
=
"ERROR: TempID IC22: Invalid family code: 0x
%.8
X
\n
"
%
(
family_code
)
msg
=
"ERROR: TempID IC22: Invalid family code (0x
%02
X)
\n
"
%
(
family_code
,
FAMILY_CODE
)
pel
.
set
(
msg
)
return
pel
.
get
()
...
...
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