Commit b6b89c7d authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. added timeout for getting images in setup 2. /dev/sda,b temperatures

parent 498794a3
......@@ -8,8 +8,8 @@ var d0 = Array(600);
var d1 = Array(600);
var d2 = Array(600);
var ds = [Array(600),Array(600)];
var labels = ["CPU","389"];
var ds = [Array(600),Array(600),Array(600),Array(600)];
var labels = ["CPU","389","/dev/sda","/dev/sdb"];
var t = Array();
......@@ -28,7 +28,15 @@ var options = {
min: 0,
max: 100
},
colors: ['rgba(255,100,100,0.5)','rgba(255,150,20,0.5)','rgba(100,255,100,0.5)','rgba(0,0,0,1)','rgba(100,100,200,1)'],
colors: [
'rgba(255,100,100,0.5)',
'rgba(255,150, 20,0.5)',
'rgba(100,255,100,0.5)',
'rgba(0,0,0,1)',
'rgba(100,100,200,1)',
'rgba( 50,150, 50,1)',
'rgba( 50,150,150,1)'
],
legend:{
position: "nw"
},
......@@ -126,15 +134,17 @@ function read_core_temp(){
options.xaxis.tickSize = Math.max(1,Math.round(d1.length)/10);
points = [
{label: "Shutdown level", data: get_data(t,d0)},
{label: "CPU shutdown level", data: get_data(t,d0)},
{label: "Fan-On level", data: get_data(t,d1)},
{label: "Fan-Off level", data: get_data(t,d2)},
];
for(var i=0;i<temps.length;i++){
if (temps[i]!="-"){
ds[i].splice(0,1);
ds[i].push(temps[i]);
points.push({label: labels[i], data: get_data(t,ds[i])});
}
}
$.plot($("#t_chart"), points, options);
......
......@@ -8,6 +8,8 @@ else
if ($cmd=="t"){
$t_cpu = file_get_contents("/tmp/core_temp");
$t_10389 = "";
$t_sda = "";
$t_sdb = "";
$temp1_input = "/sys/devices/soc0/amba@0/e0004000.ps7-i2c/i2c-0/0-001a/hwmon/hwmon0/temp1_input";
......@@ -16,7 +18,15 @@ if ($cmd=="t"){
$t_10389 = intval($t_10389)/1000;
}
echo "$t_cpu $t_10389";
$t_sda = exec("smartctl -A /dev/sda | egrep ^194 | awk '{print $4}'");
if ($t_sda=="") $t_sda = "-";
else $t_sda = intval($t_sda);
$t_sdb = exec("smartctl -A /dev/sdb | egrep ^194 | awk '{print $4}'");
if ($t_sdb=="") $t_sdb = "-";
else $t_sdb = intval($t_sdb);
echo "$t_cpu $t_10389 $t_sda $t_sdb";
}
if ($cmd=="read"){
......
var sensortype=14;
var interval_refresh_images;
function init(){
var t = $("<table>").html("\
<tr>\
......@@ -30,11 +32,13 @@ function init(){
$("#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;'>");
......@@ -104,6 +108,17 @@ function init(){
init_sensor_type();
init_images();
}
function init_images(){
interval_refresh_images = setInterval(function(){
for(var j=0;j<4;j++){
d = new Date();
n = d.getTime();
$("#chn"+j).attr("src",$("#chn"+j).attr("src_init")+"&"+n);
}
},500);
}
function send_cmd(command,index,value){
......
......@@ -51,15 +51,39 @@ 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";
$str = "write_sensor_i2c $chn 1 0 $regval"."\r\n";
send_cmd($port,$str);
$str = "compressor_control $chn 1"."\r\n";
send_cmd($port,$str);
usleep(100000);
$str = "compressor_control $chn 0"."\r\n";
send_cmd($port,$str);
usleep(100000);
$str = "control_sensor_memory $chn stop"."\r\n";
send_cmd($port,$str);
usleep(100000);
$str = "control_sensor_memory $chn reset"."\r\n";
send_cmd($port,$str);
usleep(100000);
$str = "control_sensor_memory $chn stop"."\r\n";
send_cmd($port,$str);
usleep(100000);
$str = "control_sensor_memory $chn reset"."\r\n";
send_cmd($port,$str);
usleep(100000);
$str = "control_sensor_memory $chn repetitive"."\r\n";
send_cmd($port,$str);
//$str = "sleep_ms 500"."\r\n";
//send_cmd($port,$str);
usleep(500000);
$str = "compressor_control $chn 0"."\r\n";
send_cmd($port,$str);
//$str = "sleep_ms 500"."\r\n";
//send_cmd($port,$str);
usleep(500000);
$str = "compressor_control $chn 3"."\r\n";
echo send_cmd($port,$str);
......@@ -82,7 +106,7 @@ if ($cmd=="set_sensor_phase"){
}
if ($cmd=="find_sdram_phase"){
$chn = $_GET['chn'];
$str = "compressor_control $chn 1"."\r\n";
$str .= "compressor_control $chn 0"."\r\n";
$str .= "control_sensor_memory $chn stop"."\r\n";
......@@ -128,6 +152,7 @@ function send_cmd($port,$msg){
fwrite($fp,"$msg\r\n");
fclose($fp);
echo "sent: $msg";
usleep(100);
}
}
......
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