changed led blinking to default off, removed the handler to update the pwm per default, and made a toggle to switch it back on

This commit is contained in:
Patrick Tschuchnig 2019-09-12 08:50:40 +02:00
parent 35416a2c28
commit c0d75a69f8

View File

@ -241,6 +241,12 @@ def change_led_colour(red_amount,green_amount,blue_amount):
change_red(red_amount)
change_blue(blue_amount)
change_green(green_amount)
if leds_constant_update = False:
led_red.ChangeDutyCycle(led_red_brightness)
led_green.ChangeDutyCycle(led_green_brightness)
led_blue.ChangeDutyCycle(led_blue_brightness)
def change_led_speed(colour, speed):
# changes the speed of the LED pwm
@ -263,7 +269,7 @@ def led_handler():
# led blinking effect. can be toggled on or off by setting led_blink to true or false.
# blinks every second-
if leds_constant_update == True:
if led_blink == True:
# this equals to 0 every tick for one second, and 1 every tick for another second
# it requires being handled in a one-shot situation since this is called
@ -294,8 +300,9 @@ def led_handler():
# instead, just copy the needed values to the 3 brightness variables!
# the values will be correctly put in once the toggle is back
if leds_constant_update == True:
if leds_off_toggle == False:
if int((pygame.time.get_ticks()/100))%2 == 0:
if int((pygame.time.get_ticks()/100))%20 == 0:
if timer_led_updated == 0:
timer_led_updated = 1
led_red.ChangeDutyCycle(led_red_brightness)
@ -316,6 +323,10 @@ def leds_toggle():
leds_off_toggle = True
else:
leds_off_toggle = False
led_red.ChangeDutyCycle(led_red_brightness)
led_green.ChangeDutyCycle(led_green_brightness)
led_blue.ChangeDutyCycle(led_blue_brightness)
def toggle_fullscreen():
screen = pygame.display.get_surface()