139 displayMember: 'name', |
139 displayMember: 'name', |
140 width: 240, |
140 width: 240, |
141 dropDownWidth: 480, |
141 dropDownWidth: 480, |
142 autoDropDownHeight: true |
142 autoDropDownHeight: true |
143 }); |
143 }); |
|
144 $('#air_address').on('select', function (event) { |
|
145 var args = event.args; |
|
146 if (args) { |
|
147 if ((args.index > 0) && (args.type != 'none')) { |
|
148 dataRecord.air_idx = 0; |
|
149 $('#air_idx').val(0); |
|
150 } |
|
151 } |
|
152 }); |
|
153 $('#beer_address').on('select', function (event) { |
|
154 var args = event.args; |
|
155 if (args) { |
|
156 if ((args.index > 0) && (args.type != 'none')) { |
|
157 dataRecord.beer_idx = 0; |
|
158 $('#beer_idx').val(0); |
|
159 } |
|
160 } |
|
161 }); |
|
162 $('#chiller_address').on('select', function (event) { |
|
163 var args = event.args; |
|
164 if (args) { |
|
165 if ((args.index > 0) && (args.type != 'none')) { |
|
166 dataRecord.chiller_idx = 0; |
|
167 $('#chiller_idx').val(0); |
|
168 } |
|
169 } |
|
170 }); |
144 $('#air_idx,#beer_idx,#chiller_idx,#heater_idx,#cooler_idx,#fan_idx,#light_idx,#door_idx,#psu_idx').jqxNumberInput(Spin0dec); |
171 $('#air_idx,#beer_idx,#chiller_idx,#heater_idx,#cooler_idx,#fan_idx,#light_idx,#door_idx,#psu_idx').jqxNumberInput(Spin0dec); |
145 $('#heater_address,#cooler_address,#fan_address,#light_address').jqxDropDownList({ |
172 $('#heater_address,#cooler_address,#fan_address,#light_address').jqxDropDownList({ |
146 theme: theme, |
173 theme: theme, |
147 source: switcheslist, |
174 source: switcheslist, |
148 valueMember: 'uuid', |
175 valueMember: 'uuid', |
149 displayMember: 'name', |
176 displayMember: 'name', |
150 width: 240, |
177 width: 240, |
151 dropDownWidth: 480, |
178 dropDownWidth: 480, |
152 autoDropDownHeight: true |
179 autoDropDownHeight: true |
153 }); |
180 }); |
|
181 $('#heater_address').on('select', function (event) { |
|
182 var args = event.args; |
|
183 if (args) { |
|
184 if ((args.index > 0) && (args.type != 'none')) { |
|
185 dataRecord.heater_idx = dataRecord.heater_state = dataRecord.heater_delay = 0; |
|
186 $('#heater_idx').val(0); |
|
187 $('#heater_state').val(0); |
|
188 $('#heater_delay').val(0); |
|
189 } |
|
190 } |
|
191 }); |
|
192 $('#cooler_address').on('select', function (event) { |
|
193 var args = event.args; |
|
194 if (args) { |
|
195 if ((args.index > 0) && (args.type != 'none')) { |
|
196 dataRecord.cooler_idx = dataRecord.cooler_state = dataRecord.cooler_delay = 0; |
|
197 $('#cooler_idx').val(0); |
|
198 $('#cooler_state').val(0); |
|
199 $('#cooler_delay').val(0); |
|
200 } |
|
201 } |
|
202 }); |
|
203 $('#fan_address').on('select', function (event) { |
|
204 var args = event.args; |
|
205 if (args) { |
|
206 if ((args.index > 0) && (args.type != 'none')) { |
|
207 dataRecord.fan_idx = dataRecord.fan_state = dataRecord.fan_delay = 0; |
|
208 $('#fan_idx').val(0); |
|
209 $('#fan_state').val(0); |
|
210 $('#fan_delay').val(0); |
|
211 } |
|
212 } |
|
213 }); |
|
214 $('#light_address').on('select', function (event) { |
|
215 var args = event.args; |
|
216 if (args) { |
|
217 if ((args.index > 0) && (args.type != 'none')) { |
|
218 dataRecord.light_idx = dataRecord.light_state = dataRecord.light_delay = 0; |
|
219 $('#light_idx').val(0); |
|
220 $('#light_state').val(0); |
|
221 $('#light_delay').val(0); |
|
222 } |
|
223 } |
|
224 }); |
|
225 |
154 $('#heater_state,#cooler_state,#fan_state,#light_state').jqxNumberInput(Perc0); |
226 $('#heater_state,#cooler_state,#fan_state,#light_state').jqxNumberInput(Perc0); |
155 $('#heater_delay,#cooler_delay,#fan_delay,#light_delay').jqxNumberInput(Spin0dec); |
227 $('#heater_delay,#cooler_delay,#fan_delay,#light_delay').jqxNumberInput(Spin0dec); |
156 $('#pidh_p,#pidh_i,#pidh_d,#pidc_p,#pidc_i,#pidc_d').jqxNumberInput(Spin3dec); |
228 $('#pidh_p,#pidh_i,#pidh_d,#pidc_p,#pidc_i,#pidc_d').jqxNumberInput(Spin3dec); |
157 $('#pidh_imax,#pidc_imax').jqxNumberInput(Perc1dec); |
229 $('#pidh_imax,#pidc_imax').jqxNumberInput(Perc1dec); |
158 $('#pidh_idle,#pidc_idle').jqxNumberInput(Spin2dec); |
230 $('#pidh_idle,#pidc_idle').jqxNumberInput(Spin2dec); |
162 valueMember: 'uuid', |
234 valueMember: 'uuid', |
163 displayMember: 'name', |
235 displayMember: 'name', |
164 width: 240, |
236 width: 240, |
165 dropDownWidth: 480, |
237 dropDownWidth: 480, |
166 autoDropDownHeight: true |
238 autoDropDownHeight: true |
|
239 }); |
|
240 $('#door_address').on('select', function (event) { |
|
241 var args = event.args; |
|
242 if (args) { |
|
243 if ((args.index > 0) && (args.type != 'none')) { |
|
244 dataRecord.door_idx = 0; |
|
245 $('#door_idx').val(0); |
|
246 } |
|
247 } |
|
248 }); |
|
249 $('#psu_address').on('select', function (event) { |
|
250 var args = event.args; |
|
251 if (args) { |
|
252 if ((args.index > 0) && (args.type != 'none')) { |
|
253 dataRecord.psu_idx = 0; |
|
254 $('#psu_idx').val(0); |
|
255 } |
|
256 } |
167 }); |
257 }); |
168 $('#door_state,#psu_state').jqxNumberInput(Show0dec); |
258 $('#door_state,#psu_state').jqxNumberInput(Show0dec); |
169 |
259 |
170 // initialize jqxGrid |
260 // initialize jqxGrid |
171 $('#jqxgrid').jqxGrid({ |
261 $('#jqxgrid').jqxGrid({ |
321 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); |
411 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); |
322 $('#Save').click(function() { |
412 $('#Save').click(function() { |
323 var data, |
413 var data, |
324 row = { |
414 row = { |
325 uuid: dataRecord.uuid, |
415 uuid: dataRecord.uuid, |
326 // type: $('#dev_type').val(), |
416 alias: dataRecord.alias, |
327 // direction: $('#dev_direction').val(), |
417 mode: dataRecord.mode, |
328 // value: parseInt($('#dev_value').jqxNumberInput('decimal')), |
418 stage: dataRecord.stage, |
329 // offset: parseInt($('#dev_offset').jqxNumberInput('decimal')), |
419 pidh_p: parseFloat($('#pidh_p').jqxNumberInput('decimal')), |
330 // present: $('#dev_present').val(), |
420 pidh_i: parseFloat($('#pidh_i').jqxNumberInput('decimal')), |
331 // address: $('#dev_address').val(), |
421 pidh_d: parseFloat($('#pidh_d').jqxNumberInput('decimal')), |
332 // subdevice: parseInt($('#dev_subdevice').jqxNumberInput('decimal')), |
422 pidh_imax: parseFloat($('#pidh_imax').jqxNumberInput('decimal')), |
333 // gpiopin: parseInt($('#dev_gpiopin').jqxNumberInput('val')), |
423 pidh_idle: parseFloat($('#pidh_idle').jqxNumberInput('decimal')), |
334 // description: $('#dev_description').val(), |
424 pidc_p: parseFloat($('#pidc_p').jqxNumberInput('decimal')), |
335 // comment: $('#dev_comment').val() |
425 pidc_i: parseFloat($('#pidc_i').jqxNumberInput('decimal')), |
|
426 pidc_d: parseFloat($('#pidc_d').jqxNumberInput('decimal')), |
|
427 pidc_imax: parseFloat($('#pidc_imax').jqxNumberInput('decimal')), |
|
428 pidc_idle: parseFloat($('#pidc_idle').jqxNumberInput('decimal')) |
336 }; |
429 }; |
337 data = 'update=true&' + $.param(row); |
430 data = 'update=true&' + $.param(row); |
|
431 if ($('#air_address').val() != '') { |
|
432 var row = { |
|
433 air_address: $('#air_address').val(), |
|
434 air_idx: parseInt($('#air_idx').jqxNumberInput('decimal')) |
|
435 }; |
|
436 data += '&' + $.param(row); |
|
437 } |
|
438 if ($('#beer_address').val() != '') { |
|
439 var row = { |
|
440 beer_address: $('#beer_address').val(), |
|
441 beer_address2: $('#beer_address2').val(), |
|
442 beer_idx: parseInt($('#beer_idx').jqxNumberInput('decimal')) |
|
443 }; |
|
444 data += '&' + $.param(row); |
|
445 } |
|
446 if ($('#chiller_address').val() != '') { |
|
447 var row = { |
|
448 chiller_address: $('#chiller_address').val(), |
|
449 chiller_idx: parseInt($('#chiller_idx').jqxNumberInput('decimal')) |
|
450 }; |
|
451 data += '&' + $.param(row); |
|
452 } |
|
453 if ($('#heater_address').val() != '') { |
|
454 var row = { |
|
455 heater_address: $('#heater_address').val(), |
|
456 heater_idx: parseInt($('#heater_idx').jqxNumberInput('decimal')), |
|
457 heater_state: parseInt($('#heater_state').jqxNumberInput('decimal')), |
|
458 heater_delay: parseInt($('#heater_delay').jqxNumberInput('decimal')) |
|
459 }; |
|
460 data += '&' + $.param(row); |
|
461 } |
|
462 if ($('#cooler_address').val() != '') { |
|
463 var row = { |
|
464 cooler_address: $('#cooler_address').val(), |
|
465 cooler_idx: parseInt($('#cooler_idx').jqxNumberInput('decimal')), |
|
466 cooler_state: parseInt($('#cooler_state').jqxNumberInput('decimal')), |
|
467 cooler_delay: parseInt($('#cooler_delay').jqxNumberInput('decimal')) |
|
468 }; |
|
469 data += '&' + $.param(row); |
|
470 } |
|
471 if ($('#fan_address').val() != '') { |
|
472 var row = { |
|
473 fan_address: $('#fan_address').val(), |
|
474 fan_idx: parseInt($('#fan_idx').jqxNumberInput('decimal')), |
|
475 fan_state: parseInt($('#fan_state').jqxNumberInput('decimal')), |
|
476 fan_delay: parseInt($('#fan_delay').jqxNumberInput('decimal')) |
|
477 }; |
|
478 data += '&' + $.param(row); |
|
479 } |
|
480 if ($('#light_address').val() != '') { |
|
481 var row = { |
|
482 light_address: $('#light_address').val(), |
|
483 light_idx: parseInt($('#light_idx').jqxNumberInput('decimal')), |
|
484 light_state: parseInt($('#light_state').jqxNumberInput('decimal')), |
|
485 light_delay: parseInt($('#light_delay').jqxNumberInput('decimal')) |
|
486 }; |
|
487 data += '&' + $.param(row); |
|
488 } |
|
489 if ($('#door_address').val() != '') { |
|
490 var row = { |
|
491 door_address: $('#door_address').val(), |
|
492 door_idx: parseInt($('#door_idx').jqxNumberInput('decimal')) |
|
493 }; |
|
494 data += '&' + $.param(row); |
|
495 } |
|
496 if ($('#psu_address').val() != '') { |
|
497 var row = { |
|
498 psu_address: $('#psu_address').val(), |
|
499 psu_idx: parseInt($('#psu_idx').jqxNumberInput('decimal')) |
|
500 }; |
|
501 data += '&' + $.param(row); |
|
502 } |
|
503 |
338 console.log(data); |
504 console.log(data); |
339 $.ajax({ |
505 $.ajax({ |
340 dataType: 'json', |
506 dataType: 'json', |
341 url: url, |
507 url: url, |
342 cache: false, |
508 cache: false, |