Browse Source

miner.php split devs output for different devices

nfactor-troky
Kano 13 years ago
parent
commit
702dd0f86f
  1. 77
      miner.php

77
miner.php

@ -158,7 +158,8 @@ function fmt($section, $name, $value)
switch ($section.'.'.$name) switch ($section.'.'.$name)
{ {
case 'GPU0.Last Share Time': case 'GPU.Last Share Time':
case 'PGA.Last Share Time':
return date('H:i:s', $value); return date('H:i:s', $value);
break; break;
case 'SUMMARY.Elapsed': case 'SUMMARY.Elapsed':
@ -190,11 +191,13 @@ function fmt($section, $name, $value)
} }
} }
break; break;
case 'GPU0.Utility': case 'GPU.Utility':
case 'PGA.Utility':
case 'SUMMARY.Utility': case 'SUMMARY.Utility':
return $value.'/m'; return $value.'/m';
break; break;
case 'GPU0.Temperature': case 'GPU.Temperature':
case 'PGA.Temperature':
return $value.'°C'; return $value.'°C';
break; break;
} }
@ -202,8 +205,37 @@ function fmt($section, $name, $value)
return $value; return $value;
} }
# #
global $poolcmd;
$poolcmd = array( 'Switch to' => 'switchpool',
'Enable' => 'enablepool',
'Disable' => 'disablepool' );
#
function showhead($cmd, $item, $values)
{
global $poolcmd;
echo '<tr>';
foreach ($values as $name => $value)
{
if ($name == '0')
$name = '&nbsp;';
echo "<td valign=bottom class=h>$name</td>";
}
if ($cmd == 'pools')
foreach ($poolcmd as $name => $pcmd)
echo "<td valign=bottom class=h>$name</td>";
echo '</tr>';
}
#
function details($cmd, $list) function details($cmd, $list)
{ {
global $poolcmd;
$dfmt = 'H:i:s j-M-Y \U\T\CP';
$stas = array('S' => 'Success', 'W' => 'Warning', 'I' => 'Informational', 'E' => 'Error', 'F' => 'Fatal'); $stas = array('S' => 'Success', 'W' => 'Warning', 'I' => 'Informational', 'E' => 'Error', 'F' => 'Fatal');
$tb = '<tr><td><table border=1 cellpadding=5 cellspacing=0>'; $tb = '<tr><td><table border=1 cellpadding=5 cellspacing=0>';
@ -211,7 +243,7 @@ function details($cmd, $list)
echo $tb; echo $tb;
echo '<tr><td class=sta>Date: '.date('H:i:s j-M-Y \U\T\CP').'</td></tr>'; echo '<tr><td class=sta>Date: '.date($dfmt).'</td></tr>';
echo $te.$tb; echo $te.$tb;
@ -219,50 +251,31 @@ function details($cmd, $list)
{ {
echo '<tr>'; echo '<tr>';
echo '<td>Computer: '.$list['STATUS']['Description'].'</td>'; echo '<td>Computer: '.$list['STATUS']['Description'].'</td>';
if (isset($list['STATUS']['When']))
echo '<td>When: '.date($dfmt, $list['STATUS']['When']).'</td>';
$sta = $list['STATUS']['STATUS']; $sta = $list['STATUS']['STATUS'];
echo '<td>Status: '.$stas[$sta].'</td>'; echo '<td>Status: '.$stas[$sta].'</td>';
echo '<td>Message: '.$list['STATUS']['Msg'].'</td>'; echo '<td>Message: '.$list['STATUS']['Msg'].'</td>';
echo '</tr>'; echo '</tr>';
} }
echo $te.$tb;
$section = ''; $section = '';
$poolcmd = array( 'Switch to' => 'switchpool',
'Enable' => 'enablepool',
'Disable' => 'disablepool' );
foreach ($list as $item => $values) foreach ($list as $item => $values)
{ {
if ($item != 'STATUS') if ($item == 'STATUS')
{ continue;
$section = $item;
echo '<tr>'; $sectionname = ereg_replace('[0-9]', '', $item);
foreach ($values as $name => $value) if ($sectionname != $section)
{ {
if ($name == '0') echo $te.$tb;
$name = '&nbsp;'; showhead($cmd, $item, $values);
echo "<td valign=bottom class=h>$name</td>"; $section = $sectionname;
}
if ($cmd == 'pools')
foreach ($poolcmd as $name => $pcmd)
echo "<td valign=bottom class=h>$name</td>";
echo '</tr>';
break;
}
} }
foreach ($list as $item => $values)
{
if ($item == 'STATUS')
continue;
echo '<tr>'; echo '<tr>';
foreach ($values as $name => $value) foreach ($values as $name => $value)

Loading…
Cancel
Save