Changes for parity with 2.0.x

master
Scott Lahteine 7 years ago
parent 93560836de
commit 1063b3b2b8

@ -164,6 +164,7 @@
static int8_t g26_prime_flag;
#if ENABLED(NEWPANEL)
/**
* Detect is_lcd_clicked, debounce it, and return true for cancel
*/
@ -185,28 +186,27 @@
lcd_reset_status();
return true;
}
#endif
#if ENABLED(NEWPANEL)
bool exit_from_g26() {
lcd_setstatusPGM(PSTR("Leaving G26"), -1);
wait_for_release();
return G26_ERR;
}
#endif
void G26_line_to_destination(const float &feed_rate) {
const float save_feedrate = feedrate_mm_s;
feedrate_mm_s = feed_rate; // use specified feed rate
prepare_move_to_destination(); // will ultimately call ubl.line_to_destination_cartesian for UBL or ubl.prepare_linear_move_to for UBL_DELTA
prepare_move_to_destination(); // will ultimately call ubl.line_to_destination_cartesian or ubl.prepare_linear_move_to for UBL_DELTA
feedrate_mm_s = save_feedrate; // restore global feed rate
}
void move_to(const float &x, const float &y, const float &z, const float &e_delta) {
void move_to(const float &rx, const float &ry, const float &z, const float &e_delta) {
float feed_value;
static float last_z = -999.99;
bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
bool has_xy_component = (rx != current_position[X_AXIS] || ry != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
if (z != last_z) {
last_z = z;
@ -229,8 +229,8 @@
if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
destination[X_AXIS] = x;
destination[Y_AXIS] = y;
destination[X_AXIS] = rx;
destination[Y_AXIS] = ry;
destination[E_AXIS] += e_delta;
G26_line_to_destination(feed_value);
@ -292,13 +292,11 @@
wait_for_release();
#if ENABLED(ULTRA_LCD)
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.
lcd_setstatusPGM(PSTR("Done Priming"), 99);
lcd_quick_feedback();
lcd_external_control = false;
#endif
}
else
#endif
@ -490,17 +488,11 @@
return false;
}
float valid_trig_angle(float d) {
while (d > 360.0) d -= 360.0;
while (d < 0.0) d += 360.0;
return d;
}
/**
* Turn on the bed and nozzle heat and
* wait for them to get up to temperature.
*/
bool turn_on_heaters() {
inline bool turn_on_heaters() {
millis_t next = millis() + 5000UL;
#if HAS_TEMP_BED
#if ENABLED(ULTRA_LCD)
@ -554,10 +546,16 @@
return G26_OK;
}
float valid_trig_angle(float d) {
while (d > 360.0) d -= 360.0;
while (d < 0.0) d += 360.0;
return d;
}
/**
* G26: Mesh Validation Pattern generation.
*
* Used to interactively edit UBL's Mesh by placing the
* Used to interactively edit the mesh by placing the
* nozzle in a problem area and doing a G29 P4 R command.
*/
void gcode_G26() {
@ -703,12 +701,12 @@
set_current_from_destination();
}
if (turn_on_heaters()) goto LEAVE;
if (turn_on_heaters() != G26_OK) goto LEAVE;
current_position[E_AXIS] = 0.0;
sync_plan_position_e();
if (g26_prime_flag && prime_nozzle()) goto LEAVE;
if (g26_prime_flag && prime_nozzle() != G26_OK) goto LEAVE;
/**
* Bed is preheated

@ -298,11 +298,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#if ENABLED(LCD_PROGRESS_BAR)
#if DISABLED(SDSUPPORT)
#error "LCD_PROGRESS_BAR requires SDSUPPORT."
#elif DISABLED(ULTRA_LCD)
#error "LCD_PROGRESS_BAR requires a character LCD."
#elif ENABLED(DOGLCD)
#error "LCD_PROGRESS_BAR does not apply to graphical displays."
#elif ENABLED(FILAMENT_LCD_DISPLAY)
#error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
#endif
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && DISABLED(DOGLCD)
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD."
#endif
/**

@ -813,8 +813,8 @@
#ifndef MSG_DELTA_HEIGHT_CALIBRATE
#define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Set Delta Height")
#endif
#ifndef MSG_DELTA_DIAG_ROG
#define MSG_DELTA_DIAG_ROG _UxGT("Diag Rod")
#ifndef MSG_DELTA_DIAG_ROD
#define MSG_DELTA_DIAG_ROD _UxGT("Diag Rod")
#endif
#ifndef MSG_DELTA_HEIGHT
#define MSG_DELTA_HEIGHT _UxGT("Height")

@ -124,15 +124,20 @@ float Planner::min_feedrate_mm_s,
Planner::inverse_z_fade_height,
Planner::last_fade_z;
#endif
#else
constexpr bool Planner::leveling_active;
#endif
#if ENABLED(SKEW_CORRECTION)
#if ENABLED(SKEW_CORRECTION_GCODE)
// Initialized by settings.load()
float Planner::xy_skew_factor;
#if ENABLED(SKEW_CORRECTION_FOR_Z)
float Planner::xz_skew_factor, Planner::yz_skew_factor;
#else
constexpr float Planner::xy_skew_factor;
#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

@ -1273,7 +1273,7 @@ void Temperature::init() {
* their target temperature by a configurable margin.
* This is called when the temperature is set. (M104, M109)
*/
void Temperature::start_watching_heater(uint8_t e) {
void Temperature::start_watching_heater(const uint8_t e) {
#if HOTENDS == 1
UNUSED(e);
#endif

@ -370,14 +370,14 @@ class Temperature {
static int16_t degTargetBed() { return target_temperature_bed; }
#if WATCH_HOTENDS
static void start_watching_heater(uint8_t e = 0);
static void start_watching_heater(const uint8_t e = 0);
#endif
#if WATCH_THE_BED
static void start_watching_bed();
#endif
static void setTargetHotend(const int16_t celsius, uint8_t e) {
static void setTargetHotend(const int16_t celsius, const uint8_t e) {
#if HOTENDS == 1
UNUSED(e);
#endif
@ -455,7 +455,7 @@ class Temperature {
#if ENABLED(BABYSTEPPING)
static void babystep_axis(const AxisEnum axis, const int distance) {
static void babystep_axis(const AxisEnum axis, const int16_t distance) {
if (axis_known_position[axis]) {
#if IS_CORE
#if ENABLED(BABYSTEP_XY)

@ -84,7 +84,7 @@
#if ENABLED(NEWPANEL)
static void move_z_with_encoder(const float &multiplier);
static float measure_point_with_encoder();
static float measure_business_card_thickness(float);
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

@ -45,7 +45,7 @@
#if ENABLED(NEWPANEL)
void lcd_return_to_status();
void lcd_mesh_edit_setup(float initial);
void lcd_mesh_edit_setup(const float initial);
float lcd_mesh_edit();
void lcd_z_offset_edit_setup(float);
extern void _lcd_ubl_output_map_lcd();
@ -57,8 +57,9 @@
extern float probe_pt(const float &rx, const float &ry, const bool, const uint8_t, const bool=true);
extern bool set_probe_deployed(bool);
extern void set_bed_leveling_enabled(bool);
typedef void (*screenFunc_t)();
extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder=0);
#define SIZE_OF_LITTLE_RAISE 1
#define BIG_RAISE_NOT_NEEDED 0
@ -644,8 +645,8 @@
SERIAL_ECHOPAIR(" J ", y);
SERIAL_ECHOPGM(" Z ");
SERIAL_ECHO_F(z_values[x][y], 6);
SERIAL_ECHOPAIR(" ; X ", mesh_index_to_xpos(x));
SERIAL_ECHOPAIR(", Y ", mesh_index_to_ypos(y));
SERIAL_ECHOPAIR(" ; X ", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
SERIAL_ECHOPAIR(", Y ", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
SERIAL_EOL();
}
return;
@ -799,7 +800,6 @@
z_values[location.x_index][location.y_index] = measured_z;
}
} while (location.x_index >= 0 && --max_iterations);
STOW_PROBE();
@ -914,6 +914,7 @@
}
}
}
#endif // HAS_BED_PROBE
#if ENABLED(NEWPANEL)
@ -938,7 +939,7 @@
static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
float unified_bed_leveling::measure_business_card_thickness(float in_height) {
float unified_bed_leveling::measure_business_card_thickness(const float &in_height) {
lcd_external_control = true;
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
@ -971,8 +972,6 @@
SERIAL_PROTOCOLLNPGM("mm thick.");
}
in_height = current_position[Z_AXIS]; // do manual probing at lower height
lcd_external_control = false;
restore_ubl_active_state_and_leave();
@ -1463,7 +1462,6 @@
// factor in the distance from the current location for the normal case
// so the nozzle isn't running all over the bed.
distance += HYPOT(current_position[X_AXIS] - mx, current_position[Y_AXIS] - my) * 0.1;
if (distance < best_so_far) {
best_so_far = distance; // We found a closer location with
out_mesh.x_index = i; // the specified type of mesh value.

@ -57,16 +57,12 @@
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
bool lcd_external_control;
bool lcd_external_control; // = false
#endif
// Initialized by settings.load()
int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
uint8_t progress_bar_percent;
#endif
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
millis_t previous_lcd_status_ms = 0;
#endif
@ -92,6 +88,10 @@ char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kan
uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
uint8_t progress_bar_percent;
#endif
#if ENABLED(DOGLCD)
#include "ultralcd_impl_DOGM.h"
#include <U8glib.h>
@ -259,10 +259,6 @@ uint16_t max_display_update_time = 0;
//////////// Menu System Macros ////////////
////////////////////////////////////////////
#ifndef ENCODER_FEEDRATE_DEADZONE
#define ENCODER_FEEDRATE_DEADZONE 6
#endif
/**
* MENU_ITEM generates draw & handler code for a menu item, potentially calling:
*
@ -734,7 +730,7 @@ void kill_screen(const char* lcd_msg) {
* Audio feedback for controller clicks
*
*/
void lcd_buzz(long duration, uint16_t freq) {
void lcd_buzz(const long duration, const uint16_t freq) {
#if ENABLED(LCD_USE_I2C_BUZZER)
lcd.buzz(duration, freq);
#elif PIN_EXISTS(BEEPER)
@ -1180,7 +1176,7 @@ void kill_screen(const char* lcd_msg) {
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;
lcd_goto_screen(_lcd_mesh_edit_NOP);
}
@ -1836,7 +1832,6 @@ void kill_screen(const char* lcd_msg) {
/**
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
*/
void _lcd_level_bed_moving() {
if (lcdDrawUpdate) {
char msg[10];
@ -2649,7 +2644,7 @@ void kill_screen(const char* lcd_msg) {
void lcd_move_z();
void _man_probe_pt(const float rx, const float ry) {
void _man_probe_pt(const float &rx, const float &ry) {
#if HAS_LEVELING
reset_bed_level(); // After calibration bed-level data is no longer valid
#endif
@ -2712,7 +2707,7 @@ void kill_screen(const char* lcd_msg) {
void lcd_delta_settings() {
START_MENU();
MENU_BACK(MSG_DELTA_CALIBRATE);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_DIAG_ROG, &delta_diagonal_rod, delta_diagonal_rod - 5.0, delta_diagonal_rod + 5.0, recalc_delta_settings);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5.0, delta_diagonal_rod + 5.0, recalc_delta_settings);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10.0, delta_height + 10.0, recalc_delta_settings);
MENU_ITEM_EDIT_CALLBACK(float43, "Ex", &delta_endstop_adj[A_AXIS], -5.0, 5.0, recalc_delta_settings);
MENU_ITEM_EDIT_CALLBACK(float43, "Ey", &delta_endstop_adj[B_AXIS], -5.0, 5.0, recalc_delta_settings);
@ -2785,10 +2780,7 @@ void kill_screen(const char* lcd_msg) {
manual_move_offset = 0.0;
manual_move_axis = (int8_t)NO_AXIS;
// DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
// move_to_destination. This will cause idle() to be called, which can then call this function while the
// previous invocation is being blocked. Modifications to manual_move_offset shouldn't be made while
// processing_manual_move is true or the planner will get out of sync.
// Set a blocking flag so no new moves can be added until all segments are done
processing_manual_move = true;
prepare_move_to_destination(); // will call set_current_from_destination()
processing_manual_move = false;
@ -2868,7 +2860,6 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
max = soft_endstop_max[Z_AXIS];
#endif
break;
default: break;
}
#endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
@ -3142,7 +3133,7 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
#if HAS_LCD_CONTRAST
MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, (int*)&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
#if ENABLED(FWRETRACT)
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
@ -4339,6 +4330,7 @@ void kill_screen(const char* lcd_msg) {
} \
typedef void _name
DEFINE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01);
DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1);
DEFINE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1);
DEFINE_MENU_EDIT_TYPE(float, float3, ftostr3, 1.0);
@ -4348,7 +4340,6 @@ void kill_screen(const char* lcd_msg) {
DEFINE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10.0);
DEFINE_MENU_EDIT_TYPE(float, float52, ftostr52sign, 100.0);
DEFINE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100.0);
DEFINE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01);
/**
*
@ -4611,8 +4602,13 @@ void lcd_update() {
#if ENABLED(ULTIPANEL)
static millis_t return_to_status_ms = 0;
// Handle any queued Move Axis motion
manage_manual_move();
// Update button states for LCD_CLICKED, etc.
// After state changes the next button update
// may be delayed 300-500ms.
lcd_buttons_update();
#if ENABLED(AUTO_BED_LEVELING_UBL)
@ -4947,7 +4943,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#define encrot3 1
#endif
#define GET_BUTTON_STATES(DST) \
#define GET_SHIFT_BUTTON_STATES(DST) \
uint8_t new_##DST = 0; \
WRITE(SHIFT_LD, LOW); \
WRITE(SHIFT_LD, HIGH); \
@ -4966,7 +4962,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
*/
void lcd_buttons_update() {
static uint8_t lastEncoderBits;
millis_t now = millis();
const millis_t now = millis();
if (ELAPSED(now, next_button_update_ms)) {
#if ENABLED(NEWPANEL)
@ -5047,13 +5043,15 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#elif ENABLED(REPRAPWORLD_KEYPAD)
GET_BUTTON_STATES(buttons_reprapworld_keypad);
GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad);
#endif
#else
GET_BUTTON_STATES(buttons);
#endif // !NEWPANEL
#else // !NEWPANEL
GET_SHIFT_BUTTON_STATES(buttons);
#endif
} // next_button_update_ms

@ -23,10 +23,12 @@
#ifndef ULTRALCD_H
#define ULTRALCD_H
#include "Marlin.h"
#include "MarlinConfig.h"
#if ENABLED(ULTRA_LCD)
#include "Marlin.h"
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
extern bool lcd_external_control;
#if ENABLED(G26_MESH_VALIDATION)
@ -57,7 +59,7 @@
inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
#if HAS_BUZZER
void lcd_buzz(long duration, uint16_t freq);
void lcd_buzz(const long duration, const uint16_t freq);
#endif
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
@ -205,7 +207,7 @@
void lcd_reset_status();
#if ENABLED(AUTO_BED_LEVELING_UBL)
void lcd_mesh_edit_setup(float initial);
void lcd_mesh_edit_setup(const float initial);
float lcd_mesh_edit();
void lcd_z_offset_edit_setup(float);
float lcd_z_offset_edit();

Loading…
Cancel
Save