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

FR: PocketBook frontlight warmth #3856

Open
Frenzie opened this Issue Apr 10, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@Frenzie
Member

Frenzie commented Apr 10, 2018

  • KOReader version: 305e75c
  • Device: PocketBook, not sure which ones

Issue

From the forum.

The presumably simple part, add a little interface to the backend mirroring these lines:

function PocketBookPowerD:frontlightIntensityHW()
if not self.device.hasFrontlight() then return 0 end
return inkview.GetFrontlightState()
end
function PocketBookPowerD:setIntensityHW(intensity)
if intensity == 0 then
inkview.SetFrontlightState(-1)
else
inkview.SetFrontlightState(intensity)
end
end

All we should need there is inkview.GetFrontlightColor() and inkview.SetFrontlightColor(intensity) plus a little check to see if they exist at all. Could it be as simple as hasFrontLight = (inkview.GetFrontlightColor and inkview.SetFrontlightColor) and yes or no?

The hard(er) part, adapt the settings widget. Judging by this commit it looks like it goes from 0 to 100 but perhaps that's just an assumption.

More info here.

Pinging @dengste regarding what issues there might be with the frontlight widget as it exists right now and @mk-f as our resident PocketBook expert.

@dengste

This comment has been minimized.

dengste commented Apr 10, 2018

Frontlightwidget should work if powerd has 'setWarmth' and uses a warmth value in [0 100]. The 'automatic warmth' feature has a bit more things needed in 'powerd', but I think it should be possible to move most of that stuff into BasePowerD.

@dengste

This comment has been minimized.

dengste commented Apr 10, 2018

and uses a warmth value in [0 100]

Not quite correct: it currently needs to have the same limits as the brightness value, meaning [fl_min fl_max].

@Frenzie

This comment has been minimized.

Member

Frenzie commented Apr 10, 2018

@dengste
Looking at this (remove isKobo):

self.natural_light = Device:isKobo() and Device:hasNaturalLight()

I'm guessing the configure_button would need to be hidden behind an isKobo()? (Also, double space there, grmbl. :-P)

if self.natural_light then
-- If the device supports natural light, add the widgets for 'warmth'
-- and a 'Configure' button
self:addWarmthWidgets(num_warmth, step, vertical_group)
self.configure_button = Button:new{
text = _("Configure"),
margin = Size.margin.small,
radius = 0,
width = self.screen_width * 0.20,
enabled = not self.nl_configure_open,
show_parent = self,
callback = function()
UIManager:show(NaturalLight:new{fl_widget = self})
end,
}
table.insert(vertical_group, self.configure_button)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment