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
7c5638ab
Commit
7c5638ab
authored
May 14, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sensors testing script
parent
d21ae96f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
0 deletions
+123
-0
Makefile
src/php_top/Makefile
+1
-0
test_sensors.php
src/php_top/test_sensors.php
+122
-0
No files found.
src/php_top/Makefile
View file @
7c5638ab
...
@@ -18,6 +18,7 @@ PHP_SCRIPTS=i2c.php \
...
@@ -18,6 +18,7 @@ PHP_SCRIPTS=i2c.php \
phpinfo.php
\
phpinfo.php
\
raw.php
\
raw.php
\
snapfull.php
\
snapfull.php
\
test_sensors.php
\
tuneseq.php
\
tuneseq.php
\
utils.php
utils.php
...
...
src/php_top/test_sensors.php
0 → 100644
View file @
7c5638ab
<?php
/**
* @copyright Copyright (C) 2020 Elphel, Inc.
* SPDX-License-Identifier: GPL-3.0-or-later
*
* @author Oleg Dzhimiev <oleg@elphel.com>
* @brief Test sensors at all 10393 ports
*/
include
"include/elphel_functions_include.php"
;
$PORT_BASE
=
2323
;
$SENSOR_NONE
=
'none'
;
$SENSOR_MT9P006
=
"mt9p006"
;
function
apply_def_settings
(
$port
,
$pars
){
global
$PORT_BASE
;
$parsForMD5
=
array
(
'QUALITY'
=>
96
,
'WOI_WIDTH'
=>
2592
,
'WOI_HEIGHT'
=>
1936
,
'SENSOR_RUN'
=>
2
,
'COMPRESSOR_RUN'
=>
2
,
'GAINR'
=>
0x20000
,
'GAING'
=>
0x20000
,
'GAINB'
=>
0x20000
,
'GAINGB'
=>
0x20000
,
'COLOR'
=>
0
,
'AUTOEXP_ON'
=>
0
,
'WB_EN'
=>
0
,
'GAIN_MIN'
=>
0x10000
,
'GAIN_MAX'
=>
0x10000
,
'TESTSENSOR'
=>
0x10008
,
'EXPOS'
=>
10000
);
for
(
$i
=
0
;
$i
<
2
;
$i
++
){
elphel_set_P_arr
(
$port
,
$parsForMD5
);
$thisFrame
=
elphel_get_frame
(
$port
);
elphel_wait_frame_abs
(
$port
,
$thisFrame
+
3
);
}
}
function
run_test_mt9p006
(
$port
){
global
$PORT_BASE
;
$ref_md5sum
=
"e1f8f6c37d1d7ddd233a821338f812e5"
;
$p
=
$PORT_BASE
+
$port
;
$test_status
=
"ok"
;
$ahead
=
3
;
$parsForMD5
=
array
(
'QUALITY'
=>
96
,
'WOI_WIDTH'
=>
2592
,
'WOI_HEIGHT'
=>
1936
,
'SENSOR_RUN'
=>
2
,
'COMPRESSOR_RUN'
=>
2
,
'GAINR'
=>
0x20000
,
'GAING'
=>
0x20000
,
'GAINB'
=>
0x20000
,
'GAINGB'
=>
0x20000
,
'COLOR'
=>
0
,
'AUTOEXP_ON'
=>
0
,
'WB_EN'
=>
0
,
'GAIN_MIN'
=>
0x10000
,
'GAIN_MAX'
=>
0x10000
,
'TESTSENSOR'
=>
0x10008
,
'EXPOS'
=>
10000
);
// save pars to restore later
$parsSaved
=
elphel_get_P_arr
(
$port
,
$parsForMD5
);
// Spectr's cheating - double initialization
for
(
$i
=
0
;
$i
<
2
;
$i
++
){
elphel_set_P_arr
(
$port
,
$parsForMD5
);
$thisFrame
=
elphel_get_frame
(
$port
);
elphel_wait_frame_abs
(
$port
,
$thisFrame
+
$ahead
);
}
for
(
$i
=
0
;
$i
<
3
;
$i
++
){
$md5sum
=
md5
(
file_get_contents
(
"http://127.0.0.1:
$p
/noexif/next/wait/img"
));
if
(
$md5sum
!=
$ref_md5sum
){
print
(
"md5sum(
$i
) does not match reference (
$ref_md5sum
):
$md5sum
\n
"
);
$test_status
=
"fail"
;
}
}
// restore saved pars
elphel_set_P_arr
(
$port
,
$parsSaved
);
print
(
"RESULT:
$test_status
\n
"
);
}
if
(
isset
(
$_SERVER
[
'SERVER_ADDR'
])){
print
(
"<pre>"
);
}
$sensors
=
get_sensors
();
foreach
(
$sensors
as
$i
=>
$sensor
){
print
(
"Testing port
$i
:
\n
"
);
switch
(
$sensor
){
case
$SENSOR_MT9P006
:
run_test_mt9p006
(
$i
);
break
;
case
$SENSOR_NONE
:
print
(
"WARNING: No sensor attached to port
$i
. Test skipped.
\n
"
);
break
;
default
:
print
(
"WARNING: Unsupported sensor '
$sensor
'. Test skipped.
\n
"
);
}
}
print
(
"Done
\n
"
);
?>
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