Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meta-elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
meta-elphel393
Commits
8bc4a0fb
Commit
8bc4a0fb
authored
Jun 02, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched to sensding command through socket
parent
b90e1b55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
3 deletions
+45
-3
setup.php
recipes-core/apps-web/files/setup.php
+45
-3
No files found.
recipes-core/apps-web/files/setup.php
View file @
8bc4a0fb
<?php
$port
=
8888
;
if
(
isset
(
$_GET
[
'cmd'
]))
$cmd
=
$_GET
[
'cmd'
];
else
...
...
@@ -30,10 +32,10 @@ if ($cmd=="set_test_pattern"){
}
}
$str
=
"cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes -c write_sensor_i2c
$chn
1 0
$regval
"
;
echo
$str
;
exec
(
$str
);
$str
=
"write_sensor_i2c
$chn
1 0
$regval
"
.
"
\r\n
"
;
echo
send_cmd
(
$port
,
$str
);
//$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes -c ";
}
if
(
$cmd
==
"set_sensor_phase"
){
...
...
@@ -49,6 +51,19 @@ if ($cmd=="set_sensor_phase"){
$regval
=
"0x31c0"
.
dechex
(
$val
)
.
"000"
;
}
$str
=
"write_sensor_i2c
$chn
1 0
$regval
"
.
"
\r\n
"
;
$str
.=
"compressor_control
$chn
1"
.
"
\r\n
"
;
$str
.=
"control_sensor_memory
$chn
stop"
.
"
\r\n
"
;
$str
.=
"control_sensor_memory
$chn
reset"
.
"
\r\n
"
;
$str
.=
"control_sensor_memory
$chn
repetitive"
.
"
\r\n
"
;
$str
.=
"sleep_ms 500"
.
"
\r\n
"
;
$str
.=
"compressor_control
$chn
0"
.
"
\r\n
"
;
$str
.=
"sleep_ms 500"
.
"
\r\n
"
;
$str
.=
"compressor_control
$chn
3"
.
"
\r\n
"
;
echo
send_cmd
(
$port
,
$str
);
/*
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \
-c write_sensor_i2c $chn 1 0 $regval\
-c compressor_control $chn 1\
...
...
@@ -63,9 +78,23 @@ if ($cmd=="set_sensor_phase"){
echo $str;
exec($str);
*/
}
if
(
$cmd
==
"find_sdram_phase"
){
$str
=
"compressor_control
$chn
1"
.
"
\r\n
"
;
$str
.=
"compressor_control
$chn
0"
.
"
\r\n
"
;
$str
.=
"control_sensor_memory
$chn
stop"
.
"
\r\n
"
;
$str
.=
"control_sensor_memory
$chn
reset"
.
"
\r\n
"
;
$str
.=
"measure_all
\"
*DI
\"
"
.
"
\r\n
"
;
$str
.=
"measure_all"
.
"
\r\n
"
;
$str
.=
"control_sensor_memory
$chn
repetitive"
.
"
\r\n
"
;
$str
.=
"compressor_control
$chn
3"
.
"
\r\n
"
;
echo
send_cmd
(
$port
,
$str
);
/*
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \
-c compressor_control $chn 1\
-c compressor_control $chn 0\
...
...
@@ -79,6 +108,7 @@ if ($cmd=="find_sdram_phase"){
echo $str;
exec($str);
*/
}
function
get_sensor_type
(){
...
...
@@ -89,4 +119,16 @@ function get_sensor_type(){
return
$res
[
1
];
}
function
send_cmd
(
$port
,
$msg
){
$fp
=
fsockopen
(
"localhost"
,
$port
,
$errno
,
$errstr
,
30
);
if
(
!
$fp
)
{
return
"
$errstr
(
$errno
)<br />
\n
"
;
}
else
{
fwrite
(
$fp
,
"
$msg
\r\n
"
);
fclose
(
$fp
);
echo
"sent:
$msg
"
;
}
}
?>
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