From e5d3044801a5c248386380fca188f56ebbea45c5 Mon Sep 17 00:00:00 2001 From: - <-> Date: Sun, 8 Dec 2013 21:34:56 +0100 Subject: [PATCH] Added posibility to set ENCODER_STEPS_PER_MENU_ITEM in Configuration.h like ENCODER_PULSES_PER_STEP as it depends on it for usability --- Marlin/Configuration.h | 27 ++++++++++---------- Marlin/ultralcd.cpp | 58 ++++++++++++++++++++++-------------------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d5b7621a1..b4acbac94 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -8,9 +8,9 @@ //=========================================================================== //============================= DELTA Printer =============================== //=========================================================================== -// For a Delta printer rplace the configuration files wilth the files in the +// For a Delta printer rplace the configuration files wilth the files in the // example_configurations/delta directory. -// +// // User-specified version info of this build to display in [Pronterface, etc] terminal window during // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this @@ -37,7 +37,7 @@ // 12 = Gen7 v1.3 // 13 = Gen7 v1.4 // 2 = Cheaptronic v1.0 -// 20 = Sethi 3D_1 +// 20 = Sethi 3D_1 // 3 = MEGA/RAMPS up to 1.2 = 3 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed) // 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 #define Z_RAISE_BEFORE_HOMING 4 // (in mm) Raise Z before homing (G28) for Probe Clearance. // Be sure you have this distance over your Z_MAX_POS in case - + #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min - + #define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points @@ -347,26 +347,26 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //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. // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile. -// #define PROBE_SERVO_DEACTIVATION_DELAY 300 +// #define PROBE_SERVO_DEACTIVATION_DELAY 300 -//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing, +//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing, //it is highly recommended you let this Z_SAFE_HOMING enabled!!! - #define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area. + #define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area. // When defined, it will: // - Allow Z homing only after X and Y homing AND stepper drivers still enabled // - If stepper drivers timeout, it will need X and Y homing again before Z homing // - Position the probe in a defined XY point before Z Homing when homing all axis (G28) // - Block Z homing only when the probe is outside bed area. - + #ifdef Z_SAFE_HOMING - + #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) - + #endif - + #endif @@ -435,6 +435,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define SDSUPPORT // Enable SD Card Support in Hardware Console //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error) //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder +//#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store. //#define ULTIPANEL //the ultipanel as on thingiverse @@ -541,7 +542,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Shift register panels // --------------------- // 2 wire Non-latching LCD SR from: -// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection //#define SR_LCD #ifdef SR_LCD #define SR_LCD_2W_NL // Non latching 2 wire shiftregister diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 163c881e1..fe8cab086 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -90,12 +90,16 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l #define ENCODER_FEEDRATE_DEADZONE 10 #if !defined(LCD_I2C_VIKI) - #define ENCODER_STEPS_PER_MENU_ITEM 5 + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 5 + #endif #ifndef ENCODER_PULSES_PER_STEP #define ENCODER_PULSES_PER_STEP 1 #endif #else - #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation + #endif #ifndef ENCODER_PULSES_PER_STEP #define ENCODER_PULSES_PER_STEP 1 #endif @@ -207,7 +211,7 @@ static void lcd_status_screen() else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) { feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE; - encoderPosition = 0; + encoderPosition = 0; } else if (feedmultiply != 100) { @@ -407,7 +411,7 @@ static void lcd_tune_menu() #endif MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999); - + #ifdef BABYSTEPPING #ifdef BABYSTEP_XY MENU_ITEM(submenu, "Babystep X", lcd_babystep_x); @@ -719,7 +723,7 @@ static void lcd_control_motion_menu() MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999); MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999); MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999); - MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999); + MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999); #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit); #endif @@ -781,7 +785,7 @@ static void lcd_sd_updir() void lcd_sdcard_menu() { - if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) + if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return; // nothing to do (so don't thrash the SD card) uint16_t fileCnt = card.getnrfilenames(); START_MENU(); @@ -795,7 +799,7 @@ void lcd_sdcard_menu() }else{ MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); } - + for(uint16_t i=0;i 0 - pinMode(BTN_ENC,INPUT); + pinMode(BTN_ENC,INPUT); WRITE(BTN_ENC,HIGH); - #endif + #endif #ifdef REPRAPWORLD_KEYPAD pinMode(SHIFT_CLK,OUTPUT); pinMode(SHIFT_LD,OUTPUT); @@ -1007,9 +1011,9 @@ void lcd_init() pinMode(SHIFT_EN,OUTPUT); pinMode(SHIFT_OUT,INPUT); WRITE(SHIFT_OUT,HIGH); - WRITE(SHIFT_LD,HIGH); + WRITE(SHIFT_LD,HIGH); WRITE(SHIFT_EN,LOW); - #endif // SR_LCD_2W_NL + #endif // SR_LCD_2W_NL #endif//!NEWPANEL #if (SDCARDDETECT > 0) @@ -1020,28 +1024,28 @@ void lcd_init() slow_buttons = 0; #endif lcd_buttons_update(); -#ifdef ULTIPANEL +#ifdef ULTIPANEL encoderDiff = 0; -#endif +#endif } void lcd_update() { static unsigned long timeoutToStatus = 0; - + #ifdef LCD_HAS_SLOW_BUTTONS slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context #endif - + lcd_buttons_update(); - + #if (SDCARDDETECT > 0) if((IS_SD_INSERTED != lcd_oldcardstatus)) { lcdDrawUpdate = 2; lcd_oldcardstatus = IS_SD_INSERTED; lcd_implementation_init(); // to maybe revive the lcd if static electricty killed it. - + if(lcd_oldcardstatus) { card.initsd(); @@ -1054,7 +1058,7 @@ void lcd_update() } } #endif//CARDINSERTED - + if (lcd_next_update_millis < millis()) { #ifdef ULTIPANEL @@ -1095,7 +1099,7 @@ void lcd_update() #ifdef DOGLCD // Changes due to different driver architecture of the DOGM display blink++; // Variable for fan animation and alive dot u8g.firstPage(); - do + do { u8g.setFont(u8g_font_6x10_marlin); u8g.setPrintPos(125,0); @@ -1105,7 +1109,7 @@ void lcd_update() (*currentMenu)(); if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next() } while( u8g.nextPage() ); -#else +#else (*currentMenu)(); #endif @@ -1159,7 +1163,7 @@ void lcd_reset_alert_level() void lcd_setcontrast(uint8_t value) { lcd_contrast = value & 63; - u8g.setContrast(lcd_contrast); + u8g.setContrast(lcd_contrast); } #endif @@ -1199,7 +1203,7 @@ void lcd_buttons_update() WRITE(SHIFT_LD,HIGH); unsigned char tmp_buttons=0; for(int8_t i=0;i<8;i++) - { + { newbutton = newbutton>>1; if(READ(SHIFT_OUT)) newbutton|=(1<<7); @@ -1249,14 +1253,14 @@ void lcd_buttons_update() } void lcd_buzz(long duration, uint16_t freq) -{ +{ #ifdef LCD_USE_I2C_BUZZER lcd.buzz(duration,freq); -#endif +#endif } -bool lcd_clicked() -{ +bool lcd_clicked() +{ return LCD_CLICKED; } #endif//ULTIPANEL