mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 14:58:01 +00:00
core: don't use magic numbers to set xintensity.
This commit is contained in:
parent
463668b878
commit
99fa25c27f
@ -603,7 +603,7 @@ char *set_xintensity(char *arg)
|
||||
if (nextptr == NULL)
|
||||
return "Invalid parameters for shader based intensity";
|
||||
val = atoi(nextptr);
|
||||
if (val < 1 || val > 9999)
|
||||
if (val < MIN_XINTENSITY || val > MAX_XINTENSITY)
|
||||
return "Invalid value passed to set shader intensity";
|
||||
|
||||
gpus[device].dynamic = false; // Disable dynamic intensity
|
||||
@ -613,7 +613,7 @@ char *set_xintensity(char *arg)
|
||||
|
||||
while ((nextptr = strtok(NULL, ",")) != NULL) {
|
||||
val = atoi(nextptr);
|
||||
if (val < 1 || val > 9999)
|
||||
if (val < MIN_XINTENSITY || val > MAX_XINTENSITY)
|
||||
return "Invalid value passed to set shader based intensity";
|
||||
gpus[device].dynamic = false; // Disable dynamic intensity
|
||||
gpus[device].intensity = 0; // Disable regular intensity
|
||||
@ -678,7 +678,7 @@ void manage_gpu(void)
|
||||
opt_loginput = true;
|
||||
immedok(logwin, true);
|
||||
clear_logwin();
|
||||
retry:
|
||||
retry: // TODO: refactor
|
||||
|
||||
for (gpu = 0; gpu < nDevs; gpu++) {
|
||||
struct cgpu_info *cgpu = &gpus[gpu];
|
||||
@ -865,14 +865,14 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
|
||||
intvar = curses_input("Set experimental GPU scan intensity (1 -> 999)"); // FIXME: no magic numbers
|
||||
intvar = curses_input("Set experimental GPU scan intensity (" MIN_XINTENSITY_STR " -> " MAX_XINTENSITY_STR ")");
|
||||
if (!intvar) {
|
||||
wlogprint("Invalid input\n");
|
||||
goto retry;
|
||||
}
|
||||
xintensity = atoi(intvar);
|
||||
free(intvar);
|
||||
if (xintensity < 1 || xintensity > 999) { // FIXME: no magic numbers
|
||||
if (xintensity < MIN_XINTENSITY || xintensity > MAX_XINTENSITY) {
|
||||
wlogprint("Invalid selection\n");
|
||||
goto retry;
|
||||
}
|
||||
|
4
miner.h
4
miner.h
@ -1050,6 +1050,10 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user
|
||||
#define MIN_INTENSITY_STR "8"
|
||||
#define MAX_INTENSITY 31
|
||||
#define MAX_INTENSITY_STR "31"
|
||||
#define MIN_XINTENSITY 1
|
||||
#define MIN_XINTENSITY_STR "1"
|
||||
#define MAX_XINTENSITY 999
|
||||
#define MAX_XINTENSITY_STR "999"
|
||||
|
||||
extern bool hotplug_mode;
|
||||
extern int hotplug_time;
|
||||
|
Loading…
Reference in New Issue
Block a user