Selaa lähdekoodia

Neaten up temperature member data

Scott Lahteine 8 vuotta sitten
vanhempi
commit
cdd77d23bb
2 muutettua tiedostoa jossa 54 lisäystä ja 56 poistoa
  1. 26
    27
      Marlin/temperature.cpp
  2. 28
    29
      Marlin/temperature.h

+ 26
- 27
Marlin/temperature.cpp Näytä tiedosto

@@ -50,13 +50,12 @@ Temperature thermalManager;
50 50
 
51 51
 // public:
52 52
 
53
-int Temperature::current_temperature_raw[HOTENDS] = { 0 };
54
-float Temperature::current_temperature[HOTENDS] = { 0.0 };
55
-int Temperature::target_temperature[HOTENDS] = { 0 };
56
-
57
-int Temperature::current_temperature_bed_raw = 0;
58
-float Temperature::current_temperature_bed = 0.0;
59
-int Temperature::target_temperature_bed = 0;
53
+float Temperature::current_temperature[HOTENDS] = { 0.0 },
54
+      Temperature::current_temperature_bed = 0.0;
55
+int   Temperature::current_temperature_raw[HOTENDS] = { 0 },
56
+      Temperature::target_temperature[HOTENDS] = { 0 },
57
+      Temperature::current_temperature_bed_raw = 0,
58
+      Temperature::target_temperature_bed = 0;
60 59
 
61 60
 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
62 61
   float Temperature::redundant_temperature = 0.0;
@@ -121,11 +120,11 @@ unsigned char Temperature::soft_pwm_bed;
121 120
 volatile bool Temperature::temp_meas_ready = false;
122 121
 
123 122
 #if ENABLED(PIDTEMP)
124
-  float Temperature::temp_iState[HOTENDS] = { 0 };
125
-  float Temperature::temp_dState[HOTENDS] = { 0 };
126
-  float Temperature::pTerm[HOTENDS];
127
-  float Temperature::iTerm[HOTENDS];
128
-  float Temperature::dTerm[HOTENDS];
123
+  float Temperature::temp_iState[HOTENDS] = { 0 },
124
+        Temperature::temp_dState[HOTENDS] = { 0 },
125
+        Temperature::pTerm[HOTENDS],
126
+        Temperature::iTerm[HOTENDS],
127
+        Temperature::dTerm[HOTENDS];
129 128
 
130 129
   #if ENABLED(PID_ADD_EXTRUSION_RATE)
131 130
     float Temperature::cTerm[HOTENDS];
@@ -134,21 +133,21 @@ volatile bool Temperature::temp_meas_ready = false;
134 133
     int Temperature::lpq_ptr = 0;
135 134
   #endif
136 135
 
137
-  float Temperature::pid_error[HOTENDS];
138
-  float Temperature::temp_iState_min[HOTENDS];
139
-  float Temperature::temp_iState_max[HOTENDS];
136
+  float Temperature::pid_error[HOTENDS],
137
+        Temperature::temp_iState_min[HOTENDS],
138
+        Temperature::temp_iState_max[HOTENDS];
140 139
   bool Temperature::pid_reset[HOTENDS];
141 140
 #endif
142 141
 
143 142
 #if ENABLED(PIDTEMPBED)
144
-  float Temperature::temp_iState_bed = { 0 };
145
-  float Temperature::temp_dState_bed = { 0 };
146
-  float Temperature::pTerm_bed;
147
-  float Temperature::iTerm_bed;
148
-  float Temperature::dTerm_bed;
149
-  float Temperature::pid_error_bed;
150
-  float Temperature::temp_iState_min_bed;
151
-  float Temperature::temp_iState_max_bed;
143
+  float Temperature::temp_iState_bed = { 0 },
144
+        Temperature::temp_dState_bed = { 0 },
145
+        Temperature::pTerm_bed,
146
+        Temperature::iTerm_bed,
147
+        Temperature::dTerm_bed,
148
+        Temperature::pid_error_bed,
149
+        Temperature::temp_iState_min_bed,
150
+        Temperature::temp_iState_max_bed;
152 151
 #else
153 152
   millis_t Temperature::next_bed_check_ms;
154 153
 #endif
@@ -157,10 +156,10 @@ unsigned long Temperature::raw_temp_value[4] = { 0 };
157 156
 unsigned long Temperature::raw_temp_bed_value = 0;
158 157
 
159 158
 // Init min and max temp with extreme values to prevent false errors during startup
160
-int Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP);
161
-int Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP);
162
-int Temperature::minttemp[HOTENDS] = { 0 };
163
-int Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);
159
+int Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP),
160
+    Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP),
161
+    Temperature::minttemp[HOTENDS] = { 0 },
162
+    Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);
164 163
 
165 164
 #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
166 165
   int Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 };

+ 28
- 29
Marlin/temperature.h Näytä tiedosto

@@ -52,13 +52,12 @@ class Temperature {
52 52
 
53 53
   public:
54 54
 
55
-    static int current_temperature_raw[HOTENDS];
56
-    static float current_temperature[HOTENDS];
57
-    static int target_temperature[HOTENDS];
58
-
59
-    static int current_temperature_bed_raw;
60
-    static float current_temperature_bed;
61
-    static int target_temperature_bed;
55
+    static float current_temperature[HOTENDS],
56
+                 current_temperature_bed;
57
+    static int   current_temperature_raw[HOTENDS],
58
+                 target_temperature[HOTENDS],
59
+                 current_temperature_bed_raw,
60
+                 target_temperature_bed;
62 61
 
63 62
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
64 63
       static float redundant_temperature;
@@ -143,11 +142,11 @@ class Temperature {
143 142
     static volatile bool temp_meas_ready;
144 143
 
145 144
     #if ENABLED(PIDTEMP)
146
-      static float temp_iState[HOTENDS];
147
-      static float temp_dState[HOTENDS];
148
-      static float pTerm[HOTENDS];
149
-      static float iTerm[HOTENDS];
150
-      static float dTerm[HOTENDS];
145
+      static float temp_iState[HOTENDS],
146
+                   temp_dState[HOTENDS],
147
+                   pTerm[HOTENDS],
148
+                   iTerm[HOTENDS],
149
+                   dTerm[HOTENDS];
151 150
 
152 151
       #if ENABLED(PID_ADD_EXTRUSION_RATE)
153 152
         static float cTerm[HOTENDS];
@@ -156,33 +155,33 @@ class Temperature {
156 155
         static int lpq_ptr;
157 156
       #endif
158 157
 
159
-      static float pid_error[HOTENDS];
160
-      static float temp_iState_min[HOTENDS];
161
-      static float temp_iState_max[HOTENDS];
158
+      static float pid_error[HOTENDS],
159
+                   temp_iState_min[HOTENDS],
160
+                   temp_iState_max[HOTENDS];
162 161
       static bool pid_reset[HOTENDS];
163 162
     #endif
164 163
 
165 164
     #if ENABLED(PIDTEMPBED)
166
-      static float temp_iState_bed;
167
-      static float temp_dState_bed;
168
-      static float pTerm_bed;
169
-      static float iTerm_bed;
170
-      static float dTerm_bed;
171
-      static float pid_error_bed;
172
-      static float temp_iState_min_bed;
173
-      static float temp_iState_max_bed;
165
+      static float temp_iState_bed,
166
+                   temp_dState_bed,
167
+                   pTerm_bed,
168
+                   iTerm_bed,
169
+                   dTerm_bed,
170
+                   pid_error_bed,
171
+                   temp_iState_min_bed,
172
+                   temp_iState_max_bed;
174 173
     #else
175 174
       static millis_t next_bed_check_ms;
176 175
     #endif
177 176
 
178
-    static unsigned long raw_temp_value[4];
179
-    static unsigned long raw_temp_bed_value;
177
+    static unsigned long raw_temp_value[4],
178
+                         raw_temp_bed_value;
180 179
 
181 180
     // Init min and max temp with extreme values to prevent false errors during startup
182
-    static int minttemp_raw[HOTENDS];
183
-    static int maxttemp_raw[HOTENDS];
184
-    static int minttemp[HOTENDS];
185
-    static int maxttemp[HOTENDS];
181
+    static int minttemp_raw[HOTENDS],
182
+               maxttemp_raw[HOTENDS],
183
+               minttemp[HOTENDS],
184
+               maxttemp[HOTENDS];
186 185
 
187 186
     #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
188 187
       static int consecutive_low_temperature_error[HOTENDS];

Loading…
Peruuta
Tallenna