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
7a422f1c
Commit
7a422f1c
authored
Aug 11, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New fix for the not-received-M105 issue
parent
7d8c0bdc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
printcore.py
printcore.py
+10
-5
No files found.
printcore.py
View file @
7a422f1c
...
@@ -134,19 +134,24 @@ class printcore():
...
@@ -134,19 +134,24 @@ class printcore():
return
not
self
.
stop_read_thread
and
self
.
printer
and
self
.
printer
.
isOpen
()
return
not
self
.
stop_read_thread
and
self
.
printer
and
self
.
printer
.
isOpen
()
def
_listen_until_online
(
self
):
def
_listen_until_online
(
self
):
orig_timeout
=
self
.
printer
.
timeout
self
.
printer
.
timeout
=
3
while
not
self
.
online
and
self
.
_listen_can_continue
():
while
not
self
.
online
and
self
.
_listen_can_continue
():
self
.
_send
(
"M105"
)
self
.
_send
(
"M105"
)
empty_lines
=
0
while
self
.
_listen_can_continue
():
while
self
.
_listen_can_continue
():
line
=
self
.
_readline
()
line
=
self
.
_readline
()
if
not
line
:
if
line
==
None
:
break
# connection problem
break
# workaround cases where M105 was sent before printer Serial
# was online an empty line means read timeout was reached,
# meaning no data was received thus we count those empty lines,
# and once we have seen 5 in a row, we just break and send a
# new M105
if
not
line
:
empty_lines
+=
1
else
:
empty_lines
=
0
if
empty_lines
==
5
:
break
if
line
.
startswith
(
tuple
(
self
.
greetings
))
or
line
.
startswith
(
'ok'
):
if
line
.
startswith
(
tuple
(
self
.
greetings
))
or
line
.
startswith
(
'ok'
):
if
self
.
onlinecb
:
if
self
.
onlinecb
:
try
:
self
.
onlinecb
()
try
:
self
.
onlinecb
()
except
:
pass
except
:
pass
self
.
printer
.
timeout
=
orig_timeout
self
.
online
=
True
self
.
online
=
True
return
return
time
.
sleep
(
0.25
)
time
.
sleep
(
0.25
)
...
...
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