Skip to content

Commit ba7422a

Browse files
committed
Printflow software is working ok now even though the timers are
terrible.
1 parent 6bce3cb commit ba7422a

File tree

18 files changed

+190
-155
lines changed

18 files changed

+190
-155
lines changed

host/conf/config.properties

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,25 @@ performedOneTimeInstall=false
66
limitLiveStreamToOneCPU=false
77
scriptEngineLanguage=js
88
forceCalibrationOnFirstUse=false
9+
10+
#Location where printables are stored
11+
#uploaddir=/home/user/uploaddir
12+
#Temporary unzip location
13+
#printdir=/tmp/printdir
14+
915
#Sends the force or forceprerelease to the start.sh script
1016
#upgrade.directive=force
1117

12-
skins=[{"name":"Main skin", "welcomeFiles":["index.html"], "resourceBase": "resourcesnew", "active": true}]
18+
skins=[{"name":"Main skin", "welcomeFiles":["index.html"], "resourceBase": "resourcesnew", "active": true}, {"name":"TouchScreen Skin", "welcomeFiles":["printflow.html"], "resourceBase": "printflow", "active": true}]
1319
printerDrivers=[{"driverClassName":"org.area515.resinprinter.gcode.eGENERICGCodeControl","driverName":"eGENERIC", "prettyName":"Generic GCode"},{"driverClassName":"org.area515.resinprinter.gcode.PhotocentricGCodeControl","driverName":"Photocentric", "prettyName":"Photocentric"},{"driverClassName":"org.area515.resinprinter.gcode.SedgwickGCodeControl","driverName":"Sedgwick", "prettyName":"Sedgwick"},{"driverClassName":"org.area515.resinprinter.gcode.JavascriptControl","driverName":"Javascript", "prettyName":"Generic Javascript"}]
1420

15-
#These override what is shown in the DLNA properties when the print search function is used
21+
#These override what is shown in the DLNA properties when the printer search function is used
1622
#manufacturer=[Name of printer manufacturer]
1723
#deviceName=[Name of printer model]
1824

1925
feature.org.area515.resinprinter.discover.UPNPAdvertiser=true
2026
feature.org.area515.resinprinter.usbimport.USBUploader=true
27+
featureSettings.org.area515.resinprinter.usbimport.USBUploader={"configuredRoots":["/media", "/storage"]}
2128
#feature.org.area515.resinprinter.util.cron.CronFeature=true
2229
#featureSettings.org.area515.resinprinter.util.cron.CronFeature=[{"taskName":"Show directory listing in Windows every night at 1:15am", "taskClassName":"org.area515.resinprinter.actions.osscript.ExecuteNativeOSCommandRunnable", "cronString":"15 1 * * *", "taskSettings":{"shellCommands":["cmd", "/c", "dir"]}}]
2330
#featureSettings.org.area515.resinprinter.util.cron.CronFeature=[{"taskName":"Run kweb browser after a Photonic3D restart", "taskClassName":"org.area515.resinprinter.actions.osscript.ExecuteNativeOSCommandRunnable", "cronString":"@reboot", "taskSettings":{"shellCommands":["kweb", "-KZJE", "{0}"]}}]

host/printflow/error.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<div class="main">
8080
<img src="images/error.png" usemap="error" class="uilayer">
8181
<map name="error" style="z-index: 100;">
82-
<area alt="" title="" href="index.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
82+
<area alt="" title="" href="printflow.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
8383
<area alt="" title="WPS Setup" shape="rect" coords="252,268,548,324" style="outline:none;" target="_self" onClick="startPrint();" />
8484
</map>
8585
<img name="wifi" id="wifi" class="wifi" src="images/pixel.png">
@@ -90,7 +90,7 @@
9090
</div>
9191
<div name="warn" id="warn" class="warn"></div>
9292

93-
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='index.html';">
93+
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='printflow.html';">
9494
</div>
9595
</div>
9696

host/printflow/fwupdate.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@
9292
<div class="main">
9393
<img src="images/syslog.png" usemap="syslog" class="uilayer">
9494
<map name="syslog" style="z-index: 100;">
95-
<area alt="" title="" href="settings.html" shape="poly" coords="160,40,137,45,118,58,105,77,100,100,105,123,118,142,137,155,160,160,183,155,202,142,215,123,220,100,215,77,202,58,183,45" style="outline:none;" target="_self" />
96-
<area alt="" title="" href="index.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
95+
<area alt="" title="" href="printflowsettings.html" shape="poly" coords="160,40,137,45,118,58,105,77,100,100,105,123,118,142,137,155,160,160,183,155,202,142,215,123,220,100,215,77,202,58,183,45" style="outline:none;" target="_self" />
96+
<area alt="" title="" href="printflow.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
9797
<area alt="" title="WPS Setup" shape="rect" coords="252,268,548,324" style="outline:none;" target="_self" onClick="startPrint();" />
9898
</map>
9999
<img name="wifi" id="wifi" class="wifi" src="images/wifi-0.png">
100100
<textarea class="log" id="log"></textarea>
101101
<div name="warn" id="warn" class="warn"></div>
102102

103-
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='index.html';">
104-
<img name="bigbuttonhighlight" id="bigbuttonhighlight" class="bigbuttonhighlight" src="images/bigbuttonANIM.png" onClick="location.href='settings.html';">
103+
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='printflow.html';">
104+
<img name="bigbuttonhighlight" id="bigbuttonhighlight" class="bigbuttonhighlight" src="images/bigbuttonANIM.png" onClick="location.href='printflowsettings.html';">
105105
</div>
106106
</div>
107107

host/printflow/js/printerconfig.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
var printerName = "Photonic3D";
1+
var printerName = null;
2+
3+
function getPrinterNameIfNotAvailable() {
4+
$.getJSON("/services/printers/getFirstAvailablePrinter").done(function (data){
5+
setTimeout(getPrinterNameIfNotAvailable, 15000);
6+
printerName = data.configuration.name;
7+
})
8+
.error(function (data){
9+
$.getJSON("/services/printers/list").done(function (data){
10+
setTimeout(getPrinterNameIfNotAvailable, 1000);
11+
printerName = data[0].configuration.name;
12+
})
13+
.error(function (data) {
14+
setTimeout(getPrinterNameIfNotAvailable, 500);
15+
})
16+
});
17+
}
18+
19+
getPrinterNameIfNotAvailable();

host/printflow/js/printflow.js

Lines changed: 62 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -6,109 +6,84 @@ var currentslice=0;
66
var elapsedtime=0;
77
var starttime=0;
88
var averageslicetime=0;
9-
var signalstrength = -100;
109
var PRINTERONIMAGE = "images/printer-on.png";
1110
var PRINTEROFFIMAGE = "images/printer-off.png";
1211

1312
function startpage(){
14-
if (typeof Cookies.get('lastwifi') !== 'undefined'){
15-
signalstrength = Cookies.get('lastwifi');
16-
if (signalstrength > -45) {
17-
document.getElementById("wifi").src="images/wifi-3.png";
18-
}
19-
else if (signalstrength > -67) {
20-
document.getElementById("wifi").src="images/wifi-2.png";
21-
}
22-
else if (signalstrength > -72) {
23-
document.getElementById("wifi").src="images/wifi-1.png";
24-
}
25-
else if (signalstrength > -80) {
26-
document.getElementById("wifi").src="images/wifi-0.png";
27-
}
28-
else document.getElementById("wifi").src="images/wifi-nc.png";
29-
}
30-
else{
31-
wifiupdate();
32-
}
33-
//handles page setup and the common things across all pages:
34-
35-
if (typeof Cookies.get('printerstatus') !== 'undefined'){
36-
document.getElementById("printerstatus").src = Cookies.get('printerstatus');
37-
}
38-
else{
39-
printerStatus();
40-
}
41-
42-
43-
// do the first updates
44-
//document.getElementById("time").innerHTML = moment().format("HH:mm:ss[<br>]DD-MMM-YY");
45-
printredirect();
46-
4713
setInterval(function() {
48-
//time handling/updating
49-
//document.getElementById("time").innerHTML = moment().format("HH:mm:ss[<br>]DD-MMM-YY");
50-
//redirect to print dialogue on user initiating a print
51-
printredirect();
52-
printerStatus();
53-
}, 1000);
14+
setTime();
15+
printredirect();
16+
printerStatus();
17+
}, 1000);
5418

5519
setInterval(function() {
56-
//wifi updating
57-
wifiupdate();
58-
}, 3000);
20+
wifiupdate();
21+
}, 3000);
22+
23+
setTime();
24+
wifiupdate();
25+
printredirect();
26+
printerStatus();
27+
}
28+
29+
function setTime() {
30+
var timeElement = document.getElementById("time");
31+
if (timeElement != null) {
32+
timeElement.innerHTML = moment().format("HH:mm:ss[<br>]DD-MMM-YY");
33+
}
5934
}
6035

6136
function printerStatus(){
62-
if (document.getElementById("printerstatus").src.indexOf("midchange") == -1){
63-
$.getJSON("/services/printers/get/"+encodeURI(printerName)).done(function (data){
64-
if (data.started)
65-
{
66-
Cookies.set('printerstatus',PRINTERONIMAGE);
67-
document.getElementById("printerstatus").src = PRINTERONIMAGE;
68-
}
69-
else
70-
{
71-
Cookies.set('printerstatus',PRINTEROFFIMAGE);
72-
document.getElementById("printerstatus").src = PRINTEROFFIMAGE;
73-
}
74-
});
37+
if (printerName == null || document.getElementById("printerstatus").src.indexOf("midchange") != -1){
38+
return;
39+
}
40+
41+
$.getJSON("/services/printers/get/"+encodeURI(printerName)).done(function (data){
42+
if (data.started) {
43+
Cookies.set('printerstatus',PRINTERONIMAGE);
44+
document.getElementById("printerstatus").src = PRINTERONIMAGE;
45+
} else {
46+
Cookies.set('printerstatus',PRINTEROFFIMAGE);
47+
document.getElementById("printerstatus").src = PRINTEROFFIMAGE;
7548
}
49+
});
7650
}
7751

52+
function updateWifiURL(signalstrength) {
53+
//using this as a guide for decent signal strengths in dBm: https://support.metageek.com/hc/en-us/articles/201955754-Understanding-WiFi-Signal-Strength
54+
if (signalstrength > -45) {
55+
wifiurl="images/wifi-3.png";
56+
} else if (signalstrength > -67) {
57+
wifiurl="images/wifi-2.png";
58+
} else if (signalstrength > -72) {
59+
wifiurl="images/wifi-1.png";
60+
} else if (signalstrength > -80) {
61+
wifiurl="images/wifi-0.png";
62+
} else {
63+
wifiurl="images/wifi-nc.png";
64+
}
65+
66+
document.getElementById("wifi").src = wifiurl;
67+
}
7868

7969
function wifiupdate(){
8070
//TODO: JSON to query the server's wifi status and display it
81-
82-
$.getJSON("../services/machine/wirelessNetworks/getWirelessStrength")
83-
.done(function (data){
84-
if ((typeof data !== 'undefined')&&(data !== null)){
85-
signalstrength = parseInt(data);
86-
}
87-
else{
88-
signalstrength = -100;
89-
}
90-
});
91-
Cookies.set('lastwifi',signalstrength);
92-
93-
// in the meantime for testing purposes, choose a random number.
94-
// signalstrength = Math.floor(Math.random() * -60)-30; //signal strength in dBm
95-
96-
//using this as a guide for decent signal strengths in dBm: https://support.metageek.com/hc/en-us/articles/201955754-Understanding-WiFi-Signal-Strength
97-
if (signalstrength > -45) {
98-
wifiurl="images/wifi-3.png";
99-
}
100-
else if (signalstrength > -67) {
101-
wifiurl="images/wifi-2.png";
102-
}
103-
else if (signalstrength > -72) {
104-
wifiurl="images/wifi-1.png";
105-
}
106-
else if (signalstrength > -80) {
107-
wifiurl="images/wifi-0.png";
108-
}
109-
else wifiurl="images/wifi-nc.png";
110-
111-
document.getElementById("wifi").src = wifiurl;
71+
$.getJSON("../services/machine/wirelessNetworks/list")
72+
.done(function (data){
73+
var signalStrength = Cookies.get('signalStrength');
74+
if ((typeof data !== 'undefined') && (data !== null)) {
75+
for (var t = 0; t < data.length; t++) {
76+
if (data[t].associated) {
77+
signalStrength = parseInt(data[t].signalStrength);
78+
}
79+
}
80+
}
81+
82+
updateWifiURL(signalStrength);
83+
})
84+
.error(function () {
85+
updateWifiURL(0);
86+
})
11287
}
11388

11489
function printredirect(){

host/printflow/maintain.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@
4141
<script src="../angular/js/angular.min.js"></script>
4242

4343
<script src="js/moment.min.js"></script>
44-
45-
<script src="js/printflow.js"></script>
4644
<script src="js/printerconfig.js"></script>
47-
45+
<script src="js/printflow.js"></script>
4846
<script src="js/js.cookie.js"></script>
4947

5048
<link href="css/printflow.css" rel="stylesheet">
@@ -144,8 +142,8 @@
144142
<img class="uilayer" src="images/maintain.png" usemap="maintain" class="uilayer">
145143
<map name="maintain">
146144
<area alt="" title="" href="maintain.html" shape="poly" coords="160,40,137,45,118,58,105,77,100,100,105,123,118,142,137,155,160,160,183,155,202,142,215,123,220,100,215,77,202,58,183,45" style="outline:none;" target="_self" />
147-
<area alt="" title="" href="settings.html" shape="poly" coords="65,132,52,135,40,142,33,154,30,167,33,180,40,192,52,199,65,202,78,199,90,192,97,180,100,167,97,154,90,142,78,135" style="outline:none;" target="_self" />
148-
<area alt="" title="" href="index.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
145+
<area alt="" title="" href="printflowsettings.html" shape="poly" coords="65,132,52,135,40,142,33,154,30,167,33,180,40,192,52,199,65,202,78,199,90,192,97,180,100,167,97,154,90,142,78,135" style="outline:none;" target="_self" />
146+
<area alt="" title="" href="printflow.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
149147
<area alt="" title="toggle" shape="rect" coords="252,41,608,103" style="outline:none;" target="_self" onclick="togglePrinter();" />
150148
<area alt="" title="minus10"" shape="rect" coords="371,110,445,167" style="outline:none;" target="_self" onclick="changez(-10);" />
151149
<area alt="" title="plus10" shape="rect" coords="448,110,522,167" style="outline:none;" target="_self" onclick="changez(10);" />
@@ -159,9 +157,9 @@
159157
<div name="warn" id="warn" class="warn"><div id="warning" role="alert" class="alert alert-danger collapse" ><strong>Error</strong><br>Cannot move past Z axis limits!</div></div>
160158
<div name="togglebutton" class="togglebutton" id="togglebutton" onClick="togglePrinter();"></div>
161159

162-
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='index.html';">
160+
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='printflow.html';">
163161
<img name="bigbuttonhighlight" id="bigbuttonhighlight" class="bigbuttonhighlight" src="images/bigbuttonANIM.png" onClick="location.href='maintain.html';">
164-
<img name="smallbuttonhighlight" id="smallbuttonhighlight" class="smallbuttonhighlight" src="images/homehighlightANIM.png" onClick="location.href='settings.html';">
162+
<img name="smallbuttonhighlight" id="smallbuttonhighlight" class="smallbuttonhighlight" src="images/homehighlightANIM.png" onClick="location.href='printflowsettings.html';">
165163
</div>
166164
</div>
167165

host/printflow/printdialogue.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296
function cancel(){
297297
$.getJSON("../services/printJobs/stopJob/"+jobId)
298298
.always(function(){
299-
location.href="index.html";
299+
location.href="printflow.html";
300300
});
301301
}
302302

@@ -306,7 +306,7 @@
306306
<img src="images/printdialogue.png" usemap="printdialogue" class="uilayer">
307307
<map name="printdialogue" style="z-index: 100;">
308308
<area alt="" title="" shape="poly" coords="160,40,137,45,118,58,105,77,100,100,105,123,118,142,137,155,160,160,183,155,202,142,215,123,220,100,215,77,202,58,183,45" onClick="cancel()"style="outline:none;" target="_self" />
309-
<area alt="" title="" href="index.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
309+
<area alt="" title="" href="printflow.html" shape="poly" coords="48,16,35,19,25,26,18,36,15,49,18,62,25,72,35,79,48,82,61,79,71,72,78,62,81,49,78,36,71,26,61,19" style="outline:none;" target="_self" />
310310
<area alt="" title="Pause" shape="rect" coords="252,268,548,324" style="outline:none;" target="_self" onClick="pause();" />
311311
</map>
312312
<img name="wifi" id="wifi" class="wifi" src="images/pixel.png">
@@ -324,7 +324,7 @@
324324

325325
<div name="jobid" id="jobid" class="jobid"><script>document.write(printid);</script></div>
326326

327-
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='index.html';">
327+
<img name="homehighlight" id="homehighlight" class="homehighlight" src="images/homehighlightANIM.png" onClick="location.href='printflow.html';">
328328
<img name="bigbuttonhighlight" id="bigbuttonhighlight" class="bigbuttonhighlight" src="images/bigbuttonANIM.png" onClick="cancel();">
329329

330330
<div class="printlayer" id="printlayer">

host/printflow/index.html renamed to host/printflow/printflow.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@
101101
<div class="main">
102102
<img src="images/mainmenu.png" usemap="mainmenu" class="uilayer">
103103
<map name="mainmenu">
104-
<area alt="" title="" href="printables.html" shape="poly" coords="411,104,384,109,362,125,346,147,341,174,346,201,362,223,384,239,411,244,438,239,460,223,476,201,481,174,476,147,460,125,438,109" style="outline:none;" target="_self" onClick="location.href='printables.html';" />
104+
<area alt="" title="" href="printflowprintables.html" shape="poly" coords="411,104,384,109,362,125,346,147,341,174,346,201,362,223,384,239,411,244,438,239,460,223,476,201,481,174,476,147,460,125,438,109" style="outline:none;" target="_self" onClick="location.href='printables.html';" />
105105
<area alt="" title="" href="maintain.html" shape="poly" coords="596,25,573,30,554,43,541,62,536,85,541,108,554,127,573,140,596,145,619,140,638,127,651,108,656,85,651,62,638,43,619,30" style="outline:none;" target="_self" onClick="location.href='maintain.html';" />
106-
<area alt="" title="" href="settings.html" shape="poly" coords="598,247,575,252,556,265,543,284,538,307,543,330,556,349,575,362,598,367,621,362,640,349,653,330,658,307,653,284,640,265,621,252" style="outline:none;" target="_self" onClick="location.href='settings.html';" />
106+
<area alt="" title="" href="printflowsettings.html" shape="poly" coords="598,247,575,252,556,265,543,284,538,307,543,330,556,349,575,362,598,367,621,362,640,349,653,330,658,307,653,284,640,265,621,252" style="outline:none;" target="_self" onClick="location.href='printflowsettings.html';" />
107107
</map>
108108
<img name="wifi" id="wifi" class="wifi" src="images/pixel.png">
109109
<img name="printerstatus" id="printerstatus" class="printerstatus" src="images/pixel.png">
110-
<img name="print" id="print" class="print" src="images/menumainbuttonANIM.png" onClick="location.href='printables.html';">
110+
<img name="print" id="print" class="print" src="images/menumainbuttonANIM.png" onClick="location.href='printflowprintables.html';">
111111
<img name="maintain" id="maintain" class="maintain" src="images/menusubbuttonANIM.png" onClick="location.href='maintain.html';">
112-
<img name="settings" id="settings" class="settings" src="images/menusubbuttonANIM.png" onClick="location.href='settings.html';">
112+
<img name="settings" id="settings" class="settings" src="images/menusubbuttonANIM.png" onClick="location.href='printflowsettings.html';">
113113
<img name="maintopconnector" id="maintopconnector" class="maintopconnector" src="images/maintopconnector.png">
114114
<img name="mainbotconnector" id="mainbotconnector" class="mainbotconnector" src="images/mainbotconnector.png">
115115
</div>

0 commit comments

Comments
 (0)