Fixed a bug causing gcodeInterpreter to hiccup on GCODES containing invalid coordinates such as Xnan or Yinf, causing in turn the file API to fail until the offending file was deleted and its metadata removed
This commit is contained in:
parent
8bfa3ef250
commit
ce363ce409
1 changed files with 5 additions and 2 deletions
|
|
@ -262,13 +262,16 @@ def getCodeInt(line, code):
|
||||||
|
|
||||||
|
|
||||||
def getCodeFloat(line, code):
|
def getCodeFloat(line, code):
|
||||||
|
import math
|
||||||
n = line.find(code) + 1
|
n = line.find(code) + 1
|
||||||
if n < 1:
|
if n < 1:
|
||||||
return None
|
return None
|
||||||
m = line.find(' ', n)
|
m = line.find(' ', n)
|
||||||
try:
|
try:
|
||||||
if m < 0:
|
if m < 0:
|
||||||
return float(line[n:])
|
val = float(line[n:])
|
||||||
return float(line[n:m])
|
else:
|
||||||
|
val = float(line[n:m])
|
||||||
|
return val if not (math.isnan(val) or math.isinf(val)) else None
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue