www/js/mon_fermenter.js

changeset 390
1c52a6875960
parent 385
95276520a11c
child 455
f319a8ab931a
equal deleted inserted replaced
389:eb8ce63eb489 390:1c52a6875960
165 ticksMinor: { interval: 1, size: '5%' }, 165 ticksMinor: { interval: 1, size: '5%' },
166 ticksMajor: { interval: 5, size: '9%' }, 166 ticksMajor: { interval: 5, size: '9%' },
167 labels: { interval: 5 }, 167 labels: { interval: 5 },
168 style: { fill: '#eeeeee', stroke: '#666666' }, 168 style: { fill: '#eeeeee', stroke: '#666666' },
169 value: 0, 169 value: 0,
170 colorScheme: 'scheme05', 170 colorScheme: 'scheme05'
171 easing: 'easeOutBack',
172 animationDuration: 600
173 }; 171 };
174 var gaugeSmalloptions = { 172 var gaugeSmalloptions = {
175 min: -15, max: 25, width: 190, height: 190, 173 min: -15, max: 25, width: 190, height: 190,
176 ranges: [{ startValue: -15, endValue: 0, startWidth: 5, endWidth: 5, style: { fill: '#3399FF', stroke: '#3399FF' }}, 174 ranges: [{ startValue: -15, endValue: 0, startWidth: 5, endWidth: 5, style: { fill: '#3399FF', stroke: '#3399FF' }},
177 { startValue: 0, endValue: 10, startWidth: 5, endWidth: 5, style: { fill: '#00CC33', stroke: '#00CC33' }}, 175 { startValue: 0, endValue: 10, startWidth: 5, endWidth: 5, style: { fill: '#00CC33', stroke: '#00CC33' }},
180 ticksMajor: { interval: 5, size: '9%' }, 178 ticksMajor: { interval: 5, size: '9%' },
181 labels: { interval: 5 }, 179 labels: { interval: 5 },
182 style: { fill: '#eeeeee', stroke: '#666666' }, 180 style: { fill: '#eeeeee', stroke: '#666666' },
183 value: 0, 181 value: 0,
184 colorScheme: 'scheme05', 182 colorScheme: 'scheme05',
185 easing: 'easeOutBack',
186 animationDuration: 400,
187 caption: { value: 'Chiller', position: 'bottom', offset: [0, 10] } 183 caption: { value: 'Chiller', position: 'bottom', offset: [0, 10] }
188 }; 184 };
189 $("#gaugeContainer_air").jqxGauge( gaugeoptions ); 185 $("#gaugeContainer_air").jqxGauge( gaugeoptions );
190 $("#gaugeContainer_air").jqxGauge( { caption: { value: 'Air: 00.000' }} ); 186 $("#gaugeContainer_air").jqxGauge( { caption: { value: 'Air: 00.000' }} );
191 $("#gaugeContainer_beer").jqxGauge( gaugeoptions ); 187 $("#gaugeContainer_beer").jqxGauge( gaugeoptions );
226 data += '","mode":"'+mode+'","setpoint":{"low":'+tlo+',"high":'+thi+'}}'; 222 data += '","mode":"'+mode+'","setpoint":{"low":'+tlo+',"high":'+thi+'}}';
227 $.ajax({ 223 $.ajax({
228 url: "cmd_fermenter.php", 224 url: "cmd_fermenter.php",
229 data: data, 225 data: data,
230 type: "POST", 226 type: "POST",
231 success: function(data) { 227 success: function(data) {},
232 //do something after something is received from php 228 error: function(jqXHR, textStatus, errorThrown) { console.log("sendBase() error"); }
233 },
234 error: function(jqXHR, textStatus, errorThrown) {
235 console.log("sendBase() error");
236 }
237 }); 229 });
238 } 230 }
239 231
240 function sendSwitch(sw1, sw2, sw3, sw4) { 232 function sendSwitch(sw1, sw2, sw3, sw4) {
241 233
244 data += '{"heater":{"state":'+sw1+'},"cooler":{"state":'+sw2+'},"fan":{"state":'+sw3+'},"light":{"state":'+sw4+'}}'; 236 data += '{"heater":{"state":'+sw1+'},"cooler":{"state":'+sw2+'},"fan":{"state":'+sw3+'},"light":{"state":'+sw4+'}}';
245 $.ajax({ 237 $.ajax({
246 url: "cmd_fermenter.php", 238 url: "cmd_fermenter.php",
247 data: data, 239 data: data,
248 type: "POST", 240 type: "POST",
249 success: function(data) { 241 success: function(data) {},
250 //do something after something is received from php 242 error: function(jqXHR, textStatus, errorThrown) { console.log("sendSwitch() error"); }
251 },
252 error: function(jqXHR, textStatus, errorThrown) {
253 console.log("sendBase() error");
254 }
255 }); 243 });
256 } 244 }
257 245
258 function sendProduct(code, name, uuid, yeast_lo, yeast_hi) { 246 function sendProduct(code, name, uuid, yeast_lo, yeast_hi) {
259 247
262 data += '{"product":{"code":"'+code+'","name":"'+name+'","uuid":"'+uuid+'","yeast_lo":'+yeast_lo+',"yeast_hi":'+yeast_hi+'}}'; 250 data += '{"product":{"code":"'+code+'","name":"'+name+'","uuid":"'+uuid+'","yeast_lo":'+yeast_lo+',"yeast_hi":'+yeast_hi+'}}';
263 $.ajax({ 251 $.ajax({
264 url: "cmd_fermenter.php", 252 url: "cmd_fermenter.php",
265 data: data, 253 data: data,
266 type: "POST", 254 type: "POST",
267 success: function(data) { 255 success: function(data) {},
268 //do something after something is received from php 256 error: function(jqXHR, textStatus, errorThrown) { console.log("sendProduct() error"); }
269 },
270 error: function(jqXHR, textStatus, errorThrown) {
271 console.log("sendBase() error");
272 }
273 }); 257 });
274 } 258 }
275 259
276 function sendProfile(payload) { 260 function sendProfile(payload) {
277 261
279 var data = 'node='+record.node+'&alias='+record.alias+'&payload='+payload; 263 var data = 'node='+record.node+'&alias='+record.alias+'&payload='+payload;
280 $.ajax({ 264 $.ajax({
281 url: "cmd_fermenter.php", 265 url: "cmd_fermenter.php",
282 data: data, 266 data: data,
283 type: "POST", 267 type: "POST",
284 success: function(data) { 268 success: function(data) {},
285 //do something after something is received from php 269 error: function(jqXHR, textStatus, errorThrown) { console.log("sendProfile() error"); }
286 },
287 error: function(jqXHR, textStatus, errorThrown) {
288 console.log("sendBase() error");
289 }
290 }); 270 });
291 } 271 }
292 272
293 var url = "getfermenter.php?uuid='" + my_uuid + "'"; 273 var url = "getfermenter.php?uuid='" + my_uuid + "'";
294 var source = { 274 var source = {

mercurial