diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ef4bd32b6..7b8fcb054 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -610,6 +610,20 @@ static void report_current_position(); print_xyz(PSTR(STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) #endif +/** + * sync_plan_position + * Set planner / stepper positions to the cartesian current_position. + * The stepper code translates these coordinates into step units. + * Allows translation between steps and millimeters for cartesian & core robots + */ +inline void sync_plan_position() { + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position); + #endif + planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); +} +inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); } + #if ENABLED(DELTA) || ENABLED(SCARA) inline void sync_plan_position_delta() { #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -897,16 +911,15 @@ void setup() { // Send "ok" after commands by default for (int8_t i = 0; i < BUFSIZE; i++) send_ok[i] = true; - // loads data from EEPROM if available else uses defaults (and resets step acceleration rate) + // Load data from EEPROM if available (or use defaults) + // This also updates variables in the planner, elsewhere Config_RetrieveSettings(); // Initialize current position based on home_offset memcpy(current_position, home_offset, sizeof(home_offset)); - #if ENABLED(DELTA) || ENABLED(SCARA) - // Vital to init kinematic equivalent for X0 Y0 Z0 - SYNC_PLAN_POSITION_KINEMATIC(); - #endif + // Vital to init stepper/planner equivalent for current_position + SYNC_PLAN_POSITION_KINEMATIC(); thermalManager.init(); // Initialize temperature loop @@ -1319,7 +1332,7 @@ inline bool code_value_bool() { return code_value_byte() > 0; } case TEMPUNIT_C: return code_value_float(); case TEMPUNIT_F: - return (code_value_float() - 32) / 1.8; + return (code_value_float() - 32) * 0.5555555556; case TEMPUNIT_K: return code_value_float() - 272.15; default: @@ -1333,7 +1346,7 @@ inline bool code_value_bool() { return code_value_byte() > 0; } case TEMPUNIT_K: return code_value_float(); case TEMPUNIT_F: - return code_value_float() / 1.8; + return code_value_float() * 0.5555555556; default: return code_value_float(); } @@ -1627,19 +1640,6 @@ inline void line_to_destination(float fr_mm_m) { } inline void line_to_destination() { line_to_destination(feedrate_mm_m); } -/** - * sync_plan_position - * Set planner / stepper positions to the cartesian current_position. - * The stepper code translates these coordinates into step units. - * Allows translation between steps and millimeters for cartesian & core robots - */ -inline void sync_plan_position() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position); - #endif - planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); -} -inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); } inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); } inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); } @@ -5147,6 +5147,7 @@ inline void gcode_M92() { } } } + planner.refresh_positioning(); } /** @@ -6140,7 +6141,7 @@ inline void gcode_M428() { bool err = false; LOOP_XYZ(i) { if (axis_homed[i]) { - float base = (current_position[i] > (sw_endstop_min[i] + sw_endstop_max[i]) / 2) ? base_home_pos(i) : 0, + float base = (current_position[i] > (sw_endstop_min[i] + sw_endstop_max[i]) * 0.5) ? base_home_pos(i) : 0, diff = current_position[i] - LOGICAL_POSITION(base, i); if (diff > -20 && diff < 20) { set_home_offset((AxisEnum)i, home_offset[i] - diff); diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 6a581ee1f..233a28cd5 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -171,10 +171,16 @@ void Config_Postprocess() { // steps per s2 needs to be updated to agree with units per s2 planner.reset_acceleration_rates(); + // Make sure delta kinematics are updated before refreshing the + // planner position so the stepper counts will be set correctly. #if ENABLED(DELTA) recalc_delta_settings(delta_radius, delta_diagonal_rod); #endif + // Refresh steps_to_mm with the reciprocal of axis_steps_per_mm + // and init stepper.count[], planner.position[] with current_position + planner.refresh_positioning(); + #if ENABLED(PIDTEMP) thermalManager.updatePID(); #endif diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 35e5d3bd9..d59f6c8e9 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -80,29 +80,31 @@ block_t Planner::block_buffer[BLOCK_BUFFER_SIZE]; volatile uint8_t Planner::block_buffer_head = 0; // Index of the next block to be pushed volatile uint8_t Planner::block_buffer_tail = 0; -float Planner::max_feedrate_mm_s[NUM_AXIS]; // Max speeds in mm per second -float Planner::axis_steps_per_mm[NUM_AXIS]; -unsigned long Planner::max_acceleration_steps_per_s2[NUM_AXIS]; -unsigned long Planner::max_acceleration_mm_per_s2[NUM_AXIS]; // Use M201 to override by software +float Planner::max_feedrate_mm_s[NUM_AXIS], // Max speeds in mm per second + Planner::axis_steps_per_mm[NUM_AXIS], + Planner::steps_to_mm[NUM_AXIS]; + +unsigned long Planner::max_acceleration_steps_per_s2[NUM_AXIS], + Planner::max_acceleration_mm_per_s2[NUM_AXIS]; // Use M201 to override by software millis_t Planner::min_segment_time; -float Planner::min_feedrate_mm_s; -float Planner::acceleration; // Normal acceleration mm/s^2 DEFAULT ACCELERATION for all printing moves. M204 SXXXX -float Planner::retract_acceleration; // Retract acceleration mm/s^2 filament pull-back and push-forward while standing still in the other axes M204 TXXXX -float Planner::travel_acceleration; // Travel acceleration mm/s^2 DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX -float Planner::max_xy_jerk; // The largest speed change requiring no acceleration -float Planner::max_z_jerk; -float Planner::max_e_jerk; -float Planner::min_travel_feedrate_mm_s; +float Planner::min_feedrate_mm_s, + Planner::acceleration, // Normal acceleration mm/s^2 DEFAULT ACCELERATION for all printing moves. M204 SXXXX + Planner::retract_acceleration, // Retract acceleration mm/s^2 filament pull-back and push-forward while standing still in the other axes M204 TXXXX + Planner::travel_acceleration, // Travel acceleration mm/s^2 DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX + Planner::max_xy_jerk, // The largest speed change requiring no acceleration + Planner::max_z_jerk, + Planner::max_e_jerk, + Planner::min_travel_feedrate_mm_s; #if ENABLED(AUTO_BED_LEVELING_FEATURE) matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level #endif #if ENABLED(AUTOTEMP) - float Planner::autotemp_max = 250; - float Planner::autotemp_min = 210; - float Planner::autotemp_factor = 0.1; + float Planner::autotemp_max = 250, + Planner::autotemp_min = 210, + Planner::autotemp_factor = 0.1; bool Planner::autotemp_enabled = false; #endif @@ -110,9 +112,8 @@ float Planner::min_travel_feedrate_mm_s; long Planner::position[NUM_AXIS] = { 0 }; -float Planner::previous_speed[NUM_AXIS]; - -float Planner::previous_nominal_speed; +float Planner::previous_speed[NUM_AXIS], + Planner::previous_nominal_speed; #if ENABLED(DISABLE_INACTIVE_EXTRUDER) uint8_t Planner::g_uc_extruder_last_move[EXTRUDERS] = { 0 }; @@ -783,31 +784,37 @@ void Planner::check_axes_activity() { #if ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ) float delta_mm[6]; #if ENABLED(COREXY) - delta_mm[X_HEAD] = dx / axis_steps_per_mm[A_AXIS]; - delta_mm[Y_HEAD] = dy / axis_steps_per_mm[B_AXIS]; - delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS]; - delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_mm[A_AXIS]; - delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_mm[B_AXIS]; + delta_mm[X_HEAD] = dx * steps_to_mm[A_AXIS]; + delta_mm[Y_HEAD] = dy * steps_to_mm[B_AXIS]; + delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS]; + delta_mm[A_AXIS] = (dx + dy) * steps_to_mm[A_AXIS]; + delta_mm[B_AXIS] = (dx - dy) * steps_to_mm[B_AXIS]; #elif ENABLED(COREXZ) - delta_mm[X_HEAD] = dx / axis_steps_per_mm[A_AXIS]; - delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS]; - delta_mm[Z_HEAD] = dz / axis_steps_per_mm[C_AXIS]; - delta_mm[A_AXIS] = (dx + dz) / axis_steps_per_mm[A_AXIS]; - delta_mm[C_AXIS] = (dx - dz) / axis_steps_per_mm[C_AXIS]; + delta_mm[X_HEAD] = dx * steps_to_mm[A_AXIS]; + delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS]; + delta_mm[Z_HEAD] = dz * steps_to_mm[C_AXIS]; + delta_mm[A_AXIS] = (dx + dz) * steps_to_mm[A_AXIS]; + delta_mm[C_AXIS] = (dx - dz) * steps_to_mm[C_AXIS]; #elif ENABLED(COREYZ) - delta_mm[X_AXIS] = dx / axis_steps_per_mm[A_AXIS]; - delta_mm[Y_HEAD] = dy / axis_steps_per_mm[Y_AXIS]; - delta_mm[Z_HEAD] = dz / axis_steps_per_mm[C_AXIS]; - delta_mm[B_AXIS] = (dy + dz) / axis_steps_per_mm[B_AXIS]; - delta_mm[C_AXIS] = (dy - dz) / axis_steps_per_mm[C_AXIS]; + delta_mm[X_AXIS] = dx * steps_to_mm[X_AXIS]; + delta_mm[Y_HEAD] = dy * steps_to_mm[B_AXIS]; + delta_mm[Z_HEAD] = dz * steps_to_mm[C_AXIS]; + delta_mm[B_AXIS] = (dy + dz) * steps_to_mm[B_AXIS]; + delta_mm[C_AXIS] = (dy - dz) * steps_to_mm[C_AXIS]; #endif #else float delta_mm[4]; - delta_mm[X_AXIS] = dx / axis_steps_per_mm[X_AXIS]; - delta_mm[Y_AXIS] = dy / axis_steps_per_mm[Y_AXIS]; - delta_mm[Z_AXIS] = dz / axis_steps_per_mm[Z_AXIS]; + #if ENABLED(DELTA) + // On delta all axes (should!) have the same steps-per-mm + // so calculate distance in steps first, then do one division + // at the end to get millimeters + #else + delta_mm[X_AXIS] = dx * steps_to_mm[X_AXIS]; + delta_mm[Y_AXIS] = dy * steps_to_mm[Y_AXIS]; + delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS]; + #endif #endif - delta_mm[E_AXIS] = (de / axis_steps_per_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0; + delta_mm[E_AXIS] = 0.01 * (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder]; if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) { block->millimeters = fabs(delta_mm[E_AXIS]); @@ -820,10 +827,16 @@ void Planner::check_axes_activity() { sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD]) #elif ENABLED(COREYZ) sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD]) + #elif ENABLED(DELTA) + sq(dx) + sq(dy) + sq(dz) #else sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS]) #endif - ); + ) + #if ENABLED(DELTA) + * steps_to_mm[X_AXIS] + #endif + ; } float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides @@ -875,7 +888,7 @@ void Planner::check_axes_activity() { while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM; // Convert into an index into the measurement array - filwidth_delay_index1 = (int)(filwidth_delay_dist / 10.0 + 0.0001); + filwidth_delay_index1 = (int)(filwidth_delay_dist * 0.1 + 0.0001); // If the index has changed (must have gone forward)... if (filwidth_delay_index1 != filwidth_delay_index2) { @@ -962,7 +975,7 @@ void Planner::check_axes_activity() { block->acceleration_steps_per_s2 = (max_acceleration_steps_per_s2[E_AXIS] * block->step_event_count) / block->steps[E_AXIS]; } block->acceleration = block->acceleration_steps_per_s2 / steps_per_mm; - block->acceleration_rate = (long)(block->acceleration_steps_per_s2 * 16777216.0 / ((F_CPU) / 8.0)); + block->acceleration_rate = (long)(block->acceleration_steps_per_s2 * 16777216.0 / ((F_CPU) * 0.125)); #if 0 // Use old jerk for now @@ -1008,10 +1021,12 @@ void Planner::check_axes_activity() { #endif // Start with a safe speed - float vmax_junction = max_xy_jerk / 2; - float vmax_junction_factor = 1.0; - float mz2 = max_z_jerk / 2, me2 = max_e_jerk / 2; - float csz = current_speed[Z_AXIS], cse = current_speed[E_AXIS]; + float vmax_junction = max_xy_jerk * 0.5, + vmax_junction_factor = 1.0, + mz2 = max_z_jerk * 0.5, + me2 = max_e_jerk * 0.5, + csz = current_speed[Z_AXIS], + cse = current_speed[E_AXIS]; if (fabs(csz) > mz2) vmax_junction = min(vmax_junction, mz2); if (fabs(cse) > me2) vmax_junction = min(vmax_junction, me2); vmax_junction = min(vmax_junction, block->nominal_speed); @@ -1164,6 +1179,7 @@ void Planner::check_axes_activity() { void Planner::set_e_position_mm(const float& e) { position[E_AXIS] = lround(e * axis_steps_per_mm[E_AXIS]); stepper.set_e_position(position[E_AXIS]); + previous_speed[E_AXIS] = 0.0; } // Recalculate the steps/s^2 acceleration rates, based on the mm/s^2 @@ -1172,6 +1188,13 @@ void Planner::reset_acceleration_rates() { max_acceleration_steps_per_s2[i] = max_acceleration_mm_per_s2[i] * axis_steps_per_mm[i]; } +// Recalculate position, steps_to_mm if axis_steps_per_mm changes! +void Planner::refresh_positioning() { + LOOP_XYZE(i) planner.steps_to_mm[i] = 1.0 / planner.axis_steps_per_mm[i]; + set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); + reset_acceleration_rates(); +} + #if ENABLED(AUTOTEMP) void Planner::autotemp_M109() { diff --git a/Marlin/planner.h b/Marlin/planner.h index 74abd1cb2..eac1ae5c6 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -121,6 +121,7 @@ class Planner { static float max_feedrate_mm_s[NUM_AXIS]; // Max speeds in mm per second static float axis_steps_per_mm[NUM_AXIS]; + static float steps_to_mm[NUM_AXIS]; static unsigned long max_acceleration_steps_per_s2[NUM_AXIS]; static unsigned long max_acceleration_mm_per_s2[NUM_AXIS]; // Use M201 to override by software @@ -142,7 +143,7 @@ class Planner { /** * The current position of the tool in absolute steps - * Reclculated if any axis_steps_per_mm are changed by gcode + * Recalculated if any axis_steps_per_mm are changed by gcode */ static long position[NUM_AXIS]; @@ -187,6 +188,7 @@ class Planner { */ static void reset_acceleration_rates(); + static void refresh_positioning(); // Manage fans, paste pressure, etc. static void check_axes_activity(); diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 90a1ddf65..88e8cd560 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -944,14 +944,14 @@ float Stepper::get_axis_position_mm(AxisEnum axis) { CRITICAL_SECTION_END; // ((a1+a2)+(a1-a2))/2 -> (a1+a2+a1-a2)/2 -> (a1+a1)/2 -> a1 // ((a1+a2)-(a1-a2))/2 -> (a1+a2-a1+a2)/2 -> (a2+a2)/2 -> a2 - axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) / 2.0f; + axis_steps = (pos1 + ((axis == CORE_AXIS_1) ? pos2 : -pos2)) * 0.5f; } else axis_steps = position(axis); #else axis_steps = position(axis); #endif - return axis_steps / planner.axis_steps_per_mm[axis]; + return axis_steps * planner.steps_to_mm[axis]; } void Stepper::finish_and_disable() { @@ -973,9 +973,9 @@ void Stepper::endstop_triggered(AxisEnum axis) { float axis_pos = count_position[axis]; if (axis == CORE_AXIS_1) - axis_pos = (axis_pos + count_position[CORE_AXIS_2]) / 2; + axis_pos = (axis_pos + count_position[CORE_AXIS_2]) * 0.5; else if (axis == CORE_AXIS_2) - axis_pos = (count_position[CORE_AXIS_1] - axis_pos) / 2; + axis_pos = (count_position[CORE_AXIS_1] - axis_pos) * 0.5; endstops_trigsteps[axis] = axis_pos; #else // !COREXY && !COREXZ && !COREYZ diff --git a/Marlin/stepper.h b/Marlin/stepper.h index 45c8753aa..3ecf93a71 100644 --- a/Marlin/stepper.h +++ b/Marlin/stepper.h @@ -262,7 +262,7 @@ class Stepper { // Triggered position of an axis in mm (not core-savvy) // static FORCE_INLINE float triggered_position_mm(AxisEnum axis) { - return endstops_trigsteps[axis] / planner.axis_steps_per_mm[axis]; + return endstops_trigsteps[axis] * planner.steps_to_mm[axis]; } #if ENABLED(LIN_ADVANCE) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index db2805285..666edd90f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -319,13 +319,13 @@ unsigned char Temperature::soft_pwm[HOTENDS]; SERIAL_PROTOCOLPAIR(MSG_T_MIN, min); SERIAL_PROTOCOLPAIR(MSG_T_MAX, max); if (cycles > 2) { - Ku = (4.0 * d) / (3.14159265 * (max - min) / 2.0); - Tu = ((float)(t_low + t_high) / 1000.0); + Ku = (4.0 * d) / (3.14159265 * (max - min) * 0.5); + Tu = ((float)(t_low + t_high) * 0.001); SERIAL_PROTOCOLPAIR(MSG_KU, Ku); SERIAL_PROTOCOLPAIR(MSG_TU, Tu); workKp = 0.6 * Ku; workKi = 2 * workKp / Tu; - workKd = workKp * Tu / 8; + workKd = workKp * Tu * 0.125; SERIAL_PROTOCOLLNPGM(MSG_CLASSIC_PID); SERIAL_PROTOCOLPAIR(MSG_KP, workKp); SERIAL_PROTOCOLPAIR(MSG_KI, workKi); @@ -572,7 +572,7 @@ float Temperature::get_pid_output(int e) { lpq[lpq_ptr] = 0; } if (++lpq_ptr >= lpq_len) lpq_ptr = 0; - cTerm[HOTEND_INDEX] = (lpq[lpq_ptr] / planner.axis_steps_per_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX); + cTerm[HOTEND_INDEX] = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX); pid_output += cTerm[HOTEND_INDEX]; } #endif //PID_ADD_EXTRUSION_RATE @@ -753,7 +753,7 @@ void Temperature::manage_heater() { // Get the delayed info and add 100 to reconstitute to a percent of // the nominal filament diameter then square it to get an area meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY); - float vm = pow((measurement_delay[meas_shift_index] + 100.0) / 100.0, 2); + float vm = pow((measurement_delay[meas_shift_index] + 100.0) * 0.01, 2); NOLESS(vm, 0.01); volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] = vm; } diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 7d687acea..e3729898f 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -678,7 +678,7 @@ void kill_screen(const char* lcd_msg) { } if (lcdDrawUpdate) lcd_implementation_drawedit(msg, ftostr43sign( - ((1000 * babysteps_done) / planner.axis_steps_per_mm[axis]) * 0.001f + ((1000 * babysteps_done) * planner.steps_to_mm[axis]) * 0.001f )); } @@ -1769,6 +1769,7 @@ void kill_screen(const char* lcd_msg) { } static void _reset_acceleration_rates() { planner.reset_acceleration_rates(); } + static void _planner_refresh_positioning() { planner.refresh_positioning(); } /** * @@ -1805,14 +1806,14 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates); MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000); MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000); - MENU_ITEM_EDIT(float52, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999); - MENU_ITEM_EDIT(float52, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999, _planner_refresh_positioning); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999, _planner_refresh_positioning); #if ENABLED(DELTA) - MENU_ITEM_EDIT(float52, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999); + MENU_ITEM_EDIT_CALLBACK(float52, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning); #else - MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999); + MENU_ITEM_EDIT_CALLBACK(float51, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning); #endif - MENU_ITEM_EDIT(float51, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999); + MENU_ITEM_EDIT_CALLBACK(float51, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit); #endif diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index ff9cc6223..f53f9269c 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -385,7 +385,7 @@ static void lcd_implementation_status_screen() { // SD Card Progress bar and clock if (IS_SD_PRINTING) { // Progress bar solid part - u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2 - (TALL_FONT_CORRECTION)); + u8g.drawBox(55, 50, (unsigned int)(71 * card.percentDone() * 0.01), 2 - (TALL_FONT_CORRECTION)); } u8g.setPrintPos(80,48);