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
2a15576a
Commit
2a15576a
authored
Mar 24, 2012
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #199 from Chillance/experimental
Minor updates to the graph functionality
parents
762c4a5d
09bd18e5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
45 deletions
+54
-45
graph.py
graph.py
+50
-41
pronterface.py
pronterface.py
+4
-4
No files found.
graph.py
View file @
2a15576a
...
...
@@ -32,10 +32,10 @@ class Graph(BufferedCanvas):
self
.
SetSize
(
wx
.
Size
(
170
,
100
))
self
.
extruder0temps
=
[
0
]
self
.
extruder0targettemps
=
[
0
]
self
.
extruder1temps
=
[
0
]
self
.
extruder1targettemps
=
[
0
]
self
.
extruder2temps
=
[
0
]
self
.
extruder2targettemps
=
[
0
]
self
.
bedtemps
=
[
0
]
self
.
bedtargettemps
=
[
0
]
...
...
@@ -45,7 +45,7 @@ class Graph(BufferedCanvas):
self
.
maxyvalue
=
250
self
.
ybars
=
5
self
.
xbars
=
6
# One bar per 10 second
self
.
xsteps
=
60
# Covering
One
minute in the graph
self
.
xsteps
=
60
# Covering
1
minute in the graph
self
.
y_offset
=
1
# This is to show the line even when value is 0 and maxyvalue
...
...
@@ -70,10 +70,10 @@ class Graph(BufferedCanvas):
def
updateTemperatures
(
self
,
event
):
self
.
AddBedTemperature
(
self
.
bedtemps
[
-
1
])
self
.
AddBedTargetTemperature
(
self
.
bedtargettemps
[
-
1
])
self
.
AddExtruder
1Temperature
(
self
.
extruder1
temps
[
-
1
])
self
.
AddExtruder
1TargetTemperature
(
self
.
extruder1
targettemps
[
-
1
])
#self.AddExtruder
2Temperature(self.extruder2
temps[-1])
#self.AddExtruder
2TargetTemperature(self.extruder2
targettemps[-1])
self
.
AddExtruder
0Temperature
(
self
.
extruder0
temps
[
-
1
])
self
.
AddExtruder
0TargetTemperature
(
self
.
extruder0
targettemps
[
-
1
])
#self.AddExtruder
1Temperature(self.extruder1
temps[-1])
#self.AddExtruder
1TargetTemperature(self.extruder1
targettemps[-1])
self
.
Refresh
()
...
...
@@ -131,7 +131,11 @@ class Graph(BufferedCanvas):
#dc.SetPen(wx.Pen(wx.Colour(255,0,0,0), 1))
def
drawtemperature
(
self
,
dc
,
gc
,
temperature_list
,
text
,
text_xoffset
,
r
,
g
,
b
,
a
):
if
self
.
timer
.
IsRunning
()
==
False
:
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
128
,
128
,
128
,
128
),
1
))
else
:
dc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
r
,
g
,
b
,
a
),
1
))
x_add
=
float
(
self
.
width
)
/
self
.
xsteps
x_pos
=
float
(
0.0
)
lastxvalue
=
float
(
0.0
)
...
...
@@ -140,6 +144,7 @@ class Graph(BufferedCanvas):
y_pos
=
int
((
float
(
self
.
height
-
self
.
y_offset
)
/
self
.
maxyvalue
)
*
temperature
)
+
self
.
y_offset
if
(
x_pos
>
0.0
):
# One need 2 points to draw a line.
dc
.
DrawLine
(
lastxvalue
,
self
.
height
-
self
.
_lastyvalue
,
x_pos
,
self
.
height
-
y_pos
)
lastxvalue
=
x_pos
x_pos
=
float
(
x_pos
)
+
x_add
self
.
_lastyvalue
=
y_pos
...
...
@@ -147,7 +152,11 @@ class Graph(BufferedCanvas):
if
len
(
text
)
>
0
:
font
=
wx
.
Font
(
8
,
wx
.
DEFAULT
,
wx
.
NORMAL
,
wx
.
BOLD
)
#font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
if
self
.
timer
.
IsRunning
()
==
False
:
gc
.
SetFont
(
font
,
wx
.
Colour
(
128
,
128
,
128
))
else
:
gc
.
SetFont
(
font
,
wx
.
Colour
(
r
,
g
,
b
))
#gc.DrawText(text, self.width - (font.GetPointSize() * ((len(text) * text_xoffset + 1))), self.height - self._lastyvalue - (font.GetPointSize() / 2))
gc
.
DrawText
(
text
,
x_pos
-
x_add
-
(
font
.
GetPointSize
()
*
((
len
(
text
)
*
text_xoffset
+
1
))),
self
.
height
-
self
.
_lastyvalue
-
(
font
.
GetPointSize
()
/
2
))
#gc.DrawText(text, self.width - (font.GetPixelSize().GetWidth() * ((len(text) * text_xoffset + 1) + 1)), self.height - self._lastyvalue - (font.GetPointSize() / 2))
...
...
@@ -160,18 +169,18 @@ class Graph(BufferedCanvas):
self
.
drawtemperature
(
dc
,
gc
,
self
.
bedtargettemps
,
"Bed Target"
,
2
,
255
,
120
,
0
,
128
)
def
drawextruder
1
temp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
1temps
,
"Ex1
"
,
1
,
0
,
155
,
255
,
128
)
def
drawextruder
0
temp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
0temps
,
"Ex0
"
,
1
,
0
,
155
,
255
,
128
)
def
drawextruder
1
targettemp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
1targettemps
,
"Ex1
Target"
,
2
,
0
,
5
,
255
,
128
)
def
drawextruder
0
targettemp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
0targettemps
,
"Ex0
Target"
,
2
,
0
,
5
,
255
,
128
)
def
drawextruder
2
temp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
2temps
,
"Ex2
"
,
3
,
55
,
55
,
0
,
128
)
def
drawextruder
1
temp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
1temps
,
"Ex1
"
,
3
,
55
,
55
,
0
,
128
)
def
drawextruder
2
targettemp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
2targettemps
,
"Ex2
Target"
,
2
,
55
,
55
,
0
,
128
)
def
drawextruder
1
targettemp
(
self
,
dc
,
gc
):
self
.
drawtemperature
(
dc
,
gc
,
self
.
extruder
1targettemps
,
"Ex1
Target"
,
2
,
55
,
55
,
0
,
128
)
def
SetBedTemperature
(
self
,
value
):
...
...
@@ -194,6 +203,26 @@ class Graph(BufferedCanvas):
self
.
bedtargettemps
.
pop
(
0
)
def
SetExtruder0Temperature
(
self
,
value
):
self
.
extruder0temps
.
pop
()
self
.
extruder0temps
.
append
(
value
)
def
AddExtruder0Temperature
(
self
,
value
):
self
.
extruder0temps
.
append
(
value
)
if
(
len
(
self
.
extruder0temps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder0temps
.
pop
(
0
)
def
SetExtruder0TargetTemperature
(
self
,
value
):
self
.
extruder0targettemps
.
pop
()
self
.
extruder0targettemps
.
append
(
value
)
def
AddExtruder0TargetTemperature
(
self
,
value
):
self
.
extruder0targettemps
.
append
(
value
)
if
(
len
(
self
.
extruder0targettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder0targettemps
.
pop
(
0
)
def
SetExtruder1Temperature
(
self
,
value
):
self
.
extruder1temps
.
pop
()
self
.
extruder1temps
.
append
(
value
)
...
...
@@ -214,26 +243,6 @@ class Graph(BufferedCanvas):
self
.
extruder1targettemps
.
pop
(
0
)
def
SetExtruder2Temperature
(
self
,
value
):
self
.
extruder2temps
.
pop
()
self
.
extruder2temps
.
append
(
value
)
def
AddExtruder2Temperature
(
self
,
value
):
self
.
extruder2temps
.
append
(
value
)
if
(
len
(
self
.
extruder2temps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder2temps
.
pop
(
0
)
def
SetExtruder2TargetTemperature
(
self
,
value
):
self
.
extruder2targettemps
.
pop
(
0
)
self
.
extruder2targettemps
.
append
(
value
)
def
AddExtruder2TargetTemperature
(
self
,
value
):
self
.
extruder2targettemps
.
append
(
value
)
if
(
len
(
self
.
extruder2targettemps
)
-
1
)
*
float
(
self
.
width
)
/
self
.
xsteps
>
self
.
width
:
self
.
extruder2targettemps
.
pop
(
0
)
def
StartPlotting
(
self
,
time
):
self
.
Refresh
()
self
.
timer
.
Start
(
time
)
...
...
@@ -248,11 +257,11 @@ class Graph(BufferedCanvas):
self
.
width
=
w
self
.
height
=
h
self
.
drawgrid
(
dc
,
gc
)
self
.
drawbedtemp
(
dc
,
gc
)
self
.
drawbedtargettemp
(
dc
,
gc
)
self
.
drawextruder1temp
(
dc
,
gc
)
self
.
drawbedtemp
(
dc
,
gc
)
self
.
drawextruder0targettemp
(
dc
,
gc
)
self
.
drawextruder0temp
(
dc
,
gc
)
self
.
drawextruder1targettemp
(
dc
,
gc
)
self
.
drawextruder2temp
(
dc
,
gc
)
self
.
drawextruder2targettemp
(
dc
,
gc
)
self
.
drawextruder1temp
(
dc
,
gc
)
pronterface.py
View file @
2a15576a
...
...
@@ -204,7 +204,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
try
:
temp
=
float
(
line
.
split
(
"S"
)[
1
]
.
split
(
"*"
)[
0
])
self
.
hottgauge
.
SetTarget
(
temp
)
self
.
graph
.
SetExtruder
1
TargetTemperature
(
temp
)
self
.
graph
.
SetExtruder
0
TargetTemperature
(
temp
)
except
:
pass
try
:
...
...
@@ -254,7 +254,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
print
_
(
"Setting hotend temperature to
%
f degrees Celsius."
)
%
f
self
.
hsetpoint
=
f
self
.
hottgauge
.
SetTarget
(
int
(
f
))
self
.
graph
.
SetExtruder
1
TargetTemperature
(
int
(
f
))
self
.
graph
.
SetExtruder
0
TargetTemperature
(
int
(
f
))
if
f
>
0
:
wx
.
CallAfter
(
self
.
htemp
.
SetValue
,
l
)
self
.
set
(
"last_temperature"
,
str
(
f
))
...
...
@@ -1202,7 +1202,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
try
:
self
.
hottgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
graph
.
SetExtruder
1
Temperature
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
graph
.
SetExtruder
0
Temperature
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
bedtgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"B:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
graph
.
SetBedTemperature
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"B:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
except
:
...
...
@@ -1266,7 +1266,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
wx
.
CallAfter
(
self
.
tempdisp
.
SetLabel
,
self
.
tempreport
.
strip
()
.
replace
(
"ok "
,
""
))
try
:
self
.
hottgauge
.
SetValue
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
graph
.
SetExtruder
1
Temperature
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
graph
.
SetExtruder
0
Temperature
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"T:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
self
.
graph
.
SetBedTemperature
(
float
(
filter
(
lambda
x
:
x
.
startswith
(
"B:"
),
self
.
tempreport
.
split
())[
0
]
.
split
(
":"
)[
1
]))
except
:
pass
...
...
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