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
e77d3f08
Commit
e77d3f08
authored
Jun 02, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorize pronsole and pronterface's recvcb
parent
b6d9b575
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
24 deletions
+36
-24
pronsole.py
printrun/pronsole.py
+28
-2
pronterface.py
printrun/pronterface.py
+8
-22
No files found.
printrun/pronsole.py
View file @
e77d3f08
...
...
@@ -58,6 +58,10 @@ except:
tempreading_exp
=
re
.
compile
(
"(^T:| T:)"
)
REPORT_NONE
=
0
REPORT_POS
=
1
REPORT_TEMP
=
2
class
Status
(
object
):
def
__init__
(
self
):
...
...
@@ -125,7 +129,11 @@ class pronsole(cmd.Cmd):
self
.
temps
=
{
"pla"
:
"185"
,
"abs"
:
"230"
,
"off"
:
"0"
}
self
.
bedtemps
=
{
"pla"
:
"60"
,
"abs"
:
"110"
,
"off"
:
"0"
}
self
.
percentdone
=
0
self
.
posreport
=
""
self
.
tempreadings
=
""
self
.
userm114
=
0
self
.
userm105
=
0
self
.
m105_waitcycles
=
0
self
.
macros
=
{}
self
.
history_file
=
"~/.pronsole-history"
self
.
rc_loaded
=
False
...
...
@@ -1122,9 +1130,27 @@ class pronsole(cmd.Cmd):
self
.
log
(
"Final command output:"
)
self
.
log
(
output
.
rstrip
())
def
recvcb
(
self
,
l
):
if
tempreading_exp
.
findall
(
l
):
def
recvcb_report
(
self
,
l
):
isreport
=
REPORT_NONE
if
"ok C:"
in
l
or
"Count"
in
l
\
or
(
"X:"
in
l
and
len
(
gcoder
.
m114_exp
.
findall
(
l
))
==
6
):
self
.
posreport
=
l
if
self
.
userm114
>
0
:
self
.
userm114
-=
1
else
:
isreport
=
REPORT_POS
if
"ok T:"
in
l
or
tempreading_exp
.
findall
(
l
):
self
.
tempreadings
=
l
if
self
.
userm105
>
0
:
self
.
userm105
-=
1
else
:
self
.
m105_waitcycles
=
0
isreport
=
REPORT_TEMP
return
isreport
def
recvcb
(
self
,
l
):
report_type
=
self
.
recvcb_report
(
l
)
if
report_type
==
REPORT_TEMP
:
self
.
status
.
update_tempreading
(
l
)
tstring
=
l
.
rstrip
()
if
tstring
!=
"ok"
and
not
self
.
listing
and
not
self
.
monitoring
:
...
...
printrun/pronterface.py
View file @
e77d3f08
...
...
@@ -62,6 +62,7 @@ from .excluder import Excluder
from
.settings
import
wxSetting
,
HiddenSetting
,
StringSetting
,
SpinSetting
,
\
FloatSpinSetting
,
BooleanSetting
,
StaticTextSetting
from
printrun
import
gcoder
from
.pronsole
import
REPORT_NONE
,
REPORT_POS
,
REPORT_TEMP
tempreading_exp
=
re
.
compile
(
"(^T:| T:)"
)
...
...
@@ -145,10 +146,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
status_thread
=
None
self
.
capture_skip
=
{}
self
.
capture_skip_newline
=
False
self
.
tempreadings
=
""
self
.
userm114
=
0
self
.
userm105
=
0
self
.
m105_waitcycles
=
0
self
.
fgcode
=
None
self
.
excluder
=
None
self
.
slicep
=
None
...
...
@@ -1675,8 +1672,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
except
:
traceback
.
print_exc
()
def
update_pos
(
self
,
l
):
bits
=
gcoder
.
m114_exp
.
findall
(
l
)
def
update_pos
(
self
):
bits
=
gcoder
.
m114_exp
.
findall
(
self
.
posreport
)
x
=
None
y
=
None
z
=
None
...
...
@@ -1693,24 +1690,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
if
z
is
not
None
:
self
.
current_pos
[
2
]
=
z
def
recvcb
(
self
,
l
):
isreport
=
False
if
"ok C:"
in
l
or
"Count"
in
l
\
or
(
"X:"
in
l
and
len
(
gcoder
.
m114_exp
.
findall
(
l
))
==
6
):
self
.
posreport
=
l
self
.
update_pos
(
l
)
if
self
.
userm114
>
0
:
self
.
userm114
-=
1
else
:
isreport
=
True
if
"ok T:"
in
l
or
tempreading_exp
.
findall
(
l
):
self
.
tempreadings
=
l
report_type
=
self
.
recvcb_report
(
l
)
isreport
=
report_type
!=
REPORT_NONE
if
report_type
==
REPORT_POS
:
self
.
update_pos
()
elif
report_type
==
REPORT_TEMP
:
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreadings
.
strip
()
.
replace
(
"ok "
,
""
))
self
.
update_tempdisplay
()
if
self
.
userm105
>
0
:
self
.
userm105
-=
1
else
:
self
.
m105_waitcycles
=
0
isreport
=
True
tstring
=
l
.
rstrip
()
if
not
self
.
p
.
loud
and
(
tstring
not
in
[
"ok"
,
"wait"
]
and
not
isreport
):
wx
.
CallAfter
(
self
.
addtexttolog
,
tstring
+
"
\n
"
)
...
...
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