Commit baab9071 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

test page revived

parent 51ecb1e9
...@@ -22,8 +22,8 @@ function camogm_rec_start(){ ...@@ -22,8 +22,8 @@ function camogm_rec_start(){
console.log("camogm: begin recording"); console.log("camogm: begin recording");
//camogm_cmd("mount",false); //camogm_cmd("mount",false);
camogm_cmd("start",true); camogm_cmd("start",true);
if (!disable_intervals) intvl_camogm_status = setInterval("camogm_status(true)",10000); if (!disable_intervals) intvl_camogm_status = setInterval("camogm_status(true)",5000);
if (!disable_intervals) intvl_hdd_free_space = setInterval("camogm_get_ssd_free_space(false)",10000); if (!disable_intervals) intvl_hdd_free_space = setInterval("camogm_get_ssd_free_space(false)",5000);
} }
function camogm_rec_stop(){ function camogm_rec_stop(){
......
...@@ -40,7 +40,7 @@ var pc_footage_limit = 3000; ...@@ -40,7 +40,7 @@ var pc_footage_limit = 3000;
var pc_gps_imu_device_name = "/dev/sda1"; var pc_gps_imu_device_name = "/dev/sda1";
// TODO: reduce? // TODO: reduce?
var camogm_rec_delay = 5; var camogm_rec_delay = 1;
var cams = [ var cams = [
{"ip":"192.168.0.161","port":2326,"channel":3,"master":0,"logger":0}, {"ip":"192.168.0.161","port":2326,"channel":3,"master":0,"logger":0},
......
//global vars //global vars
var free_space_interval = false; var free_space_interval = false;
var master_ip = "161"; var master_ip = "163";
var logger_ip = "161"
var daemon_restart_en = true; var daemon_restart_en = true;
var intvl_temperatures; var intvl_temperatures;
var n = 8; var n = 8;
...@@ -22,15 +23,52 @@ var cams = [ ...@@ -22,15 +23,52 @@ var cams = [
]; ];
function get_master_index(){ function get_master_index(){
for (var i=0;i<cam.length;i++){ for (var i=0;i<cams.length;i++) if (cams[i].master==1) return i;
if (cams[i].master==1){ return -1;
return i; }
function get_logger_index(){
for (var i=0;i<cams.length;i++) if (cams[i].logger==1) return i;
return -1;
}
function get_unique_cams(){
res = [];
res_full = [];
for(var i=0;i<cams.length;i++){
if (res.indexOf(cams[i].ip)==-1) {
res.push(cams[i].ip);
res_full.push(cams[i]);
}
}
return res_full;
}
function get_unique_rq_str(){
res_full = get_unique_cams();
rq_str = "";
for(var i=0;i<res_full.length;i++){
if (i!=0){
rq_str += ",";
} }
rq_str += res_full[i].ip+":"+res_full[i].port+":"+res_full[i].channel+":"+res_full[i].master+":"+res_full[i].logger;
} }
return -1; return rq_str;
}
function cams_to_str(){
var rq_str = "";
for(var i=0;i<cams.length;i++){
if (i!=0){
rq_str += ",";
}
rq_str += cams[i].ip+":"+cams[i].port+":"+cams[i].channel+":"+cams[i].master+":"+cams[i].logger;
}
return rq_str;
} }
function parseURL() { function parseURL() {
/*
var parameters=location.href.replace(/\?/ig,"&").split("&"); var parameters=location.href.replace(/\?/ig,"&").split("&");
for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("="); for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("=");
for (var i=1;i<parameters.length;i++) { for (var i=1;i<parameters.length;i++) {
...@@ -39,6 +77,11 @@ function parseURL() { ...@@ -39,6 +77,11 @@ function parseURL() {
case "master_ip": master_ip = parseInt(parameters[i][1]);break; case "master_ip": master_ip = parseInt(parameters[i][1]);break;
} }
} }
*/
master_ip = cams[get_master_index()].ip;
logger_ip = cams[get_logger_index()].ip;
} }
function run(){ function run(){
...@@ -51,7 +94,7 @@ function test7_color_bars_part1(){ ...@@ -51,7 +94,7 @@ function test7_color_bars_part1(){
//color bars on //color bars on
set_parameter(master_ip,"TESTSENSOR",65544,true); set_parameter(master_ip,"TESTSENSOR",65544,true);
//to JPEG //to JPEG
set_parameter(master_ip,"COLOR",1,true); set_parameter(master_ip,"COLOR",0,true);
setTimeout("test7_color_bars_part2()",3000); setTimeout("test7_color_bars_part2()",3000);
} }
...@@ -78,7 +121,7 @@ function test6_t(){ ...@@ -78,7 +121,7 @@ function test6_t(){
function test5_imu(){ function test5_imu(){
$.ajax({ $.ajax({
url: "tests.php?cmd=imu&master_ip="+master_ip+"&n="+n, url: "tests.php?cmd=imu&rq="+logger_ip,
async: true, async: true,
success: function(response){ success: function(response){
test5_update_imu(response); test5_update_imu(response);
...@@ -89,12 +132,12 @@ function test5_imu(){ ...@@ -89,12 +132,12 @@ function test5_imu(){
function test5_update_imu(text){ function test5_update_imu(text){
var html = ""; var html = "";
var data = $(text).find("Document"); var data = $(text).find("board");
var imu = data.find("imu").text(); var imu = data.find("part").text();
if (imu=="1") html += "<div>IMU: OK</div>\n"; if (imu!="") html += "<div>IMU: OK ("+imu+")</div>\n";
else html += "<div class='alerts'>IMU not found</div>\n"; else html += "<div class='alerts'>IMU not found</div>\n";
$("#test_5_div").html(html); $("#test_5_div").html(html);
...@@ -104,7 +147,7 @@ function test5_update_imu(text){ ...@@ -104,7 +147,7 @@ function test5_update_imu(text){
function test4_gps(){ function test4_gps(){
$.ajax({ $.ajax({
url: "tests.php?cmd=gps&master_ip="+master_ip+"&n="+n, url: "tests.php?cmd=gps&rq="+logger_ip,
async: true, async: true,
success: function(response){ success: function(response){
test4_update_gps(response); test4_update_gps(response);
...@@ -138,7 +181,7 @@ function test4_update_gps(text){ ...@@ -138,7 +181,7 @@ function test4_update_gps(text){
html += "</table>"; html += "</table>";
} }
html += "<br/><span style='font-size:14px;'>Manual test: check the coordinates <a href='http://192.168.0."+master_ip+":8081/meta'>here</a>.</span>"; html += "<br/><span style='font-size:14px;'>Manual test: check the coordinates <a href='http://"+logger_ip+":2323/meta'>here</a>.</span>";
$("#test_4_div").html(html); $("#test_4_div").html(html);
...@@ -156,7 +199,7 @@ function test3_internal_cf_cards(){ ...@@ -156,7 +199,7 @@ function test3_internal_cf_cards(){
} }
$.ajax({ $.ajax({
url: "tests.php?cmd=cf_cards&rq="+rqstr, url: "tests.php?cmd=ssds&rq="+rqstr,
async: true, async: true,
success: function(response){ success: function(response){
test3_update_cards(response); test3_update_cards(response);
...@@ -200,7 +243,7 @@ function test3_update_cards(text){ ...@@ -200,7 +243,7 @@ function test3_update_cards(text){
$("#test_3_div").html(html); $("#test_3_div").html(html);
//run the next test //run the next test
//test4_gps(); test4_gps();
} }
function test1_get_number_of_sensors(){ function test1_get_number_of_sensors(){
...@@ -277,10 +320,9 @@ function test1_update_cams(text){ ...@@ -277,10 +320,9 @@ function test1_update_cams(text){
test3_internal_cf_cards(); test3_internal_cf_cards();
} }
function set_parameter(ip,par,val,async,callback){ function set_parameter(ip,par,val,async,callback){
var url = "eyesis4pi_control.php?set_parameter&master_ip="+ip+"&n="+n+"&pname="+par+"&pvalue="+val; //console.log("n is "+n);
var url = "eyesis4pi_control.php?set_parameter&rq="+cams_to_str()+"&pname="+par+"&pvalue="+val;
$.ajax({ $.ajax({
url: url, url: url,
...@@ -341,8 +383,8 @@ function previews_init(){ ...@@ -341,8 +383,8 @@ function previews_init(){
var c = "<table id='prevs_images'><tr>\n"; var c = "<table id='prevs_images'><tr>\n";
for (var i=1;i<(n+1);i++) { for (var i=0;i<cams.length;i++) {
c += "<td><a href='http://192.168.0.22"+(i)+"'><canvas id='cam"+i+"_canvas' class='prevs'></canvas></a></td>"; c += "<td><canvas id='cam_"+i+"_canvas' class='prevs'></canvas></td>";
} }
c+= "</tr></table>"; c+= "</tr></table>";
...@@ -362,6 +404,7 @@ function working(){ ...@@ -362,6 +404,7 @@ function working(){
else $("#status").html("Working"); else $("#status").html("Working");
} }
/*
function parseURL() { function parseURL() {
var parameters=location.href.replace(/\?/ig,"&").split("&"); var parameters=location.href.replace(/\?/ig,"&").split("&");
for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("="); for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("=");
...@@ -375,3 +418,4 @@ function parseURL() { ...@@ -375,3 +418,4 @@ function parseURL() {
if (n!=8&&n!=9) {eyesis4pi_en = false}; if (n!=8&&n!=9) {eyesis4pi_en = false};
console.log("eyesis4pi_en = "+eyesis4pi_en+" n = "+n); console.log("eyesis4pi_en = "+eyesis4pi_en+" n = "+n);
} }
*/
\ No newline at end of file
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<footage_limit>3000</footage_limit> <footage_limit>3000</footage_limit>
<gpsimu_device_name>/dev/sda1</gpsimu_device_name> <gpsimu_device_name>/dev/sda1</gpsimu_device_name>
<box_force_jp4>checked</box_force_jp4> <box_force_jp4>checked</box_force_jp4>
<input_quality>98</input_quality> <input_quality>97</input_quality>
<input_trigger_period>200</input_trigger_period> <input_trigger_period>250</input_trigger_period>
<input_hdrvexpos>0x36000</input_hdrvexpos> <input_hdrvexpos>0x36000</input_hdrvexpos>
<input_autoexp_max>1</input_autoexp_max> <input_autoexp_max>1</input_autoexp_max>
<input_autoexp_lvl>220</input_autoexp_lvl> <input_autoexp_lvl>220</input_autoexp_lvl>
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<head> <head>
<title>Eyesis4Pi tests</title> <title>Eyesis4Pi tests</title>
<link rel="shortcut icon" href="favicon.ico" /> <link rel="shortcut icon" href="favicon.ico" />
<script src="jquery-1.7.2.min.js" type="text/javascript"></script> <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="tests.js" type="text/javascript"></script> <script src="js/tests.js" type="text/javascript"></script>
<script src="temperatures.js" type="text/javascript"></script> <script src="js/temperatures.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="temperatures.css" /> <link rel="stylesheet" type="text/css" href="js/temperatures.css" />
<link rel="stylesheet" type="text/css" href="tests.css" /> <link rel="stylesheet" type="text/css" href="js/tests.css" />
</head> </head>
<body onload="run()"> <body onload="run()">
<h2>Test 1: Number of modules online</h2> <h2>Test 1: Number of modules online</h2>
<div id="test_1_div"></div> <div id="test_1_div"></div>
<!-- <h2>Test 2: Test pattern</h2> <!-- <h2>Test 2: Test pattern</h2>
<div id="test_2_div"></div>--> <div id="test_2_div"></div>-->
<h2>Test 2: Internal storage</h2> <h2>Test 2: Storage</h2>
<div id="test_3_div"></div> <div id="test_3_div"></div>
<h2>Test 3: GPS</h2> <h2>Test 3: GPS</h2>
<div id="test_4_div"></div> <div id="test_4_div"></div>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div id="test_5_div"></div> <div id="test_5_div"></div>
<h2>Test 5: Temperatures </h2> <h2>Test 5: Temperatures </h2>
<div id="test_6_div"></div> <div id="test_6_div"></div>
<h2>Test 6: Color bars </h2> <h2>Test 6: Test pattern </h2>
<div id="test_7_div"> <div id="test_7_div">
<table> <table>
<tr> <tr>
......
...@@ -56,7 +56,7 @@ if (isset($_GET['rq'])){ ...@@ -56,7 +56,7 @@ if (isset($_GET['rq'])){
$pc_time=@getdate(); $pc_time=@getdate();
if ($cmd=="cf_cards"){ if ($cmd=="ssds"){
for($i=0;$i<count($cams);$i++) { for($i=0;$i<count($cams);$i++) {
$cf_contents = file_get_contents("http://{$cams[$i]['ip']}/camogm_interface.php?cmd=list_partitions"); $cf_contents = file_get_contents("http://{$cams[$i]['ip']}/camogm_interface.php?cmd=list_partitions");
...@@ -76,20 +76,15 @@ if ($cmd=="cf_cards"){ ...@@ -76,20 +76,15 @@ if ($cmd=="cf_cards"){
} }
if ($cmd=="gps") { if ($cmd=="gps") {
$res_xml = @file_get_contents("http://".($cam_ip[0]).":8081/meta"); $res_xml = @file_get_contents("http://".($cams[0]['ip']).":2323/meta");
} }
if ($cmd=="imu"){ if ($cmd=="imu"){
$imu_contents = @file_get_contents("http://".($cam_ip[0])."/phpshell.php?command=dmesg%20|%20grep%20'IMU'"); //$imu_contents = @file_get_contents("http://".($cam_ip[0])."/eyesis4pi_interface.php?cmd=check_imu");
$imu_contents = @file_get_contents("http://".($cams[0]['ip'])."/i2c.php?cmd=fromEEPROM4&EEPROM_chn=3");
$imu = @preg_match("/IMU_ctl_open/",$imu_contents); echo $imu_contents;
if ($imu>0) $imu = 1;
$res_xml = "<Document>\n";
$res_xml .= "\t<imu>".$imu."</imu>\n";
$res_xml .= "</Document>";
} }
header("Content-Type: text/xml"); header("Content-Type: text/xml");
......
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