[APP][2.1+] TeslaLED 3.0 beta

Search This thread

kevin@TeslaCoil

Senior Member
May 19, 2010
498
5,110
Chicago
teslacoilsw.com
TeslaLED is an LED flashlight app for many phones. TeslaLED has been out for over a year, but TeslaLED 3.0 beta is a fresh rewrite (giving me an test bed to try some new development ideas and tools).

Features of TeslaLED:
  • LED Flashlight
  • Strobe/Morse Code
  • Keep LED on with screen off (May flicker once)
  • Different widget styles
  • Free and No ads

TeslaLED is known to work on the following devices. It may work on other devices as well, but may require changing the "LED Method" in preferences.

  • Nexus One, Nexus S
  • Motorola Droid, Droid X, Droid 2, Atrix
  • HTC EVO, Droid Incredible, Thunderbolt, Desire, Desire HD, MyTouch 3G Slide, T-Mobile G2, Legend
  • Galaxy S II i9100
  • Galaxy S Epic and Fascinate (Strobe/Morse code do not work)
  • Galaxy Tab 7" and 10.1"
  • Xoom
  • Acer A500


I'm looking for bug reports (especially features of phones that broke since the Market version 2.0.4)





Download Link:
https://market.android.com/details?id=com.teslacoilsw.flashlight
http://teslacoilsw.com/android/teslaled/TeslaLED_3.0.1.apk

Note: My google-alerts show this APK spreading to pirate sites. The app is free so this isn't a big deal, but if doing so can you link back here?
 
Last edited:

kevin@TeslaCoil

Senior Member
May 19, 2010
498
5,110
Chicago
teslacoilsw.com
I have the old donate version. Do you recommend uninstalling that before installing this?

It won't hurt to have both installed (This is actually how I tested and compared, using TeslaLED Donate 2.0.4 and TeslaLED (non-donate) 3.0beta ), however having both installed means when going to add the widget you'll see both listed as TeslaLED with the same icon so it's a bit confusing. On my devices the 2nd option was the 3.0 beta but I'm not sure how android sorts that list so it might vary.
 

Childofthehorn

Inactive Recognized Developer
Jun 6, 2010
260
185
DFW, Texaaas
Have you thought about pulsing the signal to the LED so quickly that it emulates a true PWM feature or using the built in PWM on the LED in most phones to create pulsing or breathing LED with variable speeds or patterns.

I would love to help you with it and we could add the one good Apple thing to our phones that they don't even have on the iPhone.

Sound Cool?
 

kevin@TeslaCoil

Senior Member
May 19, 2010
498
5,110
Chicago
teslacoilsw.com
Have you thought about pulsing the signal to the LED so quickly that it emulates a true PWM feature or using the built in PWM on the LED in most phones to create pulsing or breathing LED with variable speeds or patterns.

I would love to help you with it and we could add the one good Apple thing to our phones that they don't even have on the iPhone.

Sound Cool?

Unfortunately the LED APIs are more like desktop APIs rather than microcontroller APIs (or bits to twiddle I guess).
HTC's is best which gives variable brightness (most likely implemented by an internal PWM) and responds quickly and is easy to use (write to a file in /sys/devices).
Standard/Standard+ are using the camera APIs which are a bit slow and have the choice of either on or off

TeslaLED's strobe at 20Hz stutters once in a while when using the camera API and PWM would need much higher than 20Hz.

With root or a custom kernel I'm sure you could have a bit more control over the flash, but it'd likely be rather device specific and still might not even lead to true PWM control as the camera might have it's own private controller that is slow to accept commands.
 

icehot666

Member
May 21, 2011
34
2
Fareham
Got problems on my Galaxy S2, I started the LED, either using widget locker or using the widget on my home screen, then after the screen goes off, the led goes off then on again (which I believe is normal). If I wait a further 15 seconds approximately then the LED goes off again and this time stays off.

At this point both the widget won't work to turn it back on or off, nor the built in widget for widget locker. I can however close it using the notification bar. When I try to close it using the above methods I get a force close error:

"The application TeslaLED (process com.teslacoilsw.flashlight) has stopped unexpectedly. Please try again."

This is the case for both beta 3 and the released version of the software. I've sent a bug report.
 
Last edited:

kevin@TeslaCoil

Senior Member
May 19, 2010
498
5,110
Chicago
teslacoilsw.com
Got problems on my Galaxy S2, I started the LED, either using widget locker or using the widget on my home screen, then after the screen goes off, the led goes off then on again (which I believe is normal). If I wait a further 15 seconds approximately then the LED goes off again and this time stays off.

I have a Galaxy S2 now and I was wondering why I couldn't reproduce the problems people said they had, even when I was using the old version. It seems the wait 15 seconds, with the device not plugged into a computer, is key. It also makes it much more difficult to get debug logs.

Unfortunately I couldn't find any tricks to get the LED to stay on with the screen off, so I'm going to need to disable that ability on the GS2. Keeping the screen on works and TeslaLED has a (disabled by default) "Dim Screen" page you can use to have a fake-screen-off. Not perfect though (and only accessible from the app).
 

nightranger73

Senior Member
Oct 20, 2010
979
263
50
Reggio Emilia
OPPO Find X3 Neo
I have a Galaxy S2 now and I was wondering why I couldn't reproduce the problems people said they had, even when I was using the old version. It seems the wait 15 seconds, with the device not plugged into a computer, is key. It also makes it much more difficult to get debug logs.

Unfortunately I couldn't find any tricks to get the LED to stay on with the screen off, so I'm going to need to disable that ability on the GS2. Keeping the screen on works and TeslaLED has a (disabled by default) "Dim Screen" page you can use to have a fake-screen-off. Not perfect though (and only accessible from the app).

I think it happens when phone enters in deep sleep state where the CPU is turned off to save battery (so when plugged it's not needed). You should try using wakelock threads to keep it active

Sent from my GT-I9100

If you find this post usefull please press the "Thanks" button
 

Top Liked Posts

  • There are no posts matching your filters.
  • 26
    TeslaLED is an LED flashlight app for many phones. TeslaLED has been out for over a year, but TeslaLED 3.0 beta is a fresh rewrite (giving me an test bed to try some new development ideas and tools).

    Features of TeslaLED:
    • LED Flashlight
    • Strobe/Morse Code
    • Keep LED on with screen off (May flicker once)
    • Different widget styles
    • Free and No ads

    TeslaLED is known to work on the following devices. It may work on other devices as well, but may require changing the "LED Method" in preferences.

    • Nexus One, Nexus S
    • Motorola Droid, Droid X, Droid 2, Atrix
    • HTC EVO, Droid Incredible, Thunderbolt, Desire, Desire HD, MyTouch 3G Slide, T-Mobile G2, Legend
    • Galaxy S II i9100
    • Galaxy S Epic and Fascinate (Strobe/Morse code do not work)
    • Galaxy Tab 7" and 10.1"
    • Xoom
    • Acer A500


    I'm looking for bug reports (especially features of phones that broke since the Market version 2.0.4)





    Download Link:
    https://market.android.com/details?id=com.teslacoilsw.flashlight
    http://teslacoilsw.com/android/teslaled/TeslaLED_3.0.1.apk

    Note: My google-alerts show this APK spreading to pirate sites. The app is free so this isn't a big deal, but if doing so can you link back here?
    2
    Thank you very much for this application! This was exactly what I was looking for. :)

    By the way, can you tell me if I can change toggleState function (from my SystemUI.apk \ FlashlightButton.smali) so that it can directly use TeslaLED? This was linked to CyanogenMod torch (net.cactii.flash2) which is not working properly on my phone.

    Code:
        const-string v5, "net.cactii.flash2.TOGGLE_FLASHLIGHT"
        invoke-virtual {v0, v3}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V

    Very unique request. Actually I think I can do better. Untested as I don't have CM7 installed anywhere right now, but you can give this beta a try: https://plus.google.com/u/1/b/107603899862984674678/107603899862984674678/posts/5SKN1yRrXPP and then enable Settings > CM7 Torch Receiver ? That will have TeslaLED listen for net.cactii.flash2.TOGGLE_FLASHLIGHT .
    1
    Okay I've updated the OP with a link for beta3. This fixes the first-run bug some of you were experiencing. (No real need to update if you already have beta2 as it won't happen again)
    1
    Thank you very much for this application! This was exactly what I was looking for. :)

    By the way, can you tell me if I can change toggleState function (from my SystemUI.apk \ FlashlightButton.smali) so that it can directly use TeslaLED? This was linked to CyanogenMod torch (net.cactii.flash2) which is not working properly on my phone.

    Code:
    .method protected toggleState()V
        .locals 6
    
        .prologue
        const-string v5, "net.cactii.flash2.TOGGLE_FLASHLIGHT"
    
        .line 53
        iget-object v3, p0, Lcom/android/systemui/statusbar/powerwidget/PowerButton;->mView:Landroid/view/View;
    
        invoke-virtual {v3}, Landroid/view/View;->getContext()Landroid/content/Context;
    
        move-result-object v0
    
        .line 61
        .local v0, context:Landroid/content/Context;
        invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
    
        move-result-object v2
    
        .line 62
        .local v2, pm:Landroid/content/pm/PackageManager;
        new-instance v3, Landroid/content/Intent;
    
        const-string v4, "net.cactii.flash2.TOGGLE_FLASHLIGHT"
    
        invoke-direct {v3, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
    
        const/4 v4, 0x0
    
        invoke-virtual {v2, v3, v4}, Landroid/content/pm/PackageManager;->queryBroadcastReceivers(Landroid/content/Intent;I)Ljava/util/List;
    
        move-result-object v1
    
        .line 64
        .local v1, l:Ljava/util/List;,"Ljava/util/List<Landroid/content/pm/ResolveInfo;>;"
        invoke-interface {v1}, Ljava/util/List;->isEmpty()Z
    
        move-result v3
    
        if-nez v3, :cond_0
    
        .line 65
        new-instance v3, Landroid/content/Intent;
    
        const-string v4, "net.cactii.flash2.TOGGLE_FLASHLIGHT"
    
        invoke-direct {v3, v5}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
    
        invoke-virtual {v0, v3}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
    
        .line 68
        :cond_0
        return-void
    .end method
    1
    One more last request. Given that I wanted to release my ROM with your app integrated, I wished that CM7 Torch Receiver was enabled by default... I noticed that /data/data/com.teslacoilsw.flashlight/shared_prefs/Flashlight.xml does not contains that preference... :(

    I didn't want it enabled by default as it could conflict weird if someone actually has the CM Torch and TeslaLED together (both would try to turn on the led). I agree that not showing on the indicator is annoying.

    TeslaLED 3.0.2 now on the Market removes that option completely, but supports the TeslaLEDCM7Receiver which acts as the cactii receiver and also has the system settings permission to update the indicator: http://teslacoilsw.com/tmp/TeslaLEDCM7Receiver.apk


    Source is dead simple:

    Code:
    package com.teslacoilsw.teslaledcm7receiver;
    
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.provider.Settings;
    
    public class CactiiReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent == null)
                return;
            if ("net.cactii.flash2.TOGGLE_FLASHLIGHT".equals(intent.getAction())) {
                Intent i = new Intent("com.teslacoilsw.intent.FLASHLIGHT");
                i.putExtra("toggle", true);
                context.startService(i);
            } else if ("com.teslacoilsw.flashlight.ON".equals(intent.getAction())) {
                Settings.System.putInt(context.getContentResolver(), "torch_state", 1);
            } else if ("com.teslacoilsw.flashlight.OFF".equals(intent.getAction())) {
                Settings.System.putInt(context.getContentResolver(), "torch_state", 0);
            }
        }
    
    }