FORUMS
Remove All Ads from XDA

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

563 posts
Thanks Meter: 42
 
By NetRipper, Senior Member on 31st August 2008, 07:54 PM
Post Reply Email Thread
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:
- [S]sosCode (SZ), default " ...---...". Configures the morse code to signal.[/S]
- [S]sosDotTimeoutInMs (DWORD), default 200. Configures 200ms LED on, and 200ms LED off for ".".[/S]
- [S]sosDashTimeoutInMs (DWORD), default 400. Configures 400ms LED on, and 400ms LED off for "-".[/S]
- [S]sosSpaceTimeoutInMs (DWORD), default 1000. Configures 1000ms pause when processing space " ".[/S]
* 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!
Attached Files
File Type: zip TorchButtonLib_csharp_v1.0.zip - [Click for QR Code] (6.9 KB, 3426 views)
File Type: cab TorchButton_v1.5.cab - [Click for QR Code] (59.9 KB, 14477 views)
File Type: zip TorchButton_v1.5_src.zip - [Click for QR Code] (137.0 KB, 2696 views)
File Type: txt TorchButton_v1.5_readme.txt - [Click for QR Code] (6.3 KB, 3429 views)
 
 
31st August 2008, 08:13 PM |#2  
Senior Member
Flag Warsaw
Thanks Meter: 0
 
More
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.]
31st August 2008, 08:40 PM |#3  
Senior Member
Thanks Meter: 0
 
More
Tnx
Tnx for your effort. It works great.
31st August 2008, 09:31 PM |#4  
WDawn's Avatar
Senior Member
Flag Zwevegem
Thanks Meter: 26
 
More
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
31st August 2008, 09:33 PM |#5  
Senior Member
Thanks Meter: 1
 
More
works great! Nice job! This will become a standard application on all custom roms
31st August 2008, 09:45 PM |#6  
Member
Thanks Meter: 1
 
More
:o)
Thank you NetRipper. This is a 5 Star utility!!!
31st August 2008, 09:52 PM |#7  
da_jojo's Avatar
Senior Member
Flag Utrecht
Thanks Meter: 5
 
More
HALLELUJAH !

thank you a million times !

make that trillion
31st August 2008, 10:19 PM |#8  
NetRipper's Avatar
OP Senior Member
Flag 's-Gravendeel
Thanks Meter: 42
 
Donate to Me
More
Thanks for all the great responses and I'm glad it works for everyone. I'll add that feature to change the hardcoded 30 seconds timeout tomorrow or the day after.
31st August 2008, 10:28 PM |#9  
da_jojo's Avatar
Senior Member
Flag Utrecht
Thanks Meter: 5
 
More
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 ?
31st August 2008, 10:38 PM |#10  
Senior Member
Thanks Meter: 6
 
More
Thank you . I have it as part of favourite programs in TF3D . Works great.
31st August 2008, 11:00 PM |#11  
NetRipper's Avatar
OP Senior Member
Flag 's-Gravendeel
Thanks Meter: 42
 
Donate to Me
More
Quote:
Originally Posted by da_jojo

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.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes