Browse Source

Fans loop macro

Scott Lahteine 6 years ago
parent
commit
95d154a91f

+ 2
- 1
Marlin/src/Marlin.h View File

210
     extern bool fans_paused;
210
     extern bool fans_paused;
211
     extern uint8_t paused_fan_speed[FAN_COUNT];
211
     extern uint8_t paused_fan_speed[FAN_COUNT];
212
   #endif
212
   #endif
213
+  #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT)
213
 #endif
214
 #endif
214
 
215
 
215
 inline void zero_fan_speeds() {
216
 inline void zero_fan_speeds() {
216
   #if FAN_COUNT > 0
217
   #if FAN_COUNT > 0
217
-    LOOP_L_N(i, FAN_COUNT) fan_speed[i] = 0;
218
+    FANS_LOOP(i) fan_speed[i] = 0;
218
   #endif
219
   #endif
219
 }
220
 }
220
 
221
 

+ 1
- 1
Marlin/src/feature/power.cpp View File

39
 
39
 
40
 bool Power::is_power_needed() {
40
 bool Power::is_power_needed() {
41
   #if ENABLED(AUTO_POWER_FANS)
41
   #if ENABLED(AUTO_POWER_FANS)
42
-    for (uint8_t i = 0; i < FAN_COUNT; i++) if (fan_speed[i]) return true;
42
+    FANS_LOOP(i) if (fan_speed[i]) return true;
43
   #endif
43
   #endif
44
 
44
 
45
   #if ENABLED(AUTO_POWER_E_FANS)
45
   #if ENABLED(AUTO_POWER_E_FANS)

+ 1
- 1
Marlin/src/feature/power_loss_recovery.cpp View File

277
   }
277
   }
278
 
278
 
279
   // Restore print cooling fan speeds
279
   // Restore print cooling fan speeds
280
-  for (uint8_t i = 0; i < FAN_COUNT; i++) {
280
+  FANS_LOOP(i) {
281
     uint8_t f = info.fan_speed[i];
281
     uint8_t f = info.fan_speed[i];
282
     if (f) {
282
     if (f) {
283
       sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);
283
       sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);

+ 3
- 3
Marlin/src/module/planner.cpp View File

1181
   if (has_blocks_queued()) {
1181
   if (has_blocks_queued()) {
1182
 
1182
 
1183
     #if FAN_COUNT > 0
1183
     #if FAN_COUNT > 0
1184
-      for (uint8_t i = 0; i < FAN_COUNT; i++)
1184
+      FANS_LOOP(i)
1185
         tail_fan_speed[i] = block_buffer[block_buffer_tail].fan_speed[i];
1185
         tail_fan_speed[i] = block_buffer[block_buffer_tail].fan_speed[i];
1186
     #endif
1186
     #endif
1187
 
1187
 
1204
   }
1204
   }
1205
   else {
1205
   else {
1206
     #if FAN_COUNT > 0
1206
     #if FAN_COUNT > 0
1207
-      for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fan_speed[i];
1207
+      FANS_LOOP(i) tail_fan_speed[i] = fan_speed[i];
1208
     #endif
1208
     #endif
1209
 
1209
 
1210
     #if ENABLED(BARICUDA)
1210
     #if ENABLED(BARICUDA)
1751
   #endif
1751
   #endif
1752
 
1752
 
1753
   #if FAN_COUNT > 0
1753
   #if FAN_COUNT > 0
1754
-    for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fan_speed[i];
1754
+    FANS_LOOP(i) block->fan_speed[i] = fan_speed[i];
1755
   #endif
1755
   #endif
1756
 
1756
 
1757
   #if ENABLED(BARICUDA)
1757
   #if ENABLED(BARICUDA)

Loading…
Cancel
Save