1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

🎨 Outdent, adjust comments

This commit is contained in:
Scott Lahteine 2024-10-13 22:05:35 -05:00
parent a6493e0cc8
commit 3482e9632c
19 changed files with 86 additions and 79 deletions

View File

@ -40,7 +40,7 @@
HotendIdleProtection hotend_idle; HotendIdleProtection hotend_idle;
millis_t HotendIdleProtection::next_protect_ms = 0; 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) { void HotendIdleProtection::check_hotends(const millis_t &ms) {
const bool busy = (TERN0(HAS_RESUME_CONTINUE, wait_for_user) || planner.has_blocks_queued()); const bool busy = (TERN0(HAS_RESUME_CONTINUE, wait_for_user) || planner.has_blocks_queued());

View File

@ -35,10 +35,10 @@
#include "../lcd/extui/ui_api.h" #include "../lcd/extui/ui_api.h"
#endif #endif
bool PrintJobRecovery::enabled; // Initialized by settings.load() bool PrintJobRecovery::enabled; // Initialized by settings.load
#if HAS_PLR_BED_THRESHOLD #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 #endif
MediaFile PrintJobRecovery::file; MediaFile PrintJobRecovery::file;

View File

@ -30,7 +30,7 @@ XATC xatc;
bool XATC::enabled; bool XATC::enabled;
float XATC::spacing, XATC::start; 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() { void XATC::reset() {
constexpr float xzo[] = XATC_Z_OFFSETS; constexpr float xzo[] = XATC_Z_OFFSETS;

View File

@ -59,9 +59,9 @@ float Z_distance = 0.1;
// //
// Persistent settings // Persistent settings
// //
xy_int_t mks_corner_offsets[5]; // 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() xyz_int_t mks_park_pos; // Initialized by settings.load
celsius_t mks_min_extrusion_temp; // Initialized by settings.load() celsius_t mks_min_extrusion_temp; // Initialized by settings.load
void MKS_reset_settings() { void MKS_reset_settings() {
constexpr xy_int_t init_dgus_level_offsets[5] = { constexpr xy_int_t init_dgus_level_offsets[5] = {

View File

@ -52,7 +52,7 @@
#endif #endif
bool DGUSAutoTurnOff = false; bool DGUSAutoTurnOff = false;
MKS_Language mks_language_index; // Initialized by settings.load() MKS_Language mks_language_index; // Initialized by settings.load
#if 0 #if 0
void DGUSScreenHandlerMKS::sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) { void DGUSScreenHandlerMKS::sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) {

View File

@ -93,7 +93,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif #endif
#if HAS_MULTI_LANGUAGE #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) { void MarlinUI::set_language(const uint8_t lang) {
if (lang < NUM_LANGUAGES) { if (lang < NUM_LANGUAGES) {
language = lang; language = lang;
@ -105,7 +105,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#endif #endif
#if HAS_LCD_CONTRAST #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) { void MarlinUI::set_contrast(const uint8_t value) {
contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX); contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
_set_contrast(); _set_contrast();
@ -138,7 +138,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if HAS_PREHEAT #if HAS_PREHEAT
#include "../module/temperature.h" #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) { FSTR_P MarlinUI::get_preheat_label(const uint8_t m) {
#define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL); #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 HAS_BACKLIGHT_TIMEOUT
#if ENABLED(EDITABLE_DISPLAY_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 #else
constexpr uint8_t MarlinUI::backlight_timeout_minutes; constexpr uint8_t MarlinUI::backlight_timeout_minutes;
#endif #endif
@ -209,7 +209,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#elif HAS_DISPLAY_SLEEP #elif HAS_DISPLAY_SLEEP
#if ENABLED(EDITABLE_DISPLAY_TIMEOUT) #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 #else
constexpr uint8_t MarlinUI::sleep_timeout_minutes; constexpr uint8_t MarlinUI::sleep_timeout_minutes;
#endif #endif

View File

@ -232,7 +232,7 @@ public:
#endif #endif
#if ENABLED(SOUND_MENU_ITEM) #if ENABLED(SOUND_MENU_ITEM)
static bool sound_on; // Initialized by settings.load() static bool sound_on; // Initialized by settings.load
#else #else
static constexpr bool sound_on = true; static constexpr bool sound_on = true;
#endif #endif

View File

@ -167,65 +167,72 @@ void MenuEditItemBase::goto_edit_screen(
* General function to go directly to a 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*/) { 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; * Double-click on the status screen is a shortcut for one of these:
// Going to menu_main from status screen? Remember first click time. * - Babystep the Probe Z Offset
// Going back to status screen within a very short time? Go to Z babystepping. * - Babystep the Z axis
if (screen == menu_main) { * - Move the Z axis
if (on_status_screen()) */
doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; #if ALL(DOUBLECLICK_FOR_Z_BABYSTEPPING, BABYSTEPPING)
} static millis_t doubleclick_expire_ms = 0;
else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) { if (screen == menu_main) {
if (BABYSTEP_ALLOWED()) if (on_status_screen())
screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z); doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
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);
} }
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 currentScreen = screen;
#if HAS_MARLINUI_HD44780 encoderPosition = encoder;
if (TERN1(AUTO_BED_LEVELING_UBL, !bedlevel.lcd_map_control)) encoderTopLine = top;
set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU); screen_items = items;
#endif if (on_status_screen()) {
defer_status_screen(false);
refresh(LCDVIEW_CALL_REDRAW_NEXT); clear_menu_history();
screen_changed = true; TERN_(AUTO_BED_LEVELING_UBL, bedlevel.lcd_map_control = false);
TERN_(HAS_MARLINUI_U8GLIB, drawing_screen = false);
TERN_(HAS_MARLINUI_MENU, encoder_direction_normal());
enable_encoder_multiplier(false);
set_selection(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);
} }
//////////////////////////////////////////// ////////////////////////////////////////////

View File

@ -49,7 +49,7 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h" #include "../core/debug_out.h"
// Initialized by settings.load() // Initialized by settings.load
float delta_height; float delta_height;
abc_float_t delta_endstop_adj{0}; abc_float_t delta_endstop_adj{0};
float delta_radius, float delta_radius,

View File

@ -65,7 +65,7 @@ Endstops endstops;
// private: // 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; volatile Endstops::endstop_mask_t Endstops::hit_state;
Endstops::endstop_mask_t Endstops::live_state = 0; 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; volatile bool Endstops::calibration_stop_state;
#endif #endif
// Initialized by settings.load() // Initialized by settings.load
#if ENABLED(X_DUAL_ENDSTOPS) #if ENABLED(X_DUAL_ENDSTOPS)
float Endstops::x2_endstop_adj; float Endstops::x2_endstop_adj;
#endif #endif

View File

@ -124,7 +124,7 @@ xyze_pos_t destination; // {0}
// Extruder offsets // Extruder offsets
#if HAS_HOTEND_OFFSET #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() { void reset_hotend_offsets() {
constexpr float tmp[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z }; constexpr float tmp[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z };
static_assert( static_assert(

View File

@ -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 PlannerSettings::axis_steps_per_mm[DISTINCT_AXES];
constexpr float Planner::mm_per_step[DISTINCT_AXES]; constexpr float Planner::mm_per_step[DISTINCT_AXES];
#endif #endif
planner_settings_t Planner::settings; // Initialized by settings.load() planner_settings_t Planner::settings; // Initialized by settings.load
/** /**
* Set up inline block variables * 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 matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
#endif #endif
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #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::inverse_z_fade_height,
Planner::last_fade_z; Planner::last_fade_z;
#endif #endif
@ -208,7 +208,7 @@ uint32_t Planner::max_acceleration_steps_per_s2[DISTINCT_AXES]; // (steps/s^2) D
#endif #endif
#if ENABLED(SKEW_CORRECTION) #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 #endif
#if ENABLED(AUTOTEMP) #if ENABLED(AUTOTEMP)
@ -235,7 +235,7 @@ float Planner::previous_nominal_speed;
#endif #endif
#if ENABLED(LIN_ADVANCE) #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 #endif
#if HAS_POSITION_FLOAT #if HAS_POSITION_FLOAT

View File

@ -37,7 +37,7 @@
#include "../lcd/marlinui.h" #include "../lcd/marlinui.h"
#include "../MarlinCore.h" #include "../MarlinCore.h"
// Initialized by settings.load() // Initialized by settings.load
float segments_per_second, polargraph_max_belt_len; float segments_per_second, polargraph_max_belt_len;
xy_pos_t draw_area_min, draw_area_max; xy_pos_t draw_area_min, draw_area_max;

View File

@ -103,7 +103,7 @@
Probe probe; 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 #if HAS_PROBE_XY_OFFSET
const xy_pos_t &Probe::offset_xy = Probe::offset; const xy_pos_t &Probe::offset_xy = Probe::offset;

View File

@ -160,7 +160,7 @@ Stepper stepper; // Singleton
#if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM #if HAS_MOTOR_CURRENT_SPI || HAS_MOTOR_CURRENT_PWM
bool Stepper::initialized; // = false 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 #if HAS_MOTOR_CURRENT_SPI
constexpr uint32_t Stepper::digipot_count[]; constexpr uint32_t Stepper::digipot_count[];
#endif #endif
@ -212,7 +212,7 @@ uint32_t Stepper::acceleration_time, Stepper::deceleration_time;
#if ENABLED(ADAPTIVE_STEP_SMOOTHING) #if ENABLED(ADAPTIVE_STEP_SMOOTHING)
#if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE) #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 #else
constexpr bool Stepper::adaptive_step_smoothing_enabled; // = true constexpr bool Stepper::adaptive_step_smoothing_enabled; // = true
#endif #endif

View File

@ -324,7 +324,7 @@ class Stepper {
#define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count) #define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)
#endif #endif
static bool initialized; 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 #endif
// Last-moved extruder, as set when the last movement was fetched from planner // Last-moved extruder, as set when the last movement was fetched from planner

View File

@ -2317,7 +2317,7 @@ void Temperature::task() {
#if HAS_USER_THERMISTORS #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() { void Temperature::reset_user_thermistors() {
user_thermistor_t default_user_thermistor[USER_THERMISTORS] = { user_thermistor_t default_user_thermistor[USER_THERMISTORS] = {

View File

@ -445,7 +445,7 @@ typedef struct HeaterInfo : public TempInfo {
// A heater with PID stabilization // A heater with PID stabilization
template<typename T> template<typename T>
struct PIDHeaterInfo : public HeaterInfo { struct PIDHeaterInfo : public HeaterInfo {
T pid; // Initialized by settings.load() T pid; // Initialized by settings.load
}; };
#if ENABLED(MPCTEMP) #if ENABLED(MPCTEMP)

View File

@ -37,7 +37,7 @@
//#define DEBUG_TOOLCHANGE_FILAMENT_SWAP //#define DEBUG_TOOLCHANGE_FILAMENT_SWAP
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
toolchange_settings_t toolchange_settings; // Initialized by settings.load() toolchange_settings_t toolchange_settings; // Initialized by settings.load
#endif #endif
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE) #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)