Merge pull request #8695 from thinkyhead/bf2_fixes_DEC6
[2.0.x] Cleanup, bugfixes, parity with 1.1.x
This commit is contained in:
commit
d163c4b530
|
@ -64,7 +64,7 @@
|
||||||
constexpr float unified_bed_leveling::_mesh_index_to_xpos[16],
|
constexpr float unified_bed_leveling::_mesh_index_to_xpos[16],
|
||||||
unified_bed_leveling::_mesh_index_to_ypos[16];
|
unified_bed_leveling::_mesh_index_to_ypos[16];
|
||||||
|
|
||||||
#if ENABLED(ULTRA_LCD)
|
#if ENABLED(ULTIPANEL)
|
||||||
bool unified_bed_leveling::lcd_map_control = false;
|
bool unified_bed_leveling::lcd_map_control = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -76,19 +76,23 @@ class unified_bed_leveling {
|
||||||
static int g29_grid_size;
|
static int g29_grid_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static float measure_point_with_encoder();
|
#if ENABLED(NEWPANEL)
|
||||||
static float measure_business_card_thickness(float);
|
static void move_z_with_encoder(const float &multiplier);
|
||||||
|
static float measure_point_with_encoder();
|
||||||
|
static float measure_business_card_thickness(const float&);
|
||||||
|
static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
|
||||||
|
static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool g29_parameter_parsing();
|
static bool g29_parameter_parsing();
|
||||||
static void find_mean_mesh_height();
|
static void find_mean_mesh_height();
|
||||||
static void shift_mesh_height();
|
static void shift_mesh_height();
|
||||||
static void probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
|
static void probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
|
||||||
static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
|
|
||||||
static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
|
static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
|
||||||
static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
|
static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
|
||||||
static void g29_what_command();
|
static void g29_what_command();
|
||||||
static void g29_eeprom_dump();
|
static void g29_eeprom_dump();
|
||||||
static void g29_compare_current_mesh_to_stored_mesh();
|
static void g29_compare_current_mesh_to_stored_mesh();
|
||||||
static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
|
|
||||||
static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
|
static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
|
||||||
static void smart_fill_mesh();
|
static void smart_fill_mesh();
|
||||||
|
|
||||||
|
@ -137,7 +141,7 @@ class unified_bed_leveling {
|
||||||
MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST)
|
MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST)
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLED(ULTRA_LCD)
|
#if ENABLED(ULTIPANEL)
|
||||||
static bool lcd_map_control;
|
static bool lcd_map_control;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
|
//#define UBL_DEVEL_DEBUGGING
|
||||||
|
|
||||||
#include "ubl.h"
|
#include "ubl.h"
|
||||||
|
|
||||||
#include "../../../Marlin.h"
|
#include "../../../Marlin.h"
|
||||||
|
@ -308,8 +310,7 @@
|
||||||
void unified_bed_leveling::G29() {
|
void unified_bed_leveling::G29() {
|
||||||
|
|
||||||
if (!settings.calc_num_meshes()) {
|
if (!settings.calc_num_meshes()) {
|
||||||
SERIAL_PROTOCOLLNPGM("?You need to enable your EEPROM and initialize it");
|
SERIAL_PROTOCOLLNPGM("?Enable EEPROM and init with M502, M500.\n");
|
||||||
SERIAL_PROTOCOLLNPGM("with M502, M500, M501 in that order.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +459,7 @@
|
||||||
parser.seen('T'), parser.seen('E'), parser.seen('U'));
|
parser.seen('T'), parser.seen('E'), parser.seen('U'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
#endif // HAS_BED_PROBE
|
||||||
|
|
||||||
case 2: {
|
case 2: {
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
|
@ -728,8 +729,31 @@
|
||||||
z_values[x][y] += g29_constant;
|
z_values[x][y] += g29_constant;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_BED_PROBE
|
#if ENABLED(NEWPANEL)
|
||||||
|
|
||||||
|
typedef void (*clickFunc_t)();
|
||||||
|
|
||||||
|
bool click_and_hold(const clickFunc_t func=NULL) {
|
||||||
|
if (is_lcd_clicked()) {
|
||||||
|
lcd_quick_feedback();
|
||||||
|
const millis_t nxt = millis() + 1500UL;
|
||||||
|
while (is_lcd_clicked()) { // Loop while the encoder is pressed. Uses hardware flag!
|
||||||
|
idle(); // idle, of course
|
||||||
|
if (ELAPSED(millis(), nxt)) { // After 1.5 seconds
|
||||||
|
lcd_quick_feedback();
|
||||||
|
if (func) (*func)();
|
||||||
|
wait_for_release();
|
||||||
|
safe_delay(50); // Debounce the Encoder wheel
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NEWPANEL
|
||||||
|
|
||||||
|
#if HAS_BED_PROBE
|
||||||
/**
|
/**
|
||||||
* Probe all invalidated locations of the mesh that can be reached by the probe.
|
* Probe all invalidated locations of the mesh that can be reached by the probe.
|
||||||
* This attempts to fill in locations closest to the nozzle's start location first.
|
* This attempts to fill in locations closest to the nozzle's start location first.
|
||||||
|
@ -754,10 +778,9 @@
|
||||||
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n");
|
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n");
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
STOW_PROBE();
|
STOW_PROBE();
|
||||||
while (is_lcd_clicked()) idle();
|
wait_for_release();
|
||||||
lcd_external_control = false;
|
lcd_external_control = false;
|
||||||
restore_ubl_active_state_and_leave();
|
restore_ubl_active_state_and_leave();
|
||||||
safe_delay(50); // Debounce the Encoder wheel
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -894,26 +917,27 @@
|
||||||
|
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
|
|
||||||
float unified_bed_leveling::measure_point_with_encoder() {
|
void unified_bed_leveling::move_z_with_encoder(const float &multiplier) {
|
||||||
|
wait_for_release();
|
||||||
while (is_lcd_clicked()) delay(50); // wait for user to release encoder wheel
|
while (!is_lcd_clicked()) {
|
||||||
delay(50); // debounce
|
|
||||||
|
|
||||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
||||||
while (!is_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here!
|
|
||||||
idle();
|
idle();
|
||||||
if (encoder_diff) {
|
if (encoder_diff) {
|
||||||
do_blocking_move_to_z(current_position[Z_AXIS] + 0.01 * float(encoder_diff));
|
do_blocking_move_to_z(current_position[Z_AXIS] + float(encoder_diff) * multiplier);
|
||||||
encoder_diff = 0;
|
encoder_diff = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float unified_bed_leveling::measure_point_with_encoder() {
|
||||||
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
|
move_z_with_encoder(0.01);
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
return current_position[Z_AXIS];
|
return current_position[Z_AXIS];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
|
static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
|
||||||
|
|
||||||
float unified_bed_leveling::measure_business_card_thickness(const float in_height) {
|
float unified_bed_leveling::measure_business_card_thickness(const float &in_height) {
|
||||||
lcd_external_control = true;
|
lcd_external_control = true;
|
||||||
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
|
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
|
||||||
|
|
||||||
|
@ -953,12 +977,19 @@
|
||||||
return thickness;
|
return thickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void abort_manual_probe_remaining_mesh() {
|
||||||
|
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
|
||||||
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
||||||
|
lcd_external_control = false;
|
||||||
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
|
ubl.restore_ubl_active_state_and_leave();
|
||||||
|
}
|
||||||
|
|
||||||
void unified_bed_leveling::manually_probe_remaining_mesh(const float &rx, const float &ry, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
|
void unified_bed_leveling::manually_probe_remaining_mesh(const float &rx, const float &ry, const float &z_clearance, const float &thick, const bool do_ubl_mesh_map) {
|
||||||
|
|
||||||
lcd_external_control = true;
|
lcd_external_control = true;
|
||||||
|
|
||||||
save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe
|
save_ubl_active_state_and_disable(); // we don't do bed level correction because we want the raw data when we probe
|
||||||
|
|
||||||
do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES);
|
do_blocking_move_to(rx, ry, Z_CLEARANCE_BETWEEN_PROBES);
|
||||||
|
|
||||||
lcd_return_to_status();
|
lcd_return_to_status();
|
||||||
|
@ -989,34 +1020,15 @@
|
||||||
const float z_step = 0.01; // existing behavior: 0.01mm per click, occasionally step
|
const float z_step = 0.01; // existing behavior: 0.01mm per click, occasionally step
|
||||||
//const float z_step = 1.0 / planner.axis_steps_per_mm[Z_AXIS]; // approx one step each click
|
//const float z_step = 1.0 / planner.axis_steps_per_mm[Z_AXIS]; // approx one step each click
|
||||||
|
|
||||||
while (is_lcd_clicked()) delay(50); // wait for user to release encoder wheel
|
move_z_with_encoder(z_step);
|
||||||
delay(50); // debounce
|
|
||||||
while (!is_lcd_clicked()) { // we need the loop to move the nozzle based on the encoder wheel here!
|
|
||||||
idle();
|
|
||||||
if (encoder_diff) {
|
|
||||||
do_blocking_move_to_z(current_position[Z_AXIS] + float(encoder_diff) * z_step);
|
|
||||||
encoder_diff = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this sequence to detect an is_lcd_clicked() debounce it and leave if it is
|
if (click_and_hold()) {
|
||||||
// a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This
|
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
|
||||||
// should be redone and compressed.
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
||||||
const millis_t nxt = millis() + 1500L;
|
lcd_external_control = false;
|
||||||
while (is_lcd_clicked()) { // debounce and watch for abort
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
idle();
|
restore_ubl_active_state_and_leave();
|
||||||
if (ELAPSED(millis(), nxt)) {
|
return;
|
||||||
SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
|
|
||||||
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
||||||
|
|
||||||
lcd_quick_feedback();
|
|
||||||
while (is_lcd_clicked()) idle();
|
|
||||||
lcd_external_control = false;
|
|
||||||
|
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
|
||||||
restore_ubl_active_state_and_leave();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick;
|
z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick;
|
||||||
|
@ -1033,7 +1045,6 @@
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
do_blocking_move_to(rx, ry, Z_CLEARANCE_DEPLOY_PROBE);
|
do_blocking_move_to(rx, ry, Z_CLEARANCE_DEPLOY_PROBE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NEWPANEL
|
#endif // NEWPANEL
|
||||||
|
|
||||||
bool unified_bed_leveling::g29_parameter_parsing() {
|
bool unified_bed_leveling::g29_parameter_parsing() {
|
||||||
|
@ -1078,11 +1089,11 @@
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
g29_phase_value = pv;
|
g29_phase_value = pv;
|
||||||
if (!WITHIN(g29_phase_value, 0, 6)) {
|
if (!WITHIN(g29_phase_value, 0, 6)) {
|
||||||
SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
|
SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
|
||||||
err_flag = true;
|
err_flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('J')) {
|
if (parser.seen('J')) {
|
||||||
|
@ -1151,36 +1162,39 @@
|
||||||
return UBL_OK;
|
return UBL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ubl_state_at_invocation = 0,
|
static uint8_t ubl_state_at_invocation = 0;
|
||||||
ubl_state_recursion_chk = 0;
|
|
||||||
|
#ifdef UBL_DEVEL_DEBUGGING
|
||||||
|
static uint8_t ubl_state_recursion_chk = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void unified_bed_leveling::save_ubl_active_state_and_disable() {
|
void unified_bed_leveling::save_ubl_active_state_and_disable() {
|
||||||
ubl_state_recursion_chk++;
|
#ifdef UBL_DEVEL_DEBUGGING
|
||||||
if (ubl_state_recursion_chk != 1) {
|
ubl_state_recursion_chk++;
|
||||||
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
|
if (ubl_state_recursion_chk != 1) {
|
||||||
|
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
LCD_MESSAGEPGM(MSG_UBL_SAVE_ERROR);
|
LCD_MESSAGEPGM(MSG_UBL_SAVE_ERROR);
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
return;
|
}
|
||||||
}
|
#endif
|
||||||
ubl_state_at_invocation = planner.leveling_active;
|
ubl_state_at_invocation = planner.leveling_active;
|
||||||
set_bed_leveling_enabled(false);
|
set_bed_leveling_enabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unified_bed_leveling::restore_ubl_active_state_and_leave() {
|
void unified_bed_leveling::restore_ubl_active_state_and_leave() {
|
||||||
if (--ubl_state_recursion_chk) {
|
#ifdef UBL_DEVEL_DEBUGGING
|
||||||
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
if (--ubl_state_recursion_chk) {
|
||||||
|
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
LCD_MESSAGEPGM(MSG_UBL_RESTORE_ERROR);
|
LCD_MESSAGEPGM(MSG_UBL_RESTORE_ERROR);
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
return;
|
}
|
||||||
}
|
#endif
|
||||||
set_bed_leveling_enabled(ubl_state_at_invocation);
|
set_bed_leveling_enabled(ubl_state_at_invocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,28 +1264,30 @@
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
safe_delay(50);
|
safe_delay(50);
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation);
|
#ifdef UBL_DEVEL_DEBUGGING
|
||||||
SERIAL_EOL();
|
SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation);
|
||||||
SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk);
|
SERIAL_EOL();
|
||||||
SERIAL_EOL();
|
SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk);
|
||||||
safe_delay(50);
|
SERIAL_EOL();
|
||||||
|
safe_delay(50);
|
||||||
|
|
||||||
SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.get_start_of_meshes()));
|
SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.get_start_of_meshes()));
|
||||||
SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.get_end_of_meshes()));
|
SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.get_end_of_meshes()));
|
||||||
safe_delay(50);
|
safe_delay(50);
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl));
|
SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl));
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values));
|
SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values));
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
safe_delay(25);
|
safe_delay(25);
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.get_end_of_meshes() - settings.get_start_of_meshes())));
|
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.get_end_of_meshes() - settings.get_start_of_meshes())));
|
||||||
safe_delay(50);
|
safe_delay(50);
|
||||||
|
|
||||||
SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());
|
SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());
|
||||||
SERIAL_PROTOCOLLNPGM(" meshes.\n");
|
SERIAL_PROTOCOLLNPGM(" meshes.\n");
|
||||||
safe_delay(25);
|
safe_delay(25);
|
||||||
|
#endif // UBL_DEVEL_DEBUGGING
|
||||||
|
|
||||||
if (!sanity_check()) {
|
if (!sanity_check()) {
|
||||||
echo_name();
|
echo_name();
|
||||||
|
@ -1341,11 +1357,10 @@
|
||||||
z_values[x][y] -= tmp_z_values[x][y];
|
z_values[x][y] -= tmp_z_values[x][y];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||||
|
|
||||||
bool found_a_NAN = false;
|
bool found_a_NAN = false, found_a_real = false;
|
||||||
bool found_a_real = false;
|
|
||||||
mesh_index_pair out_mesh;
|
mesh_index_pair out_mesh;
|
||||||
out_mesh.x_index = out_mesh.y_index = -1;
|
out_mesh.x_index = out_mesh.y_index = -1;
|
||||||
out_mesh.distance = -99999.99;
|
out_mesh.distance = -99999.99;
|
||||||
|
@ -1353,12 +1368,12 @@
|
||||||
for (int8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
|
for (int8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
|
||||||
for (int8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
for (int8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
|
||||||
|
|
||||||
if ( isnan(z_values[i][j])) { // Check to see if this location holds an invalid mesh point
|
if (isnan(z_values[i][j])) { // Check to see if this location holds an invalid mesh point
|
||||||
|
|
||||||
const float mx = mesh_index_to_xpos(i),
|
const float mx = mesh_index_to_xpos(i),
|
||||||
my = mesh_index_to_ypos(j);
|
my = mesh_index_to_ypos(j);
|
||||||
|
|
||||||
if ( !position_is_reachable_by_probe(mx, my)) // make sure the probe can get to the mesh point
|
if (!position_is_reachable_by_probe(mx, my)) // make sure the probe can get to the mesh point
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
found_a_NAN = true;
|
found_a_NAN = true;
|
||||||
|
@ -1452,11 +1467,18 @@
|
||||||
}
|
}
|
||||||
} // for j
|
} // for j
|
||||||
} // for i
|
} // for i
|
||||||
|
|
||||||
return out_mesh;
|
return out_mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
|
|
||||||
|
void abort_fine_tune() {
|
||||||
|
lcd_return_to_status();
|
||||||
|
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
||||||
|
LCD_MESSAGEPGM(MSG_EDITING_STOPPED);
|
||||||
|
}
|
||||||
|
|
||||||
void unified_bed_leveling::fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map) {
|
void unified_bed_leveling::fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map) {
|
||||||
if (!parser.seen('R')) // fine_tune_mesh() is special. If no repetition count flag is specified
|
if (!parser.seen('R')) // fine_tune_mesh() is special. If no repetition count flag is specified
|
||||||
g29_repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided.
|
g29_repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided.
|
||||||
|
@ -1499,15 +1521,8 @@
|
||||||
if (!position_is_reachable(rawx, rawy)) // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
|
if (!position_is_reachable(rawx, rawy)) // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
|
||||||
break;
|
break;
|
||||||
|
|
||||||
float new_z = z_values[location.x_index][location.y_index];
|
|
||||||
|
|
||||||
if (isnan(new_z)) // if the mesh point is invalid, set it to 0.0 so it can be edited
|
|
||||||
new_z = 0.0;
|
|
||||||
|
|
||||||
do_blocking_move_to(rawx, rawy, Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to the edit point
|
do_blocking_move_to(rawx, rawy, Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to the edit point
|
||||||
|
|
||||||
new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
|
|
||||||
|
|
||||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
lcd_external_control = true;
|
lcd_external_control = true;
|
||||||
|
|
||||||
|
@ -1515,15 +1530,19 @@
|
||||||
|
|
||||||
lcd_refresh();
|
lcd_refresh();
|
||||||
|
|
||||||
|
float new_z = z_values[location.x_index][location.y_index];
|
||||||
|
if (isnan(new_z)) new_z = 0.0; // Set invalid mesh points to 0.0 so they can be edited
|
||||||
|
new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
|
||||||
|
|
||||||
lcd_mesh_edit_setup(new_z);
|
lcd_mesh_edit_setup(new_z);
|
||||||
|
|
||||||
do {
|
while (!is_lcd_clicked()) {
|
||||||
new_z = lcd_mesh_edit();
|
new_z = lcd_mesh_edit();
|
||||||
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
|
#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
|
||||||
do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
|
do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
|
||||||
#endif
|
#endif
|
||||||
idle();
|
idle();
|
||||||
} while (!is_lcd_clicked());
|
}
|
||||||
|
|
||||||
if (!lcd_map_control) lcd_return_to_status();
|
if (!lcd_map_control) lcd_return_to_status();
|
||||||
|
|
||||||
|
@ -1535,19 +1554,8 @@
|
||||||
// this sequence to detect an is_lcd_clicked() debounce it and leave if it is
|
// this sequence to detect an is_lcd_clicked() debounce it and leave if it is
|
||||||
// a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This
|
// a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp). This
|
||||||
// should be redone and compressed.
|
// should be redone and compressed.
|
||||||
const millis_t nxt = millis() + 1500UL;
|
if (click_and_hold(abort_fine_tune))
|
||||||
while (is_lcd_clicked()) { // debounce and watch for abort
|
goto FINE_TUNE_EXIT;
|
||||||
idle();
|
|
||||||
if (ELAPSED(millis(), nxt)) {
|
|
||||||
lcd_return_to_status();
|
|
||||||
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
||||||
LCD_MESSAGEPGM(MSG_EDITING_STOPPED);
|
|
||||||
|
|
||||||
while (is_lcd_clicked()) idle();
|
|
||||||
|
|
||||||
goto FINE_TUNE_EXIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delay(20); // We don't want any switch noise.
|
safe_delay(20); // We don't want any switch noise.
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@
|
||||||
#error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES."
|
#error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define G26_OK false
|
||||||
|
#define G26_ERR true
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G26 Mesh Validation Tool
|
* G26 Mesh Validation Tool
|
||||||
*
|
*
|
||||||
|
@ -156,31 +159,21 @@ int8_t g26_prime_flag;
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect is_lcd_clicked, debounce it, and return true for cancel
|
* If the LCD is clicked, cancel, wait for release, return true
|
||||||
*/
|
*/
|
||||||
bool user_canceled() {
|
bool user_canceled() {
|
||||||
if (!is_lcd_clicked()) return false;
|
if (!is_lcd_clicked()) return false; // Return if the button isn't pressed
|
||||||
safe_delay(10); // Wait for click to settle
|
lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
|
||||||
|
#if ENABLED(ULTIPANEL)
|
||||||
#if ENABLED(ULTRA_LCD)
|
|
||||||
lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
|
|
||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
#endif
|
#endif
|
||||||
|
wait_for_release();
|
||||||
while (!is_lcd_clicked()) idle(); // Wait for button release
|
|
||||||
|
|
||||||
// If the button is suddenly pressed again,
|
|
||||||
// ask the user to resolve the issue
|
|
||||||
lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
|
|
||||||
while (is_lcd_clicked()) idle(); // unless this loop happens
|
|
||||||
lcd_reset_status();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exit_from_g26() {
|
bool exit_from_g26() {
|
||||||
lcd_setstatusPGM(PSTR("Leaving G26"), -1);
|
lcd_setstatusPGM(PSTR("Leaving G26"), -1);
|
||||||
while (is_lcd_clicked()) idle();
|
wait_for_release();
|
||||||
return G26_ERR;
|
return G26_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,9 +261,7 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de
|
||||||
set_destination_from_current();
|
set_destination_from_current();
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE void move_to(const float where[XYZE], const float &de) {
|
FORCE_INLINE void move_to(const float where[XYZE], const float &de) { move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de); }
|
||||||
move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de);
|
|
||||||
}
|
|
||||||
|
|
||||||
void retract_filament(const float where[XYZE]) {
|
void retract_filament(const float where[XYZE]) {
|
||||||
if (!g26_retracted) { // Only retract if we are not already retracted!
|
if (!g26_retracted) { // Only retract if we are not already retracted!
|
||||||
|
@ -314,9 +305,8 @@ void print_line_from_here_to_there(const float &sx, const float &sy, const float
|
||||||
|
|
||||||
// If the end point of the line is closer to the nozzle, flip the direction,
|
// If the end point of the line is closer to the nozzle, flip the direction,
|
||||||
// moving from the end to the start. On very small lines the optimization isn't worth it.
|
// moving from the end to the start. On very small lines the optimization isn't worth it.
|
||||||
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) {
|
if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length))
|
||||||
return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
|
||||||
}
|
|
||||||
|
|
||||||
// Decide whether to retract & bump
|
// Decide whether to retract & bump
|
||||||
|
|
||||||
|
@ -373,7 +363,6 @@ inline bool look_for_lines_to_connect() {
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
//debug_current_and_destination(PSTR("Connecting horizontal line."));
|
//debug_current_and_destination(PSTR("Connecting horizontal line."));
|
||||||
}
|
}
|
||||||
|
|
||||||
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
|
print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
|
||||||
}
|
}
|
||||||
bitmap_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it
|
bitmap_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it
|
||||||
|
@ -405,8 +394,8 @@ inline bool look_for_lines_to_connect() {
|
||||||
SERIAL_ECHOPAIR(", ey=", ey);
|
SERIAL_ECHOPAIR(", ey=", ey);
|
||||||
SERIAL_CHAR(')');
|
SERIAL_CHAR(')');
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
void debug_current_and_destination(const char *title);
|
|
||||||
debug_current_and_destination(PSTR("Connecting vertical line."));
|
debug_current_and_destination(PSTR("Connecting vertical line."));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -515,7 +504,7 @@ inline bool prime_nozzle() {
|
||||||
idle();
|
idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (is_lcd_clicked()) idle(); // Debounce Encoder Wheel
|
wait_for_release();
|
||||||
|
|
||||||
strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
|
strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
|
||||||
// So... We cheat to get a message up.
|
// So... We cheat to get a message up.
|
||||||
|
@ -678,9 +667,8 @@ void GcodeSuite::G26() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS],
|
g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
|
||||||
g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
|
g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
|
||||||
|
|
||||||
if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
|
if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
|
||||||
SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
|
SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
|
||||||
return;
|
return;
|
||||||
|
@ -727,6 +715,7 @@ void GcodeSuite::G26() {
|
||||||
#if ENABLED(ULTRA_LCD)
|
#if ENABLED(ULTRA_LCD)
|
||||||
lcd_external_control = true;
|
lcd_external_control = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
|
//debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -806,7 +795,7 @@ void GcodeSuite::G26() {
|
||||||
#if IS_KINEMATIC
|
#if IS_KINEMATIC
|
||||||
// Check to make sure this segment is entirely on the bed, skip if not.
|
// Check to make sure this segment is entirely on the bed, skip if not.
|
||||||
if (!position_is_reachable(rx, ry) || !position_is_reachable(xe, ye)) continue;
|
if (!position_is_reachable(rx, ry) || !position_is_reachable(xe, ye)) continue;
|
||||||
#else // not, we need to skip
|
#else // not, we need to skip
|
||||||
rx = constrain(rx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
rx = constrain(rx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
|
||||||
ry = constrain(ry, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
ry = constrain(ry, Y_MIN_POS + 1, Y_MAX_POS - 1);
|
||||||
xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
|
xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
|
||||||
|
@ -842,15 +831,15 @@ void GcodeSuite::G26() {
|
||||||
move_to(destination, 0); // Raise the nozzle
|
move_to(destination, 0); // Raise the nozzle
|
||||||
//debug_current_and_destination(PSTR("done doing Z-Raise."));
|
//debug_current_and_destination(PSTR("done doing Z-Raise."));
|
||||||
|
|
||||||
destination[X_AXIS] = g26_x_pos; // Move back to the starting position
|
destination[X_AXIS] = g26_x_pos; // Move back to the starting position
|
||||||
destination[Y_AXIS] = g26_y_pos;
|
destination[Y_AXIS] = g26_y_pos;
|
||||||
//destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
//destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is
|
||||||
|
|
||||||
move_to(destination, 0); // Move back to the starting position
|
move_to(destination, 0); // Move back to the starting position
|
||||||
//debug_current_and_destination(PSTR("done doing X/Y move."));
|
//debug_current_and_destination(PSTR("done doing X/Y move."));
|
||||||
|
|
||||||
#if ENABLED(ULTRA_LCD)
|
#if ENABLED(ULTRA_LCD)
|
||||||
lcd_external_control = false; // Give back control of the LCD Panel!
|
lcd_external_control = false; // Give back control of the LCD Panel!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!g26_keep_heaters_on) {
|
if (!g26_keep_heaters_on) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ void GcodeSuite::M502() {
|
||||||
* M503: print settings currently in memory
|
* M503: print settings currently in memory
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M503() {
|
void GcodeSuite::M503() {
|
||||||
(void)settings.report(parser.boolval('S'));
|
(void)settings.report(parser.seen('S') && !parser.value_bool());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !DISABLE_M503
|
#endif // !DISABLE_M503
|
||||||
|
|
|
@ -313,11 +313,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
|
||||||
#if ENABLED(LCD_PROGRESS_BAR)
|
#if ENABLED(LCD_PROGRESS_BAR)
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#error "LCD_PROGRESS_BAR requires SDSUPPORT."
|
#error "LCD_PROGRESS_BAR requires SDSUPPORT."
|
||||||
|
#elif DISABLED(ULTRA_LCD)
|
||||||
|
#error "LCD_PROGRESS_BAR requires a character LCD."
|
||||||
#elif ENABLED(DOGLCD)
|
#elif ENABLED(DOGLCD)
|
||||||
#error "LCD_PROGRESS_BAR does not apply to graphical displays."
|
#error "LCD_PROGRESS_BAR does not apply to graphical displays."
|
||||||
#elif ENABLED(FILAMENT_LCD_DISPLAY)
|
#elif ENABLED(FILAMENT_LCD_DISPLAY)
|
||||||
#error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
|
#error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
|
||||||
#endif
|
#endif
|
||||||
|
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && DISABLED(DOGLCD)
|
||||||
|
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,12 +85,13 @@ int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_spe
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t lcd_status_update_delay = 1, // First update one loop delayed
|
uint8_t lcd_status_update_delay = 1, // First update one loop delayed
|
||||||
lcd_status_message_level; // Higher level overrides lower
|
lcd_status_message_level; // Higher level blocks lower level
|
||||||
char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
|
char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
|
||||||
|
|
||||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||||
uint8_t status_scroll_pos = 0;
|
uint8_t status_scroll_pos = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SCROLL_LONG_FILENAMES)
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
||||||
uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
|
uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,8 +164,6 @@ uint16_t max_display_update_time = 0;
|
||||||
extern bool powersupply_on;
|
extern bool powersupply_on;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float move_menu_scale;
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
///////////////// Menu Tree ////////////////
|
///////////////// Menu Tree ////////////////
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
|
@ -244,7 +243,6 @@ uint16_t max_display_update_time = 0;
|
||||||
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live=false); \
|
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live=false); \
|
||||||
typedef void _name##_void
|
typedef void _name##_void
|
||||||
|
|
||||||
DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
|
|
||||||
DECLARE_MENU_EDIT_TYPE(int16_t, int3);
|
DECLARE_MENU_EDIT_TYPE(int16_t, int3);
|
||||||
DECLARE_MENU_EDIT_TYPE(uint8_t, int8);
|
DECLARE_MENU_EDIT_TYPE(uint8_t, int8);
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float3);
|
DECLARE_MENU_EDIT_TYPE(float, float3);
|
||||||
|
@ -254,6 +252,7 @@ uint16_t max_display_update_time = 0;
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float51);
|
DECLARE_MENU_EDIT_TYPE(float, float51);
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float52);
|
DECLARE_MENU_EDIT_TYPE(float, float52);
|
||||||
DECLARE_MENU_EDIT_TYPE(float, float62);
|
DECLARE_MENU_EDIT_TYPE(float, float62);
|
||||||
|
DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
|
||||||
|
|
||||||
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
||||||
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
|
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
|
||||||
|
@ -566,10 +565,9 @@ uint16_t max_display_update_time = 0;
|
||||||
static bool no_reentry = false;
|
static bool no_reentry = false;
|
||||||
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
|
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
|
||||||
if (no_reentry) return;
|
if (no_reentry) return;
|
||||||
|
|
||||||
// Make this the current handler till all moves are done
|
// Make this the current handler till all moves are done
|
||||||
no_reentry = true;
|
no_reentry = true;
|
||||||
screenFunc_t old_screen = currentScreen;
|
const screenFunc_t old_screen = currentScreen;
|
||||||
lcd_goto_screen(_lcd_synchronize);
|
lcd_goto_screen(_lcd_synchronize);
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
no_reentry = false;
|
no_reentry = false;
|
||||||
|
@ -997,7 +995,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
if (card.cardOK) {
|
if (card.cardOK) {
|
||||||
if (card.isFileOpen()) {
|
if (card.isFileOpen()) {
|
||||||
if (IS_SD_PRINTING)
|
if (card.sdprinting)
|
||||||
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
|
MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
|
||||||
else
|
else
|
||||||
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
|
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
|
||||||
|
@ -1074,7 +1072,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp);
|
if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp);
|
||||||
|
|
||||||
// Draw cw/ccw indicator and up/down arrows.
|
// Draw cw/ccw indicator and up/down arrows.
|
||||||
if (PAGE_CONTAINS(47,62)) {
|
if (PAGE_CONTAINS(47, 62)) {
|
||||||
u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down);
|
u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down);
|
||||||
u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up);
|
u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up);
|
||||||
u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp);
|
u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp);
|
||||||
|
@ -1115,6 +1113,8 @@ void kill_screen(const char* lcd_msg) {
|
||||||
ENCODER_DIRECTION_NORMAL();
|
ENCODER_DIRECTION_NORMAL();
|
||||||
if (encoderPosition) {
|
if (encoderPosition) {
|
||||||
const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
||||||
|
encoderPosition = 0;
|
||||||
|
|
||||||
const float new_zoffset = zprobe_zoffset + planner.steps_to_mm[Z_AXIS] * babystep_increment;
|
const float new_zoffset = zprobe_zoffset + planner.steps_to_mm[Z_AXIS] * babystep_increment;
|
||||||
if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
||||||
|
|
||||||
|
@ -1124,7 +1124,6 @@ void kill_screen(const char* lcd_msg) {
|
||||||
zprobe_zoffset = new_zoffset;
|
zprobe_zoffset = new_zoffset;
|
||||||
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
}
|
}
|
||||||
encoderPosition = 0;
|
|
||||||
}
|
}
|
||||||
if (lcdDrawUpdate) {
|
if (lcdDrawUpdate) {
|
||||||
lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
|
lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
|
||||||
|
@ -1164,11 +1163,12 @@ void kill_screen(const char* lcd_msg) {
|
||||||
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
|
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lcdDrawUpdate)
|
if (lcdDrawUpdate) {
|
||||||
lcd_implementation_drawedit(msg, ftostr43sign(mesh_edit_value));
|
lcd_implementation_drawedit(msg, ftostr43sign(mesh_edit_value));
|
||||||
#if ENABLED(MESH_EDIT_GFX_OVERLAY)
|
#if ENABLED(MESH_EDIT_GFX_OVERLAY)
|
||||||
_lcd_zoffset_overlay_gfx(mesh_edit_value);
|
_lcd_zoffset_overlay_gfx(mesh_edit_value);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _lcd_mesh_edit_NOP() {
|
void _lcd_mesh_edit_NOP() {
|
||||||
|
@ -1182,7 +1182,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
return mesh_edit_value;
|
return mesh_edit_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_mesh_edit_setup(float initial) {
|
void lcd_mesh_edit_setup(const float initial) {
|
||||||
mesh_edit_value = mesh_edit_accumulator = initial;
|
mesh_edit_value = mesh_edit_accumulator = initial;
|
||||||
lcd_goto_screen(_lcd_mesh_edit_NOP);
|
lcd_goto_screen(_lcd_mesh_edit_NOP);
|
||||||
}
|
}
|
||||||
|
@ -1203,6 +1203,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
|
|
||||||
#endif // AUTO_BED_LEVELING_UBL
|
#endif // AUTO_BED_LEVELING_UBL
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watch temperature callbacks
|
* Watch temperature callbacks
|
||||||
*/
|
*/
|
||||||
|
@ -2030,8 +2031,8 @@ void kill_screen(const char* lcd_msg) {
|
||||||
*/
|
*/
|
||||||
void _lcd_ubl_adjust_height_cmd() {
|
void _lcd_ubl_adjust_height_cmd() {
|
||||||
char UBL_LCD_GCODE[16];
|
char UBL_LCD_GCODE[16];
|
||||||
const int ind = ubl_height_amount < 0 ? 6 : 7;
|
const int ind = ubl_height_amount > 0 ? 9 : 10;
|
||||||
strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6-"));
|
strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
|
||||||
sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
|
sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
|
||||||
enqueue_and_echo_command(UBL_LCD_GCODE);
|
enqueue_and_echo_command(UBL_LCD_GCODE);
|
||||||
}
|
}
|
||||||
|
@ -2047,8 +2048,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
void _lcd_ubl_height_adjust_menu() {
|
void _lcd_ubl_height_adjust_menu() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
MENU_BACK(MSG_UBL_EDIT_MESH_MENU);
|
MENU_BACK(MSG_UBL_EDIT_MESH_MENU);
|
||||||
MENU_ITEM_EDIT(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9);
|
MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9, _lcd_ubl_adjust_height_cmd);
|
||||||
MENU_ITEM(function, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_adjust_height_cmd);
|
|
||||||
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
@ -2184,8 +2184,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
void _lcd_ubl_fillin_menu() {
|
void _lcd_ubl_fillin_menu() {
|
||||||
START_MENU();
|
START_MENU();
|
||||||
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
|
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
|
||||||
MENU_ITEM_EDIT(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9);
|
MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd);
|
||||||
MENU_ITEM(function, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_amount_cmd);
|
|
||||||
MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
|
MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
|
||||||
MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
|
MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
|
||||||
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
|
||||||
|
@ -2644,6 +2643,8 @@ void kill_screen(const char* lcd_msg) {
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float move_menu_scale;
|
||||||
|
|
||||||
#if ENABLED(DELTA_CALIBRATION_MENU) || (ENABLED(DELTA_AUTO_CALIBRATION) && !HAS_BED_PROBE)
|
#if ENABLED(DELTA_CALIBRATION_MENU) || (ENABLED(DELTA_AUTO_CALIBRATION) && !HAS_BED_PROBE)
|
||||||
|
|
||||||
void lcd_move_z();
|
void lcd_move_z();
|
||||||
|
@ -2653,13 +2654,11 @@ void kill_screen(const char* lcd_msg) {
|
||||||
reset_bed_level(); // After calibration bed-level data is no longer valid
|
reset_bed_level(); // After calibration bed-level data is no longer valid
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float z_dest = (Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5;
|
line_to_z((Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
|
||||||
line_to_z(z_dest);
|
|
||||||
current_position[X_AXIS] = rx;
|
current_position[X_AXIS] = rx;
|
||||||
current_position[Y_AXIS] = ry;
|
current_position[Y_AXIS] = ry;
|
||||||
line_to_current_z();
|
line_to_current_z();
|
||||||
z_dest = Z_CLEARANCE_BETWEEN_PROBES;
|
line_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
||||||
line_to_z(z_dest);
|
|
||||||
|
|
||||||
lcd_synchronize();
|
lcd_synchronize();
|
||||||
move_menu_scale = PROBE_MANUALLY_STEP;
|
move_menu_scale = PROBE_MANUALLY_STEP;
|
||||||
|
@ -2813,7 +2812,6 @@ void kill_screen(const char* lcd_msg) {
|
||||||
#endif
|
#endif
|
||||||
manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
|
manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
manual_move_start_time = millis() + (move_menu_scale < 0.99 ? 0UL : 250UL); // delay for bigger moves
|
manual_move_start_time = millis() + (move_menu_scale < 0.99 ? 0UL : 250UL); // delay for bigger moves
|
||||||
manual_move_axis = (int8_t)axis;
|
manual_move_axis = (int8_t)axis;
|
||||||
}
|
}
|
||||||
|
@ -2830,6 +2828,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
if (encoderPosition && !processing_manual_move) {
|
if (encoderPosition && !processing_manual_move) {
|
||||||
gcode.refresh_cmd_timeout();
|
gcode.refresh_cmd_timeout();
|
||||||
|
|
||||||
|
// Start with no limits to movement
|
||||||
float min = current_position[axis] - 1000,
|
float min = current_position[axis] - 1000,
|
||||||
max = current_position[axis] + 1000;
|
max = current_position[axis] + 1000;
|
||||||
|
|
||||||
|
@ -2867,7 +2866,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
// This assumes the center is 0,0
|
// This assumes the center is 0,0
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
if (axis != Z_AXIS) {
|
if (axis != Z_AXIS) {
|
||||||
max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis]));
|
max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
||||||
min = -max;
|
min = -max;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3131,7 +3130,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
|
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
|
||||||
|
|
||||||
#if HAS_LCD_CONTRAST
|
#if HAS_LCD_CONTRAST
|
||||||
MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, (int16_t*)&lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
|
MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
|
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
|
||||||
|
@ -3724,7 +3723,7 @@ void kill_screen(const char* lcd_msg) {
|
||||||
|
|
||||||
lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition);
|
lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition);
|
||||||
defer_return_to_status = true;
|
defer_return_to_status = true;
|
||||||
last_sdfile_encoderPosition == 0xFFFF;
|
last_sdfile_encoderPosition = 0xFFFF;
|
||||||
|
|
||||||
#if ENABLED(DOGLCD)
|
#if ENABLED(DOGLCD)
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
@ -3749,29 +3748,27 @@ void kill_screen(const char* lcd_msg) {
|
||||||
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
|
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileCnt) {
|
for (uint16_t i = 0; i < fileCnt; i++) {
|
||||||
for (uint16_t i = 0; i < fileCnt; i++) {
|
if (_menuLineNr == _thisItemNr) {
|
||||||
if (_menuLineNr == _thisItemNr) {
|
const uint16_t nr =
|
||||||
const uint16_t nr =
|
#if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
|
||||||
#if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
|
fileCnt - 1 -
|
||||||
fileCnt - 1 -
|
|
||||||
#endif
|
|
||||||
i;
|
|
||||||
|
|
||||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
|
||||||
card.getfilename_sorted(nr);
|
|
||||||
#else
|
|
||||||
card.getfilename(nr);
|
|
||||||
#endif
|
#endif
|
||||||
|
i;
|
||||||
|
|
||||||
if (card.filenameIsDir)
|
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||||
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
|
card.getfilename_sorted(nr);
|
||||||
else
|
#else
|
||||||
MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
|
card.getfilename(nr);
|
||||||
}
|
#endif
|
||||||
else {
|
|
||||||
MENU_ITEM_DUMMY();
|
if (card.filenameIsDir)
|
||||||
}
|
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
|
||||||
|
else
|
||||||
|
MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MENU_ITEM_DUMMY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_MENU();
|
END_MENU();
|
||||||
|
@ -4476,13 +4473,14 @@ void lcd_init() {
|
||||||
lcd_implementation_init();
|
lcd_implementation_init();
|
||||||
|
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
|
|
||||||
#if BUTTON_EXISTS(EN1)
|
#if BUTTON_EXISTS(EN1)
|
||||||
SET_INPUT_PULLUP(BTN_EN1);
|
SET_INPUT_PULLUP(BTN_EN1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUTTON_EXISTS(EN2)
|
#if BUTTON_EXISTS(EN2)
|
||||||
SET_INPUT_PULLUP(BTN_EN2);
|
SET_INPUT_PULLUP(BTN_EN2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUTTON_EXISTS(ENC)
|
#if BUTTON_EXISTS(ENC)
|
||||||
SET_INPUT_PULLUP(BTN_ENC);
|
SET_INPUT_PULLUP(BTN_ENC);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4684,7 +4682,7 @@ void lcd_update() {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
|
const bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
|
||||||
if (encoderPastThreshold || lcd_clicked) {
|
if (encoderPastThreshold || lcd_clicked) {
|
||||||
if (encoderPastThreshold) {
|
if (encoderPastThreshold) {
|
||||||
int32_t encoderMultiplier = 1;
|
int32_t encoderMultiplier = 1;
|
||||||
|
@ -4979,11 +4977,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||||
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
|
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buttons = newbutton;
|
|
||||||
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
||||||
buttons |= slow_buttons;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Directional buttons
|
// Directional buttons
|
||||||
//
|
//
|
||||||
|
@ -5032,6 +5025,11 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||||
|
|
||||||
#endif // LCD_HAS_DIRECTIONAL_BUTTONS
|
#endif // LCD_HAS_DIRECTIONAL_BUTTONS
|
||||||
|
|
||||||
|
buttons = newbutton;
|
||||||
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
||||||
|
buttons |= slow_buttons;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(ADC_KEYPAD)
|
#if ENABLED(ADC_KEYPAD)
|
||||||
|
|
||||||
uint8_t newbutton_reprapworld_keypad = 0;
|
uint8_t newbutton_reprapworld_keypad = 0;
|
||||||
|
@ -5107,6 +5105,10 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
||||||
bool is_lcd_clicked() { return LCD_CLICKED; }
|
bool is_lcd_clicked() { return LCD_CLICKED; }
|
||||||
|
void wait_for_release() {
|
||||||
|
while (is_lcd_clicked()) safe_delay(50);
|
||||||
|
safe_delay(50);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // ULTIPANEL
|
#endif // ULTIPANEL
|
||||||
|
|
|
@ -222,6 +222,7 @@
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
||||||
bool is_lcd_clicked();
|
bool is_lcd_clicked();
|
||||||
|
void wait_for_release();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // no LCD
|
#else // no LCD
|
||||||
|
|
|
@ -1527,7 +1527,7 @@ void MarlinSettings::reset() {
|
||||||
*
|
*
|
||||||
* Unless specifically disabled, M503 is available even without EEPROM
|
* Unless specifically disabled, M503 is available even without EEPROM
|
||||||
*/
|
*/
|
||||||
void MarlinSettings::report(bool forReplay) {
|
void MarlinSettings::report(const bool forReplay) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Announce current units, in case inches are being displayed
|
* Announce current units, in case inches are being displayed
|
||||||
|
|
|
@ -52,10 +52,10 @@ class MarlinSettings {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DISABLED(DISABLE_M503)
|
#if DISABLED(DISABLE_M503)
|
||||||
static void report(bool forReplay=false);
|
static void report(const bool forReplay=false);
|
||||||
#else
|
#else
|
||||||
FORCE_INLINE
|
FORCE_INLINE
|
||||||
static void report(bool forReplay=false) { UNUSED(forReplay); }
|
static void report(const bool forReplay=false) { UNUSED(forReplay); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -135,15 +135,20 @@ float Planner::min_feedrate_mm_s,
|
||||||
Planner::inverse_z_fade_height,
|
Planner::inverse_z_fade_height,
|
||||||
Planner::last_fade_z;
|
Planner::last_fade_z;
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
constexpr bool Planner::leveling_active;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SKEW_CORRECTION)
|
#if ENABLED(SKEW_CORRECTION)
|
||||||
#if ENABLED(SKEW_CORRECTION_GCODE)
|
#if ENABLED(SKEW_CORRECTION_GCODE)
|
||||||
// Initialized by settings.load()
|
|
||||||
float Planner::xy_skew_factor;
|
float Planner::xy_skew_factor;
|
||||||
#if ENABLED(SKEW_CORRECTION_FOR_Z)
|
#else
|
||||||
float Planner::xz_skew_factor, Planner::yz_skew_factor;
|
constexpr float Planner::xy_skew_factor;
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLED(SKEW_CORRECTION_FOR_Z) && ENABLED(SKEW_CORRECTION_GCODE)
|
||||||
|
float Planner::xz_skew_factor, Planner::yz_skew_factor;
|
||||||
|
#else
|
||||||
|
constexpr float Planner::xz_skew_factor, Planner::yz_skew_factor;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -94,21 +94,16 @@ block_t* Stepper::current_block = NULL; // A pointer to the block currently bei
|
||||||
// private:
|
// private:
|
||||||
|
|
||||||
uint8_t Stepper::last_direction_bits = 0; // The next stepping-bits to be output
|
uint8_t Stepper::last_direction_bits = 0; // The next stepping-bits to be output
|
||||||
uint16_t Stepper::cleaning_buffer_counter = 0;
|
int16_t Stepper::cleaning_buffer_counter = 0;
|
||||||
|
|
||||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||||
bool Stepper::locked_x_motor = false;
|
bool Stepper::locked_x_motor = false, Stepper::locked_x2_motor = false;
|
||||||
bool Stepper::locked_x2_motor = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||||
bool Stepper::locked_y_motor = false;
|
bool Stepper::locked_y_motor = false, Stepper::locked_y2_motor = false;
|
||||||
bool Stepper::locked_y2_motor = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
bool Stepper::locked_z_motor = false;
|
bool Stepper::locked_z_motor = false, Stepper::locked_z2_motor = false;
|
||||||
bool Stepper::locked_z2_motor = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long Stepper::counter_X = 0,
|
long Stepper::counter_X = 0,
|
||||||
|
@ -341,10 +336,8 @@ HAL_STEP_TIMER_ISR {
|
||||||
|
|
||||||
void Stepper::isr() {
|
void Stepper::isr() {
|
||||||
|
|
||||||
hal_timer_t ocr_val;
|
#define ENDSTOP_NOMINAL_OCR_VAL 1500 * HAL_TICKS_PER_US // Check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch
|
||||||
|
#define OCR_VAL_TOLERANCE 500 * HAL_TICKS_PER_US // First max delay is 2.0ms, last min delay is 0.5ms, all others 1.5ms
|
||||||
#define ENDSTOP_NOMINAL_OCR_VAL 1500 * HAL_TICKS_PER_US // check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch
|
|
||||||
#define OCR_VAL_TOLERANCE 500 * HAL_TICKS_PER_US // First max delay is 2.0ms, last min delay is 0.5ms, all others 1.5ms
|
|
||||||
|
|
||||||
#if DISABLED(LIN_ADVANCE)
|
#if DISABLED(LIN_ADVANCE)
|
||||||
// Disable Timer0 ISRs and enable global ISR again to capture UART events (incoming chars)
|
// Disable Timer0 ISRs and enable global ISR again to capture UART events (incoming chars)
|
||||||
|
@ -355,6 +348,7 @@ void Stepper::isr() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
hal_timer_t ocr_val;
|
||||||
static uint32_t step_remaining = 0; // SPLIT function always runs. This allows 16 bit timers to be
|
static uint32_t step_remaining = 0; // SPLIT function always runs. This allows 16 bit timers to be
|
||||||
// used to generate the stepper ISR.
|
// used to generate the stepper ISR.
|
||||||
#define SPLIT(L) do { \
|
#define SPLIT(L) do { \
|
||||||
|
@ -367,42 +361,45 @@ void Stepper::isr() {
|
||||||
ocr_val = L;\
|
ocr_val = L;\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
|
// Time remaining before the next step?
|
||||||
if (step_remaining) {
|
if (step_remaining) {
|
||||||
if (ENDSTOPS_ENABLED)
|
|
||||||
endstops.update();
|
|
||||||
if (step_remaining > ENDSTOP_NOMINAL_OCR_VAL) {
|
|
||||||
step_remaining -= ENDSTOP_NOMINAL_OCR_VAL;
|
|
||||||
ocr_val = ENDSTOP_NOMINAL_OCR_VAL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ocr_val = step_remaining;
|
|
||||||
step_remaining = 0; // last one before the ISR that does the step
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Make sure endstops are updated
|
||||||
|
if (ENDSTOPS_ENABLED) endstops.update();
|
||||||
|
|
||||||
|
// Next ISR either for endstops or stepping
|
||||||
|
ocr_val = step_remaining <= ENDSTOP_NOMINAL_OCR_VAL ? step_remaining : ENDSTOP_NOMINAL_OCR_VAL;
|
||||||
|
step_remaining -= ocr_val;
|
||||||
_NEXT_ISR(ocr_val);
|
_NEXT_ISR(ocr_val);
|
||||||
|
|
||||||
#if DISABLED(LIN_ADVANCE)
|
#if DISABLED(LIN_ADVANCE)
|
||||||
#ifdef CPU_32_BIT
|
#ifdef CPU_32_BIT
|
||||||
HAL_timer_set_count(STEP_TIMER_NUM, ocr_val);
|
HAL_timer_set_count(STEP_TIMER_NUM, ocr_val);
|
||||||
#else
|
#else
|
||||||
NOLESS(OCR1A, TCNT1 + 16);
|
NOLESS(OCR1A, TCNT1 + 16);
|
||||||
|
#endif
|
||||||
|
HAL_ENABLE_ISRs(); // re-enable ISRs
|
||||||
#endif
|
#endif
|
||||||
HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// When cleaning, discard the current block and run fast
|
||||||
|
//
|
||||||
if (cleaning_buffer_counter) {
|
if (cleaning_buffer_counter) {
|
||||||
--cleaning_buffer_counter;
|
if (cleaning_buffer_counter < 0)
|
||||||
|
++cleaning_buffer_counter; // Count up for endstop hit
|
||||||
|
else {
|
||||||
|
--cleaning_buffer_counter; // Count down for abort print
|
||||||
|
#ifdef SD_FINISHED_RELEASECOMMAND
|
||||||
|
if (!cleaning_buffer_counter && (SD_FINISHED_STEPPERRELEASE)) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
current_block = NULL;
|
current_block = NULL;
|
||||||
planner.discard_current_block();
|
planner.discard_current_block();
|
||||||
#ifdef SD_FINISHED_RELEASECOMMAND
|
_NEXT_ISR(HAL_STEPPER_TIMER_RATE / 10000); // Run at max speed - 10 KHz
|
||||||
if (!cleaning_buffer_counter && (SD_FINISHED_STEPPERRELEASE)) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
HAL_ENABLE_ISRs(); // Re-enable ISRs
|
||||||
#endif
|
|
||||||
_NEXT_ISR(HAL_STEPPER_TIMER_RATE / 10000); // Run at max speed - 10 KHz
|
|
||||||
HAL_ENABLE_ISRs(); // re-enable ISRs
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Stepper {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static uint8_t last_direction_bits; // The next stepping-bits to be output
|
static uint8_t last_direction_bits; // The next stepping-bits to be output
|
||||||
static uint16_t cleaning_buffer_counter;
|
static int16_t cleaning_buffer_counter;
|
||||||
|
|
||||||
#if ENABLED(X_DUAL_ENDSTOPS)
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||||
static bool locked_x_motor, locked_x2_motor;
|
static bool locked_x_motor, locked_x2_motor;
|
||||||
|
|
Loading…
Reference in a new issue