Followup for BTN_ENC_EN
This commit is contained in:
		
							parent
							
								
									6c103b72a2
								
							
						
					
					
						commit
						2a8fdb8ee4
					
				@ -808,6 +808,14 @@ millis_t next_lcd_update_ms;
 | 
				
			|||||||
  millis_t MarlinUI::return_to_status_ms = 0;
 | 
					  millis_t MarlinUI::return_to_status_ms = 0;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					inline bool can_encode() {
 | 
				
			||||||
 | 
					  #if BUTTON_EXISTS(ENC_EN)
 | 
				
			||||||
 | 
					    return !BUTTON_PRESSED(ENC_EN);  // Update position only when ENC_EN is HIGH
 | 
				
			||||||
 | 
					  #else
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MarlinUI::update() {
 | 
					void MarlinUI::update() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static uint16_t max_display_update_time = 0;
 | 
					  static uint16_t max_display_update_time = 0;
 | 
				
			||||||
@ -961,9 +969,7 @@ void MarlinUI::update() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
          #endif // ENCODER_RATE_MULTIPLIER
 | 
					          #endif // ENCODER_RATE_MULTIPLIER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          // Update position only when ENC_EN is HIGH
 | 
					          if (can_encode()) encoderPosition += (encoderDiff * encoderMultiplier) / epps;
 | 
				
			||||||
          if (TERN1(BTN_ENC_EN, !BUTTON_PRESSED(ENC_EN)))
 | 
					 | 
				
			||||||
            encoderPosition += (encoderDiff * encoderMultiplier) / epps;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
          encoderDiff = 0;
 | 
					          encoderDiff = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -1182,8 +1188,7 @@ void MarlinUI::update() {
 | 
				
			|||||||
            if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
 | 
					            if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
 | 
				
			||||||
          #endif
 | 
					          #endif
 | 
				
			||||||
          #if BUTTON_EXISTS(ENC)
 | 
					          #if BUTTON_EXISTS(ENC)
 | 
				
			||||||
            // Update button only when ENC_EN is HIGH
 | 
					            if (can_encode() && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
 | 
				
			||||||
            if (TERN1(BTN_ENC_EN, !BUTTON_PRESSED(ENC_EN)) && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
 | 
					 | 
				
			||||||
          #endif
 | 
					          #endif
 | 
				
			||||||
          #if BUTTON_EXISTS(BACK)
 | 
					          #if BUTTON_EXISTS(BACK)
 | 
				
			||||||
            if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;
 | 
					            if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user