Minor LCD cleanup, improvement
This commit is contained in:
@ -46,14 +46,9 @@
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
|
||||
extern millis_t manual_move_start_time;
|
||||
extern int8_t manual_move_axis;
|
||||
#if ENABLED(MANUAL_E_MOVES_RELATIVE)
|
||||
float manual_move_e_origin = 0;
|
||||
#endif
|
||||
#if IS_KINEMATIC
|
||||
extern float manual_move_offset;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Tell ui.update() to start a move to current_position" after a short delay.
|
||||
@ -66,8 +61,8 @@ inline void manual_move_to_current(AxisEnum axis
|
||||
#if MULTI_MANUAL
|
||||
if (axis == E_AXIS) ui.manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
|
||||
#endif
|
||||
manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
|
||||
manual_move_axis = (int8_t)axis;
|
||||
ui.manual_move_start_time = millis() + (move_menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
|
||||
ui.manual_move_axis = (int8_t)axis;
|
||||
}
|
||||
|
||||
//
|
||||
@ -112,11 +107,11 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
|
||||
// Get the new position
|
||||
const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
|
||||
#if IS_KINEMATIC
|
||||
manual_move_offset += diff;
|
||||
ui.manual_move_offset += diff;
|
||||
if (int32_t(ui.encoderPosition) < 0)
|
||||
NOLESS(manual_move_offset, min - current_position[axis]);
|
||||
NOLESS(ui.manual_move_offset, min - current_position[axis]);
|
||||
else
|
||||
NOMORE(manual_move_offset, max - current_position[axis]);
|
||||
NOMORE(ui.manual_move_offset, max - current_position[axis]);
|
||||
#else
|
||||
current_position[axis] += diff;
|
||||
if (int32_t(ui.encoderPosition) < 0)
|
||||
@ -130,11 +125,10 @@ static void _lcd_move_xyz(PGM_P const name, const AxisEnum axis) {
|
||||
}
|
||||
ui.encoderPosition = 0;
|
||||
if (ui.should_draw()) {
|
||||
const float pos = NATIVE_TO_LOGICAL(ui.processing_manual_move ? destination[axis] : current_position[axis]
|
||||
#if IS_KINEMATIC
|
||||
+ manual_move_offset
|
||||
#endif
|
||||
, axis);
|
||||
const float pos = NATIVE_TO_LOGICAL(
|
||||
ui.processing_manual_move ? destination[axis] : current_position[axis] + TERN0(IS_KINEMATIC, ui.manual_move_offset),
|
||||
axis
|
||||
);
|
||||
MenuEditItemBase::draw_edit_screen(name, move_menu_scale >= 0.1f ? ftostr41sign(pos) : ftostr43sign(pos));
|
||||
}
|
||||
}
|
||||
@ -149,7 +143,7 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
|
||||
if (ui.encoderPosition) {
|
||||
if (!ui.processing_manual_move) {
|
||||
const float diff = float(int32_t(ui.encoderPosition)) * move_menu_scale;
|
||||
TERN(IS_KINEMATIC, manual_move_offset, current_position.e) += diff;
|
||||
TERN(IS_KINEMATIC, ui.manual_move_offset, current_position.e) += diff;
|
||||
manual_move_to_current(E_AXIS
|
||||
#if MULTI_MANUAL
|
||||
, eindex
|
||||
@ -166,7 +160,7 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
|
||||
MenuEditItemBase::draw_edit_screen(
|
||||
GET_TEXT(TERN(MULTI_MANUAL, MSG_MOVE_EN, MSG_MOVE_E)),
|
||||
ftostr41sign(current_position.e
|
||||
+ TERN0(IS_KINEMATIC, manual_move_offset)
|
||||
+ TERN0(IS_KINEMATIC, ui.manual_move_offset)
|
||||
- TERN0(MANUAL_E_MOVES_RELATIVE, manual_move_e_origin)
|
||||
)
|
||||
);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "menu.h"
|
||||
#include "../../gcode/gcode.h"
|
||||
#include "../../gcode/queue.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../module/configuration_store.h"
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
@ -356,24 +357,16 @@ void _lcd_ubl_build_mesh() {
|
||||
}
|
||||
|
||||
/**
|
||||
* UBL Load Mesh Command
|
||||
* UBL Load / Save Mesh Commands
|
||||
*/
|
||||
void _lcd_ubl_load_mesh_cmd() {
|
||||
inline void _lcd_ubl_load_save_cmd(const char loadsave, PGM_P const msg) {
|
||||
char ubl_lcd_gcode[40];
|
||||
sprintf_P(ubl_lcd_gcode, PSTR("G29 L%i\nM117 "), ubl_storage_slot);
|
||||
sprintf_P(&ubl_lcd_gcode[strlen(ubl_lcd_gcode)], GET_TEXT(MSG_MESH_LOADED), ubl_storage_slot);
|
||||
gcode.process_subcommands_now(ubl_lcd_gcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* UBL Save Mesh Command
|
||||
*/
|
||||
void _lcd_ubl_save_mesh_cmd() {
|
||||
char ubl_lcd_gcode[40];
|
||||
sprintf_P(ubl_lcd_gcode, PSTR("G29 S%i\nM117 "), ubl_storage_slot);
|
||||
sprintf_P(&ubl_lcd_gcode[strlen(ubl_lcd_gcode)], GET_TEXT(MSG_MESH_SAVED), ubl_storage_slot);
|
||||
sprintf_P(ubl_lcd_gcode, PSTR("G29 %c%i\nM117 "), loadsave, ubl_storage_slot);
|
||||
sprintf_P(&ubl_lcd_gcode[strlen(ubl_lcd_gcode)], msg, ubl_storage_slot);
|
||||
gcode.process_subcommands_now(ubl_lcd_gcode);
|
||||
}
|
||||
void _lcd_ubl_load_mesh_cmd() { _lcd_ubl_load_save_cmd('L', GET_TEXT(MSG_MESH_LOADED)); }
|
||||
void _lcd_ubl_save_mesh_cmd() { _lcd_ubl_load_save_cmd('S', GET_TEXT(MSG_MESH_SAVED)); }
|
||||
|
||||
/**
|
||||
* UBL Mesh Storage submenu
|
||||
@ -444,9 +437,6 @@ void ubl_map_move_to_xy() {
|
||||
/**
|
||||
* UBL LCD "radar" map
|
||||
*/
|
||||
void set_current_from_steppers_for_axis(const AxisEnum axis);
|
||||
void sync_plan_position();
|
||||
|
||||
void _lcd_ubl_output_map_lcd() {
|
||||
|
||||
static int16_t step_scaler = 0;
|
||||
|
Reference in New Issue
Block a user