Skip to content

Commit

Permalink
🚸 Update ProUI Plot graph - part 2 (MarlinFirmware#26563)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
classicrocker883 and thinkyhead authored Apr 1, 2024
1 parent 017a903 commit 87e94f4
Show file tree
Hide file tree
Showing 143 changed files with 1,781 additions and 837 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3558,7 +3558,7 @@
* Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and
* to set spindle speed, spindle direction, and laser power.
*
* SuperPid is a router/spindle speed controller used in the CNC milling community.
* SuperPID is a router/spindle speed controller used in the CNC milling community.
* Marlin can be used to turn the spindle on and off. It can also be used to set
* the spindle speed from 5,000 to 30,000 RPM.
*
Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
#include "lcd/e3v2/common/encoder.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "lcd/e3v2/jyersui/dwin.h"
#endif
Expand Down Expand Up @@ -1594,11 +1592,11 @@ void setup() {
SERIAL_ECHO_TERNARY(err, "BL24CXX Check ", "failed", "succeeded", "!\n");
#endif

#if HAS_DWIN_E3V2_BASIC
#if ENABLED(DWIN_CREALITY_LCD)
SETUP_RUN(dwinInitScreen());
#endif

#if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)
SETUP_RUN(ui.reset_status(true)); // Show service messages or keep current status
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class unified_bed_leveling {
static void report_current_mesh();
static void report_state();
static void save_ubl_active_state_and_disable();
static void restore_ubl_active_state_and_leave();
static void restore_ubl_active_state(const bool is_done=true);
static void display_map(const uint8_t) __O0;
static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) __O0;
static mesh_index_pair find_furthest_invalid_mesh_point() __O0;
Expand Down
33 changes: 14 additions & 19 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void unified_bed_leveling::G29() {
#if ALL(DWIN_LCD_PROUI, ZHOME_BEFORE_LEVELING)
save_ubl_active_state_and_disable();
gcode.process_subcommands_now(F("G28Z"));
restore_ubl_active_state_and_leave();
restore_ubl_active_state(false); // ...without telling ExtUI "done"
#else
// Send 'N' to force homing before G29 (internal only)
if (axes_should_home() || parser.seen_test('N')) gcode.home_all_axes();
Expand Down Expand Up @@ -425,7 +425,7 @@ void unified_bed_leveling::G29() {
if (parser.seen_test('J')) {
save_ubl_active_state_and_disable();
tilt_mesh_based_on_probed_grid(param.J_grid_size == 0); // Zero size does 3-Point
restore_ubl_active_state_and_leave();
restore_ubl_active_state();
#if ENABLED(UBL_G29_J_RECENTER)
do_blocking_move_to_xy(0.5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0.5f * ((MESH_MIN_Y) + (MESH_MAX_Y)));
#endif
Expand Down Expand Up @@ -754,7 +754,6 @@ void unified_bed_leveling::shift_mesh_height() {

TERN_(HAS_MARLINUI_MENU, ui.capture());
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
TERN_(DWIN_LCD_PROUI, dwinLevelingStart());

save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
grid_count_t count = GRID_MAX_POINTS;
Expand All @@ -768,7 +767,6 @@ void unified_bed_leveling::shift_mesh_height() {
SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
TERN_(HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout());
TERN_(DWIN_LCD_PROUI, dwinRedrawScreen());

#if HAS_MARLINUI_MENU
if (ui.button_pressed()) {
Expand All @@ -778,8 +776,7 @@ void unified_bed_leveling::shift_mesh_height() {
ui.quick_feedback();
ui.release();
probe.stow(); // Release UI before stow to allow for PAUSE_BEFORE_DEPLOY_STOW
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
return restore_ubl_active_state_and_leave();
return restore_ubl_active_state();
}
#endif

Expand Down Expand Up @@ -815,15 +812,12 @@ void unified_bed_leveling::shift_mesh_height() {

probe.move_z_after_probing();

restore_ubl_active_state_and_leave();

do_blocking_move_to_xy(
constrain(nearby.x - probe.offset_xy.x, MESH_MIN_X, MESH_MAX_X),
constrain(nearby.y - probe.offset_xy.y, MESH_MIN_Y, MESH_MAX_Y)
);

TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
TERN_(DWIN_LCD_PROUI, dwinLevelingDone());
restore_ubl_active_state();
}

#endif // HAS_BED_PROBE
Expand Down Expand Up @@ -932,7 +926,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
if (param.V_verbosity > 1)
SERIAL_ECHOLNPGM("Business Card is ", p_float_t(thickness, 4), "mm thick.");

restore_ubl_active_state_and_leave();
restore_ubl_active_state();

return thickness;
}
Expand Down Expand Up @@ -987,7 +981,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
if (_click_and_hold([]{
SERIAL_ECHOLNPGM("\nMesh only partially populated.");
do_z_clearance(Z_CLEARANCE_DEPLOY_PROBE);
})) return restore_ubl_active_state_and_leave();
})) return restore_ubl_active_state();

// Store the Z position minus the shim height
z_values[lpos.x][lpos.y] = current_position.z - thick;
Expand All @@ -1002,10 +996,8 @@ void set_message_with_feedback(FSTR_P const fstr) {

if (do_ubl_mesh_map) display_map(param.T_map_type); // show user where we're probing

restore_ubl_active_state_and_leave();
restore_ubl_active_state();
do_blocking_move_to_xy_z(pos, Z_CLEARANCE_DEPLOY_PROBE);

TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
}

/**
Expand Down Expand Up @@ -1111,7 +1103,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
} while (lpos.x >= 0 && --param.R_repetition > 0);

if (do_ubl_mesh_map) display_map(param.T_map_type);
restore_ubl_active_state_and_leave();
restore_ubl_active_state();

do_blocking_move_to_xy_z(pos, Z_TWEEN_SAFE_CLEARANCE);

Expand Down Expand Up @@ -1263,17 +1255,20 @@ void unified_bed_leveling::save_ubl_active_state_and_disable() {
set_bed_leveling_enabled(false);
}

void unified_bed_leveling::restore_ubl_active_state_and_leave() {
void unified_bed_leveling::restore_ubl_active_state(const bool is_done/*=true*/) {
TERN_(HAS_MARLINUI_MENU, ui.release());
#if ENABLED(UBL_DEVEL_DEBUGGING)
if (--ubl_state_recursion_chk) {
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
SERIAL_ECHOLNPGM("restore_ubl_active_state() called too many times.");
set_message_with_feedback(GET_TEXT_F(MSG_UBL_RESTORE_ERROR));
return;
}
#endif
set_bed_leveling_enabled(ubl_state_at_invocation);
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());

if (is_done) {
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
}
}

mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/host_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
switch (response) {

case 0: // "Purge More" button
#if ALL(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE)
#if ENABLED(M600_PURGE_MORE_RESUMABLE)
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // Simulate menu selection (menu exits, doesn't extrude more)
#endif
break;

case 1: // "Continue" / "Disable Runout" button
#if ALL(M600_PURGE_MORE_RESUMABLE, ADVANCED_PAUSE_FEATURE)
#if ENABLED(M600_PURGE_MORE_RESUMABLE)
pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // Simulate menu selection
#endif
#if HAS_FILAMENT_SENSOR
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
/**
* feature/pause.cpp - Pause feature support functions
* This may be combined with related G-codes if features are consolidated.
*
* Note: Calls to ui.pause_show_message are passed to either ExtUI or MarlinUI.
*/

#include "../inc/MarlinConfigPre.h"
Expand Down Expand Up @@ -60,8 +62,6 @@

#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../lcd/e3v2/proui/dwin.h"
#endif

#include "../lcd/marlinui.h"
Expand Down Expand Up @@ -148,7 +148,7 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
#endif

ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode); UNUSED(mode);
ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode);

if (wait) return thermalManager.wait_for_hotend(active_extruder);

Expand Down Expand Up @@ -288,8 +288,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
// Show "Purge More" / "Resume" menu and wait for reply
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // Also sets PAUSE_RESPONSE_WAIT_FOR
#if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
ui.pause_show_message(PAUSE_MESSAGE_OPTION); // MarlinUI and MKS UI also set PAUSE_RESPONSE_WAIT_FOR
#else
pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ uint8_t PrintJobRecovery::queue_index_r;
uint32_t PrintJobRecovery::cmd_sdpos, // = 0
PrintJobRecovery::sdpos[BUFSIZE];

#if HAS_DWIN_E3V2_BASIC
bool PrintJobRecovery::dwin_flag; // = false
#if HAS_PLR_UI_FLAG
bool PrintJobRecovery::ui_flag_resume; // = false
#endif

#include "../sd/cardreader.h"
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class PrintJobRecovery {
static uint32_t cmd_sdpos, //!< SD position of the next command
sdpos[BUFSIZE]; //!< SD positions of queued commands

#if HAS_DWIN_E3V2_BASIC
static bool dwin_flag;
#if HAS_PLR_UI_FLAG
static bool ui_flag_resume; //!< Flag the UI to show a dialog to Resume (M1000) or Cancel (M1000C)
#endif

static void init();
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/feature/runout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ bool FilamentMonitorBase::enabled = true,

#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../lcd/e3v2/proui/dwin.h"
#endif

void event_filament_runout(const uint8_t extruder) {
Expand All @@ -88,7 +86,6 @@ void event_filament_runout(const uint8_t extruder) {
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder));

#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
Expand Down
44 changes: 18 additions & 26 deletions Marlin/src/feature/tmc_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,13 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
#endif
#endif

#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }

#if ENABLED(HYBRID_THRESHOLD)
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if USE_SENSORLESS
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif
#if ENABLED(HYBRID_THRESHOLD)
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if USE_SENSORLESS
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif

static constexpr int8_t sgt_min = -64,
Expand Down Expand Up @@ -207,12 +205,10 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
}
#endif

#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }

#if ENABLED(HYBRID_THRESHOLD)
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if ENABLED(HYBRID_THRESHOLD)
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
};

Expand Down Expand Up @@ -269,15 +265,13 @@ class TMCMarlin<TMC2209Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
}
#endif

#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }

#if ENABLED(HYBRID_THRESHOLD)
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if USE_SENSORLESS
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif
#if ENABLED(HYBRID_THRESHOLD)
void refresh_hybrid_thrs() { set_pwm_thrs(this->stored.hybrid_thrs); }
#endif
#if USE_SENSORLESS
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif

static constexpr uint8_t sgt_min = 0,
Expand Down Expand Up @@ -315,12 +309,10 @@ class TMCMarlin<TMC2660Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC266
}
#endif

#if ANY(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
void refresh_stepper_current() { rms_current(this->val_mA); }
void refresh_stepper_current() { rms_current(this->val_mA); }

#if USE_SENSORLESS
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif
#if USE_SENSORLESS
void refresh_homing_thrs() { homing_threshold(this->stored.homing_thrs); }
#endif

static constexpr int8_t sgt_min = -64,
Expand Down
12 changes: 2 additions & 10 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
#include "../../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../../../lcd/e3v2/proui/dwin.h"
#endif

#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
Expand All @@ -77,7 +75,7 @@ static void pre_g29_return(const bool retry, const bool did) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false));
}
if (did) {
TERN_(HAS_DWIN_E3V2_BASIC, dwinLevelingDone());
TERN_(DWIN_CREALITY_LCD, dwinLevelingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
}
}
Expand Down Expand Up @@ -425,8 +423,6 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(AUTO_BED_LEVELING_3POINT)
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling");
points[0].z = points[1].z = points[2].z = 0; // Probe at 3 arbitrary points
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
TERN_(DWIN_LCD_PROUI, dwinLevelingStart());
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart());
Expand All @@ -436,11 +432,7 @@ G29_TYPE GcodeSuite::G29() {

#if ENABLED(PREHEAT_BEFORE_LEVELING)
if (!abl.dryrun) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP,
#if ALL(DWIN_LCD_PROUI, HAS_HEATED_BED)
hmiData.bedLevT
#else
LEVELING_BED_TEMP
#endif
TERN(EXTENSIBLE_UI, ExtUI::getLevelingBedTemp(), LEVELING_BED_TEMP)
);
#endif
}
Expand Down
Loading

0 comments on commit 87e94f4

Please sign in to comment.