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
8245f90e
Commit
8245f90e
authored
Mar 29, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorize ETA computation
parent
5c5e41f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
24 deletions
+29
-24
pronsole.py
printrun/pronsole.py
+18
-2
pronterface.py
printrun/pronterface.py
+11
-22
No files found.
printrun/pronsole.py
View file @
8245f90e
...
@@ -1430,12 +1430,28 @@ class pronsole(cmd.Cmd):
...
@@ -1430,12 +1430,28 @@ class pronsole(cmd.Cmd):
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
self
.
compute_eta
.
update_layer
(
newlayer
,
secondselapsed
)
self
.
compute_eta
.
update_layer
(
newlayer
,
secondselapsed
)
def
get_eta
(
self
):
if
self
.
sdprinting
or
self
.
uploading
:
if
self
.
uploading
:
fractioncomplete
=
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
else
:
fractioncomplete
=
float
(
self
.
percentdone
/
100.0
)
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
# Prevent division by zero
secondsestimate
=
secondselapsed
/
max
(
fractioncomplete
,
0.000001
)
secondsremain
=
secondsestimate
-
secondselapsed
progress
=
fractioncomplete
else
:
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondsremain
,
secondsestimate
=
self
.
compute_eta
(
self
.
p
.
queueindex
,
secondselapsed
)
progress
=
self
.
p
.
queueindex
return
secondsremain
,
secondsestimate
,
progress
def
do_eta
(
self
,
l
):
def
do_eta
(
self
,
l
):
if
not
self
.
p
.
printing
:
if
not
self
.
p
.
printing
:
self
.
logError
(
_
(
"Printer is not currently printing. No ETA available."
))
self
.
logError
(
_
(
"Printer is not currently printing. No ETA available."
))
else
:
else
:
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondsremain
,
secondsestimate
,
progress
=
self
.
get_eta
()
secondsremain
,
secondsestimate
=
self
.
compute_eta
(
self
.
p
.
queueindex
,
secondselapsed
)
eta
=
_
(
"Est:
%
s of
%
s remaining"
)
%
(
format_duration
(
secondsremain
),
eta
=
_
(
"Est:
%
s of
%
s remaining"
)
%
(
format_duration
(
secondsremain
),
format_duration
(
secondsestimate
))
format_duration
(
secondsestimate
))
self
.
log
(
eta
.
strip
())
self
.
log
(
eta
.
strip
())
...
...
printrun/pronterface.py
View file @
8245f90e
...
@@ -909,29 +909,18 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -909,29 +909,18 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
def
statuschecker
(
self
):
def
statuschecker
(
self
):
while
self
.
statuscheck
:
while
self
.
statuscheck
:
string
=
""
string
=
""
fractioncomplete
=
0.0
if
self
.
sdprinting
or
self
.
uploading
or
self
.
p
.
printing
:
if
self
.
sdprinting
or
self
.
uploading
:
secondsremain
,
secondsestimate
,
progress
=
self
.
get_eta
()
if
self
.
uploading
:
if
self
.
sdprinting
or
self
.
uploading
:
fractioncomplete
=
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
if
self
.
uploading
:
string
+=
_
(
"SD upload:
%04.2
f
%%
|"
)
%
(
100
*
fractioncomplete
,)
string
+=
_
(
"SD upload:
%04.2
f
%%
|"
)
%
(
100
*
progress
,)
string
+=
_
(
" Line#
%
d of
%
d lines |"
)
%
(
self
.
p
.
queueindex
,
len
(
self
.
p
.
mainqueue
))
else
:
string
+=
_
(
"SD printing:
%04.2
f
%%
|"
)
%
(
self
.
percentdone
,)
elif
self
.
p
.
printing
:
string
+=
_
(
"Printing:
%04.2
f
%%
|"
)
%
(
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),)
string
+=
_
(
" Line#
%
d of
%
d lines |"
)
%
(
self
.
p
.
queueindex
,
len
(
self
.
p
.
mainqueue
))
string
+=
_
(
" Line#
%
d of
%
d lines |"
)
%
(
self
.
p
.
queueindex
,
len
(
self
.
p
.
mainqueue
))
else
:
if
progress
>
0
:
fractioncomplete
=
float
(
self
.
percentdone
/
100.0
)
string
+=
_
(
"SD printing:
%04.2
f
%%
|"
)
%
(
self
.
percentdone
,)
if
fractioncomplete
>
0.0
:
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondsestimate
=
secondselapsed
/
fractioncomplete
secondsremain
=
secondsestimate
-
secondselapsed
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
format_duration
(
secondsremain
),
format_duration
(
secondsestimate
))
string
+=
_
(
" Z:
%.3
f mm"
)
%
self
.
curlayer
elif
self
.
p
.
printing
:
fractioncomplete
=
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
)
string
+=
_
(
"Printing:
%04.2
f
%%
|"
)
%
(
100
*
float
(
self
.
p
.
queueindex
)
/
len
(
self
.
p
.
mainqueue
),)
string
+=
_
(
" Line#
%
d of
%
d lines |"
)
%
(
self
.
p
.
queueindex
,
len
(
self
.
p
.
mainqueue
))
if
self
.
p
.
queueindex
>
0
:
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondsremain
,
secondsestimate
=
self
.
compute_eta
(
self
.
p
.
queueindex
,
secondselapsed
)
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
format_duration
(
secondsremain
),
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
format_duration
(
secondsremain
),
format_duration
(
secondsestimate
))
format_duration
(
secondsestimate
))
string
+=
_
(
" Z:
%.3
f mm"
)
%
self
.
curlayer
string
+=
_
(
" Z:
%.3
f mm"
)
%
self
.
curlayer
...
...
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