From e1c13575f8e3d53d44a94ceecffb968596cc5e2e Mon Sep 17 00:00:00 2001 From: skeezix Date: Wed, 17 Mar 2010 15:25:41 -0400 Subject: [PATCH 1/1] Blink the charger LED instead of the Power LED, when battery is low --- apps/pndevmapperd.c | 6 +++--- include/pnd_device.h | 1 + lib/pnd_device.c | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/pndevmapperd.c b/apps/pndevmapperd.c index c31cade..292b27e 100644 --- a/apps/pndevmapperd.c +++ b/apps/pndevmapperd.c @@ -781,21 +781,21 @@ void sigalrm_handler ( int n ) { pnd_log ( pndn_debug, "Battery is high again, flipping to non-blinker mode\n" ); b_active = 0; set_next_alarm ( b_frequency, 0 ); - pnd_device_set_led_power_brightness ( 250 ); + pnd_device_set_led_charger_brightness ( 250 ); return; } if ( b_active == 1 ) { // turn LED on pnd_log ( pndn_debug, "Blink on\n" ); - pnd_device_set_led_power_brightness ( 200 ); + pnd_device_set_led_charger_brightness ( 200 ); // set timer to short duration b_active = 2; set_next_alarm ( 0, b_blinkdur ); } else if ( b_active == 2 ) { // turn LED off pnd_log ( pndn_debug, "Blink off\n" ); - pnd_device_set_led_power_brightness ( 10 ); + pnd_device_set_led_charger_brightness ( 10 ); // back to longer duration b_active = 1; set_next_alarm ( b_blinkfreq, 0 ); diff --git a/include/pnd_device.h b/include/pnd_device.h index acd1298..f9a58a7 100644 --- a/include/pnd_device.h +++ b/include/pnd_device.h @@ -64,6 +64,7 @@ unsigned int pnd_device_get_backlight ( void ); // set one or more LEDs on unsigned char pnd_device_set_led_power_brightness ( unsigned char v ); // 0-255 +unsigned char pnd_device_set_led_charger_brightness ( unsigned char v ); // 0-255 // suspend/hibernate/etc diff --git a/lib/pnd_device.c b/lib/pnd_device.c index df9e108..d255c97 100644 --- a/lib/pnd_device.c +++ b/lib/pnd_device.c @@ -99,3 +99,11 @@ unsigned char pnd_device_set_led_power_brightness ( unsigned char v ) { return ( pnd_device_open_write_close ( PND_DEVICE_LED_POWER PND_DEVICE_LED_SUFFIX_BRIGHTNESS, buffer ) ); } + +unsigned char pnd_device_set_led_charger_brightness ( unsigned char v ) { + char buffer [ 100 ]; + + sprintf ( buffer, "%u", v ); + + return ( pnd_device_open_write_close ( PND_DEVICE_LED_CHARGER PND_DEVICE_LED_SUFFIX_BRIGHTNESS, buffer ) ); +} -- 2.39.2