diff --git a/Marlin/src/feature/hotend_idle.cpp b/Marlin/src/feature/hotend_idle.cpp index 050898e3b5..eb16781fdd 100644 --- a/Marlin/src/feature/hotend_idle.cpp +++ b/Marlin/src/feature/hotend_idle.cpp @@ -40,7 +40,7 @@ HotendIdleProtection hotend_idle; millis_t HotendIdleProtection::next_protect_ms = 0; -hotend_idle_settings_t HotendIdleProtection::cfg; // Initialized by settings.load() +hotend_idle_settings_t HotendIdleProtection::cfg; // Initialized by settings.load void HotendIdleProtection::check_hotends(const millis_t &ms) { const bool busy = (TERN0(HAS_RESUME_CONTINUE, wait_for_user) || planner.has_blocks_queued()); diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index b7dcf00385..6c35de7cb5 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -35,10 +35,10 @@ #include "../lcd/extui/ui_api.h" #endif -bool PrintJobRecovery::enabled; // Initialized by settings.load() +bool PrintJobRecovery::enabled; // Initialized by settings.load #if HAS_PLR_BED_THRESHOLD - celsius_t PrintJobRecovery::bed_temp_threshold; // Initialized by settings.load() + celsius_t PrintJobRecovery::bed_temp_threshold; // Initialized by settings.load #endif MediaFile PrintJobRecovery::file; diff --git a/Marlin/src/feature/x_twist.cpp b/Marlin/src/feature/x_twist.cpp index b8f7e52ab6..2b7924707e 100644 --- a/Marlin/src/feature/x_twist.cpp +++ b/Marlin/src/feature/x_twist.cpp @@ -30,7 +30,7 @@ XATC xatc; bool XATC::enabled; float XATC::spacing, XATC::start; -xatc_array_t XATC::z_offset; // Initialized by settings.load() +xatc_array_t XATC::z_offset; // Initialized by settings.load void XATC::reset() { constexpr float xzo[] = XATC_Z_OFFSETS; diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp index 8e2b1bb8e4..6429ac07e5 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp @@ -59,9 +59,9 @@ float Z_distance = 0.1; // // Persistent settings // -xy_int_t mks_corner_offsets[5]; // Initialized by settings.load() -xyz_int_t mks_park_pos; // Initialized by settings.load() -celsius_t mks_min_extrusion_temp; // Initialized by settings.load() +xy_int_t mks_corner_offsets[5]; // Initialized by settings.load +xyz_int_t mks_park_pos; // Initialized by settings.load +celsius_t mks_min_extrusion_temp; // Initialized by settings.load void MKS_reset_settings() { constexpr xy_int_t init_dgus_level_offsets[5] = { diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 4af271951d..edaff3b845 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -52,7 +52,7 @@ #endif bool DGUSAutoTurnOff = false; -MKS_Language mks_language_index; // Initialized by settings.load() +MKS_Language mks_language_index; // Initialized by settings.load #if 0 void DGUSScreenHandlerMKS::sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) { diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index b8e11b5b4d..6b9bed4e3d 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -93,7 +93,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif #if HAS_MULTI_LANGUAGE - uint8_t MarlinUI::language; // Initialized by settings.load() + uint8_t MarlinUI::language; // Initialized by settings.load void MarlinUI::set_language(const uint8_t lang) { if (lang < NUM_LANGUAGES) { language = lang; @@ -105,7 +105,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif #if HAS_LCD_CONTRAST - uint8_t MarlinUI::contrast = LCD_CONTRAST_DEFAULT; // Initialized by settings.load() + uint8_t MarlinUI::contrast = LCD_CONTRAST_DEFAULT; // Initialized by settings.load void MarlinUI::set_contrast(const uint8_t value) { contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX); _set_contrast(); @@ -138,7 +138,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if HAS_PREHEAT #include "../module/temperature.h" - preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() + preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load FSTR_P MarlinUI::get_preheat_label(const uint8_t m) { #define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL); @@ -189,7 +189,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if HAS_BACKLIGHT_TIMEOUT #if ENABLED(EDITABLE_DISPLAY_TIMEOUT) - uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load() + uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load #else constexpr uint8_t MarlinUI::backlight_timeout_minutes; #endif @@ -209,7 +209,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #elif HAS_DISPLAY_SLEEP #if ENABLED(EDITABLE_DISPLAY_TIMEOUT) - uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load() + uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load #else constexpr uint8_t MarlinUI::sleep_timeout_minutes; #endif diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 96484442fe..88c3260800 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -232,7 +232,7 @@ public: #endif #if ENABLED(SOUND_MENU_ITEM) - static bool sound_on; // Initialized by settings.load() + static bool sound_on; // Initialized by settings.load #else static constexpr bool sound_on = true; #endif diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 25a315524e..96e6f6d073 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -167,65 +167,72 @@ void MenuEditItemBase::goto_edit_screen( * General function to go directly to a screen */ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { - if (currentScreen != screen) { + if (currentScreen == screen) return; - wake_display(); + wake_display(); - thermalManager.set_menu_cold_override(false); + thermalManager.set_menu_cold_override(false); - TERN_(IS_DWIN_MARLINUI, did_first_redraw = false); + TERN_(IS_DWIN_MARLINUI, did_first_redraw = false); - TERN_(HAS_TOUCH_BUTTONS, repeat_delay = BUTTON_DELAY_MENU); + TERN_(HAS_TOUCH_BUTTONS, repeat_delay = BUTTON_DELAY_MENU); - TERN_(SET_PROGRESS_PERCENT, progress_reset()); + TERN_(SET_PROGRESS_PERCENT, progress_reset()); - #if ALL(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING) - static millis_t doubleclick_expire_ms = 0; - // Going to menu_main from status screen? Remember first click time. - // Going back to status screen within a very short time? Go to Z babystepping. - if (screen == menu_main) { - if (on_status_screen()) - doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; - } - else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) { - if (BABYSTEP_ALLOWED()) - screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z); - else { - #if ENABLED(MOVE_Z_WHEN_IDLE) - ui.manual_move.menu_scale = MOVE_Z_IDLE_MULTIPLICATOR; - screen = []{ lcd_move_axis(Z_AXIS); }; - #endif - } - } - #endif - - currentScreen = screen; - encoderPosition = encoder; - encoderTopLine = top; - screen_items = items; - if (on_status_screen()) { - defer_status_screen(false); - clear_menu_history(); - TERN_(AUTO_BED_LEVELING_UBL, bedlevel.lcd_map_control = false); + /** + * Double-click on the status screen is a shortcut for one of these: + * - Babystep the Probe Z Offset + * - Babystep the Z axis + * - Move the Z axis + */ + #if ALL(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING) + static millis_t doubleclick_expire_ms = 0; + if (screen == menu_main) { + if (on_status_screen()) + doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; } + else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) { + if (BABYSTEP_ALLOWED()) + screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z); + else { + #if ENABLED(MOVE_Z_WHEN_IDLE) + ui.manual_move.menu_scale = MOVE_Z_IDLE_MULTIPLICATOR; + screen = []{ lcd_move_axis(Z_AXIS); }; + #endif + } + } + #endif - clear_for_drawing(); + // + // Go to the new screen + // - // Re-initialize custom characters that may be re-used - #if HAS_MARLINUI_HD44780 - if (TERN1(AUTO_BED_LEVELING_UBL, !bedlevel.lcd_map_control)) - set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); - #endif - - refresh(LCDVIEW_CALL_REDRAW_NEXT); - screen_changed = true; - TERN_(HAS_MARLINUI_U8GLIB, drawing_screen = false); - - TERN_(HAS_MARLINUI_MENU, encoder_direction_normal()); - enable_encoder_multiplier(false); - - set_selection(false); + currentScreen = screen; + encoderPosition = encoder; + encoderTopLine = top; + screen_items = items; + if (on_status_screen()) { + defer_status_screen(false); + clear_menu_history(); + TERN_(AUTO_BED_LEVELING_UBL, bedlevel.lcd_map_control = false); } + + clear_for_drawing(); + + // Re-initialize custom characters that may be re-used + #if HAS_MARLINUI_HD44780 + if (TERN1(AUTO_BED_LEVELING_UBL, !bedlevel.lcd_map_control)) + set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); + #endif + + refresh(LCDVIEW_CALL_REDRAW_NEXT); + screen_changed = true; + TERN_(HAS_MARLINUI_U8GLIB, drawing_screen = false); + + TERN_(HAS_MARLINUI_MENU, encoder_direction_normal()); + enable_encoder_multiplier(false); + + set_selection(false); } //////////////////////////////////////////// diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 379ef985ab..aa1bcebe70 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -49,7 +49,7 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../core/debug_out.h" -// Initialized by settings.load() +// Initialized by settings.load float delta_height; abc_float_t delta_endstop_adj{0}; float delta_radius, diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 999e07ea74..85e021d661 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -65,7 +65,7 @@ Endstops endstops; // private: -bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load() +bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load volatile Endstops::endstop_mask_t Endstops::hit_state; Endstops::endstop_mask_t Endstops::live_state = 0; @@ -95,7 +95,7 @@ Endstops::endstop_mask_t Endstops::live_state = 0; volatile bool Endstops::calibration_stop_state; #endif -// Initialized by settings.load() +// Initialized by settings.load #if ENABLED(X_DUAL_ENDSTOPS) float Endstops::x2_endstop_adj; #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 10be020680..174f16d5c5 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -124,7 +124,7 @@ xyze_pos_t destination; // {0} // Extruder offsets #if HAS_HOTEND_OFFSET - xyz_pos_t hotend_offset[HOTENDS]; // Initialized by settings.load() + xyz_pos_t hotend_offset[HOTENDS]; // Initialized by settings.load void reset_hotend_offsets() { constexpr float tmp[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z }; static_assert( diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 7c746fa5f0..42b4c8060b 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -138,7 +138,7 @@ uint8_t Planner::delay_before_delivering; // Delay block delivery so initi constexpr float PlannerSettings::axis_steps_per_mm[DISTINCT_AXES]; constexpr float Planner::mm_per_step[DISTINCT_AXES]; #endif -planner_settings_t Planner::settings; // Initialized by settings.load() +planner_settings_t Planner::settings; // Initialized by settings.load /** * Set up inline block variables @@ -199,7 +199,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) D matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level #endif #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - float Planner::z_fade_height, // Initialized by settings.load() + float Planner::z_fade_height, // Initialized by settings.load Planner::inverse_z_fade_height, Planner::last_fade_z; #endif @@ -208,7 +208,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) D #endif #if ENABLED(SKEW_CORRECTION) - skew_factor_t Planner::skew_factor; // Initialized by settings.load() + skew_factor_t Planner::skew_factor; // Initialized by settings.load #endif #if ENABLED(AUTOTEMP) @@ -235,7 +235,7 @@ float Planner::previous_nominal_speed; #endif #if ENABLED(LIN_ADVANCE) - float Planner::extruder_advance_K[DISTINCT_E]; // Initialized by settings.load() + float Planner::extruder_advance_K[DISTINCT_E]; // Initialized by settings.load #endif #if HAS_POSITION_FLOAT diff --git a/Marlin/src/module/polargraph.cpp b/Marlin/src/module/polargraph.cpp index ef6a4c0db4..534ec17ef8 100644 --- a/Marlin/src/module/polargraph.cpp +++ b/Marlin/src/module/polargraph.cpp @@ -37,7 +37,7 @@ #include "../lcd/marlinui.h" #include "../MarlinCore.h" -// Initialized by settings.load() +// Initialized by settings.load float segments_per_second, polargraph_max_belt_len; xy_pos_t draw_area_min, draw_area_max; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 7c7bf3debd..a66c11a782 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -103,7 +103,7 @@ Probe probe; -xyz_pos_t Probe::offset; // Initialized by settings.load() +xyz_pos_t Probe::offset; // Initialized by settings.load #if HAS_PROBE_XY_OFFSET const xy_pos_t &Probe::offset_xy = Probe::offset; diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 81e1d0404e..d7851e9c67 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -160,7 +160,7 @@ Stepper stepper; // Singleton #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM bool Stepper::initialized; // = false - uint32_t Stepper::motor_current_setting[MOTOR_CURRENT_COUNT]; // Initialized by settings.load() + uint32_t Stepper::motor_current_setting[MOTOR_CURRENT_COUNT]; // Initialized by settings.load #if HAS_MOTOR_CURRENT_SPI constexpr uint32_t Stepper::digipot_count[]; #endif @@ -212,7 +212,7 @@ uint32_t Stepper::acceleration_time, Stepper::deceleration_time; #if ENABLED(ADAPTIVE_STEP_SMOOTHING) #if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) - bool Stepper::adaptive_step_smoothing_enabled; // Initialized by settings.load() + bool Stepper::adaptive_step_smoothing_enabled; // Initialized by settings.load #else constexpr bool Stepper::adaptive_step_smoothing_enabled; // = true #endif diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index c678b9dca3..306b2151b5 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -324,7 +324,7 @@ class Stepper { #define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count) #endif static bool initialized; - static uint32_t motor_current_setting[MOTOR_CURRENT_COUNT]; // Initialized by settings.load() + static uint32_t motor_current_setting[MOTOR_CURRENT_COUNT]; // Initialized by settings.load #endif // Last-moved extruder, as set when the last movement was fetched from planner diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index cbb3498f55..c6df105aa8 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2317,7 +2317,7 @@ void Temperature::task() { #if HAS_USER_THERMISTORS - user_thermistor_t Temperature::user_thermistor[USER_THERMISTORS]; // Initialized by settings.load() + user_thermistor_t Temperature::user_thermistor[USER_THERMISTORS]; // Initialized by settings.load void Temperature::reset_user_thermistors() { user_thermistor_t default_user_thermistor[USER_THERMISTORS] = { diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 0d5984b0f4..ffc86eb4e5 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -445,7 +445,7 @@ typedef struct HeaterInfo : public TempInfo { // A heater with PID stabilization template struct PIDHeaterInfo : public HeaterInfo { - T pid; // Initialized by settings.load() + T pid; // Initialized by settings.load }; #if ENABLED(MPCTEMP) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index b6f02713b3..12aca3fff6 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -37,7 +37,7 @@ //#define DEBUG_TOOLCHANGE_FILAMENT_SWAP #if HAS_MULTI_EXTRUDER - toolchange_settings_t toolchange_settings; // Initialized by settings.load() + toolchange_settings_t toolchange_settings; // Initialized by settings.load #endif #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)