Reuse the cgpu temp entry for avalon and bitfury devices, changing avalon to a damped value.
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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
diff --git a/driver-avalon.c b/driver-avalon.c
index bb6121e..df91b19 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -843,7 +843,6 @@ static struct cgpu_info *avalon_detect_one(libusb_device *dev, struct usb_find_d
}
info->fan_pwm = AVALON_DEFAULT_FAN_MIN_PWM;
- info->temp_max = 0;
/* This is for check the temp/fan every 3~4s */
info->temp_history_count =
(4 / (float)((float)info->timeout * (AVALON_A3256 / info->asic) * ((float)1.67/0x32))) + 1;
@@ -1344,8 +1343,11 @@ static bool avalon_prepare(struct thr_info *thr)
return true;
}
-static inline void record_temp_fan(struct avalon_info *info, struct avalon_result *ar, float *temp_avg)
+static inline void record_temp_fan(struct cgpu_info *avalon, struct avalon_info *info,
+ struct avalon_result *ar)
{
+ double temp_max;
+
info->fan0 = ar->fan0 * AVALON_FAN_FACTOR;
info->fan1 = ar->fan1 * AVALON_FAN_FACTOR;
info->fan2 = ar->fan2 * AVALON_FAN_FACTOR;
@@ -1366,14 +1368,12 @@ static inline void record_temp_fan(struct avalon_info *info, struct avalon_resul
info->temp2 = 0 - ((~ar->temp2 & 0x7f) + 1);
}
- *temp_avg = info->temp2 > info->temp1 ? info->temp2 : info->temp1;
-
- if (info->temp0 > info->temp_max)
- info->temp_max = info->temp0;
- if (info->temp1 > info->temp_max)
- info->temp_max = info->temp1;
- if (info->temp2 > info->temp_max)
- info->temp_max = info->temp2;
+ temp_max = info->temp0;
+ if (info->temp1 > temp_max)
+ temp_max = info->temp1;
+ if (info->temp2 > temp_max)
+ temp_max = info->temp2;
+ avalon->temp = avalon->temp * 0.63 + temp_max * 0.37;
}
static void temp_rise(struct avalon_info *info, int temp)
@@ -1439,12 +1439,12 @@ static inline void adjust_fan(struct avalon_info *info)
static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *info,
struct avalon_result *ar)
{
- record_temp_fan(info, ar, &(avalon->temp));
+ record_temp_fan(avalon, info, ar);
applog(LOG_INFO,
"Avalon: Fan1: %d/m, Fan2: %d/m, Fan3: %d/m\t"
- "Temp1: %dC, Temp2: %dC, Temp3: %dC, TempMAX: %dC",
+ "Temp1: %dC, Temp2: %dC, Temp3: %dC, TempMAX: %.0fC",
info->fan0, info->fan1, info->fan2,
- info->temp0, info->temp1, info->temp2, info->temp_max);
+ info->temp0, info->temp1, info->temp2, avalon->temp);
info->temp_history_index++;
info->temp_sum += avalon->temp;
applog(LOG_DEBUG, "Avalon: temp_index: %d, temp_count: %d, temp_old: %d",
@@ -1603,7 +1603,7 @@ static struct api_data *avalon_api_stats(struct cgpu_info *cgpu)
root = api_add_int(root, "temp1", &(info->temp0), false);
root = api_add_int(root, "temp2", &(info->temp1), false);
root = api_add_int(root, "temp3", &(info->temp2), false);
- root = api_add_int(root, "temp_max", &(info->temp_max), false);
+ root = api_add_double(root, "temp_max", &cgpu->temp, false);
root = api_add_percent(root, "Device Hardware%", &hwp, true);
root = api_add_int(root, "no_matching_work", &(info->no_matching_work), false);
diff --git a/driver-avalon.h b/driver-avalon.h
index e2b944d..792c5a8 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -128,7 +128,6 @@ struct avalon_info {
int temp0;
int temp1;
int temp2;
- int temp_max;
int temp_history_count;
int temp_history_index;
int temp_sum;
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 9ff7cc1..6d42ace 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -562,7 +562,7 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
}
mutex_lock(&info->lock);
- info->temperature = (double)decitemp / 10;
+ bitfury->temp = (double)decitemp / 10;
if (decitemp > info->max_decitemp) {
info->max_decitemp = decitemp;
applog(LOG_DEBUG, "%s %d: New max decitemp %d", bitfury->drv->name,
@@ -1039,7 +1039,7 @@ static struct api_data *bf1_api_stats(struct bitfury_info *info)
return root;
}
-static struct api_data *bxf_api_stats(struct bitfury_info *info)
+static struct api_data *bxf_api_stats(struct cgpu_info *bitfury, struct bitfury_info *info)
{
struct api_data *root = NULL;
double nonce_rate;
@@ -1052,7 +1052,7 @@ static struct api_data *bxf_api_stats(struct bitfury_info *info)
nonce_rate = (double)info->total_nonces / (double)info->cycles;
root = api_add_double(root, "NonceRate", &nonce_rate, true);
root = api_add_int(root, "NoMatchingWork", &info->no_matching_work, false);
- root = api_add_double(root, "Temperature", &info->temperature, false);
+ root = api_add_double(root, "Temperature", &bitfury->temp, false);
root = api_add_int(root, "Max DeciTemp", &info->max_decitemp, false);
root = api_add_uint8(root, "Clock", &info->clocks, false);
root = api_add_int(root, "Core0 hwerror", &info->filtered_hw[0], false);
@@ -1074,7 +1074,7 @@ static struct api_data *bitfury_api_stats(struct cgpu_info *cgpu)
return bf1_api_stats(info);
break;
case IDENT_BXF:
- return bxf_api_stats(info);
+ return bxf_api_stats(cgpu, info);
break;
default:
break;
@@ -1088,7 +1088,7 @@ static void bitfury_get_statline_before(char *buf, size_t bufsiz, struct cgpu_in
switch(info->ident) {
case IDENT_BXF:
- tailsprintf(buf, bufsiz, "%5.1fC | ", info->temperature);
+ tailsprintf(buf, bufsiz, "%5.1fC | ", cgpu->temp);
break;
case IDENT_BF1:
default:
diff --git a/driver-bitfury.h b/driver-bitfury.h
index d3a3435..568688b 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -61,7 +61,6 @@ struct bitfury_info {
/* BXF specific data */
pthread_mutex_t lock;
pthread_t read_thr;
- double temperature;
int last_decitemp;
int max_decitemp;
int temp_target;
diff --git a/miner.h b/miner.h
index cfbf836..dc12443 100644
--- a/miner.h
+++ b/miner.h
@@ -472,7 +472,7 @@ struct cgpu_info {
bool new_work;
- float temp;
+ double temp;
int cutofftemp;
int diff1;