Commit f0a58bae authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

test pattern and phases

parent c6456a78
...@@ -17,6 +17,10 @@ SRC_URI = "file://controls.html \ ...@@ -17,6 +17,10 @@ SRC_URI = "file://controls.html \
file://hwmon.html \ file://hwmon.html \
file://hwmon.js \ file://hwmon.js \
file://hwmon.php \ file://hwmon.php \
file://setup.css \
file://setup.html \
file://setup.js \
file://setup.php \
" "
S = "${WORKDIR}/" S = "${WORKDIR}/"
...@@ -32,6 +36,10 @@ do_install_append() { ...@@ -32,6 +36,10 @@ do_install_append() {
install -m 0644 ${WORKDIR}/hwmon.html ${D}/www/pages install -m 0644 ${WORKDIR}/hwmon.html ${D}/www/pages
install -m 0644 ${WORKDIR}/hwmon.js ${D}/www/pages install -m 0644 ${WORKDIR}/hwmon.js ${D}/www/pages
install -m 0644 ${WORKDIR}/hwmon.php ${D}/www/pages install -m 0644 ${WORKDIR}/hwmon.php ${D}/www/pages
install -m 0644 ${WORKDIR}/setup.css ${D}/www/pages
install -m 0644 ${WORKDIR}/setup.html ${D}/www/pages
install -m 0644 ${WORKDIR}/setup.js ${D}/www/pages
install -m 0644 ${WORKDIR}/setup.php ${D}/www/pages
} }
PACKAGES = " apps-web" PACKAGES = " apps-web"
......
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
.b{ .b{
border: 2px solid rgba(100,100,200,1); border: 2px solid rgba(100,100,200,1);
} }
input{
-moz-appearance: none;
border: 1px solid rgba(200,200,200,1);
}
</style> </style>
</head> </head>
<body onload='init()'> <body onload='init()'>
......
table tr td{
padding: 5px 0px 0px 5px;
text-align: center;
}
.nooutline{
/*font-weight:bold;*/
outline:none;
}
.nooutline:focus{
outline:none;
}
/* overrides */
.btn:disabled,.btn:disabled:hover{
background:gray;
border: 1px solid gray;
cursor:pointer;
}
.btn{
border-radius:3px;
}
input {
-moz-appearance: none;
border: 1px solid rgba(200,200,200,1);
}
\ No newline at end of file
<html>
<head>
<script src="js/jquery-2.2.3.min.js"></script>
<script src="setup.js"></script>
<script src="js/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="js/bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="setup.css"/>
</head>
<body onload='init()'>
</body>
</html>
\ No newline at end of file
var sensortype=14;
function init(){
var t = $("<table>").html("\
<tr>\
<td id='controls' valign='top'></td>\
<td id='pic1'></td>\
<td id='pic2'></td>\
</tr><tr>\
<td></td>\
<td id='pic3'></td>\
<td id='pic4'></td>\
</tr>");
$("body").append(t);
var port = 2323;
for(i=0;i<4;i++){
var url = "http://"+window.location.hostname+":"+(port+i)+"/noexif/img";
var ref = "http://"+window.location.hostname+":"+(port+i)+"/noexif/mimg";
a = $("<a>",{href:ref});
img = $("<img>",{id:"chn"+i}).css({
width: "500px"
});
img.attr("src",url);
img.attr("src_init",url);
$("#pic"+(i+1)).append($("<div>").append(a.append(img)));
img.load(function(){
d = new Date();
n = d.getTime();
this.src = $(this).attr("src_init")+"&"+n;
});
}
ct = $("<div style='padding-top:10px;'>");
tmpstr = "<table>\
<tr>\
<td>Sensors type:</td>\
<td><button id='s5'><b>5 MPix</b></button></td>\
<td><button id='s14'><b>14 MPix</b></button></td>\
</tr>\
</table>";
ct.html(tmpstr);
$("#controls").append(ct);
$("#s5").addClass("btn nooutline");
$("#s14").addClass("btn nooutline");
ct2 = $("<div style='padding-top:20px;'>");
tmpstr = "<tr><td>Chn&nbsp;</td><td>Test Pattern&nbsp;</td><td>Sensor Phase (0-7)&nbsp;</td></tr>";
for(i=0;i<4;i++){
tmpstr += "\
<tr>\
<td valign='bottom'>"+(i+1)+"</td>\
<td valign='bottom'><input type='checkbox' id='tp"+i+"' class='tp'/></td>\
<td valign='bottom'><input type='text' id='sp"+i+"' value='0' class='sp'/></td>\
</tr>\
";
}
ct2.html(tmpstr);
$("#controls").append(ct2);
$(".tp").css({
width:"20px",
height:"20px"
});
$(".sp").css({
width: "50px",
"text-align":"right"
});
$(".tp").change(function(){
var tmp = $(this).attr("id");
var index = tmp[2];
console.log("index= "+index+" state="+$(this).prop("checked"));
send_cmd("set_test_pattern",index,$(this).prop("checked"));
});
$(".sp").change(function(){
var tmp = $(this).attr("id");
var index = tmp[2];
console.log("index= "+index+" state="+$(this).val());
send_cmd("set_sensor_phase",index,$(this).val());
});
ct3 = $("<div style='padding-top:20px;'>");
var sdram_phase_button = $("<button>",{id:"sdram_phase",class:"btn btn-danger nooutline"}).html("<b>SDRAM phase scan</b> (~10-minute process)");
//ct3.prepend(sdram_phase_button);
$("#controls").append(ct3);
init_sensor_type();
}
function send_cmd(command,index,value){
$.ajax({
url: "setup.php?cmd="+command+"&chn="+index+"&val="+value,
complete: function(){
console.log("complete");
}
});
}
function init_sensor_type(){
$.ajax({
url: "setup.php?cmd=get_sensor_type",
complete: function(data){
r = JSON.parse(data.responseText);
if (r.sensortype==5){
sensortype=5;
$("#s5").addClass("btn-success");
$(".sp").css({
display:"none"
});
}
if (r.sensortype==14){
sensortype=14;
$("#s14").addClass("btn-success");
}
}
});
}
\ No newline at end of file
<?php
if (isset($_GET['cmd']))
$cmd = $_GET['cmd'];
else
$cmd = "do_nothing";
$sensor_type = get_sensor_type();
if ($cmd=="get_sensor_type"){
echo json_encode(array('sensortype'=>$sensor_type));
}
if ($cmd=="set_test_pattern"){
$chn = $_GET['chn'];
$val = $_GET['val'];
if ($sensor_type==5){
if ($val=="true"){
$regval = "0x90a00041";
}else{
$regval = "0x90a00000";
}
}
if ($sensor_type==14){
if ($val=="true"){
$regval = "0x30700002";
}else{
$regval = "0x30700000";
}
}
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes -c write_sensor_i2c $chn 1 0 $regval";
echo $str;
exec($str);
}
if ($cmd=="set_sensor_phase"){
$chn = $_GET['chn'];
$val = intval($_GET['val']);
if ($val<0) $val=0;
if ($val>7) $val=7;
if ($sensor_type==14){
$val += 8;
$regval = "0x31c0".dechex($val)."000";
}
$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\
-c control_sensor_memory $chn stop\
-c control_sensor_memory $chn reset\
-c control_sensor_memory $chn repetitive\
-c sleep_ms 500\
-c compressor_control $chn 0\
-c sleep_ms 500\
-c compressor_control $chn 3\
";
echo $str;
exec($str);
}
if ($cmd=="find_sdram_phase"){
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \
-c compressor_control $chn 1\
-c compressor_control $chn 0\
-c control_sensor_memory $chn stop\
-c control_sensor_memory $chn reset\
-c measure_all \"*DI\"
-c measure_all
-c control_sensor_memory $chn repetitive\
-c compressor_control $chn 3\
";
echo $str;
exec($str);
}
function get_sensor_type(){
$lastline = exec("cat /mnt/mmc/init_elphel393.sh | grep \"SENSOR_TYPE=\"");
$res = explode("=",$lastline);
$res[1] = intval($res[1]);
if (($res[1]!=5)&&($res[1]!=14)) $res[1]=0;
return $res[1];
}
?>
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