|
|
|
@ -74,12 +74,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
|
|
|
|
|
float Temperature::redundant_temperature = 0.0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
uint8_t Temperature::soft_pwm_bed;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FAN_SOFT_PWM)
|
|
|
|
|
uint8_t Temperature::fanSpeedSoftPwm[FAN_COUNT];
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PIDTEMP)
|
|
|
|
|
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
|
|
|
|
|
float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
|
|
|
|
@ -194,10 +188,12 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE
|
|
|
|
|
millis_t Temperature::next_auto_fan_check_ms = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
uint8_t Temperature::soft_pwm[HOTENDS];
|
|
|
|
|
uint8_t Temperature::soft_pwm_amount[HOTENDS],
|
|
|
|
|
Temperature::soft_pwm_amount_bed;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FAN_SOFT_PWM)
|
|
|
|
|
uint8_t Temperature::soft_pwm_fan[FAN_COUNT];
|
|
|
|
|
uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT],
|
|
|
|
|
Temperature::soft_pwm_count_fan[FAN_COUNT];
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
|
|
|
@ -206,7 +202,7 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PROBING_HEATERS_OFF)
|
|
|
|
|
bool Temperature::paused;
|
|
|
|
|
int16_t Temperature::paused_hotend_temps[HOTENDS];
|
|
|
|
|
int16_t Temperature::paused_hotend_temp[HOTENDS];
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
|
int16_t Temperature::paused_bed_temp;
|
|
|
|
|
#endif
|
|
|
|
@ -254,13 +250,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|
|
|
|
|
|
|
|
|
#if HAS_PID_FOR_BOTH
|
|
|
|
|
if (hotend < 0)
|
|
|
|
|
soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
|
|
|
|
|
soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
|
|
|
|
|
else
|
|
|
|
|
soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
|
|
|
|
|
soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
|
|
|
|
|
#elif ENABLED(PIDTEMP)
|
|
|
|
|
soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
|
|
|
|
|
soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
|
|
|
|
|
#else
|
|
|
|
|
soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
|
|
|
|
|
soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
wait_for_heatup = true;
|
|
|
|
@ -298,13 +294,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|
|
|
|
heating = false;
|
|
|
|
|
#if HAS_PID_FOR_BOTH
|
|
|
|
|
if (hotend < 0)
|
|
|
|
|
soft_pwm_bed = (bias - d) >> 1;
|
|
|
|
|
soft_pwm_amount_bed = (bias - d) >> 1;
|
|
|
|
|
else
|
|
|
|
|
soft_pwm[hotend] = (bias - d) >> 1;
|
|
|
|
|
soft_pwm_amount[hotend] = (bias - d) >> 1;
|
|
|
|
|
#elif ENABLED(PIDTEMP)
|
|
|
|
|
soft_pwm[hotend] = (bias - d) >> 1;
|
|
|
|
|
soft_pwm_amount[hotend] = (bias - d) >> 1;
|
|
|
|
|
#elif ENABLED(PIDTEMPBED)
|
|
|
|
|
soft_pwm_bed = (bias - d) >> 1;
|
|
|
|
|
soft_pwm_amount_bed = (bias - d) >> 1;
|
|
|
|
|
#endif
|
|
|
|
|
t1 = ms;
|
|
|
|
|
t_high = t1 - t2;
|
|
|
|
@ -367,13 +363,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|
|
|
|
}
|
|
|
|
|
#if HAS_PID_FOR_BOTH
|
|
|
|
|
if (hotend < 0)
|
|
|
|
|
soft_pwm_bed = (bias + d) >> 1;
|
|
|
|
|
soft_pwm_amount_bed = (bias + d) >> 1;
|
|
|
|
|
else
|
|
|
|
|
soft_pwm[hotend] = (bias + d) >> 1;
|
|
|
|
|
soft_pwm_amount[hotend] = (bias + d) >> 1;
|
|
|
|
|
#elif ENABLED(PIDTEMP)
|
|
|
|
|
soft_pwm[hotend] = (bias + d) >> 1;
|
|
|
|
|
soft_pwm_amount[hotend] = (bias + d) >> 1;
|
|
|
|
|
#else
|
|
|
|
|
soft_pwm_bed = (bias + d) >> 1;
|
|
|
|
|
soft_pwm_amount_bed = (bias + d) >> 1;
|
|
|
|
|
#endif
|
|
|
|
|
cycles++;
|
|
|
|
|
min = temp;
|
|
|
|
@ -466,7 +462,7 @@ void Temperature::updatePID() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Temperature::getHeaterPower(int heater) {
|
|
|
|
|
return heater < 0 ? soft_pwm_bed : soft_pwm[heater];
|
|
|
|
|
return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if HAS_AUTO_FAN
|
|
|
|
@ -717,7 +713,7 @@ void Temperature::manage_heater() {
|
|
|
|
|
float pid_output = get_pid_output(e);
|
|
|
|
|
|
|
|
|
|
// Check if temperature is within the correct range
|
|
|
|
|
soft_pwm[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
|
|
|
|
|
soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0;
|
|
|
|
|
|
|
|
|
|
// Check if the temperature is failing to increase
|
|
|
|
|
#if WATCH_HOTENDS
|
|
|
|
@ -798,27 +794,27 @@ void Temperature::manage_heater() {
|
|
|
|
|
#if ENABLED(PIDTEMPBED)
|
|
|
|
|
float pid_output = get_pid_output_bed();
|
|
|
|
|
|
|
|
|
|
soft_pwm_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0;
|
|
|
|
|
soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)pid_output >> 1 : 0;
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(BED_LIMIT_SWITCHING)
|
|
|
|
|
// Check if temperature is within the correct band
|
|
|
|
|
if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
|
|
|
|
|
if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
|
|
|
|
|
soft_pwm_bed = 0;
|
|
|
|
|
soft_pwm_amount_bed = 0;
|
|
|
|
|
else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS))
|
|
|
|
|
soft_pwm_bed = MAX_BED_POWER >> 1;
|
|
|
|
|
soft_pwm_amount_bed = MAX_BED_POWER >> 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
soft_pwm_bed = 0;
|
|
|
|
|
soft_pwm_amount_bed = 0;
|
|
|
|
|
WRITE_HEATER_BED(LOW);
|
|
|
|
|
}
|
|
|
|
|
#else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
|
|
|
|
|
// Check if temperature is within the correct range
|
|
|
|
|
if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
|
|
|
|
|
soft_pwm_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0;
|
|
|
|
|
soft_pwm_amount_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
soft_pwm_bed = 0;
|
|
|
|
|
soft_pwm_amount_bed = 0;
|
|
|
|
|
WRITE_HEATER_BED(LOW);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -1205,7 +1201,7 @@ void Temperature::init() {
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PROBING_HEATERS_OFF)
|
|
|
|
|
paused = false;
|
|
|
|
|
ZERO(paused_hotend_temps);
|
|
|
|
|
ZERO(paused_hotend_temp);
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
|
paused_bed_temp = 0;
|
|
|
|
|
#endif
|
|
|
|
@ -1316,7 +1312,7 @@ void Temperature::disable_all_heaters() {
|
|
|
|
|
// Unpause and reset everything
|
|
|
|
|
#if ENABLED(PROBING_HEATERS_OFF)
|
|
|
|
|
paused = false;
|
|
|
|
|
ZERO(paused_hotend_temps);
|
|
|
|
|
ZERO(paused_hotend_temp);
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
|
paused_bed_temp = 0;
|
|
|
|
|
#endif
|
|
|
|
@ -1327,7 +1323,7 @@ void Temperature::disable_all_heaters() {
|
|
|
|
|
|
|
|
|
|
#define DISABLE_HEATER(NR) { \
|
|
|
|
|
setTargetHotend(0, NR); \
|
|
|
|
|
soft_pwm[NR] = 0; \
|
|
|
|
|
soft_pwm_amount[NR] = 0; \
|
|
|
|
|
WRITE_HEATER_ ##NR (LOW); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1349,7 +1345,7 @@ void Temperature::disable_all_heaters() {
|
|
|
|
|
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
|
target_temperature_bed = 0;
|
|
|
|
|
soft_pwm_bed = 0;
|
|
|
|
|
soft_pwm_amount_bed = 0;
|
|
|
|
|
#if HAS_HEATER_BED
|
|
|
|
|
WRITE_HEATER_BED(LOW);
|
|
|
|
|
#endif
|
|
|
|
@ -1357,16 +1353,13 @@ void Temperature::disable_all_heaters() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PROBING_HEATERS_OFF)
|
|
|
|
|
void Temperature::pause(bool p) {
|
|
|
|
|
if (p == paused) { // If called out of order something is wrong
|
|
|
|
|
SERIAL_ERROR_START;
|
|
|
|
|
serialprintPGM(paused ? PSTR("Heaters already paused!") : PSTR("Heaters already unpaused!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Temperature::pause(const bool p) {
|
|
|
|
|
if (p != paused) {
|
|
|
|
|
paused = p;
|
|
|
|
|
if (p) {
|
|
|
|
|
HOTEND_LOOP() {
|
|
|
|
|
paused_hotend_temps[e] = degTargetHotend(e);
|
|
|
|
|
paused_hotend_temp[e] = degTargetHotend(e);
|
|
|
|
|
setTargetHotend(0, e);
|
|
|
|
|
}
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
@ -1375,18 +1368,14 @@ void Temperature::disable_all_heaters() {
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
HOTEND_LOOP() setTargetHotend(paused_hotend_temps[e], e);
|
|
|
|
|
HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e);
|
|
|
|
|
#if HAS_TEMP_BED
|
|
|
|
|
setTargetBed(paused_bed_temp);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
paused = p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Temperature::ispaused() {
|
|
|
|
|
return paused;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // PROBING_HEATERS_OFF
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
|
|
|
@ -1613,11 +1602,11 @@ void Temperature::isr() {
|
|
|
|
|
#if ENABLED(SLOW_PWM_HEATERS)
|
|
|
|
|
static uint8_t slow_pwm_count = 0;
|
|
|
|
|
#define ISR_STATICS(n) \
|
|
|
|
|
static uint8_t soft_pwm_ ## n; \
|
|
|
|
|
static uint8_t state_heater_ ## n = 0; \
|
|
|
|
|
static uint8_t state_timer_heater_ ## n = 0
|
|
|
|
|
static uint8_t soft_pwm_count_ ## n, \
|
|
|
|
|
state_heater_ ## n = 0, \
|
|
|
|
|
state_timer_heater_ ## n = 0
|
|
|
|
|
#else
|
|
|
|
|
#define ISR_STATICS(n) static uint8_t soft_pwm_ ## n = 0
|
|
|
|
|
#define ISR_STATICS(n) static uint8_t soft_pwm_count_ ## n = 0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Statics per heater
|
|
|
|
@ -1656,73 +1645,73 @@ void Temperature::isr() {
|
|
|
|
|
*/
|
|
|
|
|
if (pwm_count_tmp >= 127) {
|
|
|
|
|
pwm_count_tmp -= 127;
|
|
|
|
|
soft_pwm_0 = (soft_pwm_0 & pwm_mask) + soft_pwm[0];
|
|
|
|
|
WRITE_HEATER_0(soft_pwm_0 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_0 = (soft_pwm_count_0 & pwm_mask) + soft_pwm_amount[0];
|
|
|
|
|
WRITE_HEATER_0(soft_pwm_count_0 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#if HOTENDS > 1
|
|
|
|
|
soft_pwm_1 = (soft_pwm_1 & pwm_mask) + soft_pwm[1];
|
|
|
|
|
WRITE_HEATER_1(soft_pwm_1 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_1 = (soft_pwm_count_1 & pwm_mask) + soft_pwm_amount[1];
|
|
|
|
|
WRITE_HEATER_1(soft_pwm_count_1 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#if HOTENDS > 2
|
|
|
|
|
soft_pwm_2 = (soft_pwm_2 & pwm_mask) + soft_pwm[2];
|
|
|
|
|
WRITE_HEATER_2(soft_pwm_2 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_2 = (soft_pwm_count_2 & pwm_mask) + soft_pwm_amount[2];
|
|
|
|
|
WRITE_HEATER_2(soft_pwm_count_2 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#if HOTENDS > 3
|
|
|
|
|
soft_pwm_3 = (soft_pwm_3 & pwm_mask) + soft_pwm[3];
|
|
|
|
|
WRITE_HEATER_3(soft_pwm_3 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_3 = (soft_pwm_count_3 & pwm_mask) + soft_pwm_amount[3];
|
|
|
|
|
WRITE_HEATER_3(soft_pwm_count_3 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#if HOTENDS > 4
|
|
|
|
|
soft_pwm_4 = (soft_pwm_4 & pwm_mask) + soft_pwm[4];
|
|
|
|
|
WRITE_HEATER_4(soft_pwm_4 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_4 = (soft_pwm_count_4 & pwm_mask) + soft_pwm_amount[4];
|
|
|
|
|
WRITE_HEATER_4(soft_pwm_count_4 > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#endif // HOTENDS > 4
|
|
|
|
|
#endif // HOTENDS > 3
|
|
|
|
|
#endif // HOTENDS > 2
|
|
|
|
|
#endif // HOTENDS > 1
|
|
|
|
|
|
|
|
|
|
#if HAS_HEATER_BED
|
|
|
|
|
soft_pwm_BED = (soft_pwm_BED & pwm_mask) + soft_pwm_bed;
|
|
|
|
|
WRITE_HEATER_BED(soft_pwm_BED > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
|
|
|
|
|
WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FAN_SOFT_PWM)
|
|
|
|
|
#if HAS_FAN0
|
|
|
|
|
soft_pwm_fan[0] = (soft_pwm_fan[0] & pwm_mask) + fanSpeedSoftPwm[0] >> 1;
|
|
|
|
|
WRITE_FAN(soft_pwm_fan[0] > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_fan[0] = (soft_pwm_count_fan[0] & pwm_mask) + soft_pwm_amount_fan[0] >> 1;
|
|
|
|
|
WRITE_FAN(soft_pwm_count_fan[0] > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN1
|
|
|
|
|
soft_pwm_fan[1] = (soft_pwm_fan[1] & pwm_mask) + fanSpeedSoftPwm[1] >> 1;
|
|
|
|
|
WRITE_FAN1(soft_pwm_fan[1] > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_fan[1] = (soft_pwm_count_fan[1] & pwm_mask) + soft_pwm_amount_fan[1] >> 1;
|
|
|
|
|
WRITE_FAN1(soft_pwm_count_fan[1] > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN2
|
|
|
|
|
soft_pwm_fan[2] = (soft_pwm_fan[2] & pwm_mask) + fanSpeedSoftPwm[2] >> 1;
|
|
|
|
|
WRITE_FAN2(soft_pwm_fan[2] > pwm_mask ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_fan[2] = (soft_pwm_count_fan[2] & pwm_mask) + soft_pwm_amount_fan[2] >> 1;
|
|
|
|
|
WRITE_FAN2(soft_pwm_count_fan[2] > pwm_mask ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (soft_pwm_0 <= pwm_count_tmp) WRITE_HEATER_0(0);
|
|
|
|
|
if (soft_pwm_count_0 <= pwm_count_tmp) WRITE_HEATER_0(0);
|
|
|
|
|
#if HOTENDS > 1
|
|
|
|
|
if (soft_pwm_1 <= pwm_count_tmp) WRITE_HEATER_1(0);
|
|
|
|
|
if (soft_pwm_count_1 <= pwm_count_tmp) WRITE_HEATER_1(0);
|
|
|
|
|
#if HOTENDS > 2
|
|
|
|
|
if (soft_pwm_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
|
|
|
|
|
if (soft_pwm_count_2 <= pwm_count_tmp) WRITE_HEATER_2(0);
|
|
|
|
|
#if HOTENDS > 3
|
|
|
|
|
if (soft_pwm_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
|
|
|
|
|
if (soft_pwm_count_3 <= pwm_count_tmp) WRITE_HEATER_3(0);
|
|
|
|
|
#if HOTENDS > 4
|
|
|
|
|
if (soft_pwm_4 <= pwm_count_tmp) WRITE_HEATER_4(0);
|
|
|
|
|
if (soft_pwm_count_4 <= pwm_count_tmp) WRITE_HEATER_4(0);
|
|
|
|
|
#endif // HOTENDS > 4
|
|
|
|
|
#endif // HOTENDS > 3
|
|
|
|
|
#endif // HOTENDS > 2
|
|
|
|
|
#endif // HOTENDS > 1
|
|
|
|
|
|
|
|
|
|
#if HAS_HEATER_BED
|
|
|
|
|
if (soft_pwm_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
|
|
|
|
|
if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(0);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FAN_SOFT_PWM)
|
|
|
|
|
#if HAS_FAN0
|
|
|
|
|
if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
|
|
|
|
|
if (soft_pwm_count_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN1
|
|
|
|
|
if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
|
|
|
|
|
if (soft_pwm_count_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN2
|
|
|
|
|
if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
|
|
|
|
|
if (soft_pwm_count_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -1765,7 +1754,7 @@ void Temperature::isr() {
|
|
|
|
|
WRITE_HEATER_ ##NR(0); \
|
|
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
#define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm[n])
|
|
|
|
|
#define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm_amount[n])
|
|
|
|
|
|
|
|
|
|
#define PWM_OFF_ROUTINE(NR) \
|
|
|
|
|
if (soft_pwm_ ##NR < slow_pwm_count) { \
|
|
|
|
@ -1792,7 +1781,7 @@ void Temperature::isr() {
|
|
|
|
|
#endif // HOTENDS > 2
|
|
|
|
|
#endif // HOTENDS > 1
|
|
|
|
|
#if HAS_HEATER_BED
|
|
|
|
|
_SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED
|
|
|
|
|
_SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
} // slow_pwm_count == 0
|
|
|
|
@ -1818,26 +1807,26 @@ void Temperature::isr() {
|
|
|
|
|
if (pwm_count_tmp >= 127) {
|
|
|
|
|
pwm_count_tmp = 0;
|
|
|
|
|
#if HAS_FAN0
|
|
|
|
|
soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
|
|
|
|
|
WRITE_FAN(soft_pwm_fan[0] > 0 ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_fan[0] = soft_pwm_amount_fan[0] >> 1;
|
|
|
|
|
WRITE_FAN(soft_pwm_count_fan[0] > 0 ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN1
|
|
|
|
|
soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
|
|
|
|
|
WRITE_FAN1(soft_pwm_fan[1] > 0 ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_fan[1] = soft_pwm_amount_fan[1] >> 1;
|
|
|
|
|
WRITE_FAN1(soft_pwm_count_fan[1] > 0 ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN2
|
|
|
|
|
soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
|
|
|
|
|
WRITE_FAN2(soft_pwm_fan[2] > 0 ? HIGH : LOW);
|
|
|
|
|
soft_pwm_count_fan[2] = soft_pwm_amount_fan[2] >> 1;
|
|
|
|
|
WRITE_FAN2(soft_pwm_count_fan[2] > 0 ? HIGH : LOW);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#if HAS_FAN0
|
|
|
|
|
if (soft_pwm_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
|
|
|
|
|
if (soft_pwm_count_fan[0] <= pwm_count_tmp) WRITE_FAN(0);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN1
|
|
|
|
|
if (soft_pwm_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
|
|
|
|
|
if (soft_pwm_count_fan[1] <= pwm_count_tmp) WRITE_FAN1(0);
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN2
|
|
|
|
|
if (soft_pwm_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
|
|
|
|
|
if (soft_pwm_count_fan[2] <= pwm_count_tmp) WRITE_FAN2(0);
|
|
|
|
|
#endif
|
|
|
|
|
#endif // FAN_SOFT_PWM
|
|
|
|
|
|
|
|
|
|