| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
- <head>
 
-     <meta charset="UTF-8">
 
-     <title>{{ title }}</title>
 
-     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 
-     <meta http-equiv="refresh" content="300" /><!-- <meta http-equiv="refresh" content="5" />  每 content 秒網頁自動更新-->
 
-     <!-- 新 Bootstrap4 核心 CSS 文件 -->
 
-     <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
 
-     <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
 
-     <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
 
-     <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
 
-     <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
 
-     <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
 
-     <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
 
-     <!--可用來建立使用者小圖示-->
 
-     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
 
-     
 
-     <script language="JavaScript">
 
-         // 指定 秒 刷新網頁一次
 
-         var dtn = '{{tid}}';
 
-         var status = '{{status}}';
 
-         console.log('dtn:' + dtn)
 
-         $(function(){
 
-             $("#coffee_title_pc").text("D" + dtn + " 乾燥槽操作介面");
 
-             $("#coffee_title_phone").text("D" + dtn + " 操作介面");
 
-             $("#dry_tank_page").text('乾燥槽 D' + dtn + ' 攝影機畫面')
 
-             $('#dry_tank_page').attr("href", "/camera_D" + dtn)
 
-             $("#dry_container_tank_title").text('乾燥槽 D' + dtn + ' 操作介面')
 
-             if (status == 2) {
 
-                 $('input').prop('disabled', true);
 
-                 $('button').prop('disabled', true);
 
-             } else if ( (status == 0) || (status == 1) ) {
 
-                 $('input').prop('disabled', false);
 
-                 $('button').prop('disabled', false);   
 
-             }
 
-         });
 
-         // WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 30 * 1000)
 
-     </script>
 
-     <script>
 
-         // Rita 致動器運作
 
-         var tank_num = '{{tid}}';
 
-         function tankVacuum(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_vacuum_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_vacuum_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_vacuum_status]:checked");
 
-                 console.log('check:', check);
 
-                 //大於0代表有被選中
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-05").prop('checked', false);
 
-                     if (!confirm("你確定要開啟真空吸料機嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-05").prop('checked', true);
 
-                     if (!confirm("你確定要關閉真空吸料機嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_vacuum_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-05").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-05").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankThreeWayValveInput(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_input_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_input_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_threewayvalve_input_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-08").prop('checked', false);
 
-                     if (!confirm("你確定要開啟入料三通閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-08").prop('checked', true);
 
-                     if (!confirm("你確定要關閉入料三通閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_input_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-08").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-08").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankThreeWayValveBean(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_bean_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_bean_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_threewayvalve_bean_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-38").prop('checked', false);
 
-                     if (!confirm("你確定要開啟測豆三通閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-38").prop('checked', true);
 
-                     if (!confirm("你確定要關閉測豆三通閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_bean_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-38").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-38").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankDiskValve(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_diskvalve_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_diskvalve_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_diskvalve_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-11").prop('checked', false);
 
-                     if (!confirm("你確定要開啟蝴蝶閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-11").prop('checked', true);
 
-                     if (!confirm("你確定要關閉蝴蝶閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_diskvalve_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-11").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-11").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankSolenoidDisinfect(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_disinfect_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_disinfect_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_solenoid_disinfect_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-14").prop('checked', false);
 
-                     if (!confirm("你確定要開啟電磁閥消毒嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-14").prop('checked', true);
 
-                     if (!confirm("你確定要關閉消毒電磁閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_disinfect_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-14").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-14").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         
 
-         function tankSolenoidWater(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_water_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_water_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_solenoid_water_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-17").prop('checked', false);
 
-                     if (!confirm("你確定要開啟電磁閥排水嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-17").prop('checked', true);
 
-                     if (!confirm("你確定要關閉排水電磁閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_water_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-17").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-17").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankSolenoidOuterWaterIn(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "outer_solenoid_water_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "outer_solenoid_water_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_outer_solenoid_water_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-41").prop('checked', false);
 
-                     if (!confirm("你確定要開啟夾層進水電磁閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-41").prop('checked', true);
 
-                     if (!confirm("你確定要關閉夾層進水電磁閥嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "outer_solenoid_water_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-41").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-41").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         
 
-         // Benson cargo2_actuator.html 閥 (END) 電磁閥排水
 
-         /*
 
-         function Motor() {
 
-             $.get('/peeling', '', function (res) {
 
-                 //console.log(res.peeling);
 
-                 $("#motor_encoder_status").text(res.peeling + ' rpm(每1分鐘更新一次)');
 
-             }, 'json');
 
-         };
 
-         function ChangeMotor() {
 
-             var motor_data = $("input[name=tank_motor_status]").val();
 
-             if (!confirm("你確定要更改轉速為" + motor_data + "嗎?")) {
 
-                 return false;
 
-             };
 
-             var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": motor_data };
 
-             console.log('data:', data)
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 if (res == 'on') {
 
-                     alert('更改成功');
 
-                 } else {
 
-                     alert(res);
 
-                 };
 
-             }, 'text');
 
-             setTimeout(function(){ location.reload(); }, 500);
 
-         };
 
-         */
 
-        
 
-         function tankMotor_set() {
 
-             var motor_data = $("input[id=motor_rpm_data]").val();
 
-             if (motor_data == '') {
 
-                 alert("請先輸入要運轉的值!");
 
-                 return false;
 
-             } else if (motor_data == 0) {
 
-                 alert("轉速 0 為關閉馬達");
 
-             } else if (Number(motor_data) < -50 || Number(motor_data) > 50 || !Number(motor_data)) {
 
-                 alert("您輸入的值已超過範圍,請重新輸入! " + !Number(motor_data));
 
-                 return false;
 
-             };
 
-             if (motor_data != 0) {
 
-                 if (!confirm("你確定要開啟攪拌馬達,運轉速度為 " + motor_data + " RPM 嗎?")) {
 
-                     return false;
 
-                 };
 
-             } else {
 
-                 if (!confirm("你確定要關閉攪拌馬達嗎?")) {
 
-                     return false;
 
-                 };
 
-             };
 
-             var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": motor_data };
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     //$("#cmn-toggle-14").prop('checked', true);        // prop 設置元素屬型與元素值, 設定 checked 屬性為 true
 
-                     setTimeout("alert('攪拌馬達_開啟成功!')", 500);      // 設定時間 delay(500) 執行函式, 只執行一次
 
-                     var timer = setInterval(Rotate, 60000);             // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行
 
-                 } else if (res == 'off') {
 
-                     //$("#cmn-toggle-14").prop('checked', false);
 
-                     setTimeout("alert('攪拌馬達_關閉成功!')", 500);
 
-                     clearInterval(timer);                               // 取消 timer 的不斷執行
 
-                     $("#motor_encoder_status").text('');                // 設置 #motor_encoder_status 的文字為空, #井字號
 
-                 } else {
 
-                     alert(res);
 
-                 };
 
-             }, 'text')
 
-         };
 
-         function tankMotor(params) {
 
-             var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": params };
 
-             $.post('/mqtt/' + tank_num, data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
 
-                 } else if (res == 'off') {
 
-                     clearInterval(timer)
 
-                     $("#motor_encoder_status").text('');        // 設置 #motor_encoder_status 的文字為空, #井字號
 
-                     
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-             $.get('/loading/D' + tank_num, '', function (res) {
 
-                 $("#motor_rpm_data").attr("placeholder", res.tank_motor)
 
-             }, 'json');
 
-         };
 
-         function Rotate() {
 
-             $.get('/peel', '', function (res) {
 
-                 console.log("res.peeling: " + res.peeling);
 
-                 $("#motor_encoder_status").text(res.peeling + ' rpm<br>(每1分鐘更新一次)');
 
-             }, 'json');
 
-             setTimeout(function () { location.reload(); }, 500);
 
-         };
 
-         
 
-         function tankBlower(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_blower_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_blower_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_blower_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-23").prop('checked', false);
 
-                     if (!confirm("你確定要開啟鼓風機嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-23").prop('checked', true);
 
-                     if (!confirm("你確定要關閉鼓風機嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_blower_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-23").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-23").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         
 
-         function tankHeater1(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_heater1_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_heater1_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_heater1_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-26").prop('checked', false);
 
-                     if (!confirm("你確定要開啟電熱管1嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-26").prop('checked', true);
 
-                     if (!confirm("你確定要關閉電熱管1嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_heater1_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-26").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-26").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankHeater2(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_heater2_status", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_heater2_status", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_heater2_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-29").prop('checked', false);
 
-                     if (!confirm("你確定要開啟電熱管2嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-29").prop('checked', true);
 
-                     if (!confirm("你確定要關閉電熱管2嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "tank_heater2_status", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-29").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-29").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         function tankTemp1Enable(params) {
 
-             if (params == '1') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "temp1_enable", "value": "on" };
 
-             } else if (params == '0') {
 
-                 var data = { "tank_num": "D" + tank_num, "command": "temp1_enable", "value": "off" };
 
-             } else {
 
-                 var status = "off";
 
-                 var check = $("input[name=tank_temp1_enable_status]:checked");
 
-                 if (check.length > 0) {
 
-                     status = "on";
 
-                     $("#cmn-toggle-35").prop('checked', false);
 
-                     if (!confirm("你確定要開啟溫度控制嗎?")) {
 
-                         return false;
 
-                     };
 
-                 } else {
 
-                     $("#cmn-toggle-35").prop('checked', true);
 
-                     if (!confirm("你確定要關閉溫度控制嗎?")) {
 
-                         return false;
 
-                     };
 
-                 };
 
-                 var data = { "tank_num": "D" + tank_num, "command": "temp1_enable", "value": status };
 
-             }
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     $("#cmn-toggle-35").prop('checked', true);
 
-                 } else if (res == 'off') {
 
-                     $("#cmn-toggle-35").prop('checked', false);
 
-                 } else {
 
-                     console.log(res)
 
-                 };
 
-             }, 'text')
 
-         }
 
-         
 
-         /* 判斷是否整數
 
-         function isInteger(obj) {
 
-             return obj % 1 === 0
 
-         }
 
-         isInteger(3) // true
 
-         */
 
-         // 設定溫度
 
-         /*
 
-         <h2>溫度控制設定(單位 ℃):(目前設定溫度) {{tank_temp1}}</h2>
 
-             <input name="tank_temp1_data" type="text" placeholder="{{tank_temp1}}" style="width: 40px;">℃ (限整數數值)
 
-             <span id="tank_temp1_status" style="color:red;"></span>
 
-             <input type="button" value="送出(設定溫度時請點擊)" name="tank_temp1_status" onclick="ChangeTemp1()">
 
-         */
 
-         function tankTemp1_set() {
 
-             var temp_data = $("input[id=tank_temp1_data]").val();
 
-             if (temp_data == '') {
 
-                 alert("請先輸入設定溫度!");
 
-                 return false;
 
-             }
 
-             var value = "0";
 
-             if ($("#cmn-toggle-35").prop('checked')) {
 
-                 value = temp_data;
 
-                 if (!confirm("你確定要設定內桶溫度為 " + temp_data + " ℃ 嗎?")) {
 
-                     return false;
 
-                 };
 
-             } else {
 
-                 if (!confirm("請先開啟溫控開關, 再設定桶內溫度")) {
 
-                     return false;
 
-                 };
 
-             };
 
-             var data = { "tank_num": "D" + tank_num, "command": "tank_temp", "value": temp_data };
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-                 if (res == 'on') {
 
-                     setTimeout("alert('溫度設定_開啟成功!')", 500); // 設定時間執行函式 delay(500), 只執行一次
 
-                 } else if (res == 'off') {
 
-                     setTimeout("alert('溫度設定_關閉成功!')", 500);
 
-                 } else {
 
-                     alert(res);
 
-                 };
 
-             }, 'text')
 
-         };        
 
-         
 
-         function tankTemp1(params) {
 
-             var data = { "tank_num": "D" + tank_num, "command": "tank_temp", "value": params };
 
-             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                 console.log('data:', data)
 
-             }, 'text')
 
-         };
 
-     </script>
 
-     <script language="JavaScript">
 
-     
 
-         function changeUpdate() {
 
-             clearInterval(WebUpdate_set);
 
-             var webupdate_time = $("input[name=webupdate_time]").val()
 
-             console.log('webupdate_time' + webupdate_time)
 
-             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , webupdate_time * 1000);
 
-         }
 
-         // jQuery 更新感測器致動器狀態
 
-         function WebUpdate(dtn) {
 
-             $.get('/loading/D' + dtn, '', function (res) {
 
-                 if (res.tank_vacuum == 0) {
 
-                     $("#cmn-toggle-05").prop('checked', false);
 
-                 } else if (res.tank_vacuum == 1) {
 
-                     $("#cmn-toggle-05").prop('checked', true);
 
-                 }
 
-                 if (res.tank_threewayvalve_input == 0) {
 
-                     $("#cmn-toggle-08").prop('checked', false);
 
-                 } else if (res.tank_threewayvalve_input == 1) {
 
-                     $("#cmn-toggle-08").prop('checked', true);
 
-                 }
 
-                 if (res.tank_threewayvalve_bean == 0) {
 
-                     $("#cmn-toggle-38").prop('checked', false);
 
-                 } else if (res.tank_threewayvalve_bean == 1) {
 
-                     $("#cmn-toggle-38").prop('checked', true);
 
-                 }
 
-                 if (res.tank_diskvalve == 0) {
 
-                     $("#cmn-toggle-11").prop('checked', false);
 
-                 } else if (res.tank_diskvalve == 1) {
 
-                     $("#cmn-toggle-11").prop('checked', true);
 
-                 }
 
-                 if (res.tank_solenoid_disinfect == 0) {
 
-                     $("#cmn-toggle-14").prop('checked', false);
 
-                 } else if (res.tank_solenoid_disinfect == 1) {
 
-                     $("#cmn-toggle-14").prop('checked', true);
 
-                 }
 
-                 if (res.tank_solenoid_water == 0) {
 
-                     $("#cmn-toggle-17").prop('checked', false);
 
-                 } else if (res.tank_solenoid_water == 1) {
 
-                     $("#cmn-toggle-17").prop('checked', true);
 
-                 }
 
-                 if (res.tank_solenoid_outer_water == 0) {
 
-                     $("#cmn-toggle-41").prop('checked', false);
 
-                 } else if (res.tank_solenoid_outer_water == 1) {
 
-                     $("#cmn-toggle-41").prop('checked', true);
 
-                 }
 
-                 if (res.tank_blower == 0) {
 
-                     $("#cmn-toggle-23").prop('checked', false);
 
-                 } else if (res.tank_blower == 1) {
 
-                     $("#cmn-toggle-23").prop('checked', true);
 
-                 }
 
-                 if (res.tank_heater1 == 0) {
 
-                     $("#cmn-toggle-26").prop('checked', false);
 
-                 } else if (res.tank_heater1 == 1) {
 
-                     $("#cmn-toggle-26").prop('checked', true);
 
-                 }
 
-                 if (res.tank_heater2 == 0) {
 
-                     $("#cmn-toggle-29").prop('checked', false);
 
-                 } else if (res.tank_heater2 == 1) {
 
-                     $("#cmn-toggle-29").prop('checked', true);
 
-                 }
 
-                 if (res.tank_temp1_enable == 0) {
 
-                     $("#cmn-toggle-35").prop('checked', false);
 
-                 } else if (res.tank_temp1_enable == 1) {
 
-                     $("#cmn-toggle-35").prop('checked', true);
 
-                 }
 
-                 
 
-                 $("#motor_rpm_data").attr("placeholder", res.tank_motor);
 
-                 $("#tank_temp1_data").attr("placeholder", res.tank_temp1);
 
-                 $("#UltraSonic_t_status").text(res.UltraSonic);
 
-                 $("#SHT11_Temp_t_status").text(res.SHT11_Temp);
 
-                 $("#SHT11_Humidity_t_status").text(res.SHT11_Humidity);
 
-                 $("#soil_Temp_t_status").text(res.soil_Temp);
 
-                 $("#soil_Humidity_t_status").text(res.soil_Humidity);
 
-                 $("#soil_EC_t_status").text(res.soil_EC);
 
-                 $("#PA_t_status").text(res.PA);
 
-                 var present_SHT11_Temp = res.SHT11_Temp
 
-                 var present_SOIL_Temp = res.soil_Temp
 
-                 var Temp_Weights_SHT11 = parseFloat($("#Temp_Weights_SHT11").val());
 
-                 var Temp_Weights_Soil = parseFloat($("#Temp_Weights_Soil").val());
 
-                 present_temp = Math.round((present_SHT11_Temp*Temp_Weights_SHT11 + present_SOIL_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
 
-                                     
 
-                 $("#testing_Temp_Weight").text(present_temp);
 
-                 var float_SHT11_Temp = parseFloat(res.SHT11_Temp);
 
-             }, 'json');
 
-         }
 
-     </script>
 
- </head>
 
- <body>
 
-     <div id="wrapper">
 
-         <div id="coffee_header">
 
-             <!-- 匯入共同使用的 header.html 內容 -->
 
-             {% include 'header.html' %}
 
-         </div>
 
-         <h4>致動器</h4>    
 
-         <table border="1" class="table-all" cellpadding="5" style="text-align: center;">
 
-             <tr>
 
-                 <td style="color:red;">Valve</td>
 
-                 <td>真空吸料機</td>
 
-                 <td>吸料機<br>三通閥</td>
 
-                 <td>測豆<br>三通閥</td>
 
-                 <td>夾層進水<br>電磁閥</td>
 
-                 <td>馬達</td>
 
-                 <td>鼓風機</td>
 
-                 <td>加熱器 1</td>
 
-                 <td>加熱器 2</td>
 
-                 <td>溫控開關</td>
 
-                 <td>溫度設定</td>
 
-                 <td>排水<br>電磁閥</td>
 
-                 <td>消毒<br>電磁閥</td>
 
-                 <td>蝴蝶閥</td>
 
-             </tr>
 
-             <tr>
 
-                 <td>
 
-                     <span style="color:#C0C0C0;">off</span>
 
-                     <span style="color:#008CBA;">on</span>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-04">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_vacuum == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-05" checked
 
-                                 name="tank_vacuum_status" value="ON" onclick="tankVacuum()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-05"
 
-                                 name="tank_vacuum_status" value="OFF" onclick="tankVacuum()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-05"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-06">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-07">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_threewayvalve_input == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-08" checked
 
-                                 name="tank_threewayvalve_input_status" value="ON" onclick="tankThreeWayValveInput()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-08" 
 
-                                 name="tank_threewayvalve_input_status" value="OFF" onclick="tankThreeWayValveInput()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-08"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-09">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-37">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_threewayvalve_bean == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-38" checked
 
-                                 name="tank_threewayvalve_bean_status" value="ON" onclick="tankThreeWayValveBean()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-38" 
 
-                                 name="tank_threewayvalve_bean_status" value="OFF" onclick="tankThreeWayValveBean()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-38"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-39">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-40">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_solenoid_outer_water == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-41" checked
 
-                                 name="tank_outer_solenoid_water_status" value="ON" onclick="tankSolenoidOuterWaterIn()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-41" 
 
-                                 name="tank_outer_solenoid_water_status" value="OFF" onclick="tankSolenoidOuterWaterIn()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-41"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-42">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <input type="text" class="input-text" id="motor_rpm_data" placeholder="{{tank_motor}}" value="">RPM<br>
 
-                     <input type="button" class="input-button" value="Confirm" onclick="tankMotor_set()">
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-22">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_blower == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-23" checked
 
-                                 name="tank_blower_status" value="ON" onclick="tankBlower()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-23" 
 
-                                 name="tank_blower_status" value="OFF" onclick="tankBlower()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-23"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-24">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-25">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_heater1 == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-26" checked
 
-                                 name="tank_heater1_status" value="ON" onclick="tankHeater1()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-26" 
 
-                                 name="tank_heater1_status" value="OFF" onclick="tankHeater1()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-26"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-27">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-28">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_heater2== 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-29" checked
 
-                                 name="tank_heater2_status" value="ON" onclick="tankHeater2()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-29" 
 
-                                 name="tank_heater2_status" value="OFF" onclick="tankHeater2()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-29"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-30">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-34">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_temp1_enable== 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-35" checked
 
-                                 name="tank_temp1_enable_status" value="ON" onclick="tankTemp1Enable()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-35" 
 
-                                 name="tank_temp1_enable_status" value="OFF" onclick="tankTemp1Enable()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-35"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-36">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <input type="text" class="input-text" id="tank_temp1_data" placeholder="{{tank_temp1}}" value="">℃
 
-                     <br>
 
-                     <span id="tank_temp1_status" style="color:red;"></span>
 
-                     <input type="button" class="input-button" value="Confirm" onclick="tankTemp1_set()">
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-16">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_solenoid_water== 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-17" checked 
 
-                                 name="tank_solenoid_water_status" value="ON" onclick="tankSolenoidWater()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-17" 
 
-                                 name="tank_solenoid_water_status" value="OFF" onclick="tankSolenoidWater()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-17"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-18">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-13">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_solenoid_disinfect == 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-14" checked
 
-                                 name="tank_solenoid_disinfect_status" value="ON" onclick="tankSolenoidDisinfect()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-14" 
 
-                                 name="tank_solenoid_disinfect_status" value="OFF" onclick="tankSolenoidDisinfect()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-14"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-15">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-                 <td>
 
-                     <div class="switch_div">
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round" id="cmn-toggle-10">
 
-                         </div>
 
-                         <div class="switch text-center">
 
-                             {% if tank_diskvalve== 1 %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-11" checked
 
-                                 name="tank_diskvalve_status" value="ON" onclick="tankDiskValve()">
 
-                             {% else %}
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-round-flat" id="cmn-toggle-11" 
 
-                                 name="tank_diskvalve_status" value="OFF" onclick="tankDiskValve()">
 
-                             {% endif %}
 
-                             <label class="label_ActuatorStatus" for="cmn-toggle-11"></label>
 
-                         </div>
 
-                         <div class="switch">
 
-                             <input type="checkbox" class="cmn-toggle cmn-toggle-yes-no" id="cmn-toggle-12">
 
-                         </div>
 
-                     </div>
 
-                 </td>
 
-             </tr>
 
-             <tr>
 
-                 <td><span style="color:#008CBA;"><b>ON</b></span></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankVacuum('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankThreeWayValveInput('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankThreeWayValveBean('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankSolenoidOuterWaterIn('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="30" onclick="tankMotor('30')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankBlower('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankHeater1('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankHeater2('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankTemp1Enable('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="30.0" onclick="tankTemp1('30.0')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankSolenoidWater('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankSolenoidDisinfect('1')"></td>
 
-                 <td><input type="button" class="input-button-on" value="ON" onclick="tankDiskValve('1')"></td>
 
-             </tr>
 
-             <tr>
 
-                 <td><span style="color:#C0C0C0;"><b>OFF</b></span></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankVacuum('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankThreeWayValveInput('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankThreeWayValveBean('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankSolenoidOuterWaterIn('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="0" onclick="tankMotor('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankBlower('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankHeater1('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankHeater2('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankTemp1Enable('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="0.0" onclick="tankTemp1('0.0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankSolenoidWater('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankSolenoidDisinfect('0')"></td>
 
-                 <td><input type="button" class="input-button-off" value="OFF" onclick="tankDiskValve('0')"></td>
 
-             </tr>
 
-         </table>
 
-         <br>
 
-         <h4>感測器</h4>
 
-         <table border="1" class="table-all" cellpadding="5">
 
-             <tr>
 
-                 <td style="background-color:#f3f3f3">生豆高度</td>
 
-                 <td><span id="UltraSonic_t_status">{{tank_UltraSonic.UltraSonic}}</span> 公分</td>
 
-                 <td style="background-color:#f3f3f3">馬達編碼器</td>
 
-                 <!--  style="color:crimson; height: 25px; width: 40px; text-align: center; margin: 2px;"  -->
 
-                 <td><span id="motor_encoder_status"></span></td>
 
-             </tr>
 
-             <tr>
 
-                 <td style="background-color:#f3f3f3">桶內溫度</td>
 
-                 <td><span id="SHT11_Temp_t_status">{{tank_SHT11.SHT11_Temp}}</span> ℃</td>
 
-                 <td style="background-color:#f3f3f3">桶內濕度</td>
 
-                 <td><span id="SHT11_Humidity_t_status">{{tank_SHT11.SHT11_Humidity}}</span> %</td>
 
-                 <td style="background-color:#f3f3f3">桶內壓力</td>
 
-                 <td><span id="PA_t_status">{{tank_PA.PA}}</span> Pa</td>
 
-             </tr>
 
-             <tr>
 
-                 <td style="background-color:#f3f3f3">咖啡生豆溫度</td>
 
-                 <td><span id="soil_Temp_t_status">{{tank_Soil.soil_Temp}}</span> ℃</td>
 
-                 <td style="background-color:#f3f3f3">咖啡生豆濕度</td>
 
-                 <td><span id="soil_Humidity_t_status">{{tank_Soil.soil_Humidity}}</span> %</td>
 
-                 <td style="background-color:#f3f3f3">咖啡生豆 EC</td>
 
-                 <td><span id="soil_EC_t_status">{{tank_Soil.soil_EC}}</span> uS/cm</td>
 
-             </tr>
 
-         </table>
 
-         
 
-         <br>
 
-         <table border="1" class="table-all" cellpadding="5">
 
-             <tr>
 
-                 <td>
 
-                     溫度權重設定:
 
-                     桶內溫度 × 
 
-                     <input type="text" class="input-text" id="Temp_Weights_SHT11" value="1">
 
-                      + 咖啡生豆溫度 × 
 
-                     <input type="text" class="input-text" id="Temp_Weights_Soil" value="0">
 
-                 </td>
 
-                 <td>
 
-                     <strong>溫度[權重]:<span id="testing_Temp_Weight">計算中...</span></strong>
 
-                 </td>
 
-             </tr>
 
-         </table>
 
-         
 
-         <br>
 
-         <h4>排程設計</h4>
 
-         <table border="1" class="table-all" cellpadding="5">
 
-             <tr>
 
-                 <td>乾燥</td>
 
-                 <td>入料</td>
 
-                 <td>攪拌加熱</td>
 
-                 <td>消毒清洗</td>
 
-                 <td>循環測試</td>
 
-             </tr>
 
-             <tr>
 
-                 <td>
 
-                     -- 入料 --<br>
 
-                     指定生豆高度
 
-                     <input type="text" class="input-text" name="testing_BeanIn_Height_D" value="45">公分<br>
 
-                     吸料時間
 
-                     <input type="text" class="input-text" name="testing_in_vacuum_in_D" value="3">秒<br>
 
-                     放料時間(>10)
 
-                     <input type="text" class="input-text" name="testing_in_vacuum_out_D" value="5">秒<br>
 
-                     循環次數
 
-                     <input type="text" class="input-text" name="testing_in_vacuum_loop_D" value="3">次<br>
 
-                     -- 乾燥 --<br>
 
-                     馬達轉速
 
-                     <input type="text" class="input-text" name="testing_Heat_Motor_D" value="30">rpm<br>
 
-                     指定溫度
 
-                     <input type="text" class="input-text" name="testing_Heat_Temp_D" value="35">℃<br>
 
-                     指定濕度
 
-                     <input type="text" class="input-text" name="testing_Heat_Humidity_D" value="35">%<br>
 
-                     乾燥秒數
 
-                     <input type="text" class="input-text" name="testing_Heat_time_D" value="20">秒<br>               
 
-                     -- 出料 --<br>
 
-                     指定空桶高度
 
-                     <input type="text" class="input-text" name="testing_BeanEmpty_Height_D" value="10">公分<br>
 
-                     吸料時間
 
-                     <input type="text" class="input-text" name="testing_out_vacuum_in_D" value="3">秒<br>
 
-                     放料時間(>10)
 
-                     <input type="text" class="input-text" name="testing_out_vacuum_out_D" value="5">秒<br>
 
-                     循環次數
 
-                     <input type="text" class="input-text" name="testing_out_vacuum_loop_D" value="3">次<br>
 
-                 </td>
 
-                 <td>
 
-                     指定桶內生豆高度
 
-                     <input type="text" class="input-text" name="testing_BeanIn_Height" value="0">公分<br>
 
-                     吸料時間
 
-                     <input type="text" class="input-text" name="testing_in_vacuum_in" value="1">秒<br>
 
-                     放料時間
 
-                     <input type="text" class="input-text" name="testing_in_vacuum_out" value="10">秒<br>
 
-                     循環次數
 
-                     <input type="text" class="input-text" name="testing_in_vacuum_loop" value="3">次<br>
 
-                 </td>
 
-                 <td>
 
-                     馬達轉速
 
-                     <input type="text" class="input-text" name="testing_Heat_Motor" value="20">rpm<br>
 
-                     指定溫度
 
-                     <input type="text" class="input-text" name="testing_Heat_Temp" value="25">℃<br>
 
-                     指定濕度
 
-                     <input type="text" class="input-text" name="testing_Heat_Humidity" value="35">%<br>
 
-                     乾燥秒數
 
-                     <input type="text" class="input-text" name="testing_Heat_time" value="20">秒<br>
 
-                 </td>
 
-                 <td>
 
-                     排水電磁閥 OFF<br>
 
-                     馬達轉速
 
-                     <input type="text" class="input-text" id="testing_clean_motor" name="waiting_time_8" value="30">rpm<br>
 
-                     消毒噴灑時間
 
-                     <input type="text" class="input-text" id="testing_disinfect_time" value="30">秒<br>
 
-                     排水電磁閥 ON
 
-                 </td>
 
-                 <td>
 
-                     ON (開)
 
-                     <input type="text" class="input-text" name="Testing_starttime" value="5">秒<br>
 
-                     OFF (關)
 
-                     <input type="text" class="input-text" name="Testing_endtime" value="10">秒<br>
 
-                     循環
 
-                     <input type="text" class="input-text" name="Testing_loop" value="4">次
 
-                 </td>
 
-             <tr>
 
-                 <td>
 
-                     <button type="submit" class="btn btn-primary" onclick="F_tankDiskValve_ON()">發酵槽蝴蝶閥 ON</button><br>
 
-                     <button type="submit" class="btn btn-primary" onclick="F_tankDiskValve_OFF()">發酵槽蝴蝶閥 OFF</button><br>
 
-                     <button type="submit" class="btn btn-primary" onclick="testing_D()">乾燥排程測試</button>
 
-                     <script>
 
-                         function F_tankDiskValve_ON() {
 
-                             var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": "on" };
 
-                             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                                 console.log('data:', data)
 
-                             }, 'text')
 
-                         };
 
-                         function F_tankDiskValve_OFF() {
 
-                             var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": "off" };
 
-                             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                                 console.log('data:', data)
 
-                             }, 'text')
 
-                         };
 
-                         function testing_D() {
 
-                             clearInterval(WebUpdate_set);
 
-                             var BeanIn_D_Process = 0;   // 入豆
 
-                             var Heat_D_Process = 0;     // 乾燥
 
-                             var BeanOut_D_Process = 0;  // 出豆
 
-                             var BeanIn_D_interval;
 
-                             var Heat_D_interval;
 
-                             var BeanOut_D_interval;
 
-                             var testing_BeanIn_Height_D = $("input[name=testing_BeanIn_Height_D]").val();
 
-                             var testing_in_vacuum_in_D = $("input[name=testing_in_vacuum_in_D]").val();
 
-                             var testing_in_vacuum_out_D = $("input[name=testing_in_vacuum_out_D]").val();
 
-                             var testing_in_vacuum_loop_D = $("input[name=testing_in_vacuum_loop_D]").val();
 
-                             if (testing_BeanIn_Height_D != 0) {
 
-                                 console.log('以指定高度入豆')
 
-                                 BeanIn_D_interval = setInterval(BeanInHeight_D, 5000);
 
-                                 
 
-                             } else if (testing_BeanIn_Height_D == 0) {
 
-                                 console.log('以循環次數入豆')
 
-                                 for (step = 1; step <= testing_in_vacuum_loop_D; step++) {
 
-                                     console.log('-- 循環第 ' + step + ' 次 --');
 
-                                     // aaa tankVacuum('1')
 
-                                     console.log('tankVacuum_ON')
 
-                                     var time = new Date();
 
-                                     while ((new Date() - time) < testing_in_vacuum_in_D * 1000) { };
 
-                                     // aaa tankVacuum('0')
 
-                                     console.log('tankVacuum_OFF')
 
-                                     var time = new Date();
 
-                                     while ((new Date() - time) < testing_in_vacuum_out_D * 1000) { };
 
-                                 }
 
-                                 console.log('循環入豆結束')
 
-                                 var testing_Heat_Motor_D = $("input[name=testing_Heat_Motor_D]").val();
 
-                                 var testing_Heat_Temp_D = $("input[name=testing_Heat_Temp_D]").val();
 
-                                 var testing_Heat_Humidity_D = $("input[name=testing_Heat_Humidity_D]").val();
 
-                                 var testing_Heat_time_D = $("input[name=testing_Heat_time_D]").val();
 
-                                 console.log('指定馬達轉速: ' + testing_Heat_Motor_D)
 
-                                 console.log('指定溫度: ' + testing_Heat_Temp_D)
 
-                                 console.log('指定濕度: ' + testing_Heat_Humidity_D)
 
-                                 console.log('指定乾燥秒數: ' + testing_Heat_time_D)
 
-                                 $.get('/dry_SHT11_' + tank_num, '', function (res) {
 
-                                     present_temp = Math.round((res.SHT11_Temp*Temp_Weights_SHT11 + res.soil_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
 
-                                     if ( (present_temp < testing_Heat_Temp_D) || (res.SHT11_Humidity < testing_Heat_Humidity_D) ) {
 
-                                         // aaa tankHeater1('1')
 
-                                         console.log('tankHeater1_ON')
 
-                                         // aaa tankHeater2('1')
 
-                                         console.log('tankHeater2_ON')
 
-                                         // aaa tankBlower('1')
 
-                                         console.log('tankBlower_ON')
 
-                                     } 
 
-                                 }, 'json');
 
-                                 var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": testing_Heat_Motor_D };
 
-                                 $.post('/mqtt/{{tid}}', data, function (res) {
 
-                                     console.log('data:', data)
 
-                                 }, 'text')
 
-                                 console.log('Motor ' + testing_Heat_Motor_D)
 
-                                 Heat_D_interval = setInterval(Heater_D, 5000);
 
-                             }
 
-                             function BeanInHeight_D(){
 
-                                 if (BeanIn_D_Process == 1) {
 
-                                     return;
 
-                                 }
 
-                                 BeanIn_D_Process == 1;
 
-                                 $.ajax({
 
-                                     async:false,
 
-                                     type:"GET",
 
-                                     url:"/dry_UltraSonic_" + tank_num,
 
-                                     dataType:"json",
 
-                                     success:function(response){
 
-                                         var present_Bean_height = response.UltraSonic
 
-                                         console.log('目前生豆高度: ' + present_Bean_height)
 
-                                         if ( parseInt(present_Bean_height) < parseInt(testing_BeanIn_Height_D) ) {
 
-                                             // aaa tankVacuum('1')
 
-                                             console.log('tankVacuum_ON')
 
-                                             
 
-                                             var time = new Date();
 
-                                             while ((new Date() - time) < testing_in_vacuum_in_D * 1000) { };
 
-                                             // aaa tankVacuum('0')
 
-                                             console.log('tankVacuum_OFF')
 
-                                             var time = new Date();
 
-                                             while ((new Date() - time) < testing_in_vacuum_out_D * 1000) { };
 
-                                         } else {
 
-                                             clearInterval(BeanIn_D_interval)
 
-                                             console.log('生豆已達指定高度!')
 
-                                             var testing_Heat_Motor_D = $("input[name=testing_Heat_Motor_D]").val();
 
-                                             var testing_Heat_Temp_D = $("input[name=testing_Heat_Temp_D]").val();
 
-                                             var testing_Heat_Humidity_D = $("input[name=testing_Heat_Humidity_D]").val();
 
-                                             var testing_Heat_time_D = $("input[name=testing_Heat_time_D]").val();
 
-                                             console.log('指定馬達轉速: ' + testing_Heat_Motor_D)
 
-                                             console.log('指定溫度: ' + testing_Heat_Temp_D)
 
-                                             console.log('指定濕度: ' + testing_Heat_Humidity_D)
 
-                                             console.log('指定乾燥秒數: ' + testing_Heat_time_D)
 
-                                             $.get('/dry_SHT11_' + tank_num, '', function (res) {
 
-                                                 if ( (res.SHT11_Temp < testing_Heat_Temp_D) || (res.SHT11_Humidity < testing_Heat_Humidity_D) ) {
 
-                                                     // aaa tankHeater1('1')
 
-                                                     console.log('tankHeater1_ON')
 
-                                                     // aaa tankHeater2('1')
 
-                                                     console.log('tankHeater2_ON')
 
-                                                     // aaa tankBlower('1')
 
-                                                     console.log('tankBlower_ON')
 
-                                                     var time = new Date();
 
-                                                     while ((new Date() - time) < 5 * 1000) { };
 
-                                                 } 
 
-                                             }, 'json');
 
-                                             var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": testing_Heat_Motor_D };
 
-                                             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                                                 console.log('data:', data)
 
-                                             }, 'text')
 
-                                             console.log('Motor ' + testing_Heat_Motor_D)
 
-                                             var time = new Date();
 
-                                             while ((new Date() - time) < 5 * 1000) { };
 
-                                             Heat_D_interval = setInterval(Heater_D, 5000);
 
-                                         }
 
-                                         BeanIn_D_Process == 0;
 
-                                     },
 
-                                     error:function(thrownError){
 
-                                         console.log('Error: ' + thrownError)
 
-                                         BeanIn_D_Process = 0;
 
-                                     }
 
-                                 })
 
-                             };
 
-                             function Heater_D(){
 
-                                 if ( Heat_D_Process == 1 ) {
 
-                                     return;
 
-                                 }
 
-                                 Heat_D_Process = 1;
 
-                                 $.ajax({
 
-                                     async:false,
 
-                                     type:"GET",
 
-                                     url:"/dry_SHT11_" + tank_num,
 
-                                     dataType:"json",
 
-                                     success:function(response){
 
-                                         var present_Humidity = response.SHT11_Humidity
 
-                                         var testing_Heat_Temp_D = $("input[name=testing_Heat_Temp_D]").val();
 
-                                         var testing_Heat_Humidity_D = $("input[name=testing_Heat_Humidity_D]").val();
 
-                                         var testing_Heat_time_D = $("input[name=testing_Heat_time_D]").val();
 
-                                         present_temp = Math.round((res.SHT11_Temp*Temp_Weights_SHT11 + res.soil_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
 
-                                         if ( (present_Humidity > testing_Heat_Humidity_D) && (present_temp > testing_Heat_Temp_D) ) {
 
-                                             clearInterval(Heat_D_interval)
 
-                                             console.log("已達指定溫濕度, 乾燥 " + testing_Heat_time_D + " 秒")
 
-                                             
 
-                                             var time = new Date();
 
-                                             while ( (new Date() - time) < testing_Heat_time_D * 1000 ) { }
 
-                                             // aaa tankMotor('0')
 
-                                             console.log('tankMotor_OFF')
 
-                                             // aaa tankHeater1('0')
 
-                                             console.log('tankHeater1_OFF')
 
-                                             // aaa tankHeater2('0')
 
-                                             console.log('tankHeater2_OFF')
 
-                                             // aaa tankBlower('0')
 
-                                             console.log('tankBlower_OFF')
 
-                                             console.log('攪拌加熱完成!')
 
-                                             var testing_BeanEmpty_Height_D = $('input[name=testing_BeanEmpty_Height_D]').val();
 
-                                             var testing_out_vacuum_in_D = $('input[name=testing_out_vacuum_in_D]').val();
 
-                                             var testing_out_vacuum_out_D = $('input[name=testing_out_vacuum_out_D]').val();
 
-                                             var testing_out_vacuum_loop_D = $('input[name=testing_out_vacuum_loop_D]').val();
 
-                                             console.log('指定空桶高度: ' + testing_BeanEmpty_Height_D)
 
-                                             if (testing_BeanEmpty_Height_D != 0) {
 
-                                                 console.log('以空桶高度出豆')
 
-                                                 BeanOut_D_interval = setInterval(BeanOutHeight_D, 5000);
 
-                                             } else if (testing_BeanEmpty_Height == 0) {
 
-                                                 console.log('以循環方式出豆')
 
-                                                 for (step = 1; step <= testing_out_vacuum_loop; step++) {
 
-                                                     console.log('-- 循環第 ' + step + ' 次 --');
 
-                                                     tankVacuum('1')
 
-                                                     console.log('tankVacuum_ON')
 
-                                                     var time = new Date();
 
-                                                     while ((new Date() - time) < testing_out_vacuum_in_D * 1000) { };
 
-                                                     tankVacuum('0')
 
-                                                     console.log('tankVacuum_OFF')
 
-                                                     var time = new Date();
 
-                                                     while ((new Date() - time) < testing_out_vacuum_out_D * 1000) { };
 
-                                                 }
 
-                                                 console.log('循環出豆結束')
 
-                                             }
 
-                                         } else if ( parseInt(present_Humidity) > parseInt(testing_Heat_Humidity_D) ) {
 
-                                             console.log("已達指定濕度!")
 
-                                             
 
-                                         } else if ( parseInt(present_temp) > parseInt(testing_Heat_Temp_D) ){
 
-                                             console.log("已達指定溫度!")
 
-                                             
 
-                                         } else {
 
-                                             console.log('加熱中, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
 
-                                         }
 
-                                         Heat_D_Process = 0;
 
-                                     },
 
-                                     error:function(thrownError){
 
-                                         console.log('Error: ' + thrownError)
 
-                                         Heat_D_Process = 0;
 
-                                     }
 
-                                 })
 
-                             };
 
-                             function BeanOutHeight_D(){
 
-                                 if (BeanOut_D_Process == 1) {
 
-                                     return;
 
-                                 }
 
-                                 BeanOut_D_Process = 1;
 
-                                 $.ajax({
 
-                                     async:false,
 
-                                     type:"GET",
 
-                                     url:"/dry_UltraSonic_" + tank_num,
 
-                                     dataType:"json",
 
-                                     success:function(response){
 
-                                         var present_Bean_height = response.UltraSonic
 
-                                         console.log("目前豆高: " + present_Bean_height)
 
-                                         var testing_BeanEmpty_Height_D = $('input[name=testing_BeanEmpty_Height_D]').val();
 
-                                         var testing_out_vacuum_in_D = $('input[name=testing_out_vacuum_in_D]').val();
 
-                                         var testing_out_vacuum_out_D = $('input[name=testing_out_vacuum_out_D]').val();
 
-                                         var testing_out_vacuum_loop_D = $('input[name=testing_out_vacuum_loop_D]').val();
 
-                                         if ( parseInt(present_Bean_height) < parseInt(testing_BeanEmpty_Height_D) ) {
 
-                                             clearInterval(BeanOut_D_interval)
 
-                                             console.log("已達指定空桶高度!")
 
-                                         } else {
 
-                                             // aaa outputVacuum('1')
 
-                                             console.log('outputVacuum_ON')
 
-                                             var time = new Date()
 
-                                             while ( (new Date() - time) <  testing_out_vacuum_in_D * 1000) { }
 
-                                             // aaa outputVacuum('0')
 
-                                             console.log('outputVacuum_OFF')
 
-                                             var time = new Date()
 
-                                             while ( (new Date() - time) <  testing_out_vacuum_out_D * 1000) { }
 
-                                         }
 
-                                         BeanOut_D_Process = 0;
 
-                                     },
 
-                                     error:function(thrownError){
 
-                                         console.log("Error: " + thrownError)
 
-                                         BeanOut_D_Process = 0;
 
-                                     }
 
-                                 })
 
-                             };
 
-                             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
 
-                         }
 
-                     </script>
 
-                 </td>
 
-                 <td>
 
-                     <button type="submit" class="btn btn-primary" onclick="BeanInput()">入料測試</button>
 
-                     <script>
 
-                         var BeanIn_Process = 0;
 
-                         var BeanIn_interval;
 
-                         function BeanInput() {
 
-                             clearInterval(WebUpdate_set);
 
-                             var testing_BeanIn_Height = $("input[name=testing_BeanIn_Height]").val();
 
-                             var testing_in_vacuum_in = $("input[name=testing_in_vacuum_in]").val();
 
-                             var testing_in_vacuum_out = $("input[name=testing_in_vacuum_out]").val();
 
-                             var testing_in_vacuum_loop = $("input[name=testing_in_vacuum_loop]").val();
 
-                             if (testing_BeanIn_Height != 0) {
 
-                                 console.log('以指定高度入豆')
 
-                                 var BeanIn_interval = setInterval(BeanInHeight, 5000);
 
-                                 function BeanInHeight(){
 
-                                     if (BeanIn_Process == 1) {
 
-                                         return;
 
-                                     }
 
-                                     BeanIn_Process == 1;
 
-                                     $.ajax({
 
-                                         async:false,
 
-                                         type:"GET",
 
-                                         url:"/dry_UltraSonic_" + tank_num,
 
-                                         dataType:"json",
 
-                                         success:function(response){
 
-                                             var present_Bean_height = response.UltraSonic
 
-                                             console.log('目前生豆高度: ' + present_Bean_height)
 
-                                             if ( parseInt(present_Bean_height) < parseInt(testing_BeanIn_Height) ) {
 
-                                                 // aaa tankVacuum('1')
 
-                                                 console.log('tankVacuum_ON')
 
-                                                 
 
-                                                 var time = new Date();
 
-                                                 while ((new Date() - time) < testing_in_vacuum_in * 1000) { };
 
-                                                 // aaa tankVacuum('0')
 
-                                                 console.log('tankVacuum_OFF')
 
-                                                 var time = new Date();
 
-                                                 while ((new Date() - time) < testing_in_vacuum_out * 1000) { };
 
-                                             } else {
 
-                                                 clearInterval(BeanIn_interval)
 
-                                                 console.log('生豆已達指定高度!')
 
-                                             }
 
-                                             BeanIn_Process == 0;
 
-                                         },
 
-                                         error:function(thrownError){
 
-                                             console.log('Error: ' + thrownError)
 
-                                             BeanIn_Process = 0;
 
-                                         }
 
-                                     })
 
-                                 };
 
-                             } else if (testing_BeanIn_Height == 0) {
 
-                                 console.log('以循環次數入豆')
 
-                                 for (step = 1; step <= testing_in_vacuum_loop; step++) {
 
-                                     console.log('-- 循環第 ' + step + ' 次 --');
 
-                                     // aaa tankVacuum('1')
 
-                                     console.log('tankVacuum_ON')
 
-                                     var time = new Date();
 
-                                     while ((new Date() - time) < testing_in_vacuum_in * 1000) { };
 
-                                     // aaa tankVacuum('0')
 
-                                     console.log('tankVacuum_OFF')
 
-                                     var time = new Date();
 
-                                     while ((new Date() - time) < testing_in_vacuum_out * 1000) { };
 
-                                 }
 
-                                 console.log('循環入豆結束')
 
-                             }
 
-                             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
 
-                         }
 
-                     </script>
 
-                 </td>
 
-                 <td>
 
-                     <button type="submit" class="btn btn-primary" onclick="Heat()">攪拌加熱</button>
 
-                     <script>
 
-                         var Heat_Process = 0;
 
-                         function Heat(){
 
-                             clearInterval(WebUpdate_set);
 
-                             var testing_Heat_Motor = $("input[name=testing_Heat_Motor]").val();
 
-                             var testing_Heat_Temp = $("input[name=testing_Heat_Temp]").val();
 
-                             var testing_Heat_Humidity = $("input[name=testing_Heat_Humidity]").val();
 
-                             var testing_Heat_time = $("input[name=testing_Heat_time]").val();
 
-                             console.log('指定馬達轉速: ' + testing_Heat_Motor)
 
-                             console.log('指定溫度: ' + testing_Heat_Temp)
 
-                             console.log('指定濕度: ' + testing_Heat_Humidity)
 
-                             console.log('指定乾燥秒數: ' + testing_Heat_time)
 
-                             $.get('/dry_SHT11_' + tank_num, '', function (res) {
 
-                                 if ( (res.SHT11_Temp < testing_Heat_Temp) || (res.SHT11_Humidity < testing_Heat_Humidity) ) {
 
-                                     // aaa tankHeater1('1')
 
-                                     console.log('tankHeater1_ON')
 
-                                     // aaa tankHeater2('1')
 
-                                     console.log('tankHeater2_ON')
 
-                                     // aaa tankBlower('1')
 
-                                     console.log('tankBlower_ON')
 
-                                 } 
 
-                             }, 'json');
 
-                             var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": testing_Heat_Motor };
 
-                             $.post('/mqtt/{{tid}}', data, function (res) {
 
-                                 console.log('data:', data)
 
-                             }, 'text')
 
-                             console.log('Motor ' + testing_Heat_Motor)
 
-                             var Heat_interval = setInterval(Heater, 5000);
 
-                             function Heater(){
 
-                                 var Temp_Weights_SHT11 = parseFloat($("#Temp_Weights_SHT11").val());
 
-                                 var Temp_Weights_Soil = parseFloat($("#Temp_Weights_Soil").val());
 
-                                 if ( Heat_Process == 1 ) {
 
-                                     return;
 
-                                 }
 
-                                 Heat_Process = 1;
 
-                                 $.ajax({
 
-                                     async:false,
 
-                                     type:"GET",
 
-                                     url:"/dry_SHT11_" + tank_num,
 
-                                     dataType:"json",
 
-                                     success:function(response){
 
-                                         var present_temp = Math.round((response.SHT11_Temp*Temp_Weights_SHT11 + response.Soil_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
 
-                                         var present_Humidity = response.SHT11_Humidity
 
-                                         if ( (present_Humidity > testing_Heat_Humidity) &&
 
-                                         (present_temp > testing_Heat_Temp) ) {
 
-                                             console.log("已達指定溫濕度, 乾燥 " + testing_Heat_time + " 秒")
 
-                                             clearInterval(Heat_interval)
 
-                                             
 
-                                             var time = new Date();
 
-                                             while ( (new Date() - time) < testing_Heat_time * 1000 ) { }
 
-                                             // aaa tankMotor('0')
 
-                                             console.log('tankMotor_OFF')
 
-                                             // aaa tankHeater1('0')
 
-                                             console.log('tankHeater1_OFF')
 
-                                             // aaa tankHeater2('0')
 
-                                             console.log('tankHeater2_OFF')
 
-                                             // aaa tankBlower('0')
 
-                                             console.log('tankBlower_OFF')
 
-                                             console.log('攪拌加熱完成!')
 
-                                             
 
-                                         } else if ( present_Humidity > testing_Heat_Humidity ) {
 
-                                             console.log('已達指定濕度, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
 
-                                             
 
-                                         } else if ( present_temp > testing_Heat_Temp ) {
 
-                                             console.log('已達指定溫度, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
 
-                                             
 
-                                         } else {
 
-                                             console.log('加熱中, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
 
-                                         }
 
-                                         Heat_Process = 0;
 
-                                     },
 
-                                     error:function(thrownError){
 
-                                         console.log('Error: ' + thrownError)
 
-                                         Heat_Process = 0;
 
-                                     }
 
-                                 })
 
-                             };
 
-                             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
 
-                         };
 
-                     </script>
 
-                 </td>
 
-                 <td>
 
-                     <button type="submit" class="btn btn-primary" onclick="disinfectTest()">消毒清洗測試</button>
 
-                     <script>
 
-                         function disinfectTest(){
 
-                             var testing_clean_motor = $('#testing_clean_motor').val();
 
-                             var testing_disinfect_time = parseInt($('#testing_disinfect_time').val());
 
-                             tankMotor(testing_clean_motor)
 
-                             var time = new Date();
 
-                             while ((new Date() - time) < 1 * 1000) { }
 
-                             // aaa tankSolenoidDisinfect('1')
 
-                             console.log('tankSolenoidDisinfect_ON')
 
-                             
 
-                             var time = new Date();
 
-                             while ((new Date() - time) < testing_disinfect_time * 1000) { }
 
-                             // aaa tankSolenoidDisinfect('0')
 
-                             console.log('tankSolenoidDisinfect_OFF')
 
-                             tankMotor('0')
 
-                             var time = new Date();
 
-                             while ((new Date() - time) < 1 * 1000) { }
 
-                         };
 
-                     </script>
 
-                     
 
-                 </td>
 
-                 <td>
 
-                     <button type="submit" class="btn btn-primary" onclick="diskValveTest()">蝴蝶閥測試(秒)</button><br>
 
-                     <button type="submit" class="btn btn-primary" onclick="tankVacuumTest()">真空吸料機測試(秒)</button><br>
 
-                     <button type="submit" class="btn btn-primary" onclick="threewayvalveTest()">三通閥測試(秒)</button>
 
-                     <script>
 
-                         function threewayvalveTest() {
 
-                             clearInterval(WebUpdate_set);
 
-                             var Testing_starttime = $("input[name=Testing_starttime]").val();
 
-                             var Testing_endtime = $("input[name=Testing_endtime]").val();
 
-                             var Testing_loop = $("input[name=Testing_loop]").val();
 
-                             alert('測試間隔' + Testing_starttime + ':' + Testing_endtime + ' 次數' + Testing_loop)
 
-                             var step;
 
-                             for (step = 1; step <= Testing_loop; step++) {
 
-                                 console.log('循環第 ' + step + ' 次');
 
-                                 tankThreeWayValveInput('1')
 
-                                 console.log('tankThreeWayValveInput_ON')
 
-                                 var time = new Date();
 
-                                 while ((new Date() - time) < Testing_starttime * 1000) { }
 
-                                 tankThreeWayValveInput('0')
 
-                                 console.log('tankThreeWayValveInput_OFF')
 
-                                 var time = new Date();
 
-                                 while ((new Date() - time) < Testing_endtime * 1000) { }
 
-                             }
 
-                             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
 
-                         }
 
-                     </script>
 
-                     <script>
 
-                         function tankVacuumTest() {
 
-                             clearInterval(WebUpdate_set);
 
-                             var Testing_starttime = $("input[name=Testing_starttime]").val();
 
-                             var Testing_endtime = $("input[name=Testing_endtime]").val();
 
-                             var Testing_loop = $("input[name=Testing_loop]").val();
 
-                             alert('測試間隔' + Testing_starttime + ':' + Testing_endtime + ' 次數' + Testing_loop)
 
-                             var step;
 
-                             for (step = 1; step <= Testing_loop; step++) {
 
-                                 console.log('循環第 ' + step + ' 次');
 
-                                 tankVacuum('1')
 
-                                 console.log('tankVacuum_ON')
 
-                                 var time = new Date();
 
-                                 while ((new Date() - time) < Testing_starttime * 1000) { }
 
-                                 tankVacuum('0')
 
-                                 console.log('tankVacuum_OFF')
 
-                                 var time = new Date();
 
-                                 while ((new Date() - time) < Testing_endtime * 1000) { }
 
-                             }
 
-                             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
 
-                         }
 
-                     </script>
 
-                     <script>
 
-                         function diskValveTest() {
 
-                             clearInterval(WebUpdate_set);
 
-                             var Testing_starttime = $("input[name=Testing_starttime]").val();
 
-                             var Testing_endtime = $("input[name=Testing_endtime]").val();
 
-                             var Testing_loop = $("input[name=Testing_loop]").val();
 
-                             alert('測試間隔' + Testing_starttime + ':' + Testing_endtime + ' 次數' + Testing_loop)
 
-                             var step;
 
-                             for (step = 1; step <= Testing_loop; step++) {
 
-                                 console.log('循環第 ' + step + ' 次');
 
-                                 tankDiskValve('1')
 
-                                 console.log('tankDiskValve_ON')
 
-                                 var time = new Date();
 
-                                 while ((new Date() - time) < Testing_starttime * 1000) { }
 
-                                 tankDiskValve('0')
 
-                                 console.log('tankDiskValve_OFF')
 
-                                 var time = new Date();
 
-                                 while ((new Date() - time) < Testing_endtime * 1000) { }
 
-                             }
 
-                             WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
 
-                         }
 
-                     </script>
 
-                 </td>
 
-             </tr>
 
-         </table>
 
-     
 
-         <div id="coffee_footer">
 
-             <!-- 匯入共同使用的 footer.html 內容 -->
 
-             {% include 'footer.html' %}
 
-         </div>
 
-     </div>
 
- </body>
 
- </html>
 
 
  |