[Bug] Fix RGB/LED Matrix Suspend code (#14084)
This commit is contained in:
		
							parent
							
								
									da11a49905
								
							
						
					
					
						commit
						92fa07336c
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -459,8 +459,9 @@ void led_matrix_init(void) {
 | 
			
		|||
 | 
			
		||||
void led_matrix_set_suspend_state(bool state) {
 | 
			
		||||
#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
 | 
			
		||||
    if (state && is_keyboard_master()) {
 | 
			
		||||
        led_matrix_set_value_all(0);  // turn off all LEDs when suspending
 | 
			
		||||
    if (state && !suspend_state && is_keyboard_master()) {  // only run if turning off, and only once
 | 
			
		||||
        led_task_effect(0);                                 // turn off all LEDs when suspending
 | 
			
		||||
        led_task_flush(0);                                  // and actually flash led state to LEDs
 | 
			
		||||
    }
 | 
			
		||||
    suspend_state = state;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -501,8 +501,9 @@ void rgb_matrix_init(void) {
 | 
			
		|||
 | 
			
		||||
void rgb_matrix_set_suspend_state(bool state) {
 | 
			
		||||
#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
 | 
			
		||||
    if (state) {
 | 
			
		||||
        rgb_matrix_set_color_all(0, 0, 0);  // turn off all LEDs when suspending
 | 
			
		||||
    if (state && !suspend_state) {  // only run if turning off, and only once
 | 
			
		||||
        rgb_task_render(0);         // turn off all LEDs when suspending
 | 
			
		||||
        rgb_task_flush(0);          // and actually flash led state to LEDs
 | 
			
		||||
    }
 | 
			
		||||
    suspend_state = state;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue