miner.php support DEVS in custom to show both GPU and PGA in one table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/miner.php b/miner.php
index 842da86..12facf9 100644
--- a/miner.php
+++ b/miner.php
@@ -76,13 +76,11 @@ $allowcustompages = true;
# see the example below (if there is no matching data, no total will show)
$mobilepage = array(
'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'),
- 'GPU' => array('GPU', 'Status', 'MHS av', 'Accepted', 'Rejected', 'Utility'),
- 'PGA' => array('ID', 'Name', 'Status', 'MHS av', 'Accepted', 'Rejected', 'Utility'),
+ 'DEVS' => array('ID', 'Name', 'GPU', 'Status', 'MHS av', 'Accepted', 'Rejected', 'Utility'),
'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected', 'Last Share Time'));
$mobilesum = array(
'SUMMARY' => array('MHS av' => 1, 'Found Blocks' => 1, 'Accepted' => 1, 'Rejected' => 1, 'Utility' => 1),
- 'GPU' => array('MHS av' => 1, 'Accepted' => 1, 'Rejected' => 1, 'Utility' => 1),
- 'PGA' => array('MHS av' => 1, 'Accepted' => 1, 'Rejected' => 1, 'Utility' => 1),
+ 'DEVS' => array('MHS av' => 1, 'Accepted' => 1, 'Rejected' => 1, 'Utility' => 1),
'POOL' => array('Accepted' => 1, 'Rejected' => 1));
#
# customsummarypages is an array of these Custom Summary Pages
@@ -1137,14 +1135,29 @@ function doOne($rig, $preprocess)
#
global $sectionmap;
# map sections to their api command
+# DEVS is a special case that will match GPU or PGA
+# so you can have a single table with both in it
$sectionmap = array(
'SUMMARY' => 'summary',
'POOL' => 'pools',
- 'GPU' => 'devs',
- 'PGA' => 'devs',
+ 'DEVS' => 'devs',
+ 'GPU' => 'devs', // You would normally use DEVS
+ 'PGA' => 'devs', // You would normally use DEVS
'NOTIFY' => 'notify',
'CONFIG' => 'config');
#
+function secmatch($section, $field)
+{
+ if ($section == $field)
+ return true;
+
+ if ($section == 'DEVS'
+ && ($field == 'GPU' || $field == 'PGA'))
+ return true;
+
+ return false;
+}
+#
function customset($showfields, $sum, $section, $num, $result, $total)
{
foreach ($result as $sec => $row)
@@ -1152,10 +1165,8 @@ function customset($showfields, $sum, $section, $num, $result, $total)
$secname = preg_replace('/\d/', '', $sec);
if ($sec != 'total')
- {
- if ($secname != $section)
+ if (!secmatch($section, $secname))
continue;
- }
echo '<tr>';
@@ -1176,7 +1187,7 @@ function customset($showfields, $sum, $section, $num, $result, $total)
{
$value = $row[$name];
- if (isset($sum[$secname][$name]))
+ if (isset($sum[$section][$name]))
{
if (isset($total[$name]))
$total[$name] += $value;
@@ -1192,7 +1203,7 @@ function customset($showfields, $sum, $section, $num, $result, $total)
$value = null;
}
- list($showvalue, $class) = fmt($section, $name, $value, $when, $row);
+ list($showvalue, $class) = fmt($secname, $name, $value, $when, $row);
if ($sec === 'total' and $class == '')
$class = ' class=tot';
@@ -1267,7 +1278,7 @@ function processcustompage($pagename, $sections, $sum)
foreach ($result as $sec => $row)
{
$secname = preg_replace('/\d/', '', $sec);
- if ($secname == $section && isset($row[$field]))
+ if (secmatch($section, $secname) && isset($row[$field]))
$showfields[$field] = 1;
}