Bladeren bron

Fix doubled lcd_quick_feedback

- MENU_ITEM causes lcd_quick_feedback to be called, so only those calls
to `lcd_goto_menu` outside of the `MENU_ITEM` macro need to set the
`feedback` flag when calling `lcd_goto_menu`.
Scott Lahteine 10 jaren geleden
bovenliggende
commit
388dd0cfa5
1 gewijzigde bestanden met toevoegingen van 40 en 48 verwijderingen
  1. 40
    48
      Marlin/ultralcd.cpp

+ 40
- 48
Marlin/ultralcd.cpp Bestand weergeven

@@ -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
-          }
306
+      if (wait_for_unclick) {
307
+        if (!current_click) {
308
+          ignore_click = wait_for_unclick = false;
313 309
         }
314
-        else if (current_click) {
315
-            lcd_quick_feedback();
316
-            wait_for_unclick = true;
317
-            current_click = false;
310
+        else {
311
+          current_click = false;
318 312
         }
313
+      }
314
+      else if (current_click) {
315
+        lcd_quick_feedback();
316
+        wait_for_unclick = true;
317
+        current_click = false;
318
+      }
319 319
     }
320 320
 
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
321
+    if (current_click) {
322
+      lcd_goto_menu(lcd_main_menu, true);
323
+      lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
324
+        #ifdef LCD_PROGRESS_BAR
325
+          currentMenu == lcd_status_screen
331 326
         #endif
327
+      );
328
+      #ifdef FILAMENT_LCD_DISPLAY
329
+        message_millis = millis();  // get status message to show up for a while
330
+      #endif
332 331
     }
333 332
 
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
-    {
333
+    #ifdef ULTIPANEL_FEEDMULTIPLY
334
+      // Dead zone at 100% feedrate
335
+      if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
336
+              (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)) {
339 337
         encoderPosition = 0;
340 338
         feedmultiply = 100;
341
-    }
342
-
343
-    if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
344
-    {
339
+      }
340
+      if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) {
345 341
         feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
346 342
         encoderPosition = 0;
347
-    }
348
-    else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
349
-    {
343
+      }
344
+      else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) {
350 345
         feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
351 346
         encoderPosition = 0;
352
-    }
353
-    else if (feedmultiply != 100)
354
-    {
347
+      }
348
+      else if (feedmultiply != 100) {
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
 

Laden…
Annuleren
Opslaan