Browse Source

Neaten up temperature member data

Scott Lahteine 8 years ago
parent
commit
cdd77d23bb
2 changed files with 54 additions and 56 deletions
  1. 26
    27
      Marlin/temperature.cpp
  2. 28
    29
      Marlin/temperature.h

+ 26
- 27
Marlin/temperature.cpp View File

50
 
50
 
51
 // public:
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
 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
60
 #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
62
   float Temperature::redundant_temperature = 0.0;
61
   float Temperature::redundant_temperature = 0.0;
121
 volatile bool Temperature::temp_meas_ready = false;
120
 volatile bool Temperature::temp_meas_ready = false;
122
 
121
 
123
 #if ENABLED(PIDTEMP)
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
   #if ENABLED(PID_ADD_EXTRUSION_RATE)
129
   #if ENABLED(PID_ADD_EXTRUSION_RATE)
131
     float Temperature::cTerm[HOTENDS];
130
     float Temperature::cTerm[HOTENDS];
134
     int Temperature::lpq_ptr = 0;
133
     int Temperature::lpq_ptr = 0;
135
   #endif
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
   bool Temperature::pid_reset[HOTENDS];
139
   bool Temperature::pid_reset[HOTENDS];
141
 #endif
140
 #endif
142
 
141
 
143
 #if ENABLED(PIDTEMPBED)
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
 #else
151
 #else
153
   millis_t Temperature::next_bed_check_ms;
152
   millis_t Temperature::next_bed_check_ms;
154
 #endif
153
 #endif
157
 unsigned long Temperature::raw_temp_bed_value = 0;
156
 unsigned long Temperature::raw_temp_bed_value = 0;
158
 
157
 
159
 // Init min and max temp with extreme values to prevent false errors during startup
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
 #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
164
 #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
166
   int Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 };
165
   int Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 };

+ 28
- 29
Marlin/temperature.h View File

52
 
52
 
53
   public:
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
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
62
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
64
       static float redundant_temperature;
63
       static float redundant_temperature;
143
     static volatile bool temp_meas_ready;
142
     static volatile bool temp_meas_ready;
144
 
143
 
145
     #if ENABLED(PIDTEMP)
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
       #if ENABLED(PID_ADD_EXTRUSION_RATE)
151
       #if ENABLED(PID_ADD_EXTRUSION_RATE)
153
         static float cTerm[HOTENDS];
152
         static float cTerm[HOTENDS];
156
         static int lpq_ptr;
155
         static int lpq_ptr;
157
       #endif
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
       static bool pid_reset[HOTENDS];
161
       static bool pid_reset[HOTENDS];
163
     #endif
162
     #endif
164
 
163
 
165
     #if ENABLED(PIDTEMPBED)
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
     #else
173
     #else
175
       static millis_t next_bed_check_ms;
174
       static millis_t next_bed_check_ms;
176
     #endif
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
     // Init min and max temp with extreme values to prevent false errors during startup
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
     #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
186
     #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
188
       static int consecutive_low_temperature_error[HOTENDS];
187
       static int consecutive_low_temperature_error[HOTENDS];

Loading…
Cancel
Save