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
5b0e0c98
Commit
5b0e0c98
authored
Dec 21, 2011
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into experimental
parents
505e62af
a4b37519
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
20 deletions
+39
-20
printcore.py
printcore.py
+38
-19
pronterface.py
pronterface.py
+1
-1
No files found.
printcore.py
View file @
5b0e0c98
#!/usr/bin/env python
# Licensed under GPLv3
from
serial
import
Serial
from
threading
import
Thread
from
select
import
error
as
SelectError
import
time
import
sys
import
time
,
getopt
,
sys
class
printcore
():
def
__init__
(
self
,
port
=
None
,
baud
=
None
):
...
...
@@ -267,25 +268,41 @@ class printcore():
self
.
printer
.
write
(
str
(
command
+
"
\n
"
))
if
__name__
==
'__main__'
:
#print "Usage: python printcore.py filename.gcode"
filename
=
"../prusamendel/sellsx_export.gcode"
if
len
(
sys
.
argv
)
>
1
:
filename
=
sys
.
argv
[
1
]
print
"Printing: "
+
filename
else
:
print
"Usage: python printcore.py filename.gcode"
#sys.exit(2)
p
=
printcore
(
'/dev/ttyUSB0'
,
115200
)
p
.
loud
=
True
baud
=
115200
loud
=
False
statusreport
=
False
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"h,b:,v,s"
,[
"help"
,
"baud"
,
"verbose"
,
"statusreport"
])
except
getopt
.
GetoptError
,
err
:
print
str
(
err
)
print
help
sys
.
exit
(
2
)
for
o
,
a
in
opts
:
if
o
in
(
'-h'
,
'--help'
):
# FIXME: Fix help
print
"Opts are: --help , -b --baud = baudrate, -v --verbose, -s --statusreport"
sys
.
exit
(
1
)
if
o
in
(
'-b'
,
'--baud'
):
baud
=
int
(
a
)
if
o
in
(
'-v'
,
'--verbose'
):
loud
=
True
elif
o
in
(
'-s'
,
'--statusreport'
):
statusreport
=
True
if
len
(
args
)
>
1
:
port
=
args
[
-
2
]
filename
=
args
[
-
1
]
print
"Printing: "
+
filename
+
" on "
+
port
+
" with baudrate "
+
str
(
baud
)
else
:
print
"Usage: python [-h|-b|-v|-s] printcore.py /dev/tty[USB|ACM]x filename.gcode"
sys
.
exit
(
2
)
p
=
printcore
(
port
,
baud
)
p
.
loud
=
loud
time
.
sleep
(
2
)
testdata
=
[
i
.
replace
(
"
\n
"
,
""
)
for
i
in
open
(
filename
)]
p
.
startprint
(
testdata
)
#time.sleep(1)
#p.pause()
#print "pause"
#time.sleep(5)
#p.resume()
gcode
=
[
i
.
replace
(
"
\n
"
,
""
)
for
i
in
open
(
filename
)]
p
.
startprint
(
gcode
)
try
:
if
statusreport
:
p
.
loud
=
False
...
...
@@ -296,5 +313,7 @@ if __name__ == '__main__':
if
statusreport
:
sys
.
stdout
.
write
(
"
\b\b\b\b
%02.1
f
%%
"
%
(
100
*
float
(
p
.
queueindex
)
/
len
(
p
.
mainqueue
),)
)
sys
.
stdout
.
flush
()
p
.
disconnect
()
sys
.
exit
(
0
)
except
:
p
.
disconnect
()
pronterface.py
View file @
5b0e0c98
...
...
@@ -410,7 +410,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
serialport
.
Clear
()
self
.
serialport
.
AppendItems
(
portslist
)
try
:
if
os
.
path
.
exists
(
self
.
settings
.
port
):
if
os
.
path
.
exists
(
self
.
settings
.
port
)
or
self
.
settings
.
port
.
upper
()
.
startswith
(
'COM'
)
:
self
.
serialport
.
SetValue
(
self
.
settings
.
port
)
elif
len
(
portslist
)
>
0
:
self
.
serialport
.
SetValue
(
portslist
[
0
])
...
...
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