bk1285 / rpi_wordclock

Software to create a Raspberry Pi based wordclock
GNU General Public License v3.0
214 stars 107 forks source link

Startup Brightness and color #155

Closed Azrael0815 closed 2 years ago

Azrael0815 commented 4 years ago

First of all I would like to say thank you for the great job.. i created your wordclock and it looks awesome !

Nevertheless I have a (probably stupid) question. How do I change the startup brightness and color ? The "brightness" in the cfg file does not seem to affect the brightness at all Thanks for your time andf great work

TobyLongley commented 4 years ago

Hello. I have the same problem. I finished my wordclock this weekend and tried to adjust the brightness as well in the wordclock_config.cfg, time_default/plugin.py and wordclock_display.py but nothing had any influence.

Even with the webapp I cannot set a brightness as it throws an error. Only way to adjust the brightness is via the color.

Any hints where to start?

Thank you in advance.

Azrael0815 commented 4 years ago

I managed this by adding a brightness sensor like Phenze did. Works really good. Still I am only able to change the startup color by changing the code in the Py file

TobyLongley commented 4 years ago

I managed this by adding a brightness sensor like Phenze did. Works really good. Still I am only able to change the startup color by changing the code in the Py file

noobquestion: where do I find his code? I'm pretty new to all this git stuff :/

spintike commented 4 years ago

Hi @TobyLongley.

You have to add the following line in your wordclock_config.cfg file:

https://github.com/phenze/rpi_wordclock/blob/d52ce76d5633a182cf8192a1f75848dbee45aff2/wordclock_config/wordclock_config_old.cfg#L33

Then the wordclock script execution should show something like the following on your session when the rest of the requirements are met:

Using brigtness sensor : True Importing sensor Library

TobyLongley commented 4 years ago

Hello guys,

sorry for the late reply I had no time to look through the code...

Thank you really much for the help but it still didn't work :/ I'm using another brightnesssensor therefore phenzes code doesn't work for me. I do manage to get a sensible value from my sensor but I am still struggling to get it into the wordclock code -.-

And as I'm a python newb maybe someone can explain to me how this should normally work. What i think:

but there is no method called getPixelColor defined at all? how is that supposed to work?

I thought that this might be a bug so I added

    def getPixelColor(self, pixel):
        return self.strip.getPixelColor(pixel)

Now it kind of works but instead of changing the brightness of the LEDs, the wordclock changes the color of the LEDs (like from whitewarm to blue, to another blue etc...

The second thing i struggle to understand is the formula in the Iteration:

color = (color/brightness_before)^(1/2.2) * brightness

I get "TypeError: unsupported operand type(s) for ^: 'int' and 'float'"

is '^' supposed to be '**'? or do I have to cast a variable?

phenze commented 4 years ago

Just switch to my master. I have fixed that. That is a Bug on the current Master of Bernd.

When you want to fix that on your own do the following:

  1. Comment out the loop
  2. Add the old set Brightness call (i have marked the line for you in the screenshot) Bildschirmfoto 2020-04-14 um 07 28 37
TobyLongley commented 4 years ago

Just switch to my master. I have fixed that. That is a Bug on the current Master of Bernd.

When you want to fix that on your own do the following:

  1. Comment out the loop
  2. Add the old set Brightness call (i have marked the line for you in the screenshot) Bildschirmfoto 2020-04-14 um 07 28 37

Thank you! I will try that out in the evening.

bk1285 commented 4 years ago

I'll take a look at this and provide a fix on latest develop. On develop, I'm currently refactoring the wordclock's code quite a bit, including the brighness handling.

Cheers, Bernd

bk1285 commented 2 years ago

Should be resolved by now. If not, please reopen.

Best, Bernd