Skip to content

Commit e9c1b20

Browse files
committed
Use factor for gradient also for better rendering
mostly for bed
1 parent 778435f commit e9c1b20

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

esp8266/data/printer.tpl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ Updaterange('speed');
170170
Updaterange('flow');
171171
var pulse=true;
172172
var initialization_done = false;
173+
var pos=0;
173174
function displaytemp(temperature, target,item,factor){
174175
var displaypicture = "<svg height=\"30px \" width=\"300px \" xmlns=\"http://wwww.w3.org/2000/svg\">\n<linearGradient id=\"gradient\">\n";
175176
var description = String (temperature) + "/";
@@ -178,8 +179,12 @@ else description += "Off ";
178179
displaypicture+="<stop class=\"begin\" style=\"stop-color:green;\" offset=\"0%\"/>\n";
179180
displaypicture+="<stop class=\"middle\" style=\"stop-color:yellow;\" offset=\"100%\"/>\n</linearGradient>\n<linearGradient id=\"gradient2\">\n";
180181
displaypicture+="<stop class=\"middle\" style=\"stop-color:yellow;\" offset=\"0%\"/>\n<stop class=\"end\" style=\"stop-color:red;\" offset=\"100%\"/>\n";
181-
displaypicture+="</linearGradient>\n<rect x=\"10\" y=\"4\" width=\"24\" height=\"21\" style=\"fill:url(#gradient)\" />\n";
182-
displaypicture+="<rect x=\"34\" y=\"4\" width=\"280\" height=\"21\" style=\"fill:url(#gradient2)\" />\n<line x1=\"";
182+
displaypicture+="</linearGradient>\n<rect x=\"10\" y=\"4\" width=\"";
183+
displaypicture+= String(Math.round( 24*factor ));
184+
displaypicture+="\" height=\"21\" style=\"fill:url(#gradient)\" />\n";
185+
displaypicture+="<rect x=\"";
186+
displaypicture+= String(10+Math.round( 24*factor ));
187+
displaypicture+="\" y=\"4\" width=\"280\" height=\"21\" style=\"fill:url(#gradient2)\" />\n<line x1=\"";
183188
displaypicture+=String(parseFloat(target)*factor+10);
184189
displaypicture+="\" y1=\"4\" x2=\"";
185190
displaypicture+=String(parseFloat(target)*factor+10);

0 commit comments

Comments
 (0)