浏览代码

Drop extra initializers for vars initialized by EEPROM code

Scott Lahteine 8 年前
父节点
当前提交
b0173ccdb9
共有 7 个文件被更改,包括 23 次插入44 次删除
  1. 7
    20
      Marlin/Marlin_main.cpp
  2. 1
    8
      Marlin/endstops.cpp
  3. 5
    3
      Marlin/planner.cpp
  4. 1
    1
      Marlin/stepper.cpp
  5. 7
    11
      Marlin/temperature.cpp
  6. 1
    0
      Marlin/ultralcd.cpp
  7. 1
    1
      Marlin/ultralcd_impl_DOGM.h

+ 7
- 20
Marlin/Marlin_main.cpp 查看文件

@@ -427,16 +427,10 @@ static float saved_feedrate_mm_s;
427 427
 int16_t feedrate_percentage = 100, saved_feedrate_percentage,
428 428
     flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100);
429 429
 
430
+// Initialized by settings.load()
430 431
 bool axis_relative_modes[] = AXIS_RELATIVE_MODES,
431
-     volumetric_enabled =
432
-        #if ENABLED(VOLUMETRIC_DEFAULT_ON)
433
-          true
434
-        #else
435
-          false
436
-        #endif
437
-      ;
438
-float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA),
439
-      volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
432
+     volumetric_enabled;
433
+float filament_size[EXTRUDERS], volumetric_multiplier[EXTRUDERS];
440 434
 
441 435
 #if HAS_WORKSPACE_OFFSET
442 436
   #if HAS_POSITION_SHIFT
@@ -513,7 +507,7 @@ static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL
513 507
 static uint8_t target_extruder;
514 508
 
515 509
 #if HAS_BED_PROBE
516
-  float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
510
+  float zprobe_zoffset; // Initialized by settings.load()
517 511
 #endif
518 512
 
519 513
 #if HAS_ABL
@@ -542,18 +536,12 @@ static uint8_t target_extruder;
542 536
 #endif
543 537
 
544 538
 #if ENABLED(Z_DUAL_ENDSTOPS)
545
-  float z_endstop_adj =
546
-    #ifdef Z_DUAL_ENDSTOPS_ADJUSTMENT
547
-      Z_DUAL_ENDSTOPS_ADJUSTMENT
548
-    #else
549
-      0
550
-    #endif
551
-  ;
539
+  float z_endstop_adj;
552 540
 #endif
553 541
 
554 542
 // Extruder offsets
555 543
 #if HOTENDS > 1
556
-  float hotend_offset[XYZ][HOTENDS];
544
+  float hotend_offset[XYZ][HOTENDS]; // Initialized by settings.load()
557 545
 #endif
558 546
 
559 547
 #if HAS_Z_SERVO_ENDSTOP
@@ -596,8 +584,7 @@ static uint8_t target_extruder;
596 584
   float delta[ABC],
597 585
         endstop_adj[ABC] = { 0 };
598 586
 
599
-  // These values are loaded or reset at boot time when setup() calls
600
-  // settings.load(), which calls recalc_delta_settings().
587
+  // Initialized by settings.load()
601 588
   float delta_radius,
602 589
         delta_tower_angle_trim[2],
603 590
         delta_tower[ABC][2],

+ 1
- 8
Marlin/endstops.cpp 查看文件

@@ -38,14 +38,7 @@ Endstops endstops;
38 38
 
39 39
 // public:
40 40
 
41
-bool  Endstops::enabled = true,
42
-      Endstops::enabled_globally =
43
-        #if ENABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
44
-          (true)
45
-        #else
46
-          (false)
47
-        #endif
48
-      ;
41
+bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load()
49 42
 volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
50 43
 
51 44
 #if ENABLED(Z_DUAL_ENDSTOPS)

+ 5
- 3
Marlin/planner.cpp 查看文件

@@ -95,6 +95,8 @@ uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
95 95
          Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
96 96
 
97 97
 millis_t Planner::min_segment_time;
98
+
99
+// Initialized by settings.load()
98 100
 float Planner::min_feedrate_mm_s,
99 101
       Planner::acceleration,         // Normal acceleration mm/s^2  DEFAULT ACCELERATION for all printing moves. M204 SXXXX
100 102
       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,
111 113
 #endif
112 114
 
113 115
 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
114
-  float Planner::z_fade_height,
116
+  float Planner::z_fade_height, // Initialized by settings.load()
115 117
         Planner::inverse_z_fade_height;
116 118
 #endif
117 119
 
@@ -143,8 +145,8 @@ float Planner::previous_speed[NUM_AXIS],
143 145
 #endif
144 146
 
145 147
 #if ENABLED(LIN_ADVANCE)
146
-  float Planner::extruder_advance_k = LIN_ADVANCE_K,
147
-        Planner::advance_ed_ratio = LIN_ADVANCE_E_D_RATIO,
148
+  float Planner::extruder_advance_k, // Initialized by settings.load()
149
+        Planner::advance_ed_ratio,   // Initialized by settings.load()
148 150
         Planner::position_float[NUM_AXIS] = { 0 };
149 151
 #endif
150 152
 

+ 1
- 1
Marlin/stepper.cpp 查看文件

@@ -77,7 +77,7 @@ block_t* Stepper::current_block = NULL;  // A pointer to the block currently bei
77 77
 #endif
78 78
 
79 79
 #if HAS_MOTOR_CURRENT_PWM
80
-  uint32_t Stepper::motor_current_setting[3] = PWM_MOTOR_CURRENT;
80
+  uint32_t Stepper::motor_current_setting[3]; // Initialized by settings.load()
81 81
 #endif
82 82
 
83 83
 // private:

+ 7
- 11
Marlin/temperature.cpp 查看文件

@@ -73,28 +73,24 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
73 73
   int16_t Temperature::target_temperature_bed = 0;
74 74
 #endif
75 75
 
76
+// Initialized by settings.load()
76 77
 #if ENABLED(PIDTEMP)
77 78
   #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
78
-    float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
79
-          Temperature::Ki[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Ki) * (PID_dT)),
80
-          Temperature::Kd[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Kd) / (PID_dT));
79
+    float Temperature::Kp[HOTENDS], Temperature::Ki[HOTENDS], Temperature::Kd[HOTENDS];
81 80
     #if ENABLED(PID_EXTRUSION_SCALING)
82
-      float Temperature::Kc[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kc);
81
+      float Temperature::Kc[HOTENDS];
83 82
     #endif
84 83
   #else
85
-    float Temperature::Kp = DEFAULT_Kp,
86
-          Temperature::Ki = (DEFAULT_Ki) * (PID_dT),
87
-          Temperature::Kd = (DEFAULT_Kd) / (PID_dT);
84
+    float Temperature::Kp, Temperature::Ki, Temperature::Kd;
88 85
     #if ENABLED(PID_EXTRUSION_SCALING)
89
-      float Temperature::Kc = DEFAULT_Kc;
86
+      float Temperature::Kc;
90 87
     #endif
91 88
   #endif
92 89
 #endif
93 90
 
91
+// Initialized by settings.load()
94 92
 #if ENABLED(PIDTEMPBED)
95
-  float Temperature::bedKp = DEFAULT_bedKp,
96
-        Temperature::bedKi = ((DEFAULT_bedKi) * PID_dT),
97
-        Temperature::bedKd = ((DEFAULT_bedKd) / PID_dT);
93
+  float Temperature::bedKp, Temperature::bedKi, Temperature::bedKd;
98 94
 #endif
99 95
 
100 96
 #if ENABLED(BABYSTEPPING)

+ 1
- 0
Marlin/ultralcd.cpp 查看文件

@@ -49,6 +49,7 @@
49 49
   bool ubl_lcd_map_control = false;
50 50
 #endif
51 51
 
52
+// Initialized by settings.load()
52 53
 int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
53 54
 
54 55
 #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)

+ 1
- 1
Marlin/ultralcd_impl_DOGM.h 查看文件

@@ -202,7 +202,7 @@
202 202
 
203 203
 #include "utf_mapper.h"
204 204
 
205
-uint16_t lcd_contrast;
205
+uint16_t lcd_contrast; // Initialized by settings.load()
206 206
 static char currentfont = 0;
207 207
 
208 208
 // The current graphical page being rendered

正在加载...
取消
保存