Commit d738810c authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge branch 'dev'

parents 4d02e2df 1c1be28c
Pipeline #117 skipped
...@@ -1151,13 +1151,13 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR); ...@@ -1151,13 +1151,13 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR; return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
} }
static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1 static float inactive_hotend_x_pos = X2_MAX_POS; // used in mode 0 & 1
static bool active_extruder_parked = false; // used in mode 1 & 2 static bool active_hotend_parked = false; // used in mode 1 & 2
static float raised_parked_position[NUM_AXIS]; // used in mode 1 static float raised_parked_position[NUM_AXIS]; // used in mode 1
static millis_t delayed_move_time = 0; // used in mode 1 static millis_t delayed_move_time = 0; // used in mode 1
static float duplicate_hotend_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2 static float duplicate_hotend_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
static float duplicate_extruder_temp_offset = 0; // used in mode 2 static float duplicate_hotend_temp_offset = 0; // used in mode 2
bool extruder_duplication_enabled = false; // used in mode 2 bool hotend_duplication_enabled = false; // used in mode 2
#endif //DUAL_X_CARRIAGE #endif //DUAL_X_CARRIAGE
...@@ -1175,7 +1175,7 @@ static void update_software_endstops(AxisEnum axis) { ...@@ -1175,7 +1175,7 @@ static void update_software_endstops(AxisEnum axis) {
float offs = home_offset[axis] + position_shift[axis]; float offs = home_offset[axis] + position_shift[axis];
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
if (axis == X_AXIS) { if (axis == X_AXIS) {
float dual_max_x = max(extruder_offset[X_AXIS][1], X2_MAX_POS); float dual_max_x = max(hotend_offset[X_AXIS][1], X2_MAX_POS);
if (active_extruder != 0) { if (active_extruder != 0) {
sw_endstop_min[X_AXIS] = X2_MIN_POS + offs; sw_endstop_min[X_AXIS] = X2_MIN_POS + offs;
sw_endstop_max[X_AXIS] = dual_max_x + offs; sw_endstop_max[X_AXIS] = dual_max_x + offs;
...@@ -1183,7 +1183,7 @@ static void update_software_endstops(AxisEnum axis) { ...@@ -1183,7 +1183,7 @@ static void update_software_endstops(AxisEnum axis) {
} }
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
sw_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs; sw_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
sw_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs; sw_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_hotend_x_offset) + offs;
return; return;
} }
} }
...@@ -3835,7 +3835,7 @@ inline void gcode_G28() { ...@@ -3835,7 +3835,7 @@ inline void gcode_G28() {
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
int x_axis_home_dir = x_home_dir(active_extruder); int x_axis_home_dir = x_home_dir(active_extruder);
extruder_duplication_enabled = false; hotend_duplication_enabled = false;
#else #else
int x_axis_home_dir = home_dir(X_AXIS); int x_axis_home_dir = home_dir(X_AXIS);
#endif #endif
...@@ -3889,16 +3889,16 @@ inline void gcode_G28() { ...@@ -3889,16 +3889,16 @@ inline void gcode_G28() {
if (home_all_axis || homeX) { if (home_all_axis || homeX) {
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
int tmp_extruder = active_extruder; int tmp_extruder = active_extruder;
extruder_duplication_enabled = false; hotend_duplication_enabled = false;
active_extruder = !active_extruder; active_extruder = !active_extruder;
HOMEAXIS(X); HOMEAXIS(X);
inactive_extruder_x_pos = current_position[X_AXIS]; inactive_hotend_x_pos = current_position[X_AXIS];
active_extruder = tmp_extruder; active_extruder = tmp_extruder;
HOMEAXIS(X); HOMEAXIS(X);
// reset state used by the different modes // reset state used by the different modes
memcpy(raised_parked_position, current_position, sizeof(raised_parked_position)); memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
delayed_move_time = 0; delayed_move_time = 0;
active_extruder_parked = true; active_hotend_parked = true;
#else #else
HOMEAXIS(X); HOMEAXIS(X);
#endif #endif
...@@ -6084,7 +6084,7 @@ inline void gcode_M104() { ...@@ -6084,7 +6084,7 @@ inline void gcode_M104() {
setTargetHotend(temp, target_extruder); setTargetHotend(temp, target_extruder);
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_hotend_temp_offset);
#endif #endif
/** /**
...@@ -6165,7 +6165,7 @@ inline void gcode_M109() { ...@@ -6165,7 +6165,7 @@ inline void gcode_M109() {
setTargetHotend(temp, target_extruder); setTargetHotend(temp, target_extruder);
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0) if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset); setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_hotend_temp_offset);
#endif #endif
/** /**
...@@ -7969,7 +7969,7 @@ inline void gcode_M503() { ...@@ -7969,7 +7969,7 @@ inline void gcode_M503() {
switch(dual_x_carriage_mode) { switch(dual_x_carriage_mode) {
case DXC_DUPLICATION_MODE: case DXC_DUPLICATION_MODE:
if (code_seen('X')) duplicate_hotend_x_offset = max(code_value(), X2_MIN_POS - x_home_pos(0)); if (code_seen('X')) duplicate_hotend_x_offset = max(code_value(), X2_MIN_POS - x_home_pos(0));
if (code_seen('R')) duplicate_extruder_temp_offset = code_value(); if (code_seen('R')) duplicate_hotend_temp_offset = code_value();
ECHO_SM(DB, SERIAL_HOTEND_OFFSET); ECHO_SM(DB, SERIAL_HOTEND_OFFSET);
ECHO_MV(" ", hotend_offset[X_AXIS][0]); ECHO_MV(" ", hotend_offset[X_AXIS][0]);
ECHO_MV(",", hotend_offset[Y_AXIS][0]); ECHO_MV(",", hotend_offset[Y_AXIS][0]);
...@@ -7983,8 +7983,8 @@ inline void gcode_M503() { ...@@ -7983,8 +7983,8 @@ inline void gcode_M503() {
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE; dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
break; break;
} }
active_extruder_parked = false; active_hotend_parked = false;
extruder_duplication_enabled = false; hotend_duplication_enabled = false;
delayed_move_time = 0; delayed_move_time = 0;
} }
#endif // DUAL_X_CARRIAGE #endif // DUAL_X_CARRIAGE
...@@ -8283,31 +8283,34 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -8283,31 +8283,34 @@ inline void gcode_T(uint8_t tmp_extruder) {
st_synchronize(); st_synchronize();
} }
// apply Y & Z extruder offset (x offset is already used in determining home pos)
current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
active_extruder = target_extruder; active_extruder = target_extruder;
// This function resets the max/min values - the current position may be overwritten below. // This function resets the max/min values - the current position may be overwritten below.
set_axis_is_at_home(X_AXIS); set_axis_is_at_home(X_AXIS);
if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE) { if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE) {
current_position[X_AXIS] = inactive_extruder_x_pos; current_position[X_AXIS] = inactive_hotend_x_pos;
inactive_extruder_x_pos = destination[X_AXIS]; inactive_hotend_x_pos = destination[X_AXIS];
} }
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) { else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position active_hotend_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
if (active_extruder == 0 || active_extruder_parked) if (active_hotend_parked)
current_position[X_AXIS] = inactive_extruder_x_pos; current_position[X_AXIS] = inactive_hotend_x_pos;
else else
current_position[X_AXIS] = destination[X_AXIS] + duplicate_hotend_x_offset; current_position[X_AXIS] = destination[X_AXIS] + duplicate_hotend_x_offset;
inactive_extruder_x_pos = destination[X_AXIS]; inactive_hotend_x_pos = destination[X_AXIS];
extruder_duplication_enabled = false; hotend_duplication_enabled = false;
} }
else { else {
// record raised toolhead position for use by unpark // record raised toolhead position for use by unpark
memcpy(raised_parked_position, current_position, sizeof(raised_parked_position)); memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT; raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
active_extruder_parked = true; active_hotend_parked = true;
delayed_move_time = 0; delayed_move_time = 0;
} }
...@@ -9426,15 +9429,15 @@ static void report_current_position() { ...@@ -9426,15 +9429,15 @@ static void report_current_position() {
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
inline bool prepare_move_dual_x_carriage() { inline bool prepare_move_dual_x_carriage() {
if (active_extruder_parked) { if (active_hotend_parked) {
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
// move duplicate extruder into correct duplication position. // move duplicate extruder into correct duplication position.
planner.set_position_mm(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); planner.set_position_mm(inactive_hotend_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
planner.buffer_line(current_position[X_AXIS] + duplicate_hotend_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_planner.acceleration_units_per_sq_second[X_AXIS], 1, active_driver); planner.buffer_line(current_position[X_AXIS] + duplicate_hotend_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_planner.acceleration_units_per_sq_second[X_AXIS], 1, active_driver);
sync_plan_position(); sync_plan_position();
st_synchronize(); st_synchronize();
extruder_duplication_enabled = true; hotend_duplication_enabled = true;
active_extruder_parked = false; active_hotend_parked = false;
} }
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) { // handle unparking of head
if (current_position[E_AXIS] == destination[E_AXIS]) { if (current_position[E_AXIS] == destination[E_AXIS]) {
...@@ -9453,7 +9456,7 @@ static void report_current_position() { ...@@ -9453,7 +9456,7 @@ static void report_current_position() {
planner.buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], planner.max_planner.acceleration_units_per_sq_second[Z_AXIS], active_extruder, active_driver); planner.buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], planner.max_planner.acceleration_units_per_sq_second[Z_AXIS], active_extruder, active_driver);
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(planner.max_planner.acceleration_units_per_sq_second[X_AXIS], planner.max_planner.acceleration_units_per_sq_second[Y_AXIS]), active_extruder, active_driver); planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(planner.max_planner.acceleration_units_per_sq_second[X_AXIS], planner.max_planner.acceleration_units_per_sq_second[Y_AXIS]), active_extruder, active_driver);
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_planner.acceleration_units_per_sq_second[Z_AXIS], active_extruder, active_driver); planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_planner.acceleration_units_per_sq_second[Z_AXIS], active_extruder, active_driver);
active_extruder_parked = false; active_hotend_parked = false;
} }
} }
return true; return true;
......
...@@ -37,7 +37,7 @@ void idle( ...@@ -37,7 +37,7 @@ void idle(
void manage_inactivity(bool ignore_stepper_queue = false); void manage_inactivity(bool ignore_stepper_queue = false);
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
extern bool extruder_duplication_enabled; extern bool hotend_duplication_enabled;
#endif #endif
void FlushSerialRequestResend(); void FlushSerialRequestResend();
......
...@@ -41,12 +41,17 @@ ...@@ -41,12 +41,17 @@
#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
#if ENABLED(miniVIKI) #if ENABLED(miniVIKI)
#define LCD_CONTRAST_MIN 75
#define LCD_CONTRAST_MAX 115
#define DEFAULT_LCD_CONTRAST 95 #define DEFAULT_LCD_CONTRAST 95
#elif ENABLED(VIKI2) #elif ENABLED(VIKI2)
#define DEFAULT_LCD_CONTRAST 40 #define DEFAULT_LCD_CONTRAST 40
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define LCD_CONTRAST_MIN 90
#define LCD_CONTRAST_MAX 130
#define DEFAULT_LCD_CONTRAST 110 #define DEFAULT_LCD_CONTRAST 110
#define U8GLIB_LM6059_AF #define U8GLIB_LM6059_AF
#define SD_DETECT_INVERTED
#endif #endif
#define ENCODER_PULSES_PER_STEP 4 #define ENCODER_PULSES_PER_STEP 4
......
...@@ -79,6 +79,8 @@ ...@@ -79,6 +79,8 @@
#define MSG_SPEED "Speed" #define MSG_SPEED "Speed"
#define MSG_NOZZLE "Nozzle" #define MSG_NOZZLE "Nozzle"
#define MSG_BED "Bed" #define MSG_BED "Bed"
#define MSG_CHAMBER "Chamber"
#define MSG_COOLER "Cooler"
#define MSG_BED_Z "Bed Z" #define MSG_BED_Z "Bed Z"
#define MSG_FAN_SPEED "Fan speed" #define MSG_FAN_SPEED "Fan speed"
#define MSG_FLOW "Flow" #define MSG_FLOW "Flow"
......
...@@ -75,6 +75,8 @@ ...@@ -75,6 +75,8 @@
#define MSG_SPEED "Velocita" #define MSG_SPEED "Velocita"
#define MSG_NOZZLE "Ugello" #define MSG_NOZZLE "Ugello"
#define MSG_BED "Piatto" #define MSG_BED "Piatto"
#define MSG_CHAMBER "Camera"
#define MSG_COOLER "Raffreddamento"
#define MSG_BED_Z "piatto Z" #define MSG_BED_Z "piatto Z"
#define MSG_FAN_SPEED "Ventola" #define MSG_FAN_SPEED "Ventola"
#define MSG_FLOW "Flusso" #define MSG_FLOW "Flusso"
......
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update int8_t encoderDiff; // updated from interrupt context and added to encoderPosition every LCD update
int8_t manual_move_axis = (int8_t)NO_AXIS;
millis_t manual_move_start_time = 0;
bool encoderRateMultiplierEnabled; bool encoderRateMultiplierEnabled;
int32_t lastEncoderMovementMillis; int32_t lastEncoderMovementMillis;
...@@ -776,6 +779,7 @@ static void lcd_tune_menu() { ...@@ -776,6 +779,7 @@ static void lcd_tune_menu() {
// //
// Nozzle: // Nozzle:
// Nozzle [1-4]:
// //
#if HOTENDS == 1 #if HOTENDS == 1
#if TEMP_SENSOR_0 != 0 #if TEMP_SENSOR_0 != 0
...@@ -801,17 +805,24 @@ static void lcd_tune_menu() { ...@@ -801,17 +805,24 @@ static void lcd_tune_menu() {
#endif // HOTENDS > 1 #endif // HOTENDS > 1
// //
// Laser: // Bed:
// //
#if ENABLED(LASERBEAM) && HAS(COOLER) #if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_COOLER, &target_temperature_cooler, 0, COOLER_MAXTEMP - 15); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
#endif #endif
// //
// Bed: // Chamber
// //
#if TEMP_SENSOR_BED != 0 #if HAS(CHAMBER)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); MENU_ITEM_EDIT(int3, MSG_CHAMBER, &target_temperature_chamber, 0, CHAMBER_MAXTEMP - 15);
#endif
//
// Cooler
//
#if HAS(COOLER)
MENU_ITEM_EDIT(int3, MSG_COOLER, &target_temperature_cooler, 0, COOLER_MAXTEMP - 15);
#endif #endif
// //
...@@ -927,22 +938,40 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa ...@@ -927,22 +938,40 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
#endif #endif
void lcd_preheat_pla0123() { void lcd_preheat_pla0123() {
setTargetHotend0(plaPreheatHotendTemp); #if HOTENDS > 1
setTargetHotend1(plaPreheatHotendTemp); setTargetHotend(plaPreheatHotendTemp, 1);
setTargetHotend2(plaPreheatHotendTemp); #if HOTENDS > 2
_lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); setTargetHotend(plaPreheatHotendTemp, 2);
#if HOTENDS > 3
setTargetHotend(plaPreheatHotendTemp, 3);
#endif
#endif
#endif
lcd_preheat_pla0();
} }
void lcd_preheat_abs0123() { void lcd_preheat_abs0123() {
setTargetHotend0(absPreheatHotendTemp); #if HOTENDS > 1
setTargetHotend1(absPreheatHotendTemp); setTargetHotend(absPreheatHotendTemp, 1);
setTargetHotend2(absPreheatHotendTemp); #if HOTENDS > 2
_lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); setTargetHotend(absPreheatHotendTemp, 2);
#if HOTENDS > 3
setTargetHotend(absPreheatHotendTemp, 3);
#endif
#endif
#endif
lcd_preheat_abs0();
} }
void lcd_preheat_gum0123() { void lcd_preheat_gum0123() {
setTargetHotend0(gumPreheatHotendTemp); #if HOTENDS > 1
setTargetHotend1(gumPreheatHotendTemp); setTargetHotend(gumPreheatHotendTemp, 1);
setTargetHotend2(gumPreheatHotendTemp); #if HOTENDS > 2
_lcd_preheat(3, gumPreheatHotendTemp, gumPreheatHPBTemp, gumPreheatFanSpeed); setTargetHotend(gumPreheatHotendTemp, 2);
#if HOTENDS > 3
setTargetHotend(gumPreheatHotendTemp, 3);
#endif
#endif
#endif
lcd_preheat_gum0();
} }
#endif // HOTENDS > 1 #endif // HOTENDS > 1
...@@ -979,7 +1008,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa ...@@ -979,7 +1008,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
static void lcd_preheat_abs_menu() { static void lcd_preheat_abs_menu() {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_TEMPERATURE); MENU_ITEM(back, MSG_PREPARE);
#if HOTENDS == 1 #if HOTENDS == 1
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0); MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
#else #else
...@@ -1001,7 +1030,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa ...@@ -1001,7 +1030,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
static void lcd_preheat_gum_menu() { static void lcd_preheat_gum_menu() {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_TEMPERATURE); MENU_ITEM(back, MSG_PREPARE);
#if HOTENDS == 1 #if HOTENDS == 1
MENU_ITEM(function, MSG_PREHEAT_GUM, lcd_preheat_gum0); MENU_ITEM(function, MSG_PREHEAT_GUM, lcd_preheat_gum0);
#else #else
...@@ -1087,7 +1116,7 @@ void lcd_cooldown() { ...@@ -1087,7 +1116,7 @@ void lcd_cooldown() {
ENCODER_DIRECTION_NORMAL(); ENCODER_DIRECTION_NORMAL();
// Encoder wheel adjusts the Z position // Encoder wheel adjusts the Z position
if (encoderPosition && planner.movesplanned() <= 3) { if (encoderPosition) {
refresh_cmd_timeout(); refresh_cmd_timeout();
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP); current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
NOLESS(current_position[Z_AXIS], 0); NOLESS(current_position[Z_AXIS], 0);
...@@ -1100,8 +1129,8 @@ void lcd_cooldown() { ...@@ -1100,8 +1129,8 @@ void lcd_cooldown() {
LCDVIEW_REDRAW_NOW LCDVIEW_REDRAW_NOW
#endif #endif
; ;
encoderPosition = 0;
} }
encoderPosition = 0;
static bool debounce_click = false; static bool debounce_click = false;
if (LCD_CLICKED) { if (LCD_CLICKED) {
...@@ -1356,6 +1385,31 @@ static void lcd_prepare_menu() { ...@@ -1356,6 +1385,31 @@ static void lcd_prepare_menu() {
#endif // DELTA #endif // DELTA
/**
* If the most recent manual move hasn't been fed to the planner yet,
* and the planner can accept one, send immediately
*/
inline void manage_manual_move() {
if (manual_move_axis != (int8_t)NO_AXIS && millis() >= manual_move_start_time && !planner.is_full()) {
#if MECH(DELTA)
calculate_delta(current_position);
planner.buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, active_extruder, active_driver);
#else
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[manual_move_axis]/60, active_extruder, active_driver);
#endif
manual_move_axis = (int8_t)NO_AXIS;
}
}
/**
* Set a flag that lcd_update() should start a move
* to "current_position" after a short delay.
*/
inline void manual_move_to_current(AxisEnum axis) {
manual_move_start_time = millis() + 500UL; // 1/2 second delay
manual_move_axis = (int8_t)axis;
}
/** /**
* *
* "Prepare" > "Move Axis" submenu * "Prepare" > "Move Axis" submenu
...@@ -1366,12 +1420,13 @@ float move_menu_scale; ...@@ -1366,12 +1420,13 @@ float move_menu_scale;
static void _lcd_move(const char* name, AxisEnum axis, float min, float max) { static void _lcd_move(const char* name, AxisEnum axis, float min, float max) {
ENCODER_DIRECTION_NORMAL(); ENCODER_DIRECTION_NORMAL();
if (encoderPosition && planner.movesplanned() <= 3) { if (encoderPosition) {
refresh_cmd_timeout(); refresh_cmd_timeout();
current_position[axis] += float((int32_t)encoderPosition) * move_menu_scale; current_position[axis] += float((int32_t)encoderPosition) * move_menu_scale;
if (SOFTWARE_MIN_ENDSTOPS) NOLESS(current_position[axis], min); if (SOFTWARE_MIN_ENDSTOPS) NOLESS(current_position[axis], min);
if (SOFTWARE_MAX_ENDSTOPS) NOMORE(current_position[axis], max); if (SOFTWARE_MAX_ENDSTOPS) NOMORE(current_position[axis], max);
line_to_current(axis); encoderPosition = 0;
manual_move_to_current(axis);
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
encoderPosition = 0; encoderPosition = 0;
...@@ -1380,7 +1435,7 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) { ...@@ -1380,7 +1435,7 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) {
} }
#if MECH(DELTA) #if MECH(DELTA)
static float delta_clip_radius_2 = (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS); static float delta_clip_radius_2 = (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS);
static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a * a); } static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a * a); }
static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(sw_endstop_min[X_AXIS], -clip), min(sw_endstop_max[X_AXIS], clip)); } static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(sw_endstop_min[X_AXIS], -clip), min(sw_endstop_max[X_AXIS], clip)); }
static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, max(sw_endstop_min[Y_AXIS], -clip), min(sw_endstop_max[Y_AXIS], clip)); } static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, max(sw_endstop_min[Y_AXIS], -clip), min(sw_endstop_max[Y_AXIS], clip)); }
...@@ -1399,15 +1454,15 @@ static void lcd_move_e( ...@@ -1399,15 +1454,15 @@ static void lcd_move_e(
unsigned short original_active_extruder = active_extruder; unsigned short original_active_extruder = active_extruder;
active_extruder = e; active_extruder = e;
#endif #endif
if (encoderPosition && planner.movesplanned() <= 3) { if (encoderPosition) {
#if ENABLED(IDLE_OOZING_PREVENT) #if ENABLED(IDLE_OOZING_PREVENT)
IDLE_OOZING_retract(false); IDLE_OOZING_retract(false);
#endif #endif
current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale; current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
line_to_current(E_AXIS); encoderPosition = 0;
manual_move_to_current(E_AXIS);
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
encoderPosition = 0;
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
PGM_P pos_label; PGM_P pos_label;
#if EXTRUDERS == 1 #if EXTRUDERS == 1
...@@ -1948,23 +2003,18 @@ static void lcd_control_motion_menu() { ...@@ -1948,23 +2003,18 @@ static void lcd_control_motion_menu() {
static void lcd_set_contrast() { static void lcd_set_contrast() {
ENCODER_DIRECTION_NORMAL(); ENCODER_DIRECTION_NORMAL();
if (encoderPosition) { if (encoderPosition) {
#if ENABLED(U8GLIB_LM6059_AF) set_lcd_contrast(lcd_contrast + encoderPosition);
lcd_contrast += encoderPosition;
lcd_contrast &= 0xFF;
#else
lcd_contrast -= encoderPosition;
lcd_contrast &= 0x3F;
#endif
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
u8g.setContrast(lcd_contrast);
} }
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
#if ENABLED(U8GLIB_LM6059_AF) lcd_implementation_drawedit(PSTR(MSG_CONTRAST),
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast)); #if LCD_CONTRAST_MAX >= 100
#else itostr3(lcd_contrast)
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); #else
#endif itostr2(lcd_contrast)
#endif
);
} }
if (LCD_CLICKED) lcd_goto_previous_menu(true); if (LCD_CLICKED) lcd_goto_previous_menu(true);
} }
...@@ -2577,6 +2627,8 @@ void lcd_update() { ...@@ -2577,6 +2627,8 @@ void lcd_update() {
static millis_t return_to_status_ms = 0; static millis_t return_to_status_ms = 0;
#endif #endif
manage_manual_move();
lcd_buttons_update(); lcd_buttons_update();
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
...@@ -2805,8 +2857,8 @@ void lcd_setalertstatuspgm(const char* message) { ...@@ -2805,8 +2857,8 @@ void lcd_setalertstatuspgm(const char* message) {
void lcd_reset_alert_level() { lcd_status_message_level = 0; } void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#if HAS(LCD_CONTRAST) #if HAS(LCD_CONTRAST)
void lcd_setcontrast(uint8_t value) { void set_lcd_contrast(int value) {
lcd_contrast = value & 0x3F; lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
#endif #endif
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
extern int lcd_contrast; extern int lcd_contrast;
void lcd_setcontrast(uint8_t value); void set_lcd_contrast(int value);
#endif #endif
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
......
...@@ -92,7 +92,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone; ...@@ -92,7 +92,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone;
#if ENABLED(ADVANCE) #if ENABLED(ADVANCE)
static long advance_rate, advance, final_advance = 0; static long advance_rate, advance, final_advance = 0;
static long old_advance = 0; static long old_advance = 0;
static long e_steps[6]; static long e_steps[EXTRUDERS];
#elif ENABLED(ADVANCE_LPC) #elif ENABLED(ADVANCE_LPC)
int extruder_advance_k = ADVANCE_LPC_K; int extruder_advance_k = ADVANCE_LPC_K;
volatile int e_steps[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0); volatile int e_steps[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0);
...@@ -130,7 +130,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; ...@@ -130,7 +130,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
#define X_APPLY_DIR(v,ALWAYS) \ #define X_APPLY_DIR(v,ALWAYS) \
if (extruder_duplication_enabled || ALWAYS) { \ if (hotend_duplication_enabled || ALWAYS) { \
X_DIR_WRITE(v); \ X_DIR_WRITE(v); \
X2_DIR_WRITE(v); \ X2_DIR_WRITE(v); \
} \ } \
...@@ -138,7 +138,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; ...@@ -138,7 +138,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
if (current_block->active_driver) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \ if (current_block->active_driver) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \
} }
#define X_APPLY_STEP(v,ALWAYS) \ #define X_APPLY_STEP(v,ALWAYS) \
if (extruder_duplication_enabled || ALWAYS) { \ if (hotend_duplication_enabled || ALWAYS) { \
X_STEP_WRITE(v); \ X_STEP_WRITE(v); \
X2_STEP_WRITE(v); \ X2_STEP_WRITE(v); \
} \ } \
...@@ -1010,7 +1010,7 @@ void st_init() { ...@@ -1010,7 +1010,7 @@ void st_init() {
#if ENABLED(ADVANCE) || ENABLED(ADVANCE_LPC) #if ENABLED(ADVANCE) || ENABLED(ADVANCE_LPC)
#if ENABLED(ADVANCE) #if ENABLED(ADVANCE)
e_steps[0] = e_steps[1] = e_steps[2] = e_steps[3] = e_steps[4] = e_steps[5] = 0; for (uint8_t i = 0; i < EXTRUDERS; i++) e_steps[i] = 0;
#elif ENABLED(ADVANCE_LPC) #elif ENABLED(ADVANCE_LPC)
for (uint8_t i = 0; i < EXTRUDERS; i++) { for (uint8_t i = 0; i < EXTRUDERS; i++) {
e_steps[i] = 0; e_steps[i] = 0;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#ifndef STEPPER_H #ifndef STEPPER_H
#define STEPPER_H #define STEPPER_H
/** /**
* Axis indices as enumerated constants * Axis indices as enumerated constants
* *
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* A_AXIS and C_AXIS are used by COREXZ or COREZX printers * A_AXIS and C_AXIS are used by COREXZ or COREZX printers
* X_HEAD and Y_HEAD and Z_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots. * X_HEAD and Y_HEAD and Z_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
*/ */
enum AxisEnum {X_AXIS = 0, A_AXIS = 0, Y_AXIS = 1, B_AXIS = 1, Z_AXIS = 2, C_AXIS = 2, E_AXIS = 3, X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 5}; enum AxisEnum {NO_AXIS = -1, X_AXIS = 0, A_AXIS = 0, Y_AXIS = 1, B_AXIS = 1, Z_AXIS = 2, C_AXIS = 2, E_AXIS = 3, X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 5};
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
#if ENABLED(ABORT_ON_ENDSTOP_HIT_INIT) #if ENABLED(ABORT_ON_ENDSTOP_HIT_INIT)
......
...@@ -238,9 +238,9 @@ ...@@ -238,9 +238,9 @@
#define NORM_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; }} #define NORM_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; }}
#define REV_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; }} #define REV_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; }}
#else #else
#define E_STEP_WRITE(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }} #define E_STEP_WRITE(v) { if(hotend_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }} #define NORM_E_DIR() { if(hotend_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE( INVERT_E1_DIR); } else { E0_DIR_WRITE( INVERT_E0_DIR); }} #define REV_E_DIR() { if(hotend_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE( INVERT_E1_DIR); } else { E0_DIR_WRITE( INVERT_E0_DIR); }}
#endif #endif
#else #else
#if ENABLED(DONDOLO_SINGLE_MOTOR) #if ENABLED(DONDOLO_SINGLE_MOTOR)
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
* *
* Grbl is distributed in the hope that it will be useful, * Grbl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Grbl. If not, see <http://www.gnu.org/licenses/>. * along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../../base.h" #include "../../base.h"
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
* *
* Grbl is distributed in the hope that it will be useful, * Grbl is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Grbl. If not, see <http://www.gnu.org/licenses/>. * along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef NEXTIONLCD_H #ifndef NEXTIONLCD_H
......
...@@ -208,6 +208,8 @@ class Planner { ...@@ -208,6 +208,8 @@ class Planner {
*/ */
static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); } static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING) #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
......
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