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
bd363b03
Commit
bd363b03
authored
May 19, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cherry-picked sys & fpga time updating from warrior branch
parent
92ec9d48
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
224 additions
and
186 deletions
+224
-186
index.php
src/index/index.php
+184
-177
utils.php
src/php_top/utils.php
+40
-9
No files found.
src/index/index.php
View file @
bd363b03
...
...
@@ -71,30 +71,25 @@
.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
;
}
</style>
</head>
<body>
<div
style=
'padding:10px'
>
<?php
<?php
include
"include/elphel_functions_include.php"
;
...
...
@@ -135,7 +130,7 @@
echo
"Camera Control Interface<ul>
$port_links
</ul>
\n
"
;
?>
?>
<table>
<tr
id=
"toggle_awb"
title=
'Auto White Balance'
>
<td>
...
...
@@ -177,28 +172,40 @@
<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
/>
</div>
<script>
var
jp4_previews_enable
=
true
;
var
jp4_previews_enable
=
true
;
$
(
function
(){
$
(
function
(){
check_time
();
init_awb_toggle
();
init_aexp_toggle
();
init_jp4_previews
();
});
});
function
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
(){
$
(
'.port_preview'
).
each
(
function
(){
index
=
parseInt
(
$
(
this
).
attr
(
"index"
));
if
(
jp4_previews_enable
)
{
$
(
this
).
jp4
({
ip
:
location
.
host
,
port
:
2323
+
index
,
width
:
300
,
fast
:
true
,
lowres
:
4
});
//$(this).jp4({src:"http://"+location.host+":"+(2323+index)+"/img",width:300,fast:true,lowres:4});
}
else
{
$
(
this
).
html
(
"<img width='300' src='http://"
+
location
.
host
+
":"
+
(
2323
+
index
)
+
"/img' />"
);
}
});
}
}
function
init_awb_toggle
(){
function
init_awb_toggle
(){
$
(
'#toggle_awb'
).
click
(
function
()
{
if
(
$
(
this
).
find
(
'.btn.active'
).
html
()
==
"ON"
){
...
...
@@ -230,7 +237,7 @@ function init_awb_toggle(){
});
});
}
}
function
init_aexp_toggle
(){
$
(
'#toggle_aexp'
).
click
(
function
()
{
...
...
src/php_top/utils.php
View file @
bd363b03
...
...
@@ -23,6 +23,9 @@ switch($cmd){
case
"sensors"
:
print
(
cmd_sensors
());
break
;
case
"time"
:
cmd_time
();
break
;
default
:
print
(
"OK"
);
}
...
...
@@ -37,12 +40,40 @@ function cmd_sensors(){
$res
.=
"
\t\t
<port index='
$i
' port='
$p
'>
$sensor
</port>
\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
)
\n
Camera 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
.=
"<Document>
\n
"
;
$xml
.=
$
re
s
;
$xml
.=
$s
;
$xml
.=
"</Document>
\n
"
;
return
$xml
;
}
...
...
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