Commit 047f4253 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. fixed trig bug 2. fixed restore period bug

parent 5b08f76f
......@@ -47,7 +47,7 @@
$trig_master_port = $trig_master + $port0;
}
if ($trig_master>0){
if ($trig_master>=0){
if (isset($_GET['trig'])){
// just in case one wants to override master
......@@ -57,7 +57,7 @@
$f = fopen("http://{$_SERVER['SERVER_ADDR']}:$trig_master_port/trig/pointers", 'r');
fclose($f);
die();
die("trigger ok: http://{$_SERVER['SERVER_ADDR']}:$trig_master_port/trig/pointers");
}
}
......@@ -131,6 +131,7 @@
<script>
var ip = location.origin;
var href = location.href;
var ports = [<?php echo implode(",",$available_ports);?>];
var trig_master = <?php echo $trig_master;?>;
var trig_master_port = <?php echo $trig_master_port;?>;
......
......@@ -6,46 +6,23 @@ function take_snapshot(){
$("#snapshot").attr("disabled",true);
if(ports.length!=0){
if ($("#synced").attr("checked")){
if ($("#synced").prop("checked")){
read_trig_master();
}else{
download_all(false);
}
}else{
console.log("No ports detected");
}
}
function read_trig_master(){
var param = "TRIG_MASTER";
$.ajax({
url: ip+"/parsedit.php?immediate&"+param,
success:function(data){
trig_master = parseInt($(data).find(param));
read_tp();
}
});
}
function read_tp(){
var param = "TRIG_PERIOD";
$.ajax({
url: ip+"/parsedit.php?immediate&"+param,
success:function(data){
tp_old = parseInt($(data).find(param));
trigger();
}
});
}
// channel independent or lowest?
function read_par(param,callback){
$.ajax({
url: ip+"/parsedit.php?immediate&"+param,
success:function(data){
tp_old = parseInt($(data).find("TRIG_MASTER"));
trig_master = parseInt($(data).find(param).text());
trigger();
}
});
......@@ -53,36 +30,15 @@ function read_par(param,callback){
function trigger(){
$.ajax({
url:ip+"?trig",
url:href+"?trig",
success:function(){
setTimeout(function(){
download_all(true);
},500);
}
});
}
function restore_trig_period(){
$.ajax({
url: ip+"/parsedit.php?immediate&TRIG_PERIOD="+(tp_old+1)+"*-2&sensor_port="+trig_master,
success: function(){
$.ajax({
url: ip+"/parsedit.php?immediate&TRIG_PERIOD="+(tp_old)+"*-2&sensor_port="+trig_master,
success: function(){
console.log("Done!");
$("#snapshot").attr("disabled",false);
}
});
},200);
}
});
}
function download_all(rtp){
......@@ -91,11 +47,12 @@ function download_all(rtp){
download_single(ip+":"+c+"/img");
});
// give 500ms (?)
if (rtp) {
setTimeout(function(){
restore_trig_period();
read_tp();
},200);
}else{
$("#snapshot").attr("disabled",false);
}
}
......@@ -116,6 +73,34 @@ function download_single(addr){
}
function read_tp(){
var param = "TRIG_PERIOD";
$.ajax({
url: ip+"/parsedit.php?immediate&"+param,
success:function(data){
tp_old = parseInt($(data).find(param).text());
restore_trig_period();
}
});
}
function restore_trig_period(){
console.log("restore period");
$.ajax({
url: ip+"/parsedit.php?immediate&TRIG_PERIOD="+(tp_old)+"*-2&sensor_port="+trig_master,
success: function(){
console.log("Done!");
$("#snapshot").attr("disabled",false);
}
});
}
function toggle_help(){
$("#help").toggle();
......
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