Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
047f4253
Commit
047f4253
authored
Jun 23, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. fixed trig bug 2. fixed restore period bug
parent
5b08f76f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
58 deletions
+44
-58
index.php
src/snapshot/index.php
+4
-3
snapshot.js
src/snapshot/snapshot.js
+40
-55
No files found.
src/snapshot/index.php
View file @
047f4253
...
...
@@ -45,9 +45,9 @@
if
(
!
empty
(
$available_ports
)){
$trig_master
=
intval
(
elphel_get_P_value
(
$available_ports
[
0
]
-
$port0
,
ELPHEL_TRIG_MASTER
));
$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
;
?>
;
...
...
src/snapshot/snapshot.js
View file @
047f4253
...
...
@@ -2,100 +2,57 @@
var
tp_old
=
0
;
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
();
trig_master
=
parseInt
(
$
(
data
).
find
(
param
)
.
text
()
);
trigger
();
}
});
}
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"
));
trigger
();
}
});
}
function
trigger
(){
$
.
ajax
({
url
:
ip
+
"?trig"
,
url
:
href
+
"?trig"
,
success
:
function
(){
setTimeout
(
function
(){
download_all
(
true
);
},
5
00
);
},
2
00
);
}
});
}
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
);
}
});
}
});
}
function
download_all
(
rtp
){
ports
.
forEach
(
function
(
c
,
i
){
download_single
(
ip
+
":"
+
c
+
"/img"
);
});
// give 500ms (?)
if
(
rtp
)
{
setTimeout
(
function
(){
re
store_trig_period
();
re
ad_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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment