• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[UPDATED 28-04-2009] TorchButton v1.5, using camera LED for flashlight

Search This thread

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
TorchButton v2.x supports the Leo as well as Raphael and moved to a new thread! Click this link!

On my previous devices (Wizard, Hermes) I found it very useful to have the camera LED function as flashlight. However, all those tools that were previously available to enable the LED didn't seem to work on the Raphael.

I've just spent some time debugging and testing and got it to work on my Raphael. The cab to install is attached to this post. It'll create a shortcut in your programs menu.

Usage is currently twofold. When you start the app, the flashlight turns on. When you don't do anything for 60 secs it will turn off automatically to prevent your led from burning (heard it happen before on other devices). If you start the program again within the 60 seconds, it will manually turn the flashlight off.

I've only tested this on my Raphael so far. Please let me know if it works for everyone. :)

---------------

Supported modes:
TorchButton has 5 modes so far. Each one explained in short:

Normal
Simply enable the flashlight until the application is started again or the configurable timeout occurs (60 seconds by default). This mode can be used for a prolonged period. I have only tested it up to 5 minutes though.

Bright
The Bright mode is exactly the same as the Normal mode, with the only difference being that the LED is more bright. This mode is equal to the short moment when you make a photo with flashlight on. Note that this mode does stress the LED and should not be used for prolonged periods. I have used this up to a minute without problems.

Blink
The Blink mode turns the LED on and off in specific intervals that you can configure in the registry. An example of usage is the bike light.

SOS
This is extensive mode that supports sending custom morse code. The text to be sent via morse code signals can be configured in the registry. This defaults to "sos ", thus the SOS name for this mode. NOTE that the flashlight timeout does NOT interrupt a text. It checks if the timeout occurred when it starts over again and quits when it reached the timeout.

PTT
The Push-To-Torch mode. When your device has a key you can map to 'hold', you can use this feature to keep the light on as long as the key is pressed. The AT&T Fuze is one of those devices with a PTT button.

---------------

UPDATE 01-09-2008 v1.1:
TorchButton v1.1 now includes the ability to override the default timeout from 30 seconds to anywhere between 0 and 300 (= 5 minutes) seconds. The regkey is HKLM\Software\TorchButton\FlashlightTimeout (DWORD). When the application installs or when it starts for the first time it will create the registry setting if it doesn't exist yet.

UPDATE 09-11-2008 v1.2:
Finally a new version of TorchButton.
* Enlarged maximum timeout override from 300 seconds to 86400 seconds (a day).
* Added 'bright' feature. Note that the light may flicker almost unnoticeable every 750ms. Can't prevent that.
* For Devs: attached source code of TorchButton to this post.
* For Devs: I've created a C# library for easy control of the camera led. Also attached to this post. The .zip contains a readme which has examples on how to use it.

UPDATE 14-11-2008 v1.3:
* Added 'blink' feature. Registry configuration options:
- blinkTimeOnInMs (DWORD), default 500. Configures the time the LED is on.
- blinkTimeOffInMs (DWORD), default 500. Configures the time the LED is off.
* Added 'SOS' feature. More like a 'morse code' feature though. You can set any morse code to be signalled in the registry. Options:
- sosCode (SZ), default " ...---...". Configures the morse code to signal.
- sosDotTimeoutInMs (DWORD), default 200. Configures 200ms LED on, and 200ms LED off for ".".
- sosDashTimeoutInMs (DWORD), default 400. Configures 400ms LED on, and 400ms LED off for "-".
- sosSpaceTimeoutInMs (DWORD), default 1000. Configures 1000ms pause when processing space " ".
* New shortcuts are added for those features.
* Shortcuts are moved to a TorchButton folder within the Programs, for grouping purposes (in case you're wondering where TorchButton went!).

UPDATE 29-11-2008 v1.4:
* Fixed 'sos' mode. It now properly uses a single configurable unit time to calculateother intervals.
* Updated 'sos' mode. You can now configure a text to be sent via morse code in the registry. Check configuration part of the readme for more info.
* Removed old 'sos' registry settings and replaced them with new ones.
- Check out the new configuration settings in the readme.txt (attached to this post).
* Increased default flashlight timeout from 30 to 60 seconds.
* Changed default 'blink' time to 250ms for both on and off.

UPDATE 28-04-2009 v1.5:
* Added Push-To-Torch (PTT) mode. Probably only useful for devices that have the PTT button, such as the AT&T Fuze.
* Added brightResetTimeInMs registry setting for owners of the Alltel Touch Pro. They need to set this value to 100 for bright mode to work properly.

---------------

TODO's:
* Change LCD brightness to minimum when application starts, and restore when exists.
* Prevent standby mode while active

---------------

Developers:
The source code has been attached as well. The app has been written in C/CPP using VS2008. The code doesn't deserve a beauty-price, but it does its job. The 'TorchButtonBright' project is just a wrapper that calls TorchButton.exe with the /bright parameter. This is a workaround to be able to deploy two shortcuts with different icons and a parameter. If anyone decides to use this code, please rename the project. :) I've also written a C# library that allows easy access to the normal and bright flashlight modes. Attached as well.

---------------

TorchButton v2.x supports the Leo as well as Raphael and moved to a new thread! Click this link!
 

Attachments

  • TorchButtonLib_csharp_v1.0.zip
    6.9 KB · Views: 3,439
  • TorchButton_v1.5.cab
    59.9 KB · Views: 14,490
  • TorchButton_v1.5_src.zip
    137 KB · Views: 2,703
  • TorchButton_v1.5_readme.txt
    6.3 KB · Views: 3,435
Last edited:

jakubd

Senior Member
Jul 3, 2005
366
0
Warsaw
www.danecki.net
Works beautifully with stock HTC ROM provided with Raphael released in Europe. One small request: can you provide also an option to change the timeout? For starters - in registry. Some people would like it to work only for 10s, others: for 60s. Others might have the fun of burning it out :) [anyway you can limit it to max 2 minutes just to protect those less-aware.]
 

WDawn

Senior Member
May 5, 2006
537
51
43
Zwevegem
Works like a charm! Thnx!

I second the request for a change in time out. I need to make it from the front door to my bed without waking my gf, and i don't make it in 30 seconds :)
 

da_jojo

Senior Member
Nov 19, 2006
570
5
Utrecht
houseofyu.nl
the flashlight has a normal condition and a very bright condition. would it be possible to make a dimmer on the flashlight so that for example one can attach it to the volume buttons on the side ?
 

NetRipper

Senior Member
Feb 27, 2006
563
42
's-Gravendeel
www.netripper.nl
the flashlight has a normal condition and a very bright condition. would it be possible to make a dimmer on the flashlight so that for example one can attach it to the volume buttons on the side ?
The flash indeed has two modes. However, the very bright mode is automatically disabled after 1 or 2 seconds by the camera driver. It's possible to make it sleep for that amount of time and re-set the bright mode, but I can't imagine it being very good for the LED to burn for a longer period of time at that mode. It would also flicker every 1 or 2 seconds.

I think the normal LED is bright enough, so unless the demand for the extra bright setting is overwhelming, I'll keep it like this. ;)
 

da_jojo

Senior Member
Nov 19, 2006
570
5
Utrecht
houseofyu.nl
mm that sucks.
its not a great idea to have a flashing flashlight unless one wants to drive anyone crazy or likes discolights ... maybe an idea lol... a stroboscope.. or some sort of signaling light..

it wouldnt hurt to have the LED on for a longer period. since the lifespan is over 50000 hours and it is running on lower power then intended .. only thing, is that it takes toll on the battery. i wouldnt care to much for the LED as it will last longer then the phone's display.
 

sysrq12

New member
Aug 15, 2008
3
0
W-w
yesterday I wrote for myself something just like yours. but i prefered fullscreen button which would change color to black while LED switches on (useful in dark places - eyes are not blinded by bright screen).

it is possible to change timeout (setting written in registry) using track bar or up-down, left-right keys.

enter key switches LED on and off. just like big on screeen button.

have fun.
 

Attachments

  • FlashLightCab.CAB
    29 KB · Views: 440

ZaJules

Senior Member
Sep 13, 2005
341
61
49
Port Elizabeth
new feature request.

Using the Gsensor let it keep the led on as long as the device senses motion, put it down and it turns the led of in 10 seconds.

Doable?

Thanks

Jules
 

billu

Senior Member
Dec 10, 2007
390
17
Now thats an excellent suggestion.

Are we 100% sure that leaving the LED on for prolonged periods at the low level is not going to have any adverse effect on it.