From b0173ccdb9022877388e34aea08eae48cb8e240c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 18 Jul 2017 03:17:50 -0500 Subject: [PATCH] Drop extra initializers for vars initialized by EEPROM code --- Marlin/Marlin_main.cpp | 27 +++++++-------------------- Marlin/endstops.cpp | 9 +-------- Marlin/planner.cpp | 8 +++++--- Marlin/stepper.cpp | 2 +- Marlin/temperature.cpp | 18 +++++++----------- Marlin/ultralcd.cpp | 1 + Marlin/ultralcd_impl_DOGM.h | 2 +- 7 files changed, 23 insertions(+), 44 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c9f2583cc..75eb63e3a 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -427,16 +427,10 @@ static float saved_feedrate_mm_s; int16_t feedrate_percentage = 100, saved_feedrate_percentage, flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); +// Initialized by settings.load() bool axis_relative_modes[] = AXIS_RELATIVE_MODES, - volumetric_enabled = - #if ENABLED(VOLUMETRIC_DEFAULT_ON) - true - #else - false - #endif - ; -float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA), - volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0); + volumetric_enabled; +float filament_size[EXTRUDERS], volumetric_multiplier[EXTRUDERS]; #if HAS_WORKSPACE_OFFSET #if HAS_POSITION_SHIFT @@ -513,7 +507,7 @@ static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL static uint8_t target_extruder; #if HAS_BED_PROBE - float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER; + float zprobe_zoffset; // Initialized by settings.load() #endif #if HAS_ABL @@ -542,18 +536,12 @@ static uint8_t target_extruder; #endif #if ENABLED(Z_DUAL_ENDSTOPS) - float z_endstop_adj = - #ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT - Z_DUAL_ENDSTOPS_ADJUSTMENT - #else - 0 - #endif - ; + float z_endstop_adj; #endif // Extruder offsets #if HOTENDS > 1 - float hotend_offset[XYZ][HOTENDS]; + float hotend_offset[XYZ][HOTENDS]; // Initialized by settings.load() #endif #if HAS_Z_SERVO_ENDSTOP @@ -596,8 +584,7 @@ static uint8_t target_extruder; float delta[ABC], endstop_adj[ABC] = { 0 }; - // These values are loaded or reset at boot time when setup() calls - // settings.load(), which calls recalc_delta_settings(). + // Initialized by settings.load() float delta_radius, delta_tower_angle_trim[2], delta_tower[ABC][2], diff --git a/Marlin/endstops.cpp b/Marlin/endstops.cpp index 1d98ec9d4..32541b675 100644 --- a/Marlin/endstops.cpp +++ b/Marlin/endstops.cpp @@ -38,14 +38,7 @@ Endstops endstops; // public: -bool Endstops::enabled = true, - Endstops::enabled_globally = - #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT) - (true) - #else - (false) - #endif - ; +bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load() volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value #if ENABLED(Z_DUAL_ENDSTOPS) diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index c84ce9bae..349e8affd 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -95,6 +95,8 @@ uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N], Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software millis_t Planner::min_segment_time; + +// Initialized by settings.load() float Planner::min_feedrate_mm_s, Planner::acceleration, // Normal acceleration mm/s^2 DEFAULT ACCELERATION for all printing moves. M204 SXXXX Planner::retract_acceleration, // Retract acceleration mm/s^2 filament pull-back and push-forward while standing still in the other axes M204 TXXXX @@ -111,7 +113,7 @@ float Planner::min_feedrate_mm_s, #endif #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - float Planner::z_fade_height, + float Planner::z_fade_height, // Initialized by settings.load() Planner::inverse_z_fade_height; #endif @@ -143,8 +145,8 @@ float Planner::previous_speed[NUM_AXIS], #endif #if ENABLED(LIN_ADVANCE) - float Planner::extruder_advance_k = LIN_ADVANCE_K, - Planner::advance_ed_ratio = LIN_ADVANCE_E_D_RATIO, + float Planner::extruder_advance_k, // Initialized by settings.load() + Planner::advance_ed_ratio, // Initialized by settings.load() Planner::position_float[NUM_AXIS] = { 0 }; #endif diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 9493cedf1..600bc3925 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -77,7 +77,7 @@ block_t* Stepper::current_block = NULL; // A pointer to the block currently bei #endif #if HAS_MOTOR_CURRENT_PWM - uint32_t Stepper::motor_current_setting[3] = PWM_MOTOR_CURRENT; + uint32_t Stepper::motor_current_setting[3]; // Initialized by settings.load() #endif // private: diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index deaa79ce8..bf757cef6 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -73,28 +73,24 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, int16_t Temperature::target_temperature_bed = 0; #endif +// Initialized by settings.load() #if ENABLED(PIDTEMP) #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 - float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp), - Temperature::Ki[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Ki) * (PID_dT)), - Temperature::Kd[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Kd) / (PID_dT)); + float Temperature::Kp[HOTENDS], Temperature::Ki[HOTENDS], Temperature::Kd[HOTENDS]; #if ENABLED(PID_EXTRUSION_SCALING) - float Temperature::Kc[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kc); + float Temperature::Kc[HOTENDS]; #endif #else - float Temperature::Kp = DEFAULT_Kp, - Temperature::Ki = (DEFAULT_Ki) * (PID_dT), - Temperature::Kd = (DEFAULT_Kd) / (PID_dT); + float Temperature::Kp, Temperature::Ki, Temperature::Kd; #if ENABLED(PID_EXTRUSION_SCALING) - float Temperature::Kc = DEFAULT_Kc; + float Temperature::Kc; #endif #endif #endif +// Initialized by settings.load() #if ENABLED(PIDTEMPBED) - float Temperature::bedKp = DEFAULT_bedKp, - Temperature::bedKi = ((DEFAULT_bedKi) * PID_dT), - Temperature::bedKd = ((DEFAULT_bedKd) / PID_dT); + float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd; #endif #if ENABLED(BABYSTEPPING) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index d32dd6044..2acfd3d33 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -49,6 +49,7 @@ bool ubl_lcd_map_control = false; #endif +// Initialized by settings.load() int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2]; #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index 991183c2d..3cbced445 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -202,7 +202,7 @@ #include "utf_mapper.h" -uint16_t lcd_contrast; +uint16_t lcd_contrast; // Initialized by settings.load() static char currentfont = 0; // The current graphical page being rendered