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
f367f0e5
Commit
f367f0e5
authored
Aug 03, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
5a8e3474
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
printcore.py
printrun/printcore.py
+12
-13
No files found.
printrun/printcore.py
View file @
f367f0e5
...
@@ -140,7 +140,7 @@ class printcore():
...
@@ -140,7 +140,7 @@ class printcore():
if
self
.
recvcb
:
if
self
.
recvcb
:
try
:
self
.
recvcb
(
line
)
try
:
self
.
recvcb
(
line
)
except
:
pass
except
:
pass
if
self
.
loud
:
print
"RECV: "
,
line
.
rstrip
()
if
self
.
loud
:
print
"RECV: "
,
line
.
rstrip
()
if
line
.
startswith
(
'DEBUG_'
):
if
line
.
startswith
(
'DEBUG_'
):
continue
continue
if
line
.
startswith
(
tuple
(
self
.
greetings
))
or
line
.
startswith
(
'ok'
):
if
line
.
startswith
(
tuple
(
self
.
greetings
))
or
line
.
startswith
(
'ok'
):
...
@@ -152,7 +152,6 @@ class printcore():
...
@@ -152,7 +152,6 @@ class printcore():
self
.
online
=
True
self
.
online
=
True
if
line
.
startswith
(
'ok'
):
if
line
.
startswith
(
'ok'
):
#self.resendfrom=-1
#self.resendfrom=-1
#put temp handling here
if
"T:"
in
line
and
self
.
tempcb
is
not
None
:
if
"T:"
in
line
and
self
.
tempcb
is
not
None
:
#callback for temp, status, whatever
#callback for temp, status, whatever
try
:
self
.
tempcb
(
line
)
try
:
self
.
tempcb
(
line
)
...
@@ -164,7 +163,7 @@ class printcore():
...
@@ -164,7 +163,7 @@ class printcore():
except
:
pass
except
:
pass
if
line
.
lower
()
.
startswith
(
"resend"
)
or
line
.
startswith
(
"rs"
):
if
line
.
lower
()
.
startswith
(
"resend"
)
or
line
.
startswith
(
"rs"
):
try
:
try
:
toresend
=
int
(
line
.
replace
(
"N:"
,
" "
)
.
replace
(
"N"
,
" "
)
.
replace
(
":"
,
" "
)
.
split
()[
-
1
])
toresend
=
int
(
line
.
replace
(
"N:"
,
" "
)
.
replace
(
"N"
,
" "
)
.
replace
(
":"
,
" "
)
.
split
()[
-
1
])
except
:
except
:
if
line
.
startswith
(
"rs"
):
if
line
.
startswith
(
"rs"
):
toresend
=
int
(
line
.
split
()[
1
])
toresend
=
int
(
line
.
split
()[
1
])
...
@@ -172,8 +171,8 @@ class printcore():
...
@@ -172,8 +171,8 @@ class printcore():
self
.
clear
=
True
self
.
clear
=
True
self
.
clear
=
True
self
.
clear
=
True
def
_checksum
(
self
,
command
):
def
_checksum
(
self
,
command
):
return
reduce
(
lambda
x
,
y
:
x
^
y
,
map
(
ord
,
command
))
return
reduce
(
lambda
x
,
y
:
x
^
y
,
map
(
ord
,
command
))
def
startprint
(
self
,
data
):
def
startprint
(
self
,
data
):
"""Start a print, data is an array of gcode commands.
"""Start a print, data is an array of gcode commands.
...
@@ -183,15 +182,15 @@ class printcore():
...
@@ -183,15 +182,15 @@ class printcore():
"""
"""
if
self
.
printing
or
not
self
.
online
or
not
self
.
printer
:
if
self
.
printing
or
not
self
.
online
or
not
self
.
printer
:
return
False
return
False
self
.
printing
=
True
self
.
printing
=
True
self
.
mainqueue
=
[]
+
data
self
.
mainqueue
=
[]
+
data
self
.
lineno
=
0
self
.
lineno
=
0
self
.
queueindex
=
0
self
.
queueindex
=
0
self
.
resendfrom
=
-
1
self
.
resendfrom
=
-
1
self
.
_send
(
"M110"
,
-
1
,
True
)
self
.
_send
(
"M110"
,
-
1
,
True
)
if
len
(
data
)
==
0
:
if
len
(
data
)
==
0
:
return
True
return
True
self
.
clear
=
False
self
.
clear
=
False
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
self
.
print_thread
.
start
()
self
.
print_thread
.
start
()
return
True
return
True
...
...
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