add avalon2-cutoff options
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
diff --git a/cgminer.c b/cgminer.c
index 63f8201..c3da2de 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1117,6 +1117,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_CBARG("--avalon2-voltage",
set_avalon2_voltage, NULL, &opt_set_avalon2_voltage,
"Set Avalon2 core voltage, in millivolts"),
+ OPT_WITH_ARG("--avalon2-cutoff",
+ set_int_0_to_100, opt_show_intval, &opt_avalon2_overheat,
+ "Set Avalon2 overheat cut off temperature"),
#endif
#ifdef USE_BAB
OPT_WITH_ARG("--bab-options",
diff --git a/driver-avalon2.c b/driver-avalon2.c
index d7c21a2..40e933e 100644
--- a/driver-avalon2.c
+++ b/driver-avalon2.c
@@ -51,6 +51,8 @@ int opt_avalon2_fan_max = AVA2_DEFAULT_FAN_MAX;
int opt_avalon2_voltage_min = AVA2_DEFAULT_VOLTAGE;
int opt_avalon2_voltage_max = AVA2_DEFAULT_VOLTAGE_MAX;
+int opt_avalon2_overheat = AVALON2_TEMP_OVERHEAT;
+
static inline uint8_t rev8(uint8_t d)
{
int i;
@@ -724,8 +726,8 @@ static int64_t avalon2_scanhash(struct thr_info *thr)
memcpy(send_pkg.data, &tmp, 4);
applog(LOG_DEBUG, "Avalon2: Temp max: %d, Cut off temp: %d",
- info->temp_max, avalon->cutofftemp);
- if (info->temp_max >= avlaon->cutofftemp)
+ info->temp_max, opt_avalon2_overheat);
+ if (info->temp_max >= opt_avalon2_overheat)
tmp = encode_voltage(0);
else
tmp = encode_voltage(info->set_voltage);
diff --git a/driver-avalon2.h b/driver-avalon2.h
index ca2e2df..40f11ca 100644
--- a/driver-avalon2.h
+++ b/driver-avalon2.h
@@ -37,6 +37,8 @@
#define AVA2_DEFAULT_FREQUENCY_MIN 300
#define AVA2_DEFAULT_FREQUENCY_MAX 2000
+#define AVALON2_TEMP_OVERHEAT 88
+
/* Avalon2 protocol package type */
#define AVA2_H1 'A'
#define AVA2_H2 'V'
@@ -132,6 +134,7 @@ struct avalon2_info {
extern char *set_avalon2_fan(char *arg);
extern char *set_avalon2_freq(char *arg);
extern char *set_avalon2_voltage(char *arg);
+extern int opt_avalon2_overheat;
#endif /* USE_AVALON2 */
#endif /* _AVALON2_H_ */