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:
		@@ -241,6 +241,12 @@ def change_led_colour(red_amount,green_amount,blue_amount):
 | 
				
			|||||||
        change_red(red_amount)
 | 
					        change_red(red_amount)
 | 
				
			||||||
        change_blue(blue_amount)
 | 
					        change_blue(blue_amount)
 | 
				
			||||||
        change_green(green_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):
 | 
					def change_led_speed(colour, speed):
 | 
				
			||||||
        # changes the speed of the LED pwm
 | 
					        # 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.
 | 
					        # led blinking effect. can be toggled on or off by setting led_blink to true or false.
 | 
				
			||||||
        # blinks every second-
 | 
					        # blinks every second-
 | 
				
			||||||
 | 
					        if leds_constant_update == True:
 | 
				
			||||||
            if led_blink == True: 
 | 
					            if led_blink == True: 
 | 
				
			||||||
                # this equals to 0 every tick for one second, and 1 every tick for another second
 | 
					                # 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
 | 
					                # 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! 
 | 
					        # instead, just copy the needed values to the 3 brightness variables! 
 | 
				
			||||||
        # the values will be correctly put in once the toggle is back
 | 
					        # the values will be correctly put in once the toggle is back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if leds_constant_update == True:
 | 
				
			||||||
            if leds_off_toggle == False:
 | 
					            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:
 | 
					                    if timer_led_updated == 0:
 | 
				
			||||||
                        timer_led_updated = 1        
 | 
					                        timer_led_updated = 1        
 | 
				
			||||||
                        led_red.ChangeDutyCycle(led_red_brightness)
 | 
					                        led_red.ChangeDutyCycle(led_red_brightness)
 | 
				
			||||||
@@ -316,6 +323,10 @@ def leds_toggle():
 | 
				
			|||||||
            leds_off_toggle = True
 | 
					            leds_off_toggle = True
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            leds_off_toggle = False
 | 
					            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():
 | 
					def toggle_fullscreen():
 | 
				
			||||||
        screen = pygame.display.get_surface()
 | 
					        screen = pygame.display.get_surface()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user