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
339b2a55
Commit
339b2a55
authored
Jun 29, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'experimental' of github.com:kliment/Printrun into experimental
parents
bde119f4
ebe96bf4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
44 deletions
+17
-44
printcore.py
printcore.py
+2
-2
gcoder.py
printrun/gcoder.py
+13
-10
pronterface.py
pronterface.py
+2
-32
No files found.
printcore.py
View file @
339b2a55
...
...
@@ -192,7 +192,7 @@ class printcore():
if
self
.
recvcb
:
try
:
self
.
recvcb
(
line
)
except
:
pass
if
self
.
loud
:
print
"RECV:
"
,
line
.
rstrip
()
if
self
.
loud
:
print
"RECV:"
,
line
.
rstrip
()
return
line
except
SelectError
as
e
:
if
'Bad file descriptor'
in
e
.
args
[
1
]:
...
...
@@ -522,7 +522,7 @@ class printcore():
self
.
sent
.
append
(
command
)
self
.
analyzer
.
Analyze
(
command
)
# run the command through the analyzer
if
self
.
loud
:
print
"SENT:
"
,
command
print
"SENT:"
,
command
if
self
.
sendcb
:
try
:
self
.
sendcb
(
command
)
except
:
pass
...
...
printrun/gcoder.py
View file @
339b2a55
...
...
@@ -382,17 +382,20 @@ class GCode(object):
# then calculate the time taken to complete the remaining distance
currenttravel
=
math
.
hypot
(
x
-
lastx
,
y
-
lasty
)
# FIXME: review this better
# this looks wrong : there's little chance that the feedrate we'll decelerate to is the previous feedrate
# shouldn't we instead look at three consecutive moves ?
distance
=
2
*
abs
(((
lastf
+
f
)
*
(
f
-
lastf
)
*
0.5
)
/
acceleration
)
# multiply by 2 because we have to accelerate and decelerate
if
distance
<=
currenttravel
and
lastf
+
f
!=
0
and
f
!=
0
:
# Unsure about this formula -- iXce reviewing this code
moveduration
=
2
*
distance
/
(
lastf
+
f
)
currenttravel
-=
distance
moveduration
+=
currenttravel
/
f
if
f
==
lastf
:
# Feedrate hasn't changed, no acceleration/decceleration planned
moveduration
=
currenttravel
/
f
else
:
moveduration
=
math
.
sqrt
(
2
*
distance
/
acceleration
)
# probably buggy : not taking actual travel into account
# FIXME: review this better
# this looks wrong : there's little chance that the feedrate we'll decelerate to is the previous feedrate
# shouldn't we instead look at three consecutive moves ?
distance
=
2
*
abs
(((
lastf
+
f
)
*
(
f
-
lastf
)
*
0.5
)
/
acceleration
)
# multiply by 2 because we have to accelerate and decelerate
if
distance
<=
currenttravel
and
lastf
+
f
!=
0
and
f
!=
0
:
moveduration
=
2
*
distance
/
(
lastf
+
f
)
# This is distance / mean(lastf, f)
moveduration
+=
(
currenttravel
-
distance
)
/
f
else
:
moveduration
=
2
*
currenttravel
/
(
lastf
+
f
)
# This is currenttravel / mean(lastf, f)
# FIXME: probably a little bit optimistic, but probably a much better estimate than the previous one:
# moveduration = math.sqrt(2 * distance / acceleration) # probably buggy : not taking actual travel into account
totalduration
+=
moveduration
...
...
pronterface.py
View file @
339b2a55
...
...
@@ -560,15 +560,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
pronsole
.
pronsole
.
start_macro
(
self
,
macro_name
,
old_macro_definition
)
def
catchprint
(
self
,
l
):
if
self
.
capture_skip_newline
and
len
(
l
)
and
not
len
(
l
.
strip
(
"
\n\r
"
)):
self
.
capture_skip_newline
=
False
return
for
pat
in
self
.
capture_skip
.
keys
():
if
self
.
capture_skip
[
pat
]
>
0
and
pat
.
match
(
l
):
self
.
capture_skip
[
pat
]
-=
1
self
.
capture_skip_newline
=
True
return
wx
.
CallAfter
(
self
.
addtexttolog
,
l
);
wx
.
CallAfter
(
self
.
addtexttolog
,
l
)
def
project
(
self
,
event
):
from
printrun
import
projectlayer
...
...
@@ -1313,9 +1305,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if
self
.
monitor
and
self
.
p
.
online
:
if
self
.
sdprinting
:
self
.
p
.
send_now
(
"M27"
)
if
not
hasattr
(
self
,
"auto_monitor_pattern"
):
self
.
auto_monitor_pattern
=
re
.
compile
(
r"(ok\s+)?T:[\d\.]+(\s+B:[\d\.]+)?(\s+@:[\d\.]+)?\s*"
)
self
.
capture_skip
[
self
.
auto_monitor_pattern
]
=
self
.
capture_skip
.
setdefault
(
self
.
auto_monitor_pattern
,
0
)
+
1
self
.
p
.
send_now
(
"M105"
)
cur_time
=
time
.
time
()
while
time
.
time
()
<
cur_time
+
self
.
monitor_interval
:
...
...
@@ -1331,25 +1320,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
pass
wx
.
CallAfter
(
self
.
statusbar
.
SetStatusText
,
_
(
"Not connected to printer."
))
def
capture
(
self
,
func
,
*
args
,
**
kwargs
):
stdout
=
sys
.
stdout
cout
=
None
try
:
cout
=
self
.
cout
except
:
pass
if
cout
is
None
:
cout
=
cStringIO
.
StringIO
()
sys
.
stdout
=
cout
retval
=
None
try
:
retval
=
func
(
*
args
,
**
kwargs
)
except
:
traceback
.
print_exc
()
sys
.
stdout
=
stdout
return
retval
def
recvcb
(
self
,
l
):
isreport
=
False
if
"ok C:"
in
l
or
"Count"
in
l
:
...
...
@@ -1368,7 +1338,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
else
:
isreport
=
True
tstring
=
l
.
rstrip
()
if
self
.
p
.
loud
or
(
tstring
not
in
[
"ok"
,
"wait"
]
and
not
isreport
):
if
not
self
.
p
.
loud
and
(
tstring
not
in
[
"ok"
,
"wait"
]
and
not
isreport
):
wx
.
CallAfter
(
self
.
addtexttolog
,
tstring
+
"
\n
"
);
for
listener
in
self
.
recvlisteners
:
listener
(
l
)
...
...
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