Merge branch 'master' into remote_master

Conflicts:
	README.md
	ospi.py
This commit is contained in:
Dan-in-CA 2013-10-16 13:01:12 -07:00
commit 9585087749
38 changed files with 10817 additions and 10780 deletions

8
.gitignore vendored
View File

@ -1,6 +1,6 @@
web/
/data
/.settings
/data/programs.json
/data/sd.json
/data/snames.txt
*.pyc
.project
.pydevproject
/static/log/

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OSPi</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

10
.pydevproject Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/${PROJECT_DIR_NAME}</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>

View File

@ -12,6 +12,13 @@ UPDATES
===========
***********
October 16 2013
--------------
(Dan)<br/>
Additions, bug fixes:<br/>
1. Fixed a bug that would cause an error in program preview when a master was enabled.<br/>
2. Changing to manual mode would clear rain delay setting, Setting rain delay in manual mode would switch to program mode - fixed.
October 11 2013
--------------
(Dan)<br/>

14
ospi.py
View File

@ -11,10 +11,10 @@ except ImportError:
#### Revision information ####
gv.ver = 183
gv.rev = 138
gv.rev_date = '11/October/2013'
gv.rev = 139
gv.rev_date = '16/October/2013'
#### urls is a feature of web.py. When a GET request is recieved , the corrisponding class is executed.
#### urls is a feature of web.py. When a GET request is received , the corresponding class is executed.
urls = [
'/', 'home',
'/cv', 'change_values',
@ -193,8 +193,8 @@ def stop_stations():
return
def main_loop(): # Runs in a separate thread
""" ***** Main algorithm.***** """
print 'Starting main loop \n'
""" ***** Main timing algorithm.***** """
print 'Starting timing loop \n'
last_min = 0
while True: # infinite loop
gv.now = time.time()+((gv.sd['tz']/4)-12)*3600 # Current time based on UTC time from the Pi adjusted by the Time Zone setting from options. updated once per second.
@ -309,7 +309,7 @@ def main_loop(): # Runs in a separate thread
gv.sd['rdst'] = 0 # Rain delay stop time
jsave(gv.sd, 'sd')
time.sleep(1)
#### End of main loop ####
#### End of timing loop ####
def data(dataf):
"""Return contents of requested text file as string or create file if a missing config file."""
@ -556,7 +556,7 @@ class change_values:
gv.srvals = [0]*(gv.sd['nst']) # turn off all stations
set_output()
if qdict.has_key('mm') and qdict['mm'] == '0': clear_mm()
if qdict.has_key('rd') and qdict['rd'] != '0':
if qdict.has_key('rd') and qdict['rd'] != '0' and qdict['rd'] != '':
gv.sd['rdst'] = (gv.now+(int(qdict['rd'])*3600))
stop_onrain()
elif qdict.has_key('rd') and qdict['rd'] == '0': gv.sd['rdst'] = 0

View File

@ -1 +1,4 @@
Program, Zone, Duration, Finish Time, Date
Manual, S02, 0m5s, 12:06:53, Wed. 16 Oct 2013
Manual, S01, 0m6s, 20:51:03, Tue. 15 Oct 2013
Manual, S02, 0m8s, 20:50:54, Tue. 15 Oct 2013

1 Program Zone Duration Finish Time Date
2 Manual S02 0m5s 12:06:53 Wed. 16 Oct 2013
3 Manual S01 0m6s 20:51:03 Tue. 15 Oct 2013
4 Manual S02 0m8s 20:50:54 Tue. 15 Oct 2013

View File

@ -51,7 +51,7 @@ else w("<br><b>Log</b>: <font color=gray>n/a</font>");
w("<hr>");
// print html form
w("<form name=hf action=cv method=get><p>Password:<input type=password "+(sd['ipas']?"disabled":"")+" size=10 id=pwd name=pw></p>");
w("<input type=hidden name=en><input type=hidden name=rd value=0><input type=hidden name=rbt value=0><input type=hidden name=mm value=0></form>");
w("<input type=hidden name=en><input type=hidden name=rd value=''><input type=hidden name=rbt value=0><input type=hidden name=mm value=''></form>");
w("<button style=\"height:36\" onclick=\"hf.elements[1].value="+(1-sd['en'])+";hf.submit();\">"+imgstr(sd['en']?"stop":"start")+(sd['en']?"Stop Operation":"Start Operation")+"</button>");
w("<button style=\"height:36\" onclick=\"hf.elements[4].value="+(1-sd['mm'])+";hf.submit();\">"+imgstr(sd['mm']?"auto":"manual")+(sd['mm']?"Manual Off":"Manual On")+"</button>");
w("<button style=\"height:36\" onclick=\"setrd(hf,2)\">"+imgstr("rain")+"Rain Delay</button>");

View File

@ -53,8 +53,8 @@ function plot_bar(sid,start,pid,end) { // plot program bar
w("<div title=\""+snames[sid]+" ["+getrunstr(start,end)+"]\" align=\"center\" style=\"position:absolute;background-color:"+prog_color[(pid+3)%4]+";left:"+getx(sid)+"px;top:"+gety(start/60)+"px;border:0;width:"+stwidth+"px;height:"+((end-start)/60*stheight/60)+"px\">P"+pid+"</div>");
}
function plot_master(start,end) { // plot master station
w("<div title=\"Master ["+getrunstr(start,end)+"]\" style=\"position:absolute;background-color:#CCCC80;left:"+getx(mas-1)+"px;top:"+gety(start/60)+"px;border:0;width:"+stwidth+"px;height:"+((end-start)/60*stheight/60)+"px\"></div>");
//if(mas==0||start==end) return;
w("<div title=\"Master ["+getrunstr(start,end)+"]\" style=\"position:absolute;background-color:#CCCC80;left:"+getx(sd['mas']-1)+"px;top:"+gety(start/60)+"px;border:0;width:"+stwidth+"px;height:"+((end-start)/60*stheight/60)+"px\"></div>");
//if(sd['mas']==0||start==end) return;
//ctx.fillStyle="rgba(64,64,64,0.5)";
//ctx.fillRect(getx(mas-1),gety(start/60),stwidth,(end-start)/60*stheight/60);
}