Commit d8fb5208 authored by MagoKimbra's avatar MagoKimbra

Update G28

parent 5d18bac2
...@@ -94,6 +94,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -94,6 +94,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
//If you have enabled the Auto Bed 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
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL) //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable //#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
...@@ -154,21 +162,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -154,21 +162,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define PROBE_SERVO_DEACTIVATION_DELAY 300 #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Auto Bed 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.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers time out, 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
#ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range #ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range
#if X_PROBE_OFFSET_FROM_EXTRUDER < 0 #if X_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION)) #if (-(X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
......
...@@ -94,6 +94,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -94,6 +94,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
//If you have enabled the Auto Bed 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
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL) //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable //#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
...@@ -154,16 +162,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo ...@@ -154,16 +162,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
#define PROBE_SERVO_DEACTIVATION_DELAY 300 #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Auto Bed 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.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers time out, 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 #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_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) #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
......
...@@ -118,6 +118,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo ...@@ -118,6 +118,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min #define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
//If you have enabled the Auto Bed 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
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28) or homing Z
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28) or homing Z
#endif
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL) //#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (ABL)
//#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable //#define Z_PROBE_REPEATABILITY_TEST // Delete the comment to enable
...@@ -178,21 +186,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo ...@@ -178,21 +186,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define PROBE_SERVO_DEACTIVATION_DELAY 300 #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Auto Bed 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.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers time out, 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
#ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range #ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range
#if X_PROBE_OFFSET_FROM_EXTRUDER < 0 #if X_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION)) #if (-(X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
......
...@@ -290,6 +290,11 @@ ...@@ -290,6 +290,11 @@
//=============================Additional Features=========================== //=============================Additional Features===========================
//=========================================================================== //===========================================================================
#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
//#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ //#define CHDK 4 //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
......
...@@ -2167,14 +2167,12 @@ inline void gcode_G28() { ...@@ -2167,14 +2167,12 @@ inline void gcode_G28() {
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) HOMEAXIS(Y); if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) HOMEAXIS(Y);
if(code_seen(axis_codes[X_AXIS])) { if(code_seen(axis_codes[X_AXIS]) && code_value_long() != 0) {
if(code_value_long() != 0) { #ifdef SCARA
#ifdef SCARA current_position[X_AXIS]=code_value();
current_position[X_AXIS]=code_value(); #else
#else current_position[X_AXIS]=code_value()+add_homing[X_AXIS];
current_position[X_AXIS]=code_value()+add_homing[X_AXIS]; #endif
#endif
}
} }
if (code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) { if (code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) {
...@@ -2262,7 +2260,7 @@ inline void gcode_G28() { ...@@ -2262,7 +2260,7 @@ inline void gcode_G28() {
#endif #endif
HOMEAXIS(Z); HOMEAXIS(Z);
} }
#else // Z Safe mode activated. #elif defined(Z_SAFE_HOMING) && defined(ENABLE_AUTO_BED_LEVELING)// Z Safe mode activated.
if (home_all_axis) { if (home_all_axis) {
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER);
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
...@@ -2271,7 +2269,7 @@ inline void gcode_G28() { ...@@ -2271,7 +2269,7 @@ inline void gcode_G28() {
current_position[Z_AXIS] = 0; current_position[Z_AXIS] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder, active_driver);
st_synchronize(); st_synchronize();
current_position[X_AXIS] = destination[X_AXIS]; current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS]; current_position[Y_AXIS] = destination[Y_AXIS];
...@@ -2304,6 +2302,20 @@ inline void gcode_G28() { ...@@ -2304,6 +2302,20 @@ inline void gcode_G28() {
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN); SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
} }
} }
#elif defined(Z_SAFE_HOMING)
if(home_all_axis || (code_seen(axis_codes[Z_AXIS]))) {
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT);
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT);
feedrate = XY_TRAVEL_SPEED / 60;
destination[Z_AXIS] = current_position[Z_AXIS] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder, active_driver);
st_synchronize();
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
HOMEAXIS(Z);
}
#endif //Z_SAFE_HOMING #endif //Z_SAFE_HOMING
#endif //Z_HOME_DIR < 0 #endif //Z_HOME_DIR < 0
......
...@@ -509,7 +509,7 @@ int getHeaterPower(int heater) { ...@@ -509,7 +509,7 @@ int getHeaterPower(int heater) {
#if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1 #if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1
if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN if (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
&& EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
setExtruderAutoFanState(EXTRUDER_3_AUTO_FAN_PIN, (fanState & 8) != 0); setExtruderAutoFanState(EXTRUDER_3_AUTO_FAN_PIN, (fanState & 8) != 0);
#endif #endif
#endif // !SINLGENOZZE #endif // !SINLGENOZZE
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */ int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
bool encoderRateMultiplierEnabled;
int32_t lastEncoderMovementMillis;
/* Configuration settings */ /* Configuration settings */
int plaPreheatHotendTemp; int plaPreheatHotendTemp;
int plaPreheatHPBTemp; int plaPreheatHPBTemp;
...@@ -127,6 +130,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l ...@@ -127,6 +130,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
/* Helper macros for menus */ /* Helper macros for menus */
#define START_MENU() do { \ #define START_MENU() do { \
encoderRateMultiplierEnabled = false; \
if (encoderPosition > 0x8000) encoderPosition = 0; \ if (encoderPosition > 0x8000) encoderPosition = 0; \
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\ if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
...@@ -151,9 +155,39 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l ...@@ -151,9 +155,39 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
}\ }\
_menuItemNr++;\ _menuItemNr++;\
} while(0) } while(0)
#ifdef ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
if (_menuItemNr == _lineNr) { \
if (lcdDrawUpdate) { \
const char* _label_pstr = PSTR(label); \
if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \
} \
else { \
lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
} \
} \
if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
lcd_quick_feedback(); \
encoderRateMultiplierEnabled = true; \
lastEncoderMovementMillis = 0; \
menu_action_ ## type ( args ); \
return; \
} \
} \
_menuItemNr++; \
} while(0)
#endif
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#ifdef ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#else
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#endif
#define END_MENU() \ #define END_MENU() \
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \ if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
...@@ -212,6 +246,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool ...@@ -212,6 +246,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */ /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
static void lcd_status_screen() static void lcd_status_screen()
{ {
encoderRateMultiplierEnabled = false;
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD) #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
uint16_t mil = millis(); uint16_t mil = millis();
#ifndef PROGRESS_BAR_MSG_ONCE #ifndef PROGRESS_BAR_MSG_ONCE
...@@ -1512,8 +1547,47 @@ void lcd_update() ...@@ -1512,8 +1547,47 @@ void lcd_update()
#endif #endif
if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP) if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP)
{ {
int32_t encoderMultiplier = 1;
#ifdef ENCODER_RATE_MULTIPLIER
if (encoderRateMultiplierEnabled)
{
int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
if (lastEncoderMovementMillis != 0)
{
// Note that the rate is always calculated between to passes through the
// loop and that the abs of the encoderDiff value is tracked.
float encoderStepRate =
(float)(encoderMovementSteps) / ((float)(millis() - lastEncoderMovementMillis)) * 1000.0;
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC)
{
encoderMultiplier = 100;
}
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC)
{
encoderMultiplier = 10;
}
#ifdef ENCODER_RATE_MULTIPLIER_DEBUG
SERIAL_ECHO_START;
SERIAL_ECHO("Enc Step Rate: ");
SERIAL_ECHO(encoderStepRate);
SERIAL_ECHO(" Multiplier: ");
SERIAL_ECHO(encoderMultiplier);
SERIAL_ECHO(" ENCODER_10X_STEPS_PER_SEC: ");
SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC);
SERIAL_ECHO(" ENCODER_100X_STEPS_PER_SEC: ");
SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC);
#endif
}
lastEncoderMovementMillis = millis();
}
#endif
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP; encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
encoderDiff = 0; encoderDiff = 0;
timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment