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
c02e5865
Commit
c02e5865
authored
Jan 19, 2013
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #320 from colah/clean-monitor
Clean up the monitor command.
parents
2a943374
3fb7a3e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
pronsole.py
pronsole.py
+17
-9
No files found.
pronsole.py
View file @
c02e5865
...
...
@@ -1143,6 +1143,9 @@ class pronsole(cmd.Cmd):
if
not
self
.
p
.
online
:
print
"Printer is not online. Please connect first."
return
if
not
(
self
.
p
.
printing
or
self
.
sdprinting
):
print
"Printer not printing. Please print something before monitoring."
return
print
"Monitoring printer, use ^C to interrupt."
if
len
(
l
):
try
:
...
...
@@ -1151,22 +1154,27 @@ class pronsole(cmd.Cmd):
print
"Invalid period given."
print
"Updating values every
%
f seconds."
%
(
interval
,)
self
.
monitoring
=
1
prev_msg_len
=
0
try
:
while
(
1
)
:
while
True
:
self
.
p
.
send_now
(
"M105"
)
if
(
self
.
sdprinting
):
self
.
p
.
send_now
(
"M27"
)
time
.
sleep
(
interval
)
#print (self.tempreadings.replace("\r", "").replace("T", "Hotend").replace("B", "Bed").replace("\n", "").replace("ok ", ""))
if
(
self
.
p
.
printing
):
print
"Print progress: "
,
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),
"
%
"
if
(
self
.
sdprinting
):
print
"SD print progress: "
,
self
.
percentdone
,
"
%
"
except
:
if
self
.
p
.
printing
:
preface
=
"Print progress: "
progress
=
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
elif
self
.
sdprinting
:
preface
=
"Print progress: "
progress
=
self
.
percentdone
progress
=
int
(
progress
*
10
)
/
10.0
#limit precision
prev_msg
=
preface
+
str
(
progress
)
+
"
%
"
sys
.
stdout
.
write
(
"
\r
"
+
prev_msg
.
ljust
(
prev_msg_len
))
sys
.
stdout
.
flush
()
prev_msg_len
=
len
(
prev_msg
)
except
KeyboardInterrupt
:
print
"Done monitoring."
pass
self
.
monitoring
=
0
def
help_monitor
(
self
):
...
...
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