image/w/js/webui.js

Sat, 06 Jun 2020 13:28:46 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 06 Jun 2020 13:28:46 +0200
changeset 77
66c77497d86d
parent 42
c6a1a6ca5437
child 78
b58e0c9897e1
permissions
-rw-r--r--

Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.

0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 document.getElementById("test").innerHTML = "WebSocket is not connected";
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 var websocket = new WebSocket('ws://'+location.hostname+'/ws');
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
5 var Beep= new Audio( "data:audio/wav;base64,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 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=" );
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 var BBScreen={
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
9 Screen: -1,
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
10 Subscreen: 0,
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
11 setTimer: function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
12 $("#timer").text('');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
13 if (v == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
14 $("#timer").css("font-size", "18px");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
15 $("#timer").css("font-weight", "normal");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
16 $("#timer").css("font-family", "Verdana, Arial, sans-serif");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
17 } else {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
18 $("#timer").css("font-size", "36px");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
19 $("#timer").css("font-weight", "bold");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
20 $("#timer").css("font-family", "Courier New, Lucida Console");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
21 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
22 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
23 clearScreen: function(){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
24 $("#mltline").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
25 $("#mlt_table").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
26 $("#mlt00").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
27 $("#mlt20").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
28 $("#mlt01").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
29 $("#mlt21").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
30 $("#midline").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
31 this.setTimer(0);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
32 $("#mid00").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
33 $("#mid20").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
34 $("#mid00").css("background-color", "#e7e7e7");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
35 $("#mid00").css("color", "black");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
36 $("#hltline").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
37 $("#hlt_table").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
38 $("#hlt00").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
39 $("#hlt20").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
40 $("#hlt01").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
41 $("#hlt21").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
42 $("#hlt01").css("background-color", "#e7e7e7");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
43 $("#hlt01").css("color", "black");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
44 $("#row_info").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
45 $("#prompt").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
46 $("#button_nee").css("background-color", "#e7e7e7");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
47 $("#button_nee").css("color", "black");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
48 $("#note").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
49 $("#brew").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
50 },
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
51 setScreen: function(s){
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
52 Screen = parseInt(s,10);
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
53 switch (Screen) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
54 case 0: this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
55 $("#mltline").show();
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
56 $("#mlt_table").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
57 $("#but00").text('Hand');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
58 $("#but20").text('Auto');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
59 $("#mlt00").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
60 $("#mlt20").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
61 $("#midline").show();
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
62 this.setTimer(0);
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
63 $("#hltline").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
64 $("#hlt_table").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
65 $("#hlt01").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
66 $("#but04").text('Info');
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
67 // No tools button on the web.
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
68 break;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
69 case 2: this.clearScreen();
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
70 $("#row_info").show();
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
71 break;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
72 case 96: break; // Automaat show recipe and Stop / Start
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
73 case 98: break; // Delay start
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
74 case 99: this.clearScreen(); // heatup
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
75 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
76 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
77 $("#midline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
78 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
79 $("#hlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
80 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
81 case 100: break; // All handled at Subscreen
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
82 case 120: this.clearScreen();
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
83 $("#mltline").show(); // to boil
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
84 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
85 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
86 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
87 $("#but00").text('+sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
88 $("#but20").text('-sp');
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
89 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
90 case 121: this.clearScreen();
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
91 $("#mltline").show(); // boil
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
92 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
93 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
94 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
95 $("#but00").text('+sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
96 $("#but20").text('-sp');
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
97 $("#midline").show();
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
98 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
99 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
100 $("#but02").text('+%');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
101 $("#but22").text('-%');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
102 this.setTimer(1);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
103 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
104 $("#hlt01").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
105 $("#hlt21").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
106 $("#but04").text('+1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
107 $("#but24").text('-1m');
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
108 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
109 case 122: // whirlpool 9
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
110 case 123: // cooling H
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
111 case 124: // whirlpool 7
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
112 case 125: // cooling M
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
113 case 126: // whirlpool 6
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
114 case 127: // cooling C
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
115 case 128: // whirlpool 2
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
116 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
117 case 129: this.clearScreen();
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
118 $("#note").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
119 $("#note_msg").text('Brouwen is gereed.');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
120 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
121 case 130: this.clearScreen();
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
122 $("#note").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
123 $("#note_msg").text('Brouwen is afgebroken.');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
124 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
125 case 97:
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
126 case 200: this.clearScreen();
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
127 $("#prompt").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
128 break;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
129 case 201: this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
130 $("#mltline").show();
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
131 $("#but00").text('+sp');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
132 $("#but20").text('-sp');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
133 $("#but01").text('Pomp');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
134 $("#but21").text('Aan');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
135 $("#midline").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
136 $("#hltline").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
137 $("#but03").text('+sp');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
138 $("#but23").text('-sp');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
139 $("#but04").text('Stop');
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
140 $("#but24").text('Aan');
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
141 $("#hlt01").show();
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
142 $("#hlt01").css("background-color", "#575757");
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
143 $("#hlt01").css("color", "white");
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
144 break;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
145 default: this.clearScreen();
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
146 console.log("this is default screen "+Screen);
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
147 break;
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
148 }
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
149 },
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
150 setSubscreen: function(s){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
151 Subscreen = parseInt(s,10);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
152 console.log("Screen:"+Screen+" Sub:"+Subscreen);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
153 if (Screen == 96) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
154 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
155 if (Subscreen == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
156 $("#prompt").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
157 $("#button_ja").text('Ja');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
158 $("#button_nee").text('Nee');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
159 } else if (Subscreen == 1) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
160 $("#brew").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
161 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
162 } else if ((Screen >= 100) && (Screen < 120)) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
163 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
164 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
165 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
166 $("#midline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
167 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
168 $("#hlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
169 switch (Subscreen) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
170 case 0: // MASH_NONE
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
171 case 1: // MASH_WAITTEMP
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
172 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
173 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
174 $("#but00").text('+sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
175 $("#but20").text('-sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
176 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
177 case 2: // MASH_REST
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
178 this.setTimer(1);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
179 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
180 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
181 $("#but02").text('+1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
182 $("#but22").text('-1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
183 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
184 case 3: // MASH_ADD
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
185 case 4: // MASH_IODINE
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
186 case 5: // MASH_REMOVE
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
187 case 6: // MASH_INFUSE
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
188 case 7: // MASH_DECOCT
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
189 this.setTimer(0);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
190 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
191 $("#mid00").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
192 $("#mid00").css("color", "white");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
193 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
194 $("#but02").text('Halt');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
195 $("#but22").text('Ok');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
196 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
197 };
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
198 } else if ((Screen == 123) || (Screen == 125) || (Screen == 127)) { // cooling H,M,C
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
199 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
200 if (Subscreen == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
201 $("#prompt").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
202 $("#button_ja").text('Start');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
203 $("#button_nee").text('Stop');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
204 $("#button_nee").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
205 $("#button_nee").css("color", "white");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
206 } else if (Subscreen == 1) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
207 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
208 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
209 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
210 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
211 $("#but00").text('+1');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
212 $("#but20").text('-1');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
213 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
214 $("#hlt01").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
215 $("#but04").text('Stop');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
216 $("#hlt01").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
217 $("#hlt01").css("color", "white");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
218 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
219 } else if ((Screen == 122) || (Screen == 124) || (Screen == 126) || (Screen == 128)) { // whirlpools
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
220 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
221 if (Subscreen == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
222 $("#prompt").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
223 $("#button_ja").text('Start');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
224 $("#button_nee").text('Stop');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
225 $("#button_nee").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
226 $("#button_nee").css("color", "white");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
227 } else if (Subscreen == 1) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
228 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
229 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
230 $("#midline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
231 this.setTimer(1);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
232 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
233 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
234 $("#but02").text('-1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
235 $("#but22").text('+1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
236 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
237 $("#hlt21").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
238 $("#but24").text('Pomp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
239 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
240 };
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
241 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 MLT_pv: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 $("#mlt_pv").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 MLT_sp: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 $("#mlt_sp").text(s);
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
247 if (Screen == 201) {
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
248 if (s != "") {
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
249 $("#mlt00").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
250 $("#mlt20").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
251 $("#mlt01").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
252 $("#mlt21").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
253 $("#mlt_table").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
254 }
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
255 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 MLT_power: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 $("#mlt_power").text(s);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
259 if (Screen == 201) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
260 if (s != "") {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
261 $("#but21").text('Uit');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
262 } else {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
263 $("#but21").text('Aan');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
264 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
265 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 MLT_led: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 if (s == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 $("#mlt_led").css("background-color", "#270");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 $("#mlt_led").css("background-color", "#5E0");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 Pump_led: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 if (s == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 $("#pump_led").css("background-color", "#820");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 $("#pump_led").css("background-color", "#F40");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 HLT_pv: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 $("#hlt_pv").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 HLT_sp: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 $("#hlt_sp").text(s);
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
284 if (Screen == 201) {
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
285 if (s != "") {
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
286 $("#hlt00").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
287 $("#hlt20").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
288 $("#hlt21").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
289 $("#hlt_table").show();
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
290 }
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
291 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 HLT_power: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 $("#hlt_power").text(s);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
295 if (Screen == 201) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
296 if (s != "") {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
297 $("#but24").text('Uit');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
298 } else {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
299 $("#but24").text('Aan');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
300 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
301 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 HLT_led: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 if (s == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 $("#hlt_led").css("background-color", "#270");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 $("#hlt_led").css("background-color", "#5E0");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 Topmessage: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 $("#top_msg").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 Timer: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 $("#timer").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 },
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
315 Brew1: function(s) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
316 $("#brew_msg1").text(s);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
317 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
318 Brew2: function(s) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
319 $("#brew_msg2").text(s);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
320 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
321 Beep: function(s) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
322 var loop = parseInt(s,10);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
323 Beep.pause();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
324 Beep.loop = false;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
325 for (i = 0; i < loop; i++) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
326 Beep.play();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
327 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
328 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 };
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 var BrewBoard = {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 p_msg:function(e){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 var b=this;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 var a=JSON.parse(e);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 var c={
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
337 main: function(v){
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
338 BBScreen.setScreen(v)
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
339 },
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
340 sub: function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
341 BBScreen.setSubscreen(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
342 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 mlt_pv:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 BBScreen.MLT_pv(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 mlt_sp:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 BBScreen.MLT_sp(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 mlt_power:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 BBScreen.MLT_power(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 mlt_led:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 BBScreen.MLT_led(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 pump_led:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 BBScreen.Pump_led(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 hlt_pv:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 BBScreen.HLT_pv(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 hlt_sp:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 BBScreen.HLT_sp(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364 hlt_power:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 BBScreen.HLT_power(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 hlt_led:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 BBScreen.HLT_led(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 top_msg:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 BBScreen.Topmessage(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 timer:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 BBScreen.Timer(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 },
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
376 beep:function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
377 BBScreen.Beep(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
378 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
379 brew1:function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
380 BBScreen.Brew1(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
381 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
382 brew2:function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
383 BBScreen.Brew2(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
384 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 };
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 $.each(a,function(k,v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 if (typeof(c[k])!="undefined"){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 c[k](v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 });
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 };
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
395 function sendTouch(x, y) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
396 websocket.send('{"touch":{"x":'+x+',"y":'+y+'}}');
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
400 /* Define keys in the screens and their actions. */
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
401 $("#ok_info").click( function() { sendTouch(160,220); });
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
402 $("#ok_note").click( function() { sendTouch(160,220); });
41
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
403 $("#mlt00").click( function() { sendTouch( 35, 46); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
404 $("#mlt20").click( function() { sendTouch(285, 46); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
405 $("#mlt01").click( function() { sendTouch( 35, 96); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
406 $("#mlt21").click( function() { sendTouch(285, 96); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
407 $("#mid00").click( function() { sendTouch( 35,140); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
408 $("#mid20").click( function() { sendTouch(285,140); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
409 $("#hlt00").click( function() { sendTouch( 35,170); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
410 $("#hlt20").click( function() { sendTouch(285,170); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
411 $("#hlt01").click( function() { sendTouch( 35,220); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
412 $("#hlt21").click( function() { sendTouch(285,220); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
413 $("#button_ja").click( function() { sendTouch( 80,120); });
7639cfa6aec0 Websocket interface is working for the main screen and manual mode.
Michiel Broek <mbroek@mbse.eu>
parents: 40
diff changeset
414 $("#button_nee").click( function() { sendTouch(240,120); });
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
415 $("#button_stop").click( function() { sendTouch( 35,220); });
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
416 $("#button_start").click( function() { sendTouch(285,220); });
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
417
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 websocket.onopen = function(evt) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
419 console.log('WebSocket connection opened');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
420 document.getElementById("test").innerHTML = "";
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424 * Process received websocket messages.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426 websocket.onmessage = function(evt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
427 var msg = evt.data;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428 var value;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 switch (msg.charAt(0)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430 case '{':
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431 BrewBoard.p_msg(evt.data);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
434 document.getElementById("output").innerHTML = evt.data;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
435 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
437 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 websocket.onclose = function(evt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 console.log('Websocket connection closed');
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 document.getElementById("test").innerHTML = "WebSocket closed";
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 websocket.onerror = function(evt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 console.log('Websocket error: ' + evt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 document.getElementById("test").innerHTML = "WebSocket error????!!!1!!";
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449

mercurial