Browse Source

Merge pull request #1893 from thinkyhead/cold_extrude

Fix doubled lcd_quick_feedback
Scott Lahteine 9 years ago
parent
commit
b089eb42eb
1 changed files with 46 additions and 54 deletions
  1. 46
    54
      Marlin/ultralcd.cpp

+ 46
- 54
Marlin/ultralcd.cpp View File

@@ -248,10 +248,10 @@ menuFunc_t callbackFunc;
248 248
 // place-holders for Ki and Kd edits
249 249
 float raw_Ki, raw_Kd;
250 250
 
251
-static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
251
+static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint32_t encoder=0) {
252 252
   if (currentMenu != menu) {
253 253
     currentMenu = menu;
254
-    #if defined(NEWPANEL)
254
+    #ifdef NEWPANEL
255 255
       encoderPosition = encoder;
256 256
       if (feedback) lcd_quick_feedback();
257 257
     #endif
@@ -296,77 +296,69 @@ static void lcd_status_screen() {
296 296
     #endif
297 297
   #endif //LCD_PROGRESS_BAR
298 298
 
299
-    lcd_implementation_status_screen();
299
+  lcd_implementation_status_screen();
300 300
 
301
-#ifdef ULTIPANEL
301
+  #ifdef ULTIPANEL
302 302
 
303 303
     bool current_click = LCD_CLICKED;
304 304
 
305 305
     if (ignore_click) {
306
-        if (wait_for_unclick) {
307
-          if (!current_click) {
308
-              ignore_click = wait_for_unclick = false;
309
-          }
310
-          else {
311
-              current_click = false;
312
-          }
313
-        }
314
-        else if (current_click) {
315
-            lcd_quick_feedback();
316
-            wait_for_unclick = true;
317
-            current_click = false;
318
-        }
306
+      if (wait_for_unclick) {
307
+        if (!current_click)
308
+          ignore_click = wait_for_unclick = false;
309
+        else
310
+          current_click = false;
311
+      }
312
+      else if (current_click) {
313
+        lcd_quick_feedback();
314
+        wait_for_unclick = true;
315
+        current_click = false;
316
+      }
319 317
     }
320 318
 
321
-    if (current_click)
322
-    {
323
-        lcd_goto_menu(lcd_main_menu);
324
-        lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
325
-          #ifdef LCD_PROGRESS_BAR
326
-            currentMenu == lcd_status_screen
327
-          #endif
328
-        );
329
-        #ifdef FILAMENT_LCD_DISPLAY
330
-          message_millis = millis();  // get status message to show up for a while
319
+    if (current_click) {
320
+      lcd_goto_menu(lcd_main_menu, true);
321
+      lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
322
+        #ifdef LCD_PROGRESS_BAR
323
+          currentMenu == lcd_status_screen
331 324
         #endif
325
+      );
326
+      #ifdef FILAMENT_LCD_DISPLAY
327
+        message_millis = millis();  // get status message to show up for a while
328
+      #endif
332 329
     }
333 330
 
334
-#ifdef ULTIPANEL_FEEDMULTIPLY
335
-    // Dead zone at 100% feedrate
336
-    if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
337
-            (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100))
338
-    {
331
+    #ifdef ULTIPANEL_FEEDMULTIPLY
332
+      // Dead zone at 100% feedrate
333
+      if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
334
+              (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)) {
339 335
         encoderPosition = 0;
340 336
         feedmultiply = 100;
341
-    }
342
-
343
-    if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
344
-    {
345
-        feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
346
-        encoderPosition = 0;
347
-    }
348
-    else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
349
-    {
350
-        feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
351
-        encoderPosition = 0;
352
-    }
353
-    else if (feedmultiply != 100)
354
-    {
337
+      }
338
+      if (feedmultiply == 100) {
339
+        if (int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) {
340
+          feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
341
+          encoderPosition = 0;
342
+        }
343
+        else if (int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) {
344
+          feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
345
+          encoderPosition = 0;
346
+        }
347
+      }
348
+      else {
355 349
         feedmultiply += int(encoderPosition);
356 350
         encoderPosition = 0;
357
-    }
358
-#endif //ULTIPANEL_FEEDMULTIPLY
351
+      }
352
+    #endif // ULTIPANEL_FEEDMULTIPLY
359 353
 
360
-    if (feedmultiply < 10)
361
-        feedmultiply = 10;
362
-    else if (feedmultiply > 999)
363
-        feedmultiply = 999;
364
-#endif //ULTIPANEL
354
+    feedmultiply = constrain(feedmultiply, 10, 999);
355
+
356
+  #endif //ULTIPANEL
365 357
 }
366 358
 
367 359
 #ifdef ULTIPANEL
368 360
 
369
-static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen, 0, false); }
361
+static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
370 362
 
371 363
 static void lcd_sdcard_pause() { card.pauseSDPrint(); }
372 364
 

Loading…
Cancel
Save