Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic warmth #3825

Closed
gerhaher opened this issue Apr 3, 2018 · 18 comments
Closed

Automatic warmth #3825

gerhaher opened this issue Apr 3, 2018 · 18 comments
Milestone

Comments

@gerhaher
Copy link

gerhaher commented Apr 3, 2018

  • KOReader version: v2015.11-1618-gba46376_2018-04-01
  • Device: KA1

I'm not sure how Github works. Are "closed" threads still active (people reading them)? Threads dealing with natural light and automatic setting were closed, so I open a new one here. :)

Anyway I want to add some comments about this new great feature by dengste.

  1. When maximum is reached it should stay there for several hours. Even if your normal bedtime is for example 23.00, some days you just want to continue reading. :-)
    For inspiration: In nickel, no matter what your chosen bedtime is, the light starts to go back to daylight around 4 a.m and is finished around 8.00 a.m.

  2. There is no way to save the setting to always have the automatic warmth enabled.

  3. Maybe (or maybe not) it would be a good thing to allow the users to choose their prefered maximum level, i.e. if they would prefer something lower than 100%.

  4. Some fixes are needed. From my Kobo Aura One:

reader_2018-apr-02_105019

@Frenzie
Copy link
Member

Frenzie commented Apr 3, 2018

I'm not sure how Github works. Are "closed" threads still active (people reading them)? Threads dealing with natural light and automatic setting were closed, so I open a new one here. :)

People who are subscribed still receive e-mails but new issues are much easier to track. When you take a quick look at the issues you check what open issues exist for Kobo (for example). You don't wonder which closed issues might've received comments.

However, please do refer back to the issue number with #1234.

Pinging @dengste

@dengste
Copy link

dengste commented Apr 3, 2018

Regarding the comments:

  1. It probably makes sense to hold maximum warmth for a couple of hours after bedtime. I'm not very fond of hard-coding a fixed time like 4am in there, though. I deliberately made it possible to set any time as "bedtime", since not all people actually sleep at night, for whatever reason.

  2. The setting should be saved automatically and also be synced with Nickel's configuration. Doesn't that work for you?

  3. I agree it would be nice to have that configurable. I might do that, but at the moment I'm working on other stuff. The easy workaround is to set a later bedtime; the more complicated fix is to change the 'warmth' progression through the 'Configure' button.

  4. Yeah, I modified my DPI setting to have smaller fonts... I guess I'll have to reduce the font size there.

@Frenzie
Copy link
Member

Frenzie commented Apr 3, 2018

Or just stick them underneath each other? :-)

@cramoisi
Copy link
Contributor

cramoisi commented Apr 4, 2018

or trim them. you don't need to repeat warmth under the warmth section (or just auto for automatic) ; and you could say max for maximum. There is a similar thing in the configure menu : your "save settings" overflows the button ; but since we are in the settings menu just saying "save" is enough, i think (I made this change on my ka1)

@gerhaher
Copy link
Author

gerhaher commented Apr 4, 2018

Thanks for your answer @dengste!

It probably makes sense to hold maximum warmth for a couple of hours after bedtime. I'm not very fond of hard-coding a fixed time like 4am in there, though. I deliberately made it possible to set any time as "bedtime", since not all people actually sleep at night, for whatever reason.

Yeah, 2 or 3 hours would be fine.

The setting should be saved automatically and also be synced with Nickel's configuration. Doesn't that work for you?

No, unless there is something more I must do (except for ticking the Automatic warmth box). Every time I exit KOReader the Automatic warmth box becomes unticked.

@AlanSP1
Copy link

AlanSP1 commented Apr 4, 2018

There could be setting below setting for achieving maximum warmth, something like: Hold it for: and there you set for how long you hold maximum value.

@dengste
Copy link

dengste commented Apr 4, 2018

Every time I exit KOReader the Automatic warmth box becomes unticked.

That's weird. Have you modified KOBO_LIGHT_ON_START by any chance?

@gerhaher
Copy link
Author

gerhaher commented Apr 5, 2018

That's weird. Have you modified KOBO_LIGHT_ON_START by any chance?

No I don't think so. In what way? In the "Advanced settings" I have set KOBO_LIGHT_ON_START to 20. Nothing else.

@dengste
Copy link

dengste commented Apr 5, 2018

No I don't think so. In what way? In the "Advanced settings" I have set KOBO_LIGHT_ON_START to 20. Nothing else.

Well, if you set KOBO_LIGHT_ON_START to 20, koreader does not read the frontlightsettings at all but simply sets intensity to 20. This also applies to the warmth settings, including automatic warmth, so that's why your settings do not stick. If you set it back to -2 (which means syncing with Nickle) it should work. Maybe we should change that. This whole KOBO_LIGHT_ON_START thingy is a bit confusing.

@gerhaher
Copy link
Author

gerhaher commented Apr 5, 2018

You are right. Now it sticks.
I've had that setting for a long time for some reason I don't remember now.

Thanks for your time and help!

@poire-z
Copy link
Contributor

poire-z commented Apr 6, 2018

Maybe we should change that. This whole KOBO_LIGHT_ON_START thingy is a bit confusing.

I had some thoughts about that in #3103 - but forgot about them (as all the frontlight bugs had finally been solved, I figured it was best to not touch that anymore)

dengste pushed a commit to dengste/koreader that referenced this issue Apr 6, 2018
'Save settings' was too large a string for larger fonts, so replace
with just 'Save' (issue koreader#3825).
dengste pushed a commit to dengste/koreader that referenced this issue Apr 6, 2018
Reduce text size because for larger fonts this would not fit into
widget's size (issue koreader#3825).
dengste pushed a commit to dengste/koreader that referenced this issue Apr 6, 2018
…3825)

Keep max. warmth for 2h after bedtime, and then start reducing for 2h,
so that 4h after bedtime we have reached zero warmth.
Frenzie pushed a commit that referenced this issue Apr 6, 2018
'Save settings' was too large a string for larger fonts, so replace
with just 'Save' (issue #3825).
Frenzie pushed a commit that referenced this issue Apr 6, 2018
Reduce text size because for larger fonts this would not fit into
widget's size (issue #3825).
Frenzie pushed a commit that referenced this issue Apr 6, 2018
Keep max. warmth for 2h after bedtime, and then start reducing for 2h,
so that 4h after bedtime we have reached zero warmth.
@dengste
Copy link

dengste commented Apr 7, 2018

I've reduced the text in the widget, and max. warmth is now kept for 2h after bedtime. What's left is to make this configurable, but first I want to work on light sensor support.

@Frenzie
Copy link
Member

Frenzie commented Apr 7, 2018

For light sensor, if reasonably possible it would be preferable to generalize the currently Kindle-specific https://github.com/koreader/koreader/blob/7a28c7d7aa5a38e6f3acb5ee9246017c96e8d8ff/plugins/autofrontlight.koplugin/main.lua

@Frenzie
Copy link
Member

Frenzie commented Apr 7, 2018

At a glance the most important part of that is:

local current_level = Device:ambientBrightnessLevel()

Which leads to:

function Kindle:ambientBrightnessLevel()
local haslipc, lipc = pcall(require, "liblipclua")
if not haslipc or lipc == nil then return 0 end
local lipc_handle = lipc.init("com.github.koreader.ambientbrightness")
if not lipc_handle then return 0 end
local value = lipc_handle:get_int_property("com.lab126.powerd", "alsLux")
lipc_handle:close()
if type(value) ~= "number" then return 0 end
if value < 10 then return 0 end
if value < 96 then return 1 end
if value < 192 then return 2 end
if value < 32768 then return 3 end
return 4
end

Doesn't look hard in principle, depending a bit on what the Kobo in question outputs. Which Kobos have light sensors? The One and the H2Ov2?

@dengste
Copy link

dengste commented Apr 7, 2018

It seems the Kindle outputs 16bit unsigned, and the Kobo does as well. There are two issues with the current "ambientBrightnessLevel": The output value in [0 4] is not granular enough. It is OK for deciding whether to turn frontlight on/off (which is what the autofrontlight plugin does), but not for setting the frontlight level depending on the ambient brightness. The second issue is that the Kobo has two sensors: one for visible light (sensitivity peaks around 450nm) and one for infrared (around 850nm). The latter can be used to detect sunlight, as artificial light usually does not emit as much IR as the sun. I think in Nickel, turning frontlight on/off is done solely depending on IR light (the option says "turn off in bright sunlight"), whereas the frontlight level is set depending on visible light (I think simply "the more, the brighter").
So I think of extending the interface to have 'visibleBrightness' and 'IRBrightness', both returning 16bit unsigned. I think it would make sense to have 'powerd' use a 'light_sensor' object for that, so that we can generalize on different sensors, just like we do for the frontlight.
Unfortunately, I don't know which Kobos besides the Aura One have light sensors (and which ones and how to access them).

@Frenzie
Copy link
Member

Frenzie commented Apr 7, 2018

The output value in [0 4] is not granular enough. It is OK for deciding whether to turn frontlight on/off (which is what the autofrontlight plugin does), but not for setting the frontlight level depending on the ambient brightness.

Regardless, that's ground for a modification I'd say, not for something wholly separate. ;-)

The second issue is that the Kobo has two sensors: one for visible light (sensitivity peaks around 450nm) and one for infrared (around 850nm). The latter can be used to detect sunlight, as artificial light usually does not emit as much IR as the sun.

Ah, very interesting. Afaik my phone only has one brightness level sensor, for visible light. Yes, your proposal makes sense.

@poire-z
Copy link
Contributor

poire-z commented Aug 18, 2020

Cross ref #5372

@poire-z
Copy link
Contributor

poire-z commented Jan 21, 2022

Implemented by #8129.

@poire-z poire-z closed this as completed Jan 21, 2022
@poire-z poire-z added this to the 2021.10 milestone Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants