|
@@ -254,6 +254,11 @@ int getHeaterPower(int heater) {
|
254
|
254
|
|
255
|
255
|
void manage_heater()
|
256
|
256
|
{
|
|
257
|
+#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
258
|
+ static int bed_needs_heating=0;
|
|
259
|
+ static int bed_is_on=0;
|
|
260
|
+#endif
|
|
261
|
+
|
257
|
262
|
#ifdef USE_WATCHDOG
|
258
|
263
|
wd_reset();
|
259
|
264
|
#endif
|
|
@@ -333,12 +338,26 @@ void manage_heater()
|
333
|
338
|
}
|
334
|
339
|
#endif
|
335
|
340
|
|
|
341
|
+#ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
342
|
+ if (bed_needs_heating){
|
|
343
|
+ if (bed_is_on==0)
|
|
344
|
+ WRITE(HEATER_BED_PIN,HIGH);
|
|
345
|
+ if (bed_is_on==1)
|
|
346
|
+ WRITE(HEATER_BED_PIN,LOW);
|
|
347
|
+ bed_is_on=(bed_is_on+1) % HEATER_BED_DUTY_CYCLE_DIVIDER;
|
|
348
|
+ }
|
|
349
|
+#endif
|
|
350
|
+
|
336
|
351
|
if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
|
337
|
352
|
return;
|
338
|
353
|
previous_millis_bed_heater = millis();
|
339
|
354
|
|
340
|
355
|
#if TEMP_BED_PIN > -1
|
341
|
356
|
|
|
357
|
+ #ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
358
|
+ bed_needs_heating=0;
|
|
359
|
+ #endif
|
|
360
|
+
|
342
|
361
|
#ifndef BED_LIMIT_SWITCHING
|
343
|
362
|
// Check if temperature is within the correct range
|
344
|
363
|
if((current_raw_bed > bed_minttemp) && (current_raw_bed < bed_maxttemp)) {
|
|
@@ -348,6 +367,9 @@ void manage_heater()
|
348
|
367
|
}
|
349
|
368
|
else
|
350
|
369
|
{
|
|
370
|
+ #ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
371
|
+ bed_needs_heating=1;
|
|
372
|
+ #endif
|
351
|
373
|
WRITE(HEATER_BED_PIN,HIGH);
|
352
|
374
|
}
|
353
|
375
|
}
|
|
@@ -364,6 +386,9 @@ void manage_heater()
|
364
|
386
|
else
|
365
|
387
|
if(current_raw_bed <= target_bed_low_temp)
|
366
|
388
|
{
|
|
389
|
+ #ifdef HEATER_BED_DUTY_CYCLE_DIVIDER
|
|
390
|
+ bed_needs_heating=1;
|
|
391
|
+ #endif
|
367
|
392
|
WRITE(HEATER_BED_PIN,HIGH);
|
368
|
393
|
}
|
369
|
394
|
}
|