Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
d26d566e
Commit
d26d566e
authored
Apr 01, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Please flake8/pep8
parent
2a2d63c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
21 deletions
+18
-21
printcore.py
printrun/printcore.py
+13
-11
pronsole.py
printrun/pronsole.py
+5
-10
No files found.
printrun/printcore.py
View file @
d26d566e
...
@@ -68,13 +68,16 @@ class printcore():
...
@@ -68,13 +68,16 @@ class printcore():
self
.
baud
=
None
self
.
baud
=
None
self
.
port
=
None
self
.
port
=
None
self
.
analyzer
=
gcoder
.
GCode
()
self
.
analyzer
=
gcoder
.
GCode
()
self
.
printer
=
None
# Serial instance connected to the printer,
# Serial instance connected to the printer, should be None when
# should be None when disconnected
# disconnected
self
.
clear
=
0
# clear to send, enabled after responses
self
.
printer
=
None
self
.
online
=
False
# The printer has responded to the initial command
# clear to send, enabled after responses
# and is active
# FIXME: should probably be changed to a sliding window approach
self
.
printing
=
False
# is a print currently running, true if printing
self
.
clear
=
0
# , false if paused
# The printer has responded to the initial command and is active
self
.
online
=
False
# is a print currently running, true if printing, false if paused
self
.
printing
=
False
self
.
mainqueue
=
None
self
.
mainqueue
=
None
self
.
priqueue
=
Queue
(
0
)
self
.
priqueue
=
Queue
(
0
)
self
.
queueindex
=
0
self
.
queueindex
=
0
...
@@ -298,7 +301,7 @@ class printcore():
...
@@ -298,7 +301,7 @@ class printcore():
if
line
.
startswith
(
tuple
(
self
.
greetings
))
or
line
.
startswith
(
'ok'
):
if
line
.
startswith
(
tuple
(
self
.
greetings
))
or
line
.
startswith
(
'ok'
):
self
.
clear
=
True
self
.
clear
=
True
if
line
.
startswith
(
'ok'
)
and
"T:"
in
line
and
self
.
tempcb
:
if
line
.
startswith
(
'ok'
)
and
"T:"
in
line
and
self
.
tempcb
:
#callback for temp, status, whatever
#
callback for temp, status, whatever
try
:
self
.
tempcb
(
line
)
try
:
self
.
tempcb
(
line
)
except
:
traceback
.
print_exc
()
except
:
traceback
.
print_exc
()
elif
line
.
startswith
(
'Error'
):
elif
line
.
startswith
(
'Error'
):
...
@@ -313,7 +316,6 @@ class printcore():
...
@@ -313,7 +316,6 @@ class printcore():
try
:
try
:
toresend
=
int
(
linewords
.
pop
(
0
))
toresend
=
int
(
linewords
.
pop
(
0
))
self
.
resendfrom
=
toresend
self
.
resendfrom
=
toresend
#print str(toresend)
break
break
except
:
except
:
pass
pass
...
@@ -473,7 +475,7 @@ class printcore():
...
@@ -473,7 +475,7 @@ class printcore():
self
.
_stop_sender
()
self
.
_stop_sender
()
try
:
try
:
if
self
.
startcb
:
if
self
.
startcb
:
#callback for printing started
#
callback for printing started
try
:
self
.
startcb
(
resuming
)
try
:
self
.
startcb
(
resuming
)
except
:
except
:
self
.
logError
(
_
(
"Print start callback failed with:"
)
+
self
.
logError
(
_
(
"Print start callback failed with:"
)
+
...
@@ -484,7 +486,7 @@ class printcore():
...
@@ -484,7 +486,7 @@ class printcore():
self
.
log
.
clear
()
self
.
log
.
clear
()
self
.
sent
=
[]
self
.
sent
=
[]
if
self
.
endcb
:
if
self
.
endcb
:
#callback for printing done
#
callback for printing done
try
:
self
.
endcb
()
try
:
self
.
endcb
()
except
:
except
:
self
.
logError
(
_
(
"Print end callback failed with:"
)
+
self
.
logError
(
_
(
"Print end callback failed with:"
)
+
...
...
printrun/pronsole.py
View file @
d26d566e
...
@@ -291,10 +291,6 @@ class BuildDimensionsSetting(wxSetting):
...
@@ -291,10 +291,6 @@ class BuildDimensionsSetting(wxSetting):
self
.
value
=
"
%.02
fx
%.02
fx
%.02
f
%+.02
f
%+.02
f
%+.02
f
%+.02
f
%+.02
f
%+.02
f"
%
tuple
(
values
)
self
.
value
=
"
%.02
fx
%.02
fx
%.02
f
%+.02
f
%+.02
f
%+.02
f
%+.02
f
%+.02
f
%+.02
f"
%
tuple
(
values
)
class
Settings
(
object
):
class
Settings
(
object
):
#def _temperature_alias(self): return {"pla":210, "abs":230, "off":0}
#def _temperature_validate(self, v):
# if v < 0: raise ValueError("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0.")
#def _bedtemperature_alias(self): return {"pla":60, "abs":110, "off":0}
def
_baudrate_list
(
self
):
return
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
,
"250000"
]
def
_baudrate_list
(
self
):
return
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
,
"250000"
]
def
__init__
(
self
,
root
):
def
__init__
(
self
,
root
):
...
@@ -587,7 +583,7 @@ class pronsole(cmd.Cmd):
...
@@ -587,7 +583,7 @@ class pronsole(cmd.Cmd):
promptstr
=
self
.
promptstrs
[
"online"
]
promptstr
=
self
.
promptstrs
[
"online"
]
else
:
else
:
promptstr
=
self
.
promptstrs
[
"fallback"
]
promptstr
=
self
.
promptstrs
[
"fallback"
]
if
not
"
%
"
in
promptstr
:
if
"
%
"
not
in
promptstr
:
return
promptstr
return
promptstr
else
:
else
:
specials
=
{}
specials
=
{}
...
@@ -948,9 +944,9 @@ class pronsole(cmd.Cmd):
...
@@ -948,9 +944,9 @@ class pronsole(cmd.Cmd):
if
rci
is
not
None
:
if
rci
is
not
None
:
rci
.
close
()
rci
.
close
()
rco
.
close
()
rco
.
close
()
#if definition != "":
#
if definition != "":
# self.log("Saved '"+key+"' to '"+self.rc_filename+"'")
# self.log("Saved '"+key+"' to '"+self.rc_filename+"'")
#else:
#
else:
# self.log("Removed '"+key+"' from '"+self.rc_filename+"'")
# self.log("Removed '"+key+"' from '"+self.rc_filename+"'")
except
Exception
,
e
:
except
Exception
,
e
:
self
.
logError
(
"Saving failed for "
,
key
+
":"
,
str
(
e
))
self
.
logError
(
"Saving failed for "
,
key
+
":"
,
str
(
e
))
...
@@ -1349,7 +1345,7 @@ class pronsole(cmd.Cmd):
...
@@ -1349,7 +1345,7 @@ class pronsole(cmd.Cmd):
self
.
log
(
_
(
"Starting print"
))
self
.
log
(
_
(
"Starting print"
))
self
.
p
.
send_now
(
"M24"
)
self
.
p
.
send_now
(
"M24"
)
self
.
sdprinting
=
1
self
.
sdprinting
=
1
#self.recvlisteners.remove(self.waitforsdresponse)
#
self.recvlisteners.remove(self.waitforsdresponse)
return
return
if
"Done printing file"
in
l
:
if
"Done printing file"
in
l
:
self
.
log
(
l
)
self
.
log
(
l
)
...
@@ -1357,7 +1353,7 @@ class pronsole(cmd.Cmd):
...
@@ -1357,7 +1353,7 @@ class pronsole(cmd.Cmd):
self
.
recvlisteners
.
remove
(
self
.
waitforsdresponse
)
self
.
recvlisteners
.
remove
(
self
.
waitforsdresponse
)
return
return
if
"SD printing byte"
in
l
:
if
"SD printing byte"
in
l
:
#M27 handler
#
M27 handler
try
:
try
:
resp
=
l
.
split
()
resp
=
l
.
split
()
vals
=
resp
[
-
1
]
.
split
(
"/"
)
vals
=
resp
[
-
1
]
.
split
(
"/"
)
...
@@ -1606,7 +1602,6 @@ class pronsole(cmd.Cmd):
...
@@ -1606,7 +1602,6 @@ class pronsole(cmd.Cmd):
if
self
.
sdprinting
:
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M27"
)
self
.
p
.
send_now
(
"M27"
)
time
.
sleep
(
interval
)
time
.
sleep
(
interval
)
#print (self.tempreadings.replace("\r", "").replace("T", "Hotend").replace("B", "Bed").replace("\n", "").replace("ok ", ""))
if
self
.
p
.
printing
:
if
self
.
p
.
printing
:
preface
=
_
(
"Print progress: "
)
preface
=
_
(
"Print progress: "
)
progress
=
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
progress
=
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment