File size: 11,749 Bytes
1e9310c
 
 
 
 
fa4419d
1e9310c
ef2e452
3c11f53
4eba8a4
ea22cb5
d0ddd2f
 
 
 
 
1e9310c
d0ddd2f
 
 
5457996
ea22cb5
1e9310c
 
 
 
112c1c4
3aefc14
 
fa4419d
 
d8b1280
3aefc14
 
911530c
6ac3172
f2a5c5d
3aefc14
 
 
 
 
 
 
 
112c1c4
85c8684
15e9db2
f88df1b
68fb27d
602c5b3
 
 
 
7a41528
602c5b3
ed9f7cc
 
310c2bf
 
 
 
 
602c5b3
 
c8dbcc9
602c5b3
 
 
7a41528
602c5b3
afe5dd6
 
 
 
 
 
 
602c5b3
 
c8dbcc9
602c5b3
 
 
7a41528
602c5b3
ab55b10
 
 
 
 
 
 
602c5b3
 
c8dbcc9
602c5b3
 
 
 
 
0280ba2
602c5b3
f19d7aa
 
 
 
 
 
 
 
 
 
 
 
 
c8dbcc9
f19d7aa
 
 
 
 
 
 
 
 
 
 
 
 
 
c8dbcc9
f19d7aa
 
 
 
 
 
 
602c5b3
f19d7aa
 
 
 
 
 
c8dbcc9
f19d7aa
 
 
602c5b3
 
 
42de0c1
602c5b3
afe5dd6
 
42de0c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8dbcc9
42de0c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8dbcc9
42de0c1
 
 
 
 
 
 
310c2bf
42de0c1
 
 
 
 
 
c8dbcc9
42de0c1
 
 
310c2bf
 
95a5346
 
0b033b7
42de0c1
0b033b7
112c1c4
8b1734c
7b2f791
3aefc14
 
f2a5c5d
 
 
 
 
 
3aefc14
 
 
 
f2a5c5d
 
 
 
 
 
3aefc14
 
 
 
f2a5c5d
 
7b2f791
 
3aefc14
 
 
 
 
41d5554
 
 
 
 
 
 
 
 
 
7b2f791
 
 
 
 
 
 
 
 
 
93c573b
1e9310c
9159ff4
 
1e9310c
28742bb
e80947e
4eb5c05
b3f874e
 
 
1c08e43
 
b931787
 
c16d5c8
1e9310c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3867c22
b41ae96
 
 
 
 
 
 
 
 
3867c22
 
 
 
 
 
 
 
3f54678
 
3addcc0
 
 
 
 
 
 
 
3f54678
 
fe96440
c0d4f7f
486912c
fe96440
486912c
fe96440
 
 
 
3f54678
 
 
 
 
 
 
 
 
 
42c576d
 
 
 
 
 
 
 
 
2bc38dc
 
 
 
 
 
 
 
 
 
f0e5848
 
 
 
 
 
 
 
 
 
2bc38dc
f0e5848
 
5aacd71
 
 
 
 
 
f0e5848
2bc38dc
2281f6a
 
 
 
 
 
 
 
 
42c576d
eda480b
 
 
 
 
 
 
 
1e9310c
 
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
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width" />
        <link rel="icon" type="image/ico" href="https://huggingface.co/spaces/igs-img/stor/resolve/main/list.ico">
		<title>My static Space</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">


<style>
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: inner-spin-button;
  opacity: 1;
}

input[type="number"] {
  -moz-appearance: textfield;
}

</style>

      
	</head>
<body>


<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand" href="/settings">
    <img src="https://huggingface.co/spaces/igs-img/stor/resolve/main/list.png" width="30" height="30" class="d-inline-block align-top" alt="">
    MackorLab
  </a>
  <form class="form-inline">
    <button  id="st_onl" class="btn btn-outline-success" type="button" >Онлайн</button>
    <button   id="st_set" class="btn btn-success" type="button" >Настройки</button>

  </form>
</nav>





  
<div class="container mt-3">
   <div class="container text-center"> 
    <h1>Настройки системы</h1>
   </div> <br>



<div class="card-deck">
  <div class="card">
    
    <div class="card-body">
      <!-- Уровень - PH -->  <div class="container text-center"> 
      <h4>Уровень pH</h4>  </div>
        <p>EEPROM : <span id="pH_eep"></span></p>  
      <form>
        <label for="pH_set">Новое : </label>
        <input type="number"  id="pH_set" value="5.7" min="1" max="14" step="0.01">
      </form>
    </div>
    <div class="card-footer">
      <button id="pH_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
  <div class="card">
    
    <div class="card-body">
      <!-- PH ON - sec -->
      <h4>pH доз. ON sec.</h4>  
      <p>EEPROM : <span id="ph_on_eep"></span></p>
      <form>
        <label for="ph_on_set">Новое : </label>
        <input type="number"  id="ph_on_set" value="2.5" min="0.1" max="20" step="0.01">
     </form>
    </div>
    <div class="card-footer">
      <button id="ph_on_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
  <div class="card">
    
    <div class="card-body">
      <h4>Уровень EC</h4>  
  <p>EEPROM : <span id="ec_eep"></span></p>

<form>
   <label for="ec_set">Новое : </label>
   <input type="number"  id="ec_set" value="0.85" min="0.1" max="4" step="0.01">
</form>
    </div>
    <div class="card-footer">
      <button id="ec_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
</div>


<br>

<div class="card-deck">
  <div class="card">
    
    <div class="card-body">
      <h4>EC доз. A_ON sec.</h4>  
  <p>EEPROM : <span id="ec_A_eep"></span></p>

<form>
   <label for="ec_A_set">Новое : </label>
   <input type="number"  id="ec_A_set" value="1.5" min="0.1" max="20" step="0.01">
</form>
    </div>
    <div class="card-footer">
      <button id="ec_A_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
  <div class="card">
    
    <div class="card-body">
      <h4>EC доз. B_ON sec.</h4>  
  <p>EEPROM : <span id="ec_B_eep"></span></p>

<form>
   <label for="ec_B_set">Новое : </label>
   <input type="number"  id="ec_B_set" value="1.5" min="0.1" max="20" step="0.01">
</form> 
    </div>
    <div class="card-footer">
      <button id="ec_B_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
  <div class="card">
    
    <div class="card-body">
      <h4>EC доз. C_ON sec.</h4>  
  <p>EEPROM : <span id="ec_C_eep"></span></p>

<form>
   <label for="ec_C_set">Новое : </label>
   <input type="number"  id="ec_C_set" value="1.5" min="0.1" max="20" step="0.01">
</form> 
    </div>
    <div class="card-footer">
      <button id="ec_C_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
</div>



<br>
  


<div class="card-deck">
  <div class="card">
    
    <div class="card-body">
      <h4>Свет ON </h4>  
  <p>EEPROM: <span id="l_ON_h_eep"></span> : <span id="l_ON_m_eep"></span></p>
<form>
   <label for="l_ON_h_set">Новое h : </label>
   <input type="number"  id="l_ON_h_set" value="12" min="0" max="23" step="1">
</form>  
<form>
   <label for="l_ON_m_set">Новое m : </label>
   <input type="number"  id="l_ON_m_set" value="30" min="0" max="59" step="1">
</form> 
    </div>
    <div class="card-footer">
      <button id="l_ON_set" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
  <div class="card">
    
    <div class="card-body">
      <h4>Свет OFF </h4>  
  <p>EEPROM: <span id="l_OFF_h_eep"></span> : <span id="l_OFF_m_eep"></span></p>
<form>
   <label for="l_OFF_h_set">Новое h : </label>
   <input type="number"  id="l_OFF_h_set" value="12" min="0" max="23" step="1">
</form>  
<form>
   <label for="l_OFF_m_set">Новое m : </label>
   <input type="number"  id="l_OFF_m_set" value="30" min="0" max="59" step="1">
</form> 
    </div>
    <div class="card-footer">
      <button id="l_OFF_set" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
  <div class="card">
    
    <div class="card-body">
      <h4>Тем. воздуха</h4>  
  <p>EEPROM : <span id="t_Voz_eep"></span></p>

<form>
   <label for="t_Voz_eep_set">Новое : </label>
   <input type="number"  id="t_Voz_eep_set" value="25" min="10" max="40" step="1">
</form> 
    </div>
    <div class="card-footer">
      <button id="t_Voz_set" type="button" class="btn btn-success btn-lg">Записать</button>
    </div>
  </div>
</div>


 
<br><br><br><br>


  
</div>


<script>
    document.getElementById("st_onl").addEventListener("click", function() {
        // Получаем основной URL без пути и параметров
        var baseUrl = window.location.origin;
        // Добавляем необходимый путь к основному URL
        var targetUrl = baseUrl + "/online";
        // Переходим по сформированному URL
        window.location.href = targetUrl;
    });
</script>
<script>
    document.getElementById("st_set").addEventListener("click", function() {
        // Получаем основной URL без пути и параметров
        var baseUrl = window.location.origin;
        // Добавляем необходимый путь к основному URL
        var targetUrl = baseUrl + "/settings";
        // Переходим по сформированному URL
        window.location.href = targetUrl;
    });
</script>









  

<script>
  // Функция, которая будет выполняться при загрузке страницы
  window.onload = function() {
    // Создаем запрос
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/set_res", true);
    // Отправляем запрос
    xhr.send();
  };
</script>









  
  
  <script>

    
    function updateValues(data) {
      document.getElementById("pH_eep").textContent = data.ph_eep;
      document.getElementById("ph_on_eep").textContent = data.ph_on_eep;
      document.getElementById("ec_eep").textContent = data.ec_eep;
      document.getElementById("ec_A_eep").textContent = data.ec_A_eep; 
      document.getElementById("ec_B_eep").textContent = data.ec_B_eep; 
      document.getElementById("ec_C_eep").textContent = data.ec_C_eep;       
      document.getElementById("l_ON_h_eep").textContent = data.l_ON_h_eep;
      document.getElementById("l_ON_m_eep").textContent = data.l_ON_m_eep;  
      document.getElementById("l_OFF_h_eep").textContent = data.l_OFF_h_eep;
      document.getElementById("l_OFF_m_eep").textContent = data.l_OFF_m_eep; 
      document.getElementById("t_Voz_eep").textContent = data.t_Voz_eep; 
      
    }
    
    function fetchValues() {
      var xhr = new XMLHttpRequest();
      xhr.open("GET", "/settings_api", true);
      xhr.setRequestHeader("Content-Type", "application/json");
      xhr.onreadystatechange = function () {
        if (xhr.readyState === 4 && xhr.status === 200) {
          var response = JSON.parse(xhr.responseText);
          updateValues(response);
        }
      };
      xhr.send();
    }
    
    fetchValues();
    setInterval(fetchValues, 10000);
  </script>








  

  <script>
  document.getElementById("pH_set_but").addEventListener("click", function() {
    var pHValue = document.getElementById("pH_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/pH_set?value=" + pHValue, true);
    xhr.send();
});
  </script>


  <script>
  document.getElementById("ph_on_set_but").addEventListener("click", function() {
    var pH_onValue = document.getElementById("ph_on_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/ph_on_set?value=" + pH_onValue, true);
    xhr.send();
});
  </script>

  
  <script>
  document.getElementById("ec_set_but").addEventListener("click", function() {
    var ecValue = document.getElementById("ec_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/EC_set?value=" + ecValue, true);
    xhr.send();
});
  </script>
  
  <script>
  document.getElementById("ec_A_set_but").addEventListener("click", function() {
    var ec_A_setValue = document.getElementById("ec_A_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/ec_A_set?value=" + ec_A_setValue, true);
    xhr.send();
});
  </script>


  <script>
  document.getElementById("ec_B_set_but").addEventListener("click", function() {
    var ec_B_setValue = document.getElementById("ec_B_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/ec_B_set?value=" + ec_B_setValue, true);
    xhr.send();
});
  </script>


 <script>
  document.getElementById("ec_C_set_but").addEventListener("click", function() {
    var ec_C_setValue = document.getElementById("ec_C_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/ec_C_set?value=" + ec_C_setValue, true);
    xhr.send();
});
  </script>

 <script>
  document.getElementById("ec_C_set_but").addEventListener("click", function() {
    var ec_C_setValue = document.getElementById("ec_C_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/ec_C_set?value=" + ec_C_setValue, true);
    xhr.send();
});
  </script>



  <script>
  document.getElementById("l_ON_set").addEventListener("click", function() {
     var l_ON_h_set = document.getElementById("l_ON_h_set").value;
     var l_ON_m_set = document.getElementById("l_ON_m_set").value;
     var xhr = new XMLHttpRequest();
     xhr.open("GET", "/l_ON_set?l_ON_h_set=" + l_ON_h_set + "&l_ON_m_set=" + l_ON_m_set, true);
     xhr.send();
    });
  </script> 

  <script>
  document.getElementById("l_OFF_set").addEventListener("click", function() {
     var l_OFF_h_set = document.getElementById("l_OFF_h_set").value;
     var l_OFF_m_set = document.getElementById("l_OFF_m_set").value;
     var xhr = new XMLHttpRequest();
     xhr.open("GET", "/l_OFF_set?l_OFF_h_set=" + l_OFF_h_set + "&l_OFF_m_set=" + l_OFF_m_set, true);
     xhr.send();
    });
  </script> 
  
  <script>
  document.getElementById("t_Voz_set").addEventListener("click", function() {
    var t_Voz_eep_set = document.getElementById("t_Voz_eep_set").value;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "/t_Voz_eep_set?value=" + t_Voz_eep_set, true);
    xhr.send();
});
  </script> 
</body>
</html>