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

This commit is contained in:
-
2013-12-08 21:34:56 +01:00
parent b7eadb9f37
commit e5d3044801
2 changed files with 45 additions and 40 deletions

View File

@ -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<fileCnt;i++)
{
if (_menuItemNr == _lineNr)
@ -982,14 +986,14 @@ void lcd_init()
#ifdef NEWPANEL
pinMode(BTN_EN1,INPUT);
pinMode(BTN_EN2,INPUT);
pinMode(BTN_EN2,INPUT);
pinMode(SDCARDDETECT,INPUT);
WRITE(BTN_EN1,HIGH);
WRITE(BTN_EN2,HIGH);
#if BTN_ENC > 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