Loading src/index/index.php +183 −177 Original line number Original line Diff line number Diff line Loading @@ -71,25 +71,20 @@ .img_window{ .img_window{ border: 1px solid rgba(210,210,210,1); border: 1px solid rgba(210,210,210,1); } } .port_preview{ .port_preview{ width:300px; width:300px; min-height:224px; min-height:224px; overflow: auto; overflow: auto; } } table td { table td { padding-right:10px; padding-right:10px; } } .btn.active:focus, .btn:focus{ .btn.active:focus, .btn:focus{ outline:none; outline:none; } } .btn-toggle{ .btn-toggle{ padding: 1px 0px; padding: 1px 0px; } } </style> </style> </head> </head> <body> <body> Loading Loading @@ -177,16 +172,27 @@ <a href="/test_sensors.php" title="Switch to test pattern and check md5sums">Test sensors</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 /> <a href="/debugfs.html" title="Linux Kernel Dynamic Debug helper interface (debug device drivers)">DebugFS</a><br /> </div> </div> <script> <script> var jp4_previews_enable = true; var jp4_previews_enable = true; $(function(){ $(function(){ check_time(); init_awb_toggle(); init_awb_toggle(); init_aexp_toggle(); init_aexp_toggle(); init_jp4_previews(); init_jp4_previews(); }); }); async function check_time(){ $.ajax({ url: "utils.php?cmd=time&ts="+Date.now(), success: (res)=>{ console.log(res); } }); } function init_jp4_previews(){ function init_jp4_previews(){ $('.port_preview').each(function(){ $('.port_preview').each(function(){ index = parseInt($(this).attr("index")); index = parseInt($(this).attr("index")); Loading src/php_top/utils.php +40 −9 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,9 @@ switch($cmd){ case "sensors": case "sensors": print(cmd_sensors()); print(cmd_sensors()); break; break; case "time": cmd_time(); break; default: default: print("OK"); print("OK"); } } Loading @@ -37,12 +40,40 @@ function cmd_sensors(){ $res .= "\t\t<port index='$i' port='$p'>$sensor</port>\n"; $res .= "\t\t<port index='$i' port='$p'>$sensor</port>\n"; } } $res .= "\t</camera>\n"; $res .= "\t</camera>\n"; return wrap_into_xml($res); } function cmd_time(){ date_default_timezone_set('UTC'); $t = elphel_get_fpga_time(); if (!isset($_GET['ts'])){ //date +%s will report system time //print(exec("date +%s")); print("Camera time: $t"); }else{ // ts is in ms $ts_s = substr($_GET['ts'],0,10); $ts_ms = substr($_GET['ts'],-3); //$ts = $_GET['ts']/1000; $ts_formatted = date("Y-m-d H:i:s.$ts_ms",$ts_s); print("Your time: $ts_s.$ts_ms ($ts_formatted)\nCamera time: $t\n"); if (abs($ts_s-$t)>24*3600){ elphel_set_fpga_time($_GET['ts']/1000); exec("date -s $ts_formatted"); exec("hwclock --systohc"); print("Timestamps differ by more than 24h. Camera and fpga time updated.\n"); } } } function wrap_into_xml($s){ $xml = "<?xml version='1.0' standalone='yes'?>\n"; $xml = "<?xml version='1.0' standalone='yes'?>\n"; $xml .= "<Document>\n"; $xml .= "<Document>\n"; $xml .= $res; $xml .= $s; $xml .= "</Document>\n"; $xml .= "</Document>\n"; return $xml; return $xml; } } Loading Loading
src/index/index.php +183 −177 Original line number Original line Diff line number Diff line Loading @@ -71,25 +71,20 @@ .img_window{ .img_window{ border: 1px solid rgba(210,210,210,1); border: 1px solid rgba(210,210,210,1); } } .port_preview{ .port_preview{ width:300px; width:300px; min-height:224px; min-height:224px; overflow: auto; overflow: auto; } } table td { table td { padding-right:10px; padding-right:10px; } } .btn.active:focus, .btn:focus{ .btn.active:focus, .btn:focus{ outline:none; outline:none; } } .btn-toggle{ .btn-toggle{ padding: 1px 0px; padding: 1px 0px; } } </style> </style> </head> </head> <body> <body> Loading Loading @@ -177,16 +172,27 @@ <a href="/test_sensors.php" title="Switch to test pattern and check md5sums">Test sensors</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 /> <a href="/debugfs.html" title="Linux Kernel Dynamic Debug helper interface (debug device drivers)">DebugFS</a><br /> </div> </div> <script> <script> var jp4_previews_enable = true; var jp4_previews_enable = true; $(function(){ $(function(){ check_time(); init_awb_toggle(); init_awb_toggle(); init_aexp_toggle(); init_aexp_toggle(); init_jp4_previews(); init_jp4_previews(); }); }); async function check_time(){ $.ajax({ url: "utils.php?cmd=time&ts="+Date.now(), success: (res)=>{ console.log(res); } }); } function init_jp4_previews(){ function init_jp4_previews(){ $('.port_preview').each(function(){ $('.port_preview').each(function(){ index = parseInt($(this).attr("index")); index = parseInt($(this).attr("index")); Loading
src/php_top/utils.php +40 −9 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,9 @@ switch($cmd){ case "sensors": case "sensors": print(cmd_sensors()); print(cmd_sensors()); break; break; case "time": cmd_time(); break; default: default: print("OK"); print("OK"); } } Loading @@ -37,12 +40,40 @@ function cmd_sensors(){ $res .= "\t\t<port index='$i' port='$p'>$sensor</port>\n"; $res .= "\t\t<port index='$i' port='$p'>$sensor</port>\n"; } } $res .= "\t</camera>\n"; $res .= "\t</camera>\n"; return wrap_into_xml($res); } function cmd_time(){ date_default_timezone_set('UTC'); $t = elphel_get_fpga_time(); if (!isset($_GET['ts'])){ //date +%s will report system time //print(exec("date +%s")); print("Camera time: $t"); }else{ // ts is in ms $ts_s = substr($_GET['ts'],0,10); $ts_ms = substr($_GET['ts'],-3); //$ts = $_GET['ts']/1000; $ts_formatted = date("Y-m-d H:i:s.$ts_ms",$ts_s); print("Your time: $ts_s.$ts_ms ($ts_formatted)\nCamera time: $t\n"); if (abs($ts_s-$t)>24*3600){ elphel_set_fpga_time($_GET['ts']/1000); exec("date -s $ts_formatted"); exec("hwclock --systohc"); print("Timestamps differ by more than 24h. Camera and fpga time updated.\n"); } } } function wrap_into_xml($s){ $xml = "<?xml version='1.0' standalone='yes'?>\n"; $xml = "<?xml version='1.0' standalone='yes'?>\n"; $xml .= "<Document>\n"; $xml .= "<Document>\n"; $xml .= $res; $xml .= $s; $xml .= "</Document>\n"; $xml .= "</Document>\n"; return $xml; return $xml; } } Loading