From 610fb4668393265bbe2f18fe96a329b832ddc0c3 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 26 Apr 2019 03:32:01 -0400 Subject: [PATCH] Fix some ExtUI issues (#13799) --- Marlin/src/feature/bedlevel/abl/abl.cpp | 4 ++++ Marlin/src/feature/bedlevel/bedlevel.cpp | 4 ++++ Marlin/src/feature/pause.cpp | 4 +++- Marlin/src/gcode/bedlevel/M420.cpp | 13 +++++++++---- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 ++++ Marlin/src/gcode/bedlevel/abl/M421.cpp | 4 ++++ Marlin/src/lcd/extensible_ui/ui_api.cpp | 6 ++++++ Marlin/src/lcd/extensible_ui/ui_api.h | 5 +++++ Marlin/src/lcd/ultralcd.cpp | 1 + 9 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Marlin/src/feature/bedlevel/abl/abl.cpp b/Marlin/src/feature/bedlevel/abl/abl.cpp index ce2799cd3..b6011332b 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.cpp +++ b/Marlin/src/feature/bedlevel/abl/abl.cpp @@ -32,6 +32,10 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../../core/debug_out.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + int bilinear_grid_spacing[2], bilinear_start[2]; float bilinear_grid_factor[2], z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 55267b44e..3cac3d5b4 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -42,6 +42,10 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../core/debug_out.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + bool leveling_is_valid() { return #if ENABLED(MESH_BED_LEVELING) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 75705e159..99dbb380e 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -656,7 +656,9 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le // Resume the print job timer if it was running if (print_job_timer.isPaused()) print_job_timer.start(); - ui.reset_status(); + #if HAS_LCD_MENU + ui.return_to_status(); + #endif } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index f87c60fec..3ce43b2fe 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -32,6 +32,10 @@ #include "../../module/configuration_store.h" #endif +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + //#define M420_C_USE_MEAN /** @@ -175,14 +179,15 @@ void GcodeSuite::M420() { set_bed_leveling_enabled(false); // Subtract the mean from all values for (uint8_t x = GRID_MAX_POINTS_X; x--;) - for (uint8_t y = GRID_MAX_POINTS_Y; y--;) + for (uint8_t y = GRID_MAX_POINTS_Y; y--;) { Z_VALUES(x, y) -= zmean; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); + #endif + } #if ENABLED(ABL_BILINEAR_SUBDIVISION) bed_level_virt_interpolate(); #endif - #if ENABLED(EXTENSIBLE_UI) - ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); - #endif } #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 675cd2b88..22cc0c175 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -51,6 +51,10 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../../core/debug_out.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + #if ABL_GRID #if ENABLED(PROBE_Y_FIRST) #define PR_OUTER_VAR xCount diff --git a/Marlin/src/gcode/bedlevel/abl/M421.cpp b/Marlin/src/gcode/bedlevel/abl/M421.cpp index cba905b4f..295911330 100644 --- a/Marlin/src/gcode/bedlevel/abl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/abl/M421.cpp @@ -31,6 +31,10 @@ #include "../../gcode.h" #include "../../../feature/bedlevel/abl/abl.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + /** * M421: Set a single Mesh Bed Leveling Z coordinate * diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index aa71743e1..8e531ec2a 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -715,6 +715,7 @@ namespace ExtUI { #if HAS_MESH bool getMeshValid() { return leveling_is_valid(); } bed_mesh_t getMeshArray() { return Z_VALUES_ARR; } + float getMeshPoint(const uint8_t xpos, const uint8_t ypos) { return Z_VALUES(xpos,ypos); } void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) { if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) { Z_VALUES(xpos, ypos) = zoff; @@ -748,10 +749,15 @@ namespace ExtUI { enqueue_and_echo_commands_P(gcode); } + bool commandsInQueue() { return (planner.movesplanned() || commands_in_queue); } + bool isAxisPositionKnown(const axis_t axis) { return TEST(axis_known_position, axis); } + bool isPositionKnown() { return all_axes_known(); } + bool isMachineHomed() { return all_axes_homed(); } + PGM_P getFirmwareName_str() { static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION; return firmware_name; diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index b5be58dcc..2f2f99dc1 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -58,9 +58,12 @@ namespace ExtUI { bool isMoving(); bool isAxisPositionKnown(const axis_t); + bool isPositionKnown(); // Axis position guaranteed, steppers active since homing + bool isMachineHomed(); // Axis position most likely correct, steppers may have deactivated bool canMove(const axis_t); bool canMove(const extruder_t); void enqueueCommands_P(PGM_P const); + bool commandsInQueue(); /** * Getters and setters @@ -110,8 +113,10 @@ namespace ExtUI { bool getLevelingActive(); void setLevelingActive(const bool); #if HAS_MESH + #include "../../feature/bedlevel/bedlevel.h" bool getMeshValid(); bed_mesh_t getMeshArray(); + float getMeshPoint(const uint8_t xpos, const uint8_t ypos); void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval); void onMeshUpdate(const uint8_t xpos, const uint8_t ypos, const float zval); #endif diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 0d4b88d2c..f7381c1d1 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -25,6 +25,7 @@ // These displays all share the MarlinUI class #if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI) #include "ultralcd.h" + #include "fontutils.h" MarlinUI ui; #include "../sd/cardreader.h" #if ENABLED(EXTENSIBLE_UI)