Ver código fonte

LCD: Added Deadzone at 100% Feedrate

This adds a deadzone at 100% Feedrate when changing it at the status
screen/main menu. Prevents from unwanted feedrate-changing when
navigating back to the main menu and makes it easier to return to 100%.
xifle 12 anos atrás
pai
commit
03141a5ef4
1 arquivos alterados com 27 adições e 2 exclusões
  1. 27
    2
      Marlin/ultralcd.cpp

+ 27
- 2
Marlin/ultralcd.cpp Ver arquivo

@@ -77,6 +77,7 @@ static void menu_action_setting_edit_callback_float52(const char* pstr, float* p
77 77
 static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
78 78
 
79 79
 #define ENCODER_STEPS_PER_MENU_ITEM 5
80
+#define ENCODER_FEEDRATE_DEADZONE 10
80 81
 
81 82
 /* Helper macros for menus */
82 83
 #define START_MENU() do { \
@@ -158,10 +159,34 @@ static void lcd_status_screen()
158 159
     if (LCD_CLICKED)
159 160
     {
160 161
         currentMenu = lcd_main_menu;
162
+		encoderPosition = 0;
161 163
         lcd_quick_feedback();
162 164
     }
163
-    feedmultiply += int(encoderPosition);
164
-    encoderPosition = 0;
165
+
166
+	// Dead zone at 100% feedrate
167
+	if (feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100 ||
168
+			feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)
169
+	{
170
+		encoderPosition = 0;
171
+		feedmultiply = 100;
172
+	}
173
+	
174
+	if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
175
+	{
176
+		feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
177
+		encoderPosition = 0;
178
+	}
179
+	else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
180
+	{
181
+		feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
182
+		encoderPosition = 0;	
183
+	}
184
+	else if (feedmultiply != 100)
185
+	{
186
+    	feedmultiply += int(encoderPosition);
187
+		encoderPosition = 0;
188
+    }
189
+
165 190
     if (feedmultiply < 10)
166 191
         feedmultiply = 10;
167 192
     if (feedmultiply > 999)

Carregando…
Cancelar
Salvar