jdiazbb / rfxcmd

Automatically exported from code.google.com/p/rfxcmd
1 stars 0 forks source link

Crash with wind4 sensor (fix included) #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run rfxcmd
2. Wait for wind4 sensor to report
3.

What is the expected output? What do you see instead?

A full output.

A crash.

What version of the product are you using? On what operating system?

rfxcmd-v01k-beta and rfxcmd-v01g on linux Debian GNU/Linux 6.0 with python 
Python 2.6.6

Please provide any additional information below.

When receiving a wind4 sensor you see the followin crash

Received                = 10 56 04 00 98 16 01 24 00 0C 00 16 00 4B 00 4B 49
Date/Time               = 2012-11-04 23:12:16
Packet Length           = 10
Packettype              = Wind sensors
Traceback (most recent call last):
  File "./rfxcmd.py", line 1699, in <module>
    rawcmd = read_rfx()
  File "./rfxcmd.py", line 1137, in read_rfx
    decodePacket( message )
  File "./rfxcmd.py", line 958, in decodePacket
    chill_high = clearBit(int(temp_high,16),7)
TypeError: int() can't convert non-string with explicit base

Here is the fix against rfxcmd-v01k-beta:

 diff rfxcmd.py rfxcmd-windchill-fix.py
947c947
<               # Chill factor (15,16,17)

---
>               # Chill factor (14,15)
949,951c949,951
<                       chill_high = ByteToHex(message[15])
<                       chill_low = ByteToHex(message[16])
<                       chill_pol = testBit(int(chill_high,16),15)

---
>                       chill_high = ByteToHex(message[14])
>                       chill_low = ByteToHex(message[15])
>                       chill_pol = testBit(int(chill_high,16),14)
958c958
<                       chill_high = clearBit(int(temp_high,16),7)

---
>                       chill_high = clearBit(int(chill_high,16),7)
960c960
<                       windchill = ( int(chill_high,16) + int(chill_low,16) ) 
* 0.1

---
>                       windchill = ( chill_high + int(chill_low,16) ) * 0.1
1847c1847
< exit()
\ No newline at end of file

---
> exit()

Here is a fix for v01g:

 diff rfxcmd.py rfxcmd-windchill-fix.py
596c596
<               # Chill factor (15,16,17)

---
>               # Chill factor (14,15)
598,600c598,600
<                       chill_high = ByteToHex(message[15])
<                       chill_low = ByteToHex(message[16])
<                       chill_pol = testBit(int(chill_high,16),15)

---
>                       chill_high = ByteToHex(message[14])
>                       chill_low = ByteToHex(message[15])
>                       chill_pol = testBit(int(chill_high,16),14)
607c607
<                       chill_high = clearBit(int(temp_high,16),7)

---
>                       chill_high = clearBit(int(chill_high,16),7)
609c609
<                       windchill = ( int(chill_high,16) + int(chill_low,16) ) 
* 0.1

---
>                       windchill = ( chill_high + int(chill_low,16) ) * 0.1
1154c1154
< exit()
\ No newline at end of file

---
> exit()

Regards,

RIchard

Original issue reported on code.google.com by Vand...@gmail.com on 4 Nov 2012 at 10:14

GoogleCodeExporter commented 8 years ago
This is fixed in upcoming version. Thank you for your help.

Original comment by sebastia...@gmail.com on 10 Nov 2012 at 11:21