[Help] Tasker & Brightness Script - General Questions and Answers

Writing my first scripts for Tasker & looking for some help while I try to figure this out.
I'm trying to write 2 scripts. One is to increase brightness, and one is to decrease it.
I have tasker, and I have the Screen Filter app (which has a plug in for Tasker).
I'd like to make a shortcut (that I will be calling from yet another app) that will increase brightness from:
Screen Filter 40%, Screen 0
SF 0%, S 0
SF 0%, S 50
SF 0%, S 150
SF 0%, S 255
Then the opposite for decrease.
The idea was to set a variable called %Bright, and use a if-else-else-else-end if that checked the current level of the variable, and set the screen 1 brighter and set the variable to a new value. (ie, check current brightness then increase by 1 level).
Problem is if anything other then my shortcut changed the brightness, Tasker doesn't know about it. (Say if I use Quick Settings)
There any way to get Tasker to check the current state of the brightness (and screen filter)? There a better way to do this inside Tasker?
(btw, I am aware of other apps to control brightness. please don't mention them in this thread)
EDIT: Wrote the script out with no problems assuming variable is set. For now, using variable 1-5 (dimmest to brightest). If variable is not set, or anything else, then both my dim script & my bright script will just set it to 1 and go from there.

Related

How can you dim the screen further?

Hey Everyone,
As has been mentioned many times in other threads:
1) The LCD is often the biggest battery drainer
2) The 'minimum' setting of the brightness setting is still needlessly bright.
It certainly can be pushed further down for dim/night/dark settings.
3) Certain apps "dim" the screen but are just changing the color, not the backlight. So while useful they still aren't helping your battery.
Following some tips from a different android phone, I found this file:
/sys/devices/platform_/nov_cabc.0/leds/lcd-backlight/brightness
Which appears to contain the current 'brightness #' of the LCD backlight.
Using the normal Brightness slider, the value changes from 30 - 255, with 255 being the brightest. So this clearly could be reduced further.
Setting 'Screen Filter' to 50% brightness has no effect on the value.
Here's something interesting:
Assume the screen is already set at lowest brightness.
When I use 'Widgetsoid' to set brightness to '1', the screen dims slightly, then brightens back up. The 'brightness' file gets set to 20.
'widgetsoid 20' feels the same as 'min brightness 30'. - I wonder if Android is enforcing minimum backlight?
Anyway, thought that would be interesting to note. I'm going to download some other screen dimmer apps and see what they do.
- Frank
I found this online which is very interesting reading:
http://www.scribd.com/doc/35972886/An-Analysis-of-Power-Consumption-in-a-Smart-Phone
At '30' they said the display consumed 7.8 mW, while at 255 it consumed 414 (!!!)
Various apps coud push the value to 20 - tasker, adjbrightness.
Tasker tries to set it lower but as with widgetsoid, you can see the screen get forced back up to 20.
adjbrightness can "set" it lower than 20, but the entire screen blacks out, even at 19. Remember where the other buttons are so you can restore brightness!
- Frank
Whoa, thanks for the information. That pretty insane but its an apparently in the Market: Screen Filter, saves a helluva lot of battery.
Edit: Nevermind, Frank shut me up LOL.
Sent from my HTC Glacier using XDA App
I read a thread that said that the stock rom just doesn't allow setting it that low.
Ah well
- Frank
ChodTheWacko said:
I read a thread that said that the stock rom just doesn't allow setting it that low.
Ah well
- Frank
Click to expand...
Click to collapse
Can you set it lower in other roms - like cm7?
netter123 said:
Can you set it lower in other roms - like cm7?
Click to expand...
Click to collapse
I've been playing with CM7 which has some nice features for customizing the auto-brightness settings as well as the "dim" value which seems to be the lowest value the screen will go to and what it gets set to when the screen dims before shutting off after a timeout.
For the Dim setting in CM7, the default is 20. The next highest setting in the picker is 18. I believe it goes down to 0 or 1. When set to 18 or lower the screen blanks out completely when dimmed. Depending on how you test this, you may have a problem getting the screen back, so be careful you know where your widget button is on the screen to bring it back... 20 seems to be the lowest value. However, while dim, in a very dark room it could certainly be even dimmer so I don't know why lower values don't work.
I've also found the light detector doesn't seem to detect a continuum of light levels. It seems to be quantized at particular values, so there's a pretty hard limit on how fine you can set the auto brightness levels since the lowest light reading it seems to take is not very sensitive. It can't seem to distinguish between a fully darkened room and a dimly lit room, so setting the lowest value automatically makes the screen too dark to be comfortable in many environments, but then too bright for a really dark room. I don't know if this is an issue with the ROM software or a hardware limitation of the sensor. I've set my lowest auto setting to 40 which seems to work well, then I manually switch it to the dim value (20) if I'm in the dark.

[R&D] Settings Screen Brightness API Issue

I am writing an application that changes the brightness, and I noticed that the Skyrocket does not return the proper values.
Using the Settings class if I call:
Settings.System.getInt(resolver,Settings.System.SCREEN_BRIGHTNESS);
25 is returned the first time regardless of the system brightness. If I call it again, then the proper value is returned.
Can you guys confirm or deny this issue? I've tested on another phone and emulator, which work as documented.
wrong thread somehow. wat.
My screen doesn't keep it's brightness settings when I use another program besides the built-in brightness changer in the Settings menu. If I set it low and I lock it, it always comes back up to full brightness after I turn it back on. Weird.
Seems that the T989 t-mo variant has the same issue with CM7's display tweaking utilities. Something in the hardware seems to always make it come back on at a hardcoded predefined brightness.
Hi,
As I recall from poking around the kernel source, there are some routines that intercept the value passed from the ROM and tweak it a bit before actually applying it to the screen.
Take a look at ./drivers/video/msm/lcdc_ld9040.c in the kernel source, IIRC there are some hardcoded values in here that might be resulting in your reading of 25 (I think there is a minimum value of 24 set somewhere in there, been a while since I looked)

[Kernel Module] Backlight: Lower Brightness (Useful at Night)

(dev only for now, you need to know how to install/load a kernel module by hand/write a init.d script for it)
Hi,
I was annoyed by the too bright backlight especially at night. Even the lowest (non-zero) setting was too bright for me (see my thread in general section).
Thanks to irfanbagus BCM-TWEAK which I could easily adapt here's kernel module to lower the lowest brightness. This means that only the former lowest mode is changed to an even lower brightness, the other modes remain the same.
I've attached a kernel module for this incl. source (based on irfanbagus' source, say thanks to him ).
After loading this module you can simply use the system backlight setter to dim the backlight. In case it was already set to lowest brightness, simply increase the brightness and then decrease it again to apply the updated mode.
This doesn't work with GO Launcher's setting widget's backlight setter and probably also not with other 3rd party backlight setters.
If you test it, please report.
More details about backlight/brightness (see aat1401_bl.c in kernel source if you're interested):
- brightness level is a value in [0,255] (most apps map this to [0,100]%)
- in fact there're just about 25 different brightness levels which a stored in a table, each entry has a 'level' and a 'tune_level' value
- the tune_level (>0) determines the brightness: low level low brightness, high level high brightness
- there's a "lowest" level (30) but only the system setter respects this. This level's tune_level is changed by my kernel module to 1 instead of 2
- system's brightness setter allows no level below 30 thus my mod works good with it
- other setters allow levels below 30 and here is the problem:
The responsible module for setting the backlight brightness looks at the level value in [0,255]. If it's below 30 then a default tune_level of 2 is used.
The GO Launcher widget probably simply sets the level to 0.
I don't know a way to change this default tune_level in a already compiled/running kernel.
So if you want to use another setter, make sure to choose level 30 or about 12% because then my updated tune_level will be used. Usually 12% should map to level 30. If not, I can't help you. Use system setter instead.
Btw to switch backlight off (warning, not recommended) you can use the direct way: echo 0 > /sys/class/backlight/aat1401-backlight/brightness
Found a widget which allows custom brightness values and works fine with my mod: Brightness Widget - Backlight!
Tested with this settings: 30,1,150,255
i am using switch pro widget..range from
0% ----> 100%
ronnieryan said:
i am using switch pro widget..range from
0% ----> 100%
Click to expand...
Click to collapse
0% = no backlight?
Anyway, with my mod you'd have the lowest brightness at 12%.
mikstev said:
0% = no backlight?
Anyway, with my mod you'd have the lowest brightness at 12%.
Click to expand...
Click to collapse
yes, 0% no backlight, but its so inconvenient ..10% is better
Interesting, I'll have a look.
Edit: As far as I see this widget doesn't require root. Even if it could disable backlight (I'm not sure if this is possible) its lowest non-zero brightness is higher than with my mod.
how can i use this sir?
nakawanaoki said:
how can i use this sir?
Click to expand...
Click to collapse
1. Copy the .ko file to /system/lib/modules
2. Set the file permissions to 644
3. Install the module via insmod bl_brightness-tweak.ko (you can also use a init.d script for this, you can adapt the one I uploaded in the droidwall thread)
I am not sure why,
but on trying to turn off screen with "echo 0" it is only get darker, but not completely off.
Is there any way to really turn of screen ?
Thank you,
Ranchu

Fix adaptive brightness (windows rt/8)

I customized a luminosity curve for my surface rt, just edit the registry keys.
Download extract and run the attached .reg file and confirm the insertion of the Keys, then reboot the system.
Alert to make a backup of the old keys if you want to restore the previous state.
This change is compatible with all windows 8 but I have tested only on the surface.
Adaptive brightness varies proportionally to the user manual brightness, I suggest to manually adjust the brightness bar to about 20%, if you place the bar at 0 the brightness will be minimal with no automatic adaptation.
Appreciated thanks
New version v2
New improved version.
Try it and tell me if it's okay.
In the zip you will find the normal version and one with more brightness in the dark
I suggest to manually adjust the brightness bar to about 25%
So you have a fix, that's great. But to what? You didn't state what the problem is. Neither did you way what you are doing differently over the default values. Why would me, or anybody else for that matter, want do download this?
Amax said:
So you have a fix, that's great. But to what? You didn't state what the problem is. Neither did you way what you are doing differently over the default values. Why would me, or anybody else for that matter, want do download this?
Click to expand...
Click to collapse
In my surface the luminosity curve does not satisfy me.
The display seemed to have only three levels of brightness, setting an average value (ie on the desk in the room in the morning) adaptivity did not fit values ​​for low-light (night) and lots of light, that is to say the brightness in the dark was not a minimum making it annoying for the view and unnecessary consumption of battery, instead with shaded light levels brightness became easily maximum, with again a waste of battery.
This forced me to move often the brightness bar manually, but now with my calibration does not touch more because it adapts automatically to any light condition.
Also the adaptation of brightness occurred after 3 seconds by the change of light, whereas now changes instantly in 0,1 seconds (100ms).
I like it a lot, just what I was looking for.
I use mostly in low light conditions my surface so it is very useful.
Just one remark: it is too sensitive so it is changing screen brightness very quickly even when I just touching the upper part of the screen and making a little shade on the light sensor...
So I think instead of 1 msec. would be better 3 msec.
Would you please and make a 3. version of the settings with 3 msec.?
Alapar said:
I like it a lot, just what I was looking for.
I use mostly in low light conditions my surface so it is very useful.
Just one remark: it is too sensitive so it is changing screen brightness very quickly even when I just touching the upper part of the screen and making a little shade on the light sensor...
So I think instead of 1 msec. would be better 3 msec.
Would you please and make a 3. version of the settings with 3 msec.?
Click to expand...
Click to collapse
100ms not 1ms! However, this file will change only the time in 300ms
antys86 said:
100ms not 1ms! However, this file will change only the time in 300ms
Click to expand...
Click to collapse
You are right, 100 ms. I was in a hurry. Thanks for the fast response and update
Your v2 seems to be working fine for me. Before applying it I could really tell when my surface was adjusting the screen, after applying it the transitions seems smoother and less abrupt.
I have been looking for documentation about how all of these things really work and the closest thing i could find was this link http://superuser.com/questions/644538/customize-adaptative-brightness-in-windows-8
but they seem to be using a different registry location than what you are and different registry names
regardless your settings seem to work immediately after restarting the sensor service

Tasker Guide to Auto Brightness

Follow this Guide at Your Own Risk.
I am not responsible for bricked devices, lost data, thermonuclear war or getting fired for missed alarm or whatever happens to your device by following my instructions​
I have been a long time Lux user. But what I found, that Lux is bugged with some compatibility checking wakelock. Also, Lux uses screen overlay which is a problem. For a lot of system features in Marshamllow loaded S7edge alerts that an screen overlay has been detected and this must be disabled. Therefore, I configured Tasker (Paid software available on android market), my most favourite automation tool for android. So, where is the catch?
Process:
1. Disable Auto Brightness and Create a New Task in Tasker.
2. Select Action Category > Display > Display Brightness
3. Then Set Brightness Level value at 15 (Or whatever lowest brightness you're comfortable at)
4. Below, set if parameter as "%LIGHT < 20 (Or whatever brightness level you want for 15% of brightness)
Repeat Process 2-4 to create multiple steps for your brightness level adjustments.
Now, in Tasker profiles, you add a new profile to be triggered by "Events > Display > Display On and assign the created Task.
You can also adjust your brightness on per app basis when you want a specific app to have a set brightness level by following the same process except when creating a profile you have to select "Applications" and assign the created Task or a similar task created separately.
Update:
I have attached a Tasker configuration xml to get started with.
Please note that this guide will setup auto brightness to be adjusted on device wake. You can hook this update to any event as you want.
Tested working on SM-G935FD. Should work on any Tasker compatible android device with Light Sensor.
What's wrong with auto brightness?
drummerman said:
What's wrong with auto brightness?
Click to expand...
Click to collapse
+1.... I think that Android is great because of the customization option available, but sometimes people just over-customise.
There is nothing wrong with Auto-Brightness, and in case you have a problem with it, just override it using the bar on the notification panel.
Still, although I will never use it, this is a nice tutorial.
drummerman said:
What's wrong with auto brightness?
Click to expand...
Click to collapse
Default Auto brightness implemented in S7 edge is buggy. here on xda you can check it out.
Teio said:
+1.... I think that Android is great because of the customization option available, but sometimes people just over-customise.
There is nothing wrong with Auto-Brightness, and in case you have a problem with it, just override it using the bar on the notification panel.
Still, although I will never use it, this is a nice tutorial.
Click to expand...
Click to collapse
But this is not over-customization, at least in my opinion. It means taking more control. I have been using (and many other people are) Lux to adjust the auto brightness behavior which polls sensor data at a specific period, whenever the screen is on. But if you use this guide, it will give you a auto brightness customization solution without polling light data from sensor all the time. even though the sensor will be on, it will not be active. I am not sure that it will impact on battery or not, but it gives me more control over the brightness adjustment.
cheers!
izephyr said:
Default Auto brightness implemented in S7 edge is buggy. here on xda you can check it out.
But this is not over-customization, at least in my opinion. It means taking more control. I have been using (and many other people are) Lux to adjust the auto brightness behavior which polls sensor data at a specific period, whenever the screen is on. But if you use this guide, it will give you a auto brightness customization solution without polling light data from sensor all the time. even though the sensor will be on, it will not be active. I am not sure that it will impact on battery or not, but it gives me more control over the brightness adjustment.
cheers!
Click to expand...
Click to collapse
Good point. Though I don't see the issue on my device, Auto-Brightness works as I expect it to. It gets very bright on sun, and dim on dark rooms (though I would like it to go a tiny bit dimmer to be perfect). Will this Task auto adjust or you need to select the desired brightness yourself?
Teio said:
Will this Task auto adjust or you need to select the desired brightness yourself?
Click to expand...
Click to collapse
You can select the desired brightness level according to your comfort.
Teio said:
Good point. Though I don't see the issue on my device, Auto-Brightness works as I expect it to. It gets very bright on sun, and dim on dark rooms (though I would like it to go a tiny bit dimmer to be perfect). Will this Task auto adjust or you need to select the desired brightness yourself?
Click to expand...
Click to collapse
According to http://www.greenbot.com/article/303...brightness-fixes-a-major-mobile-headache.html and this: http://www.displaymate.com/Galaxy_S7_ShootOut_1.htm you can customize according to your liking .. hadn't tried it though all I need is the AOD to shine a lil bit dimmer
The drawback to this is that it only adjusts brightness based on the level when you turn the screen on. If the ambient light changes, the screen brightness won't change with it.

Categories

Resources