Skip to content

Commit

Permalink
Merge pull request #17 from ovrheat/master
Browse files Browse the repository at this point in the history
Fixed incorrect behaviour in the rtl-sdr driver (rtlsdr_timesync)
  • Loading branch information
ToninoTarsi committed Apr 23, 2016
2 parents 9da8321 + 07b37c8 commit 50f1809
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


A Sint Wind is a wind condition ( and other meteo data ) telephone answering machine.
This implementation uses a Raspberry PI with an Huawei 3G dongle. The Sint Wind is compatible with different kind of Meteo Sensors ( WH1080,Davis,TX32,BMP085 .. ).
This implementation uses a Raspberry PI with an Huawei 3G dongle. The Sint Wind is compatible with different kind of Meteo Sensors (WH1080, Davis, TX32, BMP085...).

Complete documentation on www.vololiberomontecucco.it

Expand Down Expand Up @@ -37,15 +37,16 @@ sudo apt-get -y install gphoto2 python-piggyphoto dcraw libgphoto2-port10

sudo apt-get -y install python-requests python-spidev python-pygame python-setuptools libusb-1.0-0-dev cmake





USB library:
**USB library:**
- hidapi
- cython-hidapi
- cython


RTL-SDR libraries (included):
**RTL-SDR libraries** (included)**:**
- cd rtl-sdr
- mkdir build
- cd build
Expand All @@ -54,7 +55,7 @@ RTL-SDR libraries (included):
- sudo make install


RTL_433 (included):
**RTL_433** (included - just a little modified, see /rtl_433/README-SWPI.md)**:**
- cd rtl_433
- mkdir build
- cd build
Expand All @@ -63,6 +64,6 @@ RTL_433 (included):
- sudo make install


Main program start : sudo python swpi.py
**Main program start:** sudo python swpi.py


5 changes: 5 additions & 0 deletions rtl_433/README-SWPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Sources of this copy of rtl_433 (WH1080 decoder only) have been slightly modified
to (re)write received data in a txt file in /dev/shm,
in order to mantain compatibility with swpi's working model.

16 changes: 11 additions & 5 deletions sensor_wh1080rtlsdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def ReadData(self):
elif str(line['msg_type']) == '1':
if str(self.cfg.rtlsdr_timesync) == 'True':
print "\n"
log("*** WH1080_RTL-SDR: Datetime data received ***")
log("Setting system time...")
try:
t_year = str(line['year'])

Expand Down Expand Up @@ -180,7 +180,10 @@ def ReadData(self):
log("System time adjusted from WH1080_RTL-SDR.")
return "Time",0,0,0,0,"",0,0
except:
log("Error adjusting system time from WH1080_RTL-SDR")
log("Error adjusting system time from WH1080_RTL-SDR")
else:
log("WH1080_RTL-SDR: rtlsdr_timesync is disabled.")
return "Time",0,0,0,0,"",0,0
except:
log("Received data are not in json format. Dropped...")
return "None",0,0,0,0,"",0,0
Expand Down Expand Up @@ -235,14 +238,16 @@ def GetData(self):
time.sleep(10)
new_last_data_time = modification_date('/dev/shm/wh1080-rtl_433.txt')


log("New data received from WH1080_RTL-SDR station %s. Processing..." % station_id)
if station_id != "Time":
log("New data received from WH1080_RTL-SDR station %s. Processing..." % station_id)
else:
log("Datetime signal received from WH1080_RTL-SDR station. Processing...")
last_data_time = new_last_data_time

station_id,temp,hum,Wind_speed,Gust_Speed,dir_code,dire,rain = self.ReadData()

if ( station_id == "Time"):
log("Datetime data received from WH1080_RTL-SDR. Sleeping while waiting for weather data...")
log("Sleeping while waiting for weather data...")
tosleep = 50-(datetime.datetime.now()-last_data_time).seconds
if DEBUG: print "Sleeping ", tosleep
if (tosleep > 0 and tosleep < 50 ):
Expand All @@ -267,3 +272,4 @@ def GetData(self):

while 1:
ss.GetData()

0 comments on commit 50f1809

Please sign in to comment.