image/w/js/webui.js

Mon, 17 May 2021 20:44:35 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 17 May 2021 20:44:35 +0200
changeset 91
255a75322212
parent 79
cb5c73a8ae90
child 116
bafc2d6a0790
permissions
-rw-r--r--

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.

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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
6 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
7
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 var BBScreen={
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
10 Screen: -1,
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
11 Subscreen: 0,
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
12 setTimer: function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
13 $("#timer").text('');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
16 $("#timer").css("font-weight", "normal");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
24 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
25 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
26 clearScreen: function(){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
27 $("#mltline").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
28 $("#mlt_table").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
29 $("#mlt00").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
30 $("#mlt20").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
31 $("#mlt01").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
32 $("#mlt21").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
33 $("#midline").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
34 this.setTimer(0);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
35 $("#mid00").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
36 $("#mid20").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
37 $("#mid00").css("background-color", "#e7e7e7");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
38 $("#mid00").css("color", "black");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
39 $("#hltline").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
40 $("#hlt_table").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
41 $("#hlt00").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
42 $("#hlt20").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
43 $("#hlt01").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
44 $("#hlt21").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
45 $("#hlt01").css("background-color", "#e7e7e7");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
46 $("#hlt01").css("color", "black");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
47 $("#row_info").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
48 $("#prompt").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
49 $("#button_nee").css("background-color", "#e7e7e7");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
50 $("#button_nee").css("color", "black");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
51 $("#note").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
52 $("#brew").hide();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
57 case 0: this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
75 case 96: break; // Automaat show recipe and Stop / Start
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
76 case 98: break; // Delay start
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
77 case 99: this.clearScreen(); // heatup
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
78 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
79 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
80 $("#midline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
81 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
82 $("#hlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
86 $("#mltline").show(); // to boil
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
87 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
88 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
89 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
90 $("#but00").text('+sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
94 $("#mltline").show(); // boil
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
95 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
96 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
97 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
98 $("#but00").text('+sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
101 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
102 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
103 $("#but02").text('+%');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
104 $("#but22").text('-%');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
105 this.setTimer(1);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
106 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
107 $("#hlt01").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
108 $("#hlt21").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
109 $("#but04").text('+1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
121 $("#note").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
122 $("#note_msg").text('Brouwen is gereed.');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
125 $("#note").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
126 $("#note_msg").text('Brouwen is afgebroken.');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
127 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
128 case 97:
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
132 case 201: this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
153 setSubscreen: function(s){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
154 Subscreen = parseInt(s,10);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
155 console.log("Screen:"+Screen+" Sub:"+Subscreen);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
156 if (Screen == 96) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
157 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
158 if (Subscreen == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
159 $("#prompt").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
160 $("#button_ja").text('Ja');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
161 $("#button_nee").text('Nee');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
162 } else if (Subscreen == 1) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
163 $("#brew").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
166 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
167 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
168 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
169 $("#midline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
170 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
171 $("#hlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
172 switch (Subscreen) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
173 case 0: // MASH_NONE
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
174 case 1: // MASH_WAITTEMP
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
175 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
176 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
177 $("#but00").text('+sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
178 $("#but20").text('-sp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
179 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
180 case 2: // MASH_REST
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
181 this.setTimer(1);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
182 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
183 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
184 $("#but02").text('+1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
185 $("#but22").text('-1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
186 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
187 case 3: // MASH_ADD
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
188 case 4: // MASH_IODINE
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
189 case 5: // MASH_REMOVE
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
192 this.setTimer(0);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
193 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
194 $("#mid00").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
195 $("#mid00").css("color", "white");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
196 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
197 $("#but02").text('Halt');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
198 $("#but22").text('Ok');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
199 break;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
202 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
203 if (Subscreen == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
204 $("#prompt").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
205 $("#button_ja").text('Start');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
206 $("#button_nee").text('Stop');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
207 $("#button_nee").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
210 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
211 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
212 $("#mlt00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
213 $("#mlt20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
214 $("#but00").text('+1');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
215 $("#but20").text('-1');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
216 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
217 $("#hlt01").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
218 $("#but04").text('Stop');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
219 $("#hlt01").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
231 this.clearScreen();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
232 if (Subscreen == 0) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
233 $("#prompt").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
234 $("#button_ja").text('Start');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
235 $("#button_nee").text('Stop');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
236 $("#button_nee").css("background-color", "#575757");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
237 $("#button_nee").css("color", "white");
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
238 } else if (Subscreen == 1) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
239 $("#mltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
240 $("#mlt_table").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
241 $("#midline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
242 this.setTimer(1);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
243 $("#mid00").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
244 $("#mid20").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
245 $("#but02").text('-1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
246 $("#but22").text('+1m');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
247 $("#hltline").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
248 $("#hlt21").show();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
249 $("#but24").text('Pomp');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
250 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
251 };
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
252 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 MLT_pv: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 $("#mlt_pv").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 MLT_sp: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 MLT_power: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 $("#mlt_power").text(s);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
270 if (Screen == 201) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
271 if (s != "") {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
272 $("#but21").text('Uit');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
273 } else {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
274 $("#but21").text('Aan');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
275 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
276 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 MLT_led: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 if (s == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 $("#mlt_led").css("background-color", "#270");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 $("#mlt_led").css("background-color", "#5E0");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 Pump_led: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 if (s == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 $("#pump_led").css("background-color", "#820");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 $("#pump_led").css("background-color", "#F40");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 HLT_pv: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 $("#hlt_pv").text(s);
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_sp: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
302 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 HLT_power: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 $("#hlt_power").text(s);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
306 if (Screen == 201) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
307 if (s != "") {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
308 $("#but24").text('Uit');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
309 } else {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
310 $("#but24").text('Aan');
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
311 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
312 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 HLT_led: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 if (s == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 $("#hlt_led").css("background-color", "#270");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 $("#hlt_led").css("background-color", "#5E0");
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 Topmessage: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 $("#top_msg").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 Timer: function(s) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 $("#timer").text(s);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 },
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
326 Brew1: function(s) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
327 $("#brew_msg1").text(s);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
328 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
329 Brew2: function(s) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
330 $("#brew_msg2").text(s);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
331 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
332 Beep: function(s) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
333 var loop = parseInt(s,10);
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
334 Beep.pause();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
335 Beep.loop = false;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
336 for (i = 0; i < loop; i++) {
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
337 Beep.play();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
338 }
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
339 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 };
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 var BrewBoard = {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 p_msg:function(e){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 var b=this;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 var a=JSON.parse(e);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
351 sub: function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
352 BBScreen.setSubscreen(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
353 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 mlt_pv:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 BBScreen.MLT_pv(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 mlt_sp:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 BBScreen.MLT_sp(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 mlt_power:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 BBScreen.MLT_power(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363 mlt_led:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364 BBScreen.MLT_led(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 pump_led:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 BBScreen.Pump_led(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 hlt_pv:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 BBScreen.HLT_pv(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 hlt_sp:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 BBScreen.HLT_sp(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 hlt_power:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 BBScreen.HLT_power(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 hlt_led:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 BBScreen.HLT_led(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 top_msg:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 BBScreen.Topmessage(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 },
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 timer:function(v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 BBScreen.Timer(v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 },
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
387 beep:function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
388 BBScreen.Beep(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
389 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
390 brew1:function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
391 BBScreen.Brew1(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
392 },
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
393 brew2:function(v){
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
394 BBScreen.Brew2(v)
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
395 },
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 };
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 $.each(a,function(k,v){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 if (typeof(c[k])!="undefined"){
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 c[k](v)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 });
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 };
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405
40
71e06f6d80fd Work on web interface using websockets.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
406 function sendTouch(x, y) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
407 websocket.send('{"touch":{"x":'+x+',"y":'+y+'}}');
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
426 $("#button_stop").click( function() { sendTouch( 35,220); });
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 websocket.onopen = function(evt) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
434 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
435 * Process received websocket messages.
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 websocket.onmessage = function(evt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 var msg = evt.data;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 var value;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 switch (msg.charAt(0)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 case '{':
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 BrewBoard.p_msg(evt.data);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 document.getElementById("output").innerHTML = evt.data;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 break;
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
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
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460

mercurial