make LowLoad / HighLoad lcdproc.conf parameters instead compile time options

This commit is contained in:
marschap
2006-09-11 17:33:05 +00:00
parent 82024b0cb1
commit 08c77e0bf7
4 changed files with 18 additions and 21 deletions
+4
View File
@@ -68,6 +68,10 @@ Active=True
[Load]
# Show screen
Active=True
# Min Load Avg at which the backlight will be turned off [default: 0.05]
LowLoad=0.05
# Max Load Avg at which the backlight will start blinking [default: 1.3]
HighLoad=1.3
[TimeDate]
+13 -4
View File
@@ -8,6 +8,7 @@
# include "config.h"
#endif
#include "shared/configfile.h"
#include "shared/sockets.h"
#include "main.h"
#include "mode.h"
@@ -30,13 +31,19 @@ xload_screen (int rep, int display, int *flags_ptr)
{
static int gauge_hgt = 0;
static double loads[LCD_MAX_WIDTH];
static double lowLoad = LOAD_MIN;
static double highLoad = LOAD_MAX;
int loadtop, i;
double loadmax = 0, factor;
int status = 0;
int status = BACKLIGHT_ON;
if ((*flags_ptr & INITIALIZED) == 0) {
*flags_ptr |= INITIALIZED;
/* get config values */
lowLoad = config_get_float("Load", "LowLoad", 0, LOAD_MIN);
highLoad = config_get_float("Load", "HighLoad", 0, LOAD_MAX);
gauge_hgt = (lcd_hgt > 2) ? (lcd_hgt - 1) : lcd_hgt;
memset (loads, '\0', sizeof (double) * LCD_MAX_WIDTH);
@@ -105,9 +112,11 @@ xload_screen (int rep, int display, int *flags_ptr)
sock_send_string (sock, tmp);
// set return status depending on max & current load
status = (loadmax > LOAD_MIN) ? BACKLIGHT_ON : BACKLIGHT_OFF;
if (loads[lcd_wid - 2] > LOAD_MAX)
status = BLINK_ON;
if (lowLoad < highLoad) {
status = (loadmax > lowLoad) ? BACKLIGHT_ON : BACKLIGHT_OFF;
if (loads[lcd_wid - 2] > highLoad)
status = BLINK_ON;
}
return status;
} // End xload_screen()
+1 -1
View File
@@ -5,7 +5,7 @@
#define LOAD_MAX 1.3
#endif
#ifndef LOAD_MIN
#define LOAD_MIN 0.5
#define LOAD_MIN 0.05
#endif
int xload_screen (int rep, int display, int *flags_ptr);
-16
View File
@@ -225,22 +225,6 @@ AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.3", [Define version of lcdproc client-se
AC_DEFINE_UNQUOTED(API_VERSION, "0.5", [Define version of lcdproc API])
AC_ARG_WITH(loadmax,
[ --with-loadmax=<load> Max Load Avg at which the backlight will]
[ start blinking [1.3]],
LOAD_MAX=$withval,
LOAD_MAX=1.3
)
AC_DEFINE_UNQUOTED(LOAD_MAX, $LOAD_MAX, [Define max Load Avg at which the backlight will start blinking])
AC_ARG_WITH(loadmin,
[ --with-loadmin=<load> Min Load Avg at which the backlight will]
[ turn off (asleep) [0.05]],
LOAD_MIN=$withval,
LOAD_MIN=0.05
)
AC_DEFINE_UNQUOTED(LOAD_MIN, $LOAD_MIN, [Define min Load Avg at which the backlight will turn off])
AC_MODULES_INFO
dnl ######################################################################