2002-06-24 13:48:42 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
2008-11-26 08:26:13 +00:00
|
|
|
* Additional work by Martin Ritter (2007) and Thomas Martitz (2008)
|
|
|
|
* for backlight thread fading
|
2002-06-24 13:48:42 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-06-24 13:48:42 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
2004-10-07 08:38:51 +00:00
|
|
|
#include "cpu.h"
|
2002-06-24 13:48:42 +00:00
|
|
|
#include "kernel.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "i2c.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "rtc.h"
|
2002-06-29 23:01:10 +00:00
|
|
|
#include "usb.h"
|
2002-10-01 10:59:36 +00:00
|
|
|
#include "power.h"
|
2003-11-06 01:34:50 +00:00
|
|
|
#include "system.h"
|
2006-08-08 22:03:56 +00:00
|
|
|
#include "button.h"
|
2005-07-26 20:01:11 +00:00
|
|
|
#include "timer.h"
|
2005-11-21 23:55:39 +00:00
|
|
|
#include "backlight.h"
|
2008-03-19 00:34:56 +00:00
|
|
|
#include "lcd.h"
|
2009-02-10 23:43:37 +00:00
|
|
|
#include "screendump.h"
|
2002-06-24 13:48:42 +00:00
|
|
|
|
2005-04-15 13:51:19 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#include "lcd-remote.h"
|
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
|
2007-04-12 22:12:13 +00:00
|
|
|
#ifndef SIMULATOR
|
iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization
- Separated iBasso devices from PLATFORM_ANDROID. These are now standlone
hosted targets. Most device specific code is in the
firmware/target/hosted/ibasso directory.
- No dependency on Android SDK, only the Android NDK is needed.
32 bit Android NDK and Android API Level 16.
- Separate implementation for each device where feasible.
Code cleanup
- Rewrite of existing code, from simple reformat to complete reimplementation.
- New backlight interface, seperating backlight from touchscreen.
- Rewrite of device button handler, removing unneeded code and fixing memory
leaks.
- New Debug messages interface logging to Android adb logcat (DEBUGF, panicf,
logf).
- Rewrite of lcd device handler, removing unneeded code and fixing memory leaks.
- Rewrite of audiohw device handler/pcm interface, removing unneeded code and
fixing memory leaks, enabling 44.1/48kHz pthreaded playback.
- Rewrite of power and powermng, proper shutdown, using batterylog results
(see http://gerrit.rockbox.org/r/#/c/1047/).
- Rewrite of configure (Android NDK) and device specific config.
- Rewrite of the Android NDK specific Makefile.
Misc
- All plugins/games/demos activated.
- Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa.
Includes
- http://gerrit.rockbox.org/r/#/c/993/
- http://gerrit.rockbox.org/r/#/c/1010/
- http://gerrit.rockbox.org/r/#/c/1035/
Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight
interface and new option for hold switch, touchscreen, physical button
interaction.
Rockbox needs the iBasso DX50/DX90 loader for startup, see
http://gerrit.rockbox.org/r/#/c/1099/
The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If
/mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit
gracefully and the loader will restart Rockbox on USB disconnect.
Tested on iBasso DX50.
Compiled (not tested) for iBasso DX90.
Compiled (not tested) for PLATFORM_ANDROID.
Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-02-02 20:44:29 +00:00
|
|
|
/*
|
|
|
|
Device specific implementation:
|
|
|
|
bool backlight_hw_init(void);
|
|
|
|
void backlight_hw_on(void);
|
|
|
|
void backlight_hw_off(void);
|
|
|
|
void backlight_hw_brightness(int brightness);
|
|
|
|
*/
|
2006-03-22 14:17:45 +00:00
|
|
|
#include "backlight-target.h"
|
2009-04-26 02:27:11 +00:00
|
|
|
#else
|
|
|
|
#include "backlight-sim.h"
|
2006-03-22 14:17:45 +00:00
|
|
|
#endif
|
2005-04-15 13:51:19 +00:00
|
|
|
|
2010-06-21 17:26:50 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT)
|
2010-06-21 17:10:22 +00:00
|
|
|
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
2009-01-22 10:50:11 +00:00
|
|
|
#include "backlight-sw-fading.h"
|
2008-11-26 08:26:13 +00:00
|
|
|
#endif
|
2006-03-19 17:42:58 +00:00
|
|
|
|
2009-04-28 08:57:38 +00:00
|
|
|
#define BACKLIGHT_FADE_IN_THREAD \
|
|
|
|
(CONFIG_BACKLIGHT_FADING & (BACKLIGHT_FADING_SW_SETTING \
|
|
|
|
|BACKLIGHT_FADING_SW_HW_REG \
|
|
|
|
|BACKLIGHT_FADING_PWM) )
|
|
|
|
|
2009-04-26 00:47:35 +00:00
|
|
|
#define BACKLIGHT_THREAD_TIMEOUT HZ
|
|
|
|
|
2007-11-12 18:49:53 +00:00
|
|
|
enum {
|
|
|
|
BACKLIGHT_ON,
|
|
|
|
BACKLIGHT_OFF,
|
2009-04-24 08:54:10 +00:00
|
|
|
BACKLIGHT_TMO_CHANGED,
|
2009-05-01 03:18:20 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
BACKLIGHT_BRIGHTNESS_CHANGED,
|
|
|
|
#endif
|
2007-11-12 18:49:53 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
REMOTE_BACKLIGHT_ON,
|
|
|
|
REMOTE_BACKLIGHT_OFF,
|
2009-04-24 08:54:10 +00:00
|
|
|
REMOTE_BACKLIGHT_TMO_CHANGED,
|
2007-11-12 18:49:53 +00:00
|
|
|
#endif
|
|
|
|
#if defined(_BACKLIGHT_FADE_BOOST) || defined(_BACKLIGHT_FADE_ENABLE)
|
|
|
|
BACKLIGHT_FADE_FINISH,
|
|
|
|
#endif
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP
|
2007-11-12 18:49:53 +00:00
|
|
|
LCD_SLEEP,
|
2006-08-08 22:03:56 +00:00
|
|
|
#endif
|
2007-04-22 13:02:24 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2007-11-12 18:49:53 +00:00
|
|
|
BUTTON_LIGHT_ON,
|
|
|
|
BUTTON_LIGHT_OFF,
|
2009-04-24 08:54:10 +00:00
|
|
|
BUTTON_LIGHT_TMO_CHANGED,
|
2009-05-01 03:18:20 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
BUTTON_LIGHT_BRIGHTNESS_CHANGED,
|
2007-04-22 13:02:24 +00:00
|
|
|
#endif
|
2009-05-01 03:18:20 +00:00
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2008-05-10 18:00:11 +00:00
|
|
|
#ifdef BACKLIGHT_DRIVER_CLOSE
|
|
|
|
BACKLIGHT_QUIT,
|
|
|
|
#endif
|
2007-11-12 18:49:53 +00:00
|
|
|
};
|
2002-06-24 13:48:42 +00:00
|
|
|
|
|
|
|
static void backlight_thread(void);
|
2005-02-06 02:43:26 +00:00
|
|
|
static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
2004-08-03 05:58:46 +00:00
|
|
|
static const char backlight_thread_name[] = "backlight";
|
2011-02-14 11:27:45 +00:00
|
|
|
static struct event_queue backlight_queue SHAREDBSS_ATTR;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
static bool ignore_backlight_on = false;
|
|
|
|
static int backlight_ignored_timer = 0;
|
2008-05-10 18:00:11 +00:00
|
|
|
#ifdef BACKLIGHT_DRIVER_CLOSE
|
2008-12-10 08:57:10 +00:00
|
|
|
static unsigned int backlight_thread_id = 0;
|
2008-05-10 18:00:11 +00:00
|
|
|
#endif
|
2002-06-24 13:48:42 +00:00
|
|
|
|
2009-04-25 18:15:50 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
int backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
|
|
|
|
#endif
|
2008-04-06 15:15:44 +00:00
|
|
|
static int backlight_timer SHAREDBSS_ATTR;
|
2007-08-10 21:55:48 +00:00
|
|
|
static int backlight_timeout_normal = 5*HZ;
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
static int backlight_timeout_plugged = 5*HZ;
|
|
|
|
#endif
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
static int backlight_on_button_hold = 0;
|
|
|
|
#endif
|
2009-04-26 00:47:35 +00:00
|
|
|
static void backlight_timeout_handler(void);
|
2005-11-21 23:55:39 +00:00
|
|
|
|
2007-04-22 13:02:24 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2007-10-07 15:02:02 +00:00
|
|
|
static int buttonlight_timer;
|
2009-04-25 18:15:50 +00:00
|
|
|
static int buttonlight_timeout = 5*HZ;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
static bool ignore_buttonlight_on = false;
|
|
|
|
static int buttonlight_ignored_timer = 0;
|
2007-05-10 03:08:47 +00:00
|
|
|
|
|
|
|
/* Update state of buttonlight according to timeout setting */
|
|
|
|
static void buttonlight_update_state(void)
|
|
|
|
{
|
2009-04-25 18:15:50 +00:00
|
|
|
buttonlight_timer = buttonlight_timeout;
|
2007-05-10 03:08:47 +00:00
|
|
|
|
|
|
|
/* Buttonlight == OFF in the setting? */
|
2007-10-07 15:02:02 +00:00
|
|
|
if (buttonlight_timer < 0)
|
2007-05-10 03:08:47 +00:00
|
|
|
{
|
2007-10-07 15:02:02 +00:00
|
|
|
buttonlight_timer = 0; /* Disable the timeout */
|
2015-01-08 23:22:40 +00:00
|
|
|
buttonlight_hw_off();
|
2007-05-10 03:08:47 +00:00
|
|
|
}
|
|
|
|
else
|
2015-01-08 23:22:40 +00:00
|
|
|
buttonlight_hw_on();
|
2007-05-10 03:08:47 +00:00
|
|
|
}
|
|
|
|
|
2007-04-22 13:02:24 +00:00
|
|
|
/* external interface */
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2007-10-07 15:02:02 +00:00
|
|
|
void buttonlight_on(void)
|
2007-04-22 13:02:24 +00:00
|
|
|
{
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if(!ignore_buttonlight_on)
|
|
|
|
{
|
|
|
|
queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON);
|
|
|
|
queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void buttonlight_on_ignore(bool value, int timeout)
|
|
|
|
{
|
|
|
|
ignore_buttonlight_on = value;
|
|
|
|
buttonlight_ignored_timer = timeout;
|
2007-04-22 13:02:24 +00:00
|
|
|
}
|
|
|
|
|
2007-10-07 15:02:02 +00:00
|
|
|
void buttonlight_off(void)
|
2007-04-22 13:02:24 +00:00
|
|
|
{
|
|
|
|
queue_post(&backlight_queue, BUTTON_LIGHT_OFF, 0);
|
|
|
|
}
|
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
void buttonlight_set_timeout(int value)
|
2007-04-22 13:02:24 +00:00
|
|
|
{
|
2009-04-25 18:15:50 +00:00
|
|
|
buttonlight_timeout = HZ * value;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, BUTTON_LIGHT_TMO_CHANGED, 0);
|
2007-04-22 13:02:24 +00:00
|
|
|
}
|
|
|
|
|
2009-04-25 18:15:50 +00:00
|
|
|
int buttonlight_get_current_timeout(void)
|
|
|
|
{
|
|
|
|
return buttonlight_timeout;
|
|
|
|
}
|
|
|
|
|
2008-05-10 18:00:11 +00:00
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2007-04-22 13:02:24 +00:00
|
|
|
|
2005-04-15 16:16:26 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
static int remote_backlight_timer;
|
2007-08-10 21:55:48 +00:00
|
|
|
static int remote_backlight_timeout_normal = 5*HZ;
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2005-11-23 20:12:33 +00:00
|
|
|
static int remote_backlight_timeout_plugged = 5*HZ;
|
|
|
|
#endif
|
2006-09-10 02:00:40 +00:00
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
static int remote_backlight_on_button_hold = 0;
|
|
|
|
#endif
|
2008-05-10 18:00:11 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2002-06-24 13:48:42 +00:00
|
|
|
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP
|
2008-05-14 19:29:25 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
2006-08-08 22:03:56 +00:00
|
|
|
const signed char lcd_sleep_timeout_value[10] =
|
|
|
|
{
|
|
|
|
-1, 0, 5, 10, 15, 20, 30, 45, 60, 90
|
|
|
|
};
|
2008-05-14 19:29:25 +00:00
|
|
|
static int lcd_sleep_timeout = 10*HZ;
|
|
|
|
#else
|
|
|
|
/* Target defines needed value */
|
2009-04-25 18:15:50 +00:00
|
|
|
#define lcd_sleep_timeout LCD_SLEEP_TIMEOUT
|
2006-08-08 22:03:56 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-21 21:49:29 +00:00
|
|
|
static int lcd_sleep_timer SHAREDDATA_ATTR = 0;
|
2008-05-14 19:29:25 +00:00
|
|
|
|
2009-04-26 01:23:39 +00:00
|
|
|
static void backlight_lcd_sleep_countdown(bool start)
|
2008-05-14 19:29:25 +00:00
|
|
|
{
|
|
|
|
if (!start)
|
|
|
|
{
|
|
|
|
/* Cancel the LCD sleep countdown */
|
|
|
|
lcd_sleep_timer = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start LCD sleep countdown */
|
|
|
|
if (lcd_sleep_timeout < 0)
|
|
|
|
{
|
|
|
|
lcd_sleep_timer = 0; /* Setting == Always */
|
2009-04-21 21:49:29 +00:00
|
|
|
/* Ensure lcd_sleep() is called from backlight_thread() */
|
2009-04-26 01:23:39 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
|
2009-04-21 21:49:29 +00:00
|
|
|
queue_post(&backlight_queue, LCD_SLEEP, 0);
|
|
|
|
#else
|
2008-05-14 19:29:25 +00:00
|
|
|
lcd_sleep();
|
2009-04-21 21:49:29 +00:00
|
|
|
#endif
|
2008-05-14 19:29:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lcd_sleep_timer = lcd_sleep_timeout;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_LCD_SLEEP */
|
|
|
|
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
2008-11-26 08:26:13 +00:00
|
|
|
static int backlight_fading_type = (FADING_UP|FADING_DOWN);
|
|
|
|
static int backlight_fading_state = NOT_FADING;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-06-20 17:03:09 +00:00
|
|
|
/* backlight fading */
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
|
2007-11-26 23:10:20 +00:00
|
|
|
#define BL_PWM_INTERVAL 5 /* Cycle interval in ms */
|
|
|
|
#define BL_PWM_BITS 8
|
|
|
|
#define BL_PWM_COUNT (1<<BL_PWM_BITS)
|
|
|
|
|
|
|
|
/* s15.16 fixed point variables */
|
|
|
|
static int32_t bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/300;
|
|
|
|
static int32_t bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/2000;
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
static int32_t bl_dim_fraction = 0;
|
2005-06-18 12:53:57 +00:00
|
|
|
|
2007-01-12 20:26:23 +00:00
|
|
|
static int bl_dim_target = 0;
|
2007-11-26 23:10:20 +00:00
|
|
|
static int bl_dim_current = 0;
|
2005-06-20 17:03:09 +00:00
|
|
|
static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
|
2007-11-26 23:10:20 +00:00
|
|
|
static bool bl_timer_active = false;
|
2005-06-18 12:53:57 +00:00
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
static void backlight_isr(void)
|
2005-06-18 12:53:57 +00:00
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
int timer_period = (TIMER_FREQ*BL_PWM_INTERVAL/1000);
|
2005-06-19 10:12:11 +00:00
|
|
|
bool idle = false;
|
2007-07-27 17:53:43 +00:00
|
|
|
|
|
|
|
switch (bl_dim_state)
|
2005-07-26 20:01:11 +00:00
|
|
|
{
|
2005-06-20 17:03:09 +00:00
|
|
|
/* New cycle */
|
|
|
|
case DIM_STATE_START:
|
2007-11-26 23:10:20 +00:00
|
|
|
bl_dim_current = bl_dim_fraction >> 16;
|
2007-07-27 17:53:43 +00:00
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
if (bl_dim_current > 0 && bl_dim_current < BL_PWM_COUNT)
|
2005-06-20 17:03:09 +00:00
|
|
|
{
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_on_isr();
|
2007-11-26 23:10:20 +00:00
|
|
|
timer_period = (timer_period * bl_dim_current) >> BL_PWM_BITS;
|
2005-06-18 12:53:57 +00:00
|
|
|
bl_dim_state = DIM_STATE_MAIN;
|
2007-07-27 17:53:43 +00:00
|
|
|
}
|
2005-06-20 17:03:09 +00:00
|
|
|
else
|
|
|
|
{
|
2005-06-18 12:53:57 +00:00
|
|
|
if (bl_dim_current)
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_on_isr();
|
2005-06-18 12:53:57 +00:00
|
|
|
else
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_off_isr();
|
2005-06-20 17:03:09 +00:00
|
|
|
if (bl_dim_current == bl_dim_target)
|
|
|
|
idle = true;
|
2005-06-18 12:53:57 +00:00
|
|
|
}
|
2007-11-26 23:10:20 +00:00
|
|
|
if (bl_dim_current < bl_dim_target)
|
|
|
|
{
|
|
|
|
bl_dim_fraction = MIN(bl_dim_fraction + bl_fade_in_step,
|
|
|
|
(BL_PWM_COUNT<<16));
|
|
|
|
}
|
|
|
|
else if (bl_dim_current > bl_dim_target)
|
|
|
|
{
|
|
|
|
bl_dim_fraction = MAX(bl_dim_fraction - bl_fade_out_step, 0);
|
|
|
|
}
|
|
|
|
break;
|
2007-07-27 17:53:43 +00:00
|
|
|
|
2005-06-20 17:03:09 +00:00
|
|
|
/* Dim main screen */
|
|
|
|
case DIM_STATE_MAIN:
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_off_isr();
|
2007-11-26 23:10:20 +00:00
|
|
|
timer_period = (timer_period * (BL_PWM_COUNT - bl_dim_current))
|
|
|
|
>> BL_PWM_BITS;
|
2005-06-18 12:53:57 +00:00
|
|
|
bl_dim_state = DIM_STATE_START;
|
|
|
|
break ;
|
|
|
|
}
|
2007-07-27 17:53:43 +00:00
|
|
|
if (idle)
|
2005-06-20 17:03:09 +00:00
|
|
|
{
|
2007-11-12 18:49:53 +00:00
|
|
|
#if defined(_BACKLIGHT_FADE_BOOST) || defined(_BACKLIGHT_FADE_ENABLE)
|
|
|
|
queue_post(&backlight_queue, BACKLIGHT_FADE_FINISH, 0);
|
2006-03-19 17:42:58 +00:00
|
|
|
#endif
|
2005-07-26 20:01:11 +00:00
|
|
|
timer_unregister();
|
2005-06-20 17:03:09 +00:00
|
|
|
bl_timer_active = false;
|
2009-04-21 21:49:29 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
if (bl_dim_current == 0)
|
|
|
|
backlight_lcd_sleep_countdown(true);
|
|
|
|
#endif
|
2005-06-20 17:03:09 +00:00
|
|
|
}
|
2005-07-26 20:01:11 +00:00
|
|
|
else
|
|
|
|
timer_set_period(timer_period);
|
|
|
|
}
|
2005-06-20 17:03:09 +00:00
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
static void backlight_switch(void)
|
|
|
|
{
|
|
|
|
if (bl_dim_target > (BL_PWM_COUNT/2))
|
|
|
|
{
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_on_normal();
|
2007-11-26 23:10:20 +00:00
|
|
|
bl_dim_fraction = (BL_PWM_COUNT<<16);
|
2005-07-26 20:01:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_off_normal();
|
2007-11-26 23:10:20 +00:00
|
|
|
bl_dim_fraction = 0;
|
2009-04-21 21:49:29 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
backlight_lcd_sleep_countdown(true);
|
|
|
|
#endif
|
2005-07-26 20:01:11 +00:00
|
|
|
}
|
2005-06-18 12:53:57 +00:00
|
|
|
}
|
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
static void backlight_release_timer(void)
|
2005-06-18 12:53:57 +00:00
|
|
|
{
|
2007-11-12 18:49:53 +00:00
|
|
|
#ifdef _BACKLIGHT_FADE_BOOST
|
2006-12-05 20:21:11 +00:00
|
|
|
cpu_boost(false);
|
2006-03-19 17:42:58 +00:00
|
|
|
#endif
|
2005-07-26 20:01:11 +00:00
|
|
|
timer_unregister();
|
|
|
|
bl_timer_active = false;
|
|
|
|
backlight_switch();
|
2005-06-18 12:53:57 +00:00
|
|
|
}
|
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
static void backlight_dim(int value)
|
2005-06-18 12:53:57 +00:00
|
|
|
{
|
2005-08-11 21:22:54 +00:00
|
|
|
/* protect from extraneous calls with the same target value */
|
|
|
|
if (value == bl_dim_target)
|
|
|
|
return;
|
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
bl_dim_target = value;
|
2005-06-18 12:53:57 +00:00
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
if (bl_timer_active)
|
|
|
|
return ;
|
2005-06-18 12:53:57 +00:00
|
|
|
|
2009-06-29 14:29:46 +00:00
|
|
|
if (timer_register(0, backlight_release_timer, 2, backlight_isr
|
2008-04-04 19:38:46 +00:00
|
|
|
IF_COP(, CPU)))
|
2005-07-26 20:01:11 +00:00
|
|
|
{
|
2007-11-12 18:49:53 +00:00
|
|
|
#ifdef _BACKLIGHT_FADE_BOOST
|
2005-07-26 20:01:11 +00:00
|
|
|
/* Prevent cpu frequency changes while dimming. */
|
2006-12-05 20:21:11 +00:00
|
|
|
cpu_boost(true);
|
2006-03-19 17:42:58 +00:00
|
|
|
#endif
|
2005-07-26 20:01:11 +00:00
|
|
|
bl_timer_active = true;
|
2005-06-20 17:03:09 +00:00
|
|
|
}
|
2005-07-26 20:01:11 +00:00
|
|
|
else
|
|
|
|
backlight_switch();
|
2005-06-18 12:53:57 +00:00
|
|
|
}
|
|
|
|
|
2009-04-28 08:57:38 +00:00
|
|
|
static void backlight_setup_fade_up(void)
|
2005-11-21 23:55:39 +00:00
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
if (bl_fade_in_step > 0)
|
2007-11-12 18:49:53 +00:00
|
|
|
{
|
|
|
|
#ifdef _BACKLIGHT_FADE_ENABLE
|
|
|
|
_backlight_hw_enable(true);
|
|
|
|
#endif
|
2005-11-21 23:55:39 +00:00
|
|
|
backlight_dim(BL_PWM_COUNT);
|
2007-11-12 18:49:53 +00:00
|
|
|
}
|
2005-11-21 23:55:39 +00:00
|
|
|
else
|
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
bl_dim_target = BL_PWM_COUNT;
|
|
|
|
bl_dim_fraction = (BL_PWM_COUNT<<16);
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_on_normal();
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
|
|
|
}
|
2005-06-18 12:53:57 +00:00
|
|
|
|
2009-04-28 08:57:38 +00:00
|
|
|
static void backlight_setup_fade_down(void)
|
2004-10-07 08:38:51 +00:00
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
if (bl_fade_out_step > 0)
|
2007-11-12 18:49:53 +00:00
|
|
|
{
|
2005-07-26 20:01:11 +00:00
|
|
|
backlight_dim(0);
|
2007-11-12 18:49:53 +00:00
|
|
|
}
|
2005-06-20 17:03:09 +00:00
|
|
|
else
|
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
bl_dim_target = bl_dim_fraction = 0;
|
2007-11-12 18:49:53 +00:00
|
|
|
_backlight_off_normal();
|
2009-04-28 08:57:38 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
backlight_lcd_sleep_countdown(true);
|
|
|
|
#endif
|
2009-04-21 21:49:29 +00:00
|
|
|
}
|
2004-10-07 08:38:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-26 23:10:20 +00:00
|
|
|
void backlight_set_fade_in(int value)
|
2004-10-07 08:38:51 +00:00
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
if (value > 0)
|
|
|
|
bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16) / value;
|
|
|
|
else
|
|
|
|
bl_fade_in_step = 0;
|
2006-07-28 12:41:13 +00:00
|
|
|
}
|
|
|
|
|
2007-11-26 23:10:20 +00:00
|
|
|
void backlight_set_fade_out(int value)
|
2006-07-28 12:41:13 +00:00
|
|
|
{
|
2007-11-26 23:10:20 +00:00
|
|
|
if (value > 0)
|
|
|
|
bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16) / value;
|
|
|
|
else
|
|
|
|
bl_fade_out_step = 0;
|
2006-07-28 12:41:13 +00:00
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
|
2009-01-26 23:21:49 +00:00
|
|
|
#elif (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
2008-11-26 08:26:13 +00:00
|
|
|
|
|
|
|
void backlight_set_fade_out(bool value)
|
|
|
|
{
|
|
|
|
if(value) /* on */
|
|
|
|
backlight_fading_type |= FADING_DOWN;
|
|
|
|
else
|
|
|
|
backlight_fading_type &= FADING_UP;
|
|
|
|
}
|
|
|
|
|
|
|
|
void backlight_set_fade_in(bool value)
|
|
|
|
{
|
|
|
|
if(value) /* on */
|
|
|
|
backlight_fading_type |= FADING_UP;
|
|
|
|
else
|
|
|
|
backlight_fading_type &= FADING_DOWN;
|
|
|
|
}
|
|
|
|
|
2009-01-26 23:21:49 +00:00
|
|
|
static void backlight_setup_fade_up(void)
|
2008-11-26 08:26:13 +00:00
|
|
|
{
|
|
|
|
if (backlight_fading_type & FADING_UP)
|
|
|
|
{
|
|
|
|
if (backlight_fading_state == NOT_FADING)
|
|
|
|
{
|
|
|
|
/* make sure the backlight is at lowest level */
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_on();
|
2008-11-26 08:26:13 +00:00
|
|
|
}
|
|
|
|
backlight_fading_state = FADING_UP;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
backlight_fading_state = NOT_FADING;
|
|
|
|
_backlight_fade_update_state(backlight_brightness);
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_on();
|
|
|
|
backlight_hw_brightness(backlight_brightness);
|
2008-11-26 08:26:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-26 23:21:49 +00:00
|
|
|
static void backlight_setup_fade_down(void)
|
2008-11-26 08:26:13 +00:00
|
|
|
{
|
|
|
|
if (backlight_fading_type & FADING_DOWN)
|
|
|
|
{
|
|
|
|
backlight_fading_state = FADING_DOWN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
backlight_fading_state = NOT_FADING;
|
|
|
|
_backlight_fade_update_state(MIN_BRIGHTNESS_SETTING-1);
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_off();
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
|
|
|
/* write the lowest brightness level to the hardware so that
|
|
|
|
* fading up is glitch free */
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_brightness(MIN_BRIGHTNESS_SETTING);
|
2009-04-28 08:57:38 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
backlight_lcd_sleep_countdown(true);
|
2008-11-26 08:26:13 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2009-01-26 23:21:49 +00:00
|
|
|
#endif /* CONFIG_BACKLIGHT_FADING */
|
2008-11-26 08:26:13 +00:00
|
|
|
|
2009-04-28 08:57:38 +00:00
|
|
|
static inline void do_backlight_off(void)
|
|
|
|
{
|
|
|
|
backlight_timer = 0;
|
|
|
|
#if BACKLIGHT_FADE_IN_THREAD
|
|
|
|
backlight_setup_fade_down();
|
|
|
|
#else
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_off();
|
2009-04-28 08:57:38 +00:00
|
|
|
/* targets that have fading need to start the countdown when done with
|
|
|
|
* fading */
|
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
backlight_lcd_sleep_countdown(true);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-08-08 22:03:56 +00:00
|
|
|
/* Update state of backlight according to timeout setting */
|
|
|
|
static void backlight_update_state(void)
|
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
|
|
|
|
int timeout = backlight_get_current_timeout();
|
2006-08-08 22:03:56 +00:00
|
|
|
|
|
|
|
/* Backlight == OFF in the setting? */
|
2009-04-25 21:11:16 +00:00
|
|
|
if (UNLIKELY(timeout < 0))
|
2006-08-08 22:03:56 +00:00
|
|
|
{
|
2009-04-28 08:57:38 +00:00
|
|
|
do_backlight_off();
|
2009-11-23 23:30:55 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
2009-01-26 23:21:49 +00:00
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
2009-11-23 23:30:55 +00:00
|
|
|
/* necessary step to issue fading down when the setting is selected */
|
|
|
|
if (queue_empty(&backlight_queue))
|
|
|
|
queue_post(&backlight_queue, SYS_TIMEOUT, 0);
|
2008-11-26 08:26:13 +00:00
|
|
|
#endif
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
backlight_timer = timeout;
|
2009-04-26 01:23:39 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
backlight_lcd_sleep_countdown(false); /* wake up lcd */
|
|
|
|
#endif
|
|
|
|
|
2009-04-28 08:57:38 +00:00
|
|
|
#if BACKLIGHT_FADE_IN_THREAD
|
2009-01-26 23:21:49 +00:00
|
|
|
backlight_setup_fade_up();
|
2008-11-26 08:26:13 +00:00
|
|
|
#else
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_on();
|
2008-11-26 08:26:13 +00:00
|
|
|
#endif
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
/* Update state of remote backlight according to timeout setting */
|
|
|
|
static void remote_backlight_update_state(void)
|
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
int timeout = remote_backlight_get_current_timeout();
|
2006-08-08 22:03:56 +00:00
|
|
|
/* Backlight == OFF in the setting? */
|
2009-04-25 21:11:16 +00:00
|
|
|
if (timeout < 0)
|
2006-08-08 22:03:56 +00:00
|
|
|
{
|
|
|
|
remote_backlight_timer = 0; /* Disable the timeout */
|
2015-01-08 23:22:40 +00:00
|
|
|
remote_backlight_hw_off();
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
remote_backlight_timer = timeout;
|
2015-01-08 23:22:40 +00:00
|
|
|
remote_backlight_hw_on();
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2004-10-07 08:38:51 +00:00
|
|
|
|
2002-06-24 13:48:42 +00:00
|
|
|
void backlight_thread(void)
|
|
|
|
{
|
2007-10-16 01:25:17 +00:00
|
|
|
struct queue_event ev;
|
2007-08-12 11:18:52 +00:00
|
|
|
bool locked = false;
|
2006-08-08 22:03:56 +00:00
|
|
|
|
2002-06-24 13:48:42 +00:00
|
|
|
while(1)
|
|
|
|
{
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
2009-04-26 00:47:35 +00:00
|
|
|
if (backlight_fading_state != NOT_FADING)
|
2008-11-26 08:26:13 +00:00
|
|
|
queue_wait_w_tmo(&backlight_queue, &ev, FADE_DELAY);
|
|
|
|
else
|
|
|
|
#endif
|
2009-04-26 00:47:35 +00:00
|
|
|
queue_wait_w_tmo(&backlight_queue, &ev, BACKLIGHT_THREAD_TIMEOUT);
|
2002-06-24 13:48:42 +00:00
|
|
|
switch(ev.id)
|
2007-08-12 11:18:52 +00:00
|
|
|
{ /* These events must always be processed */
|
2007-11-12 18:49:53 +00:00
|
|
|
#ifdef _BACKLIGHT_FADE_BOOST
|
|
|
|
case BACKLIGHT_FADE_FINISH:
|
2007-08-12 11:18:52 +00:00
|
|
|
cpu_boost(false);
|
|
|
|
break;
|
|
|
|
#endif
|
2007-11-12 18:49:53 +00:00
|
|
|
#ifdef _BACKLIGHT_FADE_ENABLE
|
|
|
|
case BACKLIGHT_FADE_FINISH:
|
|
|
|
_backlight_hw_enable((bl_dim_current|bl_dim_target) != 0);
|
|
|
|
break;
|
|
|
|
#endif
|
2007-08-12 11:18:52 +00:00
|
|
|
|
2008-03-19 00:34:56 +00:00
|
|
|
#ifndef SIMULATOR
|
2007-08-12 11:18:52 +00:00
|
|
|
/* Here for now or else the aggressive init messes up scrolling */
|
2008-03-19 00:34:56 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2007-08-12 11:18:52 +00:00
|
|
|
case SYS_REMOTE_PLUGGED:
|
|
|
|
lcd_remote_on();
|
|
|
|
lcd_remote_update();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SYS_REMOTE_UNPLUGGED:
|
|
|
|
lcd_remote_off();
|
|
|
|
break;
|
2008-03-19 00:34:56 +00:00
|
|
|
#elif defined HAVE_REMOTE_LCD_AS_MAIN
|
2008-03-25 19:57:23 +00:00
|
|
|
case SYS_REMOTE_PLUGGED:
|
2008-03-19 00:34:56 +00:00
|
|
|
lcd_on();
|
|
|
|
lcd_update();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SYS_REMOTE_UNPLUGGED:
|
|
|
|
lcd_off();
|
|
|
|
break;
|
|
|
|
#endif /* HAVE_REMOTE_LCD/ HAVE_REMOTE_LCD_AS_MAIN */
|
|
|
|
#endif /* !SIMULATOR */
|
2007-08-12 11:18:52 +00:00
|
|
|
case SYS_USB_CONNECTED:
|
|
|
|
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
|
|
|
break;
|
|
|
|
|
2008-05-10 18:00:11 +00:00
|
|
|
#ifdef BACKLIGHT_DRIVER_CLOSE
|
|
|
|
/* Get out of here */
|
|
|
|
case BACKLIGHT_QUIT:
|
|
|
|
return;
|
|
|
|
#endif
|
2007-08-12 11:18:52 +00:00
|
|
|
}
|
|
|
|
if (locked)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
switch(ev.id)
|
|
|
|
{ /* These events are only processed if backlight isn't locked */
|
2005-04-15 16:16:26 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2009-04-24 09:08:43 +00:00
|
|
|
case REMOTE_BACKLIGHT_TMO_CHANGED:
|
2005-04-15 16:16:26 +00:00
|
|
|
case REMOTE_BACKLIGHT_ON:
|
2006-08-08 22:03:56 +00:00
|
|
|
remote_backlight_update_state();
|
2005-04-15 16:16:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REMOTE_BACKLIGHT_OFF:
|
2006-08-08 22:03:56 +00:00
|
|
|
remote_backlight_timer = 0; /* Disable the timeout */
|
2015-01-08 23:22:40 +00:00
|
|
|
remote_backlight_hw_off();
|
2005-04-15 16:16:26 +00:00
|
|
|
break;
|
2006-09-10 02:00:40 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
|
|
|
|
2009-04-24 08:54:10 +00:00
|
|
|
case BACKLIGHT_TMO_CHANGED:
|
2002-06-24 13:48:42 +00:00
|
|
|
case BACKLIGHT_ON:
|
2006-08-08 22:03:56 +00:00
|
|
|
backlight_update_state();
|
2002-06-24 13:48:42 +00:00
|
|
|
break;
|
2006-08-08 22:03:56 +00:00
|
|
|
|
2002-06-24 13:48:42 +00:00
|
|
|
case BACKLIGHT_OFF:
|
2009-04-26 00:47:35 +00:00
|
|
|
do_backlight_off();
|
2002-06-24 13:48:42 +00:00
|
|
|
break;
|
2009-05-01 03:18:20 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
case BACKLIGHT_BRIGHTNESS_CHANGED:
|
|
|
|
backlight_brightness = (int)ev.data;
|
2015-01-08 23:22:40 +00:00
|
|
|
backlight_hw_brightness((int)ev.data);
|
2009-05-01 03:18:20 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
|
|
|
/* receive backlight brightness */
|
|
|
|
_backlight_fade_update_state((int)ev.data);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
case LCD_SLEEP:
|
|
|
|
lcd_sleep();
|
|
|
|
break;
|
|
|
|
#endif
|
2007-04-22 13:02:24 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2009-04-24 08:54:10 +00:00
|
|
|
case BUTTON_LIGHT_TMO_CHANGED:
|
2007-04-22 13:02:24 +00:00
|
|
|
case BUTTON_LIGHT_ON:
|
2007-05-10 03:08:47 +00:00
|
|
|
buttonlight_update_state();
|
2007-04-22 13:02:24 +00:00
|
|
|
break;
|
2007-08-12 11:18:52 +00:00
|
|
|
|
2007-04-22 13:02:24 +00:00
|
|
|
case BUTTON_LIGHT_OFF:
|
2007-10-07 15:02:02 +00:00
|
|
|
buttonlight_timer = 0;
|
2015-01-08 23:22:40 +00:00
|
|
|
buttonlight_hw_off();
|
2007-04-22 13:02:24 +00:00
|
|
|
break;
|
2009-05-01 03:18:20 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
case BUTTON_LIGHT_BRIGHTNESS_CHANGED:
|
2015-01-08 23:22:40 +00:00
|
|
|
buttonlight_hw_brightness((int)ev.data);
|
2009-05-01 03:18:20 +00:00
|
|
|
break;
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2006-08-08 22:03:56 +00:00
|
|
|
|
2007-08-12 11:18:52 +00:00
|
|
|
case SYS_POWEROFF: /* Lock backlight on poweroff so it doesn't */
|
|
|
|
locked = true; /* go off before power is actually cut. */
|
|
|
|
/* fall through */
|
2007-08-10 21:55:48 +00:00
|
|
|
#if CONFIG_CHARGING
|
|
|
|
case SYS_CHARGER_CONNECTED:
|
|
|
|
case SYS_CHARGER_DISCONNECTED:
|
2007-08-12 11:18:52 +00:00
|
|
|
#endif
|
2007-08-10 21:55:48 +00:00
|
|
|
backlight_update_state();
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
remote_backlight_update_state();
|
|
|
|
#endif
|
|
|
|
break;
|
2009-04-26 00:47:35 +00:00
|
|
|
case SYS_TIMEOUT:
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
|
|
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
2009-04-26 00:47:35 +00:00
|
|
|
if (backlight_fading_state != NOT_FADING)
|
|
|
|
{
|
|
|
|
if ((_backlight_fade_step(backlight_fading_state)))
|
2009-04-26 01:23:39 +00:00
|
|
|
{ /* finished fading */
|
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
if (backlight_fading_state == FADING_DOWN)
|
|
|
|
{ /* start sleep countdown */
|
|
|
|
backlight_lcd_sleep_countdown(true);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
backlight_fading_state = NOT_FADING;
|
|
|
|
}
|
2009-04-26 00:47:35 +00:00
|
|
|
}
|
|
|
|
else
|
2009-01-26 23:21:49 +00:00
|
|
|
#endif /* CONFIG_BACKLIGHT_FADING */
|
2009-04-26 00:47:35 +00:00
|
|
|
backlight_timeout_handler();
|
|
|
|
break;
|
2007-08-12 11:18:52 +00:00
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
} /* end while */
|
2002-06-24 13:48:42 +00:00
|
|
|
}
|
|
|
|
|
2009-04-26 00:47:35 +00:00
|
|
|
static void backlight_timeout_handler(void)
|
2002-06-24 13:48:42 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
if(backlight_timer > 0)
|
2002-06-24 13:48:42 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
backlight_timer -= BACKLIGHT_THREAD_TIMEOUT;
|
|
|
|
if(backlight_timer <= 0)
|
2002-06-24 13:48:42 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
do_backlight_off();
|
2002-06-24 13:48:42 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP
|
2009-04-26 00:47:35 +00:00
|
|
|
else if(lcd_sleep_timer > 0)
|
2006-08-08 22:03:56 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
lcd_sleep_timer -= BACKLIGHT_THREAD_TIMEOUT;
|
|
|
|
if(lcd_sleep_timer <= 0)
|
2006-08-08 22:03:56 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
lcd_sleep();
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_LCD_SLEEP */
|
2005-04-15 16:16:26 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2009-04-26 00:47:35 +00:00
|
|
|
if(remote_backlight_timer > 0)
|
2005-04-15 16:16:26 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
remote_backlight_timer -= BACKLIGHT_THREAD_TIMEOUT;
|
|
|
|
if(remote_backlight_timer <= 0)
|
2005-04-15 16:16:26 +00:00
|
|
|
{
|
2015-01-08 23:22:40 +00:00
|
|
|
remote_backlight_hw_off();
|
2005-04-15 16:16:26 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
#endif /* HAVE_REMOVE_LCD */
|
2007-04-22 13:02:24 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2009-04-26 00:47:35 +00:00
|
|
|
if (buttonlight_timer > 0)
|
2007-04-22 13:02:24 +00:00
|
|
|
{
|
2009-04-26 00:47:35 +00:00
|
|
|
buttonlight_timer -= BACKLIGHT_THREAD_TIMEOUT;
|
|
|
|
if (buttonlight_timer <= 0)
|
2007-04-22 13:02:24 +00:00
|
|
|
{
|
2015-01-08 23:22:40 +00:00
|
|
|
buttonlight_hw_off();
|
2007-04-22 13:02:24 +00:00
|
|
|
}
|
|
|
|
}
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if (buttonlight_ignored_timer > 0)
|
|
|
|
{
|
|
|
|
buttonlight_ignored_timer -= BACKLIGHT_THREAD_TIMEOUT;
|
|
|
|
if (buttonlight_ignored_timer <= 0)
|
|
|
|
ignore_buttonlight_on = false;
|
|
|
|
}
|
2007-04-22 13:02:24 +00:00
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if (backlight_ignored_timer > 0)
|
|
|
|
{
|
|
|
|
backlight_ignored_timer -= BACKLIGHT_THREAD_TIMEOUT;
|
|
|
|
if (backlight_ignored_timer <= 0)
|
|
|
|
ignore_backlight_on = false;
|
|
|
|
}
|
2002-06-24 13:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void backlight_init(void)
|
|
|
|
{
|
2006-09-16 16:18:11 +00:00
|
|
|
queue_init(&backlight_queue, true);
|
2007-07-27 17:53:43 +00:00
|
|
|
|
2015-01-08 23:22:40 +00:00
|
|
|
if (backlight_hw_init())
|
2007-01-12 20:26:23 +00:00
|
|
|
{
|
2009-01-26 23:21:49 +00:00
|
|
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
|
2007-01-12 20:26:23 +00:00
|
|
|
/* If backlight is already on, don't fade in. */
|
|
|
|
bl_dim_target = BL_PWM_COUNT;
|
2007-11-26 23:10:20 +00:00
|
|
|
bl_dim_fraction = (BL_PWM_COUNT<<16);
|
2009-01-26 23:21:49 +00:00
|
|
|
#endif
|
2007-01-12 20:26:23 +00:00
|
|
|
}
|
2007-09-12 22:24:58 +00:00
|
|
|
/* Leave all lights as set by the bootloader here. The settings load will
|
|
|
|
* call the appropriate backlight_set_*() functions, only changing light
|
|
|
|
* status if necessary. */
|
2008-05-10 18:00:11 +00:00
|
|
|
#ifdef BACKLIGHT_DRIVER_CLOSE
|
2008-12-10 08:57:10 +00:00
|
|
|
backlight_thread_id =
|
2008-05-10 18:00:11 +00:00
|
|
|
#endif
|
2007-01-12 20:26:23 +00:00
|
|
|
create_thread(backlight_thread, backlight_stack,
|
2007-10-16 01:25:17 +00:00
|
|
|
sizeof(backlight_stack), 0, backlight_thread_name
|
2008-03-07 00:51:36 +00:00
|
|
|
IF_PRIO(, PRIORITY_USER_INTERFACE)
|
2007-10-16 01:25:17 +00:00
|
|
|
IF_COP(, CPU));
|
2002-06-24 13:48:42 +00:00
|
|
|
}
|
2004-09-10 13:56:54 +00:00
|
|
|
|
2008-05-10 18:00:11 +00:00
|
|
|
#ifdef BACKLIGHT_DRIVER_CLOSE
|
|
|
|
void backlight_close(void)
|
|
|
|
{
|
2008-12-10 08:57:10 +00:00
|
|
|
unsigned int thread = backlight_thread_id;
|
2008-05-10 18:00:11 +00:00
|
|
|
|
|
|
|
/* Wait for thread to exit */
|
2008-12-10 08:57:10 +00:00
|
|
|
if (thread == 0)
|
2008-05-10 18:00:11 +00:00
|
|
|
return;
|
|
|
|
|
2008-12-10 08:57:10 +00:00
|
|
|
backlight_thread_id = 0;
|
2008-05-10 18:00:11 +00:00
|
|
|
|
|
|
|
queue_post(&backlight_queue, BACKLIGHT_QUIT, 0);
|
|
|
|
thread_wait(thread);
|
|
|
|
}
|
|
|
|
#endif /* BACKLIGHT_DRIVER_CLOSE */
|
|
|
|
|
2005-11-21 23:55:39 +00:00
|
|
|
void backlight_on(void)
|
|
|
|
{
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
if(!ignore_backlight_on)
|
|
|
|
{
|
|
|
|
queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
|
|
|
|
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void backlight_on_ignore(bool value, int timeout)
|
|
|
|
{
|
|
|
|
ignore_backlight_on = value;
|
|
|
|
backlight_ignored_timer = timeout;
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
2004-09-10 13:56:54 +00:00
|
|
|
|
2005-11-21 23:55:39 +00:00
|
|
|
void backlight_off(void)
|
2005-11-16 23:53:01 +00:00
|
|
|
{
|
2006-12-19 16:50:07 +00:00
|
|
|
queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
|
|
|
|
2008-04-02 22:16:14 +00:00
|
|
|
/* returns true when the backlight is on,
|
|
|
|
* and optionally when it's set to always off. */
|
|
|
|
bool is_backlight_on(bool ignore_always_off)
|
2006-03-24 13:47:24 +00:00
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
int timeout = backlight_get_current_timeout();
|
2008-04-02 22:16:14 +00:00
|
|
|
return (backlight_timer > 0) /* countdown */
|
2009-04-25 21:11:16 +00:00
|
|
|
|| (timeout == 0) /* always on */
|
|
|
|
|| ((timeout < 0) && !ignore_always_off);
|
2006-03-24 13:47:24 +00:00
|
|
|
}
|
|
|
|
|
2005-11-23 20:12:33 +00:00
|
|
|
/* return value in ticks; 0 means always on, <0 means always off */
|
|
|
|
int backlight_get_current_timeout(void)
|
2005-11-21 23:55:39 +00:00
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
if ((backlight_on_button_hold != 0)
|
|
|
|
#ifdef HAVE_REMOTE_LCD_AS_MAIN
|
|
|
|
&& remote_button_hold()
|
|
|
|
#else
|
|
|
|
&& button_hold()
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
return (backlight_on_button_hold == 2) ? 0 : -1;
|
|
|
|
/* always on or always off */
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
if (power_input_present())
|
|
|
|
return backlight_timeout_plugged;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
return backlight_timeout_normal;
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
void backlight_set_timeout(int value)
|
2005-11-21 23:55:39 +00:00
|
|
|
{
|
2007-11-25 17:36:21 +00:00
|
|
|
backlight_timeout_normal = HZ * value;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, BACKLIGHT_TMO_CHANGED, 0);
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2007-11-25 17:36:21 +00:00
|
|
|
void backlight_set_timeout_plugged(int value)
|
2005-11-21 23:55:39 +00:00
|
|
|
{
|
2007-11-25 17:36:21 +00:00
|
|
|
backlight_timeout_plugged = HZ * value;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, BACKLIGHT_TMO_CHANGED, 0);
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
#endif /* CONFIG_CHARGING */
|
|
|
|
|
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
/* Hold button change event handler. */
|
|
|
|
void backlight_hold_changed(bool hold_button)
|
|
|
|
{
|
2007-08-10 21:55:48 +00:00
|
|
|
if (!hold_button || (backlight_on_button_hold > 0))
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
{
|
2007-08-10 21:55:48 +00:00
|
|
|
/* if unlocked or override in effect */
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
|
|
|
/*backlight_on(); REMOVED*/
|
|
|
|
queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
|
|
|
|
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
|
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void backlight_set_on_button_hold(int index)
|
|
|
|
{
|
|
|
|
if ((unsigned)index >= 3)
|
|
|
|
/* if given a weird value, use default */
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
backlight_on_button_hold = index;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, BACKLIGHT_TMO_CHANGED, 0);
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
|
|
|
#endif /* HAS_BUTTON_HOLD */
|
|
|
|
|
2008-05-14 19:29:25 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
2006-08-08 22:03:56 +00:00
|
|
|
void lcd_set_sleep_after_backlight_off(int index)
|
|
|
|
{
|
|
|
|
if ((unsigned)index >= sizeof(lcd_sleep_timeout_value))
|
|
|
|
/* if given a weird value, use default */
|
|
|
|
index = 3;
|
|
|
|
|
2008-05-14 19:29:25 +00:00
|
|
|
lcd_sleep_timeout = HZ * lcd_sleep_timeout_value[index];
|
2006-08-08 22:03:56 +00:00
|
|
|
|
2009-04-26 01:35:19 +00:00
|
|
|
if (is_backlight_on(true))
|
2006-08-08 22:03:56 +00:00
|
|
|
/* Timer will be set when bl turns off or bl set to on. */
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Backlight is Off */
|
2008-05-14 19:29:25 +00:00
|
|
|
if (lcd_sleep_timeout < 0)
|
|
|
|
lcd_sleep_timer = 1; /* Always - sleep next tick */
|
2006-08-08 22:03:56 +00:00
|
|
|
else
|
2008-05-14 19:29:25 +00:00
|
|
|
lcd_sleep_timer = lcd_sleep_timeout; /* Never, other */
|
2006-08-08 22:03:56 +00:00
|
|
|
}
|
2008-05-14 19:29:25 +00:00
|
|
|
#endif /* HAVE_LCD_SLEEP_SETTING */
|
2005-11-21 23:55:39 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
void remote_backlight_on(void)
|
|
|
|
{
|
2006-12-19 16:50:07 +00:00
|
|
|
queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0);
|
2005-11-16 23:53:01 +00:00
|
|
|
}
|
2005-11-21 23:55:39 +00:00
|
|
|
|
|
|
|
void remote_backlight_off(void)
|
|
|
|
{
|
2006-12-19 16:50:07 +00:00
|
|
|
queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0);
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
void remote_backlight_set_timeout(int value)
|
2005-11-21 23:55:39 +00:00
|
|
|
{
|
2007-11-25 17:36:21 +00:00
|
|
|
remote_backlight_timeout_normal = HZ * value;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, REMOTE_BACKLIGHT_TMO_CHANGED, 0);
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2007-11-25 17:36:21 +00:00
|
|
|
void remote_backlight_set_timeout_plugged(int value)
|
2005-11-21 23:55:39 +00:00
|
|
|
{
|
2007-11-25 17:36:21 +00:00
|
|
|
remote_backlight_timeout_plugged = HZ * value;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, REMOTE_BACKLIGHT_TMO_CHANGED, 0);
|
2005-11-21 23:55:39 +00:00
|
|
|
}
|
2006-08-08 22:03:56 +00:00
|
|
|
#endif /* CONFIG_CHARGING */
|
2006-03-25 19:16:45 +00:00
|
|
|
|
2006-09-10 02:00:40 +00:00
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
/* Remote hold button change event handler. */
|
|
|
|
void remote_backlight_hold_changed(bool rc_hold_button)
|
|
|
|
{
|
2007-08-10 21:55:48 +00:00
|
|
|
if (!rc_hold_button || (remote_backlight_on_button_hold > 0))
|
|
|
|
/* if unlocked or override */
|
2006-09-10 02:00:40 +00:00
|
|
|
remote_backlight_on();
|
|
|
|
}
|
|
|
|
|
|
|
|
void remote_backlight_set_on_button_hold(int index)
|
|
|
|
{
|
|
|
|
if ((unsigned)index >= 3)
|
|
|
|
/* if given a weird value, use default */
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
remote_backlight_on_button_hold = index;
|
2009-04-24 08:54:10 +00:00
|
|
|
queue_post(&backlight_queue, REMOTE_BACKLIGHT_TMO_CHANGED, 0);
|
2006-09-10 02:00:40 +00:00
|
|
|
}
|
|
|
|
#endif /* HAS_REMOTE_BUTTON_HOLD */
|
|
|
|
|
2006-03-25 19:16:45 +00:00
|
|
|
/* return value in ticks; 0 means always on, <0 means always off */
|
|
|
|
int remote_backlight_get_current_timeout(void)
|
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
if (remote_button_hold() && (remote_backlight_on_button_hold != 0))
|
|
|
|
return (remote_backlight_on_button_hold == 2)
|
|
|
|
? 0 : -1; /* always on or always off */
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
if (power_input_present())
|
|
|
|
return remote_backlight_timeout_plugged;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
return remote_backlight_timeout_normal;
|
2006-03-25 19:16:45 +00:00
|
|
|
}
|
|
|
|
|
2008-04-02 22:16:14 +00:00
|
|
|
/* returns true when the backlight is on, and
|
|
|
|
* optionally when it's set to always off */
|
|
|
|
bool is_remote_backlight_on(bool ignore_always_off)
|
2006-03-25 19:16:45 +00:00
|
|
|
{
|
2009-04-25 21:11:16 +00:00
|
|
|
int timeout = remote_backlight_get_current_timeout();
|
2008-04-02 22:16:14 +00:00
|
|
|
return (remote_backlight_timer > 0) /* countdown */
|
2009-04-25 21:11:16 +00:00
|
|
|
|| (timeout == 0) /* always on */
|
|
|
|
|| ((timeout < 0) && !ignore_always_off);
|
2006-03-25 19:16:45 +00:00
|
|
|
}
|
|
|
|
|
2005-11-21 23:55:39 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
|
|
|
|
2006-11-10 18:47:41 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
void backlight_set_brightness(int val)
|
|
|
|
{
|
|
|
|
if (val < MIN_BRIGHTNESS_SETTING)
|
|
|
|
val = MIN_BRIGHTNESS_SETTING;
|
|
|
|
else if (val > MAX_BRIGHTNESS_SETTING)
|
|
|
|
val = MAX_BRIGHTNESS_SETTING;
|
|
|
|
|
2009-05-01 03:18:20 +00:00
|
|
|
queue_post(&backlight_queue, BACKLIGHT_BRIGHTNESS_CHANGED, val);
|
2006-11-10 18:47:41 +00:00
|
|
|
}
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
|
|
|
|
2007-05-08 06:45:38 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
void buttonlight_set_brightness(int val)
|
|
|
|
{
|
|
|
|
if (val < MIN_BRIGHTNESS_SETTING)
|
|
|
|
val = MIN_BRIGHTNESS_SETTING;
|
|
|
|
else if (val > MAX_BRIGHTNESS_SETTING)
|
|
|
|
val = MAX_BRIGHTNESS_SETTING;
|
|
|
|
|
2009-05-01 03:18:20 +00:00
|
|
|
queue_post(&backlight_queue, BUTTON_LIGHT_BRIGHTNESS_CHANGED, val);
|
2007-05-08 06:45:38 +00:00
|
|
|
}
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
|
|
|
|
2010-06-21 17:26:50 +00:00
|
|
|
#else /* !defined(HAVE_BACKLIGHT) || !defined(BACKLIGHT_FULL_INIT)
|
2006-08-08 22:03:56 +00:00
|
|
|
-- no backlight, empty dummy functions */
|
2010-06-21 17:26:50 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_BACKLIGHT) && !defined(BACKLIGHT_FULL_INIT)
|
2005-11-22 01:39:41 +00:00
|
|
|
void backlight_init(void)
|
|
|
|
{
|
2015-01-08 23:22:40 +00:00
|
|
|
(void)backlight_hw_init();
|
|
|
|
backlight_hw_on();
|
2005-11-22 01:39:41 +00:00
|
|
|
}
|
2010-06-21 17:26:50 +00:00
|
|
|
#endif
|
2005-11-22 01:39:41 +00:00
|
|
|
|
2004-09-10 13:56:54 +00:00
|
|
|
void backlight_on(void) {}
|
|
|
|
void backlight_off(void) {}
|
2007-11-25 17:36:21 +00:00
|
|
|
void backlight_set_timeout(int value) {(void)value;}
|
2008-04-02 22:28:08 +00:00
|
|
|
|
|
|
|
bool is_backlight_on(bool ignore_always_off)
|
|
|
|
{
|
|
|
|
(void)ignore_always_off;
|
|
|
|
return true;
|
|
|
|
}
|
2005-04-15 16:16:26 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
void remote_backlight_on(void) {}
|
|
|
|
void remote_backlight_off(void) {}
|
2007-11-25 17:36:21 +00:00
|
|
|
void remote_backlight_set_timeout(int value) {(void)value;}
|
2008-04-02 22:28:08 +00:00
|
|
|
|
2008-04-04 19:38:46 +00:00
|
|
|
bool is_remote_backlight_on(bool ignore_always_off)
|
2008-04-02 22:28:08 +00:00
|
|
|
{
|
|
|
|
(void)ignore_always_off;
|
|
|
|
return true;
|
|
|
|
}
|
2006-11-10 18:47:41 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2005-12-22 10:43:36 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
2006-11-10 18:47:41 +00:00
|
|
|
void backlight_set_brightness(int val) { (void)val; }
|
2005-12-22 10:43:36 +00:00
|
|
|
#endif
|
2010-08-01 10:07:05 +00:00
|
|
|
|
2010-08-01 10:17:17 +00:00
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
2010-08-01 10:07:05 +00:00
|
|
|
void buttonlight_on(void) {}
|
2007-05-08 06:45:38 +00:00
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
void buttonlight_set_brightness(int val) { (void)val; }
|
|
|
|
#endif
|
2010-08-01 10:17:17 +00:00
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2010-08-01 10:07:05 +00:00
|
|
|
|
2010-06-21 17:26:50 +00:00
|
|
|
#endif /* defined(HAVE_BACKLIGHT) && defined(BACKLIGHT_FULL_INIT) */
|