Skip to content

Fix G26's circle drawing... #8291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9965,7 +9965,7 @@ void quickstop_stepper() {
hasQ = !hasZ && parser.seen('Q');

if (hasC) {
const mesh_index_pair location = ubl.find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL, false);
const mesh_index_pair location = ubl.find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL);
ix = location.x_index;
iy = location.y_index;
}
Expand Down Expand Up @@ -12849,24 +12849,28 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
* Returns true if current_position[] was set to destination[]
*/
inline bool prepare_move_to_destination_cartesian() {
if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
const float fr_scaled = MMS_SCALED(feedrate_mm_s);
const float fr_scaled = MMS_SCALED(feedrate_mm_s);
#if HAS_MESH
if (planner.leveling_active) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.line_to_destination_cartesian(fr_scaled, active_extruder);
#elif ENABLED(MESH_BED_LEVELING)
mesh_line_to_destination(fr_scaled);
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_line_to_destination(fr_scaled);
#endif
return true;
if (!planner.leveling_active) {
line_to_destination(fr_scaled);
return false;
}
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.line_to_destination_cartesian(fr_scaled, active_extruder); // UBL's motion routine needs to know about all moves,
return true; // even purely Z-Axis moves
#else
if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
#if ENABLED(MESH_BED_LEVELING)
mesh_line_to_destination(fr_scaled);
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_line_to_destination(fr_scaled);
#endif
return true;
}
else
line_to_destination();
#endif
#endif // HAS_MESH
line_to_destination(fr_scaled);
}
else
line_to_destination();

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
*/
#define X_PROBE_OFFSET_FROM_EXTRUDER -17 // X offset: -left +right [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER -10 // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1.027 // Z offset: -below +above [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.87 // Z offset: -below +above [the nozzle]

// X and Y axis travel speed (mm/m) between probes
#define XY_PROBE_SPEED 7500
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@
* On print completion the LCD Menu will open with the file selected.
* You can just click to start the print, or navigate elsewhere.
*/
//#define SD_REPRINT_LAST_SELECTED_FILE
#define SD_REPRINT_LAST_SELECTED_FILE

#endif // SDSUPPORT

Expand Down Expand Up @@ -679,7 +679,7 @@
#if ENABLED(BABYSTEPPING)
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
#define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion.
#define BABYSTEP_MULTIPLICATOR 3 // Babysteps are very small. Increase for faster motion.
//#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping
#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
Expand Down
6 changes: 3 additions & 3 deletions Marlin/ubl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
* to unsigned long will allow us to go to 32x32 if higher resolution Mesh's are needed
* in the future.
*/
void bit_clear(uint16_t bits[16], uint8_t x, uint8_t y) { CBI(bits[y], x); }
void bit_set(uint16_t bits[16], uint8_t x, uint8_t y) { SBI(bits[y], x); }
bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y) { return TEST(bits[y], x); }
void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y) { CBI(bits[y], x); }
void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { SBI(bits[y], x); }
bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y) { return TEST(bits[y], x); }

uint8_t ubl_cnt = 0;

Expand Down
30 changes: 26 additions & 4 deletions Marlin/ubl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@

// ubl.cpp

void bit_clear(uint16_t bits[16], uint8_t x, uint8_t y);
void bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
void bit_clear(uint16_t bits[16], const uint8_t x, const uint8_t y);
void bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y);
bool is_bit_set(uint16_t bits[16], const uint8_t x, const uint8_t y);

// ubl_motion.cpp

Expand Down Expand Up @@ -147,7 +147,8 @@
static void save_ubl_active_state_and_disable();
static void restore_ubl_active_state_and_leave();
static void display_map(const int);
static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, uint16_t[16], bool);
static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const float&, const float&, const bool, uint16_t[16]);
static mesh_index_pair find_furthest_invalid_mesh_point();
static void reset();
static void invalidate();
static void set_all_mesh_points_to_value(const float);
Expand Down Expand Up @@ -246,12 +247,16 @@
*/
inline static float z_correction_for_x_on_horizontal_mesh_line(const float &rx0, const int x1_i, const int yi) {
if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 2) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
serialprintPGM( !WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) ? PSTR("x1l_i") : PSTR("yi") );
SERIAL_ECHOPAIR(" out of bounds in z_correction_for_x_on_horizontal_mesh_line(rx0=", rx0);
SERIAL_ECHOPAIR(",x1_i=", x1_i);
SERIAL_ECHOPAIR(",yi=", yi);
SERIAL_CHAR(')');
SERIAL_EOL();
}
#endif
return NAN;
}

Expand All @@ -266,12 +271,16 @@
//
inline static float z_correction_for_y_on_vertical_mesh_line(const float &ry0, const int xi, const int y1_i) {
if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 2)) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
serialprintPGM( !WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) ? PSTR("xi") : PSTR("yl_i") );
SERIAL_ECHOPAIR(" out of bounds in z_correction_for_y_on_vertical_mesh_line(ry0=", ry0);
SERIAL_ECHOPAIR(", xi=", xi);
SERIAL_ECHOPAIR(", y1_i=", y1_i);
SERIAL_CHAR(')');
SERIAL_EOL();
}
#endif
return NAN;
}

Expand Down Expand Up @@ -365,6 +374,19 @@
static bool prepare_segmented_line_to(const float rtarget[XYZE], const float &feedrate);
static void line_to_destination_cartesian(const float &fr, uint8_t e);

#define _CMPZ(a,b) (z_values[a][b] == z_values[a][b+1])
#define CMPZ(a) (_CMPZ(a, 0) && _CMPZ(a, 1))
#define ZZER(a) (z_values[a][0] == 0)

FORCE_INLINE bool mesh_is_valid() {
return !(
( CMPZ(0) && CMPZ(1) && CMPZ(2) // adjacent z values all equal?
&& ZZER(0) && ZZER(1) && ZZER(2) // all zero at the edge?
)
|| isnan(z_values[0][0])
);
}

}; // class unified_bed_leveling

extern unified_bed_leveling ubl;
Expand Down
Loading