Merge pull request #6773 from thinkyhead/bf_lcd_patch_e5

Patch LCD code for 5th extruder
This commit is contained in:
Scott Lahteine 2017-05-18 15:26:55 -05:00 committed by GitHub
commit 94a4af1d7f
4 changed files with 55 additions and 41 deletions

View File

@ -4788,12 +4788,12 @@ void home_all_axes() { gcode_G28(true); }
// Retain the last probe position
xProbe = LOGICAL_X_POSITION(points[i].x);
yProbe = LOGICAL_Y_POSITION(points[i].y);
measured_z = points[i].z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
}
if (isnan(measured_z)) {
planner.abl_enabled = abl_should_enable;
return;
measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
if (isnan(measured_z)) {
planner.abl_enabled = abl_should_enable;
return;
}
points[i].z = measured_z;
}
if (!dryrun) {
@ -5066,9 +5066,11 @@ void home_all_axes() { gcode_G28(true); }
const float measured_z = probe_pt(xpos, ypos, !code_seen('S') || code_value_bool(), 1);
SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));
SERIAL_PROTOCOLPAIR(" Y: ", FIXFLOAT(ypos));
SERIAL_PROTOCOLLNPAIR(" Z: ", FIXFLOAT(measured_z));
if (!isnan(measured_z)) {
SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));
SERIAL_PROTOCOLPAIR(" Y: ", FIXFLOAT(ypos));
SERIAL_PROTOCOLLNPAIR(" Z: ", FIXFLOAT(measured_z));
}
clean_up_after_endstop_or_probe_move();
@ -5215,13 +5217,13 @@ void home_all_axes() { gcode_G28(true); }
if (!do_all_positions && !do_circle_x3) { // probe the center
setup_for_endstop_or_probe_move();
z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1);
z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1); // TODO: Needs error handling
clean_up_after_endstop_or_probe_move();
}
if (probe_center_plus_3) { // probe extra center points
for (int8_t axis = probe_center_plus_6 ? 11 : 9; axis > 0; axis -= probe_center_plus_6 ? 2 : 4) {
setup_for_endstop_or_probe_move();
z_at_pt[0] += probe_pt(
z_at_pt[0] += probe_pt( // TODO: Needs error handling
cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius),
sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1);
clean_up_after_endstop_or_probe_move();
@ -5237,7 +5239,7 @@ void home_all_axes() { gcode_G28(true); }
do_circle_x2 ? (zig_zag ? 0.5 : 0.0) : 0);
for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
setup_for_endstop_or_probe_move();
z_at_pt[axis] += probe_pt(
z_at_pt[axis] += probe_pt( // TODO: Needs error handling
cos(RADIANS(180 + 30 * axis)) * delta_calibration_radius *
(1 + circles * 0.1 * (zig_zag ? 1 : -1)),
sin(RADIANS(180 + 30 * axis)) * delta_calibration_radius *
@ -6417,7 +6419,8 @@ inline void gcode_M42() {
setup_for_endstop_or_probe_move();
// Move to the first point, deploy, and probe
probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
const float t = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
if (isnan(t)) return;
randomSeed(millis());

View File

@ -455,16 +455,16 @@
#define MSG_CONTRAST _UxGT("LCD contrast")
#endif
#ifndef MSG_STORE_EEPROM
#define MSG_STORE_EEPROM _UxGT("Store memory")
#define MSG_STORE_EEPROM _UxGT("Store settings")
#endif
#ifndef MSG_LOAD_EEPROM
#define MSG_LOAD_EEPROM _UxGT("Load memory")
#define MSG_LOAD_EEPROM _UxGT("Load settings")
#endif
#ifndef MSG_RESTORE_FAILSAFE
#define MSG_RESTORE_FAILSAFE _UxGT("Restore failsafe")
#endif
#ifndef MSG_INIT_EEPROM
#define MSG_INIT_EEPROM _UxGT("Initalize Memory")
#define MSG_INIT_EEPROM _UxGT("Initialize EEPROM")
#endif
#ifndef MSG_REFRESH
#define MSG_REFRESH _UxGT("Refresh")

View File

@ -393,19 +393,24 @@
ubl.save_ubl_active_state_and_disable();
ubl.tilt_mesh_based_on_probed_grid(code_seen('T'));
ubl.restore_ubl_active_state_and_leave();
} else { // grid_size==0 which means a 3-Point leveling has been requested
float z1 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y), false, g29_verbose_level),
z2 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_2_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_2_Y), false, g29_verbose_level),
z3 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_3_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_3_Y), true, g29_verbose_level);
}
else { // grid_size == 0 : A 3-Point leveling has been requested
float z3, z2, z1 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y), false, g29_verbose_level);
if (!isnan(z1)) {
z2 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_2_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_2_Y), false, g29_verbose_level);
if (!isnan(z2))
z3 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_3_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_3_Y), true, g29_verbose_level);
}
if ( isnan(z1) || isnan(z2) || isnan(z3)) { // probe_pt will return NAN if unreachable
if (isnan(z1) || isnan(z2) || isnan(z3)) { // probe_pt will return NAN if unreachable
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
goto LEAVE;
}
// We need to adjust z1, z2, z3 by the Mesh Height at these points. Just because they are non-zero doesn't mean
// the Mesh is tilted! (We need to compensate each probe point by what the Mesh says that location's height is)
// Adjust z1, z2, z3 by the Mesh Height at these points. Just because they're non-zero
// doesn't mean the Mesh is tilted! (Compensate each probe point by what the Mesh says
// its height is.)
ubl.save_ubl_active_state_and_disable();
z1 -= ubl.get_z_correction(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y)) /* + zprobe_zoffset */ ;
@ -706,7 +711,7 @@
const float mean = sum / n;
//
// Now do the sumation of the squares of difference from mean
// Sum the squares of difference from mean
//
float sum_of_diff_squared = 0.0;
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
@ -769,12 +774,13 @@
const float rawx = pgm_read_float(&ubl.mesh_index_to_xpos[location.x_index]),
rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]);
const float measured_z = probe_pt(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy), stow_probe, g29_verbose_level);
const float measured_z = probe_pt(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy), stow_probe, g29_verbose_level); // TODO: Needs error handling
ubl.z_values[location.x_index][location.y_index] = measured_z;
}
if (do_ubl_mesh_map) ubl.display_map(map_type);
} while ((location.x_index >= 0) && (--max_iterations));
} while (location.x_index >= 0 && --max_iterations);
STOW_PROBE();
ubl.restore_ubl_active_state_and_leave();
@ -1547,7 +1553,7 @@
const float x = float(x_min) + ix * dx;
for (int8_t iy = 0; iy < grid_size; iy++) {
const float y = float(y_min) + dy * (zig_zag ? grid_size - 1 - iy : iy);
float measured_z = probe_pt(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), code_seen('E'), g29_verbose_level);
float measured_z = probe_pt(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), code_seen('E'), g29_verbose_level); // TODO: Needs error handling
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_CHAR('(');

View File

@ -1289,7 +1289,7 @@ void kill_screen(const char* lcd_msg) {
void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#endif
#if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
#if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_BED != 0)
void lcd_preheat_m1_menu() {
START_MENU();
@ -1395,7 +1395,7 @@ void kill_screen(const char* lcd_msg) {
END_MENU();
}
#endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_BED)
#endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_4 || TEMP_SENSOR_BED)
void lcd_cooldown() {
#if FAN_COUNT > 0
@ -2075,18 +2075,14 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
//
// Preheat PLA
// Preheat ABS
// Change filament
//
#if TEMP_SENSOR_0 != 0
#if ENABLED(FILAMENT_CHANGE_FEATURE)
if (!thermalManager.tooColdToExtrude(active_extruder))
MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
#endif
//
// Change filament
//
#if ENABLED(FILAMENT_CHANGE_FEATURE)
if (!thermalManager.tooColdToExtrude(active_extruder))
MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
#endif
#if TEMP_SENSOR_0 != 0
//
// Cooldown
@ -2101,7 +2097,7 @@ void kill_screen(const char* lcd_msg) {
//
// Preheat for Material 1 and 2
//
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_BED != 0
MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_m1_menu);
MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_m2_menu);
#else
@ -2497,7 +2493,7 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500\nM501"));
MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500")); // TODO: Add "Are You Sure?" step
#endif
END_MENU();
}
@ -3145,6 +3141,15 @@ void kill_screen(const char* lcd_msg) {
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false);
#endif
#if TEMP_SENSOR_4 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_4
#include "thermistornames.h"
STATIC_ITEM("T4: " THERMISTOR_NAME, false, true);
STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_4_MINTEMP), false);
STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false);
#endif
#if TEMP_SENSOR_BED != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_BED