Skip to content

Commit

Permalink
01.21.26
Browse files Browse the repository at this point in the history
  • Loading branch information
sp15442 authored and sp15442 committed Jan 16, 2014
1 parent 6534c18 commit b812d23
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 23 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01.21.03
01.21.26
Binary file added audio/dewpoint.raw
Binary file not shown.
Binary file added audio/mp3/dewpoint.mp3
Binary file not shown.
Binary file added audio/mp3/pioggiainatto.mp3
Binary file not shown.
Binary file added audio/pioggiainatto.raw
Binary file not shown.
Binary file added audio/silence10s.raw
Binary file not shown.
1 change: 1 addition & 0 deletions camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def take_pictures(self) :
nTry = 0
bError = True
cmd = "gphoto2 --port " + usbcamera + " --capture-image-and-download " + gphoto2options[i] + " --filename=" + filename
#cmd = "gphoto2 --port " + usbcamera + gphoto2options[i] + " --capture-image-and-download --filename=" + filename
while ( nTry < 3 and bError == True):
bError = False
p = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
Expand Down
3 changes: 3 additions & 0 deletions database.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def resetDB(filename='db/swpi.s3db',delete_all=False):
print "DB Resetted "

if __name__ == '__main__':
resetDB(delete_all=True)
exit(0)

conn = sqlite3.connect('db/swpi.s3db',200)
dbCursor = conn.cursor()
dbCursor.execute("SELECT * FROM METEO where datetime(TIMESTAMP_LOCAL) > datetime('now','-1 day') order by rowid asc limit 1")
Expand Down
42 changes: 26 additions & 16 deletions humod.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,8 @@ def disconnect(self):
cfg = config.config(configfile)

modem = Modem(cfg.dongleDataPort,cfg.dongleAudioPort,cfg.dongleCtrlPort,cfg)
modem.enable_textmode(True)
modem.enable_clip(True)
modem.enable_nmi(True)

print modem

print ""
log( "Modem Model : " + modem.show_model())
log( "Revision : " + modem.show_revision())
Expand All @@ -504,19 +502,31 @@ def disconnect(self):
log( "Device Center : " + modem.get_service_center()[0] + " " + str(modem.get_service_center()[1]))
log( "Signal quality : " + str(modem.get_rssi()))


log( "Checking new sms messages...")
smslist = modem.sms_list()
for message in smslist:
print message

#modem.enable_textmode(True)
modem.enable_clip(True)
modem.enable_nmi(True)



# log("trying to send sms to %s" % cfg.number_to_send)
# modem.sms_send(cfg.number_to_send, "prova")

log( "Trying to connect to internet with 3G dongle ....")
time.sleep(1)
modem.connectwvdial()
time.sleep(2)
waitForIP()
IP = getIP()
if IP != None:
log("Connected with IP :" + IP)
time.sleep(10)

log( "Trying to disconnect 3G dongle ....")
modem.disconnectwvdial()
# log( "Trying to connect to internet with 3G dongle ....")
# time.sleep(1)
# modem.connectwvdial()
# time.sleep(2)
# waitForIP()
# IP = getIP()
# if IP != None:
# log("Connected with IP :" + IP)
# time.sleep(10)
#
# log( "Trying to disconnect 3G dongle ....")
# modem.disconnectwvdial()

10 changes: 10 additions & 0 deletions radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ def run(self):
listOfMessages.append("./audio/mp3/" + str(intera) + ".mp3")
listOfMessages.append("./audio/mp3/degree.mp3")

# Dew point
if ( globalvars.meteo_data.dew_point != None ):
listOfMessages.append("./audio/mp3/silence05s.mp3")
listOfMessages.append("./audio/mp3/dewpoint.mp3")
if ( globalvars.meteo_data.dew_point < 0) :
listOfMessages.append("./audio/mp3/minus.mp3")
intera = int(round( abs(globalvars.meteo_data.dew_point) ))
listOfMessages.append("./audio/mp3/" + str(intera) + ".mp3")
listOfMessages.append("./audio/mp3/degree.mp3")

# Pressure
if ( globalvars.meteo_data.rel_pressure != None ):
thousands, rem = divmod(round(globalvars.meteo_data.rel_pressure), 1000)
Expand Down
3 changes: 2 additions & 1 deletion sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def ReadDHT(self):
else:
output = subprocess.check_output(["./DHT/DHT_rf","22","18"])
#print output
matches = re.search("Temp =\s+([0-9.]+)", output)
matches = re.search("Temp =\s+([0-9.]+)", output)
#matches = re.search("Temp\s*=\s*(-?[\d.]+)", output) # Alessandro
if ( matches):
dht_temp = float(matches.group(1))
if ( self.cfg.sensor_type != "WH1080-RFM01" ):
Expand Down
4 changes: 2 additions & 2 deletions sensor_wh1080rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def ReadData(self):
return "None",0,0,0,0,"",0,0
temp = float(text[1].split(",")[1])
hum = float(text[1].split(",")[3])
Wind_speed = float(text[2].split(",")[1])
Gust_Speed = float(text[2].split(",")[3])
Wind_speed = float(text[2].split(",")[1])*self.cfg.windspeed_gain + self.cfg.windspeed_offset
Gust_Speed = float(text[2].split(",")[3])*self.cfg.windspeed_gain + self.cfg.windspeed_offset
dir_code = (text[2].split(",")[4])
dire = int(text[2].split(",")[5])
rain = float(text[3].split(",")[1])
Expand Down
2 changes: 1 addition & 1 deletion sensor_wmr100.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _parse_wind_record(self, record):
gustSpeed = 0.1 * (((record[5] & 0x0F) << 8) + record[4])

# Report Data
self._report_wind(dir, dirDeg, dirStr, gustSpeed, avgSpeed)
self._report_wind(dir, dirDeg, dirStr, gustSpeed*3.6, avgSpeed*3.6)

#if ( globalvars.meteo_data.last_measure_time == None or (datetime.datetime.now()-globalvars.meteo_data.last_measure_time).seconds >= 60 ) :
globalvars.meteo_data.status = 0
Expand Down
10 changes: 10 additions & 0 deletions swpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,16 @@ def answer_call(modem, message):
listOfMessages.append("./audio/" + str(intera) + ".raw")
listOfMessages.append("./audio/percent.raw")

# # Dew point
if ( globalvars.meteo_data.dew_point != None ):
listOfMessages.append("./audio/silence05s.raw")
listOfMessages.append("./audio/dewpoint.raw")
if ( globalvars.meteo_data.dew_point < 0) :
listOfMessages.append("./audio/minus.raw")
intera = int(round( abs(globalvars.meteo_data.dew_point) ))
listOfMessages.append("./audio/" + str(intera) + ".raw")
listOfMessages.append("./audio/degree.raw")

#Cloud base
if (globalvars.meteo_data.cloud_base_altitude != None ) :
if ( globalvars.meteo_data.cloud_base_altitude != -1 ) :
Expand Down
12 changes: 10 additions & 2 deletions wh1080_rf/wh1080_rf.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,10 +947,16 @@ uint8_t _crc8( uint8_t *addr, uint8_t len)
void scheduler_realtime() {

return;

int priority = 70;

struct sched_param p;

p.__sched_priority = sched_get_priority_max(SCHED_RR);

printf("Set priority to %d \n", priority );
p.__sched_priority = priority;
// p.__sched_priority = sched_get_priority_max(SCHED_RR);

return;
if( sched_setscheduler( 0, SCHED_RR, &p ) == -1 ) {
perror("Failed to switch to realtime scheduler.");
}
Expand All @@ -959,6 +965,8 @@ void scheduler_realtime() {
void scheduler_standard() {

return;

printf("Set priority to %d \n", 0 );
struct sched_param p;

p.__sched_priority = 0;
Expand Down

0 comments on commit b812d23

Please sign in to comment.