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