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
47d25b92
Commit
47d25b92
authored
Jun 04, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a Queue for priqueue instead of a pure list
parent
93d258f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
printcore.py
printcore.py
+6
-4
No files found.
printcore.py
View file @
47d25b92
...
...
@@ -18,6 +18,7 @@
from
serial
import
Serial
,
SerialException
from
select
import
error
as
SelectError
from
threading
import
Thread
,
Lock
from
Queue
import
Queue
import
time
,
getopt
,
sys
import
platform
,
os
,
traceback
import
socket
...
...
@@ -61,7 +62,7 @@ class printcore():
self
.
online
=
False
#The printer has responded to the initial command and is active
self
.
printing
=
False
#is a print currently running, true if printing, false if paused
self
.
mainqueue
=
None
self
.
priqueue
=
[]
self
.
priqueue
=
Queue
(
0
)
self
.
queueindex
=
0
self
.
lineno
=
0
self
.
resendfrom
=
-
1
...
...
@@ -382,7 +383,7 @@ class printcore():
"""
if
self
.
online
:
if
self
.
printing
:
self
.
priqueue
.
append
(
command
)
self
.
priqueue
.
put_nowait
(
command
)
else
:
while
self
.
printer
and
self
.
printing
and
not
self
.
clear
:
time
.
sleep
(
0.001
)
...
...
@@ -439,8 +440,9 @@ class printcore():
self
.
resendfrom
+=
1
return
self
.
resendfrom
=
-
1
if
self
.
priqueue
:
self
.
_send
(
self
.
priqueue
.
pop
(
0
))
if
not
self
.
priqueue
.
empty
():
self
.
_send
(
self
.
priqueue
.
get_nowait
())
self
.
priqueue
.
task_done
()
return
if
self
.
printing
and
self
.
queueindex
<
len
(
self
.
mainqueue
):
(
layer
,
line
)
=
self
.
mainqueue
.
idxs
(
self
.
queueindex
)
...
...
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