index.php 18.4 KB
Newer Older
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php
/**
 * @file index.php
 * @brief index page
 * @copyright Copyright (C) 2017 Elphel Inc.
 * @author Oleg Dzhimiev <oleg@elphel.com>
 *
 * @par <b>License</b>:
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
?>
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
23 24 25
<!doctype html>
<html lang="en">
<head>
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
    <title>Elphel 393</title>
    <meta charset="utf-8"/>
    <script>
    // for LibreJS:
    /**
    * @file index.php
    * @copyright Copyright (C) 2017 Elphel Inc.
    * @author -
    *
    * @licstart  The following is the entire license notice for the
    *  JavaScript code in this page.
    *
    *   The JavaScript code in this page is free software: you can
    *   redistribute it and/or modify it under the terms of the GNU
    *   General Public License (GNU GPL) as published by the Free Software
    *   Foundation, either version 3 of the License, or (at your option)
    *   any later version.  The code is distributed WITHOUT ANY WARRANTY;
    *   without even the implied warranty of MERCHANTABILITY or FITNESS
    *   FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
    *
    *   As additional permission under GNU GPL version 3 section 7, you
    *   may distribute non-source (e.g., minimized or compacted) forms of
    *   that code without the copy of the GNU GPL normally required by
    *   section 4, provided you include this license notice and a URL
    *   through which recipients can access the Corresponding Source.
    *
    *  @licend  The above is the entire license notice
    *  for the JavaScript code in this page.
    */
    </script>
    <script type='text/javascript' src='js/jquery-3.1.1.js'></script>
    <!--<script type='text/javascript' src='../js/bootstrap/js/bootstrap.js'></script>-->
    <script src="js/elphel.js"></script>
    <script src="js/jcanvas.js"></script>
    <script src="js/UTIF.js"></script>
    <script src="js/exif.js"></script>
    <script src="js/jquery-jp4.js"></script>

    <link rel="stylesheet" href="js/bootstrap/css/bootstrap.css">
    <style>
        .port_window{
            padding: 5px;
            background: rgba(240,240,240,0.5);
            border-radius: 2px;
        }
        .img_window{
            border: 1px solid rgba(210,210,210,1);
        }
        .port_preview{
            width:300px;
            min-height:224px;
            overflow: auto;
        }
        table td {
            padding-right:10px;
        }
        .btn.active:focus, .btn:focus{
            outline:none;
        }
        .btn-toggle{
            padding: 1px 0px;
        }
88 89 90 91 92 93 94
        #aexp_limit,
        #exposure,
        #fps{
            width: 50px;
            text-align:right;
            margin-top: 1px;
        }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
95 96 97 98 99 100

        #ll_status{
            color: rgba(0,150,0,1);
            opacity: 0;
        }

101 102 103 104 105 106 107 108
        .qlink{
            cursor: pointer;
        }

        .qlink:hover {
            text-decoration: underline;
        }

109
    </style>
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
110 111 112
</head>
<body>
<div style='padding:10px'>
113
<?php
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
114

115
  include "include/elphel_functions_include.php";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
116

117
  $port0 = 2323;
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
118 119
  $table_contents = "";
  $port_links = "";
120

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
121
  $sample_port = -1;
122

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
123 124
  $sensors = get_sensors();
  $sensor_type = "none";
125
  $preview_image_cmd=array();
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
126
  foreach($sensors as $i => $sensor){
127
    if ($sensor!="none"){
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
128
        $sensor_type = $sensor;
129
        $sample_port = $i;
Andrey Filippov's avatar
Andrey Filippov committed
130
        $sensor_extra_height = elphel_get_P_value($i,ELPHEL_WOI_HEIGHT) - elphel_get_P_value($i,ELPHEL_SENSOR_HEIGHT);
131 132 133
        $sandp = "http://{$_SERVER["SERVER_ADDR"]}:".($port0+$i);
        $href1 = "$sandp/bimg";
        $href2 = "$sandp/mimg";
134
        $href3 = "$sandp/tiff_palette=2/tiff_telem=1/tiff_auto=33/tiff_convert/bimg";
Andrey Filippov's avatar
Andrey Filippov committed
135 136 137 138 139 140
        if ($sensor_type == 'boson640'){ // lepton35
            $telem = ($sensor_extra_height > 0) ? 1 : 0;
            $preview_image_cmd[] = '/tiff_palette=2/tiff_telem='.$telem.'/tiff_auto=33/tiff_convert/bimg';
        } else if ($sensor_type == 'lepton35'){ 
            $telem = ($sensor_extra_height > 0) ? -2 : 0;
            $preview_image_cmd[] = '/tiff_palette=2/tiff_telem='.$telem.'/tiff_auto=33/tiff_convert/bimg';
141
        } else {
142
            $preview_image_cmd[] = '/img';
143
        }
144
        $table_contents .= "<td valign='top'>";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
145
        $table_contents .= "<div class='port_window img_window'>";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
146
        //$table_contents .= "<div><a href=\"$href1\"><img class='img_window' src='$href1' style='width:300px'/></a></div>";
147 148 149 150 151
        if ($sensor_type == boson640){
            $table_contents .= "<div><a href=\"$href3\"><div index='$i' class='port_preview'></div></a></div>";
        } else {
            $table_contents .= "<div><a href=\"$href1\"><div index='$i' class='port_preview'></div></a></div>";
        }
152
        $table_contents .= "<div style='text-align:center;'>";
153
        $table_contents .= "port $i: (".$sensor_type.")";
154
        $table_contents .= "<a title='single image' href='$href1'>bimg</a>, ";
155
        $table_contents .= "<a href=\"img.html?port=$i&amp;sensor_type=$sensor_type\" title='single image, auto refreshed on load, LOW RES, displays jpeg, tiff and jp4 formats'>img</a>, ";
156 157 158 159
        $table_contents .= "<a title='multi-part image stream (M-JPEG). Played in browser as is.' href='$href2'>mimg</a>, ";
        $table_contents .= "<a href=\"mjpeg.html?port=$i\" title='MJPEG stream played in html canvas' class='canvas_mjpeg'>canvas</a>";
        $table_contents .= "</div>";

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
160 161
        $table_contents .= "</div>";
        $table_contents .= "</td>";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
162

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
163
        $port_links .= "<li><a href=\"#\" onclick=\"window.open('camvc.html?sensor_port=$i&reload=0', 'port $i','menubar=0, width=800, height=600, toolbar=0, location=0, personalbar=0, status=0, scrollbars=1')\">port $i</a></li>\n";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
164 165
    }
  }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
166

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
167 168 169
  // check awb of master channel
  $master_port = elphel_get_P_value($sample_port,ELPHEL_TRIG_MASTER);
  $awb_on = elphel_get_P_value($master_port,ELPHEL_WB_EN);
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
170
  $aexp_on = elphel_get_P_value($master_port,ELPHEL_AUTOEXP_ON);
171

172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
  $aexp_max = elphel_get_P_value($master_port,ELPHEL_AUTOEXP_EXP_MAX);
  $aexp_max = round($aexp_max/100)/10;

  $trig_period = elphel_get_P_value($master_port,ELPHEL_TRIG_PERIOD);
  if ($trig_period!=1){ // single
    $trig_period_step_s = 0.00000001;
    $trig_period_s = $trig_period*$trig_period_step_s;
    $fps = round(1/$trig_period_s*10)/10;
  }else{
    $fps = 10;
  }

  $expos = elphel_get_P_value($master_port,ELPHEL_EXPOS);
  $expos = round($expos/100)/10;

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
187 188 189
  $sensor_width  = elphel_get_P_value($master_port,ELPHEL_SENSOR_WIDTH);
  $sensor_height = elphel_get_P_value($master_port,ELPHEL_SENSOR_HEIGHT);

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
190
  echo "<table><tr>$table_contents</tr></table>\n";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
191

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
192
  echo "<br/>";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
193

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
194
  echo "Camera Control Interface<ul>$port_links</ul>\n";
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
195

196 197
?>
    <table>
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
    <tr>
        <td>
            <span title='Frames Per Second. Set internal trigger per second. WARNING: Trigger can be programmed to be faster than real fps. In that case some triggers are ignored.'>FPS:</span>
        </td>
        <td><input id='fps' type='text' value='<?php echo $fps;?>' pname='TRIG_PERIOD' /></td>
    </tr>
    <tr>
        <td>
            <span title='Initial read from master port, applied to all ports'>Manual Exposure:</span>
        </td>
        <td><input id='exposure' type='text' value='<?php echo $expos;?>' pname='EXPOS'/> ms</td>
    </tr>
    </table>
    <br/>
    <table>
    <tr id="toggle_awb_div" title='Auto White Balance'>
214 215 216 217 218 219 220 221 222 223
        <td>
            Auto WB:
        </td>
        <td>
            <div id="toggle_awb" class="btn-group btn-toggle">
                <button class="btn btn-xs <?php echo  ($awb_on)?"btn-success active":"btn-default";?>">ON</button>
                <button class="btn btn-xs <?php echo (!$awb_on)?"btn-danger active":"btn-default";?>">OFF</button>
            </div>
        </td>
    </tr>
224
    <tr id="toggle_aexp_div" title='Auto Exposure'>
225 226 227 228 229 230 231 232 233
        <td>
            Auto Exposure:
        </td>
        <td>
            <div id="toggle_aexp" class="btn-group btn-toggle">
                <button class="btn btn-xs <?php echo  ($aexp_on)?"btn-success active":"btn-default";?>">ON</button>
                <button class="btn btn-xs <?php echo (!$aexp_on)?"btn-danger active":"btn-default";?>">OFF</button>
            </div>
        </td>
234 235 236 237
        <td>
            <span title="Auto Exposure Limit in ms">Limit:
        </td>
        <td><input id='aexp_limit' type='text' value='<?php echo $aexp_max;?>' pname='AUTOEXP_EXP_MAX'/> ms</td>
238 239 240 241 242 243 244 245
    </tr>
    </table>
    <br />
    <a href="autocampars.php" title="autocampars.php">Parameter Editor</a><br />
    <br />
    <a href="camogmgui.php"   title="Store video/images to the camera's storage">Recorder</a><br />
    <a href="snapshot/"       title="Take a snapshot and download from the camera">Snapshot</a><br />
    <a href="raw.php"         title="Take a snapshot and download raw pixel data from the camera">Snapshot (raw image data)</a><br />
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
246
    <span title="5Mpx (MT9P006) and 14Mpx (MT9F002) sensors are supported">Quick setup (5 & 14Mpx sensors):</span>
247
    <ul>
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
248
        <li><span id="quick_fullres" class='text-primary qlink'>fullres 10fps</span> <span id='ll_status'>settings applied</span></li>
249 250 251
        <li><span id="quick_1080p" class='text-primary qlink'>1920x1080 30fps</span> <span id='ll_status'>settings applied</span></li>
        <li><span id="quick_720p" class='text-primary qlink'>1280x720 60fps</span> <span id='ll_status'>settings applied</span></li>
    </ul>
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
252
    <a href="photofinish/"    title="Scanline mode demo. 5Mpx sensor (MT9P006) only">Photo finish demo</a><br />
253 254 255 256 257 258 259 260 261
    <br />
    <a href="hwmon.html"           title="hwmon.html">Temperature monitor</a><br />
    <a href="update_software.html" title="Update NAND flash">Update firmware</a><br />
    <br />
    <a title="docs" href="http://wiki.elphel.com/index.php?title=Tmp_manual">User manual</a><br />
    <a href="jp4-viewer/?width=1200&quality=1" title="Preview jp4 images (drag and drop from PC)">JP4 Viewer</a><br />
    <a href="/diagnostics/index.html" title="Inspect camera system info">System info</a><br />
    <a href="/test_sensors.php" title="Switch to test pattern and check md5sums">Test sensors</a><br />
    <a href="/debugfs.html" title="Linux Kernel Dynamic Debug helper interface (debug device drivers)">DebugFS</a><br />
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
262
</div>
263

264
<script>
265

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
266 267 268 269
    var sensor_type = "<?php echo $sensor_type;?>";
    var sensor_width = <?php echo $sensor_width;?>;
    var sensor_height = <?php echo $sensor_height;?>;

270
    var jp4_previews_enable = true;
271
    var jp4_previews = [];
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
272

273 274 275 276 277
    $(function(){
        check_time();
        init_awb_toggle();
        init_aexp_toggle();
        init_jp4_previews();
278
        init_inputs();
279
        init_quick_res_fps();
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
280
        update_canvas_mjpeg();
281
    });
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
282

283 284 285 286 287 288 289 290
    async function check_time(){
        $.ajax({
            url: "utils.php?cmd=time&ts="+Date.now(),
            success: (res)=>{
                console.log(res);
            }
        });
    }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
291

292 293 294 295
    function init_jp4_previews(){
        $('.port_preview').each(function(){
            index = parseInt($(this).attr("index"));
            if (jp4_previews_enable) {
296
                //jp4_previews[index] = $(this).jp4({ip:location.host,port:2323+index,width:300,fast:true,lowres:4});
297
                jp4_previews[index] = $(this).jp4({src:"http://"+location.host+":"+(2323+index)+"<?php echo $preview_image_cmd[0];?>",width:300,fast:true,lowres:4});
298
            }else{
299
                $(this).html("<img width='300' src='http://"+location.host+":"+(2323+index)+"<?php echo $preview_image_cmd[0];?>' />");
300 301 302
            }
        });
    }
303

304 305
    function init_awb_toggle(){
        $('#toggle_awb').click(function() {
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
306

307 308 309 310 311
            if ($(this).find('.btn.active').html()=="ON"){
                $(this).find('.btn.active').toggleClass('btn-success');
            }else{
                $(this).find('.btn.active').toggleClass('btn-danger');
            }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
312

313 314
            // toggle active
            $(this).find('.btn').toggleClass('active');
315

316 317 318 319 320 321 322
            if ($(this).find('.btn.active').html()=="ON"){
                wb_en = 1;
                $(this).find('.btn.active').toggleClass('btn-success');
            }else{
                wb_en = 0;
                $(this).find('.btn.active').toggleClass('btn-danger');
            }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
323

324
            $(this).find('.btn').toggleClass('btn-default');
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
325

326 327 328 329 330 331 332 333 334 335 336
            url = "parsedit.php?immediate&sensor_port=<?php echo $master_port;?>&WB_EN="+wb_en+"&*WB_EN=0xf";

            $.ajax({
                url: url,
                success: function(){
                    console.log("awb "+(wb_en?"on":"off"));
                }
            });

        });
    }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
337

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
338 339
    function init_aexp_toggle(){
        $('#toggle_aexp').click(function() {
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
340

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
341 342 343 344 345
            if ($(this).find('.btn.active').html()=="ON"){
                $(this).find('.btn.active').toggleClass('btn-success');
            }else{
                $(this).find('.btn.active').toggleClass('btn-danger');
            }
346

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
347 348
            // toggle active
            $(this).find('.btn').toggleClass('active');
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
349

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
350 351 352 353 354 355 356
            if ($(this).find('.btn.active').html()=="ON"){
                aexp_en = 1;
                $(this).find('.btn.active').toggleClass('btn-success');
            }else{
                aexp_en = 0;
                $(this).find('.btn.active').toggleClass('btn-danger');
            }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
357

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
358
            $(this).find('.btn').toggleClass('btn-default');
359

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
360 361 362 363 364 365 366 367
            url = "parsedit.php?immediate&sensor_port=<?php echo $master_port;?>&AUTOEXP_ON="+aexp_en+"&*AUTOEXP_ON=0xf";

            $.ajax({
                url: url,
                success: function(){
                    console.log("aexp "+(aexp_en?"on":"off"));
                }
            });
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
368

369
        });
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
370
    }
371

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
372 373 374 375 376 377 378 379
    async function init_inputs(){
        $("input").change(function(){
            let pname  = $(this).attr('pname');
            let pvalue = $(this).val();

            switch(pname){
            case "AUTOEXP_EXP_MAX":
                pvalue = parseInt(pvalue*1000);
380
                set_params({[pname]:pvalue},()=>{
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
381 382 383 384 385 386 387 388 389
                    console.log("ok");
                });
                break;
            case "EXPOS":
                pvalue = parseInt(pvalue*1000);
                // autoexp off
                if ($('#toggle_aexp').find('.btn.active').html()==="ON"){
                    $('#toggle_aexp').click();
                }
390
                set_params({[pname]:pvalue},()=>{
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
391 392 393 394 395
                    console.log("ok");
                });
                break;
            case "TRIG_PERIOD":
                pvalue = parseInt(1/pvalue*10e7);
396
                set_params({[pname]:pvalue},()=>{
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
397 398 399 400 401
                    console.log("ok");
                    update_canvas_mjpeg();
                });
                break;
            default:
402
            }
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
403 404
        });
    }
405

406 407 408 409 410 411 412
    async function init_quick_res_fps(){
        // quick_fullres
        // quick_1080p
        // quick_720p

        $("#quick_fullres").click(async function(){

413
            await set_params({
414 415 416
                "TRIG_PERIOD"    : 10000000
            },-2);

417
            await set_params({
418
                "AUTOEXP_EXP_MAX": 100000,
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
419 420
                "WOI_WIDTH"      : 10000,
                "WOI_HEIGHT"     : 10000,
421 422 423 424
                "WOI_TOP"        : 0,
                "WOI_LEFT"       : 0,
                "SENSOR_RUN"     : 0,
                "COMPRESSOR_RUN" : 3
425
            },3);
426

427
            await set_params({
428 429 430
                "TRIG_PERIOD"    : 10000000,
                "SENSOR_RUN"     : 2,
                "COMPRESSOR_RUN" : 2
431
            },7);
432 433 434 435 436 437 438

            $(this).parent().find("#ll_status").css({opacity:1}).animate({opacity:0},2000);
            update_canvas_mjpeg();
        });

        $("#quick_1080p").click(async function(){

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
439 440 441
            let w = 1920;
            let h = 1088;

442
            await set_params({
443 444
                "TRIG_PERIOD"    : 10000000
            },-2);
445

446
            await set_params({
447
                "AUTOEXP_EXP_MAX": 30000,
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
448 449 450 451
                "WOI_WIDTH"      : w,
                "WOI_HEIGHT"     : h,
                "WOI_TOP"        : (sensor_height-h)/2,
                "WOI_LEFT"       : (sensor_width-w)/2,
452 453
                "SENSOR_RUN"     : 0,
                "COMPRESSOR_RUN" : 3
454
            },3);
455

456
            await set_params({
457 458 459
                "TRIG_PERIOD"    : 3333333,
                "SENSOR_RUN"     : 2,
                "COMPRESSOR_RUN" : 2
460
            },7);
461 462 463 464 465 466 467

            $(this).parent().find("#ll_status").css({opacity:1}).animate({opacity:0},2000);
            update_canvas_mjpeg();
        });

        $("#quick_720p").click(async function(){

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
468 469 470
            let w = 1280;
            let h = 720;

471
            await set_params({
472 473
                "TRIG_PERIOD"    : 10000000
            },-2);
474

475
            await set_params({
476
                "AUTOEXP_EXP_MAX": 16000,
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
477 478 479 480
                "WOI_WIDTH"      : w,
                "WOI_HEIGHT"     : h,
                "WOI_TOP"        : (sensor_height-h)/2,
                "WOI_LEFT"       : (sensor_width-w)/2,
481 482
                "SENSOR_RUN"     : 0,
                "COMPRESSOR_RUN" : 3
483
            },3);
484

485
            await set_params({
486 487 488
                "TRIG_PERIOD"    : 1666667,
                "SENSOR_RUN"     : 2,
                "COMPRESSOR_RUN" : 2
489
            },7);
490 491

            $(this).parent().find("#ll_status").css({opacity:1}).animate({opacity:0},2000);
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
            update_canvas_mjpeg();
        });

    }

    async function update_canvas_mjpeg(){

        let refresh = parseInt(1/$("#fps").val()*1000);

        $(".canvas_mjpeg").each(function(){
            let href = $(this).attr("href");
            href = href.split("?");
            let p = new URLSearchParams(href[1]);
            let port = p.get("port");
            $(this).attr("href",href[0]+"?port="+port+"&refresh="+refresh);
        });


    }

512
    async function set_params(pars,ahead=3){
513 514 515

        let req = [];
        for(p in pars){
516
            req.push(p+"="+pars[p]+"*"+ahead+"&*"+p+"=0xf");
517 518
        }

519 520
        let res = await $.ajax({
            url: "parsedit.php?immediate&sensor_port=<?php echo $master_port;?>&"+req.join("&")
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
521
        });
522

523
        return res;
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
524
    }
525

526 527 528 529
    const sleep = ms => {
        return new Promise(resolve => setTimeout(resolve, ms));
    }

Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
530
</script>
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
531 532
<body>
</html>