Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#8934 - Colourful flashlight/lamp

Attached to Project: Rockbox
Opened by Alexander Papst (DerPapst) - Friday, 25 April 2008, 06:30 GMT+2
Last edited by Thomas Martitz (kugel.) - Tuesday, 29 December 2009, 15:07 GMT+2
Task Type Patches
Category Plugins
Status Unconfirmed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Private No

Details

After reading the irc log shortly after the flashlight plugin was committed i noticed that some want the ability back to finetune the colour of the display. This time i've added a fixed point version of the hsv_to_lcd version (thanks to amiconn) and added some more predefined colours. You can "skip" forwards or backwards to the nearest predefined colour (however, it's probably not the nicest way of doing it i guess).

I've also implemented another request to switch the backlight on and off (even for non colour targets) and it now uses the remote backlight too.


Controls:
Targets with a 4 button cross:
Up/Down: fine tune
Left/Right: jump to next predefined colours (including white)
Select: switch backlight on and off

Targets with scroll wheel:
Scroll left/right: fine tune
Left/right or fwd/rew: jump to next predefined colours (including white)
Select: switch backlight on and off

I've tried to guess the most intuitive button layout on all targets and even use the remote buttons. However i only own a small number of targets so if you think it can be done better let me know. :-)

Tested on iPod Video, Mini (sim), H300 (sim) and m:robe 100.
   flashlight_1.patch (11.7 KiB)
 flashlight.c |  250 +++++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 201 insertions(+), 49 deletions(-)

This task depends upon

Comment by Jeton Aliji (jeton) - Friday, 25 April 2008, 12:07 GMT+2
One feature that's specific for the Sansa e200 series would be to also turn on the blue wheel light, since i always have it off (i presume other users also). So with the brightness set to max and the wheel light on, it really becomes a flashlight.
Comment by Alexander Papst (DerPapst) - Friday, 25 April 2008, 15:16 GMT+2
* Added missing Keypad (Ondio)
* Added support for buttonlights and (where available) setting the buttonlight to max brightness (gigabeat f for example)
   flashlight_2.patch (15 KiB)
 plugin.c             |   10 +
 plugin.h             |   13 ++
 plugins/flashlight.c |  290 ++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 263 insertions(+), 50 deletions(-)

Comment by Thomas Martitz (kugel.) - Friday, 25 April 2008, 19:17 GMT+2
If you can explain me the need of being able to turn the backlight of, I'll by chance like it.
Comment by Alexander Papst (DerPapst) - Friday, 25 April 2008, 20:24 GMT+2
Don't know. It was a feature request in IRC and i thought i can't hurt.

* Make sure the plugin quits if USB is connected.
   flashlight_3.patch (15.3 KiB)
 plugin.c             |   10 +
 plugin.h             |   13 ++
 plugins/flashlight.c |  300 ++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 272 insertions(+), 51 deletions(-)

Comment by Alexander Levin (fml2) - Friday, 25 April 2008, 21:57 GMT+2
@kugel: the need is very easily explained. The plugin should work like a real flashlight which you usually can turn on and off.

@DerPapst: shoudn't the plugin return a special value (and not just PLUGIN_OK) if USB has been detected?
Comment by Thomas Martitz (kugel.) - Friday, 25 April 2008, 22:03 GMT+2
That's why you can exit the plugin with like every button (except the one to change the color of course).

BTW: Does a real flashlight offer some fancy color spectacle? I don't think so.
Comment by Alexander Levin (fml2) - Friday, 25 April 2008, 23:41 GMT+2
> That's why you can exit the plugin with like every button

...and then having the problem to start it again (with another button). A real flashlight does not usually have fancy colors but this not related to the ability to turn it on/off.
Comment by Thomas Martitz (kugel.) - Friday, 25 April 2008, 23:45 GMT+2
Let me get this right. Without this the ability to turn the backlight off, you exit the plugin with select and (re-)start it with select (select button in most cases). With the ability you do turn the backlight on and off.

I don't see any difference. Isn't exiting the plugin the same as turning the flashlight off?
Comment by Thomas Martitz (kugel.) - Friday, 25 April 2008, 23:46 GMT+2
Ok, the only difference is, that in one case the backlight is off, and in the other the menu shows up. Looks like a big deal.
Comment by Alexander Papst (DerPapst) - Saturday, 26 April 2008, 01:46 GMT+2
I had some discussions with other users about flashlight before i implemented this whole stuff. Someone preferred one button to quit the plugin instead of any undefined one since one might press it accidentally.
Also i don't quiet get what the problem is with turning the backlight on and off in flashlight. It's not like that it hurts somebody. If you don't like it, don't use it and quit the plugin instead of using this feature. Also one could argue that if you quit the plugin the backlight (and button light) isn't instantly off. But whatever. I didn't expect so much emotions because of such a small plugin :-)

* return PLUGIN_USB_CONNECTED if usb is connected.
   flashlight_4.patch (15.4 KiB)
 plugin.c             |   10 +
 plugin.h             |   13 ++
 plugins/flashlight.c |  302 ++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 274 insertions(+), 51 deletions(-)

Comment by Alexander Levin (fml2) - Saturday, 26 April 2008, 08:32 GMT+2
@DerPapst: quality control passed ... almost :-) Just one question. Is it ok to call "rb->default_event_handler(button)" twice? (It gets called twice in case of USB.)
Comment by Alexander Levin (fml2) - Saturday, 26 April 2008, 08:39 GMT+2
Attached is a patch improving that (hoefully).
   flashlight_5.patch (15.4 KiB)
 plugin.c             |   10 +
 plugin.h             |   13 ++
 plugins/flashlight.c |  306 ++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 276 insertions(+), 53 deletions(-)

Comment by Alexander Levin (fml2) - Saturday, 26 April 2008, 08:40 GMT+2
*hopefully :-)
Comment by Alexander Papst (DerPapst) - Sunday, 27 April 2008, 19:13 GMT+2
I think it is OK to call the default_event_handler twice. It at least worked OK in my tests. I think either version is fine :-)

Sync to svn r17262

* Follow the HAVE_TOUCHPAD introduced in r17262.
   flashlight_6.patch (15.3 KiB)
 plugin.c             |   10 +
 plugin.h             |   13 ++
 plugins/flashlight.c |  302 ++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 271 insertions(+), 54 deletions(-)

Comment by Alexander Papst (DerPapst) - Sunday, 27 April 2008, 19:21 GMT+2
Oops... :-)
   flashlight_6.1.patch (15.4 KiB)
 plugin.c             |   10 +
 plugin.h             |   13 ++
 plugins/flashlight.c |  303 ++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 274 insertions(+), 52 deletions(-)

Comment by Alexander Papst (DerPapst) - Thursday, 08 May 2008, 14:31 GMT+2
This patch only implements the request of Jeton (button light) since i think this is still a good idea.
   lamp_01.diff (2.8 KiB)
 plugin.c       |    8 ++++++++
 plugin.h       |    8 ++++++++
 plugins/lamp.c |   15 +++++++++++++++
 3 files changed, 31 insertions(+)

Comment by Peter D'Hoye (petur) - Thursday, 08 May 2008, 23:34 GMT+2
lamp_01 committed, feel free to resync the previous patch...
Comment by Alexander Papst (DerPapst) - Friday, 09 May 2008, 03:24 GMT+2
resync to r17428.
   lamp_02.diff (14.4 KiB)
 lamp.c |  352 ++++++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 260 insertions(+), 92 deletions(-)

Comment by Alexander Papst (DerPapst) - Friday, 09 May 2008, 03:32 GMT+2
note to self: don't do that kind of stuff at 3:30am.
kill a warning.
   lamp_02.1.diff (12.3 KiB)
 lamp.c |  282 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 226 insertions(+), 56 deletions(-)

Comment by Alexander Papst (DerPapst) - Thursday, 15 May 2008, 22:25 GMT+2
Sync to r17527
   lamp_03.diff (12.3 KiB)
 lamp.c |  282 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 226 insertions(+), 56 deletions(-)

Comment by Taylore (trailblaze) - Wednesday, 12 November 2008, 01:33 GMT+2
hmm... I thought this plugin was nifty... However, it is now broken aka.. Hunk error? is it possible to fix this plugin, please?
Comment by Thomas Martitz (kugel.) - Wednesday, 12 November 2008, 07:31 GMT+2
The flashlight was committed as the lamp(.rock) plugin. You should find it on your player.
The color part is not committed. The lamp plugin shows red though on a certain keypress.
Comment by Taylore (trailblaze) - Sunday, 16 November 2008, 02:44 GMT+2
yeahhh thanx... i just liked the different colors, thats all... lol
Comment by Gareth (Mystic_kitsune) - Thursday, 12 February 2009, 14:08 GMT+2
the whole turn the light on/off thing is kind of pointless, and in some cases (sansa c200/e200) redundant, as the hold/lock switch can trigger a backlight fade, and the color spectacle.. i do believe their sold... somewhere... maybe called party light, or disco cannon/laser light
Comment by Rosso Maltese (asettico) - Wednesday, 19 August 2009, 18:25 GMT+2
Resync to r22429.
   plugins-8934lamp_04.0.patch (12.1 KiB)
 lamp.c |  279 +++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 223 insertions(+), 56 deletions(-)

Comment by Rosso Maltese (asettico) - Saturday, 17 October 2009, 10:57 GMT+2
Sync to r23221.
   plugins-8934lamp_04.0.patch (12.1 KiB)
 lamp.c |  279 +++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 223 insertions(+), 56 deletions(-)

Comment by Marek Niemiec (DB1BMN) - Tuesday, 29 December 2009, 15:06 GMT+2
Hello, I came frome http://www.rockbox.org/tracker/task/10877 which I opened, because I was searching only for "Lamp", not "Flashlight".
OK, as I see you also playing with the colors, but you removed the RGB values and applied HSV-values. What are theese (I guess not, the German Soccer Club *g*)?
How to apply theese patches? Do the depend on each other and have I to apply each of theese patches from the beginning or just the very last one?
Sorry for the neewbie questions, just started to contribute to such a huge project!
Regards, Marek
Comment by Alexander Papst (DerPapst) - Tuesday, 29 December 2009, 17:55 GMT+2
Hi Marek,
You apply patches using the patch command (e.g. patch -p0 < lamp_05.patch) after reverting your changes to lamp.c (svn revert apps/plugins/lamp.c). Usually only the last patch is needed from a task if not stated otherwise in the comment.
HSV (Hue, Saturation, Value) is just another colorsystem, where hue specifies the color. For more information see http://en.wikipedia.org/wiki/HSL_and_HSV.

Synced patch to r24120.
It's missing the additional keypad defines for PHILIPS_HDD1630_PAD, PHILIPS_SA9200_PAD, ONDAVX747_PAD, ONDAVX777_PAD, SAMSUNG_YH_PAD and thus would break the plugin for those players.

Just out of curiosity, is anyone of the committers interested in getting this committed or not?
   lamp_05.patch (13.4 KiB)
 lamp.c |  310 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 252 insertions(+), 58 deletions(-)

Comment by Marek Niemiec (DB1BMN) - Thursday, 31 December 2009, 03:17 GMT+2
Good morning,
ok, I was able to apply your patch V5 and it works also on my simulator for Sansa e200V1 also with this new color coordinate system, so my patch is now obsolete.
Let me allow please one question why is the HSV model better than RGB, or just for the sake of compatibility for different platforms?
Regards
Comment by Alexander Papst (DerPapst) - Friday, 01 January 2010, 23:53 GMT+2
No. HSV is better in this case because the colour is represented through an angle. So you only have to modify one value to always get a different colour with fill saturation and brightness and the colours are arranged spectrally.

Loading...