rpi_wordclock
rpi_wordclock copied to clipboard
Startup Brightness and color
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
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.
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
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 :/
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
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:
-
time_default/plugin.py
gets loaded - the variable for the brightness is
brightness_mode_pos
- in line 222
wcd.setBrightness
is called - in
wordclock_tools/wordclock_display
thesetBrightness
method is called, there is this small iterationfor i in range...
and in line 119self.getPixelColor
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?
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:
- Comment out the loop
- Add the old set Brightness call (i have marked the line for you in the screenshot)
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:
- Comment out the loop
- Add the old set Brightness call (i have marked the line for you in the screenshot)
![]()
Thank you! I will try that out in the evening.
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
Should be resolved by now. If not, please reopen.
Best, Bernd