X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=breezed.git;a=blobdiff_plain;f=breezed.c;h=dd360c1b27041f7babf34fcc4ca9b7961fe9b59d;hp=498df00471f3ea8387c78971bcc9db50ddb8dba6;hb=c085baf951b1b3584a6d9c17eca5950f238eb1c8;hpb=00ff121c49ebc7d2b20137fc0165bf3e547ca331 diff --git a/breezed.c b/breezed.c index 498df00..dd360c1 100644 --- a/breezed.c +++ b/breezed.c @@ -40,7 +40,7 @@ const char *default_configuration_file = "/etc/breezed.conf"; const int polling_delay = 5; /* Minimum time between last change and a change down. */ -const int minimum_delay_to_go_down = 30; +const int minimum_delay_to_go_down = 10; /* Gap between a threshold to go up and a threshold to go down to reduce the oscillations. */ @@ -155,7 +155,7 @@ void define_temperature_thresholds(char *definition) { exit(EXIT_FAILURE); } - nb_temperature_thresholds = 1; + nb_temperature_thresholds = 0; char *s, *u; @@ -171,10 +171,8 @@ void define_temperature_thresholds(char *definition) { speed_names = safe_malloc(nb_temperature_thresholds * sizeof(char *)); - temperature_thresholds[0] = -1; - s = definition; - int k = 1; + int k = 0; while(s) { s = next_word(token, s, buffer_size); u = token; @@ -197,6 +195,17 @@ void define_temperature_thresholds(char *definition) { } k++; } + + if(nb_temperature_thresholds <= 0) { + fprintf(stderr, "There has to be at least one temperature.\n"); + exit(EXIT_FAILURE); + } + + if(temperature_thresholds[0] > 0) { + fprintf(stderr, "The lowest temperature has to be 0.\n"); + exit(EXIT_FAILURE); + } + } void evaluate_one_configuration_line(char *line, int line_number) { @@ -615,8 +624,10 @@ Written by Francois Fleuret (francois@fleuret.org).\n", nb_rounds_since_last_change = 0; last_level = new_level; if(debug) { - printf("Temperature is %dC setting the fan level to %d.\n", - temperature, new_level); + printf("Temperature is %dC setting the fan level to %d (%s).\n", + temperature, + new_level, + speed_names[new_level]); } }