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
 //===========================================================================
8
 //===========================================================================
9
 //============================= DELTA Printer ===============================
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
 // example_configurations/delta directory.
12
 // example_configurations/delta directory.
13
-// 
13
+//
14
 
14
 
15
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
15
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
16
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
16
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
37
 // 12 = Gen7 v1.3
37
 // 12 = Gen7 v1.3
38
 // 13 = Gen7 v1.4
38
 // 13 = Gen7 v1.4
39
 // 2  = Cheaptronic v1.0
39
 // 2  = Cheaptronic v1.0
40
-// 20 = Sethi 3D_1 
40
+// 20 = Sethi 3D_1
41
 // 3  = MEGA/RAMPS up to 1.2 = 3
41
 // 3  = MEGA/RAMPS up to 1.2 = 3
42
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
42
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
43
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
43
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
336
 
336
 
337
   #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
337
   #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
338
                                         // Be sure you have this distance over your Z_MAX_POS in case
338
                                         // Be sure you have this distance over your Z_MAX_POS in case
339
-    
339
+
340
   #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
340
   #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
341
-  
341
+
342
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
342
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
343
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
343
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
344
 
344
 
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.
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
   // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
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
 //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
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
                           // When defined, it will:
357
                           // When defined, it will:
358
                           // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
358
                           // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
359
                           // - If stepper drivers timeout, it will need X and Y homing again before Z homing
359
                           // - If stepper drivers timeout, it will need X and Y homing again before Z homing
360
                           // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
360
                           // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
361
                           // - Block Z homing only when the probe is outside bed area.
361
                           // - Block Z homing only when the probe is outside bed area.
362
-  
362
+
363
   #ifdef Z_SAFE_HOMING
363
   #ifdef Z_SAFE_HOMING
364
-    
364
+
365
     #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
365
     #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
366
     #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
366
     #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
367
-    
367
+
368
   #endif
368
   #endif
369
-  
369
+
370
 #endif
370
 #endif
371
 
371
 
372
 
372
 
435
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
435
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
436
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
436
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
437
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
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
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
439
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
439
 //#define ULTIPANEL  //the ultipanel as on thingiverse
440
 //#define ULTIPANEL  //the ultipanel as on thingiverse
440
 
441
 
541
 // Shift register panels
542
 // Shift register panels
542
 // ---------------------
543
 // ---------------------
543
 // 2 wire Non-latching LCD SR from:
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
 //#define SR_LCD
546
 //#define SR_LCD
546
 #ifdef SR_LCD
547
 #ifdef SR_LCD
547
    #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
548
    #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister

+ 31
- 27
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save