Commit c13e620ab040da0d5b6bf774c72a35e0268ba9e9

Con Kolivas 2014-03-01T14:31:47

Convert and update values shown in the cointerra api output.

diff --git a/driver-cointerra.c b/driver-cointerra.c
index cb63264..d17c0aa 100644
--- a/driver-cointerra.c
+++ b/driver-cointerra.c
@@ -566,6 +566,11 @@ static void cta_parse_debug(struct cointerra_info *info, char *buf)
 	info->autovoltage = u8_from_msg(buf, CTA_STAT_AUTOVOLTAGE);
 	info->current_ps_percent = u8_from_msg(buf, CTA_STAT_POWER_PERCENT);
 	info->power_used = hu16_from_msg(buf,CTA_STAT_POWER_USED);
+	info->power_voltage = hu16_from_msg(buf,CTA_STAT_VOLTAGE);
+	info->ipower_used = hu16_from_msg(buf,CTA_STAT_IPOWER_USED);
+	info->ipower_voltage = hu16_from_msg(buf,CTA_STAT_IVOLTAGE);
+	info->power_temps[0] = hu16_from_msg(buf,CTA_STAT_PS_TEMP1);
+	info->power_temps[1] = hu16_from_msg(buf,CTA_STAT_PS_TEMP2);
 
 	mutex_unlock(&info->lock);
 }
@@ -1013,11 +1018,11 @@ static struct api_data *cta_api_stats(struct cgpu_info *cgpu)
 	/* Status readings */
 	for (i = 0; i < CTA_CORES; i++) {
 		sprintf(buf, "CoreTemp%d", i);
-		root = api_add_uint16(root, buf, &info->coretemp[i], false);
+		root = api_add_int16(root, buf, &info->coretemp[i], false);
 	}
-	root = api_add_uint16(root, "Ambient Low", &info->ambtemp_low, false);
-	root = api_add_uint16(root, "Ambient Avg", &info->ambtemp_avg, false);
-	root = api_add_uint16(root, "Ambient High", &info->ambtemp_high, false);
+	root = api_add_int16(root, "Ambient Low", &info->ambtemp_low, false);
+	root = api_add_int16(root, "Ambient Avg", &info->ambtemp_avg, false);
+	root = api_add_int16(root, "Ambient High", &info->ambtemp_high, false);
 	for (i = 0; i < CTA_PUMPS; i++) {
 		sprintf(buf, "PumpRPM%d", i);
 		root = api_add_uint16(root, buf, &info->pump_tachs[i], false);
@@ -1103,6 +1108,12 @@ static struct api_data *cta_api_stats(struct cgpu_info *cgpu)
 	root = api_add_uint8(root,"AV",&info->autovoltage, false);
 	root = api_add_uint8(root,"Power Supply Percent",&info->current_ps_percent, false);
 	root = api_add_uint16(root,"Power Used",&info->power_used, false);
+	root = api_add_uint16(root,"IOUT",&info->power_used, false);
+	root = api_add_uint16(root,"VOUT",&info->power_voltage, false);
+	root = api_add_uint16(root,"IIN",&info->ipower_used, false);
+	root = api_add_uint16(root,"VIN",&info->ipower_voltage, false);
+	root = api_add_uint16(root,"PSTemp1",&info->power_temps[0], false);
+	root = api_add_uint16(root,"PSTemp2",&info->power_temps[1], false);
 
 	return root;
 }
@@ -1119,9 +1130,9 @@ static void cta_statline_before(char *buf, size_t bufsiz, struct cgpu_info *coin
 		if (info->corefreqs[i] > freq)
 			freq = info->corefreqs[i];
 	}
-	max_volt /= 100;
+	max_volt /= 1000;
 
-	tailsprintf(buf, bufsiz, "%3dMHz %3.1fC %2.1fV", freq, cointerra->temp, max_volt);
+	tailsprintf(buf, bufsiz, "%4dMHz %3.1fC %3.2fV", freq, cointerra->temp, max_volt);
 }
 
 struct device_drv cointerra_drv = {
diff --git a/driver-cointerra.h b/driver-cointerra.h
index eb6175c..523012e 100644
--- a/driver-cointerra.h
+++ b/driver-cointerra.h
@@ -15,7 +15,7 @@
 #define CTA_READ_TIMEOUT 1
 #define CTA_READ_INTERVAL 100
 #define CTA_SCAN_INTERVAL 500
-#define CTA_RESET_TIMEOUT 200
+#define CTA_RESET_TIMEOUT 1000
 
 #define CTA_INIT_DIFF		32*0.9999847412109375
 
@@ -118,9 +118,15 @@
 #define CTA_STAT_UPTIME_MS	21
 #define CTA_STAT_HASHES		25
 #define CTA_STAT_FLUSHED_HASHES 33
-#define CTA_STAT_AUTOVOLTAGE  41
-#define CTA_STAT_POWER_PERCENT 42
-#define CTA_STAT_POWER_USED 43
+#define CTA_STAT_AUTOVOLTAGE	41
+#define CTA_STAT_POWER_PERCENT	42
+#define CTA_STAT_POWER_USED	43
+#define CTA_STAT_VOLTAGE	45
+#define CTA_STAT_IPOWER_USED	47
+#define CTA_STAT_IVOLTAGE	49
+#define CTA_STAT_PS_TEMP1	51
+#define CTA_STAT_PS_TEMP2	53
+
 
 #define CTA_CORES		8
 #define CTA_PUMPS		2
@@ -183,6 +189,11 @@ struct cointerra_info {
 	uint8_t  autovoltage;
 	uint8_t  current_ps_percent;
 	uint16_t power_used;
+	uint16_t power_voltage;
+	uint16_t ipower_used;
+	uint16_t ipower_voltage;
+	uint16_t power_temps[2];
+
 
 	/* Calculated totals based on work done and nonces found */
 	uint64_t hashes;