Commit f1f12cde authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

single shots - trigger and download from all ports to the client device

parent a2ab5a9f
# Runs 'make', 'make install', and 'make clean' in specified subdirectories # Runs 'make', 'make install', and 'make clean' in specified subdirectories
SUBDIRS := src/php_top src/python_tests src/debugfs-webgui src/jp4-canvas src/update src/eyesis4pi src/index src/pointers # src1 SUBDIRS := src/php_top src/python_tests src/debugfs-webgui src/jp4-canvas src/update src/eyesis4pi src/index src/pointers src/save_single # src1
INSTALLDIRS = $(SUBDIRS:%=install-%) INSTALLDIRS = $(SUBDIRS:%=install-%)
CLEANDIRS = $(SUBDIRS:%=clean-%) CLEANDIRS = $(SUBDIRS:%=clean-%)
......
DOCUMENTROOT=$(DESTDIR)/www/pages/save_single
OWN = -o root -g root
INSTDOCS = 0644
INSTALL = install
DOCS= save_single.js \
save_single.css
PHP_SCRIPTS= index.php
all:
@echo "make all in src"
install:
@echo "make install in src"
$(INSTALL) $(OWN) -d $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(DOCS) $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(PHP_SCRIPTS) $(DOCUMENTROOT)
clean:
@echo "make clean in src"
<?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/>.
*/
?>
<!doctype html>
<html lang="en">
<head>
<title>Elphel 393</title>
<meta charset="utf-8"/>
<script src="../js/jquery-3.1.1.js"></script>
<script src="save_single.js"></script>
<link rel="stylesheet" href="save_single.css">
<script>
<?php
$port0 = 2323;
$path = "/sys/devices/soc0/elphel393-detect_sensors@0";
$available_ports = Array();
for($i=0;$i<4;$i++){
$sensor = $path."/sensor{$i}0";
if (is_file($sensor)){
$c = trim(file_get_contents($sensor));
if ($c!="none"){
array_push($available_ports,$port0+$i);
}
}
}
if (count($available_ports)!=0){
echo " var ports = [".implode(",",$available_ports)."];\n";
//echo " var ports = [2324];\n";
}
?>
</script>
</head>
<body>
<div><button id='save'>SAVE</button></div>
</body>
</html>
#save{
font-family: Verdana, Geneva, sans-serif;
-webkit-transition-duration: 0.3s; /* Safari */
transition-duration: 0.3s;
color: rgba(150,50,50,1);
background-color: white;
border: 4px solid rgba(150,50,50,1);
font-size: 3em;
cursor: pointer;
border-radius: 2px;
padding: 16px 32px;
}
#save:hover{
color: white;
background: rgba(150,50,50,1);
}
#save:active {
background: rgba(150,50,50,1);
transform: translateY(2px);
}
/**
* @file save_single.js
* @brief save single shots (download synced images from all available ports)
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @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.
*/
$(function(){
init();
});
function init(){
$("#save").on("click",function(){
if (!$(this).prop("disabled")){
$(this).prop("disabled",true);
console.log("disable");
read_current_trig_period();
}else{
console.log("Disabled!");
}
});
}
function read_current_trig_period(){
$.ajax({
url: "http://"+window.location.host+"/parsedit.php?immediate&TRIG_PERIOD",
success: function(data){
var TRIG_PERIOD = $(data).find("TRIG_PERIOD").text();
download_all(TRIG_PERIOD);
restore_trig_period(TRIG_PERIOD);
}
});
}
function restore_trig_period(period){
$.ajax({
url: "http://"+window.location.host+"/parsedit.php?immeadiate&TRIG_PERIOD="+period+"*-2&sensor_port=0",
success: function(){
console.log("enable");
$("#save").prop("disabled",false);
console.log("Done");
}
});
}
function download_all(){
for(var i=0;i<ports.length;i++){
var tmp_href = "http://"+window.location.host+":"+ports[i]+"/img";
download(tmp_href);
}
}
function download(href){
var link = document.createElement('a');
link.setAttribute('download', null);
link.style.display = 'none';
document.body.appendChild(link);
link.setAttribute('href', href);
link.click();
document.body.removeChild(link);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment