Commit 73055e59 authored by Kliment Yanev's avatar Kliment Yanev

Fix math domain error in estimation code.

Make crash in estimation code not block file load.
Diable web interface by default.
parent a20c1fe4
...@@ -157,7 +157,7 @@ def estimate_duration(g): ...@@ -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
......
...@@ -55,10 +55,11 @@ from zbuttons import ZButtons ...@@ -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): ...@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment