Browse Source

Be consistent in setting of the fan PWM.

Always set the FAN PWM value in check_axes_activity() and always use
the value of the active move if a move is active.
Kevin O'Connor 12 years ago
parent
commit
3f2f94ef28
2 changed files with 2 additions and 28 deletions
  1. 2
    22
      Marlin/planner.cpp
  2. 0
    6
      Marlin/ultralcd.cpp

+ 2
- 22
Marlin/planner.cpp View File

@@ -438,8 +438,7 @@ void check_axes_activity()
438 438
   unsigned char y_active = 0;  
439 439
   unsigned char z_active = 0;
440 440
   unsigned char e_active = 0;
441
-  unsigned char fan_speed = 0;
442
-  unsigned char tail_fan_speed = 0;
441
+  unsigned char tail_fan_speed = fanSpeed;
443 442
   block_t *block;
444 443
 
445 444
   if(block_buffer_tail != block_buffer_head)
@@ -453,20 +452,9 @@ void check_axes_activity()
453 452
       if(block->steps_y != 0) y_active++;
454 453
       if(block->steps_z != 0) z_active++;
455 454
       if(block->steps_e != 0) e_active++;
456
-      if(block->fan_speed != 0) fan_speed++;
457 455
       block_index = (block_index+1) & (BLOCK_BUFFER_SIZE - 1);
458 456
     }
459 457
   }
460
-  else
461
-  {
462
-    #if FAN_PIN > -1
463
-    #ifndef FAN_SOFT_PWM
464
-    if (fanSpeed != 0){
465
-      analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
466
-    }
467
-    #endif
468
-	#endif
469
-  }
470 458
   if((DISABLE_X) && (x_active == 0)) disable_x();
471 459
   if((DISABLE_Y) && (y_active == 0)) disable_y();
472 460
   if((DISABLE_Z) && (z_active == 0)) disable_z();
@@ -478,15 +466,7 @@ void check_axes_activity()
478 466
   }
479 467
 #if FAN_PIN > -1
480 468
   #ifndef FAN_SOFT_PWM
481
-  if((fanSpeed == 0) && (fan_speed ==0))
482
-  {
483
-    analogWrite(FAN_PIN, 0);
484
-  }
485
-
486
-  if (fanSpeed != 0 && tail_fan_speed !=0)
487
-  {
488
-    analogWrite(FAN_PIN,tail_fan_speed);
489
-  }
469
+  analogWrite(FAN_PIN,tail_fan_speed);
490 470
   #endif
491 471
 #endif
492 472
 #ifdef AUTOTEMP

+ 0
- 6
Marlin/ultralcd.cpp View File

@@ -221,10 +221,7 @@ void lcd_preheat_pla()
221 221
     setTargetHotend1(plaPreheatHotendTemp);
222 222
     setTargetHotend2(plaPreheatHotendTemp);
223 223
     setTargetBed(plaPreheatHPBTemp);
224
-#if FAN_PIN > -1
225 224
     fanSpeed = plaPreheatFanSpeed;
226
-    analogWrite(FAN_PIN,  fanSpeed);
227
-#endif
228 225
     lcd_return_to_status();
229 226
 }
230 227
 
@@ -234,10 +231,7 @@ void lcd_preheat_abs()
234 231
     setTargetHotend1(absPreheatHotendTemp);
235 232
     setTargetHotend2(absPreheatHotendTemp);
236 233
     setTargetBed(absPreheatHPBTemp);
237
-#if FAN_PIN > -1
238 234
     fanSpeed = absPreheatFanSpeed;
239
-    analogWrite(FAN_PIN,  fanSpeed);
240
-#endif
241 235
     lcd_return_to_status();
242 236
 }
243 237
 

Loading…
Cancel
Save