Merge pull request #486 from xifle/Marlin_v1

LCD: Added Deadzone at 100% Feedrate
This commit is contained in:
ErikZalm 2013-05-20 08:09:51 -07:00
commit 273502a172

View file

@ -76,12 +76,15 @@ static void menu_action_setting_edit_callback_float51(const char* pstr, float* p
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
#define ENCODER_FEEDRATE_DEADZONE 10
#if !defined(LCD_I2C_VIKI) #if !defined(LCD_I2C_VIKI)
#define ENCODER_STEPS_PER_MENU_ITEM 5 #define ENCODER_STEPS_PER_MENU_ITEM 5
#else #else
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
#endif #endif
/* Helper macros for menus */ /* Helper macros for menus */
#define START_MENU() do { \ #define START_MENU() do { \
if (encoderPosition > 0x8000) encoderPosition = 0; \ if (encoderPosition > 0x8000) encoderPosition = 0; \
@ -165,10 +168,34 @@ static void lcd_status_screen()
if (LCD_CLICKED) if (LCD_CLICKED)
{ {
currentMenu = lcd_main_menu; currentMenu = lcd_main_menu;
encoderPosition = 0;
lcd_quick_feedback(); lcd_quick_feedback();
} }
feedmultiply += int(encoderPosition);
encoderPosition = 0; // Dead zone at 100% feedrate
if (feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100 ||
feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)
{
encoderPosition = 0;
feedmultiply = 100;
}
if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
{
feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
encoderPosition = 0;
}
else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
{
feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
encoderPosition = 0;
}
else if (feedmultiply != 100)
{
feedmultiply += int(encoderPosition);
encoderPosition = 0;
}
if (feedmultiply < 10) if (feedmultiply < 10)
feedmultiply = 10; feedmultiply = 10;
if (feedmultiply > 999) if (feedmultiply > 999)