Commit fc274359 authored by Adam Wujek's avatar Adam Wujek

[BUG: #242] www: fixes

Fix:
-Correct display of live information
-Display of temperatures in dashboard
-Display of Firmware version in dashboard
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 297b6aed
......@@ -38,7 +38,7 @@ $options = Array (
Array ("HOSTNAME","Hostname","uname -n","y"),
Array ("KERNEL","Kernel Version","uname -r","y"),
Array ("KERNELCOMPILEDDATE","Kernel Compiled Date","uname -v","y"),
Array ("FIRMWARE","Firmware Version","/wr/bin/wrs_version | awk '{print $4}'","y"),
Array ("FIRMWARE","Firmware Version","cat /tmp/www_wrs_version.txt | grep software-version | awk '{print $2}'","y"),
Array ("HARDWARE","Hardware Version","cat /tmp/www_wrs_version.txt | grep 'scb\|back' | sort -r | sed 's/back/ back/' | sed 's/-version: /: v/'","y"),
Array ("FPGA","FPGA Version","cat /tmp/www_wrs_version.txt | grep 'fpga-type' | sed 's/[^:]*: //'","y"),
Array ("COMPILEDBY","Compiled By","cat /tmp/www_wrs_version.txt | grep 'bult-by' | sed 's/[^:]*: //'","y"),
......
......@@ -191,7 +191,8 @@ function wrs_main_info(){
#Obtain the temperatures using the last line of (wr-mon -w)
$temperatures=shell_exec("cat /tmp/www_ports.txt 2>/dev/null | tail -1");
$arr = split(" ", $temperatures);
$temperatures = $arr[1];
array_shift($arr);
$temperatures = implode($arr, " ");
$ports = shell_exec("/wr/bin/wr_mon -w | tail -2 | head -1");
$arr2 = explode(" ", $ports);
......
......@@ -12,7 +12,7 @@ include 'functionsget.php';
$data = array();
array_push($data, getTemperatures(1));
array_push($data, getTemperatures());
array_push($data, getWrDate());
array_push($data, getTablePortStatus());
array_push($data, getTiming());
......
......@@ -29,7 +29,8 @@ function get_info(){
function updateValues(){
$("#sfp_panel").html(datainfo[2]);
$("#temp").text(datainfo[0]);
datainfo[0].shift();
$("#temp").text(datainfo[0].join(" "));
$("#datewr").html(datainfo[1][0] + '<br>' + datainfo[1][1]);
var status;
......
......@@ -60,9 +60,9 @@ function drawrowtable(data){
}
function drawtimingtable(data){
var names=[["WR time", "TAI"],["Switch time","UTC"],["Servo state", "ss"],["Round-trip time (mu)", "mu"],
var names=[["WR time", "TAI"],["Switch time","UTC"],["Servo state", "ss"],["Mean Delay (no deltas)", "md"],
["Master-slave delay","dms"],["Master PHY delays TX", "dtxm"], ["Master PHY delays RX", "drxm"],
["Slave PHY delays TX", "dtxs"],["Slave PHY delays RX", "drxs"], ["Total link asymmetry","asym"],
["Slave PHY delays TX", "dtxs"],["Slave PHY delays RX", "drxs"], ["Corrected Round-trip time (crtt)","crtt"], ["Total link asymmetry","asym"],
["Estimated link length","ll"],
["Clock offset", "cko"],["Phase setpoint","setp"],["Servo update counter","ucnt"]];
......@@ -71,34 +71,41 @@ function drawtimingtable(data){
var j=0;
data = data.split(",");
for (var i = 0; i < data.length; i++) {
if((data[i].match(/:/g) || []).length>1){
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i] + '</td></tr>';
j++;
}
else if((data[i].match(/:/g) || []).length==1){
data[i] = data[i].split(":");
if(data[i][0].indexOf("ss")>=0){
data[i][1] = data[i][1].replace("\'",'');
data[i][1] = data[i][1].replace("\'",'');
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1] + '</td></tr>';
j++;
}
else if(data[i][0].indexOf("ucnt")>=0){
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1] + ' times' + '</td></tr>';
j++;
}
else if(data[i][0].indexOf("ll")>=0){
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1]/100 + ' m ' + '</td></tr>';
j++;
if (i == 0 || i == 1)
tablewr += '<tr><td>' + names[i][0] + '</td><td>' + data[i] + '</td></tr>';
data[i] = data[i].split(":");
for (j = 0; j < names.length; j++) {
if (data[i][0] === names[j][1]) {
if (names[j][1] === "ucnt") {
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1] + ' times' + '</td></tr>';
} else if (names[j][1] === "ss") {
data[i][1] = data[i][1].replace("\'",'');
data[i][1] = data[i][1].replace("\'",'');
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1] + '</td></tr>';
} else if (names[j][1] === "dms"
|| names[j][1] === "dtxm"
|| names[j][1] === "drxm"
|| names[j][1] === "dtxs"
|| names[j][1] === "drxs"
) {
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + (data[i][1]*1000000000).toFixed(3) + ' nsec' + '</td></tr>';
} else if (names[j][1] === "md"
|| names[j][1] === "crtt"
|| names[j][1] === "setp"
|| names[j][1] === "asym"
|| names[j][1] === "cko"
) {
tablewr += '<tr><td>' + names[j][0] +'</td><td>' + data[i][1] + ' nsec' + '</td></tr>';
} else if (names[j][1] === "ll") {
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1] + ' meters' + '</td></tr>';
} else
tablewr += '<tr><td>' + names[j][0] +'</td><td>' + data[i][1] + '' + '</td></tr>';
}
else if(data[i][0].indexOf("sv")<0 && data[i][0].indexOf("crtt")<0 && data[i][0].indexOf("lock")<0){
tablewr += '<tr><td>' + names[j][0] + '</td><td>' + data[i][1]/1000 + ' nsec' + '</td></tr>';
j++;
}
}
}
tablewr += '</table></div>';
return tablewr;
}
......
......@@ -671,6 +671,9 @@ void show_ports(int hal_alive, int ppsi_alive)
term_cprintf(C_RED, " ");
term_cprintf(C_CYAN, "|");
}
if (mode == SHOW_GUI || mode == WEB_INTERFACE) {
instance_port = 0;
/*
......@@ -691,7 +694,7 @@ void show_ports(int hal_alive, int ppsi_alive)
* skip */
continue;
}
if (instance_port > 0) {
if (mode == SHOW_GUI && instance_port > 0) {
term_cprintf(C_CYAN, "\n | |");
}
instance_port++;
......@@ -718,6 +721,22 @@ void show_ports(int hal_alive, int ppsi_alive)
}
}
str_config[sizeof(str_config)-1]=0; // Force the string to be well terminated
if (mode == WEB_INTERFACE) {
unsigned char *p = ppi->activePeer;
printf("%-5s ", if_name);
printf("%s ", state_up(port_state)
? "up" : "down");
printf("%s ", str_config);
printf("%s ", port_state->locked
? "Locked" : "NoLock");
printf("%s ", port_state->calib.rx_calibrated
&& port_state->calib.tx_calibrated
? "Calibrated" : "Uncalibrated");
printf("%02x:%02x:%02x:%02x:%02x:%02x ",
p[0], p[1], p[2], p[3], p[4], p[5]);
printf("\n");
continue;
}
/* print instance number */
term_cprintf(C_WHITE, " %2d ", j);
term_cprintf(C_CYAN, "|");
......@@ -804,19 +823,13 @@ void show_ports(int hal_alive, int ppsi_alive)
}
}
}
if (!instance_port || !ppsi_alive) {
term_cprintf(C_WHITE, " -- ");
term_cprintf(C_CYAN, "| | | | | |");
if (mode == SHOW_GUI) {
if (!instance_port || !ppsi_alive) {
term_cprintf(C_WHITE, " -- ");
term_cprintf(C_CYAN, "| | | | | |");
}
term_cprintf(C_WHITE, "\n");
}
term_cprintf(C_WHITE, "\n");
} else if (mode & WEB_INTERFACE) {
printf("%s ", state_up(port_state)
? "up" : "down");
printf("%s ", port_state->locked
? "Locked" : "NoLock");
printf("%s ", port_state->calib.rx_calibrated
&& port_state->calib.tx_calibrated
? "Calibrated" : "Uncalibrated");
} else if (print_port) {
printf("port:%s ", if_name);
printf("lnk:%d ", state_up(port_state));
......@@ -1011,6 +1024,8 @@ void show_servo(struct inst_servo_t *servo, int alive)
/* SPEC shows temperature, but that can be selected separately
* in this program
*/
if (mode & WEB_INTERFACE)
printf("\n");
}
}
......@@ -1026,7 +1041,7 @@ void show_servos(int alive) {
void show_temperatures(void)
{
if ((mode == SHOW_GUI) || (mode & WEB_INTERFACE)) {
if (mode == SHOW_GUI) {
if (mode == SHOW_GUI) {
/* -------------------------------------------------------------------------------*/
term_cprintf(C_CYAN, "\n-------------------------------- Temperatures ---------------------------------\n");
......@@ -1052,12 +1067,16 @@ void show_temperatures(void)
printf("pll:%2.2f ", temp_sensors_local.pll/256.0);
printf("psl:%2.2f ", temp_sensors_local.psl/256.0);
printf("psr:%2.2f", temp_sensors_local.psr/256.0);
if (mode & WEB_INTERFACE)
printf("\n");
}
}
void show_time(void)
{
printf("TIME sec:%lld nsec:%d ", seconds, nanoseconds);
if (mode & WEB_INTERFACE)
printf("\n");
}
void show_all(void)
......@@ -1077,18 +1096,18 @@ void show_all(void)
ppsi_alive = (ppsi_head->pid && (kill(ppsi_head->pid, 0) == 0))
+ ignore_alive;
if (mode & SHOW_WR_TIME) {
if (mode & (SHOW_WR_TIME | WEB_INTERFACE)) {
if (ppsi_alive)
show_time();
else if (mode == SHOW_ALL)
printf("PPSI is dead!\n");
}
if ((mode & (SHOW_ALL_PORTS|WEB_INTERFACE)) || mode == SHOW_GUI) {
if ((mode & (SHOW_ALL_PORTS | WEB_INTERFACE)) || mode == SHOW_GUI) {
show_ports(hal_alive,ppsi_alive);
}
if (mode & SHOW_SERVO || mode == SHOW_GUI) {
if ((mode & (SHOW_SERVO | WEB_INTERFACE)) || mode == SHOW_GUI) {
show_servos(ppsi_alive);
}
......
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