Browse Source

Patch prevEncoderPosition compile issue

Thanks to @jbrazio #3301
Scott Lahteine 9 years ago
parent
commit
641b30217e
1 changed files with 17 additions and 8 deletions
  1. 17
    8
      Marlin/ultralcd.cpp

+ 17
- 8
Marlin/ultralcd.cpp View File

@@ -267,7 +267,7 @@ static void lcd_status_screen();
267 267
   uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
268 268
   millis_t next_button_update_ms;
269 269
   uint8_t lastEncoderBits;
270
-  uint32_t encoderPosition;
270
+  uint32_t encoderPosition, prevEncoderPosition;
271 271
   #if PIN_EXISTS(SD_DETECT)
272 272
     uint8_t lcd_sd_status;
273 273
   #endif
@@ -281,14 +281,12 @@ bool ignore_click = false;
281 281
 bool wait_for_unclick;
282 282
 uint8_t lcdDrawUpdate = 2;                  /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) */
283 283
 
284
-//prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
285
-menuFunc_t prevMenu = NULL;
286
-uint16_t prevEncoderPosition;
287
-//Variables used when editing values.
284
+// Variables used when editing values.
288 285
 const char* editLabel;
289 286
 void* editValue;
290 287
 int32_t minEditValue, maxEditValue;
291
-menuFunc_t callbackFunc;
288
+menuFunc_t prevMenu = NULL;           // return here after editing (also prevEncoderPosition)
289
+menuFunc_t callbackFunc;              // call this after editing
292 290
 
293 291
 // place-holders for Ki and Kd edits
294 292
 float raw_Ki, raw_Kd;
@@ -310,9 +308,20 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
310 308
   }
311 309
 }
312 310
 
313
-inline void lcd_save_previous_menu() { prevMenu = currentMenu; prevEncoderPosition = encoderPosition; }
311
+inline void lcd_save_previous_menu() {
312
+  prevMenu = currentMenu;
313
+  #if ENABLED(ULTIPANEL)
314
+    prevEncoderPosition = encoderPosition;
315
+  #endif
316
+}
314 317
 
315
-static void lcd_goto_previous_menu() { lcd_goto_menu(prevMenu, true, prevEncoderPosition); }
318
+static void lcd_goto_previous_menu() {
319
+  lcd_goto_menu(prevMenu, true
320
+    #if ENABLED(ULTIPANEL)
321
+      , prevEncoderPosition
322
+    #endif
323
+  );
324
+}
316 325
 
317 326
 /**
318 327
  *

Loading…
Cancel
Save