From 2f21c0e0067ddb20a0e158cec1f7ce98f7aec18c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 30 Jun 2023 00:58:39 -0500 Subject: [PATCH] Apply case (ProUI) --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 4 +- Marlin/src/feature/runout.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 +- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 6 +- Marlin/src/gcode/bedlevel/ubl/M421.cpp | 4 +- Marlin/src/gcode/config/M302.cpp | 2 +- Marlin/src/gcode/control/M997.cpp | 2 +- Marlin/src/gcode/lcd/M0_M1.cpp | 4 +- Marlin/src/gcode/sd/M1001.cpp | 2 - Marlin/src/gcode/stats/M75-M78.cpp | 2 +- Marlin/src/gcode/temp/M303.cpp | 6 +- Marlin/src/inc/Conditionals_post.h | 6 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 20 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 68 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.h | 32 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2874 +++++++++--------- Marlin/src/lcd/e3v2/proui/dwin.h | 349 ++- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 42 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp | 16 +- Marlin/src/lcd/e3v2/proui/dwin_lcd.h | 16 +- Marlin/src/lcd/e3v2/proui/dwin_popup.cpp | 30 +- Marlin/src/lcd/e3v2/proui/dwin_popup.h | 42 +- Marlin/src/lcd/e3v2/proui/dwinui.cpp | 140 +- Marlin/src/lcd/e3v2/proui/dwinui.h | 342 +-- Marlin/src/lcd/e3v2/proui/endstop_diag.cpp | 28 +- Marlin/src/lcd/e3v2/proui/endstop_diag.h | 8 +- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 16 +- Marlin/src/lcd/e3v2/proui/lockscreen.cpp | 34 +- Marlin/src/lcd/e3v2/proui/lockscreen.h | 4 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 412 +-- Marlin/src/lcd/e3v2/proui/menus.h | 198 +- Marlin/src/lcd/e3v2/proui/meshviewer.cpp | 68 +- Marlin/src/lcd/e3v2/proui/meshviewer.h | 14 +- Marlin/src/lcd/e3v2/proui/plot.cpp | 24 +- Marlin/src/lcd/e3v2/proui/plot.h | 4 +- Marlin/src/lcd/e3v2/proui/printstats.cpp | 40 +- Marlin/src/lcd/e3v2/proui/printstats.h | 12 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/module/motion.h | 2 +- Marlin/src/module/probe.cpp | 2 +- Marlin/src/module/settings.cpp | 8 +- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/temperature.cpp | 20 +- 43 files changed, 2456 insertions(+), 2457 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 3b8ee33730f3b..6f5187cc9f39b 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -759,7 +759,7 @@ void unified_bed_leveling::shift_mesh_height() { TERN_(HAS_MARLINUI_MENU, ui.capture()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + 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; @@ -820,7 +820,7 @@ void unified_bed_leveling::shift_mesh_height() { ); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingDone()); + TERN_(DWIN_LCD_PROUI, dwinLevelingDone()); } #endif // HAS_BED_PROBE diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index a1d4d259b7689..db325dee7a085 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -88,7 +88,7 @@ void event_filament_runout(const uint8_t extruder) { #endif TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder))); - TERN_(DWIN_LCD_PROUI, DWIN_FilamentRunout(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); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 5632c6e46721b..5ecb6af66c58c 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -429,7 +429,7 @@ G29_TYPE GcodeSuite::G29() { 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, DWIN_LevelingStart()); + TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); #endif TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); @@ -440,7 +440,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) - HMI_data.BedLevT + hmiData.bedLevT #else LEVELING_BED_TEMP #endif diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index 4bc9ba777a09f..c5e02b91f9bd5 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -143,7 +143,7 @@ void GcodeSuite::G29() { queue.inject(F("G29S2")); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingStart()); - TERN_(DWIN_LCD_PROUI, DWIN_LevelingStart()); + TERN_(DWIN_LCD_PROUI, dwinLevelingStart()); return; } @@ -169,7 +169,7 @@ void GcodeSuite::G29() { // Save Z for the previous mesh position bedlevel.set_zigzag_z(mbl_probe_index - 1, current_position.z); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z)); - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z)); + TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z)); SET_SOFT_ENDSTOP_LOOSE(false); } // If there's another point to sample, move there with optional lift. @@ -236,7 +236,7 @@ void GcodeSuite::G29() { if (parser.seenval('Z')) { bedlevel.z_values[ix][iy] = parser.value_linear_units(); TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); + TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ix, iy, bedlevel.z_values[ix][iy])); } else return echo_not_entered('Z'); diff --git a/Marlin/src/gcode/bedlevel/ubl/M421.cpp b/Marlin/src/gcode/bedlevel/ubl/M421.cpp index ff74f4c6f744f..3a5aa8cb038ca 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/M421.cpp @@ -66,10 +66,10 @@ void GcodeSuite::M421() { else if (!WITHIN(ij.x, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(ij.y, 0, GRID_MAX_POINTS_Y - 1)) SERIAL_ERROR_MSG(STR_ERR_MESH_XY); else { - float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point + float &zval = bedlevel.z_values[ij.x][ij.y]; // Altering this Mesh Point zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0); // N=NAN, Z=NEWVAL, or Q=ADDVAL TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval)); // Ping ExtUI in case it's showing the mesh - TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(ij.x, ij.y, zval)); + TERN_(DWIN_LCD_PROUI, dwinMeshUpdate(ij.x, ij.y, zval)); } } diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index 26e5a468cabc2..3373e143251c1 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -51,7 +51,7 @@ void GcodeSuite::M302() { if (seen_S) { thermalManager.extrude_min_temp = parser.value_celsius(); thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0); - TERN_(DWIN_LCD_PROUI, HMI_data.ExtMinT = thermalManager.extrude_min_temp); + TERN_(DWIN_LCD_PROUI, hmiData.extMinT = thermalManager.extrude_min_temp); } if (parser.seen('P')) diff --git a/Marlin/src/gcode/control/M997.cpp b/Marlin/src/gcode/control/M997.cpp index 74ed8b0d073e8..5ac0ba23bbca4 100644 --- a/Marlin/src/gcode/control/M997.cpp +++ b/Marlin/src/gcode/control/M997.cpp @@ -33,7 +33,7 @@ */ void GcodeSuite::M997() { - TERN_(DWIN_LCD_PROUI, DWIN_RebootScreen()); + TERN_(DWIN_LCD_PROUI, dwinRebootScreen()); flashFirmware(parser.intval('S')); diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 4e4625e9483d4..fcab61b59d92c 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -73,9 +73,9 @@ void GcodeSuite::M0_M1() { ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_USERWAIT)); #elif ENABLED(DWIN_LCD_PROUI) if (parser.string_arg) - DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); + dwinPopupConfirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); else - DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); + dwinPopupConfirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); #else if (parser.string_arg) { diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index c49909646eaaa..a00ca61228454 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -49,8 +49,6 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../../lcd/e3v2/proui/dwin.h" #endif #if ENABLED(HOST_ACTION_COMMANDS) diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 2ff04797eb280..bced97351dacc 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -39,7 +39,7 @@ void GcodeSuite::M75() { startOrResumeJob(); #if ENABLED(DWIN_LCD_PROUI) - if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); + if (!IS_SD_PRINTING()) dwinPrintHeader(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT)); #endif } diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 48eebaa0e4d81..f9f3abc5bd4ea 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -31,7 +31,7 @@ #if ENABLED(EXTENSIBLE_UI) #include "../../lcd/extui/ui_api.h" -#elif ENABLED(DWIN_LCD_PROUI) +#elif ENABLED(PROUI_PID_TUNE) #include "../../lcd/e3v2/proui/dwin.h" #endif @@ -69,7 +69,7 @@ void GcodeSuite::M303() { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_BAD_HEATER_ID)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_BAD_HEATER_ID)); return; } @@ -79,7 +79,7 @@ void GcodeSuite::M303() { const celsius_t temp = seenS ? parser.value_celsius() : default_temp; const bool u = parser.boolval('U'); - TERN_(DWIN_PID_TUNE, DWIN_StartM303(seenC, c, seenS, hid, temp)); + TERN_(PROUI_PID_TUNE, dwinStartM303(seenC, c, seenS, hid, temp)); IF_DISABLED(BUSY_WHILE_HEATING, KEEPALIVE_STATE(NOT_BUSY)); diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 664d4cd544136..8cc3f6bc2db8c 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2386,10 +2386,10 @@ #if ENABLED(DWIN_LCD_PROUI) #if ANY(PIDTEMP, PIDTEMPBED) - #define DWIN_PID_TUNE 1 + #define PROUI_PID_TUNE 1 #endif - #if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) - #define SHOW_TUNING_GRAPH 1 + #if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) + #define PROUI_TUNING_GRAPH 1 #endif #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 0c26a84810992..77de5b93549e4 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -265,14 +265,14 @@ class TextScroller { #if ENABLED(AUTO_BED_LEVELING_UBL) uint8_t tilt_grid = 1; - void manual_value_update(bool undefined=false) { + void manualValueUpdate(bool undefined=false) { gcode.process_subcommands_now( TS(F("M421I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3), undefined ? "N" : "") ); planner.synchronize(); } - bool create_plane_from_mesh() { + bool createPlaneFromMesh() { struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { @@ -312,7 +312,7 @@ class TextScroller { #else - void manual_value_update() { + void manualValueUpdate() { gcode.process_subcommands_now( TS(F("G29I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3)) ); @@ -340,7 +340,7 @@ class TextScroller { } } - float get_max_value() { + float getMaxValue() { float max = __FLT_MIN__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) @@ -349,7 +349,7 @@ class TextScroller { return max; } - float get_min_value() { + float getMinValue() { float min = __FLT_MAX__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) @@ -363,7 +363,7 @@ class TextScroller { const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x, cell_width_px = total_width_px / (GRID_MAX_POINTS_X), cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); - const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); @@ -418,8 +418,8 @@ class TextScroller { void setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead float v1, v2, - v_min = abs(get_min_value()), - v_max = abs(get_max_value()); + v_min = abs(getMinValue()), + v_max = abs(getMaxValue()); if (viewer_asymmetric_range) { if (v_min > 3e+10F) v_min = 0.0000001; if (v_max > 3e+10F) v_max = 0.0000001; @@ -3437,7 +3437,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); else { - if (mesh_conf.create_plane_from_mesh()) break; + if (mesh_conf.createPlaneFromMesh()) break; gcode.process_subcommands_now(F("M420 S1")); planner.synchronize(); audioFeedback(true); @@ -3582,7 +3582,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra if (draw) drawMenuItem(row, ICON_ResumeEEPROM, F("Clear Point Value")); else { - mesh_conf.manual_value_update(true); + mesh_conf.manualValueUpdate(true); redrawMenu(false); } break; diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 4ab98b17116e1..bd2f8a88e6a60 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -63,22 +63,22 @@ #include "dwin_popup.h" #include "bedlevel_tools.h" -BedLevelToolsClass bedLevelTools; +BedLevelTools bedLevelTools; #if ENABLED(USE_GRID_MESHVIEWER) - bool BedLevelToolsClass::viewer_asymmetric_range = false; - bool BedLevelToolsClass::viewer_print_value = false; + bool BedLevelTools::viewer_asymmetric_range = false; + bool BedLevelTools::viewer_print_value = false; #endif -bool BedLevelToolsClass::goto_mesh_value = false; -uint8_t BedLevelToolsClass::mesh_x = 0; -uint8_t BedLevelToolsClass::mesh_y = 0; -uint8_t BedLevelToolsClass::tilt_grid = 1; +bool BedLevelTools::goto_mesh_value = false; +uint8_t BedLevelTools::mesh_x = 0; +uint8_t BedLevelTools::mesh_y = 0; +uint8_t BedLevelTools::tilt_grid = 1; bool drawing_mesh = false; #if ENABLED(AUTO_BED_LEVELING_UBL) - void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { + void BedLevelTools::manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/*=false*/) { MString cmd; cmd.set(F("M421 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3)); if (undefined) cmd += F(" N"); @@ -86,7 +86,7 @@ bool drawing_mesh = false; planner.synchronize(); } - bool BedLevelToolsClass::create_plane_from_mesh() { + bool BedLevelTools::createPlaneFromMesh() { struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { @@ -126,7 +126,7 @@ bool drawing_mesh = false; #else - void BedLevelToolsClass::manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y) { + void BedLevelTools::manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y) { gcode.process_subcommands_now( TS(F("G29 I"), mesh_x, 'J', mesh_y, 'Z', p_float_t(current_position.z, 3)) ); @@ -135,7 +135,7 @@ bool drawing_mesh = false; #endif -void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { +void BedLevelTools::manualMove(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/*=false*/) { gcode.process_subcommands_now(F("G28O")); if (zmove) { planner.synchronize(); @@ -144,48 +144,48 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y, planner.synchronize(); } else { - DWIN_Show_Popup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done.")); - HMI_SaveProcessID(NothingToDo); + dwinShowPopup(ICON_BLTouch, F("Moving to Point"), F("Please wait until done.")); + hmiSaveProcessID(ID_NothingToDo); gcode.process_subcommands_now(TS(F("G0 F300 Z"), p_float_t(Z_CLEARANCE_BETWEEN_PROBES, 3))); gcode.process_subcommands_now(TS(F("G42 F4000 I"), mesh_x, F(" J"), mesh_y)); planner.synchronize(); current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); - HMI_ReturnScreen(); + hmiReturnScreen(); } } // Move / Probe methods. As examples, not yet used. -void BedLevelToolsClass::MoveToXYZ() { - bedLevelTools.goto_mesh_value = true; - bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false); +void BedLevelTools::moveToXYZ() { + goto_mesh_value = true; + manualMove(mesh_x, mesh_y, false); } -void BedLevelToolsClass::MoveToXY() { - bedLevelTools.goto_mesh_value = false; - bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false); +void BedLevelTools::moveToXY() { + goto_mesh_value = false; + manualMove(mesh_x, mesh_y, false); } -void BedLevelToolsClass::MoveToZ() { - bedLevelTools.goto_mesh_value = true; - bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, true); +void BedLevelTools::moveToZ() { + goto_mesh_value = true; + manualMove(mesh_x, mesh_y, true); } -void BedLevelToolsClass::ProbeXY() { +void BedLevelTools::probeXY() { gcode.process_subcommands_now( MString( F("G28O\nG0Z"), uint16_t(Z_CLEARANCE_DEPLOY_PROBE), - F("\nG30X"), p_float_t(bedlevel.get_mesh_x(bedLevelTools.mesh_x), 2), - F("Y"), p_float_t(bedlevel.get_mesh_y(bedLevelTools.mesh_y), 2) + F("\nG30X"), p_float_t(bedlevel.get_mesh_x(mesh_x), 2), + F("Y"), p_float_t(bedlevel.get_mesh_y(mesh_y), 2) ) ); } -void BedLevelToolsClass::mesh_reset() { +void BedLevelTools::meshReset() { ZERO(bedlevel.z_values); TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); } // Accessors -float BedLevelToolsClass::get_max_value() { +float BedLevelTools::getMaxValue() { float max = __FLT_MAX__ * -1; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] > max) @@ -194,7 +194,7 @@ float BedLevelToolsClass::get_max_value() { return max; } -float BedLevelToolsClass::get_min_value() { +float BedLevelTools::getMinValue() { float min = __FLT_MAX__; GRID_LOOP(x, y) { if (!isnan(bedlevel.z_values[x][y]) && bedlevel.z_values[x][y] < min) @@ -204,7 +204,7 @@ float BedLevelToolsClass::get_min_value() { } // Return 'true' if mesh is good and within LCD limits -bool BedLevelToolsClass::meshvalidate() { +bool BedLevelTools::meshValidate() { GRID_LOOP(x, y) { const float v = bedlevel.z_values[x][y]; if (isnan(v) || !WITHIN(v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false; @@ -216,12 +216,12 @@ bool BedLevelToolsClass::meshvalidate() { constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12); - void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) { + void BedLevelTools::drawBedMesh(int16_t selected/*=-1*/, uint8_t gridline_width/*=1*/, uint16_t padding_x/*=8*/, uint16_t padding_y_top/*=(40 + 53 - 7)*/) { drawing_mesh = true; const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x; const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X); const uint16_t cell_height_px = total_width_px / (GRID_MAX_POINTS_Y); - const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + const float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square dwinDrawRectangle(1, COLOR_BG_BLACK, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); @@ -275,8 +275,8 @@ bool BedLevelToolsClass::meshvalidate() { } } - void BedLevelToolsClass::Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead - float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); + void BedLevelTools::setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead + float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), range = _MAX(v_min, v_max); if (v_min > 3e+10f) v_min = 0.0000001; if (v_max > 3e+10f) v_max = 0.0000001; if (range > 3e+10f) range = 0.0000001; diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h index 40652cfc419fe..2e9b66aa30d27 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.h @@ -50,7 +50,7 @@ #define UBL_Z_OFFSET_MIN -3.0 #define UBL_Z_OFFSET_MAX 3.0 -class BedLevelToolsClass { +class BedLevelTools { public: #if ENABLED(USE_GRID_MESHVIEWER) static bool viewer_asymmetric_range; @@ -61,24 +61,24 @@ class BedLevelToolsClass { static uint8_t tilt_grid; #if ENABLED(AUTO_BED_LEVELING_UBL) - static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false); - static bool create_plane_from_mesh(); + static void manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y, bool undefined=false); + static bool createPlaneFromMesh(); #else - static void manual_value_update(const uint8_t mesh_x, const uint8_t mesh_y); + static void manualValueUpdate(const uint8_t mesh_x, const uint8_t mesh_y); #endif - static void manual_move(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false); - static void MoveToXYZ(); - static void MoveToXY(); - static void MoveToZ(); - static void ProbeXY(); - static void mesh_reset(); - static float get_max_value(); - static float get_min_value(); - static bool meshvalidate(); + static void manualMove(const uint8_t mesh_x, const uint8_t mesh_y, bool zmove=false); + static void moveToXYZ(); + static void moveToXY(); + static void moveToZ(); + static void probeXY(); + static void meshReset(); + static float getMaxValue(); + static float getMinValue(); + static bool meshValidate(); #if ENABLED(USE_GRID_MESHVIEWER) - static void Draw_Bed_Mesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7)); - static void Set_Mesh_Viewer_Status(); + static void drawBedMesh(int16_t selected=-1, uint8_t gridline_width=1, uint16_t padding_x=8, uint16_t padding_y_top=(40 + 53 - 7)); + static void setMeshViewerStatus(); #endif }; -extern BedLevelToolsClass bedLevelTools; +extern BedLevelTools bedLevelTools; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 51a53741ef3c2..2e4047e05f45c 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -117,7 +117,7 @@ #include "endstop_diag.h" #endif -#if SHOW_TUNING_GRAPH +#if PROUI_TUNING_GRAPH #include "plot.h" #endif @@ -175,9 +175,9 @@ #endif // Structs -HMI_value_t HMI_value; -HMI_flag_t hmiFlag{0}; -HMI_data_t HMI_data; +hmi_value_t hmiValue; +hmi_flag_t hmiFlag{0}; +hmi_data_t hmiData; enum SelectItem : uint8_t { PAGE_PRINT = 0, @@ -208,110 +208,110 @@ select_t select_page{0}, select_print{0}; bool hash_changed = true; // Flag to know if message status was changed bool blink = false; -uint8_t checkkey = 255, last_checkkey = MainMenu; +uint8_t checkkey = 255, last_checkkey = ID_MainMenu; // New menu system pointers -MenuClass *FileMenu = nullptr; -MenuClass *PrepareMenu = nullptr; +Menu *fileMenu = nullptr; +Menu *prepareMenu = nullptr; #if ENABLED(LCD_BED_TRAMMING) - MenuClass *TrammingMenu = nullptr; + Menu *trammingMenu = nullptr; #endif -MenuClass *MoveMenu = nullptr; -MenuClass *ControlMenu = nullptr; -MenuClass *AdvancedSettings = nullptr; +Menu *moveMenu = nullptr; +Menu *ControlMenu = nullptr; +Menu *AdvancedSettings = nullptr; #if HAS_HOME_OFFSET - MenuClass *HomeOffMenu = nullptr; + Menu *homeOffsetMenu = nullptr; #endif #if HAS_BED_PROBE - MenuClass *ProbeSetMenu = nullptr; -#endif -MenuClass *FilSetMenu = nullptr; -MenuClass *SelectColorMenu = nullptr; -MenuClass *GetColorMenu = nullptr; -MenuClass *TuneMenu = nullptr; -MenuClass *MotionMenu = nullptr; -MenuClass *FilamentMenu = nullptr; + Menu *ProbeSetMenu = nullptr; +#endif +Menu *filSetMenu = nullptr; +Menu *selectColorMenu = nullptr; +Menu *getColorMenu = nullptr; +Menu *tuneMenu = nullptr; +Menu *motionMenu = nullptr; +Menu *filamentMenu = nullptr; #if ENABLED(MESH_BED_LEVELING) - MenuClass *ManualMesh = nullptr; + Menu *manualMesh = nullptr; #endif #if HAS_PREHEAT - MenuClass *PreheatMenu = nullptr; - MenuClass *PreheatHotendMenu = nullptr; + Menu *preheatMenu = nullptr; + Menu *preheatHotendMenu = nullptr; #endif -MenuClass *TemperatureMenu = nullptr; -MenuClass *MaxSpeedMenu = nullptr; -MenuClass *MaxAccelMenu = nullptr; +Menu *temperatureMenu = nullptr; +Menu *maxSpeedMenu = nullptr; +Menu *maxAccelMenu = nullptr; #if HAS_CLASSIC_JERK - MenuClass *MaxJerkMenu = nullptr; + Menu *maxJerkMenu = nullptr; #endif -MenuClass *StepsMenu = nullptr; +Menu *stepsMenu = nullptr; #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - MenuClass *HotendMPCMenu = nullptr; + Menu *hotendMPCMenu = nullptr; #endif #if ENABLED(PIDTEMP) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) - MenuClass *HotendPIDMenu = nullptr; + Menu *hotendPIDMenu = nullptr; #endif #if ENABLED(PIDTEMPBED) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) - MenuClass *BedPIDMenu = nullptr; + Menu *bedPIDMenu = nullptr; #endif #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - MenuClass *CaseLightMenu = nullptr; + Menu *caseLightMenu = nullptr; #endif #if ENABLED(LED_CONTROL_MENU) - MenuClass *LedControlMenu = nullptr; + Menu *ledControlMenu = nullptr; #endif #if HAS_BED_PROBE - MenuClass *ZOffsetWizMenu = nullptr; + Menu *zOffsetWizMenu = nullptr; #endif #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - MenuClass *HomingMenu = nullptr; + Menu *homingMenu = nullptr; #endif #if ENABLED(FWRETRACT) - MenuClass *FWRetractMenu = nullptr; + Menu *fwRetractMenu = nullptr; #endif #if HAS_MESH - MenuClass *MeshMenu = nullptr; + Menu *meshMenu = nullptr; #if ENABLED(MESH_EDIT_MENU) - MenuClass *EditMeshMenu = nullptr; + Menu *editMeshMenu = nullptr; #endif #endif #if ENABLED(SHAPING_MENU) - MenuClass *InputShapingMenu = nullptr; + Menu *inputShapingMenu = nullptr; #endif #if HAS_TRINAMIC_CONFIG - MenuClass *TrinamicConfigMenu = nullptr; + Menu *trinamicConfigMenu = nullptr; #endif // Updatable menuitems pointers -MenuItemClass *HotendTargetItem = nullptr; -MenuItemClass *BedTargetItem = nullptr; -MenuItemClass *FanSpeedItem = nullptr; -MenuItemClass *MMeshMoveZItem = nullptr; -MenuItemClass *EditZValueItem = nullptr; +MenuItem *hotendTargetItem = nullptr; +MenuItem *bedTargetItem = nullptr; +MenuItem *fanSpeedItem = nullptr; +MenuItem *mMeshMoveZItem = nullptr; +MenuItem *editZValueItem = nullptr; -bool Printing() { return printingIsActive() || printingIsPaused(); } -bool SD_Printing() { return Printing() && IS_SD_FILE_OPEN(); } -bool Host_Printing() { return Printing() && !IS_SD_FILE_OPEN(); } +bool isPrinting() { return printingIsActive() || printingIsPaused(); } +bool sdPrinting() { return isPrinting() && IS_SD_FILE_OPEN(); } +bool Host_Printing() { return isPrinting() && !IS_SD_FILE_OPEN(); } #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 -inline bool HMI_IsChinese() { return hmiFlag.language == DWIN_CHINESE; } +inline bool hmiIsChinese() { return hmiFlag.language == DWIN_CHINESE; } -void HMI_SetLanguageCache() { - dwinJPGCacheTo1(HMI_IsChinese() ? Language_Chinese : Language_English); +void hmiSetLanguageCache() { + dwinJPGCacheTo1(hmiIsChinese() ? Language_Chinese : Language_English); } -void HMI_SetLanguage() { +void hmiSetLanguage() { #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language)); #endif - HMI_SetLanguageCache(); + hmiSetLanguageCache(); } -void HMI_ToggleLanguage() { - hmiFlag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; - HMI_SetLanguageCache(); +void hmiToggleLanguage() { + hmiFlag.language = hmiIsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; + hmiSetLanguageCache(); #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language)); #endif @@ -324,15 +324,15 @@ void HMI_ToggleLanguage() { typedef struct { uint16_t x, y[2], w, h; } text_info_t; void ICON_Button(const bool selected, const int iconid, const frame_rect_t &ico, const text_info_t (&txt), FSTR_P caption) { - DWINUI::Draw_IconWB(iconid + selected, ico.x, ico.y); - if (selected) DWINUI::Draw_Box(0, HMI_data.Highlight_Color, ico); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, txt.x, txt.y[selected], txt.x + txt.w - 1, txt.y[selected] + txt.h - 1, ico.x + (ico.w - txt.w) / 2, (ico.y + ico.h - 25) - txt.h/2); + DWINUI::drawIconWB(iconid + selected, ico.x, ico.y); + if (selected) DWINUI::drawBox(0, hmiData.colorHighlight, ico); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, txt.x, txt.y[selected], txt.x + txt.w - 1, txt.y[selected] + txt.h - 1, ico.x + (ico.w - txt.w) / 2, (ico.y + ico.h - 25) - txt.h/2); } else { const uint16_t x = ico.x + (ico.w - strlen_P(FTOP(caption)) * DWINUI::fontWidth()) / 2, y = (ico.y + ico.h - 20) - DWINUI::fontHeight() / 2; - DWINUI::Draw_String(x, y, caption); + DWINUI::drawString(x, y, caption); } } @@ -409,83 +409,83 @@ void ICON_Stop() { } // -//PopUps +// PopUps // -void Popup_window_PauseOrStop() { - if (HMI_IsChinese()) { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150); - else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150); - DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150); - DWINUI::Draw_IconWB(ICON_Confirm_C, 26, 280); - DWINUI::Draw_IconWB(ICON_Cancel_C, 146, 280); - Draw_Select_Highlight(true); +void popupPauseOrStop() { + if (hmiIsChinese()) { + DWINUI::clearMainArea(); + drawPopupBkgd(); + if (select_print.now == PRINT_PAUSE_RESUME) dwinFrameAreaCopy(1, 237, 338, 269, 356, 98, 150); + else if (select_print.now == PRINT_STOP) dwinFrameAreaCopy(1, 221, 320, 253, 336, 98, 150); + dwinFrameAreaCopy(1, 220, 304, 264, 319, 130, 150); + DWINUI::drawIconWB(ICON_Confirm_C, 26, 280); + DWINUI::drawIconWB(ICON_Cancel_C, 146, 280); + drawSelectHighlight(true); dwinUpdateLCD(); } else - DWIN_Popup_ConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); + dwinPopupConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); } #if HAS_HOTEND - void Popup_Window_ETempTooLow() { - if (HMI_IsChinese()) { - HMI_SaveProcessID(WaitResponse); - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - DWINUI::Draw_Icon(ICON_TempTooLow, 102, 105); - DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240); - DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 102, 240); - DWINUI::Draw_IconWB(ICON_Confirm_C, 86, 280); + void popupETempTooLow() { + if (hmiIsChinese()) { + hmiSaveProcessID(ID_WaitResponse); + DWINUI::clearMainArea(); + drawPopupBkgd(); + DWINUI::drawIcon(ICON_TempTooLow, 102, 105); + dwinFrameAreaCopy(1, 103, 371, 136, 386, 69, 240); + dwinFrameAreaCopy(1, 170, 371, 270, 386, 102, 240); + DWINUI::drawIconWB(ICON_Confirm_C, 86, 280); dwinUpdateLCD(); } else - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); } #endif #if HAS_HOTEND || HAS_HEATED_BED void dwinPopupTemperature(const bool toohigh) { - HMI_SaveProcessID(WaitResponse); - if (HMI_IsChinese()) { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); + hmiSaveProcessID(ID_WaitResponse); + if (hmiIsChinese()) { + DWINUI::clearMainArea(); + drawPopupBkgd(); if (toohigh) { - DWINUI::Draw_Icon(ICON_TempTooHigh, 102, 165); - DWIN_Frame_AreaCopy(1, 103, 371, 237, 386, 52, 285); - DWIN_Frame_AreaCopy(1, 151, 389, 185, 402, 187, 285); - DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310); + DWINUI::drawIcon(ICON_TempTooHigh, 102, 165); + dwinFrameAreaCopy(1, 103, 371, 237, 386, 52, 285); + dwinFrameAreaCopy(1, 151, 389, 185, 402, 187, 285); + dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } else { - DWINUI::Draw_Icon(ICON_TempTooLow, 102, 165); - DWIN_Frame_AreaCopy(1, 103, 371, 270, 386, 52, 285); - DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310); + DWINUI::drawIcon(ICON_TempTooLow, 102, 165); + dwinFrameAreaCopy(1, 103, 371, 270, 386, 52, 285); + dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } } else - DWIN_Show_Popup(toohigh ? ICON_TempTooHigh : ICON_TempTooLow, F("Nozzle or Bed temperature"), toohigh ? F("is too high") : F("is too low"), BTN_Continue); + dwinShowPopup(toohigh ? ICON_TempTooHigh : ICON_TempTooLow, F("Nozzle or Bed temperature"), toohigh ? F("is too high") : F("is too low"), BTN_Continue); } #endif // // Draw status line // -void DWIN_DrawStatusLine(const char *text) { - dwinDrawRectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text); +void dwinDrawStatusLine(const char *text) { + dwinDrawRectangle(1, hmiData.colorStatusBg, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + if (text) DWINUI::drawCenteredString(hmiData.colorStatusTxt, STATUS_Y + 2, text); } -void DWIN_DrawStatusLine(FSTR_P fstr) { DWIN_DrawStatusLine(FTOP(fstr)); } +void dwinDrawStatusLine(FSTR_P fstr) { dwinDrawStatusLine(FTOP(fstr)); } // Clear & reset status line -void DWIN_ResetStatusLine() { +void dwinResetStatusLine() { ui.status_message.clear(); - DWIN_CheckStatusMessage(); + dwinCheckStatusMessage(); } // Djb2 hash algorithm -uint32_t GetHash(char * str) { +uint32_t getHash(char * str) { uint32_t hash = 5381; char c; while ((c = *str++)) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ @@ -493,14 +493,14 @@ uint32_t GetHash(char * str) { } // Check for a change in the status message -void DWIN_CheckStatusMessage() { +void dwinCheckStatusMessage() { static MString<>::hash_t old_hash = 0x0000; const MString<>::hash_t hash = ui.status_message.hash(); hash_changed = hash != old_hash; old_hash = hash; } -void DWIN_DrawStatusMessage() { +void dwinDrawStatusMessage() { #if ENABLED(STATUS_MESSAGE_SCROLLING) // Get the UTF8 character count of the string @@ -509,7 +509,7 @@ void DWIN_DrawStatusMessage() { // If the string fits the status line do not scroll it if (slen <= LCD_WIDTH) { if (hash_changed) { - DWIN_DrawStatusLine(ui.status_message); + dwinDrawStatusLine(ui.status_message); hash_changed = false; } } @@ -520,18 +520,18 @@ void DWIN_DrawStatusMessage() { // and the string remaining length uint8_t rlen; const char *stat = MarlinUI::status_and_len(rlen); - dwinDrawRectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - DWINUI::MoveTo(0, STATUS_Y + 2); - DWINUI::Draw_String(HMI_data.StatusTxt_Color, stat, LCD_WIDTH); + dwinDrawRectangle(1, hmiData.colorStatusBg, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + DWINUI::moveTo(0, STATUS_Y + 2); + DWINUI::drawString(hmiData.colorStatusTxt, stat, LCD_WIDTH); // If the string doesn't completely fill the line... if (rlen < LCD_WIDTH) { - DWINUI::Draw_Char(HMI_data.StatusTxt_Color, '.'); // Always at 1+ spaces left, draw a dot + DWINUI::drawChar(hmiData.colorStatusTxt, '.'); // Always at 1+ spaces left, draw a dot uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters if (--chars) { // Draw a second dot if there's space - DWINUI::Draw_Char(HMI_data.StatusTxt_Color, '.'); + DWINUI::drawChar(hmiData.colorStatusTxt, '.'); if (--chars) - DWINUI::Draw_String(HMI_data.StatusTxt_Color, ui.status_message, chars); // Print a second copy of the message + DWINUI::drawString(hmiData.colorStatusTxt, ui.status_message, chars); // Print a second copy of the message } } MarlinUI::advance_status_scroll(); @@ -541,147 +541,147 @@ void DWIN_DrawStatusMessage() { if (hash_changed) { ui.status_message.trunc(LCD_WIDTH); - DWIN_DrawStatusLine(ui.status_message); + dwinDrawStatusLine(ui.status_message); hash_changed = false; } #endif } -void Draw_Print_Labels() { - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 0, 72, 63, 86, 41, 173); // Printing Time - DWIN_Frame_AreaCopy(1, 65, 72, 128, 86, 176, 173); // Remain +void drawPrintLabels() { + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 0, 72, 63, 86, 41, 173); // Printing Time + dwinFrameAreaCopy(1, 65, 72, 128, 86, 176, 173); // Remain } else { - DWINUI::Draw_String( 46, 173, GET_TEXT_F(MSG_INFO_PRINT_TIME)); - DWINUI::Draw_String(181, 173, GET_TEXT_F(MSG_REMAINING_TIME)); + DWINUI::drawString( 46, 173, GET_TEXT_F(MSG_INFO_PRINT_TIME)); + DWINUI::drawString(181, 173, GET_TEXT_F(MSG_REMAINING_TIME)); } } -void Draw_Print_ProgressBar() { +void drawPrintProgressBar() { const uint8_t _percent_done = ui.get_progress_percent(); - DWINUI::Draw_IconWB(ICON_Bar, 15, 93); - dwinDrawRectangle(1, HMI_data.Barfill_Color, 16 + _percent_done * 240 / 100, 93, 256, 113); - DWINUI::Draw_Int(HMI_data.PercentTxt_Color, HMI_data.Background_Color, 3, 117, 133, _percent_done); - DWINUI::Draw_String(HMI_data.PercentTxt_Color, 142, 133, F("%")); + DWINUI::drawIconWB(ICON_Bar, 15, 93); + dwinDrawRectangle(1, hmiData.colorBarfill, 16 + _percent_done * 240 / 100, 93, 256, 113); + DWINUI::drawInt(hmiData.colorPercentTxt, hmiData.colorBackground, 3, 117, 133, _percent_done); + DWINUI::drawString(hmiData.colorPercentTxt, 142, 133, F("%")); } -void Draw_Print_ProgressElapsed() { +void drawPrintProgressElapsed() { MString<12> buf; duration_t elapsed = print_job_timer.duration(); // Print timer buf.setf(F("%02i:%02i "), uint16_t(elapsed.value / 3600), (uint16_t(elapsed.value) % 3600) / 60); - DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 47, 192, buf); + DWINUI::drawString(hmiData.colorText, hmiData.colorBackground, 47, 192, buf); } #if ENABLED(SHOW_REMAINING_TIME) - void Draw_Print_ProgressRemain() { + void drawPrintProgressRemain() { MString<12> buf; buf.setf(F("%02i:%02i "), _remain_time / 3600, (_remain_time % 3600) / 60); - DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 181, 192, buf); + DWINUI::drawString(hmiData.colorText, hmiData.colorBackground, 181, 192, buf); } #endif void ICON_ResumeOrPause() { - if (checkkey == PrintProcess) (print_job_timer.isPaused() || hmiFlag.pause_flag) ? ICON_Resume() : ICON_Pause(); + if (checkkey == ID_PrintProcess) (print_job_timer.isPaused() || hmiFlag.pause_flag) ? ICON_Resume() : ICON_Pause(); } // Update filename on print -void DWIN_Print_Header(const char *text = nullptr) { +void dwinPrintHeader(const char *text = nullptr) { static char headertxt[31] = ""; // Print header text if (text) { const int8_t size = _MIN(30U, strlen_P(text)); for (uint8_t i = 0; i < size; ++i) headertxt[i] = text[i]; headertxt[size] = '\0'; } - if (checkkey == PrintProcess || checkkey == PrintDone) { - dwinDrawRectangle(1, HMI_data.Background_Color, 0, 60, DWIN_WIDTH, 60+16); - DWINUI::Draw_CenteredString(60, headertxt); + if (checkkey == ID_PrintProcess || checkkey == ID_PrintDone) { + dwinDrawRectangle(1, hmiData.colorBackground, 0, 60, DWIN_WIDTH, 60+16); + DWINUI::drawCenteredString(60, headertxt); } } -void Draw_PrintProcess() { - if (HMI_IsChinese()) - Title.FrameCopy(30, 1, 42, 14); // "Printing" +void drawPrintProcess() { + if (hmiIsChinese()) + title.frameCopy(30, 1, 42, 14); // "Printing" else - Title.ShowCaption(GET_TEXT_F(MSG_PRINTING)); - DWINUI::ClearMainArea(); - DWIN_Print_Header(nullptr); - Draw_Print_Labels(); - DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); - DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - TERN_(SHOW_REMAINING_TIME, Draw_Print_ProgressRemain()); + title.showCaption(GET_TEXT_F(MSG_PRINTING)); + DWINUI::clearMainArea(); + dwinPrintHeader(nullptr); + drawPrintLabels(); + DWINUI::drawIcon(ICON_PrintTime, 15, 173); + DWINUI::drawIcon(ICON_RemainTime, 150, 171); + drawPrintProgressBar(); + drawPrintProgressElapsed(); + TERN_(SHOW_REMAINING_TIME, drawPrintProgressRemain()); ICON_Tune(); ICON_ResumeOrPause(); ICON_Stop(); } -void Goto_PrintProcess() { - if (checkkey == PrintProcess) +void gotoPrintProcess() { + if (checkkey == ID_PrintProcess) ICON_ResumeOrPause(); else { - checkkey = PrintProcess; - Draw_PrintProcess(); - TERN_(DASH_REDRAW, DWIN_RedrawDash()); + checkkey = ID_PrintProcess; + drawPrintProcess(); + TERN_(DASH_REDRAW, dwinRedrawDash()); } dwinUpdateLCD(); } -void Draw_PrintDone() { +void drawPrintDone() { TERN_(SET_PROGRESS_PERCENT, ui.set_progress_done()); TERN_(SET_REMAINING_TIME, ui.reset_remaining_time()); - Title.ShowCaption(GET_TEXT_F(MSG_PRINT_DONE)); - DWINUI::ClearMainArea(); - DWIN_Print_Header(nullptr); + title.showCaption(GET_TEXT_F(MSG_PRINT_DONE)); + DWINUI::clearMainArea(); + dwinPrintHeader(nullptr); #if HAS_GCODE_PREVIEW const bool haspreview = Preview_Valid(); if (haspreview) { Preview_Show(); - DWINUI::Draw_Button(BTN_Continue, 86, 295); + DWINUI::drawButton(BTN_Continue, 86, 295); } #else constexpr bool haspreview = false; #endif if (!haspreview) { - Draw_Print_ProgressBar(); - Draw_Print_Labels(); - DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); - DWINUI::Draw_Icon(ICON_RemainTime, 150, 171); - Draw_Print_ProgressElapsed(); - TERN_(SHOW_REMAINING_TIME, Draw_Print_ProgressRemain()); - DWINUI::Draw_Button(BTN_Continue, 86, 273); + drawPrintProgressBar(); + drawPrintLabels(); + DWINUI::drawIcon(ICON_PrintTime, 15, 173); + DWINUI::drawIcon(ICON_RemainTime, 150, 171); + drawPrintProgressElapsed(); + TERN_(SHOW_REMAINING_TIME, drawPrintProgressRemain()); + DWINUI::drawButton(BTN_Continue, 86, 273); } } -void Goto_PrintDone() { +void gotoPrintDone() { wait_for_user = true; - if (checkkey != PrintDone) { - checkkey = PrintDone; - Draw_PrintDone(); + if (checkkey != ID_PrintDone) { + checkkey = ID_PrintDone; + drawPrintDone(); dwinUpdateLCD(); } } -void Draw_Main_Menu() { - DWINUI::ClearMainArea(); - if (HMI_IsChinese()) - Title.FrameCopy(2, 2, 26, 13); // "Home" etc +void drawMainMenu() { + DWINUI::clearMainArea(); + if (hmiIsChinese()) + title.frameCopy(2, 2, 26, 13); // "Home" etc else - Title.ShowCaption(MACHINE_NAME); - DWINUI::Draw_Icon(ICON_LOGO, 71, 52); // CREALITY logo + title.showCaption(MACHINE_NAME); + DWINUI::drawIcon(ICON_LOGO, 71, 52); // CREALITY logo ICON_Print(); ICON_Prepare(); ICON_Control(); ICON_AdvSettings(); } -void Goto_Main_Menu() { - if (checkkey == MainMenu) return; - checkkey = MainMenu; - Draw_Main_Menu(); +void gotoMainMenu() { + if (checkkey == ID_MainMenu) return; + checkkey = ID_MainMenu; + drawMainMenu(); dwinUpdateLCD(); } @@ -706,74 +706,74 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y, if (force || changed || draw_qmark || draw_empty) { if (blink && draw_qmark) - DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F(" - ? -")); + DWINUI::drawString(hmiData.colorCoordinate, hmiData.colorBackground, x, y, F(" - ? -")); else if (blink && draw_empty) - DWINUI::Draw_String(HMI_data.Coordinate_Color, HMI_data.Background_Color, x, y, F(" ")); + DWINUI::drawString(hmiData.colorCoordinate, hmiData.colorBackground, x, y, F(" ")); else - DWINUI::Draw_Signed_Float(HMI_data.Coordinate_Color, HMI_data.Background_Color, 3, 2, x, y, p); + DWINUI::drawSignedFloat(hmiData.colorCoordinate, hmiData.colorBackground, 3, 2, x, y, p); } } -void _draw_iconblink(bool &flag, const bool sensor, const uint8_t icon1, const uint8_t icon2, const uint16_t x, const uint16_t y) { +void _drawIconBlink(bool &flag, const bool sensor, const uint8_t icon1, const uint8_t icon2, const uint16_t x, const uint16_t y) { #if DISABLED(NO_BLINK_IND) if (flag != sensor) { flag = sensor; if (!flag) { - dwinDrawBox(1, HMI_data.Background_Color, x, y, 20, 20); - DWINUI::Draw_Icon(icon1, x, y); + dwinDrawBox(1, hmiData.colorBackground, x, y, 20, 20); + DWINUI::drawIcon(icon1, x, y); } } if (flag) { - dwinDrawBox(1, blink ? HMI_data.SplitLine_Color : HMI_data.Background_Color, x, y, 20, 20); - DWINUI::Draw_Icon(icon2, x, y); + dwinDrawBox(1, blink ? hmiData.colorSplitLine : hmiData.colorBackground, x, y, 20, 20); + DWINUI::drawIcon(icon2, x, y); } #else if (flag != sensor) { flag = sensor; - dwinDrawBox(1, HMI_data.Background_Color, x, y, 20, 20); - DWINUI::Draw_Icon(flag ? icon2 : icon1, x, y); + dwinDrawBox(1, hmiData.colorBackground, x, y, 20, 20); + DWINUI::drawIcon(flag ? icon2 : icon1, x, y); } #endif } -void _draw_ZOffsetIcon() { +void _drawZOffsetIcon() { #if HAS_LEVELING static bool _leveling_active = false; - _draw_iconblink(_leveling_active, planner.leveling_active, ICON_Zoffset, ICON_SetZOffset, 186, 416); + _drawIconBlink(_leveling_active, planner.leveling_active, ICON_Zoffset, ICON_SetZOffset, 186, 416); #else - DWINUI::Draw_Icon(ICON_Zoffset, 187, 416); + DWINUI::drawIcon(ICON_Zoffset, 187, 416); #endif } -void _draw_feedrate() { +void _drawFeedrate() { #if ENABLED(SHOW_SPEED_IND) int16_t _value; if (blink) { _value = feedrate_percentage; - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 116 + 4 * STAT_CHR_W + 2, 384, F(" %")); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 4 * STAT_CHR_W + 2, 384, F(" %")); } else { _value = CEIL(feedrate_mm_s * feedrate_percentage / 100); - dwinDrawBox(1, HMI_data.Background_Color, 116 + 5 * STAT_CHR_W + 2, 384, 20, 20); + dwinDrawBox(1, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 384, 20, 20); } - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, _value); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 384, _value); #else static int16_t _feedrate = 100; if (_feedrate != feedrate_percentage) { _feedrate = feedrate_percentage; - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, _feedrate); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 384, _feedrate); } #endif } -void _draw_xyz_position(const bool force) { +void _drawXYZPosition(const bool force) { _update_axis_value(X_AXIS, 27, 459, force); _update_axis_value(Y_AXIS, 112, 459, force); _update_axis_value(Z_AXIS, 197, 459, force); } -void update_variable() { - _draw_xyz_position(false); +void updateVariable() { + _drawXYZPosition(false); #if HAS_HOTEND static celsius_t _hotendtemp = 0, _hotendtarget = 0; const celsius_t hc = thermalManager.wholeDegHotend(0), @@ -798,49 +798,49 @@ void update_variable() { if (_new_fanspeed) _fanspeed = thermalManager.fan_speed[0]; #endif - if (IsMenu(TuneMenu) || IsMenu(TemperatureMenu)) { + if (isMenu(tuneMenu) || isMenu(temperatureMenu)) { // Tune page temperature update - TERN_(HAS_HOTEND, if (_new_hotend_target) HotendTargetItem->redraw()); - TERN_(HAS_HEATED_BED, if (_new_bed_target) BedTargetItem->redraw()); - TERN_(HAS_FAN, if (_new_fanspeed) FanSpeedItem->redraw()); + TERN_(HAS_HOTEND, if (_new_hotend_target) hotendTargetItem->redraw()); + TERN_(HAS_HEATED_BED, if (_new_bed_target) bedTargetItem->redraw()); + TERN_(HAS_FAN, if (_new_fanspeed) fanSpeedItem->redraw()); } // Bottom temperature update #if HAS_HOTEND if (_new_hotend_temp) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 384, _hotendtemp); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 384, _hotendtemp); if (_new_hotend_target) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 384, _hotendtarget); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 384, _hotendtarget); static int16_t _flow = planner.flow_percentage[0]; if (_flow != planner.flow_percentage[0]) { _flow = planner.flow_percentage[0]; - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 417, _flow); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 417, _flow); } #endif #if HAS_HEATED_BED if (_new_bed_temp) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 417, _bedtemp); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 417, _bedtemp); if (_new_bed_target) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, _bedtarget); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 417, _bedtarget); #endif - _draw_feedrate(); + _drawFeedrate(); #if HAS_FAN if (_new_fanspeed) - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, _fanspeed); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 195 + 2 * STAT_CHR_W, 384, _fanspeed); #endif static float _offset = 0; if (BABY_Z_VAR != _offset) { _offset = BABY_Z_VAR; - DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 2, 2, 204, 417, _offset); + DWINUI::drawSignedFloat(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 2, 2, 204, 417, _offset); } - _draw_ZOffsetIcon(); + _drawZOffsetIcon(); } /** @@ -850,19 +850,19 @@ void update_variable() { bool DWIN_lcd_sd_status = false; #if ENABLED(MEDIASORT_MENU_ITEM) - void SetMediaSort() { - Toggle_Chkb_Line(HMI_data.MediaSort); - card.setSortOn(HMI_data.MediaSort); + void setMediaSort() { + toggleCheckboxLine(hmiData.mediaSort); + card.setSortOn(hmiData.mediaSort); } #endif -void SetMediaAutoMount() { Toggle_Chkb_Line(HMI_data.MediaAutoMount); } +void setMediaAutoMount() { toggleCheckboxLine(hmiData.mediaAutoMount); } inline uint16_t nr_sd_menu_items() { return _MIN(card.get_num_items() + !card.flag.workDirIsRoot, MENU_MAX_ITEMS); } -void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { +void makeNameWithoutExt(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { size_t pos = strlen(src); // Index of ending nul // For files, remove the extension @@ -886,52 +886,53 @@ void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) while (pos--) dst[pos] = src[pos]; } -void SDCard_Up() { +void sdCardUp() { card.cdup(); DWIN_lcd_sd_status = false; // On next DWIN_Update } -void SDCard_Folder(char * const dirname) { +void sdCardFolder(char * const dirname) { card.cd(dirname); DWIN_lcd_sd_status = false; // On next DWIN_Update } void onClickSDItem() { const uint16_t hasUpDir = !card.flag.workDirIsRoot; - if (hasUpDir && CurrentMenu->selected == 1) return SDCard_Up(); + if (hasUpDir && currentMenu->selected == 1) return sdCardUp(); else { - const uint16_t filenum = CurrentMenu->selected - 1 - hasUpDir; + const uint16_t filenum = currentMenu->selected - 1 - hasUpDir; card.selectFileByIndexSorted(filenum); // Enter that folder! - if (card.flag.filenameIsDir) return SDCard_Folder(card.filename); + if (card.flag.filenameIsDir) return sdCardFolder(card.filename); if (card.fileIsBinary()) - return DWIN_Popup_Confirm(ICON_Error, F("Please check filenames"), F("Only G-code can be printed")); + return dwinPopupConfirm(ICON_Error, F("Please check filenames"), F("Only G-code can be printed")); else { - DWIN_Print_Header(card.longest_filename()); // Save filename - return Goto_ConfirmToPrint(); + dwinPrintHeader(card.longest_filename()); // Save filename + return gotoConfirmToPrint(); } } } #if ENABLED(SCROLL_LONG_FILENAMES) + char shift_name[LONG_FILENAME_LENGTH + 1] = ""; - void Draw_SDItem_Shifted(uint8_t &shift) { + void drawSDItemShifted(uint8_t &shift) { // Shorten to the available space const size_t lastchar = shift + MENU_CHAR_LIMIT; const char c = shift_name[lastchar]; shift_name[lastchar] = '\0'; - const uint8_t row = FileMenu->line(); - Erase_Menu_Text(row); - Draw_Menu_Line(row, 0, &shift_name[shift]); + const uint8_t row = fileMenu->line(); + eraseMenuText(row); + drawMenuLine(row, 0, &shift_name[shift]); shift_name[lastchar] = c; } - void FileMenuIdle(bool reset=false) { + void fileMenuIdle(bool reset=false) { static bool hasUpDir = false; static uint8_t last_itemselected = 0; static int8_t shift_amt = 0, shift_len = 0; @@ -940,78 +941,81 @@ void onClickSDItem() { hasUpDir = !card.flag.workDirIsRoot; // Is a SubDir return; } - const uint8_t selected = FileMenu->selected; + const uint8_t selected = fileMenu->selected; if (last_itemselected != selected) { - if (last_itemselected >= 1 + hasUpDir) FileMenu->Items()[last_itemselected]->redraw(true); + if (last_itemselected >= 1 + hasUpDir) fileMenu->items()[last_itemselected]->redraw(true); last_itemselected = selected; if (selected >= 1 + hasUpDir) { const int8_t filenum = selected - 1 - hasUpDir; // Skip "Back" and ".." card.selectFileByIndexSorted(filenum); - make_name_without_ext(shift_name, card.longest_filename(), LONG_FILENAME_LENGTH); + makeNameWithoutExt(shift_name, card.longest_filename(), LONG_FILENAME_LENGTH); shift_len = strlen(shift_name); shift_amt = 0; } } else if ((selected >= 1 + hasUpDir) && (shift_len > MENU_CHAR_LIMIT)) { uint8_t shift_new = _MIN(shift_amt + 1, shift_len - MENU_CHAR_LIMIT); // Try to shift by... - Draw_SDItem_Shifted(shift_new); // Draw the item + drawSDItemShifted(shift_new); // Draw the item if (shift_new == shift_amt) // Scroll reached the end shift_new = -1; // Reset shift_amt = shift_new; // Set new scroll } } -#else + +#else // !SCROLL_LONG_FILENAMES + char shift_name[FILENAME_LENGTH + 1] = ""; + #endif -void onDrawFileName(MenuItemClass* menuitem, int8_t line) { +void onDrawFileName(MenuItem* menuitem, int8_t line) { const bool is_subdir = !card.flag.workDirIsRoot; if (is_subdir && menuitem->pos == 1) { - Draw_Menu_Line(line, ICON_Folder, ".."); + drawMenuLine(line, ICON_Folder, ".."); } else { uint8_t icon; card.selectFileByIndexSorted(menuitem->pos - is_subdir - 1); - make_name_without_ext(shift_name, card.longest_filename()); + makeNameWithoutExt(shift_name, card.longest_filename()); icon = card.flag.filenameIsDir ? ICON_Folder : card.fileIsBinary() ? ICON_Binary : ICON_File; - Draw_Menu_Line(line, icon, shift_name); + drawMenuLine(line, icon, shift_name); } } -void Draw_Print_File_Menu() { - checkkey = Menu; +void drawPrintFileMenu() { + checkkey = ID_Menu; if (card.isMounted()) { - if (SET_MENU(FileMenu, MSG_MEDIA_MENU, nr_sd_menu_items() + 1)) { - BACK_ITEM(Goto_Main_Menu); + if (SET_MENU(fileMenu, MSG_MEDIA_MENU, nr_sd_menu_items() + 1)) { + BACK_ITEM(gotoMainMenu); for (uint8_t i = 0; i < nr_sd_menu_items(); ++i) { - MenuItemAdd(onDrawFileName, onClickSDItem); + menuItemAdd(onDrawFileName, onClickSDItem); } } - UpdateMenu(FileMenu); - TERN_(DASH_REDRAW, DWIN_RedrawDash()); + updateMenu(fileMenu); + TERN_(DASH_REDRAW, dwinRedrawDash()); } else { - if (SET_MENU(FileMenu, MSG_MEDIA_MENU, 1)) BACK_ITEM(Goto_Main_Menu); - UpdateMenu(FileMenu); - dwinDrawRectangle(1, HMI_data.AlertBg_Color, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - DWINUI::Draw_CenteredString(font12x24, HMI_data.AlertTxt_Color, MBASE(3), GET_TEXT_F(MSG_MEDIA_NOT_INSERTED)); + if (SET_MENU(fileMenu, MSG_MEDIA_MENU, 1)) BACK_ITEM(gotoMainMenu); + updateMenu(fileMenu); + dwinDrawRectangle(1, hmiData.colorAlertBg, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + DWINUI::drawCenteredString(font12x24, hmiData.colorAlertTxt, MBASE(3), GET_TEXT_F(MSG_MEDIA_NOT_INSERTED)); } - TERN_(SCROLL_LONG_FILENAMES, FileMenuIdle(true)); + TERN_(SCROLL_LONG_FILENAMES, fileMenuIdle(true)); } // // Watch for media mount / unmount // -void HMI_SDCardUpdate() { +void hmiSDCardUpdate() { if (hmiFlag.home_flag) return; if (DWIN_lcd_sd_status != card.isMounted()) { DWIN_lcd_sd_status = card.isMounted(); - ResetMenu(FileMenu); - if (IsMenu(FileMenu)) { - CurrentMenu = nullptr; - Draw_Print_File_Menu(); + resetMenu(fileMenu); + if (isMenu(fileMenu)) { + currentMenu = nullptr; + drawPrintFileMenu(); } - if (!DWIN_lcd_sd_status && SD_Printing()) ui.abort_print(); // Media removed while printing + if (!DWIN_lcd_sd_status && sdPrinting()) ui.abort_print(); // Media removed while printing } } @@ -1019,80 +1023,80 @@ void HMI_SDCardUpdate() { * Dash board and indicators */ -void DWIN_Draw_Dashboard() { +void dwinDrawDashboard() { - dwinDrawRectangle(1, HMI_data.Background_Color, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1); - dwinDrawRectangle(1, HMI_data.SplitLine_Color, 0, 449, DWIN_WIDTH, 451); + dwinDrawRectangle(1, hmiData.colorBackground, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1); + dwinDrawRectangle(1, hmiData.colorSplitLine, 0, 449, DWIN_WIDTH, 451); - DWINUI::Draw_Icon(ICON_MaxSpeedX, 10, 456); - DWINUI::Draw_Icon(ICON_MaxSpeedY, 95, 456); - DWINUI::Draw_Icon(ICON_MaxSpeedZ, 180, 456); - _draw_xyz_position(true); + DWINUI::drawIcon(ICON_MaxSpeedX, 10, 456); + DWINUI::drawIcon(ICON_MaxSpeedY, 95, 456); + DWINUI::drawIcon(ICON_MaxSpeedZ, 180, 456); + _drawXYZPosition(true); #if HAS_HOTEND - DWINUI::Draw_Icon(ICON_HotendTemp, 10, 383); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 384, thermalManager.wholeDegHotend(0)); - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); + DWINUI::drawIcon(ICON_HotendTemp, 10, 383); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 384, thermalManager.wholeDegHotend(0)); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); - DWINUI::Draw_Icon(ICON_StepE, 112, 417); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + DWINUI::drawIcon(ICON_StepE, 112, 417); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); #endif #if HAS_HEATED_BED - DWINUI::Draw_Icon(ICON_BedTemp, 10, 416); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 28, 417, thermalManager.wholeDegBed()); - DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); + DWINUI::drawIcon(ICON_BedTemp, 10, 416); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 28, 417, thermalManager.wholeDegBed()); + DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); #endif - DWINUI::Draw_Icon(ICON_Speed, 113, 383); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); - IF_DISABLED(SHOW_SPEED_IND, DWINUI::Draw_String(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 116 + 5 * STAT_CHR_W + 2, 384, F("%"))); + DWINUI::drawIcon(ICON_Speed, 113, 383); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); + IF_DISABLED(SHOW_SPEED_IND, DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 384, F("%"))); #if HAS_FAN - DWINUI::Draw_Icon(ICON_FanSpeed, 187, 383); - DWINUI::Draw_Int(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); + DWINUI::drawIcon(ICON_FanSpeed, 187, 383); + DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); #endif #if HAS_ZOFFSET_ITEM - DWINUI::Draw_Icon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); - DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 2, 2, 204, 417, BABY_Z_VAR); + DWINUI::drawIcon(planner.leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); + DWINUI::drawSignedFloat(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 2, 2, 204, 417, BABY_Z_VAR); #endif } -void Draw_Info_Menu() { - DWINUI::ClearMainArea(); - if (HMI_IsChinese()) - Title.FrameCopy(30, 17, 28, 13); // "Info" +void drawInfoMenu() { + DWINUI::clearMainArea(); + if (hmiIsChinese()) + title.frameCopy(30, 17, 28, 13); // "Info" else - Title.ShowCaption(GET_TEXT_F(MSG_INFO_SCREEN)); - Draw_Menu_Line(0, ICON_Back, GET_TEXT_F(MSG_BACK), false, true); + title.showCaption(GET_TEXT_F(MSG_INFO_SCREEN)); + drawMenuLine(0, ICON_Back, GET_TEXT_F(MSG_BACK), false, true); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 197, 149, 252, 161, 108, 102); // "Size" - DWIN_Frame_AreaCopy(1, 1, 164, 56, 176, 108, 175); // "Firmware Version" - DWIN_Frame_AreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details" - DWINUI::Draw_CenteredString(268, F(CORP_WEBSITE)); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 197, 149, 252, 161, 108, 102); // "Size" + dwinFrameAreaCopy(1, 1, 164, 56, 176, 108, 175); // "Firmware Version" + dwinFrameAreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details" + DWINUI::drawCenteredString(268, F(CORP_WEBSITE)); } else { - DWINUI::Draw_CenteredString(102, F("Size")); - DWINUI::Draw_CenteredString(175, F("Firmware version")); - DWINUI::Draw_CenteredString(248, F("Build Datetime")); - DWINUI::Draw_CenteredString(268, F(STRING_DISTRIBUTION_DATE)); + DWINUI::drawCenteredString(102, F("Size")); + DWINUI::drawCenteredString(175, F("Firmware version")); + DWINUI::drawCenteredString(248, F("Build Datetime")); + DWINUI::drawCenteredString(268, F(STRING_DISTRIBUTION_DATE)); } - DWINUI::Draw_CenteredString(122, F(MACHINE_SIZE)); - DWINUI::Draw_CenteredString(195, F(SHORT_BUILD_VERSION)); + DWINUI::drawCenteredString(122, F(MACHINE_SIZE)); + DWINUI::drawCenteredString(195, F(SHORT_BUILD_VERSION)); for (uint8_t i = 0; i < 3; ++i) { - DWINUI::Draw_Icon(ICON_PrintSize + i, ICOX, 99 + i * 73); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 240); + DWINUI::drawIcon(ICON_PrintSize + i, ICOX, 99 + i * 73); + dwinDrawHLine(hmiData.colorSplitLine, 16, MBASE(2) + i * 73, 240); } } // Main Process -void HMI_MainMenu() { +void hmiMainMenu() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; @@ -1119,32 +1123,32 @@ void HMI_MainMenu() { else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_page.now) { case PAGE_PRINT: - if (HMI_data.MediaAutoMount) { + if (hmiData.mediaAutoMount) { card.mount(); safe_delay(800); }; - Draw_Print_File_Menu(); + drawPrintFileMenu(); break; - case PAGE_PREPARE: Draw_Prepare_Menu(); break; - case PAGE_CONTROL: Draw_Control_Menu(); break; - case PAGE_ADVANCE: Draw_AdvancedSettings_Menu(); break; + case PAGE_PREPARE: drawPrepareMenu(); break; + case PAGE_CONTROL: drawControlMenu(); break; + case PAGE_ADVANCE: drawAdvancedSettingsMenu(); break; } } dwinUpdateLCD(); } // Pause or Stop popup -void onClick_PauseOrStop() { +void onClickPauseOrStop() { switch (select_print.now) { case PRINT_PAUSE_RESUME: if (hmiFlag.select_flag) ui.pause_print(); break; // Confirm pause case PRINT_STOP: if (hmiFlag.select_flag) ui.abort_print(); break; // Stop confirmed then abort print default: break; } - return Goto_PrintProcess(); + return gotoPrintProcess(); } // Printing -void HMI_Printing() { +void hmiPrinting() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu @@ -1168,16 +1172,16 @@ void HMI_Printing() { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_print.now) { - case PRINT_SETUP: Draw_Tune_Menu(); break; + case PRINT_SETUP: drawTuneMenu(); break; case PRINT_PAUSE_RESUME: if (printingIsPaused()) { // If printer is already in pause ui.resume_print(); break; } else - return Goto_Popup(Popup_window_PauseOrStop, onClick_PauseOrStop); + return gotoPopup(popupPauseOrStop, onClickPauseOrStop); case PRINT_STOP: - return Goto_Popup(Popup_window_PauseOrStop, onClick_PauseOrStop); + return gotoPopup(popupPauseOrStop, onClickPauseOrStop); default: break; } } @@ -1186,84 +1190,84 @@ void HMI_Printing() { #include "../../../libs/buzzer.h" -void Draw_Main_Area() { +void drawMainArea() { switch (checkkey) { - case MainMenu: Draw_Main_Menu(); break; - case PrintProcess: Draw_PrintProcess(); break; - case PrintDone: Draw_PrintDone(); break; + case ID_MainMenu: drawMainMenu(); break; + case ID_PrintProcess: drawPrintProcess(); break; + case ID_PrintDone: drawPrintDone(); break; #if HAS_ESDIAG - case ESDiagProcess: Draw_EndStopDiag(); break; + case ID_ESDiagProcess: drawEndStopDiag(); break; #endif - case Popup: popupDraw(); break; + case ID_Popup: popupDraw(); break; #if HAS_LOCKSCREEN - case Locked: lockScreen.draw(); break; - #endif - case Menu: - case SetInt: - case SetPInt: - case SetIntNoDraw: - case SetFloat: - case SetPFloat: ReDrawMenu(true); break; + case ID_Locked: lockScreen.draw(); break; + #endif + case ID_Menu: + case ID_SetInt: + case ID_SetPInt: + case ID_SetIntNoDraw: + case ID_SetFloat: + case ID_SetPFloat: ReDrawMenu(true); break; default: break; } } -void HMI_WaitForUser() { +void hmiWaitForUser() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState != ENCODER_DIFF_NO && !ui.backlight) { - if (checkkey == WaitResponse) HMI_ReturnScreen(); + if (checkkey == ID_WaitResponse) hmiReturnScreen(); return ui.refresh_brightness(); } if (!wait_for_user) { switch (checkkey) { - case PrintDone: + case ID_PrintDone: select_page.reset(); - Goto_Main_Menu(); + gotoMainMenu(); break; #if HAS_BED_PROBE - case Leveling: + case ID_Leveling: #endif default: - HMI_ReturnScreen(); + hmiReturnScreen(); break; } } } -void HMI_Init() { +void hmiInit() { #if ENABLED(SHOW_BOOTSCREEN) #ifndef BOOTSCREEN_TIMEOUT #define BOOTSCREEN_TIMEOUT 1100 #endif - DWINUI::Draw_Box(1, Color_Black, { 5, 220, DWIN_WIDTH - 5, DWINUI::fontHeight() }); - DWINUI::Draw_CenteredString(Color_White, 220, F("ProUI starting up ")); + DWINUI::drawBox(1, COLOR_BLACK, { 5, 220, DWIN_WIDTH - 5, DWINUI::fontHeight() }); + DWINUI::drawCenteredString(COLOR_WHITE, 220, F("ProUI starting up ")); for (uint16_t t = 15; t < 257; t += 11) { - DWINUI::Draw_Icon(ICON_Bar, 15, 260); - dwinDrawRectangle(1, HMI_data.Background_Color, t, 260, 257, 280); + DWINUI::drawIcon(ICON_Bar, 15, 260); + dwinDrawRectangle(1, hmiData.colorBackground, t, 260, 257, 280); dwinUpdateLCD(); safe_delay((BOOTSCREEN_TIMEOUT) / 22); } #endif - HMI_SetLanguage(); + hmiSetLanguage(); } -void EachMomentUpdate() { +void eachMomentUpdate() { static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0; const millis_t ms = millis(); if (ELAPSED(ms, next_var_update_ms)) { next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL; blink = !blink; - update_variable(); + updateVariable(); #if HAS_ESDIAG - if (checkkey == ESDiagProcess) ESDiag.Update(); + if (checkkey == ID_ESDiagProcess) esDiag.update(); #endif - #if SHOW_TUNING_GRAPH - if (checkkey == PidProcess) { - TERN_(PIDTEMP, if (HMI_value.tempcontrol == PIDTEMP_START) plot.Update(thermalManager.wholeDegHotend(0))); - TERN_(PIDTEMPBED, if (HMI_value.tempcontrol == PIDTEMPBED_START) plot.Update(thermalManager.wholeDegBed())); + #if PROUI_TUNING_GRAPH + if (checkkey == ID_PIDProcess) { + TERN_(PIDTEMP, if (hmiValue.tempControl == PIDTEMP_START) plot.update(thermalManager.wholeDegHotend(0))); + TERN_(PIDTEMPBED, if (hmiValue.tempControl == PIDTEMPBED_START) plot.update(thermalManager.wholeDegBed())); } - TERN_(MPCTEMP, if (checkkey == MPCProcess) plot.Update(thermalManager.wholeDegHotend(0))); + TERN_(MPCTEMP, if (checkkey == ID_MPCProcess) plot.update(thermalManager.wholeDegHotend(0))); #endif } @@ -1275,42 +1279,42 @@ void EachMomentUpdate() { if (ELAPSED(ms, next_status_update_ms)) { next_status_update_ms = ms + 500; - DWIN_DrawStatusMessage(); + dwinDrawStatusMessage(); #if ENABLED(SCROLL_LONG_FILENAMES) - if (IsMenu(FileMenu)) FileMenuIdle(); + if (isMenu(fileMenu)) fileMenuIdle(); #endif } if (!PENDING(ms, next_rts_update_ms)) { next_rts_update_ms = ms + DWIN_UPDATE_INTERVAL; - if ((Printing() != hmiFlag.printing_flag) && !hmiFlag.home_flag) { - hmiFlag.printing_flag = Printing(); + if ((isPrinting() != hmiFlag.printing_flag) && !hmiFlag.home_flag) { + hmiFlag.printing_flag = isPrinting(); if (hmiFlag.printing_flag) - DWIN_Print_Started(); + dwinPrintStarted(); else if (hmiFlag.abort_flag) - DWIN_Print_Aborted(); + dwinPrintAborted(); else - DWIN_Print_Finished(); + dwinPrintFinished(); } if ((printingIsPaused() != hmiFlag.pause_flag) && !hmiFlag.home_flag) { hmiFlag.pause_flag = printingIsPaused(); if (hmiFlag.pause_flag) - DWIN_Print_Pause(); + dwinPrintPause(); else if (hmiFlag.abort_flag) - DWIN_Print_Aborted(); + dwinPrintAborted(); else - DWIN_Print_Resume(); + dwinPrintResume(); } - if (checkkey == PrintProcess) { // Print process + if (checkkey == ID_PrintProcess) { // Print process // Progress percent static uint8_t _percent_done = 255; if (_percent_done != ui.get_progress_percent()) { _percent_done = ui.get_progress_percent(); - Draw_Print_ProgressBar(); + drawPrintProgressBar(); } // Remaining time @@ -1318,7 +1322,7 @@ void EachMomentUpdate() { static uint32_t _remain_time = 0; if (_remain_time != ui.get_remaining_time()) { _remain_time = ui.get_remaining_time(); - Draw_Print_ProgressRemain(); + drawPrintProgressRemain(); } #endif @@ -1327,12 +1331,12 @@ void EachMomentUpdate() { const uint16_t min = (print_job_timer.duration() % 3600) / 60; if (_printtime != min) { // 1 minute update _printtime = min; - Draw_Print_ProgressElapsed(); + drawPrintProgressElapsed(); } } #if ENABLED(POWER_LOSS_RECOVERY) else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // Resume print before power off - return Goto_PowerLossRecovery(); + return gotoPowerLossRecovery(); } #endif @@ -1341,136 +1345,136 @@ void EachMomentUpdate() { } #if ENABLED(POWER_LOSS_RECOVERY) - void Popup_PowerLossRecovery() { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 160, 338, 235, 354, 98, 115); - DWIN_Frame_AreaCopy(1, 103, 321, 271, 335, 52, 167); - DWINUI::Draw_IconWB(ICON_Cancel_C, 26, 280); - DWINUI::Draw_IconWB(ICON_Continue_C, 146, 280); + void popupPowerLossRecovery() { + DWINUI::clearMainArea(); + drawPopupBkgd(); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 160, 338, 235, 354, 98, 115); + dwinFrameAreaCopy(1, 103, 321, 271, 335, 52, 167); + DWINUI::drawIconWB(ICON_Cancel_C, 26, 280); + DWINUI::drawIconWB(ICON_Continue_C, 146, 280); } else { - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 70, GET_TEXT_F(MSG_OUTAGE_RECOVERY)); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 147, F("It looks like the last")); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 167, F("file was interrupted.")); - DWINUI::Draw_Button(BTN_Cancel, 26, 280); - DWINUI::Draw_Button(BTN_Continue, 146, 280); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_OUTAGE_RECOVERY)); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 147, F("It looks like the last")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 167, F("file was interrupted.")); + DWINUI::drawButton(BTN_Cancel, 26, 280); + DWINUI::drawButton(BTN_Continue, 146, 280); } MediaFile *dir = nullptr; const char * const filename = card.diveToFile(true, dir, recovery.info.sd_filename); card.selectFileByName(filename); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 207, card.longest_filename()); - DWIN_Print_Header(card.longest_filename()); // Save filename - Draw_Select_Highlight(hmiFlag.select_flag); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 207, card.longest_filename()); + dwinPrintHeader(card.longest_filename()); // Save filename + drawSelectHighlight(hmiFlag.select_flag); dwinUpdateLCD(); } - void onClick_PowerLossRecovery() { + void onClickPowerLossRecovery() { if (hmiFlag.select_flag) { queue.inject(F("M1000C")); select_page.reset(); - return Goto_Main_Menu(); + return gotoMainMenu(); } else { - HMI_SaveProcessID(NothingToDo); + hmiSaveProcessID(ID_NothingToDo); select_print.set(PRINT_SETUP); queue.inject(F("M1000")); } } - void Goto_PowerLossRecovery() { + void gotoPowerLossRecovery() { recovery.dwin_flag = false; LCD_MESSAGE(MSG_CONTINUE_PRINT_JOB); - Goto_Popup(Popup_PowerLossRecovery, onClick_PowerLossRecovery); + gotoPopup(popupPowerLossRecovery, onClickPowerLossRecovery); } #endif // POWER_LOSS_RECOVERY -void DWIN_HandleScreen() { +void dwinHandleScreen() { switch (checkkey) { - case MainMenu: HMI_MainMenu(); break; - case Menu: HMI_Menu(); break; - case SetInt: HMI_SetDraw(); break; - case SetFloat: HMI_SetDraw(); break; - case SetPInt: HMI_SetPInt(); break; - case SetPFloat: HMI_SetPFloat(); break; - case SetIntNoDraw: HMI_SetNoDraw(); break; - case PrintProcess: HMI_Printing(); break; - case Popup: HMI_Popup(); break; - case Leveling: break; + case ID_MainMenu: hmiMainMenu(); break; + case ID_Menu: hmiMenu(); break; + case ID_SetInt: hmiSetDraw(); break; + case ID_SetFloat: hmiSetDraw(); break; + case ID_SetPInt: hmiSetPInt(); break; + case ID_SetPFloat: hmiSetPFloat(); break; + case ID_SetIntNoDraw: hmiSetNoDraw(); break; + case ID_PrintProcess: hmiPrinting(); break; + case ID_Popup: hmiPopup(); break; + case ID_Leveling: break; #if HAS_LOCKSCREEN - case Locked: HMI_LockScreen(); break; - #endif - case PrintDone: - TERN_(HAS_ESDIAG, case ESDiagProcess:) - case WaitResponse: HMI_WaitForUser(); break; - case Homing: - case PidProcess: - case NothingToDo: break; + case ID_Locked: hmiLockScreen(); break; + #endif + case ID_PrintDone: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) + case ID_WaitResponse: hmiWaitForUser(); break; + case ID_Homing: + case ID_PIDProcess: + case ID_NothingToDo: break; default: break; } } -bool IDisPopUp() { // If ID is popup... +bool idIsPopUp() { // If ID is popup... switch (checkkey) { - case NothingToDo: - case WaitResponse: - case Popup: - case Homing: - case Leveling: - case PidProcess: - TERN_(HAS_ESDIAG, case ESDiagProcess:) + case ID_NothingToDo: + case ID_WaitResponse: + case ID_Popup: + case ID_Homing: + case ID_Leveling: + case ID_PIDProcess: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) return true; default: break; } return false; } -void HMI_SaveProcessID(const uint8_t id) { +void hmiSaveProcessID(const uint8_t id) { if (checkkey == id) return; - if (!IDisPopUp()) last_checkkey = checkkey; // If previous is not a popup + if (!idIsPopUp()) last_checkkey = checkkey; // If previous is not a popup checkkey = id; switch (id) { - case Popup: - case WaitResponse: - case PrintDone: - case Leveling: - TERN_(HAS_ESDIAG, case ESDiagProcess:) + case ID_Popup: + case ID_WaitResponse: + case ID_PrintDone: + case ID_Leveling: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) wait_for_user = true; default: break; } } -void HMI_ReturnScreen() { +void hmiReturnScreen() { checkkey = last_checkkey; wait_for_user = false; - Draw_Main_Area(); + drawMainArea(); } void dwinHomingStart() { hmiFlag.home_flag = true; - HMI_SaveProcessID(Homing); - Title.ShowCaption(GET_TEXT_F(MSG_HOMING)); - DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); + hmiSaveProcessID(ID_Homing); + title.showCaption(GET_TEXT_F(MSG_HOMING)); + dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); } void dwinHomingDone() { hmiFlag.home_flag = false; - if (last_checkkey == PrintDone) - Goto_PrintDone(); + if (last_checkkey == ID_PrintDone) + gotoPrintDone(); else - HMI_ReturnScreen(); + hmiReturnScreen(); } -void DWIN_LevelingStart() { +void dwinLevelingStart() { #if HAS_BED_PROBE - HMI_SaveProcessID(Leveling); - Title.ShowCaption(GET_TEXT_F(MSG_BED_LEVELING)); - DWIN_Show_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT)); + hmiSaveProcessID(ID_Leveling); + title.showCaption(GET_TEXT_F(MSG_BED_LEVELING)); + dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT)); #if ALL(AUTO_BED_LEVELING_UBL, PREHEAT_BEFORE_LEVELING) #if HAS_BED_PROBE - if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, HMI_data.BedLevT); + if (!DEBUGGING(DRYRUN)) probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, hmiData.bedLevT); #else #if HAS_HOTEND if (!DEBUGGING(DRYRUN) && thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) { @@ -1479,24 +1483,24 @@ void DWIN_LevelingStart() { } #endif #if HAS_HEATED_BED - if (!DEBUGGING(DRYRUN) && thermalManager.degTargetBed() < HMI_data.BedLevT) { - thermalManager.setTargetBed(HMI_data.BedLevT); + if (!DEBUGGING(DRYRUN) && thermalManager.degTargetBed() < hmiData.bedLevT) { + thermalManager.setTargetBed(hmiData.bedLevT); thermalManager.wait_for_bed_heating(); } #endif #endif #endif #elif ENABLED(MESH_BED_LEVELING) - Draw_ManualMesh_Menu(); + drawManualMeshMenu(); #endif } -void DWIN_LevelingDone() { - TERN_(HAS_MESH, Goto_MeshViewer(true)); +void dwinLevelingDone() { + TERN_(HAS_MESH, gotoMeshViewer(true)); } #if HAS_MESH - void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval) { + void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval) { ui.set_status( &MString<32>(GET_TEXT_F(MSG_PROBING_POINT), ' ', cpos, '/', tpos, F(" Z="), p_float_t(zval, 2)) ); @@ -1505,49 +1509,49 @@ void DWIN_LevelingDone() { // PID/MPC process -#if SHOW_TUNING_GRAPH +#if PROUI_TUNING_GRAPH #include "plot.h" celsius_t _maxtemp, _target; - void DWIN_Draw_PID_MPC_Popup() { + void dwinDrawPIDMPCPopup() { constexpr frame_rect_t gfrm = { 40, 180, DWIN_WIDTH - 80, 120 }; - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); + DWINUI::clearMainArea(); + drawPopupBkgd(); - switch (HMI_value.tempcontrol) { + switch (hmiValue.tempControl) { default: return; #if ENABLED(MPC_AUTOTUNE) case MPCTEMP_START: - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); - DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); break; #endif #if ANY(PIDTEMP, PIDTEMPBED) TERN_(PIDTEMP, case PIDTEMP_START:) TERN_(PIDTEMPBED, case PIDTEMPBED_START:) - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); - DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); break; #endif } - switch (HMI_value.tempcontrol) { + switch (hmiValue.tempControl) { default: break; #if ANY(PIDTEMP, MPC_AUTOTUNE) TERN_(PIDTEMP, case PIDTEMP_START:) TERN_(MPC_AUTOTUNE, case MPCTEMP_START:) - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 120, F("for Nozzle is running.")); break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 120, F("for BED is running.")); break; #endif } - switch (HMI_value.tempcontrol) { + switch (hmiValue.tempControl) { default: break; #if ENABLED(MPC_AUTOTUNE) case MPCTEMP_START: @@ -1558,74 +1562,74 @@ void DWIN_LevelingDone() { #if ENABLED(PIDTEMP) case PIDTEMP_START: _maxtemp = thermalManager.hotend_maxtemp[0]; - _target = HMI_data.HotendPidT; + _target = hmiData.hotendPidT; break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: _maxtemp = BED_MAXTEMP; - _target = HMI_data.BedPidT; + _target = hmiData.bedPidT; break; #endif } - plot.Draw(gfrm, _maxtemp, _target); - DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); + plot.draw(gfrm, _maxtemp, _target); + DWINUI::drawInt(hmiData.colorPopupTxt, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); } -#endif // SHOW_TUNING_GRAPH +#endif // PROUI_TUNING_GRAPH -#if DWIN_PID_TUNE +#if PROUI_PID_TUNE - void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp) { - if (seenC) HMI_data.PidCycles = c; + void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp) { + if (seenC) hmiData.pidCycles = c; if (seenS) { switch (hid) { - OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: HMI_data.HotendPidT = temp; break) - OPTCODE(PIDTEMPBED, case H_BED: HMI_data.BedPidT = temp; break) + OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: hmiData.hotendPidT = temp; break) + OPTCODE(PIDTEMPBED, case H_BED: hmiData.bedPidT = temp; break) default: break; } } } - void DWIN_PidTuning(tempcontrol_t result) { - HMI_value.tempcontrol = result; + void dwinPidTuning(tempcontrol_t result) { + hmiValue.tempControl = result; switch (result) { #if ENABLED(PIDTEMP) case PIDTEMP_START: - HMI_SaveProcessID(PidProcess); - #if SHOW_TUNING_GRAPH - DWIN_Draw_PID_MPC_Popup(); + hmiSaveProcessID(ID_PIDProcess); + #if PROUI_TUNING_GRAPH + dwinDrawPIDMPCPopup(); #else - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); #endif break; case PID_TEMP_TOO_HIGH: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: - HMI_SaveProcessID(PidProcess); - #if SHOW_TUNING_GRAPH - DWIN_Draw_PID_MPC_Popup(); + hmiSaveProcessID(ID_PIDProcess); + #if PROUI_TUNING_GRAPH + dwinDrawPIDMPCPopup(); #else - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); #endif break; #endif case PID_BAD_HEATER_ID: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TUNING_TIMEOUT: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); break; case AUTOTUNE_DONE: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); break; default: checkkey = last_checkkey; @@ -1633,34 +1637,34 @@ void DWIN_LevelingDone() { } } -#endif // DWIN_PID_TUNE +#endif // PROUI_PID_TUNE #if ENABLED(MPC_AUTOTUNE) - void DWIN_MPCTuning(tempcontrol_t result) { - HMI_value.tempcontrol = result; + void dwinMPCTuning(tempcontrol_t result) { + hmiValue.tempControl = result; switch (result) { case MPCTEMP_START: - HMI_SaveProcessID(MPCProcess); - #if SHOW_TUNING_GRAPH - DWIN_Draw_PID_MPC_Popup(); + hmiSaveProcessID(ID_MPCProcess); + #if PROUI_TUNING_GRAPH + dwinDrawPIDMPCPopup(); #else - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), F("for Nozzle is running.")); + dwinDrawPopup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), F("for Nozzle is running.")); #endif break; case MPC_TEMP_ERROR: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), F(STR_MPC_TEMPERATURE_ERROR)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), F(STR_MPC_TEMPERATURE_ERROR)); ui.reset_alert_level(); break; case MPC_INTERRUPTED: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE_INTERRUPTED)); + dwinPopupConfirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE_INTERRUPTED)); ui.reset_alert_level(); break; case AUTOTUNE_DONE: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); + dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); ui.reset_alert_level(); break; default: @@ -1673,117 +1677,117 @@ void DWIN_LevelingDone() { #endif // MPC_AUTOTUNE // Started a Print Job -void DWIN_Print_Started() { +void dwinPrintStarted() { TERN_(HAS_GCODE_PREVIEW, if (Host_Printing()) Preview_Invalidate()); TERN_(SET_PROGRESS_PERCENT, ui.progress_reset()); TERN_(SET_REMAINING_TIME, ui.reset_remaining_time()); hmiFlag.pause_flag = false; hmiFlag.abort_flag = false; select_print.reset(); - Goto_PrintProcess(); + gotoPrintProcess(); } // Pause a print job -void DWIN_Print_Pause() { +void dwinPrintPause() { ICON_ResumeOrPause(); } // Resume print job -void DWIN_Print_Resume() { +void dwinPrintResume() { ICON_ResumeOrPause(); LCD_MESSAGE(MSG_RESUME_PRINT); } // Ended print job -void DWIN_Print_Finished() { +void dwinPrintFinished() { TERN_(POWER_LOSS_RECOVERY, if (card.isPrinting()) recovery.cancel()); hmiFlag.abort_flag = false; hmiFlag.pause_flag = false; wait_for_heatup = false; planner.finish_and_disable(); thermalManager.cooldown(); - Goto_PrintDone(); + gotoPrintDone(); } // Print was aborted -void DWIN_Print_Aborted() { - DWIN_Print_Finished(); +void dwinPrintAborted() { + dwinPrintFinished(); } #if HAS_FILAMENT_SENSOR // Filament Runout process - void DWIN_FilamentRunout(const uint8_t extruder) { LCD_MESSAGE(MSG_RUNOUT_SENSOR); } -#endif - -void DWIN_SetColorDefaults() { - HMI_data.Background_Color = Def_Background_Color; - HMI_data.Cursor_Color = Def_Cursor_Color; - HMI_data.TitleBg_Color = Def_TitleBg_Color; - HMI_data.TitleTxt_Color = Def_TitleTxt_Color; - HMI_data.Text_Color = Def_Text_Color; - HMI_data.Selected_Color = Def_Selected_Color; - HMI_data.SplitLine_Color = Def_SplitLine_Color; - HMI_data.Highlight_Color = Def_Highlight_Color; - HMI_data.StatusBg_Color = Def_StatusBg_Color; - HMI_data.StatusTxt_Color = Def_StatusTxt_Color; - HMI_data.PopupBg_Color = Def_PopupBg_Color; - HMI_data.PopupTxt_Color = Def_PopupTxt_Color; - HMI_data.AlertBg_Color = Def_AlertBg_Color; - HMI_data.AlertTxt_Color = Def_AlertTxt_Color; - HMI_data.PercentTxt_Color = Def_PercentTxt_Color; - HMI_data.Barfill_Color = Def_Barfill_Color; - HMI_data.Indicator_Color = Def_Indicator_Color; - HMI_data.Coordinate_Color = Def_Coordinate_Color; -} - -void DWIN_SetDataDefaults() { - DWIN_SetColorDefaults(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - TERN_(PIDTEMP, HMI_data.HotendPidT = DEF_HOTENDPIDT); - TERN_(PIDTEMPBED, HMI_data.BedPidT = DEF_BEDPIDT); - TERN_(DWIN_PID_TUNE, HMI_data.PidCycles = DEF_PIDCYCLES); + void dwinFilamentRunout(const uint8_t extruder) { LCD_MESSAGE(MSG_RUNOUT_SENSOR); } +#endif + +void dwinSetColorDefaults() { + hmiData.colorBackground = defColorBackground; + hmiData.colorCursor = defColorCursor; + hmiData.colorTitleBg = defColorTitleBg; + hmiData.colorTitleTxt = defColorTitleTxt; + hmiData.colorText = defColorText; + hmiData.colorSelected = defColorSelected; + hmiData.colorSplitLine = defColorSplitLine; + hmiData.colorHighlight = defColorHighlight; + hmiData.colorStatusBg = defColorStatusBg; + hmiData.colorStatusTxt = defColorStatusTxt; + hmiData.colorPopupBg = defColorPopupBg; + hmiData.colorPopupTxt = defColorPopupTxt; + hmiData.colorAlertBg = defColorAlertBg; + hmiData.colorAlertTxt = defColorAlertTxt; + hmiData.colorPercentTxt = defColorPercentTxt; + hmiData.colorBarfill = defColorBarfill; + hmiData.colorIndicator = defColorIndicator; + hmiData.colorCoordinate = defColorCoordinate; +} + +void dwinSetDataDefaults() { + dwinSetColorDefaults(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + TERN_(PIDTEMP, hmiData.hotendPidT = DEF_HOTENDPIDT); + TERN_(PIDTEMPBED, hmiData.bedPidT = DEF_BEDPIDT); + TERN_(PROUI_PID_TUNE, hmiData.pidCycles = DEF_PIDCYCLES); #if ENABLED(PREVENT_COLD_EXTRUSION) - HMI_data.ExtMinT = EXTRUDE_MINTEMP; - ApplyExtMinT(); + hmiData.extMinT = EXTRUDE_MINTEMP; + applyExtMinT(); #endif - TERN_(PREHEAT_BEFORE_LEVELING, HMI_data.BedLevT = LEVELING_BED_TEMP); - TERN_(BAUD_RATE_GCODE, SetBaud250K()); + TERN_(PREHEAT_BEFORE_LEVELING, hmiData.bedLevT = LEVELING_BED_TEMP); + TERN_(BAUD_RATE_GCODE, setBaud250K()); #if ALL(LCD_BED_TRAMMING, HAS_BED_PROBE) - HMI_data.FullManualTramming = DISABLED(BED_TRAMMING_USE_PROBE); + hmiData.fullManualTramming = DISABLED(BED_TRAMMING_USE_PROBE); #endif #if ENABLED(MEDIASORT_MENU_ITEM) - HMI_data.MediaSort = true; + hmiData.mediaSort = true; card.setSortOn(true); #endif - HMI_data.MediaAutoMount = ENABLED(HAS_SD_EXTENDER); + hmiData.mediaAutoMount = ENABLED(HAS_SD_EXTENDER); #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - HMI_data.z_after_homing = DEF_Z_AFTER_HOMING; + hmiData.zAfterHoming = DEF_Z_AFTER_HOMING; #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) TERN_(LED_COLOR_PRESETS, leds.set_default()); - ApplyLEDColor(); + applyLEDColor(); #endif - TERN_(ADAPTIVE_STEP_SMOOTHING, HMI_data.AdaptiveStepSmoothing = true); - TERN_(HAS_GCODE_PREVIEW, HMI_data.EnablePreview = true); + TERN_(ADAPTIVE_STEP_SMOOTHING, hmiData.adaptiveStepSmoothing = true); + TERN_(HAS_GCODE_PREVIEW, hmiData.enablePreview = true); } -void DWIN_CopySettingsTo(char * const buff) { - memcpy(buff, &HMI_data, eeprom_data_size); +void dwinCopySettingsTo(char * const buff) { + memcpy(buff, &hmiData, eeprom_data_size); } -void DWIN_CopySettingsFrom(const char * const buff) { - memcpy(&HMI_data, buff, sizeof(HMI_data_t)); - if (HMI_data.Text_Color == HMI_data.Background_Color) DWIN_SetColorDefaults(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - TERN_(PREVENT_COLD_EXTRUSION, ApplyExtMinT()); +void dwinCopySettingsFrom(const char * const buff) { + memcpy(&hmiData, buff, sizeof(hmi_data_t)); + if (hmiData.colorText == hmiData.colorBackground) dwinSetColorDefaults(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + TERN_(PREVENT_COLD_EXTRUSION, applyExtMinT()); feedrate_percentage = 100; - TERN_(BAUD_RATE_GCODE, HMI_SetBaudRate()); + TERN_(BAUD_RATE_GCODE, hmiSetBaudRate()); #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) leds.set_color( - HMI_data.Led_Color.r, - HMI_data.Led_Color.g, - HMI_data.Led_Color.b - OPTARG(HAS_WHITE_LED, HMI_data.Led_Color.w) + hmiData.ledColor.r, + hmiData.ledColor.g, + hmiData.ledColor.b + OPTARG(HAS_WHITE_LED, hmiData.ledColor.w) ); leds.update(); #endif @@ -1799,23 +1803,23 @@ void MarlinUI::init_lcd() { } void dwinInitScreen() { - DWIN_SetColorDefaults(); - HMI_Init(); // Draws boot screen + dwinSetColorDefaults(); + hmiInit(); // Draws boot screen DWINUI::init(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - DWINUI::onTitleDraw = Draw_Title; - InitMenu(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + DWINUI::onTitleDraw = drawTitle; + initMenu(); checkkey = 255; hash_changed = true; - DWIN_DrawStatusLine(); - DWIN_Draw_Dashboard(); - Goto_Main_Menu(); + dwinDrawStatusLine(); + dwinDrawDashboard(); + gotoMainMenu(); } void MarlinUI::update() { - HMI_SDCardUpdate(); // SD card update - EachMomentUpdate(); // Status update - DWIN_HandleScreen(); // Rotary encoder update + hmiSDCardUpdate(); // SD card update + eachMomentUpdate(); // Status update + dwinHandleScreen(); // Rotary encoder update } void MarlinUI::refresh() { /* Nothing to see here */ } @@ -1825,149 +1829,149 @@ void MarlinUI::refresh() { /* Nothing to see here */ } #endif void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) { - DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, GET_TEXT_F(MSG_TURN_OFF)); + dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 270, GET_TEXT_F(MSG_TURN_OFF)); dwinUpdateLCD(); } -void DWIN_RebootScreen() { - dwinFrameClear(Color_Bg_Black); +void dwinRebootScreen() { + dwinFrameClear(COLOR_BG_BLACK); dwinJPGShowAndCache(0); - DWINUI::Draw_CenteredString(Color_White, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); + DWINUI::drawCenteredString(COLOR_WHITE, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); dwinUpdateLCD(); safe_delay(500); } -void DWIN_RedrawDash() { +void dwinRedrawDash() { hash_changed = true; - DWIN_DrawStatusMessage(); - DWIN_Draw_Dashboard(); + dwinDrawStatusMessage(); + dwinDrawDashboard(); } -void DWIN_RedrawScreen() { - Draw_Main_Area(); - DWIN_RedrawDash(); +void dwinRedrawScreen() { + drawMainArea(); + dwinRedrawDash(); } #if ENABLED(ADVANCED_PAUSE_FEATURE) - void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button/*=0*/) { - HMI_SaveProcessID(button ? WaitResponse : NothingToDo); - DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button); + void dwinPopupPause(FSTR_P const fmsg, uint8_t button/*=0*/) { + hmiSaveProcessID(button ? ID_WaitResponse : ID_NothingToDo); + dwinShowPopup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), fmsg, button); } void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { //if (mode == PAUSE_MODE_SAME) return; pause_mode = mode; switch (message) { - case PAUSE_MESSAGE_PARKING: DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 - case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) - case PAUSE_MESSAGE_WAITING: DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; - case PAUSE_MESSAGE_INSERT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; - case PAUSE_MESSAGE_LOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_UNLOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 + case PAUSE_MESSAGE_PARKING: dwinPopupPause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 + case PAUSE_MESSAGE_CHANGING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) + case PAUSE_MESSAGE_WAITING: dwinPopupPause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), BTN_Continue); break; + case PAUSE_MESSAGE_INSERT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; + case PAUSE_MESSAGE_LOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_UNLOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 case PAUSE_MESSAGE_PURGE: #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_CONT_PURGE)); + dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_CONT_PURGE)); #else - DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); + dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); #endif break; - case PAUSE_MESSAGE_OPTION: Goto_FilamentPurge(); break; - case PAUSE_MESSAGE_RESUME: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; - case PAUSE_MESSAGE_HEATING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; - case PAUSE_MESSAGE_STATUS: HMI_ReturnScreen(); break; // Exit from Pause, Load and Unload + case PAUSE_MESSAGE_OPTION: gotoFilamentPurge(); break; + case PAUSE_MESSAGE_RESUME: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; + case PAUSE_MESSAGE_HEATING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEATING)); break; + case PAUSE_MESSAGE_STATUS: hmiReturnScreen(); break; // Exit from Pause, Load and Unload default: break; } } - void Draw_Popup_FilamentPurge() { - DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); - DWINUI::Draw_Button(BTN_Purge, 26, 280); - DWINUI::Draw_Button(BTN_Continue, 146, 280); - Draw_Select_Highlight(true); + void drawPopupFilamentPurge() { + dwinDrawPopup(ICON_BLTouch, GET_TEXT_F(MSG_ADVANCED_PAUSE), GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE_CONTINUE)); + DWINUI::drawButton(BTN_Purge, 26, 280); + DWINUI::drawButton(BTN_Continue, 146, 280); + drawSelectHighlight(true); } - void onClick_FilamentPurge() { + void onClickFilamentPurge() { if (hmiFlag.select_flag) pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // "Purge More" button else { - HMI_SaveProcessID(NothingToDo); + hmiSaveProcessID(ID_NothingToDo); pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; // "Continue" button } } - void Goto_FilamentPurge() { + void gotoFilamentPurge() { pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; - Goto_Popup(Draw_Popup_FilamentPurge, onClick_FilamentPurge); + gotoPopup(drawPopupFilamentPurge, onClickFilamentPurge); } #endif // ADVANCED_PAUSE_FEATURE #if HAS_MESH - void DWIN_MeshViewer() { + void dwinMeshViewer() { if (!leveling_is_valid()) - DWIN_Popup_Continue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); + dwinPopupContinue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); else { - HMI_SaveProcessID(WaitResponse); - MeshViewer.Draw(); + hmiSaveProcessID(ID_WaitResponse); + meshViewer.draw(); } } #endif #if HAS_LOCKSCREEN - void DWIN_LockScreen() { - if (checkkey != Locked) { + void dwinLockScreen() { + if (checkkey != ID_Locked) { lockScreen.rprocess = checkkey; - checkkey = Locked; + checkkey = ID_Locked; lockScreen.init(); } } - void DWIN_UnLockScreen() { - if (checkkey == Locked) { + void dwinUnLockScreen() { + if (checkkey == ID_Locked) { checkkey = lockScreen.rprocess; - Draw_Main_Area(); + drawMainArea(); } } - void HMI_LockScreen() { + void hmiLockScreen() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; lockScreen.onEncoder(encoder_diffState); - if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); + if (lockScreen.isUnlocked()) dwinUnLockScreen(); } #endif // HAS_LOCKSCREEN #if HAS_GCODE_PREVIEW - void SetPreview() { Toggle_Chkb_Line(HMI_data.EnablePreview); } + void setPreview() { toggleCheckboxLine(hmiData.enablePreview); } - void onClick_ConfirmToPrint() { - DWIN_ResetStatusLine(); + void onClickConfirmToPrint() { + dwinResetStatusLine(); if (hmiFlag.select_flag) { // Confirm - Goto_Main_Menu(); + gotoMainMenu(); return card.openAndPrintFile(card.filename); } else - HMI_ReturnScreen(); + hmiReturnScreen(); } #endif // HAS_GCODE_PREVIEW -void Goto_ConfirmToPrint() { +void gotoConfirmToPrint() { #if HAS_GCODE_PREVIEW - if (HMI_data.EnablePreview) return Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint); + if (hmiData.enablePreview) return gotoPopup(Preview_DrawFromSD, onClickConfirmToPrint); #endif card.openAndPrintFile(card.filename); // Direct print SD file } #if HAS_ESDIAG - void Draw_EndStopDiag() { - HMI_SaveProcessID(ESDiagProcess); - ESDiag.Draw(); + void drawEndStopDiag() { + hmiSaveProcessID(ID_ESDiagProcess); + esDiag.draw(); } #endif @@ -1979,80 +1983,80 @@ void Goto_ConfirmToPrint() { #if ENABLED(EEPROM_SETTINGS) - void WriteEeprom() { - DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); + void writeEEPROM() { + dwinDrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); dwinUpdateLCD(); DONE_BUZZ(settings.save()); } - void ReadEeprom() { + void readEEPROM() { const bool success = settings.load(); - DWIN_RedrawScreen(); + dwinRedrawScreen(); DONE_BUZZ(success); } - void ResetEeprom() { + void resetEEPROM() { settings.reset(); - DWIN_RedrawScreen(); + dwinRedrawScreen(); DONE_BUZZ(true); } #if HAS_MESH - void SaveMesh() { TERN(AUTO_BED_LEVELING_UBL, UBLMeshSave(), WriteEeprom()); } + void saveMesh() { TERN(AUTO_BED_LEVELING_UBL, ublMeshSave(), writeEEPROM()); } #endif #endif // EEPROM_SETTINGS // Reset Printer -void RebootPrinter() { +void rebootPrinter() { wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user thermalManager.disable_all_heaters(); planner.finish_and_disable(); - DWIN_RebootScreen(); + dwinRebootScreen(); hal.reboot(); } -void Goto_Info_Menu() { - Draw_Info_Menu(); +void gotoInfoMenu() { + drawInfoMenu(); dwinUpdateLCD(); - HMI_SaveProcessID(WaitResponse); + hmiSaveProcessID(ID_WaitResponse); } -void DisableMotors() { queue.inject(F("M84")); } +void disableMotors() { queue.inject(F("M84")); } -void AutoLev() { // Always reacquire the Z "home" position +void autoLevel() { // Always reacquire the Z "home" position queue.inject(F(TERN(AUTO_BED_LEVELING_UBL, "G29P1", "G29"))); } -void AutoHome() { queue.inject_P(G28_STR); } +void autoHome() { queue.inject_P(G28_STR); } #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - void HomeX() { queue.inject(F("G28X")); } - void HomeY() { queue.inject(F("G28Y")); } - void HomeZ() { queue.inject(F("G28Z")); } + void homeX() { queue.inject(F("G28X")); } + void homeY() { queue.inject(F("G28Y")); } + void homeZ() { queue.inject(F("G28Z")); } #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - void ApplyZAfterHoming() { HMI_data.z_after_homing = MenuData.Value; }; - void SetZAfterHoming() { SetIntOnClick(0, 20, HMI_data.z_after_homing, ApplyZAfterHoming); } + void applyZAfterHoming() { hmiData.zAfterHoming = menuData.value; }; + void setZAfterHoming() { setIntOnClick(0, 20, hmiData.zAfterHoming, applyZAfterHoming); } #endif #endif #if HAS_ZOFFSET_ITEM - void ApplyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } - void LiveZOffset() { + void applyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); } + void liveZOffset() { #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) - const_float_t step_zoffset = round((MenuData.Value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum; + const_float_t step_zoffset = round((menuData.value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum; if (BABYSTEP_ALLOWED()) babystep.add_steps(Z_AXIS, step_zoffset); #endif } - void SetZOffset() { + void setZOffset() { #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) babystep.accum = round(planner.settings.axis_steps_per_mm[Z_AXIS] * BABY_Z_VAR); #endif - SetPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, ApplyZOffset, LiveZOffset); + setPFloatOnClick(Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, 2, applyZOffset, liveZOffset); } - void SetMoveZto0() { + void setMoveZto0() { #if ENABLED(Z_SAFE_HOMING) gcode.process_subcommands_now(MString<54>(F("G28XYO\nG28Z\nG0F5000X"), Z_SAFE_HOMING_X_POINT, F("Y"), Z_SAFE_HOMING_Y_POINT, F("\nG0Z0F300\nM400"))); #else @@ -2064,213 +2068,213 @@ void AutoHome() { queue.inject_P(G28_STR); } } #if !HAS_BED_PROBE - void HomeZandDisable() { - SetMoveZto0(); - DisableMotors(); + void homeZAndDisable() { + setMoveZto0(); + disableMotors(); } #endif #endif // HAS_ZOFFSET_ITEM #if HAS_PREHEAT - #define _DoPreheat(N) void DoPreheat##N() { ui.preheat_all(N-1); }\ + #define _doPreheat(N) void DoPreheat##N() { ui.preheat_all(N-1); }\ void DoPreheatHotend##N() { ui.preheat_hotend(N-1); } - REPEAT_1(PREHEAT_COUNT, _DoPreheat) + REPEAT_1(PREHEAT_COUNT, _doPreheat) #endif -void DoCoolDown() { thermalManager.cooldown(); } +void doCoolDown() { thermalManager.cooldown(); } -void SetLanguage() { - HMI_ToggleLanguage(); - CurrentMenu = nullptr; // Invalidate menu to full redraw - Draw_Prepare_Menu(); +void setLanguage() { + hmiToggleLanguage(); + currentMenu = nullptr; // Invalidate menu to full redraw + drawPrepareMenu(); } -bool EnableLiveMove = false; -void SetLiveMove() { Toggle_Chkb_Line(EnableLiveMove); } -void AxisMove(AxisEnum axis) { +bool enableLiveMove = false; +void setLiveMove() { toggleCheckboxLine(enableLiveMove); } +void axisMove(AxisEnum axis) { #if HAS_HOTEND if (axis == E_AXIS && thermalManager.tooColdToExtrude(0)) { gcode.process_subcommands_now(F("G92E0")); // Reset extruder position - return DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); + return dwinPopupConfirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); } #endif planner.synchronize(); if (!planner.is_full()) planner.buffer_line(current_position, manual_feedrate_mm_s[axis]); } -void LiveMove() { - if (!EnableLiveMove) return; - *MenuData.P_Float = MenuData.Value / MINUNITMULT; - AxisMove(HMI_value.axis); +void liveMove() { + if (!enableLiveMove) return; + *menuData.floatPtr = menuData.value / MINUNITMULT; + axisMove(hmiValue.axis); } -void ApplyMove() { - if (EnableLiveMove) return; - AxisMove(HMI_value.axis); +void applyMove() { + if (enableLiveMove) return; + axisMove(hmiValue.axis); } -void SetMoveX() { HMI_value.axis = X_AXIS; SetPFloatOnClick(X_MIN_POS, X_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); } -void SetMoveY() { HMI_value.axis = Y_AXIS; SetPFloatOnClick(Y_MIN_POS, Y_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); } -void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, ApplyMove, LiveMove); } +void setMoveX() { hmiValue.axis = X_AXIS; setPFloatOnClick(X_MIN_POS, X_MAX_POS, UNITFDIGITS, applyMove, liveMove); } +void setMoveY() { hmiValue.axis = Y_AXIS; setPFloatOnClick(Y_MIN_POS, Y_MAX_POS, UNITFDIGITS, applyMove, liveMove); } +void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, UNITFDIGITS, applyMove, liveMove); } #if HAS_HOTEND - void SetMoveE() { + void setMoveE() { const float e_min = current_position.e - (EXTRUDE_MAXLENGTH), e_max = current_position.e + (EXTRUDE_MAXLENGTH); - HMI_value.axis = E_AXIS; SetPFloatOnClick(e_min, e_max, UNITFDIGITS, ApplyMove, LiveMove); + hmiValue.axis = E_AXIS; setPFloatOnClick(e_min, e_max, UNITFDIGITS, applyMove, liveMove); } #endif #if ENABLED(POWER_LOSS_RECOVERY) - void SetPwrLossr() { - Toggle_Chkb_Line(recovery.enabled); + void setPwrLossr() { + toggleCheckboxLine(recovery.enabled); recovery.changed(); } #endif #if ENABLED(BAUD_RATE_GCODE) - void HMI_SetBaudRate() { HMI_data.Baud115K ? SetBaud115K() : SetBaud250K(); } - void SetBaudRate() { - HMI_data.Baud115K ^= true; - HMI_SetBaudRate(); - Draw_Chkb_Line(CurrentMenu->line(), HMI_data.Baud115K); + void hmiSetBaudRate() { hmiData.baud115K ? setBaud115K() : setBaud250K(); } + void setBaudRate() { + hmiData.baud115K ^= true; + hmiSetBaudRate(); + drawCheckboxLine(currentMenu->line(), hmiData.baud115K); dwinUpdateLCD(); } - void SetBaud115K() { queue.inject(F("M575 P0 B115200")); HMI_data.Baud115K = true; } - void SetBaud250K() { queue.inject(F("M575 P0 B250000")); HMI_data.Baud115K = false; } + void setBaud115K() { queue.inject(F("M575 P0 B115200")); hmiData.baud115K = true; } + void setBaud250K() { queue.inject(F("M575 P0 B250000")); hmiData.baud115K = false; } #endif #if HAS_LCD_BRIGHTNESS - void ApplyBrightness() { ui.set_brightness(MenuData.Value); } - void LiveBrightness() { dwinLCDBrightness(MenuData.Value); } - void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); } - void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_RedrawScreen(); } + void applyBrightness() { ui.set_brightness(menuData.value); } + void liveBrightness() { dwinLCDBrightness(menuData.value); } + void setBrightness() { setIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, applyBrightness, liveBrightness); } + void turnOffBacklight() { hmiSaveProcessID(ID_WaitResponse); ui.set_brightness(0); dwinRedrawScreen(); } #endif #if ENABLED(CASE_LIGHT_MENU) - void SetCaseLight() { - Toggle_Chkb_Line(caselight.on); + void setCaseLight() { + toggleCheckboxLine(caselight.on); caselight.update_enabled(); } #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - void LiveCaseLightBrightness() { caselight.brightness = MenuData.Value; caselight.update_brightness(); } - void SetCaseLightBrightness() { SetIntOnClick(0, 255, caselight.brightness, nullptr, LiveCaseLightBrightness); } + void liveCaseLightBrightness() { caselight.brightness = menuData.value; caselight.update_brightness(); } + void setCaseLightBrightness() { setIntOnClick(0, 255, caselight.brightness, nullptr, liveCaseLightBrightness); } #endif #endif #if ENABLED(LED_CONTROL_MENU) #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - void SetLedStatus() { + void setLedStatus() { leds.toggle(); - Show_Chkb_Line(leds.lights_on); + showCheckboxLine(leds.lights_on); } #endif #if HAS_COLOR_LEDS - void ApplyLEDColor() { - HMI_data.Led_Color = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, HMI_data.Led_Color.w) } ); - } - void LiveLEDColor(uint8_t *color) { *color = MenuData.Value; leds.update(); } - void LiveLEDColorR() { LiveLEDColor(&leds.color.r); } - void LiveLEDColorG() { LiveLEDColor(&leds.color.g); } - void LiveLEDColorB() { LiveLEDColor(&leds.color.b); } - void SetLEDColorR() { SetIntOnClick(0, 255, leds.color.r, ApplyLEDColor, LiveLEDColorR); } - void SetLEDColorG() { SetIntOnClick(0, 255, leds.color.g, ApplyLEDColor, LiveLEDColorG); } - void SetLEDColorB() { SetIntOnClick(0, 255, leds.color.b, ApplyLEDColor, LiveLEDColorB); } + void applyLEDColor() { + hmiData.ledColor = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, hmiData.ledColor.w) } ); + } + void liveLEDColor(uint8_t *color) { *color = menuData.value; leds.update(); } + void liveLEDColorR() { liveLEDColor(&leds.color.r); } + void liveLEDColorG() { liveLEDColor(&leds.color.g); } + void liveLEDColorB() { liveLEDColor(&leds.color.b); } + void setLEDColorR() { setIntOnClick(0, 255, leds.color.r, applyLEDColor, liveLEDColorR); } + void setLEDColorG() { setIntOnClick(0, 255, leds.color.g, applyLEDColor, liveLEDColorG); } + void setLEDColorB() { setIntOnClick(0, 255, leds.color.b, applyLEDColor, liveLEDColorB); } #if HAS_WHITE_LED - void LiveLEDColorW() { LiveLEDColor(&leds.color.w); } - void SetLEDColorW() { SetIntOnClick(0, 255, leds.color.w, ApplyLEDColor, LiveLEDColorW); } + void liveLEDColorW() { liveLEDColor(&leds.color.w); } + void setLEDColorW() { setIntOnClick(0, 255, leds.color.w, applyLEDColor, liveLEDColorW); } #endif #endif #endif #if ENABLED(SOUND_MENU_ITEM) - void SetEnableSound() { - Toggle_Chkb_Line(ui.sound_on); + void setEnableSound() { + toggleCheckboxLine(ui.sound_on); } #endif #if HAS_HOME_OFFSET - void ApplyHomeOffset() { set_home_offset(HMI_value.axis, MenuData.Value / MINUNITMULT); } - void SetHomeOffsetX() { HMI_value.axis = X_AXIS; SetPFloatOnClick(-50, 50, UNITFDIGITS, ApplyHomeOffset); } - void SetHomeOffsetY() { HMI_value.axis = Y_AXIS; SetPFloatOnClick(-50, 50, UNITFDIGITS, ApplyHomeOffset); } - void SetHomeOffsetZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick( -2, 2, UNITFDIGITS, ApplyHomeOffset); } + void applyHomeOffset() { set_home_offset(hmiValue.axis, menuData.value / MINUNITMULT); } + void setHomeOffsetX() { hmiValue.axis = X_AXIS; setPFloatOnClick(-50, 50, UNITFDIGITS, applyHomeOffset); } + void setHomeOffsetY() { hmiValue.axis = Y_AXIS; setPFloatOnClick(-50, 50, UNITFDIGITS, applyHomeOffset); } + void setHomeOffsetZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick( -2, 2, UNITFDIGITS, applyHomeOffset); } #endif #if HAS_BED_PROBE - void SetProbeOffsetX() { SetPFloatOnClick(-60, 60, UNITFDIGITS); } - void SetProbeOffsetY() { SetPFloatOnClick(-60, 60, UNITFDIGITS); } - void SetProbeOffsetZ() { SetPFloatOnClick(-10, 10, 2); } - void ProbeTest() { + void setProbeOffsetX() { setPFloatOnClick(-60, 60, UNITFDIGITS); } + void setProbeOffsetY() { setPFloatOnClick(-60, 60, UNITFDIGITS); } + void setProbeOffsetZ() { setPFloatOnClick(-10, 10, 2); } + void probeTest() { LCD_MESSAGE(MSG_M48_TEST); queue.inject(F("G28O\nM48 P10")); } - void ProbeStow() { probe.stow(); } - void ProbeDeploy() { probe.deploy(); } + void probeStow() { probe.stow(); } + void probeDeploy() { probe.deploy(); } #if HAS_BLTOUCH_HS_MODE - void SetHSMode() { Toggle_Chkb_Line(bltouch.high_speed_mode); } + void setHSMode() { toggleCheckboxLine(bltouch.high_speed_mode); } #endif #endif #if HAS_FILAMENT_SENSOR - void SetRunoutEnable() { + void setRunoutEnable() { runout.reset(); - Toggle_Chkb_Line(runout.enabled); + toggleCheckboxLine(runout.enabled); } #if HAS_FILAMENT_RUNOUT_DISTANCE - void ApplyRunoutDistance() { runout.set_runout_distance(MenuData.Value / MINUNITMULT); } - void SetRunoutDistance() { SetFloatOnClick(0, 999, UNITFDIGITS, runout.runout_distance(), ApplyRunoutDistance); } + void applyRunoutDistance() { runout.set_runout_distance(menuData.value / MINUNITMULT); } + void setRunoutDistance() { setFloatOnClick(0, 999, UNITFDIGITS, runout.runout_distance(), applyRunoutDistance); } #endif #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void SetFilLoad() { SetPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } - void SetFilUnload() { SetPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } + void setFilLoad() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } + void setFilUnload() { setPFloatOnClick(0, MAX_LOAD_UNLOAD, UNITFDIGITS); } #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - void ApplyExtMinT() { thermalManager.extrude_min_temp = HMI_data.ExtMinT; thermalManager.allow_cold_extrude = (HMI_data.ExtMinT == 0); } - void SetExtMinT() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP, ApplyExtMinT); } + void applyExtMinT() { thermalManager.extrude_min_temp = hmiData.extMinT; thermalManager.allow_cold_extrude = (hmiData.extMinT == 0); } + void setExtMinT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP, applyExtMinT); } #endif -void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } +void setSpeed() { setPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #if HAS_HOTEND - void ApplyHotendTemp() { thermalManager.setTargetHotend(MenuData.Value, 0); } - void SetHotendTemp() { SetIntOnClick(MIN_ETEMP, MAX_ETEMP, thermalManager.degTargetHotend(0), ApplyHotendTemp); } + void applyHotendTemp() { thermalManager.setTargetHotend(menuData.value, 0); } + void setHotendTemp() { setIntOnClick(MIN_ETEMP, MAX_ETEMP, thermalManager.degTargetHotend(0), applyHotendTemp); } #endif #if HAS_HEATED_BED - void ApplyBedTemp() { thermalManager.setTargetBed(MenuData.Value); } - void SetBedTemp() { SetIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP, thermalManager.degTargetBed(), ApplyBedTemp); } + void applyBedTemp() { thermalManager.setTargetBed(menuData.value); } + void setBedTemp() { setIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP, thermalManager.degTargetBed(), applyBedTemp); } #endif #if HAS_FAN - void ApplyFanSpeed() { thermalManager.set_fan_speed(0, MenuData.Value); } - void SetFanSpeed() { SetIntOnClick(0, 255, thermalManager.fan_speed[0], ApplyFanSpeed); } + void applyFanSpeed() { thermalManager.set_fan_speed(0, menuData.value); } + void setFanSpeed() { setIntOnClick(0, 255, thermalManager.fan_speed[0], applyFanSpeed); } #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void ChangeFilament() { - HMI_SaveProcessID(NothingToDo); + void changeFilament() { + hmiSaveProcessID(ID_NothingToDo); queue.inject(F("M600 B2")); } #if ENABLED(NOZZLE_PARK_FEATURE) - void ParkHead() { + void parkHead() { LCD_MESSAGE(MSG_FILAMENT_PARK_ENABLED); queue.inject(F("G28O\nG27")); } #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - void UnloadFilament() { + void unloadFilament() { LCD_MESSAGE(MSG_FILAMENTUNLOAD); queue.inject(F("M702 Z20")); } - void LoadFilament() { + void loadFilament() { LCD_MESSAGE(MSG_FILAMENTLOAD); queue.inject(F("M701 Z20")); } @@ -2278,13 +2282,13 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #endif // ADVANCED_PAUSE_FEATURE -void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refresh_e_factor(0); }); } +void setFlow() { setPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refresh_e_factor(0); }); } // Bed Tramming #if ENABLED(LCD_BED_TRAMMING) - void TramXY(const uint8_t point, float &x, float &y) { + void tramXY(const uint8_t point, float &x, float &y) { switch (point) { case 0: LCD_MESSAGE(MSG_TRAM_FL); @@ -2317,14 +2321,14 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #if HAS_BED_PROBE - float Tram(const uint8_t point) { + float tram(const uint8_t point) { static bool inLev = false; if (inLev) return NAN; float xpos = 0, ypos = 0, zval = 0; - TramXY(point, xpos, ypos); + tramXY(point, xpos, ypos); - if (HMI_data.FullManualTramming) { + if (hmiData.fullManualTramming) { queue.inject(MString<100>( F("M420S0\nG28O\nG90\nG0F300Z5\nG0F5000X"), p_float_t(xpos, 1), 'Y', p_float_t(ypos, 1), F("\nG0F300Z0") )); @@ -2361,9 +2365,9 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #else - void Tram(const uint8_t point) { + void tram(const uint8_t point) { float xpos = 0, ypos = 0; - TramXY(point, xpos, ypos); + tramXY(point, xpos, ypos); queue.inject(MString<100>( F("M420S0\nG28O\nG90\nG0F300Z5\nG0F5000X"), p_float_t(xpos, 1), 'Y', p_float_t(ypos, 1), F("\nG0F300Z0") )); @@ -2371,49 +2375,49 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #endif - inline void TramFL() { Tram(0); } - inline void TramFR() { Tram(1); } - inline void TramBR() { Tram(2); } - inline void TramBL() { Tram(3); } + inline void tramFL() { tram(0); } + inline void tramFR() { tram(1); } + inline void tramBR() { tram(2); } + inline void tramBL() { tram(3); } #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) - inline void TramC() { Tram(4); } + inline void tramC() { tram(4); } #endif #if HAS_BED_PROBE && HAS_MESH - void Trammingwizard() { - if (HMI_data.FullManualTramming) { + void trammingwizard() { + if (hmiData.fullManualTramming) { LCD_MESSAGE_F("Disable manual tramming"); return; } bed_mesh_t zval = {0}; - zval[0][0] = TramFL(); - checkkey = NothingToDo; - MeshViewer.DrawMesh(zval, 2, 2); - zval[1][0] = TramFR(); - MeshViewer.DrawMesh(zval, 2, 2); - zval[1][1] = TramBR(); - MeshViewer.DrawMesh(zval, 2, 2); - zval[0][1] = TramBL(); - MeshViewer.DrawMesh(zval, 2, 2); - - DWINUI::Draw_CenteredString(140, F("Calculating average")); - DWINUI::Draw_CenteredString(160, F("and relative heights")); + zval[0][0] = tramFL(); + checkkey = ID_NothingToDo; + meshViewer.drawMesh(zval, 2, 2); + zval[1][0] = tramFR(); + meshViewer.drawMesh(zval, 2, 2); + zval[1][1] = tramBR(); + meshViewer.drawMesh(zval, 2, 2); + zval[0][1] = tramBL(); + meshViewer.drawMesh(zval, 2, 2); + + DWINUI::drawCenteredString(140, F("Calculating average")); + DWINUI::drawCenteredString(160, F("and relative heights")); safe_delay(1000); float avg = 0.0f; for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) avg += zval[x][y]; avg /= 4.0f; for (uint8_t x = 0; x < 2; ++x) for (uint8_t y = 0; y < 2; ++y) zval[x][y] -= avg; - MeshViewer.DrawMesh(zval, 2, 2); + meshViewer.drawMesh(zval, 2, 2); ui.reset_status(); #ifndef BED_TRAMMING_PROBE_TOLERANCE #define BED_TRAMMING_PROBE_TOLERANCE 0.05 #endif - if (ABS(MeshViewer.max - MeshViewer.min) < BED_TRAMMING_PROBE_TOLERANCE) { - DWINUI::Draw_CenteredString(140, F("Corners leveled")); - DWINUI::Draw_CenteredString(160, F("Tolerance achieved!")); + if (ABS(meshViewer.max - meshViewer.min) < BED_TRAMMING_PROBE_TOLERANCE) { + DWINUI::drawCenteredString(140, F("Corners leveled")); + DWINUI::drawCenteredString(160, F("Tolerance achieved!")); } else { uint8_t p = 0; @@ -2435,18 +2439,18 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr case 0b11 : plabel = GET_TEXT_F(MSG_TRAM_BR); break; default : plabel = F(""); break; } - DWINUI::Draw_CenteredString(120, F("Corners not leveled")); - DWINUI::Draw_CenteredString(140, F("Knob adjustment required")); - DWINUI::Draw_CenteredString(Color_Green, 160, s ? F("Lower") : F("Raise")); - DWINUI::Draw_CenteredString(Color_Green, 180, plabel); + DWINUI::drawCenteredString(120, F("Corners not leveled")); + DWINUI::drawCenteredString(140, F("Knob adjustment required")); + DWINUI::drawCenteredString(COLOR_GREEN, 160, s ? F("Lower") : F("Raise")); + DWINUI::drawCenteredString(COLOR_GREEN, 180, plabel); } - DWINUI::Draw_Button(BTN_Continue, 86, 305); - checkkey = Menu; - HMI_SaveProcessID(WaitResponse); + DWINUI::drawButton(BTN_Continue, 86, 305); + checkkey = ID_Menu; + hmiSaveProcessID(ID_WaitResponse); } - void SetManualTramming() { - Toggle_Chkb_Line(HMI_data.FullManualTramming); + void setManualTramming() { + toggleCheckboxLine(hmiData.fullManualTramming); } #endif // HAS_BED_PROBE && HAS_MESH @@ -2455,30 +2459,30 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #if ENABLED(MESH_BED_LEVELING) - void ManualMeshStart() { + void manualMeshStart() { LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU); gcode.process_subcommands_now(F("G28XYO\nG28Z\nM211S0\nG29S1")); #ifdef MANUAL_PROBE_START_Z - const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos); - DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, 2, VALX - 2 * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), MANUAL_PROBE_START_Z); + const uint8_t line = currentMenu->line(mMeshMoveZItem->pos); + DWINUI::drawSignedFloat(hmiData.colorText, hmiData.colorBackground, 3, 2, VALX - 2 * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), MANUAL_PROBE_START_Z); #endif } - void LiveMeshMoveZ() { - *MenuData.P_Float = MenuData.Value / POW(10, 2); + void liveMeshMoveZ() { + *menuData.floatPtr = menuData.value / POW(10, 2); if (!planner.is_full()) { planner.synchronize(); planner.buffer_line(current_position, manual_feedrate_mm_s[Z_AXIS]); } } - void SetMMeshMoveZ() { SetPFloatOnClick(-1, 1, 2, planner.synchronize, LiveMeshMoveZ); } + void setMMeshMoveZ() { setPFloatOnClick(-1, 1, 2, planner.synchronize, liveMeshMoveZ); } - void ManualMeshContinue() { + void manualMeshContinue() { gcode.process_subcommands_now(F("G29S2")); - MMeshMoveZItem->redraw(); + mMeshMoveZItem->redraw(); } - void ManualMeshSave() { + void manualMeshSave() { LCD_MESSAGE(MSG_UBL_STORAGE_MESH_MENU); queue.inject(F("M211S1\nM500")); } @@ -2487,207 +2491,207 @@ void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, []{ planner.refr #if HAS_PREHEAT #if HAS_HOTEND - void SetPreheatEndTemp() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } + void setPreheatEndTemp() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif #if HAS_HEATED_BED - void SetPreheatBedTemp() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + void setPreheatBedTemp() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif #if HAS_FAN - void SetPreheatFanSpeed() { SetPIntOnClick(0, 255); } + void setPreheatFanSpeed() { setPIntOnClick(0, 255); } #endif #endif -void ApplyMaxSpeed() { planner.set_max_feedrate(HMI_value.axis, MenuData.Value / MINUNITMULT); } +void applyMaxSpeed() { planner.set_max_feedrate(hmiValue.axis, menuData.value / MINUNITMULT); } #if HAS_X_AXIS - void SetMaxSpeedX() { HMI_value.axis = X_AXIS, SetFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], ApplyMaxSpeed); } + void setMaxSpeedX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], applyMaxSpeed); } #endif #if HAS_Y_AXIS - void SetMaxSpeedY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], ApplyMaxSpeed); } + void setMaxSpeedY() { hmiValue.axis = Y_AXIS, setFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], applyMaxSpeed); } #endif #if HAS_Z_AXIS - void SetMaxSpeedZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], ApplyMaxSpeed); } + void setMaxSpeedZ() { hmiValue.axis = Z_AXIS, setFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], applyMaxSpeed); } #endif #if HAS_HOTEND - void SetMaxSpeedE() { HMI_value.axis = E_AXIS; SetFloatOnClick(min_feedrate_edit_values.e, max_feedrate_edit_values.e, UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], ApplyMaxSpeed); } + void setMaxSpeedE() { hmiValue.axis = E_AXIS; setFloatOnClick(min_feedrate_edit_values.e, max_feedrate_edit_values.e, UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], applyMaxSpeed); } #endif -void ApplyMaxAccel() { planner.set_max_acceleration(HMI_value.axis, MenuData.Value); } +void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.value); } #if HAS_X_AXIS - void SetMaxAccelX() { HMI_value.axis = X_AXIS, SetIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], ApplyMaxAccel); } + void setMaxAccelX() { hmiValue.axis = X_AXIS, setIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], applyMaxAccel); } #endif #if HAS_Y_AXIS - void SetMaxAccelY() { HMI_value.axis = Y_AXIS, SetIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], ApplyMaxAccel); } + void setMaxAccelY() { hmiValue.axis = Y_AXIS, setIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], applyMaxAccel); } #endif #if HAS_Z_AXIS - void SetMaxAccelZ() { HMI_value.axis = Z_AXIS, SetIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], ApplyMaxAccel); } + void setMaxAccelZ() { hmiValue.axis = Z_AXIS, setIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], applyMaxAccel); } #endif #if HAS_HOTEND - void SetMaxAccelE() { HMI_value.axis = E_AXIS; SetIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], ApplyMaxAccel); } + void setMaxAccelE() { hmiValue.axis = E_AXIS; setIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], applyMaxAccel); } #endif #if HAS_CLASSIC_JERK - void ApplyMaxJerk() { planner.set_max_jerk(HMI_value.axis, MenuData.Value / MINUNITMULT); } + void applyMaxJerk() { planner.set_max_jerk(hmiValue.axis, menuData.value / MINUNITMULT); } #if HAS_X_AXIS - void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, ApplyMaxJerk); } + void setMaxJerkX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, applyMaxJerk); } #endif #if HAS_Y_AXIS - void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, ApplyMaxJerk); } + void setMaxJerkY() { hmiValue.axis = Y_AXIS, setFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, applyMaxJerk); } #endif #if HAS_Z_AXIS - void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, ApplyMaxJerk); } + void setMaxJerkZ() { hmiValue.axis = Z_AXIS, setFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, applyMaxJerk); } #endif #if HAS_HOTEND - void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(min_jerk_edit_values.e, max_jerk_edit_values.e, UNITFDIGITS, planner.max_jerk.e, ApplyMaxJerk); } + void setMaxJerkE() { hmiValue.axis = E_AXIS; setFloatOnClick(min_jerk_edit_values.e, max_jerk_edit_values.e, UNITFDIGITS, planner.max_jerk.e, applyMaxJerk); } #endif #elif HAS_JUNCTION_DEVIATION - void ApplyJDmm() { TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk()); } - void SetJDmm() { SetPFloatOnClick(MIN_JD_MM, MAX_JD_MM, 3, ApplyJDmm); } + void applyJDmm() { TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk()); } + void setJDmm() { setPFloatOnClick(MIN_JD_MM, MAX_JD_MM, 3, applyJDmm); } #endif #if ENABLED(LIN_ADVANCE) - void SetLA_K() { SetPFloatOnClick(0, 10, 3); } + void setLA_K() { setPFloatOnClick(0, 10, 3); } #endif #if HAS_X_AXIS - void SetStepsX() { HMI_value.axis = X_AXIS, SetPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); } + void setStepsX() { hmiValue.axis = X_AXIS, setPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); } #endif #if HAS_Y_AXIS - void SetStepsY() { HMI_value.axis = Y_AXIS, SetPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); } + void setStepsY() { hmiValue.axis = Y_AXIS, setPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); } #endif #if HAS_Z_AXIS - void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); } + void setStepsZ() { hmiValue.axis = Z_AXIS, setPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); } #endif #if HAS_HOTEND - void SetStepsE() { HMI_value.axis = E_AXIS; SetPFloatOnClick( min_steps_edit_values.e, max_steps_edit_values.e, UNITFDIGITS); } + void setStepsE() { hmiValue.axis = E_AXIS; setPFloatOnClick( min_steps_edit_values.e, max_steps_edit_values.e, UNITFDIGITS); } #endif #if ENABLED(FWRETRACT) - void Return_FWRetract_Menu() { (PreviousMenu == FilSetMenu) ? Draw_FilSet_Menu() : Draw_Tune_Menu(); } - void SetRetractLength() { SetPFloatOnClick( 0, 10, UNITFDIGITS); } - void SetRetractSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); } - void SetZRaise() { SetPFloatOnClick( 0, 2, 2); } - void SetRecoverSpeed() { SetPFloatOnClick( 1, 90, UNITFDIGITS); } - void SetAddRecover() { SetPFloatOnClick(-5, 5, UNITFDIGITS); } + void returnFWRetractMenu() { (previousMenu == filSetMenu) ? drawFilSetMenu() : drawTuneMenu(); } + void setRetractLength() { setPFloatOnClick( 0, 10, UNITFDIGITS); } + void setRetractSpeed() { setPFloatOnClick( 1, 90, UNITFDIGITS); } + void setZRaise() { setPFloatOnClick( 0, 2, 2); } + void setRecoverSpeed() { setPFloatOnClick( 1, 90, UNITFDIGITS); } + void setAddRecover() { setPFloatOnClick(-5, 5, UNITFDIGITS); } #endif // Special Menuitem Drawing functions ================================================= -void onDrawBack(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 129, 72, 156, 84); +void onDrawBack(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 129, 72, 156, 84); onDrawMenuItem(menuitem, line); } -void onDrawTempSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 57, 104, 84, 116); +void onDrawTempSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 57, 104, 84, 116); onDrawSubMenu(menuitem, line); } -void onDrawMotionSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 87, 104, 114, 116); +void onDrawMotionSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 87, 104, 114, 116); onDrawSubMenu(menuitem, line); } #if ENABLED(EEPROM_SETTINGS) - void onDrawWriteEeprom(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 117, 104, 172, 116); + void onDrawWriteEeprom(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 117, 104, 172, 116); onDrawMenuItem(menuitem, line); } - void onDrawReadEeprom(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 174, 103, 229, 116); + void onDrawReadEeprom(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 174, 103, 229, 116); onDrawMenuItem(menuitem, line); } - void onDrawResetEeprom(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 118, 56, 131); + void onDrawResetEeprom(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 118, 56, 131); onDrawMenuItem(menuitem, line); } #endif -void onDrawInfoSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 231, 104, 258, 116); +void onDrawInfoSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 231, 104, 258, 116); onDrawSubMenu(menuitem, line); } -void onDrawMoveX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 58, 118, 106, 132); +void onDrawMoveX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 58, 118, 106, 132); onDrawPFloatMenu(menuitem, line); } -void onDrawMoveY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 109, 118, 157, 132); +void onDrawMoveY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 109, 118, 157, 132); onDrawPFloatMenu(menuitem, line); } -void onDrawMoveZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132); +void onDrawMoveZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 160, 118, 209, 132); onDrawPFloatMenu(menuitem, line); } #if HAS_HOTEND - void onDrawMoveE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 212, 118, 253, 131); + void onDrawMoveE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 212, 118, 253, 131); onDrawPFloatMenu(menuitem, line); } #endif -void onDrawMoveSubMenu(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 159, 70, 200, 84); +void onDrawMoveSubMenu(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 159, 70, 200, 84); onDrawSubMenu(menuitem, line); } -void onDrawDisableMotors(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 204, 70, 259, 82); +void onDrawDisableMotors(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 204, 70, 259, 82); onDrawMenuItem(menuitem, line); } -void onDrawAutoHome(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 0, 89, 41, 101); +void onDrawAutoHome(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 0, 89, 41, 101); onDrawMenuItem(menuitem, line); } #if HAS_ZOFFSET_ITEM #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) - void onDrawZOffset(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 174, 164, 223, 177); + void onDrawZOffset(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 174, 164, 223, 177); onDrawPFloat2Menu(menuitem, line); } #endif #endif #if HAS_HOTEND - void onDrawPreheat1(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 100, 89, 151, 101); + void onDrawPreheat1(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 100, 89, 151, 101); onDrawMenuItem(menuitem, line); } #if PREHEAT_COUNT > 1 - void onDrawPreheat2(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 180, 89, 233, 100); + void onDrawPreheat2(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 180, 89, 233, 100); onDrawMenuItem(menuitem, line); } #endif #endif #if HAS_PREHEAT - void onDrawCooldown(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 104, 56, 117); + void onDrawCooldown(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 104, 56, 117); onDrawMenuItem(menuitem, line); } #endif -void onDrawLanguage(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 239, 134, 266, 146); +void onDrawLanguage(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 239, 134, 266, 146); onDrawMenuItem(menuitem, line); - DWINUI::Draw_String(VALX, MBASE(line), HMI_IsChinese() ? F("CN") : F("EN")); + DWINUI::drawString(VALX, MBASE(line), hmiIsChinese() ? F("CN") : F("EN")); } -void onDrawSelColorItem(MenuItemClass* menuitem, int8_t line) { - const uint16_t color = *(uint16_t*)static_cast(menuitem)->value; - dwinDrawRectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); +void onDrawSelColorItem(MenuItem* menuitem, int8_t line) { + const uint16_t color = *(uint16_t*)static_cast(menuitem)->value; + dwinDrawRectangle(0, hmiData.colorHighlight, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); dwinDrawRectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17); onDrawMenuItem(menuitem, line); } -void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) { +void onDrawGetColorItem(MenuItem* menuitem, int8_t line) { const uint8_t i = menuitem->icon; uint16_t color; switch (i) { @@ -2696,165 +2700,165 @@ void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) { case 2: color = RGB(0, 0, 31); break; // Blue default: color = 0; break; } - dwinDrawRectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); + dwinDrawRectangle(0, hmiData.colorHighlight, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); dwinDrawRectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17); - DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption); - Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, HMI_value.Color[i]); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); + DWINUI::drawString(LBLX, MBASE(line) - 1, menuitem->caption); + drawMenuIntValue(hmiData.colorBackground, line, 4, hmiValue.Color[i]); + dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240); } -void onDrawSpeedItem(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 116, 164, 171, 176); +void onDrawSpeedItem(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 116, 164, 171, 176); onDrawPIntMenu(menuitem, line); } #if HAS_HOTEND - void onDrawHotendTemp(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 134, 56, 146); + void onDrawHotendTemp(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 134, 56, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_HEATED_BED - void onDrawBedTemp(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 58, 134, 113, 146); + void onDrawBedTemp(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 58, 134, 113, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_FAN - void onDrawFanSpeed(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 115, 134, 170, 146); + void onDrawFanSpeed(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 115, 134, 170, 146); onDrawPInt8Menu(menuitem, line); } #endif -void onDrawSteps(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 153, 148, 194, 161); +void onDrawSteps(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 153, 148, 194, 161); onDrawSubMenu(menuitem, line); } #if ENABLED(MESH_BED_LEVELING) - void onDrawMMeshMoveZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132); + void onDrawMMeshMoveZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 160, 118, 209, 132); onDrawPFloat2Menu(menuitem, line); } #endif #if HAS_PREHEAT #if HAS_HOTEND - void onDrawSetPreheatHotend(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 1, 134, 56, 146); + void onDrawSetPreheatHotend(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 1, 134, 56, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_HEATED_BED - void onDrawSetPreheatBed(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 58, 134, 113, 146); + void onDrawSetPreheatBed(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 58, 134, 113, 146); onDrawPIntMenu(menuitem, line); } #endif #if HAS_FAN - void onDrawSetPreheatFan(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) menuitem->SetFrame(1, 115, 134, 170, 146); + void onDrawSetPreheatFan(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) menuitem->setFrame(1, 115, 134, 170, 146); onDrawPIntMenu(menuitem, line); } #endif #endif // HAS_PREHEAT -void onDrawSpeed(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) - menuitem->SetFrame(1, 173, 133, 228, 147); +void onDrawSpeed(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) + menuitem->setFrame(1, 173, 133, 228, 147); onDrawSubMenu(menuitem, line); } #if HAS_X_AXIS - void onDrawMaxSpeedX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X + void onDrawMaxSpeedX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(line)); // X } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawMaxSpeedY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y + void onDrawMaxSpeedY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(line)); // Y } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawMaxSpeedZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z + void onDrawMaxSpeedZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(line) + 3); // Z } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_HOTEND - void onDrawMaxSpeedE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 228, 147); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 58, MBASE(line)); // E + void onDrawMaxSpeedE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 228, 147); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 58, MBASE(line)); // E } onDrawPFloatMenu(menuitem, line); } #endif -void onDrawAcc(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration +void onDrawAcc(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line) + 1); // ...Acceleration } onDrawSubMenu(menuitem, line); } #if HAS_X_AXIS - void onDrawMaxAccelX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X + void onDrawMaxAccelX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(line)); // X } onDrawPInt32Menu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawMaxAccelY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y + void onDrawMaxAccelY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(line)); // Y } onDrawPInt32Menu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z + void onDrawMaxAccelZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(line)); // Z } onDrawPInt32Menu(menuitem, line); } #endif #if HAS_HOTEND - void onDrawMaxAccelE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 71, MBASE(line)); // E + void onDrawMaxAccelE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 71, MBASE(line)); // E } onDrawPInt32Menu(menuitem, line); } @@ -2862,46 +2866,46 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #if HAS_CLASSIC_JERK - void onDrawJerk(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ... - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk + void onDrawJerk(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line) + 1); // ... + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(line)); // ...Jerk } onDrawSubMenu(menuitem, line); } #if HAS_X_AXIS - void onDrawMaxJerkX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line)); + void onDrawMaxJerkX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawMaxJerkY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line)); + void onDrawMaxJerkY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawMaxJerkZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line)); + void onDrawMaxJerkZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } @@ -2909,12 +2913,12 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #if HAS_HOTEND - void onDrawMaxJerkE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 173, 133, 200, 147); - DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); - DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 83, MBASE(line)); + void onDrawMaxJerkE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 173, 133, 200, 147); + dwinFrameAreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(line)); + dwinFrameAreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(line)); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 83, MBASE(line)); } onDrawPFloatMenu(menuitem, line); } @@ -2924,30 +2928,30 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #endif // HAS_CLASSIC_JERK #if HAS_X_AXIS - void onDrawStepsX(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X + void onDrawStepsX(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(line)); // X } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Y_AXIS - void onDrawStepsY(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y + void onDrawStepsY(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(line)); // Y } onDrawPFloatMenu(menuitem, line); } #endif #if HAS_Z_AXIS - void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z + void onDrawStepsZ(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(line)); // Z } onDrawPFloatMenu(menuitem, line); } @@ -2955,10 +2959,10 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #if HAS_HOTEND - void onDrawStepsE(MenuItemClass* menuitem, int8_t line) { - if (HMI_IsChinese()) { - menuitem->SetFrame(1, 153, 148, 194, 161); - DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 44, MBASE(line)); // E + void onDrawStepsE(MenuItem* menuitem, int8_t line) { + if (hmiIsChinese()) { + menuitem->setFrame(1, 153, 148, 194, 161); + dwinFrameAreaCopy(1, 18, 150, 25, 160, LBLX + 44, MBASE(line)); // E } onDrawPFloatMenu(menuitem, line); } @@ -2966,292 +2970,292 @@ void onDrawAcc(MenuItemClass* menuitem, int8_t line) { #endif #if HAS_ONESTEP_LEVELING - void onDrawManualTramming(MenuItemClass* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, HMI_data.FullManualTramming); } + void onDrawManualTramming(MenuItem* menuitem, int8_t line) { onDrawChkbMenu(menuitem, line, hmiData.fullManualTramming); } #endif // Menu Creation and Drawing functions ====================================================== frame_rect_t selrect(frame_rect_t) { - return HMI_IsChinese() ? frame_rect_t({ 133, 1, 28, 13 }) : frame_rect_t({ 0 }); + return hmiIsChinese() ? frame_rect_t({ 133, 1, 28, 13 }) : frame_rect_t({ 0 }); } -void Draw_Prepare_Menu() { - checkkey = Menu; - if (SET_MENU_R(PrepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) { - BACK_ITEM(Goto_Main_Menu); +void drawPrepareMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(prepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) { + BACK_ITEM(gotoMainMenu); #if ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, Draw_FilamentMan_Menu); + MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, drawFilamentManMenu); #endif - MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, Draw_Move_Menu); + MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, drawMoveMenu); #if ENABLED(LCD_BED_TRAMMING) - MENU_ITEM(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, Draw_Tramming_Menu); + MENU_ITEM(ICON_Tram, MSG_BED_TRAMMING, onDrawSubMenu, drawTrammingMenu); #endif - MENU_ITEM(ICON_CloseMotor, MSG_DISABLE_STEPPERS, onDrawDisableMotors, DisableMotors); + MENU_ITEM(ICON_CloseMotor, MSG_DISABLE_STEPPERS, onDrawDisableMotors, disableMotors); #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - MENU_ITEM(ICON_Homing, MSG_HOMING, onDrawSubMenu, Draw_Homing_Menu); + MENU_ITEM(ICON_Homing, MSG_HOMING, onDrawSubMenu, drawHomingMenu); #else - MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawAutoHome, AutoHome); + MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawAutoHome, autoHome); #endif #if ENABLED(MESH_BED_LEVELING) - MENU_ITEM(ICON_ManualMesh, MSG_MANUAL_MESH, onDrawSubMenu, Draw_ManualMesh_Menu); + MENU_ITEM(ICON_ManualMesh, MSG_MANUAL_MESH, onDrawSubMenu, drawManualMeshMenu); #elif HAS_BED_PROBE - MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); + MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, autoLevel); #endif #if HAS_ZOFFSET_ITEM #if HAS_BED_PROBE - MENU_ITEM(ICON_SetZOffset, MSG_PROBE_WIZARD, onDrawSubMenu, Draw_ZOffsetWiz_Menu); + MENU_ITEM(ICON_SetZOffset, MSG_PROBE_WIZARD, onDrawSubMenu, drawZOffsetWizMenu); #elif ENABLED(BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); #endif #endif #if HAS_PREHEAT #define _ITEM_PREHEAT(N) MENU_ITEM(ICON_Preheat##N, MSG_PREHEAT_##N, onDrawMenuItem, DoPreheat##N); REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT) #endif - MENU_ITEM(ICON_Cool, MSG_COOLDOWN, onDrawCooldown, DoCoolDown); - MENU_ITEM(ICON_Language, MSG_UI_LANGUAGE, onDrawLanguage, SetLanguage); + MENU_ITEM(ICON_Cool, MSG_COOLDOWN, onDrawCooldown, doCoolDown); + MENU_ITEM(ICON_Language, MSG_UI_LANGUAGE, onDrawLanguage, setLanguage); } ui.reset_status(true); - UpdateMenu(PrepareMenu); + updateMenu(prepareMenu); } #if ENABLED(LCD_BED_TRAMMING) - void Draw_Tramming_Menu() { - checkkey = Menu; - if (SET_MENU(TrammingMenu, MSG_BED_TRAMMING, 8)) { - BACK_ITEM(Draw_Prepare_Menu); + void drawTrammingMenu() { + checkkey = ID_Menu; + if (SET_MENU(trammingMenu, MSG_BED_TRAMMING, 8)) { + BACK_ITEM(drawPrepareMenu); #if HAS_BED_PROBE && HAS_MESH - MENU_ITEM(ICON_ProbeSet, MSG_TRAMMING_WIZARD, onDrawMenuItem, Trammingwizard); - EDIT_ITEM(ICON_ProbeSet, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, SetManualTramming, &HMI_data.FullManualTramming); + MENU_ITEM(ICON_ProbeSet, MSG_TRAMMING_WIZARD, onDrawMenuItem, trammingwizard); + EDIT_ITEM(ICON_ProbeSet, MSG_BED_TRAMMING_MANUAL, onDrawChkbMenu, setManualTramming, &hmiData.fullManualTramming); #elif !HAS_BED_PROBE && HAS_ZOFFSET_ITEM - MENU_ITEM_F(ICON_MoveZ0, "Home Z and disable", onDrawMenuItem, HomeZandDisable); + MENU_ITEM_F(ICON_MoveZ0, "Home Z and disable", onDrawMenuItem, homeZAndDisable); #endif - MENU_ITEM(ICON_Axis, MSG_TRAM_FL, onDrawMenuItem, TramFL); - MENU_ITEM(ICON_Axis, MSG_TRAM_FR, onDrawMenuItem, TramFR); - MENU_ITEM(ICON_Axis, MSG_TRAM_BR, onDrawMenuItem, TramBR); - MENU_ITEM(ICON_Axis, MSG_TRAM_BL, onDrawMenuItem, TramBL); + MENU_ITEM(ICON_Axis, MSG_TRAM_FL, onDrawMenuItem, tramFL); + MENU_ITEM(ICON_Axis, MSG_TRAM_FR, onDrawMenuItem, tramFR); + MENU_ITEM(ICON_Axis, MSG_TRAM_BR, onDrawMenuItem, tramBR); + MENU_ITEM(ICON_Axis, MSG_TRAM_BL, onDrawMenuItem, tramBL); #if ENABLED(BED_TRAMMING_INCLUDE_CENTER) - MENU_ITEM(ICON_Axis, MSG_TRAM_C, onDrawMenuItem, TramC); + MENU_ITEM(ICON_Axis, MSG_TRAM_C, onDrawMenuItem, tramC); #endif } - UpdateMenu(TrammingMenu); + updateMenu(trammingMenu); } #endif // LCD_BED_TRAMMING -void Draw_Control_Menu() { - checkkey = Menu; +void drawControlMenu() { + checkkey = ID_Menu; if (SET_MENU_R(ControlMenu, selrect({103, 1, 28, 14}), MSG_CONTROL, 10)) { - BACK_ITEM(Goto_Main_Menu); - MENU_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawTempSubMenu, Draw_Temperature_Menu); - MENU_ITEM(ICON_Motion, MSG_MOTION, onDrawMotionSubMenu, Draw_Motion_Menu); + BACK_ITEM(gotoMainMenu); + MENU_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawTempSubMenu, drawTemperatureMenu); + MENU_ITEM(ICON_Motion, MSG_MOTION, onDrawMotionSubMenu, drawMotionMenu); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, WriteEeprom); - MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, ReadEeprom); - MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, ResetEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); + MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, readEEPROM); + MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, resetEEPROM); #endif - MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, RebootPrinter); + MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, rebootPrinter); #if ENABLED(CASE_LIGHT_MENU) #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, Draw_CaseLight_Menu); + MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, drawCaseLightMenu); #else - MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); + MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #endif #endif #if ENABLED(LED_CONTROL_MENU) - MENU_ITEM(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, Draw_LedControl_Menu); + MENU_ITEM(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, drawLedControlMenu); #endif - MENU_ITEM(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, Goto_Info_Menu); + MENU_ITEM(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, gotoInfoMenu); } ui.reset_status(true); - UpdateMenu(ControlMenu); + updateMenu(ControlMenu); } -void Draw_AdvancedSettings_Menu() { - checkkey = Menu; +void drawAdvancedSettingsMenu() { + checkkey = ID_Menu; if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 22)) { - BACK_ITEM(Goto_Main_Menu); + BACK_ITEM(gotoMainMenu); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif #if HAS_MESH - MENU_ITEM(ICON_ProbeSet, MSG_MESH_LEVELING, onDrawSubMenu, Draw_MeshSet_Menu); + MENU_ITEM(ICON_ProbeSet, MSG_MESH_LEVELING, onDrawSubMenu, drawMeshSetMenu); #endif #if HAS_BED_PROBE - MENU_ITEM(ICON_ProbeSet, MSG_ZPROBE_SETTINGS, onDrawSubMenu, Draw_ProbeSet_Menu); + MENU_ITEM(ICON_ProbeSet, MSG_ZPROBE_SETTINGS, onDrawSubMenu, drawProbeSetMenu); #endif - MENU_ITEM(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, Draw_FilSet_Menu); + MENU_ITEM(ICON_FilSet, MSG_FILAMENT_SET, onDrawSubMenu, drawFilSetMenu); #if ENABLED(PIDTEMP) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, Draw_HotendPID_Menu); + MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, drawHotendPIDMenu); #endif #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_MPCNozzle, "MPC Settings", onDrawSubMenu, Draw_HotendMPC_Menu); + MENU_ITEM_F(ICON_MPCNozzle, "MPC Settings", onDrawSubMenu, drawHotendMPCMenu); #endif #if ENABLED(PIDTEMPBED) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, Draw_BedPID_Menu); + MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, drawBedPIDMenu); #endif #if HAS_TRINAMIC_CONFIG - MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, Draw_TrinamicConfig_menu); + MENU_ITEM(ICON_TMCSet, MSG_TMC_DRIVERS, onDrawSubMenu, drawTrinamicConfigMenu); #endif #if HAS_ESDIAG - MENU_ITEM_F(ICON_ESDiag, "End-stops diag.", onDrawSubMenu, Draw_EndStopDiag); + MENU_ITEM_F(ICON_esDiag, "End-stops diag.", onDrawSubMenu, drawEndStopDiag); #endif #if ENABLED(PRINTCOUNTER) - MENU_ITEM(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, Goto_PrintStats); - MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, PrintStatsReset); + MENU_ITEM(ICON_PrintStats, MSG_INFO_STATS_MENU, onDrawSubMenu, gotoPrintStats); + MENU_ITEM(ICON_PrintStatsReset, MSG_INFO_PRINT_COUNT_RESET, onDrawSubMenu, printStatsReset); #endif #if HAS_LOCKSCREEN - MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen); #endif #if ENABLED(SOUND_MENU_ITEM) - EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, SetEnableSound, &ui.sound_on); + EDIT_ITEM(ICON_Sound, MSG_SOUND_ENABLE, onDrawChkbMenu, setEnableSound, &ui.sound_on); #endif #if ENABLED(POWER_LOSS_RECOVERY) - EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, SetPwrLossr, &recovery.enabled); + EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, setPwrLossr, &recovery.enabled); #endif #if HAS_GCODE_PREVIEW - EDIT_ITEM(ICON_File, MSG_HAS_PREVIEW, onDrawChkbMenu, SetPreview, &HMI_data.EnablePreview); + EDIT_ITEM(ICON_File, MSG_HAS_PREVIEW, onDrawChkbMenu, setPreview, &hmiData.enablePreview); #endif #if ENABLED(MEDIASORT_MENU_ITEM) - EDIT_ITEM(ICON_File, MSG_MEDIA_SORT, onDrawChkbMenu, SetMediaSort, &HMI_data.MediaSort); + EDIT_ITEM(ICON_File, MSG_MEDIA_SORT, onDrawChkbMenu, setMediaSort, &hmiData.mediaSort); #endif - EDIT_ITEM(ICON_File, MSG_MEDIA_UPDATE, onDrawChkbMenu, SetMediaAutoMount, &HMI_data.MediaAutoMount); + EDIT_ITEM(ICON_File, MSG_MEDIA_UPDATE, onDrawChkbMenu, setMediaAutoMount, &hmiData.mediaAutoMount); #if ENABLED(BAUD_RATE_GCODE) - EDIT_ITEM_F(ICON_SetBaudRate, "115K baud", onDrawChkbMenu, SetBaudRate, &HMI_data.Baud115K); + EDIT_ITEM_F(ICON_SetBaudRate, "115K baud", onDrawChkbMenu, setBaudRate, &hmiData.baud115K); #endif #if HAS_LCD_BRIGHTNESS - EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); + EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); + MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); #endif #if HAS_CUSTOM_COLORS - MENU_ITEM(ICON_Scolor, MSG_COLORS_SELECT, onDrawSubMenu, Draw_SelectColors_Menu); + MENU_ITEM(ICON_Scolor, MSG_COLORS_SELECT, onDrawSubMenu, drawSelectColorsMenu); #endif } ui.reset_status(true); - UpdateMenu(AdvancedSettings); + updateMenu(AdvancedSettings); } -void Draw_Move_Menu() { - checkkey = Menu; - if (SET_MENU_R(MoveMenu, selrect({192, 1, 42, 14}), MSG_MOVE_AXIS, 6)) { - BACK_ITEM(Draw_Prepare_Menu); - EDIT_ITEM(ICON_Axis, MSG_LIVE_MOVE, onDrawChkbMenu, SetLiveMove, &EnableLiveMove); +void drawMoveMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(moveMenu, selrect({192, 1, 42, 14}), MSG_MOVE_AXIS, 6)) { + BACK_ITEM(drawPrepareMenu); + EDIT_ITEM(ICON_Axis, MSG_LIVE_MOVE, onDrawChkbMenu, setLiveMove, &enableLiveMove); #if HAS_X_AXIS - EDIT_ITEM(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, SetMoveX, ¤t_position.x); + EDIT_ITEM(ICON_MoveX, MSG_MOVE_X, onDrawMoveX, setMoveX, ¤t_position.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, SetMoveY, ¤t_position.y); + EDIT_ITEM(ICON_MoveY, MSG_MOVE_Y, onDrawMoveY, setMoveY, ¤t_position.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, SetMoveZ, ¤t_position.z); + EDIT_ITEM(ICON_MoveZ, MSG_MOVE_Z, onDrawMoveZ, setMoveZ, ¤t_position.z); #endif #if HAS_HOTEND gcode.process_subcommands_now(F("G92E0")); // Reset extruder position - EDIT_ITEM(ICON_Extruder, MSG_MOVE_E, onDrawMoveE, SetMoveE, ¤t_position.e); + EDIT_ITEM(ICON_Extruder, MSG_MOVE_E, onDrawMoveE, setMoveE, ¤t_position.e); #endif } - UpdateMenu(MoveMenu); + updateMenu(moveMenu); if (!all_axes_trusted()) LCD_MESSAGE_F("WARNING: Current position unknown. Home axes."); } #if HAS_HOME_OFFSET - void Draw_HomeOffset_Menu() { - checkkey = Menu; - if (SET_MENU(HomeOffMenu, MSG_SET_HOME_OFFSETS, 4)) { - BACK_ITEM(Draw_PhySet_Menu); + void drawHomeOffsetMenu() { + checkkey = ID_Menu; + if (SET_MENU(homeOffsetMenu, MSG_SET_HOME_OFFSETS, 4)) { + BACK_ITEM(drawPhySetMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, SetHomeOffsetX, &home_offset.x); + EDIT_ITEM(ICON_HomeOffsetX, MSG_HOME_OFFSET_X, onDrawPFloatMenu, setHomeOffsetX, &home_offset.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, SetHomeOffsetY, &home_offset.y); + EDIT_ITEM(ICON_HomeOffsetY, MSG_HOME_OFFSET_Y, onDrawPFloatMenu, setHomeOffsetY, &home_offset.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, SetHomeOffsetZ, &home_offset.z); + EDIT_ITEM(ICON_HomeOffsetZ, MSG_HOME_OFFSET_Z, onDrawPFloatMenu, setHomeOffsetZ, &home_offset.z); #endif } - UpdateMenu(HomeOffMenu); + updateMenu(homeOffsetMenu); } #endif // HAS_HOME_OFFSET #if HAS_BED_PROBE - void Draw_ProbeSet_Menu() { - checkkey = Menu; + void drawProbeSetMenu() { + checkkey = ID_Menu; if (SET_MENU(ProbeSetMenu, MSG_ZPROBE_SETTINGS, 9)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + BACK_ITEM(drawAdvancedSettingsMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); + EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, setProbeOffsetX, &probe.offset.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); + EDIT_ITEM(ICON_ProbeOffsetY, MSG_ZPROBE_YOFFSET, onDrawPFloatMenu, setProbeOffsetY, &probe.offset.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); + EDIT_ITEM(ICON_ProbeOffsetZ, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, setProbeOffsetZ, &probe.offset.z); #endif #if ENABLED(BLTOUCH) - MENU_ITEM(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, ProbeStow); - MENU_ITEM(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, ProbeDeploy); + MENU_ITEM(ICON_ProbeStow, MSG_MANUAL_STOW, onDrawMenuItem, probeStow); + MENU_ITEM(ICON_ProbeDeploy, MSG_MANUAL_DEPLOY, onDrawMenuItem, probeDeploy); MENU_ITEM(ICON_BltouchReset, MSG_BLTOUCH_RESET, onDrawMenuItem, bltouch._reset); #if HAS_BLTOUCH_HS_MODE - EDIT_ITEM(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, SetHSMode, &bltouch.high_speed_mode); + EDIT_ITEM(ICON_HSMode, MSG_ENABLE_HS_MODE, onDrawChkbMenu, setHSMode, &bltouch.high_speed_mode); #endif #endif - MENU_ITEM(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, ProbeTest); + MENU_ITEM(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, probeTest); } - UpdateMenu(ProbeSetMenu); + updateMenu(ProbeSetMenu); } #endif // HAS_BED_PROBE -void Draw_FilSet_Menu() { - checkkey = Menu; - if (SET_MENU(FilSetMenu, MSG_FILAMENT_SET, 9)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); +void drawFilSetMenu() { + checkkey = ID_Menu; + if (SET_MENU(filSetMenu, MSG_FILAMENT_SET, 9)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if HAS_FILAMENT_SENSOR - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, SetRunoutEnable, &runout.enabled); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, setRunoutEnable, &runout.enabled); #endif #if HAS_FILAMENT_RUNOUT_DISTANCE - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance()); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, setRunoutDistance, &runout.runout_distance()); #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT); + EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT); #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length); - EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length); + EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, setFilLoad, &fc_settings[0].load_length); + EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, setFilUnload, &fc_settings[0].unload_length); #endif #if ENABLED(FWRETRACT) - MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); + MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, drawFWRetractMenu); #endif } - UpdateMenu(FilSetMenu); + updateMenu(filSetMenu); } #if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - void Draw_CaseLight_Menu() { - checkkey = Menu; - if (SET_MENU(CaseLightMenu, MSG_CASE_LIGHT, 3)) { - BACK_ITEM(Draw_Control_Menu); - EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); - EDIT_ITEM(ICON_Brightness, MSG_CASE_LIGHT_BRIGHTNESS, onDrawPInt8Menu, SetCaseLightBrightness, &caselight.brightness); + void drawCaseLightMenu() { + checkkey = ID_Menu; + if (SET_MENU(caseLightMenu, MSG_CASE_LIGHT, 3)) { + BACK_ITEM(drawControlMenu); + EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); + EDIT_ITEM(ICON_Brightness, MSG_CASE_LIGHT_BRIGHTNESS, onDrawPInt8Menu, setCaseLightBrightness, &caselight.brightness); } - UpdateMenu(CaseLightMenu); + updateMenu(caseLightMenu); } #endif #if ENABLED(LED_CONTROL_MENU) - void Draw_LedControl_Menu() { - checkkey = Menu; - if (SET_MENU(LedControlMenu, MSG_LED_CONTROL, 10)) { - BACK_ITEM(Draw_Control_Menu); + void drawLedControlMenu() { + checkkey = ID_Menu; + if (SET_MENU(ledControlMenu, MSG_LED_CONTROL, 10)) { + BACK_ITEM(drawControlMenu); #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) - EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); + EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, setLedStatus, &leds.lights_on); #endif #if HAS_COLOR_LEDS #if ENABLED(LED_COLOR_PRESETS) @@ -3264,363 +3268,363 @@ void Draw_FilSet_Menu() { MENU_ITEM(ICON_LedControl, MSG_SET_LEDS_INDIGO, onDrawMenuItem, leds.set_indigo); MENU_ITEM(ICON_LedControl, MSG_SET_LEDS_VIOLET, onDrawMenuItem, leds.set_violet); #else - EDIT_ITEM(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, SetLEDColorR, &leds.color.r); - EDIT_ITEM(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g); - EDIT_ITEM(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_RED, onDrawPInt8Menu, setLEDColorR, &leds.color.r); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, setLEDColorG, &leds.color.g); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, setLEDColorB, &leds.color.b); #if ENABLED(HAS_WHITE_LED) - EDIT_ITEM(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLEDColorW, &leds.color.w); + EDIT_ITEM(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, setLEDColorW, &leds.color.w); #endif #endif #endif } - UpdateMenu(LedControlMenu); + updateMenu(ledControlMenu); } #endif // LED_CONTROL_MENU -void Draw_Tune_Menu() { - checkkey = Menu; - if (SET_MENU_R(TuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 17)) { - BACK_ITEM(Goto_PrintProcess); - EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawSpeedItem, SetSpeed, &feedrate_percentage); +void drawTuneMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(tuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 17)) { + BACK_ITEM(gotoPrintProcess); + EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawSpeedItem, setSpeed, &feedrate_percentage); #if HAS_HOTEND - HotendTargetItem = EDIT_ITEM(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); + hotendTargetItem = EDIT_ITEM(ICON_HotendTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, setHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - BedTargetItem = EDIT_ITEM(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); + bedTargetItem = EDIT_ITEM(ICON_BedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, setBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN - FanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); + fanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, setFanSpeed, &thermalManager.fan_speed[0]); #endif #if ALL(HAS_ZOFFSET_ITEM, HAS_BED_PROBE, BABYSTEP_ZPROBE_OFFSET, BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawZOffset, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawZOffset, setZOffset, &BABY_Z_VAR); #elif ALL(HAS_ZOFFSET_ITEM, MESH_BED_LEVELING, BABYSTEPPING) - EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + EDIT_ITEM(ICON_Zoffset, MSG_HOME_OFFSET_Z, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); #endif - EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); + EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, setFlow, &planner.flow_percentage[0]); #if ENABLED(ADVANCED_PAUSE_FEATURE) - MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, ChangeFilament); + MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament); #endif #if HAS_FILAMENT_SENSOR - EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, SetRunoutEnable, &runout.enabled); + EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, setRunoutEnable, &runout.enabled); #endif #if ENABLED(PLR_TUNE_ITEM) - EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, SetPwrLossr, &recovery.enabled); + EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, setPwrLossr, &recovery.enabled); #endif #if ENABLED(FWRETRACT) - MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, Draw_FWRetract_Menu); + MENU_ITEM(ICON_FWRetract, MSG_FWRETRACT, onDrawSubMenu, drawFWRetractMenu); #endif #if ENABLED(JD_TUNE_ITEM) - EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, SetJDmm, &planner.junction_deviation_mm); + EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm); #endif #if ENABLED(ADVK_TUNE_ITEM) - EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, SetLA_K, &planner.extruder_advance_K[0]); + EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &planner.extruder_advance_K[0]); #endif #if HAS_LOCKSCREEN - MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, DWIN_LockScreen); + MENU_ITEM(ICON_Lock, MSG_LOCKSCREEN, onDrawMenuItem, dwinLockScreen); #endif #if HAS_LCD_BRIGHTNESS - EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, SetBrightness, &ui.brightness); - MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, TurnOffBacklight); + EDIT_ITEM(ICON_Brightness, MSG_BRIGHTNESS, onDrawPInt8Menu, setBrightness, &ui.brightness); + MENU_ITEM(ICON_Brightness, MSG_BRIGHTNESS_OFF, onDrawMenuItem, turnOffBacklight); #endif #if ENABLED(CASE_LIGHT_MENU) - EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, SetCaseLight, &caselight.on); + EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #elif ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) - EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, SetLedStatus, &leds.lights_on); + EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, setLedStatus, &leds.lights_on); #endif } - UpdateMenu(TuneMenu); + updateMenu(tuneMenu); } #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - void SetAdaptiveStepSmoothing() { - Toggle_Chkb_Line(HMI_data.AdaptiveStepSmoothing); + void setAdaptiveStepSmoothing() { + toggleCheckboxLine(hmiData.adaptiveStepSmoothing); } #endif #if ENABLED(SHAPING_MENU) - void ApplyShapingFreq() { stepper.set_shaping_frequency(HMI_value.axis, MenuData.Value / 100); } - void ApplyShapingZeta() { stepper.set_shaping_damping_ratio(HMI_value.axis, MenuData.Value / 100); } + void applyShapingFreq() { stepper.set_shaping_frequency(hmiValue.axis, menuData.value / 100); } + void applyShapingZeta() { stepper.set_shaping_damping_ratio(hmiValue.axis, menuData.value / 100); } #if ENABLED(INPUT_SHAPING_X) - void onDrawShapingXFreq(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(X_AXIS)); } - void onDrawShapingXZeta(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(X_AXIS)); } - void SetShapingXFreq() { HMI_value.axis = X_AXIS; SetFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(X_AXIS), ApplyShapingFreq); } - void SetShapingXZeta() { HMI_value.axis = X_AXIS; SetFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(X_AXIS), ApplyShapingZeta); } + void onDrawShapingXFreq(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(X_AXIS)); } + void onDrawShapingXZeta(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(X_AXIS)); } + void setShapingXFreq() { hmiValue.axis = X_AXIS; setFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(X_AXIS), applyShapingFreq); } + void setShapingXZeta() { hmiValue.axis = X_AXIS; setFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(X_AXIS), applyShapingZeta); } #endif #if ENABLED(INPUT_SHAPING_Y) - void onDrawShapingYFreq(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(Y_AXIS)); } - void onDrawShapingYZeta(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(Y_AXIS)); } - void SetShapingYFreq() { HMI_value.axis = Y_AXIS; SetFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(Y_AXIS), ApplyShapingFreq); } - void SetShapingYZeta() { HMI_value.axis = Y_AXIS; SetFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(Y_AXIS), ApplyShapingZeta); } + void onDrawShapingYFreq(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(Y_AXIS)); } + void onDrawShapingYZeta(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_damping_ratio(Y_AXIS)); } + void setShapingYFreq() { hmiValue.axis = Y_AXIS; setFloatOnClick(0, 200, 2, stepper.get_shaping_frequency(Y_AXIS), applyShapingFreq); } + void setShapingYZeta() { hmiValue.axis = Y_AXIS; setFloatOnClick(0, 1, 2, stepper.get_shaping_damping_ratio(Y_AXIS), applyShapingZeta); } #endif - void Draw_InputShaping_menu() { - checkkey = Menu; - if (SET_MENU(InputShapingMenu, MSG_INPUT_SHAPING, 5)) { - BACK_ITEM(Draw_Motion_Menu); + void drawInputShaping_menu() { + checkkey = ID_Menu; + if (SET_MENU(inputShapingMenu, MSG_INPUT_SHAPING, 5)) { + BACK_ITEM(drawMotionMenu); #if ENABLED(INPUT_SHAPING_X) - MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_FREQ, onDrawShapingXFreq, SetShapingXFreq); - MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_ZETA, onDrawShapingXZeta, SetShapingXZeta); + MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_FREQ, onDrawShapingXFreq, setShapingXFreq); + MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_ZETA, onDrawShapingXZeta, setShapingXZeta); #endif #if ENABLED(INPUT_SHAPING_Y) - MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_FREQ, onDrawShapingYFreq, SetShapingYFreq); - MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_ZETA, onDrawShapingYZeta, SetShapingYZeta); + MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_FREQ, onDrawShapingYFreq, setShapingYFreq); + MENU_ITEM(ICON_ShapingY, MSG_SHAPING_B_ZETA, onDrawShapingYZeta, setShapingYZeta); #endif } - UpdateMenu(InputShapingMenu); + updateMenu(inputShapingMenu); } #endif #if HAS_TRINAMIC_CONFIG #if AXIS_IS_TMC(X) - void SetXTMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperX.refresh_stepper_current(); }); } + void setXTMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperX.refresh_stepper_current(); }); } #endif #if AXIS_IS_TMC(Y) - void SetYTMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperY.refresh_stepper_current(); }); } + void setYTMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperY.refresh_stepper_current(); }); } #endif #if AXIS_IS_TMC(Z) - void SetZTMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperZ.refresh_stepper_current(); }); } + void setZTMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperZ.refresh_stepper_current(); }); } #endif #if AXIS_IS_TMC(E0) - void SetETMCCurrent() { SetPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperE0.refresh_stepper_current(); }); } + void setETMCCurrent() { setPIntOnClick(MIN_TMC_CURRENT, MAX_TMC_CURRENT, []{ stepperE0.refresh_stepper_current(); }); } #endif - void Draw_TrinamicConfig_menu() { - checkkey = Menu; - if (SET_MENU(TrinamicConfigMenu, MSG_TMC_DRIVERS, 5)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawTrinamicConfigMenu() { + checkkey = ID_Menu; + if (SET_MENU(trinamicConfigMenu, MSG_TMC_DRIVERS, 5)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if AXIS_IS_TMC(X) - EDIT_ITEM(ICON_TMCXSet, MSG_TMC_ACURRENT, onDrawPIntMenu, SetXTMCCurrent, &stepperX.val_mA); + EDIT_ITEM(ICON_TMCXSet, MSG_TMC_ACURRENT, onDrawPIntMenu, setXTMCCurrent, &stepperX.val_mA); #endif #if AXIS_IS_TMC(Y) - EDIT_ITEM(ICON_TMCYSet, MSG_TMC_BCURRENT, onDrawPIntMenu, SetYTMCCurrent, &stepperY.val_mA); + EDIT_ITEM(ICON_TMCYSet, MSG_TMC_BCURRENT, onDrawPIntMenu, setYTMCCurrent, &stepperY.val_mA); #endif #if AXIS_IS_TMC(Z) - EDIT_ITEM(ICON_TMCZSet, MSG_TMC_CCURRENT, onDrawPIntMenu, SetZTMCCurrent, &stepperZ.val_mA); + EDIT_ITEM(ICON_TMCZSet, MSG_TMC_CCURRENT, onDrawPIntMenu, setZTMCCurrent, &stepperZ.val_mA); #endif #if AXIS_IS_TMC(E0) - EDIT_ITEM(ICON_TMCESet, MSG_TMC_ECURRENT, onDrawPIntMenu, SetETMCCurrent, &stepperE0.val_mA); + EDIT_ITEM(ICON_TMCESet, MSG_TMC_ECURRENT, onDrawPIntMenu, setETMCCurrent, &stepperE0.val_mA); #endif } - UpdateMenu(TrinamicConfigMenu); + updateMenu(trinamicConfigMenu); } #endif -void Draw_Motion_Menu() { - checkkey = Menu; - if (SET_MENU_R(MotionMenu, selrect({1, 16, 28, 13}), MSG_MOTION, 10)) { - BACK_ITEM(Draw_Control_Menu); - MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, Draw_MaxSpeed_Menu); - MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, Draw_MaxAccel_Menu); +void drawMotionMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(motionMenu, selrect({1, 16, 28, 13}), MSG_MOTION, 10)) { + BACK_ITEM(drawControlMenu); + MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, drawMaxSpeedMenu); + MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, drawMaxAccelMenu); #if HAS_CLASSIC_JERK - MENU_ITEM(ICON_MaxJerk, MSG_JERK, onDrawJerk, Draw_MaxJerk_Menu); + MENU_ITEM(ICON_MaxJerk, MSG_JERK, onDrawJerk, drawMaxJerkMenu); #elif HAS_JUNCTION_DEVIATION - EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, SetJDmm, &planner.junction_deviation_mm); + EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm); #endif #if ENABLED(LIN_ADVANCE) - EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, SetLA_K, &planner.extruder_advance_K[0]); + EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &planner.extruder_advance_K[0]); #endif #if ENABLED(SHAPING_MENU) - MENU_ITEM(ICON_InputShaping, MSG_INPUT_SHAPING, onDrawSubMenu, Draw_InputShaping_menu); + MENU_ITEM(ICON_InputShaping, MSG_INPUT_SHAPING, onDrawSubMenu, drawInputShaping_menu); #endif #if ENABLED(ADAPTIVE_STEP_SMOOTHING) - EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, SetAdaptiveStepSmoothing, &HMI_data.AdaptiveStepSmoothing); + EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, setAdaptiveStepSmoothing, &hmiData.adaptiveStepSmoothing); #endif - MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, Draw_Steps_Menu); - EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); - EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawPIntMenu, SetSpeed, &feedrate_percentage); + MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, drawStepsMenu); + EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, setFlow, &planner.flow_percentage[0]); + EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawPIntMenu, setSpeed, &feedrate_percentage); } - UpdateMenu(MotionMenu); + updateMenu(motionMenu); } #if HAS_PREHEAT - void Draw_PreheatHotend_Menu() { - checkkey = Menu; - if (SET_MENU(PreheatHotendMenu, MSG_PREHEAT_HOTEND, 1 + PREHEAT_COUNT)) { - BACK_ITEM(Draw_FilamentMan_Menu); + void drawPreheatHotendMenu() { + checkkey = ID_Menu; + if (SET_MENU(preheatHotendMenu, MSG_PREHEAT_HOTEND, 1 + PREHEAT_COUNT)) { + BACK_ITEM(drawFilamentManMenu); #define _ITEM_PREHEAT_HE(N) MENU_ITEM(ICON_Preheat##N, MSG_PREHEAT_##N, onDrawMenuItem, DoPreheatHotend##N); REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT_HE) } - UpdateMenu(PreheatHotendMenu); + updateMenu(preheatHotendMenu); } #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void Draw_FilamentMan_Menu() { - checkkey = Menu; - if (SET_MENU(FilamentMenu, MSG_FILAMENT_MAN, 6)) { - BACK_ITEM(Draw_Prepare_Menu); + void drawFilamentManMenu() { + checkkey = ID_Menu; + if (SET_MENU(filamentMenu, MSG_FILAMENT_MAN, 6)) { + BACK_ITEM(drawPrepareMenu); #if ENABLED(NOZZLE_PARK_FEATURE) - MENU_ITEM(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, ParkHead); + MENU_ITEM(ICON_Park, MSG_FILAMENT_PARK_ENABLED, onDrawMenuItem, parkHead); #endif #if HAS_PREHEAT - MENU_ITEM(ICON_SetEndTemp, MSG_PREHEAT_HOTEND, onDrawSubMenu, Draw_PreheatHotend_Menu); + MENU_ITEM(ICON_SetEndTemp, MSG_PREHEAT_HOTEND, onDrawSubMenu, drawPreheatHotendMenu); #endif - MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, ChangeFilament); + MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament); #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - MENU_ITEM(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, UnloadFilament); - MENU_ITEM(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, LoadFilament); + MENU_ITEM(ICON_FilUnload, MSG_FILAMENTUNLOAD, onDrawMenuItem, unloadFilament); + MENU_ITEM(ICON_FilLoad, MSG_FILAMENTLOAD, onDrawMenuItem, loadFilament); #endif } - UpdateMenu(FilamentMenu); + updateMenu(filamentMenu); } #endif #if ENABLED(MESH_BED_LEVELING) - void Draw_ManualMesh_Menu() { - checkkey = Menu; - if (SET_MENU(ManualMesh, MSG_UBL_MANUAL_MESH, 6)) { - BACK_ITEM(Draw_Prepare_Menu); - MENU_ITEM(ICON_ManualMesh, MSG_LEVEL_BED, onDrawMenuItem, ManualMeshStart); - MMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z); - MENU_ITEM(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, ManualMeshContinue); - MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, DWIN_MeshViewer); - MENU_ITEM(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, ManualMeshSave); + void drawManualMeshMenu() { + checkkey = ID_Menu; + if (SET_MENU(manualMesh, MSG_UBL_MANUAL_MESH, 6)) { + BACK_ITEM(drawPrepareMenu); + MENU_ITEM(ICON_ManualMesh, MSG_LEVEL_BED, onDrawMenuItem, manualMeshStart); + mMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, setMMeshMoveZ, ¤t_position.z); + MENU_ITEM(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, manualMeshContinue); + MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); + MENU_ITEM(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, manualMeshSave); } - UpdateMenu(ManualMesh); + updateMenu(manualMesh); } #endif // MESH_BED_LEVELING #if HAS_PREHEAT - void Draw_Preheat_Menu(bool NotCurrent) { - checkkey = Menu; - if (NotCurrent) { - BACK_ITEM(Draw_Temperature_Menu); + void drawPreheatMenu(const bool notCurrent) { + checkkey = ID_Menu; + if (notCurrent) { + BACK_ITEM(drawTemperatureMenu); #if HAS_HOTEND - EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, SetPreheatEndTemp, &ui.material_preset[HMI_value.Select].hotend_temp); + EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawSetPreheatHotend, setPreheatEndTemp, &ui.material_preset[hmiValue.select].hotend_temp); #endif #if HAS_HEATED_BED - EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, SetPreheatBedTemp, &ui.material_preset[HMI_value.Select].bed_temp); + EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawSetPreheatBed, setPreheatBedTemp, &ui.material_preset[hmiValue.select].bed_temp); #endif #if HAS_FAN - EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawSetPreheatFan, SetPreheatFanSpeed, &ui.material_preset[HMI_value.Select].fan_speed); + EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawSetPreheatFan, setPreheatFanSpeed, &ui.material_preset[hmiValue.select].fan_speed); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); #endif } - UpdateMenu(PreheatMenu); + updateMenu(preheatMenu); } - #define _Preheat_Menu(N) \ - void Draw_Preheat## N ##_Menu() { \ - HMI_value.Select = (N) - 1; \ - Draw_Preheat_Menu(SET_MENU(PreheatMenu, MSG_PREHEAT_## N ##_SETTINGS, 5)); \ + #define _preheatMenu(N) \ + void drawPreheat## N ##Menu() { \ + hmiValue.select = (N) - 1; \ + drawPreheatMenu(SET_MENU(preheatMenu, MSG_PREHEAT_## N ##_SETTINGS, 5)); \ } - REPEAT_1(PREHEAT_COUNT, _Preheat_Menu) + REPEAT_1(PREHEAT_COUNT, _preheatMenu) #endif // HAS_PREHEAT -void Draw_Temperature_Menu() { - checkkey = Menu; - if (SET_MENU_R(TemperatureMenu, selrect({236, 2, 28, 12}), MSG_TEMPERATURE, 4 + PREHEAT_COUNT)) { - BACK_ITEM(Draw_Control_Menu); +void drawTemperatureMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(temperatureMenu, selrect({236, 2, 28, 12}), MSG_TEMPERATURE, 4 + PREHEAT_COUNT)) { + BACK_ITEM(drawControlMenu); #if HAS_HOTEND - HotendTargetItem = EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); + hotendTargetItem = EDIT_ITEM(ICON_SetEndTemp, MSG_UBL_SET_TEMP_HOTEND, onDrawHotendTemp, setHotendTemp, &thermalManager.temp_hotend[0].target); #endif #if HAS_HEATED_BED - BedTargetItem = EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); + bedTargetItem = EDIT_ITEM(ICON_SetBedTemp, MSG_UBL_SET_TEMP_BED, onDrawBedTemp, setBedTemp, &thermalManager.temp_bed.target); #endif #if HAS_FAN - FanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); + fanSpeedItem = EDIT_ITEM(ICON_FanSpeed, MSG_FAN_SPEED, onDrawFanSpeed, setFanSpeed, &thermalManager.fan_speed[0]); #endif #if HAS_PREHEAT - #define _ITEM_SETPREHEAT(N) MENU_ITEM(ICON_SetPreheat##N, MSG_PREHEAT_## N ##_SETTINGS, onDrawSubMenu, Draw_Preheat## N ##_Menu); + #define _ITEM_SETPREHEAT(N) MENU_ITEM(ICON_SetPreheat##N, MSG_PREHEAT_## N ##_SETTINGS, onDrawSubMenu, drawPreheat## N ##Menu); REPEAT_1(PREHEAT_COUNT, _ITEM_SETPREHEAT) #endif } - UpdateMenu(TemperatureMenu); + updateMenu(temperatureMenu); } -void Draw_MaxSpeed_Menu() { - checkkey = Menu; - if (SET_MENU_R(MaxSpeedMenu, selrect({1, 16, 28, 13}), MSG_MAX_SPEED, 5)) { - BACK_ITEM(Draw_Motion_Menu); +void drawMaxSpeedMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(maxSpeedMenu, selrect({1, 16, 28, 13}), MSG_MAX_SPEED, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); + EDIT_ITEM(ICON_MaxSpeedX, MSG_VMAX_A, onDrawMaxSpeedX, setMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); + EDIT_ITEM(ICON_MaxSpeedY, MSG_VMAX_B, onDrawMaxSpeedY, setMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); + EDIT_ITEM(ICON_MaxSpeedZ, MSG_VMAX_C, onDrawMaxSpeedZ, setMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_MaxSpeedE, MSG_VMAX_E, onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); + EDIT_ITEM(ICON_MaxSpeedE, MSG_VMAX_E, onDrawMaxSpeedE, setMaxSpeedE, &planner.settings.max_feedrate_mm_s[E_AXIS]); #endif } - UpdateMenu(MaxSpeedMenu); + updateMenu(maxSpeedMenu); } -void Draw_MaxAccel_Menu() { - checkkey = Menu; - if (SET_MENU_R(MaxAccelMenu, selrect({1, 16, 28, 13}), MSG_AMAX_EN, 5)) { - BACK_ITEM(Draw_Motion_Menu); +void drawMaxAccelMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(maxAccelMenu, selrect({1, 16, 28, 13}), MSG_AMAX_EN, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); + EDIT_ITEM(ICON_MaxAccX, MSG_AMAX_A, onDrawMaxAccelX, setMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); + EDIT_ITEM(ICON_MaxAccY, MSG_AMAX_B, onDrawMaxAccelY, setMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); + EDIT_ITEM(ICON_MaxAccZ, MSG_AMAX_C, onDrawMaxAccelZ, setMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_MaxAccE, MSG_AMAX_E, onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); + EDIT_ITEM(ICON_MaxAccE, MSG_AMAX_E, onDrawMaxAccelE, setMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); #endif } - UpdateMenu(MaxAccelMenu); + updateMenu(maxAccelMenu); } #if HAS_CLASSIC_JERK - void Draw_MaxJerk_Menu() { - checkkey = Menu; - if (SET_MENU_R(MaxJerkMenu, selrect({1, 16, 28, 13}), MSG_JERK, 5)) { - BACK_ITEM(Draw_Motion_Menu); + void drawMaxJerkMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(maxJerkMenu, selrect({1, 16, 28, 13}), MSG_JERK, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk.x); + EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, setMaxJerkX, &planner.max_jerk.x); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk.y); + EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, setMaxJerkY, &planner.max_jerk.y); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk.z); + EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, setMaxJerkZ, &planner.max_jerk.z); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk.e); + EDIT_ITEM(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, setMaxJerkE, &planner.max_jerk.e); #endif } - UpdateMenu(MaxJerkMenu); + updateMenu(maxJerkMenu); } #endif // HAS_CLASSIC_JERK -void Draw_Steps_Menu() { - checkkey = Menu; - if (SET_MENU_R(StepsMenu, selrect({1, 16, 28, 13}), MSG_STEPS_PER_MM, 5)) { - BACK_ITEM(Draw_Motion_Menu); +void drawStepsMenu() { + checkkey = ID_Menu; + if (SET_MENU_R(stepsMenu, selrect({1, 16, 28, 13}), MSG_STEPS_PER_MM, 5)) { + BACK_ITEM(drawMotionMenu); #if HAS_X_AXIS - EDIT_ITEM(ICON_StepX, MSG_A_STEPS, onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); + EDIT_ITEM(ICON_StepX, MSG_A_STEPS, onDrawStepsX, setStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); #endif #if HAS_Y_AXIS - EDIT_ITEM(ICON_StepY, MSG_B_STEPS, onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); + EDIT_ITEM(ICON_StepY, MSG_B_STEPS, onDrawStepsY, setStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); #endif #if HAS_Z_AXIS - EDIT_ITEM(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); + EDIT_ITEM(ICON_StepZ, MSG_C_STEPS, onDrawStepsZ, setStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); #endif #if HAS_HOTEND - EDIT_ITEM(ICON_StepE, MSG_E_STEPS, onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); + EDIT_ITEM(ICON_StepE, MSG_E_STEPS, onDrawStepsE, setStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); #endif } - UpdateMenu(StepsMenu); + updateMenu(stepsMenu); } //============================================================================= @@ -3629,77 +3633,77 @@ void Draw_Steps_Menu() { #if HAS_CUSTOM_COLORS - void RestoreDefaultColors() { - DWIN_SetColorDefaults(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - DWIN_RedrawScreen(); + void restoreDefaultColors() { + dwinSetColorDefaults(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + dwinRedrawScreen(); } - void SelColor() { - MenuData.P_Int = (int16_t*)static_cast(CurrentMenu->SelectedItem())->value; - HMI_value.Color[0] = GetRColor(*MenuData.P_Int); // Red - HMI_value.Color[1] = GetGColor(*MenuData.P_Int); // Green - HMI_value.Color[2] = GetBColor(*MenuData.P_Int); // Blue - Draw_GetColor_Menu(); + void selColor() { + menuData.intPtr = (int16_t*)static_cast(currentMenu->selectedItem())->value; + hmiValue.Color[0] = GetRColor(*menuData.intPtr); // Red + hmiValue.Color[1] = GetGColor(*menuData.intPtr); // Green + hmiValue.Color[2] = GetBColor(*menuData.intPtr); // Blue + drawGetColorMenu(); } - void LiveRGBColor() { - HMI_value.Color[CurrentMenu->line() - 2] = MenuData.Value; - uint16_t color = RGB(HMI_value.Color[0], HMI_value.Color[1], HMI_value.Color[2]); + void liveRGBColor() { + hmiValue.Color[currentMenu->line() - 2] = menuData.value; + uint16_t color = RGB(hmiValue.Color[0], hmiValue.Color[1], hmiValue.Color[2]); dwinDrawRectangle(1, color, 20, 315, DWIN_WIDTH - 20, 335); } - void SetRGBColor() { - const uint8_t color = static_cast(CurrentMenu->SelectedItem())->icon; - SetIntOnClick(0, (color == 1) ? 63 : 31, HMI_value.Color[color], nullptr, LiveRGBColor); + void setRGBColor() { + const uint8_t color = static_cast(currentMenu->selectedItem())->icon; + setIntOnClick(0, (color == 1) ? 63 : 31, hmiValue.Color[color], nullptr, liveRGBColor); } - void DWIN_ApplyColor() { - *MenuData.P_Int = RGB(HMI_value.Color[0], HMI_value.Color[1], HMI_value.Color[2]); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - Draw_SelectColors_Menu(); + void dwinApplyColor() { + *menuData.intPtr = RGB(hmiValue.Color[0], hmiValue.Color[1], hmiValue.Color[2]); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + drawSelectColorsMenu(); hash_changed = true; LCD_MESSAGE(MSG_COLORS_APPLIED); - DWIN_Draw_Dashboard(); - } - - void Draw_SelectColors_Menu() { - checkkey = Menu; - if (SET_MENU(SelectColorMenu, MSG_COLORS_SELECT, 20)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); - MENU_ITEM(ICON_StockConfiguration, MSG_RESTORE_DEFAULTS, onDrawMenuItem, RestoreDefaultColors); - EDIT_ITEM_F(0, "Screen Background", onDrawSelColorItem, SelColor, &HMI_data.Background_Color); - EDIT_ITEM_F(0, "Cursor", onDrawSelColorItem, SelColor, &HMI_data.Cursor_Color); - EDIT_ITEM_F(0, "Title Background", onDrawSelColorItem, SelColor, &HMI_data.TitleBg_Color); - EDIT_ITEM_F(0, "Title Text", onDrawSelColorItem, SelColor, &HMI_data.TitleTxt_Color); - EDIT_ITEM_F(0, "Text", onDrawSelColorItem, SelColor, &HMI_data.Text_Color); - EDIT_ITEM_F(0, "Selected", onDrawSelColorItem, SelColor, &HMI_data.Selected_Color); - EDIT_ITEM_F(0, "Split Line", onDrawSelColorItem, SelColor, &HMI_data.SplitLine_Color); - EDIT_ITEM_F(0, "Highlight", onDrawSelColorItem, SelColor, &HMI_data.Highlight_Color); - EDIT_ITEM_F(0, "Status Background", onDrawSelColorItem, SelColor, &HMI_data.StatusBg_Color); - EDIT_ITEM_F(0, "Status Text", onDrawSelColorItem, SelColor, &HMI_data.StatusTxt_Color); - EDIT_ITEM_F(0, "Popup Background", onDrawSelColorItem, SelColor, &HMI_data.PopupBg_Color); - EDIT_ITEM_F(0, "Popup Text", onDrawSelColorItem, SelColor, &HMI_data.PopupTxt_Color); - EDIT_ITEM_F(0, "Alert Background", onDrawSelColorItem, SelColor, &HMI_data.AlertBg_Color); - EDIT_ITEM_F(0, "Alert Text", onDrawSelColorItem, SelColor, &HMI_data.AlertTxt_Color); - EDIT_ITEM_F(0, "Percent Text", onDrawSelColorItem, SelColor, &HMI_data.PercentTxt_Color); - EDIT_ITEM_F(0, "Bar Fill", onDrawSelColorItem, SelColor, &HMI_data.Barfill_Color); - EDIT_ITEM_F(0, "Indicator value", onDrawSelColorItem, SelColor, &HMI_data.Indicator_Color); - EDIT_ITEM_F(0, "Coordinate value", onDrawSelColorItem, SelColor, &HMI_data.Coordinate_Color); - } - UpdateMenu(SelectColorMenu); - } - - void Draw_GetColor_Menu() { - checkkey = Menu; - if (SET_MENU(GetColorMenu, MSG_COLORS_GET, 5)) { - BACK_ITEM(DWIN_ApplyColor); - MENU_ITEM(ICON_Cancel, MSG_BUTTON_CANCEL, onDrawMenuItem, Draw_SelectColors_Menu); - MENU_ITEM(0, MSG_COLORS_RED, onDrawGetColorItem, SetRGBColor); - MENU_ITEM(1, MSG_COLORS_GREEN, onDrawGetColorItem, SetRGBColor); - MENU_ITEM(2, MSG_COLORS_BLUE, onDrawGetColorItem, SetRGBColor); - } - UpdateMenu(GetColorMenu); - dwinDrawRectangle(1, *MenuData.P_Int, 20, 315, DWIN_WIDTH - 20, 335); + dwinDrawDashboard(); + } + + void drawSelectColorsMenu() { + checkkey = ID_Menu; + if (SET_MENU(selectColorMenu, MSG_COLORS_SELECT, 20)) { + BACK_ITEM(drawAdvancedSettingsMenu); + MENU_ITEM(ICON_StockConfiguration, MSG_RESTORE_DEFAULTS, onDrawMenuItem, restoreDefaultColors); + EDIT_ITEM_F(0, "Screen Background", onDrawSelColorItem, selColor, &hmiData.colorBackground); + EDIT_ITEM_F(0, "Cursor", onDrawSelColorItem, selColor, &hmiData.colorCursor); + EDIT_ITEM_F(0, "Title Background", onDrawSelColorItem, selColor, &hmiData.colorTitleBg); + EDIT_ITEM_F(0, "Title Text", onDrawSelColorItem, selColor, &hmiData.colorTitleTxt); + EDIT_ITEM_F(0, "Text", onDrawSelColorItem, selColor, &hmiData.colorText); + EDIT_ITEM_F(0, "Selected", onDrawSelColorItem, selColor, &hmiData.colorSelected); + EDIT_ITEM_F(0, "Split Line", onDrawSelColorItem, selColor, &hmiData.colorSplitLine); + EDIT_ITEM_F(0, "Highlight", onDrawSelColorItem, selColor, &hmiData.colorHighlight); + EDIT_ITEM_F(0, "Status Background", onDrawSelColorItem, selColor, &hmiData.colorStatusBg); + EDIT_ITEM_F(0, "Status Text", onDrawSelColorItem, selColor, &hmiData.colorStatusTxt); + EDIT_ITEM_F(0, "Popup Background", onDrawSelColorItem, selColor, &hmiData.colorPopupBg); + EDIT_ITEM_F(0, "Popup Text", onDrawSelColorItem, selColor, &hmiData.colorPopupTxt); + EDIT_ITEM_F(0, "Alert Background", onDrawSelColorItem, selColor, &hmiData.colorAlertBg); + EDIT_ITEM_F(0, "Alert Text", onDrawSelColorItem, selColor, &hmiData.colorAlertTxt); + EDIT_ITEM_F(0, "Percent Text", onDrawSelColorItem, selColor, &hmiData.colorPercentTxt); + EDIT_ITEM_F(0, "Bar Fill", onDrawSelColorItem, selColor, &hmiData.colorBarfill); + EDIT_ITEM_F(0, "Indicator value", onDrawSelColorItem, selColor, &hmiData.colorIndicator); + EDIT_ITEM_F(0, "Coordinate value", onDrawSelColorItem, selColor, &hmiData.colorCoordinate); + } + updateMenu(selectColorMenu); + } + + void drawGetColorMenu() { + checkkey = ID_Menu; + if (SET_MENU(getColorMenu, MSG_COLORS_GET, 5)) { + BACK_ITEM(dwinApplyColor); + MENU_ITEM(ICON_Cancel, MSG_BUTTON_CANCEL, onDrawMenuItem, drawSelectColorsMenu); + MENU_ITEM(0, MSG_COLORS_RED, onDrawGetColorItem, setRGBColor); + MENU_ITEM(1, MSG_COLORS_GREEN, onDrawGetColorItem, setRGBColor); + MENU_ITEM(2, MSG_COLORS_BLUE, onDrawGetColorItem, setRGBColor); + } + updateMenu(getColorMenu); + dwinDrawRectangle(1, *menuData.intPtr, 20, 315, DWIN_WIDTH - 20, 335); } #endif // HAS_CUSTOM_COLORS @@ -3711,91 +3715,91 @@ void Draw_Steps_Menu() { #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) #if ENABLED(MPC_EDIT_MENU) - void SetHeaterPower() { SetPFloatOnClick(1, 200, 1); } - void SetBlkHeatCapacity() { SetPFloatOnClick(0, 40, 2); } - void SetSensorResponse() { SetPFloatOnClick(0, 1, 4); } - void SetAmbientXfer() { SetPFloatOnClick(0, 1, 4); } + void setHeaterPower() { setPFloatOnClick(1, 200, 1); } + void setBlkHeatCapacity() { setPFloatOnClick(0, 40, 2); } + void setSensorResponse() { setPFloatOnClick(0, 1, 4); } + void setAmbientXfer() { setPFloatOnClick(0, 1, 4); } #if ENABLED(MPC_INCLUDE_FAN) - void onDrawFanAdj(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } - void ApplyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(MenuData.Value / POW(10, 4)); } - void SetFanAdj() { SetFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), ApplyFanAdj); } + void onDrawFanAdj(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } + void applyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(menuData.value / POW(10, 4)); } + void setFanAdj() { setFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), applyFanAdj); } #endif #endif - void Draw_HotendMPC_Menu() { - checkkey = Menu; - if (SET_MENU_F(HotendMPCMenu, "MPC Settings", 7)) { + void drawHotendMPCMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(hotendMPCMenu, "MPC Settings", 7)) { MPC_t &mpc = thermalManager.temp_hotend[0].mpc; - BACK_ITEM(Draw_AdvancedSettings_Menu); + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(MPC_AUTOTUNE_MENU) MENU_ITEM(ICON_MPCNozzle, MSG_MPC_AUTOTUNE, onDrawMenuItem, []{ thermalManager.MPC_autotune(active_extruder, Temperature::MPCTuningType::AUTO); }); #endif #if ENABLED(MPC_EDIT_MENU) - EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, SetHeaterPower, &mpc.heater_power); - EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, SetBlkHeatCapacity, &mpc.block_heat_capacity); - EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, SetSensorResponse, &mpc.sensor_responsiveness); - EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, SetAmbientXfer, &mpc.ambient_xfer_coeff_fan0); + EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, setHeaterPower, &mpc.heater_power); + EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, setBlkHeatCapacity, &mpc.block_heat_capacity); + EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, setSensorResponse, &mpc.sensor_responsiveness); + EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, setAmbientXfer, &mpc.ambient_xfer_coeff_fan0); #if ENABLED(MPC_INCLUDE_FAN) - EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, SetFanAdj, &mpc.fan255_adjustment); + EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, setFanAdj, &mpc.fan255_adjustment); #endif #endif } - UpdateMenu(HotendMPCMenu); + updateMenu(hotendMPCMenu); } #endif // MPC_EDIT_MENU || MPC_AUTOTUNE_MENU -#if DWIN_PID_TUNE - void SetPID(celsius_t t, heater_id_t h) { +#if PROUI_PID_TUNE + void setPID(celsius_t t, heater_id_t h) { gcode.process_subcommands_now( MString<60>(F("G28OXY\nG0Z5F300\nG0X"), X_CENTER, F("Y"), Y_CENTER, F("F5000\nM84\nM400")) ); - thermalManager.PID_autotune(t, h, HMI_data.PidCycles, true); + thermalManager.PID_autotune(t, h, hmiData.pidCycles, true); } - void SetPidCycles() { SetPIntOnClick(3, 50); } + void setPidCycles() { setPIntOnClick(3, 50); } #endif #if ALL(HAS_PID_HEATING, PID_EDIT_MENU) - void SetKp() { SetPFloatOnClick(0, 1000, 2); } - void ApplyPIDi() { - *MenuData.P_Float = scalePID_i(MenuData.Value / POW(10, 2)); + void setKp() { setPFloatOnClick(0, 1000, 2); } + void applyPIDi() { + *menuData.floatPtr = scalePID_i(menuData.value / POW(10, 2)); TERN_(PIDTEMP, thermalManager.updatePID()); } - void ApplyPIDd() { - *MenuData.P_Float = scalePID_d(MenuData.Value / POW(10, 2)); + void applyPIDd() { + *menuData.floatPtr = scalePID_d(menuData.value / POW(10, 2)); TERN_(PIDTEMP, thermalManager.updatePID()); } - void SetKi() { - MenuData.P_Float = (float*)static_cast(CurrentMenu->SelectedItem())->value; - const float value = unscalePID_i(*MenuData.P_Float); - SetFloatOnClick(0, 1000, 2, value, ApplyPIDi); + void setKi() { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + const float value = unscalePID_i(*menuData.floatPtr); + setFloatOnClick(0, 1000, 2, value, applyPIDi); } - void SetKd() { - MenuData.P_Float = (float*)static_cast(CurrentMenu->SelectedItem())->value; - const float value = unscalePID_d(*MenuData.P_Float); - SetFloatOnClick(0, 1000, 2, value, ApplyPIDd); + void setKd() { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + const float value = unscalePID_d(*menuData.floatPtr); + setFloatOnClick(0, 1000, 2, value, applyPIDd); } - void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } - void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } + void onDrawPIDi(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } + void onDrawPIDd(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } #endif // HAS_PID_HEATING && PID_EDIT_MENU #if ENABLED(PIDTEMP) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) #if ENABLED(PID_AUTOTUNE_MENU) - void HotendPID() { SetPID(HMI_data.HotendPidT, H_E0); } - void SetHotendPidT() { SetPIntOnClick(MIN_ETEMP, MAX_ETEMP); } + void hotendPID() { setPID(hmiData.hotendPidT, H_E0); } + void setHotendPidT() { setPIntOnClick(MIN_ETEMP, MAX_ETEMP); } #endif - void Draw_HotendPID_Menu() { - checkkey = Menu; - if (SET_MENU_F(HotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawHotendPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(hotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(PID_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID, onDrawMenuItem, HotendPID); - EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT); - EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); + MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID, onDrawMenuItem, hotendPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setHotendPidT, &hmiData.hotendPidT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPidCycles, &hmiData.pidCycles); #endif #if ENABLED(PID_EDIT_MENU) EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KP, onDrawPFloat2Menu, SetKp, &thermalManager.temp_hotend[0].pid.Kp); @@ -3803,10 +3807,10 @@ void Draw_Steps_Menu() { EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KD, onDrawPIDd, SetKd, &thermalManager.temp_hotend[0].pid.Kd); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif } - UpdateMenu(HotendPIDMenu); + updateMenu(hotendPIDMenu); } #endif // PIDTEMP && (PID_AUTOTUNE_MENU || PID_EDIT_MENU) @@ -3814,18 +3818,18 @@ void Draw_Steps_Menu() { #if ENABLED(PIDTEMPBED) && ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) #if ENABLED(PID_AUTOTUNE_MENU) - void BedPID() { SetPID(HMI_data.BedPidT, H_BED); } - void SetBedPidT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + void bedPID() { setPID(hmiData.bedPidT, H_BED); } + void setBedPidT() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif - void Draw_BedPID_Menu() { - checkkey = Menu; - if (SET_MENU_F(BedPIDMenu, STR_BED_PID " Settings", 8)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawBedPIDMenu() { + checkkey = ID_Menu; + if (SET_MENU_F(bedPIDMenu, STR_BED_PID " Settings", 8)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(PID_AUTOTUNE_MENU) - MENU_ITEM_F(ICON_PIDBed, STR_BED_PID, onDrawMenuItem,BedPID); - EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT); - EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); + MENU_ITEM_F(ICON_PIDBed, STR_BED_PID, onDrawMenuItem,bedPID); + EDIT_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawPIntMenu, setBedPidT, &hmiData.bedPidT); + EDIT_ITEM(ICON_PIDCycles, MSG_PID_CYCLE, onDrawPIntMenu, setPidCycles, &hmiData.pidCycles); #endif #if ENABLED(PID_EDIT_MENU) EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KP, onDrawPFloat2Menu, SetKp, &thermalManager.temp_bed.pid.Kp); @@ -3833,10 +3837,10 @@ void Draw_Steps_Menu() { EDIT_ITEM_F(ICON_PIDValue, "Set" STR_KD, onDrawPIDd, SetKd, &thermalManager.temp_bed.pid.Kd); #endif #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); #endif } - UpdateMenu(BedPIDMenu); + updateMenu(bedPIDMenu); } #endif // PIDTEMPBED && (PID_AUTOTUNE_MENU || PID_EDIT_MENU) @@ -3845,15 +3849,15 @@ void Draw_Steps_Menu() { #if HAS_BED_PROBE - void Draw_ZOffsetWiz_Menu() { - checkkey = Menu; - if (SET_MENU(ZOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { - BACK_ITEM(Draw_Prepare_Menu); - MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); - MENU_ITEM_F(ICON_MoveZ0, "Move Z to Home", onDrawMenuItem, SetMoveZto0); - EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); + void drawZOffsetWizMenu() { + checkkey = ID_Menu; + if (SET_MENU(zOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { + BACK_ITEM(drawPrepareMenu); + MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, autoHome); + MENU_ITEM_F(ICON_MoveZ0, "Move Z to Home", onDrawMenuItem, setMoveZto0); + EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); } - UpdateMenu(ZOffsetWizMenu); + updateMenu(zOffsetWizMenu); if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); } @@ -3861,42 +3865,42 @@ void Draw_Steps_Menu() { #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - void Draw_Homing_Menu() { - checkkey = Menu; - if (SET_MENU(HomingMenu, MSG_HOMING, 6)) { - BACK_ITEM(Draw_Prepare_Menu); - MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, AutoHome); + void drawHomingMenu() { + checkkey = ID_Menu; + if (SET_MENU(homingMenu, MSG_HOMING, 6)) { + BACK_ITEM(drawPrepareMenu); + MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, autoHome); #if HAS_X_AXIS - MENU_ITEM(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, HomeX); + MENU_ITEM(ICON_HomeX, MSG_AUTO_HOME_X, onDrawMenuItem, homeX); #endif #if HAS_Y_AXIS - MENU_ITEM(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, HomeY); + MENU_ITEM(ICON_HomeY, MSG_AUTO_HOME_Y, onDrawMenuItem, homeY); #endif #if HAS_Z_AXIS - MENU_ITEM(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, HomeZ); + MENU_ITEM(ICON_HomeZ, MSG_AUTO_HOME_Z, onDrawMenuItem, homeZ); #endif #if ENABLED(MESH_BED_LEVELING) - EDIT_ITEM(ICON_ZAfterHome, MSG_Z_AFTER_HOME, onDrawPInt8Menu, SetZAfterHoming, &HMI_data.z_after_homing); + EDIT_ITEM(ICON_ZAfterHome, MSG_Z_AFTER_HOME, onDrawPInt8Menu, setZAfterHoming, &hmiData.zAfterHoming); #endif } - UpdateMenu(HomingMenu); + updateMenu(homingMenu); } #endif // INDIVIDUAL_AXIS_HOMING_SUBMENU #if ENABLED(FWRETRACT) - void Draw_FWRetract_Menu() { - checkkey = Menu; - if (SET_MENU(FWRetractMenu, MSG_FWRETRACT, 6)) { - BACK_ITEM(Return_FWRetract_Menu); - EDIT_ITEM(ICON_FWRetLength, MSG_CONTROL_RETRACT, onDrawPFloatMenu, SetRetractLength, &fwretract.settings.retract_length); - EDIT_ITEM(ICON_FWRetSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, SetRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); - EDIT_ITEM(ICON_FWRetZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, SetZRaise, &fwretract.settings.retract_zraise); - EDIT_ITEM(ICON_FWRecSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, SetRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); - EDIT_ITEM(ICON_FWRecExtra, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, SetAddRecover, &fwretract.settings.retract_recover_extra); + void drawFWRetractMenu() { + checkkey = ID_Menu; + if (SET_MENU(fwRetractMenu, MSG_FWRETRACT, 6)) { + BACK_ITEM(returnFWRetractMenu); + EDIT_ITEM(ICON_FWRetLength, MSG_CONTROL_RETRACT, onDrawPFloatMenu, setRetractLength, &fwretract.settings.retract_length); + EDIT_ITEM(ICON_FWRetSpeed, MSG_SINGLENOZZLE_RETRACT_SPEED, onDrawPFloatMenu, setRetractSpeed, &fwretract.settings.retract_feedrate_mm_s); + EDIT_ITEM(ICON_FWRetZRaise, MSG_CONTROL_RETRACT_ZHOP, onDrawPFloat2Menu, setZRaise, &fwretract.settings.retract_zraise); + EDIT_ITEM(ICON_FWRecSpeed, MSG_SINGLENOZZLE_UNRETRACT_SPEED, onDrawPFloatMenu, setRecoverSpeed, &fwretract.settings.retract_recover_feedrate_mm_s); + EDIT_ITEM(ICON_FWRecExtra, MSG_CONTROL_RETRACT_RECOVER, onDrawPFloatMenu, setAddRecover, &fwretract.settings.retract_recover_extra); } - UpdateMenu(FWRetractMenu); + updateMenu(fwRetractMenu); } #endif @@ -3907,47 +3911,47 @@ void Draw_Steps_Menu() { #if HAS_MESH - void ApplyMeshFadeHeight() { set_z_fade_height(planner.z_fade_height); } - void SetMeshFadeHeight() { SetPFloatOnClick(0, 100, 1, ApplyMeshFadeHeight); } + void applyMeshFadeHeight() { set_z_fade_height(planner.z_fade_height); } + void setMeshFadeHeight() { setPFloatOnClick(0, 100, 1, applyMeshFadeHeight); } - void SetMeshActive() { + void setMeshActive() { set_bed_leveling_enabled(!planner.leveling_active); - Draw_Chkb_Line(CurrentMenu->line(), planner.leveling_active); + drawCheckboxLine(currentMenu->line(), planner.leveling_active); dwinUpdateLCD(); } #if ENABLED(PREHEAT_BEFORE_LEVELING) - void SetBedLevT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } + void setBedLevT() { setPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif #if ENABLED(MESH_EDIT_MENU) #define Z_OFFSET_MIN -3 #define Z_OFFSET_MAX 3 - void LiveEditMesh() { ((MenuItemPtrClass*)EditZValueItem)->value = &bedlevel.z_values[HMI_value.Select ? bedLevelTools.mesh_x : MenuData.Value][HMI_value.Select ? MenuData.Value : bedLevelTools.mesh_y]; EditZValueItem->redraw(); } - void ApplyEditMeshX() { bedLevelTools.mesh_x = MenuData.Value; } - void ApplyEditMeshY() { bedLevelTools.mesh_y = MenuData.Value; } - void ResetMesh() { bedLevelTools.mesh_reset(); LCD_MESSAGE(MSG_MESH_RESET); } - void SetEditMeshX() { HMI_value.Select = 0; SetIntOnClick(0, GRID_MAX_POINTS_X - 1, bedLevelTools.mesh_x, ApplyEditMeshX, LiveEditMesh); } - void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, bedLevelTools.mesh_y, ApplyEditMeshY, LiveEditMesh); } - void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } + void LiveEditMesh() { ((MenuItemPtr*)editZValueItem)->value = &bedlevel.z_values[hmiValue.select ? bedLevelTools.mesh_x : menuData.value][hmiValue.select ? menuData.value : bedLevelTools.mesh_y]; editZValueItem->redraw(); } + void applyEditMeshX() { bedLevelTools.mesh_x = menuData.value; } + void applyEditMeshY() { bedLevelTools.mesh_y = menuData.value; } + void ResetMesh() { bedLevelTools.meshReset(); LCD_MESSAGE(MSG_MESH_RESET); } + void setEditMeshX() { hmiValue.select = 0; setIntOnClick(0, GRID_MAX_POINTS_X - 1, bedLevelTools.mesh_x, applyEditMeshX, LiveEditMesh); } + void setEditMeshY() { hmiValue.select = 1; setIntOnClick(0, GRID_MAX_POINTS_Y - 1, bedLevelTools.mesh_y, applyEditMeshY, LiveEditMesh); } + void setEditZValue() { setPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } #endif #endif // HAS_MESH #if ENABLED(AUTO_BED_LEVELING_UBL) - void ApplyUBLSlot() { bedlevel.storage_slot = MenuData.Value; } - void SetUBLSlot() { SetIntOnClick(0, settings.calc_num_meshes() - 1, bedlevel.storage_slot, ApplyUBLSlot); } - void onDrawUBLSlot(MenuItemClass* menuitem, int8_t line) { + void applyUBLSlot() { bedlevel.storage_slot = menuData.value; } + void setUBLSlot() { setIntOnClick(0, settings.calc_num_meshes() - 1, bedlevel.storage_slot, applyUBLSlot); } + void onDrawUBLSlot(MenuItem* menuitem, int8_t line) { NOLESS(bedlevel.storage_slot, 0); onDrawIntMenu(menuitem, line, bedlevel.storage_slot); } - void ApplyUBLTiltGrid() { bedLevelTools.tilt_grid = MenuData.Value; } - void SetUBLTiltGrid() { SetIntOnClick(1, 3, bedLevelTools.tilt_grid, ApplyUBLTiltGrid); } + void applyUBLTiltGrid() { bedLevelTools.tilt_grid = menuData.value; } + void setUBLTiltGrid() { setIntOnClick(1, 3, bedLevelTools.tilt_grid, applyUBLTiltGrid); } - void UBLMeshTilt() { + void ublMeshTilt() { NOLESS(bedlevel.storage_slot, 0); if (bedLevelTools.tilt_grid > 1) gcode.process_subcommands_now(TS(F("G29J"), bedLevelTools.tilt_grid)); @@ -3956,19 +3960,19 @@ void Draw_Steps_Menu() { LCD_MESSAGE(MSG_UBL_MESH_TILTED); } - void UBLSmartFillMesh() { + void ublSmartFillMesh() { for (uint8_t x = 0; x < GRID_MAX_POINTS_Y; ++x) bedlevel.smart_fill_mesh(); LCD_MESSAGE(MSG_UBL_MESH_FILLED); } - void UBLMeshSave() { + void ublMeshSave() { NOLESS(bedlevel.storage_slot, 0); settings.store_mesh(bedlevel.storage_slot); ui.status_printf(0, GET_TEXT_F(MSG_MESH_SAVED), bedlevel.storage_slot); DONE_BUZZ(true); } - void UBLMeshLoad() { + void ublMeshLoad() { NOLESS(bedlevel.storage_slot, 0); settings.load_mesh(bedlevel.storage_slot); } @@ -3977,48 +3981,48 @@ void Draw_Steps_Menu() { #if HAS_MESH - void Draw_MeshSet_Menu() { - checkkey = Menu; - if (SET_MENU(MeshMenu, MSG_MESH_LEVELING, 14)) { - BACK_ITEM(Draw_AdvancedSettings_Menu); + void drawMeshSetMenu() { + checkkey = ID_Menu; + if (SET_MENU(meshMenu, MSG_MESH_LEVELING, 14)) { + BACK_ITEM(drawAdvancedSettingsMenu); #if ENABLED(PREHEAT_BEFORE_LEVELING) - EDIT_ITEM(ICON_Temperature, MSG_UBL_SET_TEMP_BED, onDrawPIntMenu, SetBedLevT, &HMI_data.BedLevT); + EDIT_ITEM(ICON_Temperature, MSG_UBL_SET_TEMP_BED, onDrawPIntMenu, setBedLevT, &hmiData.bedLevT); #endif - EDIT_ITEM(ICON_SetZOffset, MSG_Z_FADE_HEIGHT, onDrawPFloatMenu, SetMeshFadeHeight, &planner.z_fade_height); - EDIT_ITEM(ICON_UBLActive, MSG_ACTIVATE_MESH, onDrawChkbMenu, SetMeshActive, &planner.leveling_active); + EDIT_ITEM(ICON_SetZOffset, MSG_Z_FADE_HEIGHT, onDrawPFloatMenu, setMeshFadeHeight, &planner.z_fade_height); + EDIT_ITEM(ICON_UBLActive, MSG_ACTIVATE_MESH, onDrawChkbMenu, setMeshActive, &planner.leveling_active); #if HAS_BED_PROBE - MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, AutoLev); + MENU_ITEM(ICON_Level, MSG_AUTO_MESH, onDrawMenuItem, autoLevel); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - EDIT_ITEM(ICON_UBLSlot, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot); - MENU_ITEM(ICON_UBLMeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLMeshSave); - MENU_ITEM(ICON_UBLMeshLoad, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLMeshLoad); - EDIT_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &bedLevelTools.tilt_grid); - MENU_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLMeshTilt); - MENU_ITEM(ICON_UBLSmartFill, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh); + EDIT_ITEM(ICON_UBLSlot, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, setUBLSlot, &bedlevel.storage_slot); + MENU_ITEM(ICON_UBLMeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, ublMeshSave); + MENU_ITEM(ICON_UBLMeshLoad, MSG_UBL_LOAD_MESH, onDrawMenuItem, ublMeshLoad); + EDIT_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, setUBLTiltGrid, &bedLevelTools.tilt_grid); + MENU_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILT_MESH, onDrawMenuItem, ublMeshTilt); + MENU_ITEM(ICON_UBLSmartFill, MSG_UBL_SMART_FILLIN, onDrawMenuItem, ublSmartFillMesh); #endif #if ENABLED(MESH_EDIT_MENU) MENU_ITEM(ICON_MeshReset, MSG_MESH_RESET, onDrawMenuItem, ResetMesh); - MENU_ITEM(ICON_MeshEdit, MSG_EDIT_MESH, onDrawSubMenu, Draw_EditMesh_Menu); + MENU_ITEM(ICON_MeshEdit, MSG_EDIT_MESH, onDrawSubMenu, drawEditMeshMenu); #endif - MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, DWIN_MeshViewer); + MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); } - UpdateMenu(MeshMenu); + updateMenu(meshMenu); } #if ENABLED(MESH_EDIT_MENU) - void Draw_EditMesh_Menu() { + void drawEditMeshMenu() { if (!leveling_is_valid()) { LCD_MESSAGE(MSG_UBL_MESH_INVALID); return; } set_bed_leveling_enabled(false); - checkkey = Menu; - if (SET_MENU(EditMeshMenu, MSG_EDIT_MESH, 4)) { + checkkey = ID_Menu; + if (SET_MENU(editMeshMenu, MSG_EDIT_MESH, 4)) { bedLevelTools.mesh_x = bedLevelTools.mesh_y = 0; - BACK_ITEM(Draw_MeshSet_Menu); - EDIT_ITEM(ICON_MeshEditX, MSG_MESH_X, onDrawPInt8Menu, SetEditMeshX, &bedLevelTools.mesh_x); - EDIT_ITEM(ICON_MeshEditY, MSG_MESH_Y, onDrawPInt8Menu, SetEditMeshY, &bedLevelTools.mesh_y); - EditZValueItem = EDIT_ITEM(ICON_MeshEditZ, MSG_MESH_EDIT_Z, onDrawPFloat2Menu, SetEditZValue, &bedlevel.z_values[bedLevelTools.mesh_x][bedLevelTools.mesh_y]); + BACK_ITEM(drawMeshSetMenu); + EDIT_ITEM(ICON_MeshEditX, MSG_MESH_X, onDrawPInt8Menu, setEditMeshX, &bedLevelTools.mesh_x); + EDIT_ITEM(ICON_MeshEditY, MSG_MESH_Y, onDrawPInt8Menu, setEditMeshY, &bedLevelTools.mesh_y); + editZValueItem = EDIT_ITEM(ICON_MeshEditZ, MSG_MESH_EDIT_Z, onDrawPFloat2Menu, setEditZValue, &bedlevel.z_values[bedLevelTools.mesh_x][bedLevelTools.mesh_y]); } - UpdateMenu(EditMeshMenu); + updateMenu(editMeshMenu); } #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index bd1e802458371..62bf2ad99ee30 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -54,31 +54,31 @@ namespace GET_LANG(LCD_LANGUAGE) { enum processID : uint8_t { // Process ID - MainMenu, - Menu, - SetInt, - SetPInt, - SetIntNoDraw, - SetFloat, - SetPFloat, - PrintProcess, - Popup, - Leveling, - Locked, - Reboot, - PrintDone, - ESDiagProcess, - WaitResponse, - Homing, - PidProcess, - MPCProcess, - NothingToDo + ID_MainMenu, + ID_Menu, + ID_SetInt, + ID_SetPInt, + ID_SetIntNoDraw, + ID_SetFloat, + ID_SetPFloat, + ID_PrintProcess, + ID_Popup, + ID_Leveling, + ID_Locked, + ID_Reboot, + ID_PrintDone, + ID_ESDiagProcess, + ID_WaitResponse, + ID_Homing, + ID_PIDProcess, + ID_MPCProcess, + ID_NothingToDo }; -#if ANY(DWIN_PID_TUNE, MPC_AUTOTUNE) +#if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) enum tempcontrol_t : uint8_t { - #if DWIN_PID_TUNE + #if PROUI_PID_TUNE PIDTEMP_START, PIDTEMPBED_START, PID_BAD_HEATER_ID, @@ -100,69 +100,69 @@ enum processID : uint8_t { typedef struct { // Color settings - uint16_t Background_Color; - uint16_t Cursor_Color; - uint16_t TitleBg_Color; - uint16_t TitleTxt_Color; - uint16_t Text_Color; - uint16_t Selected_Color; - uint16_t SplitLine_Color; - uint16_t Highlight_Color; - uint16_t StatusBg_Color; - uint16_t StatusTxt_Color; - uint16_t PopupBg_Color; - uint16_t PopupTxt_Color; - uint16_t AlertBg_Color; - uint16_t AlertTxt_Color; - uint16_t PercentTxt_Color; - uint16_t Barfill_Color; - uint16_t Indicator_Color; - uint16_t Coordinate_Color; + uint16_t colorBackground; + uint16_t colorCursor; + uint16_t colorTitleBg; + uint16_t colorTitleTxt; + uint16_t colorText; + uint16_t colorSelected; + uint16_t colorSplitLine; + uint16_t colorHighlight; + uint16_t colorStatusBg; + uint16_t colorStatusTxt; + uint16_t colorPopupBg; + uint16_t colorPopupTxt; + uint16_t colorAlertBg; + uint16_t colorAlertTxt; + uint16_t colorPercentTxt; + uint16_t colorBarfill; + uint16_t colorIndicator; + uint16_t colorCoordinate; // Temperatures - #if DWIN_PID_TUNE - int16_t PidCycles = DEF_PIDCYCLES; + #if PROUI_PID_TUNE + int16_t pidCycles = DEF_PIDCYCLES; #if ENABLED(PIDTEMP) - int16_t HotendPidT = DEF_HOTENDPIDT; + int16_t hotendPidT = DEF_HOTENDPIDT; #endif #if ENABLED(PIDTEMPBED) - int16_t BedPidT = DEF_BEDPIDT; + int16_t bedPidT = DEF_BEDPIDT; #endif #endif #if ENABLED(PREVENT_COLD_EXTRUSION) - int16_t ExtMinT = EXTRUDE_MINTEMP; + int16_t extMinT = EXTRUDE_MINTEMP; #endif #if ENABLED(PREHEAT_BEFORE_LEVELING) - int16_t BedLevT = LEVELING_BED_TEMP; + int16_t bedLevT = LEVELING_BED_TEMP; #endif #if ENABLED(BAUD_RATE_GCODE) - bool Baud115K = false; + bool baud115K = false; #endif - bool FullManualTramming = false; - bool MediaSort = true; - bool MediaAutoMount = ENABLED(HAS_SD_EXTENDER); + bool fullManualTramming = false; + bool mediaSort = true; + bool mediaAutoMount = ENABLED(HAS_SD_EXTENDER); #if ALL(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - uint8_t z_after_homing = DEF_Z_AFTER_HOMING; + uint8_t zAfterHoming = DEF_Z_AFTER_HOMING; #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) - LEDColor Led_Color = Def_Leds_Color; + LEDColor ledColor = defColorLeds; #endif - bool AdaptiveStepSmoothing = true; - bool EnablePreview = true; -} HMI_data_t; + bool adaptiveStepSmoothing = true; + bool enablePreview = true; +} hmi_data_t; -extern HMI_data_t HMI_data; -static constexpr size_t eeprom_data_size = sizeof(HMI_data_t); +extern hmi_data_t hmiData; +static constexpr size_t eeprom_data_size = sizeof(hmi_data_t); typedef struct { int8_t Color[3]; // Color components - #if ANY(DWIN_PID_TUNE, MPCTEMP) - tempcontrol_t tempcontrol = AUTOTUNE_DONE; + #if ANY(PROUI_PID_TUNE, MPCTEMP) + tempcontrol_t tempControl = AUTOTUNE_DONE; #endif - uint8_t Select = 0; // Auxiliary selector variable + uint8_t select = 0; // Auxiliary selector variable AxisEnum axis = X_AXIS; // Axis Select -} HMI_value_t; +} hmi_value_t; typedef struct { uint8_t language; @@ -171,10 +171,10 @@ typedef struct { bool pause_flag:1; // printing is paused bool select_flag:1; // Popup button selected bool home_flag:1; // homing in course -} HMI_flag_t; +} hmi_flag_t; -extern HMI_value_t HMI_value; -extern HMI_flag_t hmiFlag; +extern hmi_value_t hmiValue; +extern hmi_flag_t hmiFlag; extern uint8_t checkkey; // Popups @@ -182,217 +182,214 @@ extern uint8_t checkkey; void dwinPopupTemperature(const bool toohigh); #endif #if ENABLED(POWER_LOSS_RECOVERY) - void Popup_PowerLossRecovery(); + void popupPowerLossRecovery(); #endif // Tool Functions -uint32_t GetHash(char * str); +uint32_t getHash(char * str); #if ENABLED(EEPROM_SETTINGS) - void WriteEeprom(); - void ReadEeprom(); - void ResetEeprom(); + void writeEEPROM(); + void readEEPROM(); + void resetEEPROM(); #if HAS_MESH - void SaveMesh(); + void saveMesh(); #endif #endif -void RebootPrinter(); -void DisableMotors(); -void AutoLev(); -void AutoHome(); +void rebootPrinter(); +void disableMotors(); +void autoLevel(); +void autoHome(); #if HAS_PREHEAT #define _DOPREHEAT(N) void DoPreheat##N(); REPEAT_1(PREHEAT_COUNT, _DOPREHEAT) #endif -void DoCoolDown(); +void doCoolDown(); #if ENABLED(BAUD_RATE_GCODE) - void HMI_SetBaudRate(); - void SetBaud115K(); - void SetBaud250K(); + void hmiSetBaudRate(); + void setBaud115K(); + void setBaud250K(); #endif #if HAS_LCD_BRIGHTNESS - void TurnOffBacklight(); + void turnOffBacklight(); #endif -void ApplyExtMinT(); -void ParkHead(); +void applyExtMinT(); +void parkHead(); #if HAS_ONESTEP_LEVELING - void Trammingwizard(); + void trammingwizard(); #endif #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) - void ApplyLEDColor(); + void applyLEDColor(); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - void UBLMeshTilt(); - void UBLMeshSave(); - void UBLMeshLoad(); + void ublMeshTilt(); + void ublMeshSave(); + void ublMeshLoad(); #endif #if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION) - void HostShutDown(); + void hostShutDown(); #endif #if DISABLED(HAS_BED_PROBE) - void HomeZandDisable(); + void homeZAndDisable(); #endif // Other -void Goto_PrintProcess(); -void Goto_Main_Menu(); -void Goto_Info_Menu(); -void Goto_PowerLossRecovery(); -void Goto_ConfirmToPrint(); -void DWIN_Draw_Dashboard(const bool with_update); // Status Area -void Draw_Main_Area(); // Redraw main area -void DWIN_DrawStatusLine(const char *text = ""); // Draw simple status text -void DWIN_RedrawDash(); // Redraw Dash and Status line -void DWIN_RedrawScreen(); // Redraw all screen elements -void HMI_MainMenu(); // Main process screen -void HMI_Printing(); // Print page -void HMI_ReturnScreen(); // Return to previous screen before popups -void HMI_WaitForUser(); -void HMI_SaveProcessID(const uint8_t id); -void HMI_SDCardUpdate(); -void EachMomentUpdate(); -void update_variable(); +void gotoPrintProcess(); +void gotoMainMenu(); +void gotoInfoMenu(); +void gotoPowerLossRecovery(); +void gotoConfirmToPrint(); +void dwinDrawDashboard(const bool with_update); // Status Area +void drawMainArea(); // Redraw main area +void dwinDrawStatusLine(const char *text = ""); // Draw simple status text +void dwinRedrawDash(); // Redraw Dash and Status line +void dwinRedrawScreen(); // Redraw all screen elements +void hmiMainMenu(); // Main process screen +void hmiPrinting(); // Print page +void hmiReturnScreen(); // Return to previous screen before popups +void hmiWaitForUser(); +void hmiSaveProcessID(const uint8_t id); +void hmiSDCardUpdate(); +void eachMomentUpdate(); +void updateVariable(); void dwinInitScreen(); -void DWIN_HandleScreen(); -void DWIN_CheckStatusMessage(); +void dwinHandleScreen(); +void dwinCheckStatusMessage(); void dwinHomingStart(); void dwinHomingDone(); #if HAS_MESH - void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval); -#endif -void DWIN_LevelingStart(); -void DWIN_LevelingDone(); -void DWIN_Print_Started(); -void DWIN_Print_Pause(); -void DWIN_Print_Resume(); -void DWIN_Print_Finished(); -void DWIN_Print_Aborted(); + void dwinMeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval); +#endif +void dwinLevelingStart(); +void dwinLevelingDone(); +void dwinPrintStarted(); +void dwinPrintPause(); +void dwinPrintResume(); +void dwinPrintFinished(); +void dwinPrintAborted(); #if HAS_FILAMENT_SENSOR - void DWIN_FilamentRunout(const uint8_t extruder); -#endif -void DWIN_Print_Header(const char *text); -void DWIN_SetColorDefaults(); -void DWIN_CopySettingsTo(char * const buff); -void DWIN_CopySettingsFrom(const char * const buff); -void DWIN_SetDataDefaults(); -void DWIN_RebootScreen(); + void dwinFilamentRunout(const uint8_t extruder); +#endif +void dwinPrintHeader(const char *text); +void dwinSetColorDefaults(); +void dwinCopySettingsTo(char * const buff); +void dwinCopySettingsFrom(const char * const buff); +void dwinSetDataDefaults(); +void dwinRebootScreen(); #if ENABLED(ADVANCED_PAUSE_FEATURE) - void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0); - void Draw_Popup_FilamentPurge(); - void Goto_FilamentPurge(); + void dwinPopupPause(FSTR_P const fmsg, uint8_t button=0); + void drawPopupFilamentPurge(); + void gotoFilamentPurge(); #endif // Utility and extensions #if HAS_LOCKSCREEN - void DWIN_LockScreen(); - void DWIN_UnLockScreen(); - void HMI_LockScreen(); + void dwinLockScreen(); + void dwinUnLockScreen(); + void hmiLockScreen(); #endif #if HAS_MESH - void DWIN_MeshViewer(); + void dwinMeshViewer(); #endif #if HAS_GCODE_PREVIEW - void HMI_ConfirmToPrint(); + void hmiConfirmToPrint(); #endif #if HAS_ESDIAG - void Draw_EndStopDiag(); + void drawEndStopDiag(); #endif #if ENABLED(PRINTCOUNTER) - void Draw_PrintStats(); + void drawPrintStats(); #endif // Menu drawing functions -void Draw_Print_File_Menu(); -void Draw_Control_Menu(); -void Draw_AdvancedSettings_Menu(); -void Draw_Prepare_Menu(); -void Draw_Move_Menu(); -void Draw_Tramming_Menu(); +void drawPrintFileMenu(); +void drawControlMenu(); +void drawAdvancedSettingsMenu(); +void drawPrepareMenu(); +void drawMoveMenu(); +void drawTrammingMenu(); #if HAS_HOME_OFFSET - void Draw_HomeOffset_Menu(); + void drawHomeOffsetMenu(); #endif #if HAS_BED_PROBE - void Draw_ProbeSet_Menu(); + void drawProbeSetMenu(); #endif -void Draw_FilSet_Menu(); +void drawFilSetMenu(); #if ENABLED(NOZZLE_PARK_FEATURE) - void Draw_ParkPos_Menu(); + void drawParkPosMenu(); #endif -void Draw_PhySet_Menu(); +void drawPhySetMenu(); #if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) - void Draw_CaseLight_Menu(); + void drawCaseLightMenu(); #endif #if ENABLED(LED_CONTROL_MENU) - void Draw_LedControl_Menu(); + void drawLedControlMenu(); #endif -void Draw_Tune_Menu(); -void Draw_Motion_Menu(); +void drawTuneMenu(); +void drawMotionMenu(); #if ENABLED(ADVANCED_PAUSE_FEATURE) - void Draw_FilamentMan_Menu(); + void drawFilamentManMenu(); #endif #if ENABLED(MESH_BED_LEVELING) - void Draw_ManualMesh_Menu(); + void drawManualMeshMenu(); #endif -void Draw_Temperature_Menu(); -void Draw_MaxSpeed_Menu(); -void Draw_MaxAccel_Menu(); +void drawTemperatureMenu(); +void drawMaxSpeedMenu(); +void drawMaxAccelMenu(); #if HAS_CLASSIC_JERK - void Draw_MaxJerk_Menu(); + void drawMaxJerkMenu(); #endif -void Draw_Steps_Menu(); +void drawStepsMenu(); #if ANY(HAS_BED_PROBE, BABYSTEPPING) - void Draw_ZOffsetWiz_Menu(); + void drawZOffsetWizMenu(); #endif #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - void Draw_Homing_Menu(); + void drawHomingMenu(); #endif #if ENABLED(FWRETRACT) - void Draw_FWRetract_Menu(); + void drawFWRetractMenu(); #endif #if HAS_MESH - void Draw_MeshSet_Menu(); + void drawMeshSetMenu(); #if ENABLED(MESH_EDIT_MENU) - void Draw_EditMesh_Menu(); + void drawEditMeshMenu(); #endif #endif -#if HAS_TRINAMIC_CONFIG - void Draw_TrinamicConfig_menu(); -#endif // Custom colors editing #if HAS_CUSTOM_COLORS - void DWIN_ApplyColor(); - void Draw_SelectColors_Menu(); - void Draw_GetColor_Menu(); + void dwinApplyColor(); + void drawSelectColorsMenu(); + void drawGetColorMenu(); #endif // PID -#if DWIN_PID_TUNE +#if PROUI_PID_TUNE #include "../../../module/temperature.h" - void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp); - void DWIN_PidTuning(tempcontrol_t result); + void dwinStartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp); + void dwinPidTuning(tempcontrol_t result); #endif #if ENABLED(PIDTEMP) #if ENABLED(PID_AUTOTUNE_MENU) - void HotendPID(); + void hotendPID(); #endif #if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - void Draw_HotendPID_Menu(); + void drawHotendPIDMenu(); #endif #endif #if ENABLED(PIDTEMPBED) #if ENABLED(PID_AUTOTUNE_MENU) - void BedPID(); + void bedPID(); #endif #if ANY(PID_AUTOTUNE_MENU, PID_EDIT_MENU) - void Draw_BedPID_Menu(); + void drawBedPIDMenu(); #endif #endif // MPC #if ANY(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) - void Draw_HotendMPC_Menu(); + void drawHotendMPCMenu(); #endif #if ENABLED(MPC_AUTOTUNE) - void DWIN_MPCTuning(tempcontrol_t result); + void dwinMPCTuning(tempcontrol_t result); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 6f4520e23bc0a..c52d57031c83f 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -46,30 +46,30 @@ #define HAS_ZOFFSET_ITEM 1 #endif -#define Def_Background_Color RGB( 1, 12, 8) -#define Def_Cursor_Color RGB(20, 49, 31) -#define Def_TitleBg_Color RGB( 0, 23, 16) -#define Def_TitleTxt_Color Color_White -#define Def_Text_Color Color_White -#define Def_Selected_Color Select_Color -#define Def_SplitLine_Color RGB( 0, 23, 16) -#define Def_Highlight_Color Color_White -#define Def_StatusBg_Color RGB( 0, 23, 16) -#define Def_StatusTxt_Color Color_Yellow -#define Def_PopupBg_Color Color_Bg_Window -#define Def_PopupTxt_Color Popup_Text_Color -#define Def_AlertBg_Color Color_Bg_Red -#define Def_AlertTxt_Color Color_Yellow -#define Def_PercentTxt_Color Percent_Color -#define Def_Barfill_Color BarFill_Color -#define Def_Indicator_Color Color_White -#define Def_Coordinate_Color Color_White -#define Def_Button_Color RGB( 0, 23, 16) +#define defColorBackground RGB( 1, 12, 8) +#define defColorCursor RGB(20, 49, 31) +#define defColorTitleBg RGB( 0, 23, 16) +#define defColorTitleTxt COLOR_WHITE +#define defColorText COLOR_WHITE +#define defColorSelected COLOR_SELECT +#define defColorSplitLine RGB( 0, 23, 16) +#define defColorHighlight COLOR_WHITE +#define defColorStatusBg RGB( 0, 23, 16) +#define defColorStatusTxt COLOR_YELLOW +#define defColorPopupBg COLOR_BG_WINDOW +#define defColorPopupTxt COLOR_POPUP_TEXT +#define defColorAlertBg COLOR_BG_RED +#define defColorAlertTxt COLOR_YELLOW +#define defColorPercentTxt COLOR_PERCENT +#define defColorBarfill COLOR_BARFILL +#define defColorIndicator COLOR_WHITE +#define defColorCoordinate COLOR_WHITE +#define defColorButton RGB( 0, 23, 16) #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) - #define Def_Leds_Color LEDColorWhite() + #define defColorLeds LEDColorWhite() #endif #if ENABLED(CASELIGHT_USES_BRIGHTNESS) - #define Def_CaseLight_Brightness 255 + #define defCaseLightBrightness 255 #endif #ifdef Z_AFTER_HOMING #define DEF_Z_AFTER_HOMING Z_AFTER_HOMING diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index 180b35e2ecb17..853da8532e121 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -42,7 +42,7 @@ // QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16) // (Nx, Ny): The coordinates of the upper left corner displayed by the QR code // str: multi-bit data -void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) { +void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) { size_t i = 0; dwinByte(i, 0x21); dwinWord(i, x); @@ -64,7 +64,7 @@ void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { +void dwinFrameAreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { size_t i = 0; dwinByte(i, 0x26); dwinWord(i, xStart); @@ -84,7 +84,7 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16 // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { +void dwinFrameAreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { size_t i = 0; dwinByte(i, 0x27); dwinByte(i, (IBD & 1) << 7 | (BIR & 1) << 6 | (BFI & 1) << 5 | cacheID); @@ -102,8 +102,8 @@ void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { - DWIN_Frame_AreaCopy(false, false, true, cacheID, xStart, yStart, xEnd, yEnd, x, y); +void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { + dwinFrameAreaCopy(false, false, true, cacheID, xStart, yStart, xEnd, yEnd, x, y); } // Write buffer data to the SRAM or Flash @@ -111,7 +111,7 @@ void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint // addr: start address // length: Bytes to write // data: address of the buffer with data -void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) { +void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data) { const uint8_t max_size = 128; uint16_t pending = length; uint16_t to_send; @@ -156,7 +156,7 @@ void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr) { // Write the contents of the 32KB SRAM data memory into the designated image memory space. // picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes -void DWIN_SRAMToPic(uint8_t picID) { +void dwinSRAMToPic(uint8_t picID) { size_t i = 0; dwinByte(i, 0x33); dwinByte(i, 0x5A); @@ -167,7 +167,7 @@ void DWIN_SRAMToPic(uint8_t picID) { //--------------------------Test area ------------------------- -//void DWIN_ReadSRAM(uint16_t addr, const uint8_t length, const char * const data) { +//void dwinReadSRAM(uint16_t addr, const uint8_t length, const char * const data) { // size_t i = 0; // dwinByte(i, 0x32); // dwinByte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.h b/Marlin/src/lcd/e3v2/proui/dwin_lcd.h index 8c9c063367dc7..51f459012905f 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.h @@ -35,10 +35,10 @@ // QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16) // (Nx, Ny): The coordinates of the upper left corner displayed by the QR code // str: multi-bit data -void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string); +void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string); -inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_QR(QR_Pixel, x, y, (char *)title); +inline void dwinDrawQR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawQR(QR_Pixel, x, y, (char *)fTitle); } // Copy area from virtual display area to current screen @@ -46,13 +46,13 @@ inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); // Copy area from current virtual display area to current screen // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); // Copy area from virtual display area to current screen // IBD: background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black @@ -62,14 +62,14 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16 // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); // Write buffer data to the SRAM or Flash // mem: 0x5A=32KB SRAM, 0xA5=16KB Flash // addr: start address // length: Bytes to write // data: address of the buffer with data -void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data); +void dwinWriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data); // Draw an Icon from SRAM // x/y: Upper-left point @@ -78,4 +78,4 @@ void dwinIconShow(uint16_t x, uint16_t y, uint16_t addr); // Write the contents of the 32KB SRAM data memory into the designated image memory space. // picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes -void DWIN_SRAMToPic(uint8_t picID); +void dwinSRAMToPic(uint8_t picID); diff --git a/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp b/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp index 7b22069c69e18..91c3ee98e3907 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_popup.cpp @@ -43,41 +43,41 @@ popupChangeFunc_t popupChange = nullptr; uint16_t HighlightYPos = 280; -void Draw_Select_Highlight(const bool sel, const uint16_t ypos) { +void drawSelectHighlight(const bool sel, const uint16_t ypos) { HighlightYPos = ypos; hmiFlag.select_flag = sel; - const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_Color, - c2 = sel ? HMI_data.PopupBg_Color : HMI_data.Highlight_Color; + const uint16_t c1 = sel ? hmiData.colorHighlight : hmiData.colorPopupBg, + c2 = sel ? hmiData.colorPopupBg : hmiData.colorHighlight; dwinDrawRectangle(0, c1, 25, ypos - 1, 126, ypos + 38); dwinDrawRectangle(0, c1, 24, ypos - 2, 127, ypos + 39); dwinDrawRectangle(0, c2, 145, ypos - 1, 246, ypos + 38); dwinDrawRectangle(0, c2, 144, ypos - 2, 247, ypos + 39); } -void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) { - HMI_SaveProcessID(WaitResponse); - DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue +void dwinPopupContinue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) { + hmiSaveProcessID(ID_WaitResponse); + dwinDrawPopup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue dwinUpdateLCD(); } -void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) { - DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2); - DWINUI::Draw_Button(BTN_Confirm, 26, 280); - DWINUI::Draw_Button(BTN_Cancel, 146, 280); - Draw_Select_Highlight(hmiFlag.select_flag); +void dwinPopupConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) { + dwinDrawPopup(ICON_BLTouch, F("Please confirm"), fmsg2); + DWINUI::drawButton(BTN_Confirm, 26, 280); + DWINUI::drawButton(BTN_Cancel, 146, 280); + drawSelectHighlight(hmiFlag.select_flag); dwinUpdateLCD(); } -void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) { +void gotoPopup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) { popupDraw = fnDraw; popupClick = fnClick; popupChange = fnChange; - HMI_SaveProcessID(Popup); + hmiSaveProcessID(ID_Popup); hmiFlag.select_flag = false; popupDraw(); } -void HMI_Popup() { +void hmiPopup() { if (!wait_for_user) { if (popupClick) popupClick(); return; @@ -86,7 +86,7 @@ void HMI_Popup() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) { const bool change = encoder_diffState != ENCODER_DIFF_CW; - if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos); + if (popupChange) popupChange(change); else drawSelectHighlight(change, HighlightYPos); dwinUpdateLCD(); } } diff --git a/Marlin/src/lcd/e3v2/proui/dwin_popup.h b/Marlin/src/lcd/e3v2/proui/dwin_popup.h index 5009f36b3b15d..ee8664e874dd3 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_popup.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_popup.h @@ -36,38 +36,38 @@ typedef void (*popupClickFunc_t)(); typedef void (*popupChangeFunc_t)(const bool state); extern popupDrawFunc_t popupDraw; -void Draw_Select_Highlight(const bool sel, const uint16_t ypos); -inline void Draw_Select_Highlight(const bool sel) { Draw_Select_Highlight(sel, 280); }; -void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2); -void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2); -void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr); -void HMI_Popup(); +void drawSelectHighlight(const bool sel, const uint16_t ypos); +inline void drawSelectHighlight(const bool sel) { drawSelectHighlight(sel, 280); }; +void dwinPopupContinue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2); +void dwinPopupConfirmCancel(const uint8_t icon, FSTR_P const fmsg2); +void gotoPopup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr); +void hmiPopup(); -inline void Draw_Popup_Bkgd() { - dwinDrawRectangle(1, HMI_data.PopupBg_Color, 14, 60, 258, 330); - dwinDrawRectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330); +inline void drawPopupBkgd() { + dwinDrawRectangle(1, hmiData.colorPopupBg, 14, 60, 258, 330); + dwinDrawRectangle(0, hmiData.colorHighlight, 14, 60, 258, 330); } template -void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - if (icon) DWINUI::Draw_Icon(icon, 101, 105); - if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1); - if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2); - if (button) DWINUI::Draw_Button(button, 86, 280); +void dwinDrawPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { + DWINUI::clearMainArea(); + drawPopupBkgd(); + if (icon) DWINUI::drawIcon(icon, 101, 105); + if (amsg1) DWINUI::drawCenteredString(hmiData.colorPopupTxt, 210, amsg1); + if (amsg2) DWINUI::drawCenteredString(hmiData.colorPopupTxt, 240, amsg2); + if (button) DWINUI::drawButton(button, 86, 280); } template -void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { - DWIN_Draw_Popup(icon, amsg1, amsg2, button); +void dwinShowPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { + dwinDrawPopup(icon, amsg1, amsg2, button); dwinUpdateLCD(); } template -void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) { - HMI_SaveProcessID(WaitResponse); - DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm +void dwinPopupConfirm(const uint8_t icon, T amsg1, U amsg2) { + hmiSaveProcessID(ID_WaitResponse); + dwinDrawPopup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index 235b30f9faa2e..72b66fb5b3e4b 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -35,26 +35,26 @@ #include "dwinui.h" xy_int_t DWINUI::cursor = { 0 }; -uint16_t DWINUI::pencolor = Color_White; -uint16_t DWINUI::textcolor = Def_Text_Color; -uint16_t DWINUI::backcolor = Def_Background_Color; -uint16_t DWINUI::buttoncolor = Def_Button_Color; -uint8_t DWINUI::fontid = font8x16; -FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR); +uint16_t DWINUI::penColor = COLOR_WHITE; +uint16_t DWINUI::textColor = defColorText; +uint16_t DWINUI::backColor = defColorBackground; +uint16_t DWINUI::buttonColor = defColorButton; +uint8_t DWINUI::fontID = font8x16; +FSTR_P const DWINUI::author = F(STRING_CONFIG_H_AUTHOR); -void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr; +void (*DWINUI::onTitleDraw)(Title* t) = nullptr; void DWINUI::init() { cursor.reset(); - pencolor = Color_White; - textcolor = Def_Text_Color; - backcolor = Def_Background_Color; - buttoncolor = Def_Button_Color; - fontid = font8x16; + penColor = COLOR_WHITE; + textColor = defColorText; + backColor = defColorBackground; + buttonColor = defColorButton; + fontID = font8x16; } // Set text/number font -void DWINUI::setFont(fontid_t fid) { fontid = fid; } +void DWINUI::setFont(fontid_t fid) { fontID = fid; } // Get font character width uint8_t DWINUI::fontWidth(fontid_t fid) { @@ -95,33 +95,33 @@ uint8_t DWINUI::fontHeight(fontid_t fid) { } // Get screen x coordinates from text column -uint16_t DWINUI::ColToX(uint8_t col) { return col * fontWidth(fontid); } +uint16_t DWINUI::colToX(uint8_t col) { return col * fontWidth(fontID); } // Get screen y coordinates from text row -uint16_t DWINUI::RowToY(uint8_t row) { return row * fontHeight(fontid); } +uint16_t DWINUI::rowToY(uint8_t row) { return row * fontHeight(fontID); } // Set text/number color -void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { - textcolor = fgcolor; - backcolor = bgcolor; - buttoncolor = alcolor; +void DWINUI::setColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) { + textColor = fgcolor; + backColor = bgcolor; + buttonColor = alcolor; } -void DWINUI::SetTextColor(uint16_t fgcolor) { - textcolor = fgcolor; +void DWINUI::setTextColor(uint16_t fgcolor) { + textColor = fgcolor; } -void DWINUI::SetBackgroundColor(uint16_t bgcolor) { - backcolor = bgcolor; +void DWINUI::setBackgroundColor(uint16_t bgcolor) { + backColor = bgcolor; } // Moves cursor to point // x: abscissa of the display // y: ordinate of the display // point: xy coordinate -void DWINUI::MoveTo(int16_t x, int16_t y) { +void DWINUI::moveTo(int16_t x, int16_t y) { cursor.x = x; cursor.y = y; } -void DWINUI::MoveTo(xy_int_t point) { +void DWINUI::moveTo(xy_int_t point) { cursor = point; } @@ -129,16 +129,16 @@ void DWINUI::MoveTo(xy_int_t point) { // x: abscissa of the display // y: ordinate of the display // point: xy coordinate -void DWINUI::MoveBy(int16_t x, int16_t y) { +void DWINUI::moveBy(int16_t x, int16_t y) { cursor.x += x; cursor.y += y; } -void DWINUI::MoveBy(xy_int_t point) { +void DWINUI::moveBy(xy_int_t point) { cursor += point; } // Draw a Centered string using arbitrary x1 and x2 margins -void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { +void DWINUI::drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1; dwinDrawString(bShow, fid, color, bColor, x, y, string); } @@ -148,28 +148,28 @@ void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint1 // x: abscissa of the display // y: ordinate of the display // c: ASCII code of char -void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { +void DWINUI::drawChar(uint16_t color, uint16_t x, uint16_t y, const char c) { const char string[2] = { c, 0}; - dwinDrawString(false, fontid, color, backcolor, x, y, string, 1); + dwinDrawString(false, fontID, color, backColor, x, y, string, 1); } // Draw a char at cursor position and increment cursor -void DWINUI::Draw_Char(uint16_t color, const char c) { - Draw_Char(color, cursor.x, cursor.y, c); - MoveBy(fontWidth(fontid), 0); +void DWINUI::drawChar(uint16_t color, const char c) { + drawChar(color, cursor.x, cursor.y, c); + moveBy(fontWidth(fontID), 0); } // Draw a string at cursor position // color: Character color // *string: The string // rlimit: For draw less chars than string length use rlimit -void DWINUI::Draw_String(const char * const string, uint16_t rlimit) { - dwinDrawString(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(fontid), 0); +void DWINUI::drawString(const char * const string, uint16_t rlimit) { + dwinDrawString(false, fontID, textColor, backColor, cursor.x, cursor.y, string, rlimit); + moveBy(strlen(string) * fontWidth(fontID), 0); } -void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) { - dwinDrawString(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit); - MoveBy(strlen(string) * fontWidth(fontid), 0); +void DWINUI::drawString(uint16_t color, const char * const string, uint16_t rlimit) { + dwinDrawString(false, fontID, color, backColor, cursor.x, cursor.y, string, rlimit); + moveBy(strlen(string) * fontWidth(fontID), 0); } // Draw a numeric integer value @@ -181,7 +181,7 @@ void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rli // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value -void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { +void DWINUI::drawInt(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { char nstr[10]; sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); dwinDrawString(bShow, fid, color, bColor, x, y, nstr); @@ -197,7 +197,7 @@ void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t col // fNum: Number of decimal digits // x/y: Upper-left coordinate // value: float value -void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { +void DWINUI::drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { char nstr[10]; dwinDrawString(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); } @@ -217,19 +217,19 @@ void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) { // ------------------------- Buttons ------------------------------// -void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { +void DWINUI::drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { dwinDrawRectangle(1, bcolor, x1, y1, x2, y2); - Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); + drawCenteredString(0, fontID, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); } -void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { +void DWINUI::drawButton(uint8_t id, uint16_t x, uint16_t y) { switch (id) { - case BTN_Cancel : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break; - case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break; - case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; - case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; - case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; - case BTN_Purge : Draw_Button(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; + case BTN_Cancel : drawButton(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break; + case BTN_Confirm : drawButton(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break; + case BTN_Continue: drawButton(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break; + case BTN_Print : drawButton(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break; + case BTN_Save : drawButton(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break; + case BTN_Purge : drawButton(GET_TEXT_F(MSG_BUTTON_PURGE), x, y); break; default: break; } } @@ -241,7 +241,7 @@ void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) { // x: the abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius -void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { +void DWINUI::drawCircle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { int a = 0, b = 0; while (a <= b) { b = SQRT(sq(r) - sq(a)); @@ -263,7 +263,7 @@ void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { // x: the abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius -void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { +void DWINUI::drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { dwinDrawLine(bcolor, x - r, y, x + r, y); uint16_t b = 1; while (b <= r) { @@ -322,54 +322,54 @@ uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) { // bColor: Background color // x/y: Upper-left point // mode : 0 : unchecked, 1 : checked -void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { +void DWINUI::drawCheckbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { dwinDrawRectangle(0, color, x + 2, y + 2, x + 17, y + 17); dwinDrawRectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13); } // Clear Menu by filling the menu area with background color -void DWINUI::ClearMainArea() { - dwinDrawRectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); +void DWINUI::clearMainArea() { + dwinDrawRectangle(1, backColor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); } /* Title Class ==============================================================*/ -TitleClass Title; +Title title; -void TitleClass::draw() { +void Title::draw() { if (DWINUI::onTitleDraw != nullptr) (*DWINUI::onTitleDraw)(this); } -void TitleClass::SetCaption(const char * const title) { +void Title::setCaption(const char * const titleStr) { frameid = 0; - if ( caption == title ) return; - const uint8_t len = _MIN(sizeof(caption) - 1, strlen(title)); - memcpy(&caption[0], title, len); + if ( caption == titleStr ) return; + const uint8_t len = _MIN(sizeof(caption) - 1, strlen(titleStr)); + memcpy(&caption[0], titleStr, len); caption[len] = '\0'; } -void TitleClass::ShowCaption(const char * const title) { - SetCaption(title); +void Title::showCaption(const char * const titleStr) { + setCaption(titleStr); draw(); } -void TitleClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { +void Title::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { caption[0] = '\0'; frameid = id; frame = { x1, y1, x2, y2 }; } -void TitleClass::SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - SetFrame(1, x, y, x + w - 1, y + h - 1); +void Title::setFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { + setFrame(1, x, y, x + w - 1, y + h - 1); } -void TitleClass::FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { - SetFrame(id, x1, y1, x2, y2); +void Title::frameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { + setFrame(id, x1, y1, x2, y2); draw(); } -void TitleClass::FrameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - FrameCopy(1, x, y, x + w - 1, y + h - 1); +void Title::frameCopy(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { + frameCopy(1, x, y, x + w - 1, y + h - 1); } #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 06daece9d0998..9f8ab70e71b31 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -46,7 +46,7 @@ #define ICON_Cancel ICON_StockConfiguration #define ICON_CustomPreheat ICON_SetEndTemp #define ICON_Error ICON_TempTooHigh -#define ICON_ESDiag ICON_Info +#define ICON_esDiag ICON_Info #define ICON_ExtrudeMinT ICON_HotendTemp #define ICON_FilLoad ICON_WriteEEPROM #define ICON_FilMan ICON_ResumeEEPROM @@ -170,24 +170,24 @@ #define BTN_Purge 92 // Extended and default UI Colors -#define Color_Black 0 -#define Color_Green RGB(0,63,0) -#define Color_Aqua RGB(0,63,31) -#define Color_Blue RGB(0,0,31) -#define Color_Light_White 0xBDD7 -#define Color_Light_Green 0x3460 -#define Color_Cyan 0x07FF -#define Color_Light_Cyan 0x04F3 -#define Color_Light_Blue 0x3A6A -#define Color_Magenta 0xF81F -#define Color_Light_Magenta 0x9813 -#define Color_Light_Red 0x8800 -#define Color_Orange 0xFA20 -#define Color_Light_Orange 0xFBC0 -#define Color_Light_Yellow 0x8BE0 -#define Color_Brown 0xCC27 -#define Color_Light_Brown 0x6204 -#define Color_Grey 0x18E3 +#define COLOR_BLACK 0 +#define COLOR_GREEN RGB(0,63,0) +#define COLOR_AQUA RGB(0,63,31) +#define COLOR_BLUE RGB(0,0,31) +#define COLOR_LIGHT_WHITE 0xBDD7 +#define COLOR_LIGHT_GREEN 0x3460 +#define COLOR_CYAN 0x07FF +#define COLOR_LIGHT_CYAN 0x04F3 +#define COLOR_LIGHT_BLUE 0x3A6A +#define COLOR_MAGENTA 0xF81F +#define COLOR_LIGHT_MAGENTA 0x9813 +#define COLOR_LIGHT_RED 0x8800 +#define COLOR_ORANGE 0xFA20 +#define COLOR_LIGHT_ORANGE 0xFBC0 +#define COLOR_LIGHT_YELLOW 0x8BE0 +#define COLOR_BROWN 0xCC27 +#define COLOR_LIGHT_BROWN 0x6204 +#define COLOR_GREY 0x18E3 // UI element defines and constants #define DWIN_FONT_MENU font8x16 @@ -195,7 +195,7 @@ #define DWIN_FONT_HEAD font10x20 #define DWIN_FONT_ALERT font10x20 #define STATUS_Y 354 -#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontid is font8x16 +#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default fontID is font8x16 // Minimum unit (0.1) : multiple (10) #define UNITFDIGITS 1 @@ -223,33 +223,33 @@ constexpr uint8_t TITLE_HEIGHT = 30, // Title bar heig typedef struct { uint16_t left, top, right, bottom; } rect_t; typedef struct { uint16_t x, y, w, h; } frame_rect_t; -class TitleClass { +class Title { public: char caption[32] = ""; uint8_t frameid = 0; rect_t frame = {0}; void draw(); - void SetCaption(const char * const title); - inline void SetCaption(FSTR_P title) { SetCaption((char *)title); } - void ShowCaption(const char * const title); - inline void ShowCaption(FSTR_P title) { ShowCaption((char *)title); } - void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - void SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h); - void FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - void FrameCopy(uint16_t x, uint16_t y, uint16_t h, uint16_t v); + void setCaption(const char * const titleStr); + inline void setCaption(FSTR_P fTitle) { setCaption((char *)fTitle); } + void showCaption(const char * const titleStr); + inline void showCaption(FSTR_P fTitle) { showCaption((char *)fTitle); } + void setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + void setFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h); + void frameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + void frameCopy(uint16_t x, uint16_t y, uint16_t h, uint16_t v); }; -extern TitleClass Title; +extern Title title; namespace DWINUI { extern xy_int_t cursor; - extern uint16_t pencolor; - extern uint16_t textcolor; - extern uint16_t backcolor; - extern uint16_t buttoncolor; - extern fontid_t fontid; - extern FSTR_P const Author; + extern uint16_t penColor; + extern uint16_t textColor; + extern uint16_t backColor; + extern uint16_t buttonColor; + extern fontid_t fontID; + extern FSTR_P const author; - extern void (*onTitleDraw)(TitleClass* title); + extern void (*onTitleDraw)(Title* t); // DWIN LCD Initialization void init(); @@ -259,50 +259,50 @@ namespace DWINUI { // Get font character width uint8_t fontWidth(fontid_t cfont); - inline uint8_t fontWidth() { return fontWidth(fontid); }; + inline uint8_t fontWidth() { return fontWidth(fontID); }; // Get font character height uint8_t fontHeight(fontid_t cfont); - inline uint8_t fontHeight() { return fontHeight(fontid); }; + inline uint8_t fontHeight() { return fontHeight(fontID); }; // Get screen x coordinates from text column - uint16_t ColToX(uint8_t col); + uint16_t colToX(uint8_t col); // Get screen y coordinates from text row - uint16_t RowToY(uint8_t row); + uint16_t rowToY(uint8_t row); // Set text/number color - void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor); - void SetTextColor(uint16_t fgcolor); - void SetBackgroundColor(uint16_t bgcolor); + void setColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor); + void setTextColor(uint16_t fgcolor); + void setBackgroundColor(uint16_t bgcolor); // Moves cursor to point // x: abscissa of the display // y: ordinate of the display // point: xy coordinate - void MoveTo(int16_t x, int16_t y); - void MoveTo(xy_int_t point); + void moveTo(int16_t x, int16_t y); + void moveTo(xy_int_t point); // Moves cursor relative to the actual position // x: abscissa of the display // y: ordinate of the display // point: xy coordinate - void MoveBy(int16_t x, int16_t y); - void MoveBy(xy_int_t point); + void moveBy(int16_t x, int16_t y); + void moveBy(xy_int_t point); // Draw a line from the cursor to xy position // color: Line segment color // x/y: End point - inline void LineTo(uint16_t color, uint16_t x, uint16_t y) { + inline void lineTo(uint16_t color, uint16_t x, uint16_t y) { dwinDrawLine(color, cursor.x, cursor.y, x, y); } - inline void LineTo(uint16_t x, uint16_t y) { - dwinDrawLine(pencolor, cursor.x, cursor.y, x, y); + inline void lineTo(uint16_t x, uint16_t y) { + dwinDrawLine(penColor, cursor.x, cursor.y, x, y); } // Extend a frame box // v: value to extend - inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) { + inline frame_rect_t extendFrame(frame_rect_t frame, uint8_t v) { frame_rect_t t; t.x = frame.x - v; t.y = frame.y - v; @@ -321,14 +321,14 @@ namespace DWINUI { // Draw an Icon with transparent background from the library ICON // icon: Icon ID // x/y: Upper-left point - inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) { + inline void drawIcon(uint8_t icon, uint16_t x, uint16_t y) { ICON_Show(false, icon, x, y); } // Draw an Icon from the library ICON with its background // icon: Icon ID // x/y: Upper-left point - inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) { + inline void drawIconWB(uint8_t icon, uint16_t x, uint16_t y) { ICON_Show(true, icon, x, y); } @@ -341,48 +341,48 @@ namespace DWINUI { // iNum: Number of digits // x/y: Upper-left coordinate // value: Integer value - void Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); + void drawInt(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value); // Draw a positive integer - inline void Draw_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 0, fid, color, bColor, iNum, x, y, value); + inline void drawInt(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(bShow, 0, fid, color, bColor, iNum, x, y, value); } - inline void Draw_Int(uint8_t iNum, long value) { - Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(fontid), 0); + inline void drawInt(uint8_t iNum, long value) { + drawInt(false, 0, fontID, textColor, backColor, iNum, cursor.x, cursor.y, value); + moveBy(iNum * fontWidth(fontID), 0); } - inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, fontid, textcolor, backcolor, iNum, x, y, value); + inline void drawInt(uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 0, fontID, textColor, backColor, iNum, x, y, value); } - inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 0, fontid, color, backcolor, iNum, x, y, value); + inline void drawInt(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 0, fontID, color, backColor, iNum, x, y, value); } - inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, fontid, color, bColor, iNum, x, y, value); + inline void drawInt(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 0, fontID, color, bColor, iNum, x, y, value); } - inline void Draw_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 0, fid, color, bColor, iNum, x, y, value); + inline void drawInt(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 0, fid, color, bColor, iNum, x, y, value); } // Draw a signed integer - inline void Draw_Signed_Int(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(bShow, 1, fid, color, bColor, iNum, x, y, value); + inline void drawSignedInt(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(bShow, 1, fid, color, bColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint8_t iNum, long value) { - Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, cursor.x, cursor.y, value); - MoveBy(iNum * fontWidth(fontid), 0); + inline void drawSignedInt(uint8_t iNum, long value) { + drawInt(false, 1, fontID, textColor, backColor, iNum, cursor.x, cursor.y, value); + moveBy(iNum * fontWidth(fontID), 0); } - inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, fontid, textcolor, backcolor, iNum, x, y, value); + inline void drawSignedInt(uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 1, fontID, textColor, backColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(false, 1, fontid, color, backcolor, iNum, x, y, value); + inline void drawSignedInt(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(false, 1, fontID, color, backColor, iNum, x, y, value); } - inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, fontid, color, bColor, iNum, x, y, value); + inline void drawSignedInt(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 1, fontID, color, bColor, iNum, x, y, value); } - inline void Draw_Signed_Int(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { - Draw_Int(true, 1, fid, color, bColor, iNum, x, y, value); + inline void drawSignedInt(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) { + drawInt(true, 1, fid, color, bColor, iNum, x, y, value); } // Draw a numeric float value @@ -395,48 +395,48 @@ namespace DWINUI { // fNum: Number of decimal digits // x/y: Upper-left coordinate // value: float value - void Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); + void drawFloat(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value); // Draw a positive floating point number - inline void Draw_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawFloat(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(bShow, 0, fid, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0); + inline void drawFloat(uint8_t iNum, uint8_t fNum, float value) { + drawFloat(false, 0, fontID, textColor, backColor, iNum, fNum, cursor.x, cursor.y, value); + moveBy((iNum + fNum + 1) * fontWidth(fontID), 0); } - inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, fontid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawFloat(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 0, fontID, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 0, fid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawFloat(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 0, fid, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, fontid, color, bColor, iNum, fNum, x, y, value); + inline void drawFloat(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 0, fontID, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 0, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawFloat(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 0, fid, color, bColor, iNum, fNum, x, y, value); } // Draw a signed floating point number - inline void Draw_Signed_Float(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawSignedFloat(uint8_t bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(bShow, 1, fid, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) { - Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value); - MoveBy((iNum + fNum + 1) * fontWidth(fontid), 0); + inline void drawSignedFloat(uint8_t iNum, uint8_t fNum, float value) { + drawFloat(false, 1, fontID, textColor, backColor, iNum, fNum, cursor.x, cursor.y, value); + moveBy((iNum + fNum + 1) * fontWidth(fontID), 0); } - inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, fontid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawSignedFloat(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 1, fontID, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(false, 1, fid, textcolor, backcolor, iNum, fNum, x, y, value); + inline void drawSignedFloat(fontid_t fid, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(false, 1, fid, textColor, backColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, fontid, color, bColor, iNum, fNum, x, y, value); + inline void drawSignedFloat(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 1, fontID, color, bColor, iNum, fNum, x, y, value); } - inline void Draw_Signed_Float(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { - Draw_Float(true, 1, fid, color, bColor, iNum, fNum, x, y, value); + inline void drawSignedFloat(fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { + drawFloat(true, 1, fid, color, bColor, iNum, fNum, x, y, value); } // Draw a char @@ -444,23 +444,23 @@ namespace DWINUI { // x: abscissa of the display // y: ordinate of the display // c: ASCII code of char - void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c); - inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); }; + void drawChar(uint16_t color, uint16_t x, uint16_t y, const char c); + inline void drawChar(uint16_t x, uint16_t y, const char c) { drawChar(textColor, x, y, c); }; // Draw a char at cursor position and increment cursor - void Draw_Char(uint16_t color, const char c); - inline void Draw_Char(const char c) { Draw_Char(textcolor, c); } + void drawChar(uint16_t color, const char c); + inline void drawChar(const char c) { drawChar(textColor, c); } // Draw a string at cursor position // color: Character color // *string: The string // rlimit: For draw less chars than string length use rlimit - void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF); - void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); - inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) { - Draw_String(FTOP(string), rlimit); + void drawString(const char * const string, uint16_t rlimit = 0xFFFF); + void drawString(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); + inline void drawString(FSTR_P string, uint16_t rlimit = 0xFFFF) { + drawString(FTOP(string), rlimit); } - inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { - Draw_String(color, FTOP(string), rlimit); + inline void drawString(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { + drawString(color, FTOP(string), rlimit); } // Draw a string @@ -469,29 +469,29 @@ namespace DWINUI { // bColor: Background color // x/y: Upper-left coordinate of the string // *string: The string - inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { - dwinDrawString(false, fontid, textcolor, backcolor, x, y, string); + inline void drawString(uint16_t x, uint16_t y, const char * const string) { + dwinDrawString(false, fontID, textColor, backColor, x, y, string); } - inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(false, fontid, textcolor, backcolor, x, y, FTOP(title)); + inline void drawString(uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(false, fontID, textColor, backColor, x, y, FTOP(fTitle)); } - inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { - dwinDrawString(false, fontid, color, backcolor, x, y, string); + inline void drawString(uint16_t color, uint16_t x, uint16_t y, const char * const string) { + dwinDrawString(false, fontID, color, backColor, x, y, string); } - inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(false, fontid, color, backcolor, x, y, title); + inline void drawString(uint16_t color, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(false, fontID, color, backColor, x, y, fTitle); } - inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { - dwinDrawString(true, fontid, color, bgcolor, x, y, string); + inline void drawString(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + dwinDrawString(true, fontID, color, bgcolor, x, y, string); } - inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(true, fontid, color, bgcolor, x, y, title); + inline void drawString(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(true, fontID, color, bgcolor, x, y, fTitle); } - inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { + inline void drawString(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { dwinDrawString(true, fid, color, bgcolor, x, y, string); } - inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - dwinDrawString(true, fid, color, bgcolor, x, y, title); + inline void drawString(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P fTitle) { + dwinDrawString(true, fid, color, bgcolor, x, y, fTitle); } // Draw a centered string using DWIN_WIDTH @@ -501,40 +501,40 @@ namespace DWINUI { // bColor: Background color // y: Upper coordinate of the string // *string: The string - void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); - inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { - Draw_CenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string); + void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string); + inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) { + drawCenteredString(bShow, fid, color, bColor, 0, DWIN_WIDTH, y, string); } - inline void Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { - Draw_CenteredString(bShow, fid, color, bColor, y, FTOP(string)); + inline void drawCenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { + drawCenteredString(bShow, fid, color, bColor, y, FTOP(string)); } - inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { - Draw_CenteredString(true, fontid, color, bcolor, y, string); + inline void drawCenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { + drawCenteredString(true, fontID, color, bcolor, y, string); } - inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, fid, color, backcolor, y, string); + inline void drawCenteredString(fontid_t fid, uint16_t color, uint16_t y, const char * const string) { + drawCenteredString(false, fid, color, backColor, y, string); } - inline void Draw_CenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, fid, color, backcolor, y, title); + inline void drawCenteredString(fontid_t fid, uint16_t color, uint16_t y, FSTR_P fTitle) { + drawCenteredString(false, fid, color, backColor, y, fTitle); } - inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { - Draw_CenteredString(false, fontid, color, backcolor, y, string); + inline void drawCenteredString(uint16_t color, uint16_t y, const char * const string) { + drawCenteredString(false, fontID, color, backColor, y, string); } - inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, fontid, color, backcolor, y, title); + inline void drawCenteredString(uint16_t color, uint16_t y, FSTR_P fTitle) { + drawCenteredString(false, fontID, color, backColor, y, fTitle); } - inline void Draw_CenteredString(uint16_t y, const char * const string) { - Draw_CenteredString(false, fontid, textcolor, backcolor, y, string); + inline void drawCenteredString(uint16_t y, const char * const string) { + drawCenteredString(false, fontID, textColor, backColor, y, string); } - inline void Draw_CenteredString(uint16_t y, FSTR_P title) { - Draw_CenteredString(false, fontid, textcolor, backcolor, y, title); + inline void drawCenteredString(uint16_t y, FSTR_P fTitle) { + drawCenteredString(false, fontID, textColor, backColor, y, fTitle); } // Draw a box // mode: 0=frame, 1=fill, 2=XOR fill // color: Rectangle color // frame: Box coordinates and size - inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) { + inline void drawBox(uint8_t mode, uint16_t color, frame_rect_t frame) { dwinDrawBox(mode, color, frame.x, frame.y, frame.w, frame.h); } @@ -543,9 +543,9 @@ namespace DWINUI { // x: abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius - void Draw_Circle(uint16_t color, uint16_t x,uint16_t y,uint8_t r); - inline void Draw_Circle(uint16_t color, uint8_t r) { - Draw_Circle(color, cursor.x, cursor.y, r); + void drawCircle(uint16_t color, uint16_t x,uint16_t y,uint8_t r); + inline void drawCircle(uint16_t color, uint8_t r) { + drawCircle(color, cursor.x, cursor.y, r); } // Draw a checkbox @@ -553,9 +553,9 @@ namespace DWINUI { // bColor: Background color // x/y: Upper-left point // checked : 0 : unchecked, 1 : checked - void Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked); - inline void Draw_Checkbox(uint16_t x, uint16_t y, bool checked=false) { - Draw_Checkbox(textcolor, backcolor, x, y, checked); + void drawCheckbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked); + inline void drawCheckbox(uint16_t x, uint16_t y, bool checked=false) { + drawCheckbox(textColor, backColor, x, y, checked); } // Color Interpolator @@ -568,14 +568,14 @@ namespace DWINUI { // ------------------------- Buttons ------------------------------// - void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption); - inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) { - Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption)); + void drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption); + inline void drawButton(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) { + drawButton(color, bcolor, x1, y1, x2, y2, FTOP(caption)); } - inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) { - Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption); + inline void drawButton(FSTR_P caption, uint16_t x, uint16_t y) { + drawButton(textColor, buttonColor, x, y, x + 99, y + 37, caption); } - void Draw_Button(uint8_t id, uint16_t x, uint16_t y); + void drawButton(uint8_t id, uint16_t x, uint16_t y); // -------------------------- Extra -------------------------------// @@ -584,9 +584,9 @@ namespace DWINUI { // x: abscissa of the center of the circle // y: ordinate of the center of the circle // r: circle radius - void Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r); - inline void Draw_FillCircle(uint16_t bcolor, uint8_t r) { - Draw_FillCircle(bcolor, cursor.x, cursor.y, r); + void drawFillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r); + inline void drawFillCircle(uint16_t bcolor, uint8_t r) { + drawFillCircle(bcolor, cursor.x, cursor.y, r); } // Color Interpolator through Red->Yellow->Green->Blue @@ -600,7 +600,7 @@ namespace DWINUI { // length: Bytes to write // data: address of the buffer with data inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) { - DWIN_WriteToMem(0x5A, addr, length, data); + dwinWriteToMem(0x5A, addr, length, data); } // Write buffer data to the Flash @@ -608,11 +608,11 @@ namespace DWINUI { // length: Bytes to write // data: address of the buffer with data inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) { - DWIN_WriteToMem(0xA5, addr, length, data); + dwinWriteToMem(0xA5, addr, length, data); } // Clear by filling the area with background color // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1) - void ClearMainArea(); + void clearMainArea(); }; diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp index c6d014e53c80c..4dd3d7a369ea3 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.cpp @@ -46,38 +46,38 @@ #include "../../../module/probe.h" #endif -ESDiagClass ESDiag; +ESDiag esDiag; void draw_es_label(FSTR_P const flabel=nullptr) { DWINUI::cursor.x = 40; - if (flabel) DWINUI::Draw_String(F(flabel)); - DWINUI::Draw_String(F(": ")); - DWINUI::MoveBy(0, 25); + if (flabel) DWINUI::drawString(F(flabel)); + DWINUI::drawString(F(": ")); + DWINUI::moveBy(0, 25); } void draw_es_state(const bool is_hit) { const uint8_t LM = 130; DWINUI::cursor.x = LM; - dwinDrawRectangle(1, HMI_data.PopupBg_Color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); - is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); - DWINUI::MoveBy(0, 25); + dwinDrawRectangle(1, hmiData.colorPopupBg, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); + is_hit ? DWINUI::drawString(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::drawString(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); + DWINUI::moveBy(0, 25); } -void ESDiagClass::Draw() { - Title.ShowCaption(GET_TEXT_F(MSG_ENDSTOP_TEST)); - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - DWINUI::Draw_Button(BTN_Continue, 86, 250); +void ESDiag::draw() { + title.showCaption(GET_TEXT_F(MSG_ENDSTOP_TEST)); + DWINUI::clearMainArea(); + drawPopupBkgd(); + DWINUI::drawButton(BTN_Continue, 86, 250); DWINUI::cursor.y = 80; #define ES_LABEL(S) draw_es_label(F(STR_##S)) TERN_(USE_X_MIN, ES_LABEL(X_MIN)); TERN_(USE_X_MAX, ES_LABEL(X_MAX)); TERN_(USE_Y_MIN, ES_LABEL(Y_MIN)); TERN_(USE_Y_MAX, ES_LABEL(Y_MAX)); TERN_(HAS_Z_MIN_PIN, ES_LABEL(Z_MIN)); TERN_(USE_Z_MAX, ES_LABEL(Z_MAX)); TERN_(HAS_FILAMENT_SENSOR, draw_es_label(F(STR_FILAMENT))); - Update(); + update(); } -void ESDiagClass::Update() { +void ESDiag::update() { DWINUI::cursor.y = 80; #define ES_REPORT(S) draw_es_state(READ(S##_PIN) == S##_ENDSTOP_HIT_STATE) TERN_(USE_X_MIN, ES_REPORT(X_MIN)); TERN_(USE_X_MAX, ES_REPORT(X_MAX)); diff --git a/Marlin/src/lcd/e3v2/proui/endstop_diag.h b/Marlin/src/lcd/e3v2/proui/endstop_diag.h index 236262282e111..d4a98d5f1a86c 100644 --- a/Marlin/src/lcd/e3v2/proui/endstop_diag.h +++ b/Marlin/src/lcd/e3v2/proui/endstop_diag.h @@ -28,10 +28,10 @@ * Date: 2023/05/10 */ -class ESDiagClass { +class ESDiag { public: - static void Draw(); - static void Update(); + static void draw(); + static void update(); }; -extern ESDiagClass ESDiag; +extern ESDiag esDiag; diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index c0b12c5946fdd..8017847538e40 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -200,27 +200,27 @@ void Preview_DrawFromSD() { if (Has_Preview()) { MString<45> buf; char str_1[6] = "", str_2[6] = "", str_3[6] = ""; - dwinDrawRectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); + dwinDrawRectangle(1, hmiData.colorBackground, 0, 0, DWIN_WIDTH, STATUS_Y - 1); if (fileprop.time) { buf.setf(F("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); - DWINUI::Draw_String(20, 10, &buf); + DWINUI::drawString(20, 10, &buf); } if (fileprop.filament) { buf.setf(F("Filament used: %s m"), dtostrf(fileprop.filament, 1, 2, str_1)); - DWINUI::Draw_String(20, 30, &buf); + DWINUI::drawString(20, 30, &buf); } if (fileprop.layer) { buf.setf(F("Layer height: %s mm"), dtostrf(fileprop.layer, 1, 2, str_1)); - DWINUI::Draw_String(20, 50, &buf); + DWINUI::drawString(20, 50, &buf); } if (fileprop.width) { buf.setf(F("Volume: %sx%sx%s mm"), dtostrf(fileprop.width, 1, 1, str_1), dtostrf(fileprop.length, 1, 1, str_2), dtostrf(fileprop.height, 1, 1, str_3)); - DWINUI::Draw_String(20, 70, &buf); + DWINUI::drawString(20, 70, &buf); } - DWINUI::Draw_Button(BTN_Print, 26, 290); - DWINUI::Draw_Button(BTN_Cancel, 146, 290); + DWINUI::drawButton(BTN_Print, 26, 290); + DWINUI::drawButton(BTN_Cancel, 146, 290); Preview_Show(); - Draw_Select_Highlight(true, 290); + drawSelectHighlight(true, 290); dwinUpdateLCD(); } else { diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp index 50874e0fc2bbe..ebe3568c98799 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.cpp +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.cpp @@ -36,39 +36,39 @@ #include "dwin.h" #include "lockscreen.h" -LockScreenClass lockScreen; +LockScreen lockScreen; -uint8_t LockScreenClass::lock_pos = 0; -bool LockScreenClass::unlocked = false; -uint8_t LockScreenClass::rprocess = 0; +uint8_t LockScreen::lock_pos = 0; +bool LockScreen::unlocked = false; +uint8_t LockScreen::rprocess = 0; -void LockScreenClass::init() { +void LockScreen::init() { lock_pos = 0; unlocked = false; draw(); } -void LockScreenClass::draw() { - Title.SetCaption(GET_TEXT_F(MSG_LOCKSCREEN)); - DWINUI::ClearMainArea(); - DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo - DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); - DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); - DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-")); - dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); - dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); +void LockScreen::draw() { + title.setCaption(GET_TEXT_F(MSG_LOCKSCREEN)); + DWINUI::clearMainArea(); + DWINUI::drawIcon(ICON_LOGO, 71, 120); // CREALITY logo + DWINUI::drawCenteredString(COLOR_WHITE, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); + DWINUI::drawCenteredString(COLOR_WHITE, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); + DWINUI::drawCenteredString(COLOR_WHITE, 240, F("-> | <-")); + dwinDrawBox(1, hmiData.colorBarfill, 0, 260, DWIN_WIDTH, 20); + dwinDrawVLine(COLOR_YELLOW, lock_pos * DWIN_WIDTH / 255, 260, 20); dwinUpdateLCD(); } -void LockScreenClass::onEncoder(EncoderState encoder_diffState) { +void LockScreen::onEncoder(EncoderState encoder_diffState) { switch (encoder_diffState) { case ENCODER_DIFF_CW: lock_pos += 8; break; case ENCODER_DIFF_CCW: lock_pos -= 8; break; case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break; default: break; } - dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); - dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); + dwinDrawBox(1, hmiData.colorBarfill, 0, 260, DWIN_WIDTH, 20); + dwinDrawVLine(COLOR_YELLOW, lock_pos * DWIN_WIDTH / 255, 260, 20); dwinUpdateLCD(); } diff --git a/Marlin/src/lcd/e3v2/proui/lockscreen.h b/Marlin/src/lcd/e3v2/proui/lockscreen.h index cb75f2c7c0db0..9feb91c25b411 100644 --- a/Marlin/src/lcd/e3v2/proui/lockscreen.h +++ b/Marlin/src/lcd/e3v2/proui/lockscreen.h @@ -31,7 +31,7 @@ #include "../common/encoder.h" #include -class LockScreenClass { +class LockScreen { private: static bool unlocked; static uint8_t lock_pos; @@ -43,4 +43,4 @@ class LockScreenClass { static bool isUnlocked() { return unlocked; } }; -extern LockScreenClass lockScreen; +extern LockScreen lockScreen; diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 54892b6acbb06..347130743c63c 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -37,135 +37,135 @@ int8_t MenuItemTotal = 0; int8_t MenuItemCount = 0; -CustomMenuItemClass** MenuItems = nullptr; -MenuClass *CurrentMenu = nullptr; -MenuClass *PreviousMenu = nullptr; -MenuData_t MenuData; +CustomMenuItem** menuItems = nullptr; +Menu *currentMenu = nullptr; +Menu *previousMenu = nullptr; +MenuData_t menuData; // Menuitem Drawing functions ================================================= -void Draw_Title(TitleClass* title) { - dwinDrawRectangle(1, HMI_data.TitleBg_Color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1); - if (title->frameid) - DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1); +void drawTitle(Title* aTitle) { + dwinDrawRectangle(1, hmiData.colorTitleBg, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1); + if (aTitle->frameid) + dwinFrameAreaCopy(aTitle->frameid, aTitle->frame.left, aTitle->frame.top, aTitle->frame.right, aTitle->frame.bottom, 14, (TITLE_HEIGHT - (aTitle->frame.bottom - aTitle->frame.top)) / 2 - 1); else #if ENABLED(TITLE_CENTERED) - DWINUI::Draw_CenteredString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption); + DWINUI::drawCenteredString(false, DWIN_FONT_HEAD, hmiData.colorTitleTxt, hmiData.colorTitleBg, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, aTitle->caption); #else - dwinDrawString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption); + dwinDrawString(false, DWIN_FONT_HEAD, hmiData.colorTitleTxt, hmiData.colorTitleBg, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, aTitle->caption); #endif } -void Draw_Menu_Cursor(const int8_t line) { +void drawMenuCursor(const int8_t line) { const uint16_t ypos = MYPOS(line); - DWINUI::Draw_Box(1, HMI_data.Cursor_Color, {0, ypos, 15, MLINE - 1}); + DWINUI::drawBox(1, hmiData.colorCursor, {0, ypos, 15, MLINE - 1}); } -void Erase_Menu_Cursor(const int8_t line) { +void eraseMenuCursor(const int8_t line) { const uint16_t ypos = MYPOS(line); - DWINUI::Draw_Box(1, HMI_data.Background_Color, {0, ypos, 15, MLINE - 1}); + DWINUI::drawBox(1, hmiData.colorBackground, {0, ypos, 15, MLINE - 1}); } -void Erase_Menu_Text(const int8_t line) { +void eraseMenuText(const int8_t line) { if (line < 0 || line >= TROWS) return; const uint16_t ypos = MYPOS(line) + 1; - DWINUI::Draw_Box(1, HMI_data.Background_Color, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2}); + DWINUI::drawBox(1, hmiData.colorBackground, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2}); } -void Draw_Menu_Line(const uint8_t line, const uint8_t icon/*=0*/, const char * const label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { - if (icon) DWINUI::Draw_Icon(icon, ICOX, MBASE(line) - 3); - if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label); - if (more) DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3); - if (selected) Draw_Menu_Cursor(line); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); +void drawMenuLine(const uint8_t line, const uint8_t icon/*=0*/, const char * const label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { + if (icon) DWINUI::drawIcon(icon, ICOX, MBASE(line) - 3); + if (label) DWINUI::drawString(LBLX, MBASE(line) - 1, (char*)label); + if (more) DWINUI::drawIcon(ICON_More, VALX + 16, MBASE(line) - 3); + if (selected) drawMenuCursor(line); + dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240); } -void Draw_Menu_Line(const uint8_t line, const uint8_t icon/*=0*/, FSTR_P label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { - Draw_Menu_Line(line, icon, FTOP(label), more, selected); +void drawMenuLine(const uint8_t line, const uint8_t icon/*=0*/, FSTR_P label/*=nullptr*/, bool more/*=false*/, bool selected/*=false*/) { + drawMenuLine(line, icon, FTOP(label), more, selected); } -void Draw_Chkb_Line(const uint8_t line, const bool checked) { - DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); +void drawCheckboxLine(const uint8_t line, const bool checked) { + DWINUI::drawCheckbox(hmiData.colorText, hmiData.colorBackground, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); } -void Show_Chkb_Line(const bool checked) { - const uint8_t line = CurrentMenu->line(); - DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); +void showCheckboxLine(const bool checked) { + const uint8_t line = currentMenu->line(); + DWINUI::drawCheckbox(hmiData.colorText, hmiData.colorBackground, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); dwinUpdateLCD(); } -void Toggle_Chkb_Line(bool &checked) { +void toggleCheckboxLine(bool &checked) { checked = !checked; - Show_Chkb_Line(checked); + showCheckboxLine(checked); } -void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) { - DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(line) - 1, value); +void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value/*=0*/) { + DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(line) - 1, value); } -void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) { - if (menuitem->icon) DWINUI::Draw_Icon(menuitem->icon, ICOX, MBASE(line) - 3); +void onDrawMenuItem(MenuItem* menuitem, int8_t line) { + if (menuitem->icon) DWINUI::drawIcon(menuitem->icon, ICOX, MBASE(line) - 3); if (menuitem->frameid) - DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line)); + dwinFrameAreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line)); else if (menuitem->caption) - DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption); - dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); + DWINUI::drawString(LBLX, MBASE(line) - 1, menuitem->caption); + dwinDrawHLine(hmiData.colorSplitLine, 16, MYPOS(line + 1), 240); } -void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) { +void onDrawSubMenu(MenuItem* menuitem, int8_t line) { onDrawMenuItem(menuitem, line); - DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3); + DWINUI::drawIcon(ICON_More, VALX + 16, MBASE(line) - 3); } -void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value) { +void onDrawIntMenu(MenuItem* menuitem, int8_t line, int32_t value) { onDrawMenuItem(menuitem, line); - Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, value); + drawMenuIntValue(hmiData.colorBackground, line, 4, value); } -void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line) { - const int16_t value = *(int16_t*)static_cast(menuitem)->value; +void onDrawPIntMenu(MenuItem* menuitem, int8_t line) { + const int16_t value = *(int16_t*)static_cast(menuitem)->value; onDrawIntMenu(menuitem, line, value); } -void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line) { - const uint8_t value = *(uint8_t*)static_cast(menuitem)->value; +void onDrawPInt8Menu(MenuItem* menuitem, int8_t line) { + const uint8_t value = *(uint8_t*)static_cast(menuitem)->value; onDrawIntMenu(menuitem, line, value); } -void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line) { - const uint32_t value = *(uint32_t*)static_cast(menuitem)->value; +void onDrawPInt32Menu(MenuItem* menuitem, int8_t line) { + const uint32_t value = *(uint32_t*)static_cast(menuitem)->value; onDrawIntMenu(menuitem, line, value); } -void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value) { +void onDrawFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp, const float value) { onDrawMenuItem(menuitem, line); - DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value); + DWINUI::drawSignedFloat(hmiData.colorText, hmiData.colorBackground, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value); } -void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp) { - const float value = *(float*)static_cast(menuitem)->value; +void onDrawPFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp) { + const float value = *(float*)static_cast(menuitem)->value; onDrawFloatMenu(menuitem, line, dp, value); } -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) { +void onDrawChkbMenu(MenuItem* menuitem, int8_t line, bool checked) { onDrawMenuItem(menuitem, line); - Draw_Chkb_Line(line, checked); + drawCheckboxLine(line, checked); } -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) { - const bool val = *(bool*)static_cast(menuitem)->value; +void onDrawChkbMenu(MenuItem* menuitem, int8_t line) { + const bool val = *(bool*)static_cast(menuitem)->value; onDrawChkbMenu(menuitem, line, val); } void DrawItemEdit(const bool selected) { - const uint16_t bcolor = selected ? HMI_data.Selected_Color : HMI_data.Background_Color; - const uint8_t iNum = 4 - ((MenuData.dp > 0) ? (MenuData.dp - 1) : 0); + const uint16_t bcolor = selected ? hmiData.colorSelected : hmiData.colorBackground; + const uint8_t iNum = 4 - ((menuData.dp > 0) ? (menuData.dp - 1) : 0); switch (checkkey) { - case SetIntNoDraw: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case SetInt: - case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break; - case SetFloat: - case SetPFloat: DWINUI::Draw_Signed_Float(HMI_data.Text_Color, bcolor, iNum, MenuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break; + case ID_SetIntNoDraw: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case ID_SetInt: + case ID_SetPInt: DWINUI::drawSignedInt(hmiData.colorText, bcolor, iNum , VALX, MBASE(currentMenu->line()) - 1, menuData.value); break; + case ID_SetFloat: + case ID_SetPFloat: DWINUI::drawSignedFloat(hmiData.colorText, bcolor, iNum, menuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(currentMenu->line()), menuData.value / POW(10, menuData.dp)); break; default: break; } } @@ -180,16 +180,16 @@ void DrawItemEdit(const bool selected) { // hi: high limit // dp: decimal places, 0 for integers // val: value / scaled value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { checkkey = process; - MenuData.MinValue = lo; - MenuData.MaxValue = hi; - MenuData.dp = dp; - MenuData.Apply = Apply; - MenuData.LiveUpdate = LiveUpdate; - MenuData.Value = constrain(val, lo, hi); + menuData.minValue = lo; + menuData.maxValue = hi; + menuData.dp = dp; + menuData.apply = apply; + menuData.liveUpdate = liveUpdate; + menuData.value = constrain(val, lo, hi); encoderRate.enabled = true; } @@ -198,10 +198,10 @@ void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, // lo: scaled low limit // hi: scaled high limit // val: value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - SetOnClick(process, lo, hi, 0, val, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + setOnClick(process, lo, hi, 0, val, apply, liveUpdate); DrawItemEdit(true); } @@ -210,11 +210,11 @@ void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const // lo: scaled low limit // hi: scaled high limit // val: value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { const int32_t value = round(val * POW(10, dp)); - SetOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, Apply, LiveUpdate); + setOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, apply, liveUpdate); DrawItemEdit(true); } @@ -222,21 +222,21 @@ void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp // lo: scaled low limit // hi: scaled high limit // val: value -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - SetValueOnClick(SetInt, lo, hi, val, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + setValueOnClick(ID_SetInt, lo, hi, val, apply, liveUpdate); } // Generic onclick event for set pointer to 16 bit uinteger values // lo: low limit // hi: high limit -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - MenuData.P_Int = (int16_t*)static_cast(CurrentMenu->SelectedItem())->value; - const int32_t value = *MenuData.P_Int; - SetValueOnClick(SetPInt, lo, hi, value, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setPIntOnClick(const int32_t lo, const int32_t hi, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + menuData.intPtr = (int16_t*)static_cast(currentMenu->selectedItem())->value; + const int32_t value = *menuData.intPtr; + setValueOnClick(ID_SetPInt, lo, hi, value, apply, liveUpdate); } // Generic onclick event for float values @@ -245,31 +245,31 @@ void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()/*=nullpt // hi: high limit // dp: decimal places // val: value -void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - SetValueOnClick(SetFloat, lo, hi, dp, val, Apply, LiveUpdate); +void setFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + setValueOnClick(ID_SetFloat, lo, hi, dp, val, apply, liveUpdate); } // Generic onclick event for set pointer to float values // lo: low limit // hi: high limit -// LiveUpdate: live update function when the encoder changes -// Apply: update function when the encoder is pressed -void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)()/*=nullptr*/, void (*LiveUpdate)()/*=nullptr*/) { - MenuData.P_Float = (float*)static_cast(CurrentMenu->SelectedItem())->value; - SetValueOnClick(SetPFloat, lo, hi, dp, *MenuData.P_Float, Apply, LiveUpdate); +// liveUpdate: live update function when the encoder changes +// apply: update function when the encoder is pressed +void setPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) { + menuData.floatPtr = (float*)static_cast(currentMenu->selectedItem())->value; + setValueOnClick(ID_SetPFloat, lo, hi, dp, *menuData.floatPtr, apply, liveUpdate); } // HMI Control functions ====================================================== // Generic menu control using the encoder -void HMI_Menu() { +void hmiMenu() { EncoderState encoder_diffState = get_encoder_state(); - if (CurrentMenu) { + if (currentMenu) { if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) - CurrentMenu->onClick(); + currentMenu->onClick(); else - CurrentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW); + currentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW); } } @@ -279,283 +279,283 @@ void HMI_Menu() { // 0 : no change // 1 : live change // 2 : apply change -int8_t HMI_Get(bool draw) { - const int32_t lo = MenuData.MinValue; - const int32_t hi = MenuData.MaxValue; - const int32_t cval = MenuData.Value; +int8_t hmiGet(bool draw) { + const int32_t lo = menuData.minValue; + const int32_t hi = menuData.maxValue; + const int32_t cval = menuData.value; EncoderState encoder_diffState = TERN(SMOOTH_ENCODER_MENUITEMS, get_encoder_state(), encoderReceiveAnalyze()); if (encoder_diffState != ENCODER_DIFF_NO) { - if (applyEncoder(encoder_diffState, MenuData.Value)) { + if (applyEncoder(encoder_diffState, menuData.value)) { encoderRate.enabled = false; if (draw) DrawItemEdit(false); - checkkey = Menu; + checkkey = ID_Menu; return 2; } - LIMIT(MenuData.Value, lo, hi); + LIMIT(menuData.value, lo, hi); } - const bool change = cval != MenuData.Value; + const bool change = cval != menuData.value; if (change) DrawItemEdit(true); return int8_t(change); } // Set and draw a value using the encoder -void HMI_SetDraw() { - int8_t val = HMI_Get(true); +void hmiSetDraw() { + int8_t val = hmiGet(true); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: if (menuData.apply) menuData.apply(); break; } } // Set an value without drawing -void HMI_SetNoDraw() { - int8_t val = HMI_Get(false); +void hmiSetNoDraw() { + int8_t val = hmiGet(false); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: if (menuData.apply) menuData.apply(); break; } } // Set an integer pointer variable using the encoder -void HMI_SetPInt() { - int8_t val = HMI_Get(true); +void hmiSetPInt() { + int8_t val = hmiGet(true); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: *MenuData.P_Int = MenuData.Value; if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: *menuData.intPtr = menuData.value; if (menuData.apply) menuData.apply(); break; } } // Set a scaled float pointer variable using the encoder -void HMI_SetPFloat() { - const int8_t val = HMI_Get(true); +void hmiSetPFloat() { + const int8_t val = hmiGet(true); switch (val) { case 0: return; - case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break; - case 2: *MenuData.P_Float = MenuData.Value / POW(10, MenuData.dp); if (MenuData.Apply) MenuData.Apply(); break; + case 1: if (menuData.liveUpdate) menuData.liveUpdate(); break; + case 2: *menuData.floatPtr = menuData.value / POW(10, menuData.dp); if (menuData.apply) menuData.apply(); break; } } // Menu Class =============================================================== -MenuClass::MenuClass() { +Menu::Menu() { selected = 0; topline = 0; } -void MenuClass::draw() { - MenuTitle.draw(); - DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); - dwinDrawRectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); +void Menu::draw() { + menuTitle.draw(); + DWINUI::setColors(hmiData.colorText, hmiData.colorBackground, hmiData.colorStatusBg); + dwinDrawRectangle(1, DWINUI::backColor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); for (int8_t i = 0; i < MenuItemCount; i++) - MenuItems[i]->draw(i - topline); - Draw_Menu_Cursor(line()); + menuItems[i]->draw(i - topline); + drawMenuCursor(line()); dwinUpdateLCD(); } -void MenuClass::onScroll(bool dir) { +void Menu::onScroll(bool dir) { int8_t sel = selected; if (dir) sel++; else sel--; LIMIT(sel, 0, MenuItemCount - 1); if (sel != selected) { - Erase_Menu_Cursor(line()); + eraseMenuCursor(line()); dwinUpdateLCD(); if ((sel - topline) == TROWS) { - dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); + dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backColor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); topline++; - MenuItems[sel]->draw(TROWS - 1); + menuItems[sel]->draw(TROWS - 1); } if ((sel < topline)) { - dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); + dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backColor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); topline--; - MenuItems[sel]->draw(0); + menuItems[sel]->draw(0); } selected = sel; - Draw_Menu_Cursor(line()); + drawMenuCursor(line()); dwinUpdateLCD(); } } -void MenuClass::onClick() { - if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)(); +void Menu::onClick() { + if (menuItems[selected]->onClick != nullptr) (*menuItems[selected]->onClick)(); } -CustomMenuItemClass *MenuClass::SelectedItem() { - return MenuItems[selected]; +CustomMenuItem *Menu::selectedItem() { + return menuItems[selected]; } -CustomMenuItemClass** MenuClass::Items() { - return MenuItems; +CustomMenuItem** Menu::items() { + return menuItems; } -int8_t MenuClass::count() { +int8_t Menu::count() { return MenuItemCount; }; /* MenuItem Class ===========================================================*/ -void CustomMenuItemClass::draw(int8_t line) { +void CustomMenuItem::draw(int8_t line) { if (line < 0 || line >= TROWS) return; - if (onDraw != nullptr) (*onDraw)(static_cast(this), line); + if (onDraw != nullptr) (*onDraw)(static_cast(this), line); }; -void CustomMenuItemClass::redraw(bool erase/*=false*/) { - const int8_t line = CurrentMenu->line(this->pos); - if (erase) Erase_Menu_Text(line); +void CustomMenuItem::redraw(bool erase/*=false*/) { + const int8_t line = currentMenu->line(this->pos); + if (erase) eraseMenuText(line); draw(line); } -CustomMenuItemClass::CustomMenuItemClass(OnDrawItem ondraw, OnClickItem onclick) { +CustomMenuItem::CustomMenuItem(OnDrawItem ondraw, OnClickItem onclick) { onClick = onclick; onDraw = ondraw; } -MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) { +MenuItem::MenuItem(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItem(ondraw, onclick) { icon = cicon; - SetCaption(text); + setCaption(text); } -MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) { +MenuItem::MenuItem(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItem(ondraw, onclick) { icon = cicon; caption[0] = '\0'; frameid = id; frame = { x1, y1, x2, y2 }; } -void MenuItemClass::SetCaption(const char * const text) { +void MenuItem::setCaption(const char * const text) { const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text)); memcpy(&caption[0], text, len); caption[len] = '\0'; } -void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { +void MenuItem::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { caption[0] = '\0'; frameid = id; frame = { x1, y1, x2, y2 }; } -MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemClass(cicon, text, ondraw, onclick) { +MenuItemPtr::MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItem(cicon, text, ondraw, onclick) { value = val; }; // Menu auxiliary functions =================================================== -void MenuItemsClear() { - if (MenuItems == nullptr) return; - for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; - delete[] MenuItems; - MenuItems = nullptr; +void menuItemsClear() { + if (menuItems == nullptr) return; + for (int8_t i = 0; i < MenuItemCount; i++) delete menuItems[i]; + delete[] menuItems; + menuItems = nullptr; MenuItemCount = 0; MenuItemTotal = 0; } -void MenuItemsPrepare(int8_t totalitems) { - MenuItemsClear(); +void menuItemsPrepare(int8_t totalitems) { + menuItemsClear(); MenuItemTotal = _MIN(totalitems, MENU_MAX_ITEMS); - MenuItems = new CustomMenuItemClass*[totalitems]; + menuItems = new CustomMenuItem*[totalitems]; } -bool IsMenu(MenuClass* _menu) { - return ((checkkey == Menu) && !!CurrentMenu && (CurrentMenu == _menu)); +bool isMenu(Menu* _menu) { + return ((checkkey == ID_Menu) && !!currentMenu && (currentMenu == _menu)); } template -T* MenuItemAdd(T* menuitem) { - MenuItems[MenuItemCount] = menuitem; +T* menuItemAdd(T* menuitem) { + menuItems[MenuItemCount] = menuitem; menuitem->pos = MenuItemCount++; return menuitem; } -CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { +CustomMenuItem* menuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { if (MenuItemCount < MenuItemTotal) { - CustomMenuItemClass* menuitem = new CustomMenuItemClass(ondraw, onclick); - return MenuItemAdd(menuitem); + CustomMenuItem* menuitem = new CustomMenuItem(ondraw, onclick); + return menuItemAdd(menuitem); } else return nullptr; } -MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { +MenuItem* menuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { if (MenuItemCount < MenuItemTotal) { - MenuItemClass* menuitem = new MenuItemClass(cicon, text, ondraw, onclick); - return MenuItemAdd(menuitem); + MenuItem* menuitem = new MenuItem(cicon, text, ondraw, onclick); + return menuItemAdd(menuitem); } else return nullptr; } -MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { +MenuItem* menuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) { if (MenuItemCount < MenuItemTotal) { - MenuItemClass* menuitem = new MenuItemClass(cicon, id, x1, y1, x2, y2, ondraw, onclick); - return MenuItemAdd(menuitem); + MenuItem* menuitem = new MenuItem(cicon, id, x1, y1, x2, y2, ondraw, onclick); + return menuItemAdd(menuitem); } else return nullptr; } -MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) { +MenuItem* editItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) { if (MenuItemCount < MenuItemTotal) { - MenuItemClass* menuitem = new MenuItemPtrClass(cicon, text, ondraw, onclick, val); - return MenuItemAdd(menuitem); + MenuItem* menuitem = new MenuItemPtr(cicon, text, ondraw, onclick, val); + return menuItemAdd(menuitem); } else return nullptr; } -void InitMenu() { - CurrentMenu = nullptr; - PreviousMenu = nullptr; +void initMenu() { + currentMenu = nullptr; + previousMenu = nullptr; } -bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems) { - if (!menu) menu = new MenuClass(); - const bool NotCurrent = (CurrentMenu != menu); +bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems) { + if (!menu) menu = new Menu(); + const bool NotCurrent = (currentMenu != menu); if (NotCurrent) { - menu->MenuTitle.SetCaption(title); - MenuItemsPrepare(totalitems); + menu->menuTitle.setCaption(fTitle); + menuItemsPrepare(totalitems); } return NotCurrent; } -bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems) { - if (!menu) menu = new MenuClass(); - const bool NotCurrent = (CurrentMenu != menu); +bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems) { + if (!menu) menu = new Menu(); + const bool NotCurrent = (currentMenu != menu); if (NotCurrent) { if (cn.w != 0) - menu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h); + menu->menuTitle.setFrame(cn.x, cn.y, cn.w, cn.h); else - menu->MenuTitle.SetCaption(title); - MenuItemsPrepare(totalitems); + menu->menuTitle.setCaption(fTitle); + menuItemsPrepare(totalitems); } return NotCurrent; } -void ResetMenu(MenuClass* &menu) { +void resetMenu(Menu* &menu) { if (menu) { menu->topline = 0; menu->selected = 0; } } -void InvalidateMenu() { - ResetMenu(CurrentMenu); - CurrentMenu = nullptr; +void invalidateMenu() { + resetMenu(currentMenu); + currentMenu = nullptr; } -void UpdateMenu(MenuClass* &menu) { +void updateMenu(Menu* &menu) { if (!menu) return; - if (CurrentMenu != menu) { - PreviousMenu = CurrentMenu; - CurrentMenu = menu; + if (currentMenu != menu) { + previousMenu = currentMenu; + currentMenu = menu; } menu->draw(); } void ReDrawMenu(bool force/*=false*/) { - if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw(); + if (currentMenu && (force || checkkey == ID_Menu)) currentMenu->draw(); if (force) DrawItemEdit(true); } void ReDrawItem() { - static_cast(CurrentMenu->SelectedItem())->redraw(false); + static_cast(currentMenu->selectedItem())->redraw(false); } #endif // DWIN_LCD_PROUI diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index f0855e707343e..58dd92f0f6aca 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -37,154 +37,154 @@ #endif typedef struct { - int32_t MaxValue = 0; // Auxiliar max integer/scaled float value - int32_t MinValue = 0; // Auxiliar min integer/scaled float value + int32_t maxValue = 0; // Auxiliar max integer/scaled float value + int32_t minValue = 0; // Auxiliar min integer/scaled float value int8_t dp = 0; // Auxiliar decimal places - int32_t Value = 0; // Auxiliar integer / scaled float value - int16_t *P_Int = nullptr; // Auxiliar pointer to 16 bit integer variable - float *P_Float = nullptr; // Auxiliar pointer to float variable - void (*Apply)() = nullptr; // Auxiliar apply function - void (*LiveUpdate)() = nullptr; // Auxiliar live update function + int32_t value = 0; // Auxiliar integer / scaled float value + int16_t *intPtr = nullptr; // Auxiliar pointer to 16 bit integer variable + float *floatPtr = nullptr; // Auxiliar pointer to float variable + void (*apply)() = nullptr; // Auxiliar apply function + void (*liveUpdate)() = nullptr; // Auxiliar live update function } MenuData_t; -extern MenuData_t MenuData; +extern MenuData_t menuData; // Auxiliary Macros =========================================================== // Create and add a MenuItem object to the menu array -#define SET_MENU(I,L,V) SetMenu(I, GET_TEXT_F(L), V) -#define SET_MENU_F(I,L,V) SetMenu(I, F(L), V) -#define SET_MENU_R(I,R,L,V) SetMenu(I, R, GET_TEXT_F(L), V) +#define SET_MENU(I,L,V) setMenu(I, GET_TEXT_F(L), V) +#define SET_MENU_F(I,L,V) setMenu(I, F(L), V) +#define SET_MENU_R(I,R,L,V) setMenu(I, R, GET_TEXT_F(L), V) -#define BACK_ITEM(H) MenuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H) -#define MENU_ITEM(I,L,V...) MenuItemAdd(I, GET_TEXT_F(L), V) -#define EDIT_ITEM(I,L,V...) EditItemAdd(I, GET_TEXT_F(L), V) -#define MENU_ITEM_F(I,L,V...) MenuItemAdd(I, F(L), V) -#define EDIT_ITEM_F(I,L,V...) EditItemAdd(I, F(L), V) +#define BACK_ITEM(H) menuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H) +#define MENU_ITEM(I,L,V...) menuItemAdd(I, GET_TEXT_F(L), V) +#define EDIT_ITEM(I,L,V...) editItemAdd(I, GET_TEXT_F(L), V) +#define MENU_ITEM_F(I,L,V...) menuItemAdd(I, F(L), V) +#define EDIT_ITEM_F(I,L,V...) editItemAdd(I, F(L), V) // Menu Classes =============================================================== -class CustomMenuItemClass; -class MenuItemClass; +class CustomMenuItem; +class MenuItem; -typedef void (*OnDrawCustomItem)(CustomMenuItemClass* menuitem, int8_t line); -typedef void (*OnDrawItem)(MenuItemClass* menuitem, int8_t line); +typedef void (*OnDrawCustomItem)(CustomMenuItem* menuitem, int8_t line); +typedef void (*OnDrawItem)(MenuItem* menuitem, int8_t line); typedef void (*OnClickItem)(); -class CustomMenuItemClass { +class CustomMenuItem { public: int8_t pos = 0; OnDrawItem onDraw = nullptr; void (*onClick)() = nullptr; - CustomMenuItemClass() {}; - CustomMenuItemClass(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); - virtual ~CustomMenuItemClass(){}; + CustomMenuItem() {}; + CustomMenuItem(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); + virtual ~CustomMenuItem(){}; virtual void draw(int8_t line); void redraw(bool erase=false); }; -class MenuItemClass: public CustomMenuItemClass { +class MenuItem: public CustomMenuItem { public: uint8_t icon = 0; char caption[MENU_CHAR_LIMIT] = ""; uint8_t frameid = 0; rect_t frame = {0}; - using CustomMenuItemClass::CustomMenuItemClass; - MenuItemClass(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); - MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); - void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); - void SetCaption(const char * const text = nullptr); + using CustomMenuItem::CustomMenuItem; + MenuItem(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); + MenuItem(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); + void setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); + void setCaption(const char * const text = nullptr); }; -class MenuItemPtrClass: public MenuItemClass { +class MenuItemPtr: public MenuItem { public: void *value = nullptr; - using MenuItemClass::MenuItemClass; - MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); - MenuItemPtrClass(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){} + using MenuItem::MenuItem; + MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); + MenuItemPtr(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtr(cicon, FTOP(text), ondraw, onclick, val){} }; -class MenuClass { +class Menu { public: int8_t topline = 0; int8_t selected = 0; - TitleClass MenuTitle; - MenuClass(); - virtual ~MenuClass(){}; + Title menuTitle; + Menu(); + virtual ~Menu(){}; inline int8_t line() { return selected - topline; }; inline int8_t line(uint8_t pos) {return pos - topline; }; int8_t count(); virtual void draw(); virtual void onScroll(bool dir); void onClick(); - CustomMenuItemClass* SelectedItem(); - static CustomMenuItemClass** Items(); + CustomMenuItem* selectedItem(); + static CustomMenuItem** items(); }; -extern MenuClass *CurrentMenu; -extern MenuClass *PreviousMenu; +extern Menu *currentMenu; +extern Menu *previousMenu; // Menuitem Drawing functions ================================================= -void Draw_Title(TitleClass* title); -void Draw_Menu_Cursor(const int8_t line); -void Erase_Menu_Cursor(const int8_t line); -void Erase_Menu_Text(const int8_t line); -void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false); -void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false); -void Draw_Chkb_Line(const uint8_t line, const bool checked); -void Show_Chkb_Line(const bool checked); -void Toggle_Chkb_Line(bool &checked); -void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0); -void onDrawMenuItem(MenuItemClass* menuitem, int8_t line); -void onDrawSubMenu(MenuItemClass* menuitem, int8_t line); -void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value); -void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line); -void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line); -void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line); -void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value); -void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp); -inline void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); }; -inline void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); }; -inline void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); }; -inline void onDrawPFloat4Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); }; -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked); -void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line); +void drawTitle(Title* aTitle); +void drawMenuCursor(const int8_t line); +void eraseMenuCursor(const int8_t line); +void eraseMenuText(const int8_t line); +void drawMenuLine(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false); +void drawMenuLine(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false); +void drawCheckboxLine(const uint8_t line, const bool checked); +void showCheckboxLine(const bool checked); +void toggleCheckboxLine(bool &checked); +void drawMenuIntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0); +void onDrawMenuItem(MenuItem* menuitem, int8_t line); +void onDrawSubMenu(MenuItem* menuitem, int8_t line); +void onDrawIntMenu(MenuItem* menuitem, int8_t line, int32_t value); +void onDrawPIntMenu(MenuItem* menuitem, int8_t line); +void onDrawPInt8Menu(MenuItem* menuitem, int8_t line); +void onDrawPInt32Menu(MenuItem* menuitem, int8_t line); +void onDrawFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp, const float value); +void onDrawPFloatMenu(MenuItem* menuitem, int8_t line, uint8_t dp); +inline void onDrawPFloatMenu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); }; +inline void onDrawPFloat2Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); }; +inline void onDrawPFloat3Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); }; +inline void onDrawPFloat4Menu(MenuItem* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); }; +void onDrawChkbMenu(MenuItem* menuitem, int8_t line, bool checked); +void onDrawChkbMenu(MenuItem* menuitem, int8_t line); // On click functions ========================================================= -void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); -void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)()=nullptr, void (*LiveUpdate)()=nullptr); +void setOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setPIntOnClick(const int32_t lo, const int32_t hi, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); +void setPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*apply)()=nullptr, void (*liveUpdate)()=nullptr); // HMI user control functions ================================================= -void HMI_Menu(); -void HMI_SetDraw(); -void HMI_SetNoDraw(); -void HMI_SetPInt(); -void HMI_SetPFloat(); +void hmiMenu(); +void hmiSetDraw(); +void hmiSetNoDraw(); +void hmiSetPInt(); +void hmiSetPFloat(); // Menu auxiliary functions =================================================== // Initialize menu -void InitMenu(); +void initMenu(); // Create a new menu -bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems); -bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems); +bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems); +bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems); // Reset top line and selected item -void ResetMenu(MenuClass* &menu); +void resetMenu(Menu* &menu); -// Invalidate CurrentMenu to prepare for full menu drawing -void InvalidateMenu(); +// Invalidate currentMenu to prepare for full menu drawing +void invalidateMenu(); //Update the Menu and Draw if it is valid -void UpdateMenu(MenuClass* &menu); +void updateMenu(Menu* &menu); //Redraw the current Menu if it is valid void ReDrawMenu(bool force=false); @@ -192,23 +192,23 @@ void ReDrawMenu(bool force=false); //Redraw selected menu item void ReDrawItem(); -// Clear MenuItems array and free MenuItems elements -void MenuItemsClear(); +// Clear menuItems array and free menuItems elements +void menuItemsClear(); -// Prepare MenuItems array -void MenuItemsPrepare(int8_t totalitems); +// Prepare menuItems array +void menuItemsPrepare(int8_t totalitems); // Is the current menu = menu? -bool IsMenu(MenuClass* menu); +bool isMenu(Menu* menu); -// Add elements to the MenuItems array -CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); -MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); -inline MenuItemClass* MenuItemAdd(uint8_t cicon, FSTR_P text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) { - return MenuItemAdd(cicon, FTOP(text), ondraw, onclick); +// Add elements to the menuItems array +CustomMenuItem* menuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); +MenuItem* menuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); +inline MenuItem* menuItemAdd(uint8_t cicon, FSTR_P text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) { + return menuItemAdd(cicon, FTOP(text), ondraw, onclick); } -MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); -MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); -inline MenuItemClass* EditItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) { - return EditItemAdd(cicon, FTOP(text), ondraw, onclick, val); +MenuItem* menuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr); +MenuItem* editItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val); +inline MenuItem* editItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) { + return editItemAdd(cicon, FTOP(text), ondraw, onclick, val); } diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 086795d943c5d..2781ccaa1df79 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -56,101 +56,101 @@ uint8_t rmax; // Maximum radius constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12); -MeshViewerClass MeshViewer; +MeshViewer meshViewer; -float MeshViewerClass::max, MeshViewerClass::min; +float MeshViewer::max, MeshViewer::min; -void MeshViewerClass::DrawMeshGrid(const uint8_t csizex, const uint8_t csizey) { +void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) { sizex = csizex; sizey = csizey; rmax = _MIN(margin - 2, 0.5 * (width) / (sizex - 1)); min = 100; max = -100; - DWINUI::ClearMainArea(); - dwinDrawRectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1)); - for (uint8_t x = 1; x < sizex - 1; ++x) dwinDrawVLine(HMI_data.SplitLine_Color, px(x), py(sizey - 1), width); - for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(HMI_data.SplitLine_Color, px(0), py(y), width); + DWINUI::clearMainArea(); + dwinDrawRectangle(0, hmiData.colorSplitLine, px(0), py(0), px(sizex - 1), py(sizey - 1)); + for (uint8_t x = 1; x < sizex - 1; ++x) dwinDrawVLine(hmiData.colorSplitLine, px(x), py(sizey - 1), width); + for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(hmiData.colorSplitLine, px(0), py(y), width); } -void MeshViewerClass::DrawMeshPoint(const uint8_t x, const uint8_t y, const float z) { +void MeshViewer::drawMeshPoint(const uint8_t x, const uint8_t y, const float z) { const uint8_t fs = DWINUI::fontWidth(meshfont); const int16_t v = isnan(z) ? 0 : round(z * 100); NOLESS(max, z); NOMORE(min, z); const uint16_t color = DWINUI::RainbowInt(v, zmin, zmax); - DWINUI::Draw_FillCircle(color, px(x), py(y), r(_MAX(_MIN(v,zmax),zmin))); + DWINUI::drawFillCircle(color, px(x), py(y), r(_MAX(_MIN(v,zmax),zmin))); TERN_(TJC_DISPLAY, delay(100)); if (sizex < (ENABLED(TJC_DISPLAY) ? 8 : 9)) { - if (v == 0) DWINUI::Draw_Float(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0); - else DWINUI::Draw_Signed_Float(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z); + if (v == 0) DWINUI::drawFloat(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0); + else DWINUI::drawSignedFloat(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z); } else { char str_1[9]; str_1[0] = '\0'; switch (v) { case -999 ... -100: - DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); + DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); break; case -99 ... -1: sprintf_P(str_1, PSTR("-.%02i"), -v); break; case 0: - dwinDrawString(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - fs, "0"); + dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 4, py(y) - fs, "0"); break; case 1 ... 99: sprintf_P(str_1, PSTR(".%02i"), v); break; case 100 ... 999: - DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z); + DWINUI::drawSignedFloat(meshfont, 1, 1, px(x) - 3 * fs, py(y) - fs, z); break; } if (str_1[0]) - dwinDrawString(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 2 * fs, py(y) - fs, str_1); + dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 2 * fs, py(y) - fs, str_1); } } -void MeshViewerClass::DrawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) { - DrawMeshGrid(csizex, csizey); +void MeshViewer::drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) { + drawMeshGrid(csizex, csizey); for (uint8_t y = 0; y < csizey; ++y) { hal.watchdog_refresh(); - for (uint8_t x = 0; x < csizex; ++x) DrawMeshPoint(x, y, zval[x][y]); + for (uint8_t x = 0; x < csizex; ++x) drawMeshPoint(x, y, zval[x][y]); } } -void MeshViewerClass::Draw(const bool withsave/*=false*/, const bool redraw/*=true*/) { - Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER)); +void MeshViewer::draw(const bool withsave/*=false*/, const bool redraw/*=true*/) { + title.showCaption(GET_TEXT_F(MSG_MESH_VIEWER)); #if ENABLED(USE_GRID_MESHVIEWER) - DWINUI::ClearMainArea(); + DWINUI::clearMainArea(); bedLevelTools.viewer_print_value = true; - bedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT); + bedLevelTools.drawBedMesh(-1, 1, 8, 10 + TITLE_HEIGHT); #else - if (redraw) DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); - else DWINUI::Draw_Box(1, HMI_data.Background_Color, { 89, 305, 99, 38 }); + if (redraw) drawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); + else DWINUI::drawBox(1, hmiData.colorBackground, { 89, 305, 99, 38 }); #endif if (withsave) { - DWINUI::Draw_Button(BTN_Save, 26, 305); - DWINUI::Draw_Button(BTN_Continue, 146, 305); - Draw_Select_Highlight(hmiFlag.select_flag, 305); + DWINUI::drawButton(BTN_Save, 26, 305); + DWINUI::drawButton(BTN_Continue, 146, 305); + drawSelectHighlight(hmiFlag.select_flag, 305); } else - DWINUI::Draw_Button(BTN_Continue, 86, 305); + DWINUI::drawButton(BTN_Continue, 86, 305); #if ENABLED(USE_GRID_MESHVIEWER) - bedLevelTools.Set_Mesh_Viewer_Status(); + bedLevelTools.setMeshViewerStatus(); #else char str_1[6], str_2[6] = ""; ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"), dtostrf(min, 1, 2, str_1), dtostrf(max, 1, 2, str_2)); #endif } -void Draw_MeshViewer() { MeshViewer.Draw(true, meshredraw); } +void drawMeshViewer() { meshViewer.draw(true, meshredraw); } -void onClick_MeshViewer() { if (hmiFlag.select_flag) SaveMesh(); HMI_ReturnScreen(); } +void onClick_MeshViewer() { if (hmiFlag.select_flag) saveMesh(); hmiReturnScreen(); } -void Goto_MeshViewer(const bool redraw) { +void gotoMeshViewer(const bool redraw) { meshredraw = redraw; - if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); - else HMI_ReturnScreen(); + if (leveling_is_valid()) gotoPopup(drawMeshViewer, onClick_MeshViewer); + else hmiReturnScreen(); } #endif // DWIN_LCD_PROUI && HAS_MESH diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.h b/Marlin/src/lcd/e3v2/proui/meshviewer.h index 1f45a834809b6..f73f1da86e1ca 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.h +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.h @@ -28,15 +28,15 @@ * Date: 2023/05/05 */ -class MeshViewerClass { +class MeshViewer { public: static float max, min; - static void DrawMeshGrid(const uint8_t csizex, const uint8_t csizey); - static void DrawMeshPoint(const uint8_t x, const uint8_t y, const float z); - static void Draw(const bool withsave=false, const bool redraw=true); - static void DrawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey); + static void drawMeshGrid(const uint8_t csizex, const uint8_t csizey); + static void drawMeshPoint(const uint8_t x, const uint8_t y, const float z); + static void draw(const bool withsave=false, const bool redraw=true); + static void drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey); }; -extern MeshViewerClass MeshViewer; +extern MeshViewer meshViewer; -void Goto_MeshViewer(const bool redraw); +void gotoMeshViewer(const bool redraw); diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp index 45341ae624631..95d8ec291d1b4 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.cpp +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -29,7 +29,7 @@ #include "../../../inc/MarlinConfig.h" -#if ALL(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH) +#if ALL(DWIN_LCD_PROUI, PROUI_TUNING_GRAPH) #include "dwin.h" #include "../../../core/types.h" @@ -44,32 +44,32 @@ uint16_t grphpoints, r, x2, y2 = 0; frame_rect_t grphframe = {0}; float scale = 0; -void PlotClass::Draw(const frame_rect_t &frame, const_float_t max, const_float_t ref/*=0*/) { +void PlotClass::draw(const frame_rect_t &frame, const_float_t max, const_float_t ref/*=0*/) { grphframe = frame; grphpoints = 0; scale = frame.h / max; x2 = frame.x + frame.w - 1; y2 = frame.y + frame.h - 1; r = round((y2) - ref * scale); - DWINUI::Draw_Box(1, Plot_Bg_Color, frame); - for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(Line_Color, i * 50 + frame.x, frame.y, frame.h); - DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); - dwinDrawHLine(Color_Red, frame.x, r, frame.w); + DWINUI::drawBox(1, Plot_Bg_Color, frame); + for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(COLOR_LINE, i * 50 + frame.x, frame.y, frame.h); + DWINUI::drawBox(0, COLOR_WHITE, DWINUI::extendFrame(frame, 1)); + dwinDrawHLine(COLOR_RED, frame.x, r, frame.w); } -void PlotClass::Update(const_float_t value) { +void PlotClass::update(const_float_t value) { if (!scale) return; const uint16_t y = round((y2) - value * scale); if (grphpoints < grphframe.w) { - dwinDrawPoint(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); + dwinDrawPoint(COLOR_YELLOW, 1, 1, grphpoints + grphframe.x, y); } else { dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); - if ((grphpoints % 50) == 0) dwinDrawVLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2); - dwinDrawPoint(Color_Red, 1, 1, x2 - 1, r); - dwinDrawPoint(Color_Yellow, 1, 1, x2 - 1, y); + if ((grphpoints % 50) == 0) dwinDrawVLine(COLOR_LINE, x2 - 1, grphframe.y + 1, grphframe.h - 2); + dwinDrawPoint(COLOR_RED, 1, 1, x2 - 1, r); + dwinDrawPoint(COLOR_YELLOW, 1, 1, x2 - 1, y); } grphpoints++; } -#endif // DWIN_LCD_PROUI && SHOW_TUNING_GRAPH +#endif // DWIN_LCD_PROUI && PROUI_TUNING_GRAPH diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h index 144ba0073b4d1..bc0e3a774ccd2 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.h +++ b/Marlin/src/lcd/e3v2/proui/plot.h @@ -32,8 +32,8 @@ class PlotClass { public: - static void Draw(const frame_rect_t &frame, const_float_t max, const_float_t ref=0); - static void Update(const_float_t value); + static void draw(const frame_rect_t &frame, const_float_t max, const_float_t ref=0); + static void update(const_float_t value); }; extern PlotClass plot; diff --git a/Marlin/src/lcd/e3v2/proui/printstats.cpp b/Marlin/src/lcd/e3v2/proui/printstats.cpp index 993b5b7b70f17..732e80542d16f 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.cpp +++ b/Marlin/src/lcd/e3v2/proui/printstats.cpp @@ -40,43 +40,43 @@ #include "dwin.h" #include "dwin_popup.h" -PrintStatsClass PrintStats; +PrintStats printStats; -void PrintStatsClass::Draw() { +void PrintStats::draw() { char str[30] = ""; constexpr int8_t MRG = 30; - Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU)); - DWINUI::ClearMainArea(); - Draw_Popup_Bkgd(); - DWINUI::Draw_Button(BTN_Continue, 86, 250); + title.showCaption(GET_TEXT_F(MSG_INFO_STATS_MENU)); + DWINUI::clearMainArea(); + drawPopupBkgd(); + DWINUI::drawButton(BTN_Continue, 86, 250); printStatistics ps = print_job_timer.getStats(); - DWINUI::Draw_String(MRG, 80, TS(GET_TEXT_F(MSG_INFO_PRINT_COUNT), F(": "), ps.totalPrints)); - DWINUI::Draw_String(MRG, 100, TS(GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), F(": "), ps.finishedPrints)); + DWINUI::drawString(MRG, 80, TS(GET_TEXT_F(MSG_INFO_PRINT_COUNT), F(": "), ps.totalPrints)); + DWINUI::drawString(MRG, 100, TS(GET_TEXT_F(MSG_INFO_COMPLETED_PRINTS), F(": "), ps.finishedPrints)); duration_t(print_job_timer.getStats().printTime).toDigital(str, true); - DWINUI::Draw_String(MRG, 120, MString<50>(GET_TEXT_F(MSG_INFO_PRINT_TIME), F(": "), str)); + DWINUI::drawString(MRG, 120, MString<50>(GET_TEXT_F(MSG_INFO_PRINT_TIME), F(": "), str)); duration_t(print_job_timer.getStats().longestPrint).toDigital(str, true); - DWINUI::Draw_String(MRG, 140, MString<50>(GET_TEXT(MSG_INFO_PRINT_LONGEST), F(": "), str)); - DWINUI::Draw_String(MRG, 160, TS(GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), F(": "), p_float_t(ps.filamentUsed / 1000, 2), F(" m"))); + DWINUI::drawString(MRG, 140, MString<50>(GET_TEXT(MSG_INFO_PRINT_LONGEST), F(": "), str)); + DWINUI::drawString(MRG, 160, TS(GET_TEXT_F(MSG_INFO_PRINT_FILAMENT), F(": "), p_float_t(ps.filamentUsed / 1000, 2), F(" m"))); } -void PrintStatsClass::Reset() { +void PrintStats::reset() { print_job_timer.initStats(); DONE_BUZZ(true); } -void Goto_PrintStats() { - PrintStats.Draw(); - HMI_SaveProcessID(WaitResponse); +void gotoPrintStats() { + printStats.draw(); + hmiSaveProcessID(ID_WaitResponse); } // Print Stats Reset popup -void Popup_ResetStats() { DWIN_Popup_ConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); } -void OnClick_ResetStats() { - if (hmiFlag.select_flag) PrintStatsClass::Reset(); - HMI_ReturnScreen(); +void popupResetStats() { dwinPopupConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); } +void onClickResetStats() { + if (hmiFlag.select_flag) printStats.reset(); + hmiReturnScreen(); } -void PrintStatsReset() { Goto_Popup(Popup_ResetStats, OnClick_ResetStats); } +void printStatsReset() { gotoPopup(popupResetStats, onClickResetStats); } #endif // DWIN_LCD_PROUI && PRINTCOUNTER diff --git a/Marlin/src/lcd/e3v2/proui/printstats.h b/Marlin/src/lcd/e3v2/proui/printstats.h index aadb3e8dceed0..133e9eb96e17b 100644 --- a/Marlin/src/lcd/e3v2/proui/printstats.h +++ b/Marlin/src/lcd/e3v2/proui/printstats.h @@ -28,13 +28,13 @@ * Date: 2022/12/03 */ -class PrintStatsClass { +class PrintStats { public: - static void Draw(); - static void Reset(); + static void draw(); + static void reset(); }; -extern PrintStatsClass PrintStats; +extern PrintStats printStats; -void Goto_PrintStats(); -void PrintStatsReset(); +void gotoPrintStats(); +void printStatsReset(); diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 8517e2ec2324d..f8fde21777383 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1600,7 +1600,7 @@ void MarlinUI::host_status() { TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message)); - TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage()); + TERN_(DWIN_LCD_PROUI, dwinCheckStatusMessage()); TERN_(DWIN_CREALITY_LCD_JYERSUI, jyersDWIN.updateStatus(status_message)); } diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 1e6d02d2a7c89..9d5da849e5a94 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -413,7 +413,7 @@ void restore_feedrate_and_scaling(); #if HAS_Z_AXIS #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #define Z_POST_CLEARANCE HMI_data.z_after_homing + #define Z_POST_CLEARANCE hmiData.z_after_homing #elif defined(Z_AFTER_HOMING) #define Z_POST_CLEARANCE Z_AFTER_HOMING #else diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index e426e3bb4bdd5..b3872146d136d 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -377,7 +377,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str)); - TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR))); + TERN_(DWIN_LCD_PROUI, dwinPopupConfirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); ui.reset_status(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 7ef6970141994..479b43c4bd7d5 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1610,7 +1610,7 @@ void MarlinSettings::postprocess() { { _FIELD_TEST(dwin_data); char dwin_data[eeprom_data_size] = { 0 }; - DWIN_CopySettingsTo(dwin_data); + dwinCopySettingsTo(dwin_data); EEPROM_WRITE(dwin_data); } #endif @@ -2675,7 +2675,7 @@ void MarlinSettings::postprocess() { const char dwin_data[eeprom_data_size] = { 0 }; _FIELD_TEST(dwin_data); EEPROM_READ(dwin_data); - if (!validating) DWIN_CopySettingsFrom(dwin_data); + if (!validating) dwinCopySettingsFrom(dwin_data); } #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) { @@ -3022,7 +3022,7 @@ void MarlinSettings::postprocess() { #endif #if ENABLED(DWIN_LCD_PROUI) - status = !bedLevelTools.meshvalidate(); + status = !bedLevelTools.meshValidate(); if (status) { bedlevel.invalidate(); LCD_MESSAGE(MSG_UBL_MESH_INVALID); @@ -3559,7 +3559,7 @@ void MarlinSettings::reset() { // // Ender-3 V2 with ProUI // - TERN_(DWIN_LCD_PROUI, DWIN_SetDataDefaults()); + TERN_(DWIN_LCD_PROUI, dwinSetDataDefaults()); // // Model predictive control diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 5d48b20ee8e86..6133b6e39b08c 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2639,7 +2639,7 @@ hal_timer_t Stepper::block_phase_isr() { oversampling_factor = 0; // Assume no axis smoothing (via oversampling) // Decide if axis smoothing is possible uint32_t max_rate = current_block->nominal_rate; // Get the step event rate - if (TERN1(DWIN_LCD_PROUI, HMI_data.AdaptiveStepSmoothing)) { + if (TERN1(DWIN_LCD_PROUI, hmiData.adaptiveStepSmoothing)) { while (max_rate < MIN_STEP_ISR_FREQUENCY) { // As long as more ISRs are possible... max_rate <<= 1; // Try to double the rate if (max_rate < MIN_STEP_ISR_FREQUENCY) // Don't exceed the estimated ISR limit diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index c38d4968c9caf..e209d6f83519f 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -723,12 +723,12 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } @@ -820,7 +820,7 @@ volatile bool Temperature::raw_temps_ready = false; if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; } @@ -857,7 +857,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); @@ -910,7 +910,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(AUTOTUNE_DONE)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE)); goto EXIT_M303; } @@ -928,7 +928,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(DWIN_PID_TUNE, DWIN_PidTuning(AUTOTUNE_DONE)); + TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE)); EXIT_M303: TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); @@ -1147,7 +1147,7 @@ volatile bool Temperature::raw_temps_ready = false; // Ensure we don't drift too far from the window between the last sampled temp and the target temperature if (!WITHIN(current_temp, get_sample_3_temp() - 15.0f, hotend.target + 15.0f)) { SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_TEMP_ERROR)); + TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_TEMP_ERROR)); wait_for_heatup = false; return FAILED; } @@ -1187,7 +1187,7 @@ volatile bool Temperature::raw_temps_ready = false; if (!wait_for_heatup) { SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED)); + TERN_(DWIN_LCD_PROUI, dwinMPCTuning(MPC_INTERRUPTED)); return MeasurementState::CANCELLED; } @@ -1215,7 +1215,7 @@ volatile bool Temperature::raw_temps_ready = false; // Determine ambient temperature. SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT); #if ENABLED(DWIN_LCD_PROUI) - DWIN_MPCTuning(MPCTEMP_START); + dwinMPCTuning(MPCTEMP_START); LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT); #else LCD_MESSAGE(MSG_COOLING); @@ -1305,7 +1305,7 @@ volatile bool Temperature::raw_temps_ready = false; } SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); - TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(AUTOTUNE_DONE)); + TERN_(DWIN_LCD_PROUI, dwinMPCTuning(AUTOTUNE_DONE)); SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity); SERIAL_ECHOLNPGM("MPC_SENSOR_RESPONSIVENESS ", p_float_t(mpc.sensor_responsiveness, 4));