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
fd6eb8ac
Commit
fd6eb8ac
authored
Jun 06, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reset command. Make gettemp and monitor less misleading
parent
69b0eed1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
printcore.py
printcore.py
+9
-1
pronsole.py
pronsole.py
+12
-5
No files found.
printcore.py
View file @
fd6eb8ac
...
@@ -59,6 +59,14 @@ class printcore():
...
@@ -59,6 +59,14 @@ class printcore():
self
.
printer
=
Serial
(
self
.
port
,
self
.
baud
,
timeout
=
5
)
self
.
printer
=
Serial
(
self
.
port
,
self
.
baud
,
timeout
=
5
)
Thread
(
target
=
self
.
_listen
)
.
start
()
Thread
(
target
=
self
.
_listen
)
.
start
()
def
reset
(
self
):
"""Reset the printer
"""
if
(
self
.
printer
):
self
.
printer
.
setDTR
(
1
)
self
.
printer
.
setDTR
(
0
)
def
_listen
(
self
):
def
_listen
(
self
):
"""This function acts on messages from the firmware
"""This function acts on messages from the firmware
"""
"""
...
@@ -78,7 +86,7 @@ class printcore():
...
@@ -78,7 +86,7 @@ class printcore():
print
"RECV: "
,
line
print
"RECV: "
,
line
if
(
line
.
startswith
(
'start'
)
or
line
.
startswith
(
'ok'
)
or
"T:"
in
line
):
if
(
line
.
startswith
(
'start'
)
or
line
.
startswith
(
'ok'
)
or
"T:"
in
line
):
self
.
clear
=
True
self
.
clear
=
True
if
not
self
.
online
and
self
.
onlinecb
is
not
None
:
if
(
not
self
.
online
or
line
.
startswith
(
'start'
))
and
self
.
onlinecb
is
not
None
:
self
.
onlinecb
()
self
.
onlinecb
()
self
.
online
=
True
self
.
online
=
True
if
(
line
.
startswith
(
'ok'
)):
if
(
line
.
startswith
(
'ok'
)):
...
...
pronsole.py
View file @
fd6eb8ac
...
@@ -401,6 +401,12 @@ class pronsole(cmd.Cmd):
...
@@ -401,6 +401,12 @@ class pronsole(cmd.Cmd):
except
:
except
:
pass
pass
def
do_reset
(
self
,
l
):
self
.
p
.
reset
()
def
help_reset
(
self
):
print
"Resets the printer."
def
do_sdprint
(
self
,
l
):
def
do_sdprint
(
self
,
l
):
if
not
self
.
p
.
online
:
if
not
self
.
p
.
online
:
print
"Printer is not online. Try connect to it first."
print
"Printer is not online. Try connect to it first."
...
@@ -466,14 +472,14 @@ class pronsole(cmd.Cmd):
...
@@ -466,14 +472,14 @@ class pronsole(cmd.Cmd):
def
tempcb
(
self
,
l
):
def
tempcb
(
self
,
l
):
if
"T:"
in
l
:
if
"T:"
in
l
:
print
l
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
)
print
l
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
)
self
.
recvlisteners
.
remove
(
self
.
tempcb
)
def
do_gettemp
(
self
,
l
):
def
do_gettemp
(
self
,
l
):
if
self
.
p
.
online
:
if
self
.
p
.
online
:
self
.
recvlisteners
+=
[
self
.
tempcb
]
self
.
recvlisteners
+=
[
self
.
tempcb
]
self
.
p
.
send_now
(
"M105"
)
self
.
p
.
send_now
(
"M105"
)
time
.
sleep
(
0.5
)
time
.
sleep
(
0.75
)
self
.
recvlisteners
.
remove
(
self
.
tempcb
)
def
help_gettemp
(
self
):
def
help_gettemp
(
self
):
print
"Read the extruder and bed temperature."
print
"Read the extruder and bed temperature."
...
@@ -678,13 +684,14 @@ class pronsole(cmd.Cmd):
...
@@ -678,13 +684,14 @@ class pronsole(cmd.Cmd):
self
.
p
.
send_now
(
"M105"
)
self
.
p
.
send_now
(
"M105"
)
if
(
self
.
sdprinting
):
if
(
self
.
sdprinting
):
self
.
p
.
send_now
(
"M27"
)
self
.
p
.
send_now
(
"M27"
)
time
.
sleep
(
interval
)
print
(
self
.
tempreadings
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
print
(
self
.
tempreadings
.
replace
(
"
\r
"
,
""
)
.
replace
(
"T"
,
"Hotend"
)
.
replace
(
"B"
,
"Bed"
)
.
replace
(
"
\n
"
,
""
)
.
replace
(
"ok "
,
""
))
if
(
self
.
p
.
printing
):
if
(
self
.
p
.
printing
):
print
"Print progress: "
,
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),
"
%
"
print
"Print progress: "
,
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),
"
%
"
if
(
self
.
sdprinting
):
if
(
self
.
sdprinting
):
print
"SD print progress: "
,
self
.
percentdone
,
"
%
"
print
"SD print progress: "
,
self
.
percentdone
,
"
%
"
time
.
sleep
(
interval
)
except
:
except
:
print
"Done monitoring."
print
"Done monitoring."
pass
pass
...
...
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