-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitor_simple.html
1203 lines (1111 loc) · 32.1 KB
/
monitor_simple.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="stylesheet" href="./assets/w3.css"> -->
<!-- <link rel="shortcut icon" href="./assets/favicon.ico" type="image/x-icon"> -->
<!-- https://developer.mozilla.org/en-US/docs/Web/CSS/white-space-->
<style>
:root {
--color_me: #55BBFF;
--color_ro: #FF6677;
}
body {background-color: rgb(0, 0, 0);}
input {background-color: rgb(0, 0, 0);}
input {color: white;}
input {border: 2px solid powderblue;}
pre {border: 2px solid powderblue;}
button {background-color: gray;}
button {color: white;}
button:focus {
outline: none;
box-shadow: none;
}
h1 {color: white;}
p {color: chartreuse;}
label{color: white;}
label{font-size: small;}
pre {
display: block;
white-space: break-spaces;
font-family: 'Courier New', Courier, monospace;
}
object {
font-size: small;
color:red;
background-color: gray;
border: 2px solid powderblue;
font-family:Tahoma;
font-size:20;
}
/* #timer {
font-size: 20pt;
font-weight: 100;
color: rgb(24, 147, 149);
padding: 20px;
width: 200px;
color: rgb(251, 9, 9);
} */
</style>
<title>Motor control!</title>
</head>
<body>
<!-- WS address box -->
<label for="fname">addr:</label>
<input type="text" id="ws_address_box" name="ws_adress" value="ws://192.168.1.32:9000/ws"
style="width: 180px"><button id="connect">Connect</button>
<label id="status" style="font-weight: bold;">Status:</label><br>
<!-- Message response box -->
<pre id="messages" style="width: 99%; margin-left: 1%; height: 280px; overflow: scroll"></pre>
<!-- Command box -->
<input type="text" id="command_box" placeholder="place a command line" style="width: 80%; margin-left: 2%"></input>
<!--<input type="text" id="command_box" placeholder="place a command line"
style="display: block; width: 80%; margin-bottom: 10px; margin-left: 5%; padding: 10px;"></input>-->
<button id="send" title="Send command" style="width:47px" >Send</button><br><br>
<!-- <button id="send" title="Send command" style="width: 10%; margin-left: 5%; height: 30px;">Send</button><br><br> -->
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>-->
<!-- Tab links -->
<!-- <div class="tab">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#clock">Clock</a></li>
<li> <a data-toggle="tab" href="sensors">Sensors</a></li>
<li> <a data-toggle="tab" href="motor">Motor</a></li>
<li> <a data-toggle="tab" href="valves">Valves</a></li>
<li> <a data-toggle="tab" href="config">Config</a></li>
</ul>
<div class="tab-content">
<div id="clock" class="tab-pane fade in active">
</div>
<div id="sensors" class="tab-pane fade">
<h3>not implemented</h3>
<p>nothing implemented yed :/</p>
</div>
<div id="motor" class="tab-pane fade">
</div>
<div id="valves" class="tab-pane fade">
<h3>not implemented</h3>
<p>nothing implemented yed :/</p>
</div>
<div id="config" class="tab-pane fade">
<h3>not implemented</h3>
<p>nothing implemented yed :/</p>
</div>
</div>
</div> -->
<!-- Real time variables -->
<label for="fname">P1: </label>
<label id="rt_pressure1" style="font-family:courier; font-size:20pt;color:chocolate">___</label>
<label for="fname" style="font-family:courier; font-size:10pt;">m.c.a. </label>
<label for="fname">P2: </label>
<label id="rt_pressure2" style="font-family:courier; font-size:20pt;color:blueviolet">___</label>
<label for="fname" style="font-family:courier; font-size:10pt;">m.c.a. </label>
<label for="fname">t_on: </label><label id="rt_time_on" style="font-family:courier;
font-size:15pt;color:darkcyan">___</label>
<label for="fname">t_off: </label><label id="rt_time_off" style="font-family:courier;
font-size:15pt;color:darkcyan">___</label>
<label for="fname">K1: </label><label id="rt_k1" style="font-family:courier;
font-size:15pt;color:darkcyan">___</label>
<label for="fname">K2: </label><label id="rt_k2" style="font-family:courier;
font-size:15pt;color:darkcyan">___</label>
<label for="fname">K3: </label><label id="rt_k3" style="font-family:courier;
font-size:15pt;color:darkcyan">___</label>
<label for="fname">Rth: </label><label id="rt_rth" style="font-family:courier;
font-size:15pt;color:darkcyan">___</label>
<br><br>
<!-- System date time block -->
<label for="fname">System date time</label><br>
<!-- <button id="cmd_00">Horários/estado</button> -->
<!-- <button id="cmd_1h">Set time</button> -->
<!-- <button id="cmd_1d">Set date</button> -->
<!-- <button id="cmd_1h1d">Set datetime</button> -->
<button id="cmd_00x">auto refresh</button>
<label for="fname"> | </label>
<br><br>
<script>
// Control buttons
const btn_00 = document.querySelector('#cmd_00');
const btn_00x = document.querySelector('#cmd_00x');
const btn_01 = document.querySelector('#cmd_01');
const btn_02 = document.querySelector('#cmd_02');
const btn_02s = document.querySelector('#cmd_02s');
const btn_02f = document.querySelector('#cmd_02f');
const btn_03 = document.querySelector('#cmd_03');
const btn_07 = document.querySelector('#cmd_07');
const btn_30 = document.querySelector('#cmd_30');
const btn_31 = document.querySelector('#cmd_31');
const btn_32 = document.querySelector('#cmd_32');
const btn_33 = document.querySelector('#cmd_33');
const btn_34 = document.querySelector('#cmd_34');
const btn_35 = document.querySelector('#cmd_35');
const btn_36 = document.querySelector('#cmd_36');
const btn_1h = document.querySelector('#cmd_1h');
const btn_1d = document.querySelector('#cmd_1d');
const btn_1h1d = document.querySelector('#cmd_1h1d');
const btn_70l1_1 = document.querySelector('#cmd_70l1_1');
const btn_70l1_0 = document.querySelector('#cmd_70l1_0');
const btn_70l1 = document.querySelector('#cmd_70l1');
const btn_70l2_1 = document.querySelector('#cmd_70l2_1');
const btn_70l2_0 = document.querySelector('#cmd_70l2_0');
const btn_70l2 = document.querySelector('#cmd_70l2');
const btn_70l4_1 = document.querySelector('#cmd_70l4_1');
const btn_70l4_0 = document.querySelector('#cmd_70l4_0');
const btn_70l4 = document.querySelector('#cmd_70l4');
const btn_70pl_1 = document.querySelector('#cmd_70pl_1');
const btn_70pl_0 = document.querySelector('#cmd_70pl_0');
const btn_70ph = document.querySelector('#cmd_70ph');
const btn_80 = document.querySelector('#cmd_80');
const btn_80s0 = document.querySelector('#cmd_80s0');
const btn_80s1 = document.querySelector('#cmd_80s1');
const btn_80d0 = document.querySelector('#cmd_80d0');
const btn_80d1 = document.querySelector('#cmd_80d1');
const btn_80h = document.querySelector('#cmd_80h');
const btn_80n = document.querySelector('#cmd_80n');
const btn_80vnn = document.querySelector('#cmd_80vnn');
const btn_80vnn1 = document.querySelector('#cmd_80vnn1');
const btn_80vnn0 = document.querySelector('#cmd_80vnn0');
const btn_80vnni = document.querySelector('#cmd_80vnni');
const btn_80vnnr = document.querySelector('#cmd_80vnnr');
const btn_80vnnt = document.querySelector('#cmd_80vnnt');
const btn_80vnnp = document.querySelector('#cmd_80vnnp');
const btn_84 = document.querySelector('#cmd_84');
const btn_85 = document.querySelector('#cmd_85');
const btn_86d = document.querySelector('#cmd_86d');
const btn_86i = document.querySelector('#cmd_86i');
const btn_86p = document.querySelector('#cmd_86p');
const btn_86u = document.querySelector('#cmd_86u');
const btn_86t = document.querySelector('#cmd_86t');
const btn_86v = document.querySelector('#cmd_86v');
const btn_88 = document.querySelector('#cmd_88');
const btn_89 = document.querySelector('#cmd_89');
const btn_90_0 = document.querySelector('#cmd_90_0');
const btn_90_1 = document.querySelector('#cmd_90_1');
const btn_90_2 = document.querySelector('#cmd_90_2');
const btn_91 = document.querySelector('#cmd_91');
const btn_95_0 = document.querySelector("#cmd_95_0");
const btn_95_1 = document.querySelector("#cmd_95_1");
const btn_95_2 = document.querySelector("#cmd_95_2");
const btn_95_3 = document.querySelector("#cmd_95_3");
const btn_95_4 = document.querySelector("#cmd_95_4");
const btn_95_8 = document.querySelector("#cmd_95_8");
const btn_95_9 = document.querySelector("#cmd_95_9");
const btn_97 = document.querySelector("#cmd_97");
const btn_98 = document.querySelector("#cmd_98");
const btn_99 = document.querySelector("#cmd_99");
const btn_5 = document.querySelector("#cmd_5");
const btn_51 = document.querySelector("#cmd_51");
const btn_50 = document.querySelector("#cmd_50");
const btn_5nx = document.querySelector("#cmd_5nx");
const btn_5hx = document.querySelector("#cmd_5hx");
const btn_5tx = document.querySelector("#cmd_5tx");
const btn_5m1 = document.querySelector("#cmd_5m1");
const btn_5m2 = document.querySelector("#cmd_5m2");
const btn_5m6 = document.querySelector("#cmd_5m6");
const btn_7tm0 = document.querySelector("#cmd_7tm0");
// var ws_address_box = document.getElementById("ws_address")
// var command_box_id = document.getElementById("command_box");
const ws_address_box = document.querySelector("#ws_address_box");
const command_box = document.querySelector('#command_box');
const btn_send = document.querySelector('#send');
const btn_connect = document.getElementById("connect");
const messages = document.querySelector('#messages');
const valve_number = document.querySelector('#valve_number');
const time_match_n = document.querySelector('#time_match_n');
// const time_match_index = document.querySelector('#time_match_index');
const time_match_hour = document.querySelector('#time_match_hour');
const time_match_min = document.querySelector('#time_match_min');
const valve_time = document.querySelector('#valve_time');
const valve_pressure = document.querySelector('#valve_pressure');
const motor_time_elapsed = document.querySelector("#motor_time_elapsed");
var ws_state;
var ws = null;
var command_str;
// var real_time_state;
var data_json;
// defines the console colors
const color_me = getComputedStyle(document.documentElement).getPropertyValue('--color_me');
const color_ro = getComputedStyle(document.documentElement).getPropertyValue('--color_ro');
// function to put any message into scroll box with some color
function message_to_box(msg, color)
{
document.querySelector('#messages').innerHTML += `\n<font color='${color}'>${msg}</font>`;
messages.scrollTop = messages.scrollHeight;
}
// put message int real time pressure box
// function message_to_box_rt(msg)
// {
// let str = String(msg) + "";
// document.getElementById('rt_pressure1').innerHTML = str;
// }
// convert seconds to seconds
timesec_to_sec = (seconds) => {
let sec = parseInt((seconds%3600)%60);
return (sec);
}
// convert seconds to minutes
timesec_to_min = (seconds) => {
let min = parseInt((seconds%3600)/60);
return min;
}
// convert seconds to hours
timesec_to_hour = (seconds) => {
return parseInt((seconds%(60*60*24))/3600);
}
// function to get json data and put into the dash board
message_to_dashboard = (msg) => {
document.getElementById('rt_pressure1').innerHTML = String(msg.p1);
document.getElementById('rt_pressure2').innerHTML = String(msg.p2);
let time_on = String(timesec_to_hour(msg.ton)).padStart(2,'0') + ":" + String(timesec_to_min(msg.ton)).padStart(2,'0') + ":" + String(timesec_to_sec(msg.ton)).padStart(2,'0');
let time_off = String(timesec_to_hour(msg.toff)).padStart(2,'0') + ":" + String(timesec_to_min(msg.toff)).padStart(2,'0') + ":" + String(timesec_to_sec(msg.toff)).padStart(2,'0');
document.getElementById('rt_time_on').innerHTML = time_on;
document.getElementById('rt_time_off').innerHTML = time_off;
document.getElementById('rt_k1').innerHTML = String(msg.k1);
document.getElementById('rt_k2').innerHTML = String(msg.k2);
document.getElementById('rt_k3').innerHTML = String(msg.k3);
document.getElementById('rt_rth').innerHTML = String(msg.rth);
}
// --- WebSocket functions ---
function ws_on_open() {
document.getElementById("status").innerHTML = "Connected!";
document.getElementById("connect").innerHTML = "Disconnect";
document.getElementById('status').style.color = "#00FF00";
document.querySelector('#send').disable = false;
ws_state = 1;
message_to_box(`Opened connection at ${get_datetime()}`, "white");
console.log("Connected to server " + ws_address_box.value);
}
function ws_on_close() {
document.getElementById("status").innerHTML = "Disconnected";
document.getElementById('status').style.color = 'red';
document.getElementById("connect").innerHTML = "Connect";
message_to_box(`Closed connection at ${get_datetime()}`, "white");
console.log("Disconnected to the server");
ws_state = 0;
}
// get system time
get_datetime = () => {
let datetime = new Date();
return datetime;
}
// date time to string convert
function time_to_string (_datetime)
{
let str = String(_datetime.getHours()).padStart(2,'0') +
String(_datetime.getMinutes()).padStart(2,'0') +
String(_datetime.getSeconds()).padStart(2,'0');
return str
}
date_to_string = (_datetime) => {
let str = String(_datetime.getDate()).padStart(2,'0') +
String(_datetime.getMonth()+1).padStart(2,'0') +
String(_datetime.getFullYear()).padStart(4,'0');
return str
}
// Send command_str by pressing ENTER key from command box
command_box.addEventListener("keypress", ev => {
if(ev.keyCode === 13) {
ev.preventDefault();
btn_send.click();
console.log("Enter pressed on command box");
}
});
ws_address_box.addEventListener("keypress", ev => {
if(ev.keyCode === 13) {
ev.preventDefault();
btn_connect.click();
console.log("Enter pressed on addr box")
}
});
// websocket client connection
function connect(addr) {
ws = new WebSocket(addr);
ws.onopen = () => {
ws_on_open();
}
ws.onmessage = ev => {
// ws_on_message(ev);
try {
data_json = JSON.parse(ev.data);
// console.log(data_json);
message_to_dashboard(data_json);
// real_time_state = 1;
console.log(data_json);
}
catch(e) {
message_to_box(ev.data, color_ro);
console.log(e);
}
}
ws.onerror = error => {
// alert(`[Error] ${error.message}`);
}
ws.onclose = () => {
ws = null;
ws_on_close();
// console.log("on close event");
}
}
// Click function to connect button (event)
btn_connect.onclick = () => {
if(ws) {
if(ws.readyState === WebSocket.OPEN) // Close the connection, if it's open.
{
ws.close();
console.log("disconnected!");
}
} else {
connect(ws_address_box.value);
document.getElementById("connect").innerHTML = "connecting...";
}
}
btn_send.onclick = function() {
// Click function to operation buttons
if((ws_state === 1) && (command_box.value != ""))
{
ws.send(command_box.value);
message_to_box(`ME: ${command_box.value}`, color_me);
command_box.value = ''; // clear command box.
}
}
btn_00.onclick = () => {
if(ws_state === 1)
{
command_str = "$00;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_01.onclick = () => {
if(ws_state === 1)
{
command_str = "$01;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_00x.onclick = () => {
if(ws_state === 1)
{
command_str = "$00:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_02.onclick = () => {
if(ws_state === 1)
{
command_str = "$02;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_02s.onclick = () => {
if(ws_state === 1)
{
command_str = "$02:s:" + String(motor_time_elapsed.value).padStart(3,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_02f.onclick = () => {
if(ws_state === 1)
{
command_str = "$02:f:" + String(motor_time_elapsed.value).padStart(3,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_03.onclick = () => {
if(ws_state === 1)
{
command_str = "$03;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_07.onclick = () => {
if(ws_state === 1)
{
command_str = "$07;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_1h.onclick = () => {
if(ws_state === 1)
{
command_str = "$10:h:" + time_to_string(get_datetime()) + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_1d.onclick = () => {
if(ws_state === 1)
{
command_str = "$10:d:" + date_to_string(get_datetime()) + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_1h1d.onclick = () => {
if(ws_state === 1)
{
setTimeout( function () {
command_str = "$10:h:" + time_to_string(get_datetime()) + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);}, 1000);
command_str = "$10:d:" + date_to_string(get_datetime()) + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_30.onclick = () => {
if(ws_state === 1)
{
command_str = "$30;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_31.onclick = () => {
if(ws_state === 1)
{
var command_str = "$31;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_32.onclick = () => {
if(ws_state === 1)
{
var command_str = "$32;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_33.onclick = () => {
if(ws_state === 1)
{
command_str = "$33;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_34.onclick = () => {
if(ws_state === 1)
{
command_str = "$34;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_35.onclick = () => {
if(ws_state === 1)
{
command_str = "$35;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_36.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$36;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_51.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_50.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5nx.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:n:" + String(time_match_n.value).padStart(1,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5m1.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:m" + String(time_match_n.value).padStart(1,'0') + ":1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5m2.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:m" + String(time_match_n.value).padStart(1,'0') + ":2;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5m6.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:m" + String(time_match_n.value).padStart(1,'0') + ":6;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5hx.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:h" + String(time_match_n.value).padStart(1,'0') + ":" + String(time_match_hour.value).padStart(2,'0') + String(time_match_min.value).padStart(2,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_5tx.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$50:t" + String(time_match_n.value).padStart(1,'0') + ":" + String(time_value.value).padStart(3,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70pl_1.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:pl:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70pl_0.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:pl:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l1_1.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l1:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l1_0.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l1:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l1.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l2_1.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l2:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l2_0.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l2:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l2.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l2;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l4_1.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l4:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l4_0.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l4:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70l4.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:l4;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_70ph.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$70:ph:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
setTimeout( function () {
command_str = "$03:s1:" + String(pipe1_ph.value).padStart(2,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);}, 1000);
}
}
btn_80.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$80;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
cmd_80s1 = () => {
if(ws_state === 1)
{
command_str = "$80:s:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
function cmd_80s0() {
if(ws_state === 1)
{
command_str = "$80:s:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80d0.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:d:0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80d1.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:d:1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80h.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:h;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80n.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:n;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnn.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnn1.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ":1;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnn0.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ":0;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnni.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ":i;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnnr.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ":r;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnnt.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ":t:" + String(valve_time.value).padStart(3,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_80vnnp.onclick = () => {
if(ws_state === 1)
{
command_str = "$80:v:" + String(valve_number.value).padStart(2,'0') + ":p:" + String(valve_pressure.value).padStart(2,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_84.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$84:" + String(output_.value).padStart(2,'0') + ";";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_85.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$85;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_86d.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$86:d;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_86i.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$86:i;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}
}
btn_86p.onclick = () =>
{
if(ws_state === 1)
{
command_str = "$86:p;";
ws.send(command_str);
message_to_box(`ME: ${command_str}`, color_me);
console.log(command_str);
}