Fix math domain error in estimation code.

Make crash in estimation code not block file load.
Diable web interface by default.
master
Kliment Yanev 2012-07-15 13:07:16 +02:00
parent a20c1fe4c0
commit 73055e59a8
2 changed files with 9 additions and 5 deletions

View File

@ -157,7 +157,7 @@ def estimate_duration(g):
# then calculate the time taken to complete the remaining distance # then calculate the time taken to complete the remaining distance
currenttravel = hypot3d(x, y, z, lastx, lasty, lastz) currenttravel = hypot3d(x, y, z, lastx, lasty, lastz)
distance = 2* ((lastf+f) * (f-lastf) * 0.5 ) / acceleration #2x because we have to accelerate and decelerate distance = abs(2* ((lastf+f) * (f-lastf) * 0.5 ) / acceleration) #2x because we have to accelerate and decelerate
if distance <= currenttravel and ( lastf + f )!=0 and f!=0: if distance <= currenttravel and ( lastf + f )!=0 and f!=0:
moveduration = 2 * distance / ( lastf + f ) moveduration = 2 * distance / ( lastf + f )
currenttravel -= distance currenttravel -= distance

View File

@ -55,10 +55,11 @@ from zbuttons import ZButtons
from graph import Graph from graph import Graph
import pronsole import pronsole
webavail = True webavail = False
try : try :
import cherrypy, webinterface if webavail:
from threading import Thread import cherrypy, webinterface
from threading import Thread
except: except:
print _("CherryPy is not installed. Web Interface Disabled.") print _("CherryPy is not installed. Web Interface Disabled.")
webavail = False webavail = False
@ -1552,7 +1553,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self.webInterface.AddLog(_("the print goes from %f mm to %f mm in X\nand is %f mm wide\n") % (Xmin, Xmax, Xtot)) self.webInterface.AddLog(_("the print goes from %f mm to %f mm in X\nand is %f mm wide\n") % (Xmin, Xmax, Xtot))
print _("the print goes from %f mm to %f mm in Y\nand is %f mm wide\n") % (Ymin, Ymax, Ytot) print _("the print goes from %f mm to %f mm in Y\nand is %f mm wide\n") % (Ymin, Ymax, Ytot)
print _("the print goes from %f mm to %f mm in Z\nand is %f mm high\n") % (Zmin, Zmax, Ztot) print _("the print goes from %f mm to %f mm in Z\nand is %f mm high\n") % (Zmin, Zmax, Ztot)
print _("Estimated duration (pessimistic): "), pronsole.estimate_duration(self.f) try:
print _("Estimated duration (pessimistic): "), pronsole.estimate_duration(self.f)
except:
pass
#import time #import time
#t0=time.time() #t0=time.time()
self.gviz.clear() self.gviz.clear()