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
898a43e5
Commit
898a43e5
authored
Aug 03, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework pause/resume
parent
eaab2859
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
printcore.py
printrun/printcore.py
+8
-4
No files found.
printrun/printcore.py
View file @
898a43e5
...
...
@@ -66,6 +66,7 @@ class printcore():
self
.
wait
=
0
# default wait period for send(), send_now()
self
.
read_thread
=
None
self
.
stop_read_thread
=
False
self
.
print_thread
=
None
if
port
is
not
None
and
baud
is
not
None
:
#print port, baud
self
.
connect
(
port
,
baud
)
...
...
@@ -207,7 +208,8 @@ class printcore():
if
len
(
data
)
==
0
:
return
True
self
.
clear
=
False
Thread
(
target
=
self
.
_print
)
.
start
()
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
self
.
print_thread
.
start
()
return
True
def
pause
(
self
):
...
...
@@ -215,14 +217,16 @@ class printcore():
"""
self
.
paused
=
True
self
.
printing
=
False
time
.
sleep
(
1
)
self
.
print_thread
.
join
()
self
.
print_thread
=
None
def
resume
(
self
):
"""Resumes a paused print.
"""
self
.
paused
=
False
self
.
printing
=
True
Thread
(
target
=
self
.
_print
)
.
start
()
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
self
.
print_thread
.
start
()
def
send
(
self
,
command
,
wait
=
0
):
"""Adds a command to the checksummed main command queue if printing, or sends the command immediately if not printing
...
...
@@ -290,7 +294,7 @@ class printcore():
def
_sendnext
(
self
):
if
(
not
self
.
printer
):
return
while
not
self
.
clear
:
while
self
.
printer
and
self
.
printing
and
not
self
.
clear
:
time
.
sleep
(
0.001
)
self
.
clear
=
False
if
not
(
self
.
printing
and
self
.
printer
and
self
.
online
):
...
...
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