Limit all hfa restarts for temperature control to no closer than 15 seconds apart.
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
diff --git a/driver-hashfast.c b/driver-hashfast.c
index fa6fc01..52fe825 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -983,6 +983,11 @@ static void hfa_temp_clock(struct cgpu_info *hashfast, struct hashfast_info *inf
if (!opt_hfa_target)
return;
+ /* Do no restarts at all if there has been one less than 15 seconds
+ * ago */
+ if (now_t - info->last_restart < 15)
+ return;
+
for (i = 0; i < info->asic_count ; i++) {
struct hf_die_data *hdd = &info->die_data[i];
@@ -1013,7 +1018,8 @@ static void hfa_temp_clock(struct cgpu_info *hashfast, struct hashfast_info *inf
continue;
hfa_increase_clock(hashfast, info, i);
}
- hdd->last_restart = now_t;
+ info->last_restart = hdd->last_restart = now_t;
+ break;
}
}
@@ -1054,6 +1060,7 @@ static int64_t hfa_scanwork(struct thr_info *thr)
if (unlikely(thr->work_restart)) {
restart:
+ info->last_restart = time(NULL);
thr->work_restart = false;
ret = hfa_send_frame(hashfast, HF_USB_CMD(OP_WORK_RESTART), 0, (uint8_t *)NULL, 0);
if (unlikely(!ret)) {
diff --git a/driver-hashfast.h b/driver-hashfast.h
index 65b6825..b94435c 100644
--- a/driver-hashfast.h
+++ b/driver-hashfast.h
@@ -118,6 +118,7 @@ struct hashfast_info {
double max_temp;
pthread_t read_thr;
+ time_t last_restart;
};
#endif /* USE_HASHFAST */