Browse Source

Added posibility to set ENCODER_STEPS_PER_MENU_ITEM in Configuration.h like ENCODER_PULSES_PER_STEP as it depends on it for usability

- 10 years ago
parent
commit
e5d3044801
2 changed files with 45 additions and 40 deletions
  1. 14
    13
      Marlin/Configuration.h
  2. 31
    27
      Marlin/ultralcd.cpp

+ 14
- 13
Marlin/Configuration.h View File

@@ -8,9 +8,9 @@
8 8
 //===========================================================================
9 9
 //============================= DELTA Printer ===============================
10 10
 //===========================================================================
11
-// For a Delta printer rplace the configuration files wilth the files in the 
11
+// For a Delta printer rplace the configuration files wilth the files in the
12 12
 // example_configurations/delta directory.
13
-// 
13
+//
14 14
 
15 15
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
16 16
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
@@ -37,7 +37,7 @@
37 37
 // 12 = Gen7 v1.3
38 38
 // 13 = Gen7 v1.4
39 39
 // 2  = Cheaptronic v1.0
40
-// 20 = Sethi 3D_1 
40
+// 20 = Sethi 3D_1
41 41
 // 3  = MEGA/RAMPS up to 1.2 = 3
42 42
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
43 43
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
@@ -336,9 +336,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
336 336
 
337 337
   #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
338 338
                                         // Be sure you have this distance over your Z_MAX_POS in case
339
-    
339
+
340 340
   #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
341
-  
341
+
342 342
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
343 343
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
344 344
 
@@ -347,26 +347,26 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
347 347
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
348 348
   // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
349 349
 
350
-//  #define PROBE_SERVO_DEACTIVATION_DELAY 300  
350
+//  #define PROBE_SERVO_DEACTIVATION_DELAY 300
351 351
 
352 352
 
353
-//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing, 
353
+//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing,
354 354
 //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
355 355
 
356
-  #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area. 
356
+  #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area.
357 357
                           // When defined, it will:
358 358
                           // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
359 359
                           // - If stepper drivers timeout, it will need X and Y homing again before Z homing
360 360
                           // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
361 361
                           // - Block Z homing only when the probe is outside bed area.
362
-  
362
+
363 363
   #ifdef Z_SAFE_HOMING
364
-    
364
+
365 365
     #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
366 366
     #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
367
-    
367
+
368 368
   #endif
369
-  
369
+
370 370
 #endif
371 371
 
372 372
 
@@ -435,6 +435,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
435 435
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
436 436
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
437 437
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
438
+//#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
438 439
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
439 440
 //#define ULTIPANEL  //the ultipanel as on thingiverse
440 441
 
@@ -541,7 +542,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
541 542
 // Shift register panels
542 543
 // ---------------------
543 544
 // 2 wire Non-latching LCD SR from:
544
-// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
545
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
545 546
 //#define SR_LCD
546 547
 #ifdef SR_LCD
547 548
    #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister

+ 31
- 27
Marlin/ultralcd.cpp View File

@@ -90,12 +90,16 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
90 90
 #define ENCODER_FEEDRATE_DEADZONE 10
91 91
 
92 92
 #if !defined(LCD_I2C_VIKI)
93
-  #define ENCODER_STEPS_PER_MENU_ITEM 5
93
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
94
+    #define ENCODER_STEPS_PER_MENU_ITEM 5
95
+  #endif
94 96
   #ifndef ENCODER_PULSES_PER_STEP
95 97
     #define ENCODER_PULSES_PER_STEP 1
96 98
   #endif
97 99
 #else
98
-  #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
100
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
101
+    #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
102
+  #endif
99 103
   #ifndef ENCODER_PULSES_PER_STEP
100 104
     #define ENCODER_PULSES_PER_STEP 1
101 105
   #endif
@@ -207,7 +211,7 @@ static void lcd_status_screen()
207 211
     else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
208 212
     {
209 213
         feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
210
-        encoderPosition = 0;	
214
+        encoderPosition = 0;
211 215
     }
212 216
     else if (feedmultiply != 100)
213 217
     {
@@ -407,7 +411,7 @@ static void lcd_tune_menu()
407 411
 #endif
408 412
     MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
409 413
     MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
410
-    
414
+
411 415
 #ifdef BABYSTEPPING
412 416
     #ifdef BABYSTEP_XY
413 417
       MENU_ITEM(submenu, "Babystep X", lcd_babystep_x);
@@ -719,7 +723,7 @@ static void lcd_control_motion_menu()
719 723
     MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999);
720 724
     MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
721 725
     MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
722
-    MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);    
726
+    MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);
723 727
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
724 728
     MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit);
725 729
 #endif
@@ -781,7 +785,7 @@ static void lcd_sd_updir()
781 785
 
782 786
 void lcd_sdcard_menu()
783 787
 {
784
-    if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) 
788
+    if (lcdDrawUpdate == 0 && LCD_CLICKED == 0)
785 789
         return;	// nothing to do (so don't thrash the SD card)
786 790
     uint16_t fileCnt = card.getnrfilenames();
787 791
     START_MENU();
@@ -795,7 +799,7 @@ void lcd_sdcard_menu()
795 799
     }else{
796 800
         MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
797 801
     }
798
-    
802
+
799 803
     for(uint16_t i=0;i<fileCnt;i++)
800 804
     {
801 805
         if (_menuItemNr == _lineNr)
@@ -982,14 +986,14 @@ void lcd_init()
982 986
 
983 987
 #ifdef NEWPANEL
984 988
     pinMode(BTN_EN1,INPUT);
985
-    pinMode(BTN_EN2,INPUT); 
989
+    pinMode(BTN_EN2,INPUT);
986 990
     pinMode(SDCARDDETECT,INPUT);
987 991
     WRITE(BTN_EN1,HIGH);
988 992
     WRITE(BTN_EN2,HIGH);
989 993
   #if BTN_ENC > 0
990
-    pinMode(BTN_ENC,INPUT); 
994
+    pinMode(BTN_ENC,INPUT);
991 995
     WRITE(BTN_ENC,HIGH);
992
-  #endif    
996
+  #endif
993 997
   #ifdef REPRAPWORLD_KEYPAD
994 998
     pinMode(SHIFT_CLK,OUTPUT);
995 999
     pinMode(SHIFT_LD,OUTPUT);
@@ -1007,9 +1011,9 @@ void lcd_init()
1007 1011
      pinMode(SHIFT_EN,OUTPUT);
1008 1012
      pinMode(SHIFT_OUT,INPUT);
1009 1013
      WRITE(SHIFT_OUT,HIGH);
1010
-     WRITE(SHIFT_LD,HIGH); 
1014
+     WRITE(SHIFT_LD,HIGH);
1011 1015
      WRITE(SHIFT_EN,LOW);
1012
-   #endif // SR_LCD_2W_NL    
1016
+   #endif // SR_LCD_2W_NL
1013 1017
 #endif//!NEWPANEL
1014 1018
 
1015 1019
 #if (SDCARDDETECT > 0)
@@ -1020,28 +1024,28 @@ void lcd_init()
1020 1024
     slow_buttons = 0;
1021 1025
     #endif
1022 1026
     lcd_buttons_update();
1023
-#ifdef ULTIPANEL    
1027
+#ifdef ULTIPANEL
1024 1028
     encoderDiff = 0;
1025
-#endif    
1029
+#endif
1026 1030
 }
1027 1031
 
1028 1032
 void lcd_update()
1029 1033
 {
1030 1034
     static unsigned long timeoutToStatus = 0;
1031
-    
1035
+
1032 1036
     #ifdef LCD_HAS_SLOW_BUTTONS
1033 1037
     slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
1034 1038
     #endif
1035
-    
1039
+
1036 1040
     lcd_buttons_update();
1037
-    
1041
+
1038 1042
     #if (SDCARDDETECT > 0)
1039 1043
     if((IS_SD_INSERTED != lcd_oldcardstatus))
1040 1044
     {
1041 1045
         lcdDrawUpdate = 2;
1042 1046
         lcd_oldcardstatus = IS_SD_INSERTED;
1043 1047
         lcd_implementation_init(); // to maybe revive the lcd if static electricty killed it.
1044
-        
1048
+
1045 1049
         if(lcd_oldcardstatus)
1046 1050
         {
1047 1051
             card.initsd();
@@ -1054,7 +1058,7 @@ void lcd_update()
1054 1058
         }
1055 1059
     }
1056 1060
     #endif//CARDINSERTED
1057
-    
1061
+
1058 1062
     if (lcd_next_update_millis < millis())
1059 1063
     {
1060 1064
 #ifdef ULTIPANEL
@@ -1095,7 +1099,7 @@ void lcd_update()
1095 1099
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
1096 1100
         blink++;     // Variable for fan animation and alive dot
1097 1101
         u8g.firstPage();
1098
-        do 
1102
+        do
1099 1103
         {
1100 1104
             u8g.setFont(u8g_font_6x10_marlin);
1101 1105
             u8g.setPrintPos(125,0);
@@ -1105,7 +1109,7 @@ void lcd_update()
1105 1109
             (*currentMenu)();
1106 1110
             if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
1107 1111
         } while( u8g.nextPage() );
1108
-#else        
1112
+#else
1109 1113
         (*currentMenu)();
1110 1114
 #endif
1111 1115
 
@@ -1159,7 +1163,7 @@ void lcd_reset_alert_level()
1159 1163
 void lcd_setcontrast(uint8_t value)
1160 1164
 {
1161 1165
     lcd_contrast = value & 63;
1162
-    u8g.setContrast(lcd_contrast);	
1166
+    u8g.setContrast(lcd_contrast);
1163 1167
 }
1164 1168
 #endif
1165 1169
 
@@ -1199,7 +1203,7 @@ void lcd_buttons_update()
1199 1203
     WRITE(SHIFT_LD,HIGH);
1200 1204
     unsigned char tmp_buttons=0;
1201 1205
     for(int8_t i=0;i<8;i++)
1202
-    { 
1206
+    {
1203 1207
         newbutton = newbutton>>1;
1204 1208
         if(READ(SHIFT_OUT))
1205 1209
             newbutton|=(1<<7);
@@ -1249,14 +1253,14 @@ void lcd_buttons_update()
1249 1253
 }
1250 1254
 
1251 1255
 void lcd_buzz(long duration, uint16_t freq)
1252
-{ 
1256
+{
1253 1257
 #ifdef LCD_USE_I2C_BUZZER
1254 1258
   lcd.buzz(duration,freq);
1255
-#endif   
1259
+#endif
1256 1260
 }
1257 1261
 
1258
-bool lcd_clicked() 
1259
-{ 
1262
+bool lcd_clicked()
1263
+{
1260 1264
   return LCD_CLICKED;
1261 1265
 }
1262 1266
 #endif//ULTIPANEL

Loading…
Cancel
Save