Limit intensity range according to whether scrypt is in use or not.
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
diff --git a/api.c b/api.c
index 8c2d995..073cc08 100644
--- a/api.c
+++ b/api.c
@@ -532,7 +532,7 @@ struct CODES {
{ SEVERITY_ERR, MSG_MISVAL, PARAM_NONE, "Missing comma after GPU number" },
{ SEVERITY_ERR, MSG_NOADL, PARAM_NONE, "ADL is not available" },
{ SEVERITY_ERR, MSG_NOGPUADL,PARAM_GPU, "GPU %d does not have ADL" },
- { SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " _MIN_INTENSITY_STR " - " _MAX_INTENSITY_STR },
+ { SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " MIN_SHA_INTENSITY_STR " - " MAX_SCRYPT_INTENSITY_STR },
{ SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" },
{ SEVERITY_SUCC, MSG_MINECONFIG,PARAM_NONE, "CGMiner config" },
#ifdef HAVE_OPENCL
diff --git a/cgminer.c b/cgminer.c
index 788ceb3..14c5eec 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1041,10 +1041,18 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--lookup-gap",
set_lookup_gap, NULL, NULL,
"Set GPU lookup gap for scrypt mining, comma separated"),
-#endif
OPT_WITH_ARG("--intensity|-I",
set_intensity, NULL, NULL,
- "Intensity of GPU scanning (d or " _MIN_INTENSITY_STR " -> " _MAX_INTENSITY_STR ", default: d to maintain desktop interactivity)"),
+ "Intensity of GPU scanning (d or " MIN_SHA_INTENSITY_STR
+ " -> " MAX_SCRYPT_INTENSITY_STR
+ ",default: d to maintain desktop interactivity)"),
+#else
+ OPT_WITH_ARG("--intensity|-I",
+ set_intensity, NULL, NULL,
+ "Intensity of GPU scanning (d or " MIN_SHA_INTENSITY_STR
+ " -> " MAX_SHA_INTENSITY_STR
+ ",default: d to maintain desktop interactivity)"),
+#endif
#endif
OPT_WITH_ARG("--hotplug",
set_int_0_to_9999, NULL, &hotplug_time,
diff --git a/driver-opencl.c b/driver-opencl.c
index ec635b8..38995eb 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -789,7 +789,15 @@ retry:
wlogprint("Invalid selection\n");
goto retry;
}
- intvar = curses_input("Set GPU scan intensity (d or " _MIN_INTENSITY_STR " -> " _MAX_INTENSITY_STR ")");
+ if (opt_scrypt) {
+ intvar = curses_input("Set GPU scan intensity (d or "
+ MIN_SCRYPT_INTENSITY_STR " -> "
+ MAX_SCRYPT_INTENSITY_STR ")");
+ } else {
+ intvar = curses_input("Set GPU scan intensity (d or "
+ MIN_SHA_INTENSITY_STR " -> "
+ MAX_SHA_INTENSITY_STR ")");
+ }
if (!intvar) {
wlogprint("Invalid input\n");
goto retry;
diff --git a/miner.h b/miner.h
index 731cba8..a05c1e0 100644
--- a/miner.h
+++ b/miner.h
@@ -945,14 +945,24 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user
#define MAX_GPUDEVICES 16
#define MAX_DEVICES 4096
-#define MIN_INTENSITY -10
-#define _MIN_INTENSITY_STR "-10"
+#define MIN_SHA_INTENSITY -10
+#define MIN_SHA_INTENSITY_STR "-10"
+#define MAX_SHA_INTENSITY 14
+#define MAX_SHA_INTENSITY_STR "14"
+#define MIN_SCRYPT_INTENSITY 8
+#define MIN_SCRYPT_INTENSITY_STR "8"
+#define MAX_SCRYPT_INTENSITY 20
+#define MAX_SCRYPT_INTENSITY_STR "20"
#ifdef USE_SCRYPT
-#define MAX_INTENSITY 20
-#define _MAX_INTENSITY_STR "20"
+#define MIN_INTENSITY (opt_scrypt ? MIN_SCRYPT_INTENSITY : MIN_SHA_INTENSITY)
+#define MIN_INTENSITY_STR (opt_scrypt ? MIN_SCRYPT_INTENSITY_STR : MIN_SHA_INTENSITY_STR)
+#define MAX_INTENSITY (opt_scrypt ? MAX_SCRYPT_INTENSITY : MAX_SHA_INTENSITY)
+#define MAX_INTENSITY_STR (opt_scrypt ? MAX_SCRYPT_INTENSITY_STR : MAX_SHA_INTENSITY_STR)
#else
-#define MAX_INTENSITY 14
-#define _MAX_INTENSITY_STR "14"
+#define MIN_INTENSITY MIN_SHA_INTENSITY
+#define MIN_INTENSITY_STR MIN_SHA_INTENSITY_STR
+#define MAX_INTENSITY MAX_SHA_INTENSITY
+#define MAX_INTENSITY_STR MAX_SHA_INTENSITY_STR
#endif
extern bool hotplug_mode;