Skip to content

Commit

Permalink
🎨 Outdent, adjust comments
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 14, 2024
1 parent a6493e0 commit 3482e96
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/hotend_idle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/x_twist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class MarlinUI {
#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
Expand Down
99 changes: 53 additions & 46 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
/**
* 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

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);
}
#endif

clear_for_drawing();
//
// Go to the new screen
//

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
// 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);
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);
TERN_(HAS_MARLINUI_MENU, encoder_direction_normal());
enable_encoder_multiplier(false);

set_selection(false);
}
set_selection(false);
}

////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/polargraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ typedef struct HeaterInfo : public TempInfo {
// A heater with PID stabilization
template<typename T>
struct PIDHeaterInfo : public HeaterInfo {
T pid; // Initialized by settings.load()
T pid; // Initialized by settings.load
};

#if ENABLED(MPCTEMP)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/tool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3482e96

Please sign in to comment.