Implement menus to change temperature limits.
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
diff --git a/adl.c b/adl.c
index 997a2c0..9792f3c 100644
--- a/adl.c
+++ b/adl.c
@@ -720,10 +720,12 @@ void change_autosettings(int gpu)
{
struct gpu_adl *ga = &gpus[gpu].adl;
char input;
+ int val;
wlogprint("Target temperature: %d\n", ga->targettemp);
wlogprint("Overheat temperature: %d\n", ga->overtemp);
- wlogprint("Toggle [F]an auto [G]PU auto, change [T]arget [O]verheat\n");
+ wlogprint("Hysteresis differece: %d\n", opt_hysteresis);
+ wlogprint("Toggle [F]an auto [G]PU auto\nChange [T]arget [O]verheat [H]ysteresis\n");
wlogprint("Or press any other key to continue\n");
input = getch();
if (!strncasecmp(&input, "f", 1)) {
@@ -740,6 +742,25 @@ void change_autosettings(int gpu)
wlogprint("Resetting GPU engine clock to startup settings\n");
set_defaultengine(gpu);
}
+ } else if (!strncasecmp(&input, "t", 1)) {
+ val = curses_int("Enter target temperature for this GPU in °C (0-100)");
+ if (val < 0 || val > 100)
+ wlogprint("Invalid temperature");
+ else
+ ga->targettemp = val;
+ } else if (!strncasecmp(&input, "o", 1)) {
+ wlogprint("Enter oveheat temperature for this GPU in °C (%d-100)", ga->targettemp);
+ val = curses_int("");
+ if (val <= ga->targettemp || val > 100)
+ wlogprint("Invalid temperature");
+ else
+ ga->overtemp = val;
+ } else if (!strncasecmp(&input, "h", 1)) {
+ val = curses_int("Enter hysteresis temperature difference (0-10)");
+ if (val < 1 || val > 10)
+ wlogprint("Invalid value");
+ else
+ opt_hysteresis = val;
}
}
diff --git a/main.c b/main.c
index ef8e664..df145b7 100644
--- a/main.c
+++ b/main.c
@@ -1253,7 +1253,7 @@ static struct opt_table opt_config_table[] = {
#endif
#ifdef HAVE_ADL
OPT_WITH_ARG("--temp-hysteresis",
- set_int_0_to_10, opt_show_intval, &opt_hysteresis,
+ set_int_1_to_10, opt_show_intval, &opt_hysteresis,
"Set how much the temperature can fluctuate outside limits when automanaging speeds"),
OPT_WITH_ARG("--temp-overheat",
set_int_0_to_100, opt_show_intval, &opt_overheattemp,