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
2bbc80ef
Commit
2bbc80ef
authored
Jun 15, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup serial port detection
parent
040b89f2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
31 deletions
+15
-31
pronsole.py
pronsole.py
+1
-1
pronterface.py
pronterface.py
+14
-30
No files found.
pronsole.py
View file @
2bbc80ef
...
@@ -462,7 +462,7 @@ class pronsole(cmd.Cmd):
...
@@ -462,7 +462,7 @@ class pronsole(cmd.Cmd):
pass
pass
for
g
in
[
'/dev/ttyUSB*'
,
'/dev/ttyACM*'
,
"/dev/tty.*"
,
"/dev/cu.*"
,
"/dev/rfcomm*"
]:
for
g
in
[
'/dev/ttyUSB*'
,
'/dev/ttyACM*'
,
"/dev/tty.*"
,
"/dev/cu.*"
,
"/dev/rfcomm*"
]:
baselist
+=
glob
.
glob
(
g
)
baselist
+=
glob
.
glob
(
g
)
return
filter
(
self
.
_bluetoothSerialFilter
,
baselist
)
return
filter
(
self
.
_bluetoothSerialFilter
,
baselist
)
def
_bluetoothSerialFilter
(
self
,
serial
):
def
_bluetoothSerialFilter
(
self
,
serial
):
...
...
pronterface.py
View file @
2bbc80ef
...
@@ -534,20 +534,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -534,20 +534,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
return
return
wx
.
CallAfter
(
self
.
addtexttolog
,
l
);
wx
.
CallAfter
(
self
.
addtexttolog
,
l
);
def
scanserial
(
self
):
"""scan for available ports. return a list of device names."""
baselist
=
[]
if
os
.
name
==
"nt"
:
try
:
key
=
_winreg
.
OpenKey
(
_winreg
.
HKEY_LOCAL_MACHINE
,
"HARDWARE
\\
DEVICEMAP
\\
SERIALCOMM"
)
i
=
0
while
True
:
baselist
+=
[
_winreg
.
EnumValue
(
key
,
i
)[
1
]]
i
+=
1
except
:
pass
return
baselist
+
glob
.
glob
(
'/dev/ttyUSB*'
)
+
glob
.
glob
(
'/dev/ttyACM*'
)
+
glob
.
glob
(
"/dev/tty.*"
)
+
glob
.
glob
(
"/dev/cu.*"
)
+
glob
.
glob
(
"/dev/rfcomm*"
)
def
project
(
self
,
event
):
def
project
(
self
,
event
):
from
printrun
import
projectlayer
from
printrun
import
projectlayer
projectlayer
.
SettingsFrame
(
self
,
self
.
p
)
.
Show
()
projectlayer
.
SettingsFrame
(
self
,
self
.
p
)
.
Show
()
...
@@ -651,19 +637,16 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -651,19 +637,16 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
Close
()
self
.
Close
()
def
rescanports
(
self
,
event
=
None
):
def
rescanports
(
self
,
event
=
None
):
scan
=
self
.
scanserial
()
scan
ned
=
self
.
scanserial
()
portslist
=
list
(
scan
)
portslist
=
list
(
scan
ned
)
if
self
.
settings
.
port
!=
""
and
self
.
settings
.
port
not
in
portslist
:
if
self
.
settings
.
port
!=
""
and
self
.
settings
.
port
not
in
portslist
:
portslist
+=
[
self
.
settings
.
port
]
portslist
.
append
(
self
.
settings
.
port
)
self
.
serialport
.
Clear
()
self
.
serialport
.
Clear
()
self
.
serialport
.
AppendItems
(
portslist
)
self
.
serialport
.
AppendItems
(
portslist
)
try
:
if
os
.
path
.
exists
(
self
.
settings
.
port
)
or
self
.
settings
.
port
in
scanned
:
if
os
.
path
.
exists
(
self
.
settings
.
port
)
or
self
.
settings
.
port
in
scan
:
self
.
serialport
.
SetValue
(
self
.
settings
.
port
)
self
.
serialport
.
SetValue
(
self
.
settings
.
port
)
elif
len
(
portslist
)
>
0
:
elif
portslist
:
self
.
serialport
.
SetValue
(
portslist
[
0
])
self
.
serialport
.
SetValue
(
portslist
[
0
])
except
:
pass
def
cbkey
(
self
,
e
):
def
cbkey
(
self
,
e
):
if
e
.
GetKeyCode
()
==
wx
.
WXK_UP
:
if
e
.
GetKeyCode
()
==
wx
.
WXK_UP
:
...
@@ -1591,17 +1574,18 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -1591,17 +1574,18 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def
connect
(
self
,
event
=
None
):
def
connect
(
self
,
event
=
None
):
print
_
(
"Connecting..."
)
print
_
(
"Connecting..."
)
port
=
None
port
=
None
try
:
if
self
.
serialport
.
GetValue
():
port
=
self
.
scanserial
()[
0
]
except
:
pass
if
self
.
serialport
.
GetValue
()
!=
""
:
port
=
str
(
self
.
serialport
.
GetValue
())
port
=
str
(
self
.
serialport
.
GetValue
())
else
:
scanned
=
self
.
scanserial
()
if
scanned
:
port
=
scanned
[
0
]
baud
=
115200
baud
=
115200
try
:
try
:
baud
=
int
(
self
.
baud
.
GetValue
())
baud
=
int
(
self
.
baud
.
GetValue
())
except
:
except
:
pass
print
_
(
"Could not parse baud rate: "
)
traceback
.
print_exc
(
file
=
sys
.
stdout
)
if
self
.
paused
:
if
self
.
paused
:
self
.
p
.
paused
=
0
self
.
p
.
paused
=
0
self
.
p
.
printing
=
0
self
.
p
.
printing
=
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