FS#10581 - Separate backlight setting for viewer

Attached to Project: Rockbox
Opened by Crend King (CrendKing) - Thursday, 03 September 2009, 22:29 GMT
Task Type Patches
Category Plugins
Status Unconfirmed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Hello! I made this patch to add a separate backlight setting for the viewer plugin. By default the viewer plugin use Rockbox global backlight setting. For battery life, the backlight length would be usually too short in viewer, since reading a page may take more than 10 seconds. Bring the backlight on again by pressing buttons or wheel could be painful since it may cause unwanted effects (e.g. scroll to top/bottom of the text).

I added two options: Use global setting (default) and Always on. When setting to "Use global setting", everything should remain the same as before. When setting to "Always on", the backlight should never dim off. Changing the option during reading will immediately applies effect. I use the helper functions "backlight_use_settings" and "backlight_force_on" to achieve this.

Warning: since I changed the preference struct, after installing the new viewer.rock, all previous viewer setting will be abandoned and revert to default settings. You can backup your old viewer.dat (36 bytes), wait the new viewer.dat (40 bytes) be generated, and overwrite the first 36 bytes from the old viewer.dat to restore the setting. I don't know if there is a painless way for the transition. Suggestions are welcomed.

Thank you!
   patch (2.4 KiB)
This task depends upon

Comment by Crend King (CrendKing) - Thursday, 03 September 2009, 22:31 GMT
This patch is generated from the rockbox-20090903.7z, which extracts rockbox-21932 (though in the Rockbox website, it says rev 22609).
Comment by Seth (froggyman) - Thursday, 03 September 2009, 23:15 GMT
You should really use SVN if you want to do any devolping. Here is some more info on SVN:
Comment by Crend King (CrendKing) - Friday, 04 September 2009, 04:06 GMT
I understand. But the firewall blocks all outbound port except 80 and 443. I cannot use the svn protocol easily. Sorry.
Comment by Thomas Martitz (kugel.) - Friday, 04 September 2009, 12:13 GMT
Just wondering why you made an enum, but don't use the enum member in the rest of the code.
Comment by Crend King (CrendKing) - Friday, 04 September 2009, 19:33 GMT
Simply mimc other options, like , to make the function working. There must be some better idea, but I'm new in Rockbox dev. I'll go check if I can use some boolean like code.

Also in my own case, I found that, if there is a shortcut way to switch the two backlight mode, like pressing a button, it would be much more convenient. Sometimes I have to do something for a while when I'm reading. Keep the backlight always on is bad for battery life in this case. The quick screen does not work in viewer.

Another idea is to make a backlight mode indicator which shows in Always on mode.