Bug 12889 - Hook ambient light sensor to auto-brightness control
: Hook ambient light sensor to auto-brightness control
Status: CLOSED FIXED
Product: SB Radio
Classification: Unclassified
Component: Settings
: Include FW version in comment
: PC Other
: P1 normal (vote)
: 7.4.0
Assigned To: Chris Owens
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-16 07:35 UTC by Caleb Crome
Modified: 2009-10-05 14:31 UTC (History)
6 users (show)

See Also:
Category: Bug


Attachments
Detailed test report (4.91 KB, application/force-download)
2009-09-24 09:20 UTC, Chris Owens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caleb Crome 2009-07-16 07:35:29 UTC
Dunno if I'm missing this in the UI somewhere, but it appears that the brightness is not currently hooked up to the ambient light sensor.

It should be :-)
Comment 1 Felix Mueller 2009-07-23 15:30:36 UTC
Hi Raphael

Do you think you'll find time to do something similar as you did for Fab4?
Comment 2 Felix Mueller 2009-08-09 02:53:35 UTC
Raphael added a first version of that (r6968). Automatic mode can be enabled in the Brightness applet.
Comment 3 James Richardson 2009-08-18 20:35:43 UTC
These are marked as CAT, yet that milestone is over now.  Please re-target accordingly.
Comment 4 SVN Bot 2009-08-19 22:54:32 UTC
 == Auto-comment from SVN commit #7165 to the jive repo by ccrome ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7165 ==

Bug #12889, Bug #12753.  I implemented the lower brightness mode.  This allows the baby display to go very dim.  

I had to change the applet code so that it uses the bl_power in the /sys interface to switch to dim mode.  This required that each entry of the brightnessTable contains a pair of values, rather than a single value.  

I believe I got all the manual settings, but I think I broke the ambient light sensor code (which was kind of broken anyway).  

Raphael, would you mind taking a look at that, and see if you can see what I broke?

The brightness is always an *index* into brightnessTable, rather than a value.  This means that you don't want to be multiplying brightnesses, only adding and subtracting. 

Only setBrightness should dig into the brightnessTable values.

-Caleb
Comment 5 Caleb Crome 2009-08-19 23:14:12 UTC
Oops, this breaks PB1 units.  (And maybe PB2 units).

How do I check for board revision in lua?
Comment 6 Felix Mueller 2009-08-20 18:44:49 UTC
*** Bug 12999 has been marked as a duplicate of this bug. ***
Comment 7 Felix Mueller 2009-08-21 03:44:19 UTC
Manual brightness for PB1 and PB2 units fixed in r7189.
Comment 8 Mark Miksis 2009-08-21 06:36:00 UTC
*** Bug 13555 has been marked as a duplicate of this bug. ***
Comment 9 Mark Miksis 2009-08-22 16:57:56 UTC
*** Bug 13604 has been marked as a duplicate of this bug. ***
Comment 10 Pat Ransil 2009-09-08 16:49:13 UTC
Comment 7 says 'fixed in pb1 and pb2' - is that so? Is this an issue for later versions? If OK in later versions, don't worry about pb1/2 units.
Comment 11 Sue Chastain 2009-09-09 07:22:06 UTC
I thought when this bug was fixed we would have automatic brightness working based on the ambient light sensor. Comment 7 says that MANUAL brightness is fixed, but as far as I can tell, automatic brightness still doesn't work properly. When I set my PB1 for automatic brightness it just does an annoying strobe effect between two brightness levels whether the room is dark or bright. Is this something that can't or won't be fixed in PB1 units? Mine is on Firmware: 7.4.0-r7453.

The lack of automatic brightness makes it difficult to test Baby in certain environments.
Comment 12 Mickey Gee 2009-09-12 09:05:36 UTC
Is this really fixed? I'm not sure. Here's what I did with a PVT unit and firmware 7526:

1. I set Brightness->Brightness Control->Automatic Brightness.
2. I left in my kitchen overnight. Very dark. Plugged into wall with battery.
3. Before I left the kitchen for the night, I watched the brightness of the screen dim -- step by step, inc by inch. The screen was at a reasonable dim level before I left the room.
4. Next morning, the screen still looked dim.
5. I took it outside by disconnecting it from AC. It's an overcast day, and the screen was so dim I could barely read the screen.
6. Was somehow able to go back to Brightness->Brightness Control screen. The screen then got bright. I thought it might be OK without any adjusting, so I didn't make a change.
7. I put it down to start writing this bug, and the screen had automatically became super dim again.
8. I navigated back to Brightness Control screen and put it on Manual. I can now read the screen again.
Comment 13 Richard Titmuss 2009-09-14 00:51:53 UTC
Felix, could you see if Raphael has time to look at this over the next couple of days, or can you fix it?
Comment 14 Caleb Crome 2009-09-14 21:22:36 UTC
This must be tested with a PVT or later unit.  It can't be done on a PB1 or PB2 unit.

-C
Comment 15 Felix Mueller 2009-09-15 00:39:27 UTC
Caleb: How can a PVT unit be identified again? Is hardware version 3 good enough?
Comment 16 Caleb Crome 2009-09-15 08:33:14 UTC
Right, HW rev 3, 4, or 5 would be fine
Comment 17 Felix Mueller 2009-09-16 04:41:56 UTC
Mickey: Caleb fixed bug 14075 in r7594 which solves the issue where the display would stay dark even when the surrounding is bright again.

I did some quick tests with r7594 and my Baby did behave as I would have expected it.

I also talked to Raphael today and asked him to try to improve automatic brightness control while Baby is used. I.e. when the display is in active (not dimmed) state.
Comment 18 Raphael Juchli 2009-09-18 00:50:43 UTC
As discussed with Felix my changes to the brightness algorithm are as follows:

- Automatic Brightness even if the Baby is in the ACTIVE state
- Spikes in the returned lux values from the sensor are filtered out using average and standard deviation of the last 8 (MAX_SMOOTHING_VALUES) lux values.
- Brightness Timer now runs ever 500ms

How the new algorithm behaves can be controlled with the MAX_SMOOTHING_VALUES variable.

The higher it is the bigger/more spikes are filtered out but has the side effect of delaying actual "big" changes to the brightness by 500ms * MAX_SMOOTHING_VALUES

Please note I only tested on my R1 Hardware until my new one arrives.
Comment 19 SVN Bot 2009-09-18 02:22:42 UTC
 == Auto-comment from SVN commit #7652 to the jive repo by felix ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7652 ==

Bug: 12889 
Description: Checkin on behalf of Raphael.
Comment 20 SVN Bot 2009-09-20 03:30:48 UTC
 == Auto-comment from SVN commit #7665 to the jive repo by felix ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7665 ==

Bug: 12889 
Description: Changed some log levels to unclutter debug output.
Comment 21 Chris Owens 2009-09-22 09:54:31 UTC
Chris to review to see 1) what priority is 2) what correction should be made
Comment 22 SVN Bot 2009-09-24 06:58:21 UTC
 == Auto-comment from SVN commit #7729 to the jive repo by felix ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7729 ==

Bug: 12889 
Description:  
- Adjusted minimal brightness
- Fix for spurious (wrong) values from ambient light sensor.
Comment 23 Chris Owens 2009-09-24 09:15:48 UTC
IMO, this is good enough to ship.

If someone disagrees with me, the following changes should make it much better:

Reported value	Current brightness multiplier *
11		1
13		1
700		1
1286		1
1400		0.9
2053		1
2800		1
3800		1
7000		1.25
16500		1.25
65535		1

I will attach a more detailed report as a .pdf
Comment 24 Chris Owens 2009-09-24 09:20:28 UTC
Created attachment 5920 [details]
Detailed test report
Comment 25 Caleb Crome 2009-09-24 17:14:55 UTC
The auto-brightness is already pretty good.  I just fixed a bug in the ambient light sensor code, so now it shouldn't have the spurious 65535 readings.  The 65535 readings will still be the number of 'dark' but, it won't have spurious ones.

That was fixed in Bug #14259, but only on trunk, not on 7.4.0.

-Caleb
Comment 26 Caleb Crome 2009-09-24 22:26:13 UTC
Hey, nice table Chris!  Now I get your previous comment :-)
Comment 27 Chris Owens 2009-09-27 13:15:47 UTC
This bug as written has been fixed.

See also bug 14341 and bug 14342 for continuing issues.
Comment 28 James Richardson 2009-10-05 14:31:18 UTC
This bug has been marked as fixed in the 7.4.0 release version of SqueezeBox Server!
    * SqueezeCenter: 28672
    * Squeezebox 2 and 3: 130
    * Transporter: 80
    * Receiver: 65
    * Boom: 50
    * Controller: 7790
    * Radio: 7790  

Please see the Release Notes for all the details: http://wiki.slimdevices.com/index.php/Release_Notes

If you haven't already, please download and install the new version from http://www.logitechsqueezebox.com/support/download-squeezebox-server.html

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.