Merge pull request #6647 from thinkyhead/bf_pwm_cleanup
Rename software PWM variables for clarity
This commit is contained in:
commit
5402eaf9bd
@ -649,7 +649,7 @@
|
|||||||
/**
|
/**
|
||||||
* Heater & Fan Pausing
|
* Heater & Fan Pausing
|
||||||
*/
|
*/
|
||||||
#if ENABLED(PROBING_FANS_OFF) && FAN_COUNT == 0
|
#if FAN_COUNT == 0
|
||||||
#undef PROBING_FANS_OFF
|
#undef PROBING_FANS_OFF
|
||||||
#endif
|
#endif
|
||||||
#define QUIET_PROBING (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF))
|
#define QUIET_PROBING (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF))
|
||||||
|
@ -2057,24 +2057,21 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PROBING_FANS_OFF)
|
#if ENABLED(PROBING_FANS_OFF)
|
||||||
void fans_pause(bool p) {
|
|
||||||
if (p == fans_paused) { // If called out of order something is wrong
|
|
||||||
SERIAL_ERROR_START;
|
|
||||||
serialprintPGM(fans_paused ? PSTR("Fans already paused!") : PSTR("Fans already unpaused!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void fans_pause(const bool p) {
|
||||||
|
if (p != fans_paused) {
|
||||||
|
fans_paused = p;
|
||||||
if (p)
|
if (p)
|
||||||
for (uint8_t x = 0;x < FAN_COUNT;x++) {
|
for (uint8_t x = 0; x < FAN_COUNT; x++) {
|
||||||
paused_fanSpeeds[x] = fanSpeeds[x];
|
paused_fanSpeeds[x] = fanSpeeds[x];
|
||||||
fanSpeeds[x] = 0;
|
fanSpeeds[x] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (uint8_t x = 0;x < FAN_COUNT;x++)
|
for (uint8_t x = 0; x < FAN_COUNT; x++)
|
||||||
fanSpeeds[x] = paused_fanSpeeds[x];
|
fanSpeeds[x] = paused_fanSpeeds[x];
|
||||||
|
|
||||||
fans_paused = p;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // PROBING_FANS_OFF
|
#endif // PROBING_FANS_OFF
|
||||||
|
|
||||||
#if HAS_BED_PROBE
|
#if HAS_BED_PROBE
|
||||||
@ -2089,18 +2086,16 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QUIET_PROBING
|
#if QUIET_PROBING
|
||||||
void probing_pause(bool pause) {
|
void probing_pause(const bool p) {
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
thermalManager.pause(pause);
|
thermalManager.pause(p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PROBING_FANS_OFF)
|
#if ENABLED(PROBING_FANS_OFF)
|
||||||
fans_pause(pause);
|
fans_pause(p);
|
||||||
#endif
|
#endif
|
||||||
|
if (p) safe_delay(25);
|
||||||
if(pause) safe_delay(25);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif // QUIET_PROBING
|
||||||
|
|
||||||
#if ENABLED(BLTOUCH)
|
#if ENABLED(BLTOUCH)
|
||||||
|
|
||||||
@ -11141,7 +11136,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
|||||||
// SERIAL_ECHOPAIR(" seconds=", seconds);
|
// SERIAL_ECHOPAIR(" seconds=", seconds);
|
||||||
// SERIAL_ECHOLNPAIR(" segments=", segments);
|
// SERIAL_ECHOLNPAIR(" segments=", segments);
|
||||||
|
|
||||||
#if IS_SCARA
|
#if IS_SCARA && ENABLED(SCARA_FEEDRATE_SCALING)
|
||||||
// SCARA needs to scale the feed rate from mm/s to degrees/s
|
// SCARA needs to scale the feed rate from mm/s to degrees/s
|
||||||
const float inv_segment_length = min(10.0, float(segments) / cartesian_mm), // 1/mm/segs
|
const float inv_segment_length = min(10.0, float(segments) / cartesian_mm), // 1/mm/segs
|
||||||
feed_factor = inv_segment_length * _feedrate_mm_s;
|
feed_factor = inv_segment_length * _feedrate_mm_s;
|
||||||
@ -11168,7 +11163,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
|||||||
|
|
||||||
ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
|
ADJUST_DELTA(logical); // Adjust Z if bed leveling is enabled
|
||||||
|
|
||||||
#if IS_SCARA
|
#if IS_SCARA && ENABLED(SCARA_FEEDRATE_SCALING)
|
||||||
// For SCARA scale the feed rate from mm/s to degrees/s
|
// For SCARA scale the feed rate from mm/s to degrees/s
|
||||||
// Use ratio between the length of the move and the larger angle change
|
// Use ratio between the length of the move and the larger angle change
|
||||||
const float adiff = abs(delta[A_AXIS] - oldA),
|
const float adiff = abs(delta[A_AXIS] - oldA),
|
||||||
@ -11184,7 +11179,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
|||||||
// Since segment_distance is only approximate,
|
// Since segment_distance is only approximate,
|
||||||
// the final move must be to the exact destination.
|
// the final move must be to the exact destination.
|
||||||
|
|
||||||
#if IS_SCARA
|
#if IS_SCARA && ENABLED(SCARA_FEEDRATE_SCALING)
|
||||||
// For SCARA scale the feed rate from mm/s to degrees/s
|
// For SCARA scale the feed rate from mm/s to degrees/s
|
||||||
// With segments > 1 length is 1 segment, otherwise total length
|
// With segments > 1 length is 1 segment, otherwise total length
|
||||||
inverse_kinematics(ltarget);
|
inverse_kinematics(ltarget);
|
||||||
@ -11516,7 +11511,7 @@ void prepare_move_to_destination() {
|
|||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
if (ELAPSED(ms, nextMotorCheck)) {
|
if (ELAPSED(ms, nextMotorCheck)) {
|
||||||
nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
|
nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
|
||||||
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || thermalManager.soft_pwm_bed > 0
|
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || thermalManager.soft_pwm_amount_bed > 0
|
||||||
|| E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
|
|| E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
|
||||||
#if E_STEPPERS > 1
|
#if E_STEPPERS > 1
|
||||||
|| E1_ENABLE_READ == E_ENABLE_ON
|
|| E1_ENABLE_READ == E_ENABLE_ON
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
|
|
||||||
#if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)
|
#if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)
|
||||||
//#define DEBUG_SCARA_KINEMATICS
|
//#define DEBUG_SCARA_KINEMATICS
|
||||||
|
//#define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly
|
||||||
|
|
||||||
// If movement is choppy try lowering this value
|
// If movement is choppy try lowering this value
|
||||||
#define SCARA_SEGMENTS_PER_SECOND 200
|
#define SCARA_SEGMENTS_PER_SECOND 200
|
||||||
|
@ -491,13 +491,13 @@ void Planner::check_axes_activity() {
|
|||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
thermalManager.fanSpeedSoftPwm[0] = CALC_FAN_SPEED(0);
|
thermalManager.soft_pwm_amount_fan[0] = CALC_FAN_SPEED(0);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN1
|
#if HAS_FAN1
|
||||||
thermalManager.fanSpeedSoftPwm[1] = CALC_FAN_SPEED(1);
|
thermalManager.soft_pwm_amount_fan[1] = CALC_FAN_SPEED(1);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN2
|
#if HAS_FAN2
|
||||||
thermalManager.fanSpeedSoftPwm[2] = CALC_FAN_SPEED(2);
|
thermalManager.soft_pwm_amount_fan[2] = CALC_FAN_SPEED(2);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
|
@ -74,12 +74,6 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
|
|||||||
float Temperature::redundant_temperature = 0.0;
|
float Temperature::redundant_temperature = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t Temperature::soft_pwm_bed;
|
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
|
||||||
uint8_t Temperature::fanSpeedSoftPwm[FAN_COUNT];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(PIDTEMP)
|
#if ENABLED(PIDTEMP)
|
||||||
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
|
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
|
||||||
float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
|
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;
|
millis_t Temperature::next_auto_fan_check_ms = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t Temperature::soft_pwm[HOTENDS];
|
uint8_t Temperature::soft_pwm_amount[HOTENDS],
|
||||||
|
Temperature::soft_pwm_amount_bed;
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#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
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
@ -206,7 +202,7 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|||||||
|
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
bool Temperature::paused;
|
bool Temperature::paused;
|
||||||
int16_t Temperature::paused_hotend_temps[HOTENDS];
|
int16_t Temperature::paused_hotend_temp[HOTENDS];
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
int16_t Temperature::paused_bed_temp;
|
int16_t Temperature::paused_bed_temp;
|
||||||
#endif
|
#endif
|
||||||
@ -254,13 +250,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|||||||
|
|
||||||
#if HAS_PID_FOR_BOTH
|
#if HAS_PID_FOR_BOTH
|
||||||
if (hotend < 0)
|
if (hotend < 0)
|
||||||
soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
|
soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
|
||||||
else
|
else
|
||||||
soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
|
soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
|
||||||
#elif ENABLED(PIDTEMP)
|
#elif ENABLED(PIDTEMP)
|
||||||
soft_pwm[hotend] = bias = d = (PID_MAX) >> 1;
|
soft_pwm_amount[hotend] = bias = d = (PID_MAX) >> 1;
|
||||||
#else
|
#else
|
||||||
soft_pwm_bed = bias = d = (MAX_BED_POWER) >> 1;
|
soft_pwm_amount_bed = bias = d = (MAX_BED_POWER) >> 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wait_for_heatup = true;
|
wait_for_heatup = true;
|
||||||
@ -298,13 +294,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|||||||
heating = false;
|
heating = false;
|
||||||
#if HAS_PID_FOR_BOTH
|
#if HAS_PID_FOR_BOTH
|
||||||
if (hotend < 0)
|
if (hotend < 0)
|
||||||
soft_pwm_bed = (bias - d) >> 1;
|
soft_pwm_amount_bed = (bias - d) >> 1;
|
||||||
else
|
else
|
||||||
soft_pwm[hotend] = (bias - d) >> 1;
|
soft_pwm_amount[hotend] = (bias - d) >> 1;
|
||||||
#elif ENABLED(PIDTEMP)
|
#elif ENABLED(PIDTEMP)
|
||||||
soft_pwm[hotend] = (bias - d) >> 1;
|
soft_pwm_amount[hotend] = (bias - d) >> 1;
|
||||||
#elif ENABLED(PIDTEMPBED)
|
#elif ENABLED(PIDTEMPBED)
|
||||||
soft_pwm_bed = (bias - d) >> 1;
|
soft_pwm_amount_bed = (bias - d) >> 1;
|
||||||
#endif
|
#endif
|
||||||
t1 = ms;
|
t1 = ms;
|
||||||
t_high = t1 - t2;
|
t_high = t1 - t2;
|
||||||
@ -367,13 +363,13 @@ uint8_t Temperature::soft_pwm[HOTENDS];
|
|||||||
}
|
}
|
||||||
#if HAS_PID_FOR_BOTH
|
#if HAS_PID_FOR_BOTH
|
||||||
if (hotend < 0)
|
if (hotend < 0)
|
||||||
soft_pwm_bed = (bias + d) >> 1;
|
soft_pwm_amount_bed = (bias + d) >> 1;
|
||||||
else
|
else
|
||||||
soft_pwm[hotend] = (bias + d) >> 1;
|
soft_pwm_amount[hotend] = (bias + d) >> 1;
|
||||||
#elif ENABLED(PIDTEMP)
|
#elif ENABLED(PIDTEMP)
|
||||||
soft_pwm[hotend] = (bias + d) >> 1;
|
soft_pwm_amount[hotend] = (bias + d) >> 1;
|
||||||
#else
|
#else
|
||||||
soft_pwm_bed = (bias + d) >> 1;
|
soft_pwm_amount_bed = (bias + d) >> 1;
|
||||||
#endif
|
#endif
|
||||||
cycles++;
|
cycles++;
|
||||||
min = temp;
|
min = temp;
|
||||||
@ -466,7 +462,7 @@ void Temperature::updatePID() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Temperature::getHeaterPower(int heater) {
|
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
|
#if HAS_AUTO_FAN
|
||||||
@ -717,7 +713,7 @@ void Temperature::manage_heater() {
|
|||||||
float pid_output = get_pid_output(e);
|
float pid_output = get_pid_output(e);
|
||||||
|
|
||||||
// Check if temperature is within the correct range
|
// 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
|
// Check if the temperature is failing to increase
|
||||||
#if WATCH_HOTENDS
|
#if WATCH_HOTENDS
|
||||||
@ -798,27 +794,27 @@ void Temperature::manage_heater() {
|
|||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
float pid_output = get_pid_output_bed();
|
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)
|
#elif ENABLED(BED_LIMIT_SWITCHING)
|
||||||
// Check if temperature is within the correct band
|
// Check if temperature is within the correct band
|
||||||
if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
|
if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
|
||||||
if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS)
|
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))
|
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 {
|
else {
|
||||||
soft_pwm_bed = 0;
|
soft_pwm_amount_bed = 0;
|
||||||
WRITE_HEATER_BED(LOW);
|
WRITE_HEATER_BED(LOW);
|
||||||
}
|
}
|
||||||
#else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
|
#else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
|
||||||
// Check if temperature is within the correct range
|
// Check if temperature is within the correct range
|
||||||
if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) {
|
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 {
|
else {
|
||||||
soft_pwm_bed = 0;
|
soft_pwm_amount_bed = 0;
|
||||||
WRITE_HEATER_BED(LOW);
|
WRITE_HEATER_BED(LOW);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1205,7 +1201,7 @@ void Temperature::init() {
|
|||||||
|
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
paused = false;
|
paused = false;
|
||||||
ZERO(paused_hotend_temps);
|
ZERO(paused_hotend_temp);
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
paused_bed_temp = 0;
|
paused_bed_temp = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -1316,7 +1312,7 @@ void Temperature::disable_all_heaters() {
|
|||||||
// Unpause and reset everything
|
// Unpause and reset everything
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
paused = false;
|
paused = false;
|
||||||
ZERO(paused_hotend_temps);
|
ZERO(paused_hotend_temp);
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
paused_bed_temp = 0;
|
paused_bed_temp = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -1327,7 +1323,7 @@ void Temperature::disable_all_heaters() {
|
|||||||
|
|
||||||
#define DISABLE_HEATER(NR) { \
|
#define DISABLE_HEATER(NR) { \
|
||||||
setTargetHotend(0, NR); \
|
setTargetHotend(0, NR); \
|
||||||
soft_pwm[NR] = 0; \
|
soft_pwm_amount[NR] = 0; \
|
||||||
WRITE_HEATER_ ##NR (LOW); \
|
WRITE_HEATER_ ##NR (LOW); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,7 +1345,7 @@ void Temperature::disable_all_heaters() {
|
|||||||
|
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
target_temperature_bed = 0;
|
target_temperature_bed = 0;
|
||||||
soft_pwm_bed = 0;
|
soft_pwm_amount_bed = 0;
|
||||||
#if HAS_HEATER_BED
|
#if HAS_HEATER_BED
|
||||||
WRITE_HEATER_BED(LOW);
|
WRITE_HEATER_BED(LOW);
|
||||||
#endif
|
#endif
|
||||||
@ -1357,16 +1353,13 @@ void Temperature::disable_all_heaters() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#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) {
|
if (p) {
|
||||||
HOTEND_LOOP() {
|
HOTEND_LOOP() {
|
||||||
paused_hotend_temps[e] = degTargetHotend(e);
|
paused_hotend_temp[e] = degTargetHotend(e);
|
||||||
setTargetHotend(0, e);
|
setTargetHotend(0, e);
|
||||||
}
|
}
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
@ -1375,18 +1368,14 @@ void Temperature::disable_all_heaters() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
HOTEND_LOOP() setTargetHotend(paused_hotend_temps[e], e);
|
HOTEND_LOOP() setTargetHotend(paused_hotend_temp[e], e);
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
setTargetBed(paused_bed_temp);
|
setTargetBed(paused_bed_temp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
paused = p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Temperature::ispaused() {
|
|
||||||
return paused;
|
|
||||||
}
|
|
||||||
#endif // PROBING_HEATERS_OFF
|
#endif // PROBING_HEATERS_OFF
|
||||||
|
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||||
@ -1613,11 +1602,11 @@ void Temperature::isr() {
|
|||||||
#if ENABLED(SLOW_PWM_HEATERS)
|
#if ENABLED(SLOW_PWM_HEATERS)
|
||||||
static uint8_t slow_pwm_count = 0;
|
static uint8_t slow_pwm_count = 0;
|
||||||
#define ISR_STATICS(n) \
|
#define ISR_STATICS(n) \
|
||||||
static uint8_t soft_pwm_ ## n; \
|
static uint8_t soft_pwm_count_ ## n, \
|
||||||
static uint8_t state_heater_ ## n = 0; \
|
state_heater_ ## n = 0, \
|
||||||
static uint8_t state_timer_heater_ ## n = 0
|
state_timer_heater_ ## n = 0
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
// Statics per heater
|
// Statics per heater
|
||||||
@ -1656,73 +1645,73 @@ void Temperature::isr() {
|
|||||||
*/
|
*/
|
||||||
if (pwm_count_tmp >= 127) {
|
if (pwm_count_tmp >= 127) {
|
||||||
pwm_count_tmp -= 127;
|
pwm_count_tmp -= 127;
|
||||||
soft_pwm_0 = (soft_pwm_0 & pwm_mask) + soft_pwm[0];
|
soft_pwm_count_0 = (soft_pwm_count_0 & pwm_mask) + soft_pwm_amount[0];
|
||||||
WRITE_HEATER_0(soft_pwm_0 > pwm_mask ? HIGH : LOW);
|
WRITE_HEATER_0(soft_pwm_count_0 > pwm_mask ? HIGH : LOW);
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
soft_pwm_1 = (soft_pwm_1 & pwm_mask) + soft_pwm[1];
|
soft_pwm_count_1 = (soft_pwm_count_1 & pwm_mask) + soft_pwm_amount[1];
|
||||||
WRITE_HEATER_1(soft_pwm_1 > pwm_mask ? HIGH : LOW);
|
WRITE_HEATER_1(soft_pwm_count_1 > pwm_mask ? HIGH : LOW);
|
||||||
#if HOTENDS > 2
|
#if HOTENDS > 2
|
||||||
soft_pwm_2 = (soft_pwm_2 & pwm_mask) + soft_pwm[2];
|
soft_pwm_count_2 = (soft_pwm_count_2 & pwm_mask) + soft_pwm_amount[2];
|
||||||
WRITE_HEATER_2(soft_pwm_2 > pwm_mask ? HIGH : LOW);
|
WRITE_HEATER_2(soft_pwm_count_2 > pwm_mask ? HIGH : LOW);
|
||||||
#if HOTENDS > 3
|
#if HOTENDS > 3
|
||||||
soft_pwm_3 = (soft_pwm_3 & pwm_mask) + soft_pwm[3];
|
soft_pwm_count_3 = (soft_pwm_count_3 & pwm_mask) + soft_pwm_amount[3];
|
||||||
WRITE_HEATER_3(soft_pwm_3 > pwm_mask ? HIGH : LOW);
|
WRITE_HEATER_3(soft_pwm_count_3 > pwm_mask ? HIGH : LOW);
|
||||||
#if HOTENDS > 4
|
#if HOTENDS > 4
|
||||||
soft_pwm_4 = (soft_pwm_4 & pwm_mask) + soft_pwm[4];
|
soft_pwm_count_4 = (soft_pwm_count_4 & pwm_mask) + soft_pwm_amount[4];
|
||||||
WRITE_HEATER_4(soft_pwm_4 > pwm_mask ? HIGH : LOW);
|
WRITE_HEATER_4(soft_pwm_count_4 > pwm_mask ? HIGH : LOW);
|
||||||
#endif // HOTENDS > 4
|
#endif // HOTENDS > 4
|
||||||
#endif // HOTENDS > 3
|
#endif // HOTENDS > 3
|
||||||
#endif // HOTENDS > 2
|
#endif // HOTENDS > 2
|
||||||
#endif // HOTENDS > 1
|
#endif // HOTENDS > 1
|
||||||
|
|
||||||
#if HAS_HEATER_BED
|
#if HAS_HEATER_BED
|
||||||
soft_pwm_BED = (soft_pwm_BED & pwm_mask) + soft_pwm_bed;
|
soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed;
|
||||||
WRITE_HEATER_BED(soft_pwm_BED > pwm_mask ? HIGH : LOW);
|
WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
soft_pwm_fan[0] = (soft_pwm_fan[0] & pwm_mask) + fanSpeedSoftPwm[0] >> 1;
|
soft_pwm_count_fan[0] = (soft_pwm_count_fan[0] & pwm_mask) + soft_pwm_amount_fan[0] >> 1;
|
||||||
WRITE_FAN(soft_pwm_fan[0] > pwm_mask ? HIGH : LOW);
|
WRITE_FAN(soft_pwm_count_fan[0] > pwm_mask ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN1
|
#if HAS_FAN1
|
||||||
soft_pwm_fan[1] = (soft_pwm_fan[1] & pwm_mask) + fanSpeedSoftPwm[1] >> 1;
|
soft_pwm_count_fan[1] = (soft_pwm_count_fan[1] & pwm_mask) + soft_pwm_amount_fan[1] >> 1;
|
||||||
WRITE_FAN1(soft_pwm_fan[1] > pwm_mask ? HIGH : LOW);
|
WRITE_FAN1(soft_pwm_count_fan[1] > pwm_mask ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN2
|
#if HAS_FAN2
|
||||||
soft_pwm_fan[2] = (soft_pwm_fan[2] & pwm_mask) + fanSpeedSoftPwm[2] >> 1;
|
soft_pwm_count_fan[2] = (soft_pwm_count_fan[2] & pwm_mask) + soft_pwm_amount_fan[2] >> 1;
|
||||||
WRITE_FAN2(soft_pwm_fan[2] > pwm_mask ? HIGH : LOW);
|
WRITE_FAN2(soft_pwm_count_fan[2] > pwm_mask ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
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 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 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 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 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 > 4
|
||||||
#endif // HOTENDS > 3
|
#endif // HOTENDS > 3
|
||||||
#endif // HOTENDS > 2
|
#endif // HOTENDS > 2
|
||||||
#endif // HOTENDS > 1
|
#endif // HOTENDS > 1
|
||||||
|
|
||||||
#if HAS_HEATER_BED
|
#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
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
#if HAS_FAN0
|
#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
|
#endif
|
||||||
#if HAS_FAN1
|
#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
|
#endif
|
||||||
#if HAS_FAN2
|
#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
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1765,7 +1754,7 @@ void Temperature::isr() {
|
|||||||
WRITE_HEATER_ ##NR(0); \
|
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) \
|
#define PWM_OFF_ROUTINE(NR) \
|
||||||
if (soft_pwm_ ##NR < slow_pwm_count) { \
|
if (soft_pwm_ ##NR < slow_pwm_count) { \
|
||||||
@ -1792,7 +1781,7 @@ void Temperature::isr() {
|
|||||||
#endif // HOTENDS > 2
|
#endif // HOTENDS > 2
|
||||||
#endif // HOTENDS > 1
|
#endif // HOTENDS > 1
|
||||||
#if HAS_HEATER_BED
|
#if HAS_HEATER_BED
|
||||||
_SLOW_PWM_ROUTINE(BED, soft_pwm_bed); // BED
|
_SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // slow_pwm_count == 0
|
} // slow_pwm_count == 0
|
||||||
@ -1818,26 +1807,26 @@ void Temperature::isr() {
|
|||||||
if (pwm_count_tmp >= 127) {
|
if (pwm_count_tmp >= 127) {
|
||||||
pwm_count_tmp = 0;
|
pwm_count_tmp = 0;
|
||||||
#if HAS_FAN0
|
#if HAS_FAN0
|
||||||
soft_pwm_fan[0] = fanSpeedSoftPwm[0] >> 1;
|
soft_pwm_count_fan[0] = soft_pwm_amount_fan[0] >> 1;
|
||||||
WRITE_FAN(soft_pwm_fan[0] > 0 ? HIGH : LOW);
|
WRITE_FAN(soft_pwm_count_fan[0] > 0 ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN1
|
#if HAS_FAN1
|
||||||
soft_pwm_fan[1] = fanSpeedSoftPwm[1] >> 1;
|
soft_pwm_count_fan[1] = soft_pwm_amount_fan[1] >> 1;
|
||||||
WRITE_FAN1(soft_pwm_fan[1] > 0 ? HIGH : LOW);
|
WRITE_FAN1(soft_pwm_count_fan[1] > 0 ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN2
|
#if HAS_FAN2
|
||||||
soft_pwm_fan[2] = fanSpeedSoftPwm[2] >> 1;
|
soft_pwm_count_fan[2] = soft_pwm_amount_fan[2] >> 1;
|
||||||
WRITE_FAN2(soft_pwm_fan[2] > 0 ? HIGH : LOW);
|
WRITE_FAN2(soft_pwm_count_fan[2] > 0 ? HIGH : LOW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_FAN0
|
#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
|
#endif
|
||||||
#if HAS_FAN1
|
#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
|
#endif
|
||||||
#if HAS_FAN2
|
#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
|
||||||
#endif // FAN_SOFT_PWM
|
#endif // FAN_SOFT_PWM
|
||||||
|
|
||||||
|
@ -109,10 +109,12 @@ class Temperature {
|
|||||||
static float redundant_temperature;
|
static float redundant_temperature;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t soft_pwm_bed;
|
static uint8_t soft_pwm_amount[HOTENDS],
|
||||||
|
soft_pwm_amount_bed;
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
#if ENABLED(FAN_SOFT_PWM)
|
||||||
static uint8_t fanSpeedSoftPwm[FAN_COUNT];
|
static uint8_t soft_pwm_amount_fan[FAN_COUNT],
|
||||||
|
soft_pwm_count_fan[FAN_COUNT];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)
|
||||||
@ -249,19 +251,13 @@ class Temperature {
|
|||||||
static millis_t next_auto_fan_check_ms;
|
static millis_t next_auto_fan_check_ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t soft_pwm[HOTENDS];
|
|
||||||
|
|
||||||
#if ENABLED(FAN_SOFT_PWM)
|
|
||||||
static uint8_t soft_pwm_fan[FAN_COUNT];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
static int current_raw_filwidth; //Holds measured filament diameter - one extruder only
|
static int current_raw_filwidth; //Holds measured filament diameter - one extruder only
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
static bool paused;
|
static bool paused;
|
||||||
static int16_t paused_hotend_temps[HOTENDS];
|
static int16_t paused_hotend_temp[HOTENDS];
|
||||||
|
|
||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
static int16_t paused_bed_temp;
|
static int16_t paused_bed_temp;
|
||||||
@ -462,8 +458,7 @@ class Temperature {
|
|||||||
#endif // BABYSTEPPING
|
#endif // BABYSTEPPING
|
||||||
|
|
||||||
#if ENABLED(PROBING_HEATERS_OFF)
|
#if ENABLED(PROBING_HEATERS_OFF)
|
||||||
static void pause(bool p);
|
static void pause(const bool p);
|
||||||
static bool ispaused();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
58
README.md
58
README.md
@ -113,37 +113,37 @@ Proposed patches should be submitted as a Pull Request against this branch ([bug
|
|||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
The current Marlin dev team consists of:
|
The current Marlin dev team consists of:
|
||||||
- Roxanne Neufeld [@Roxy-3D] - English
|
- Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - English
|
||||||
- Scott Lahteine [@thinkyhead] - English
|
- Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - English
|
||||||
- Bob Kuhn [@Bob-the-Kuhn] - English
|
- Bob Kuhn [[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)] - English
|
||||||
- Andreas Hardtung [@AnHardt] - Deutsch, English
|
- Andreas Hardtung [[@AnHardt](https://github.com/AnHardt)] - Deutsch, English
|
||||||
- Nico Tonnhofer [@Wurstnase] - Deutsch, English
|
- Nico Tonnhofer [[@Wurstnase](https://github.com/Wurstnase)] - Deutsch, English
|
||||||
- Jochen Groppe [@CONSULitAS] - Deutsch, English
|
- Jochen Groppe [[@CONSULitAS](https://github.com/CONSULitAS)] - Deutsch, English
|
||||||
- João Brazio [@jbrazio] - Portuguese, English
|
- João Brazio [[@jbrazio](https://github.com/jbrazio)] - Portuguese, English
|
||||||
- Bo Hermannsen [@boelle] - Danish, English
|
- Bo Hermannsen [[@boelle](https://github.com/boelle)] - Danish, English
|
||||||
- Bob Cousins [@bobc] - English
|
- Bob Cousins [[@bobc](https://github.com/bobc)] - English
|
||||||
- [@maverikou]
|
- [[@maverikou](https://github.com/maverikou)]
|
||||||
- Chris Palmer [@nophead]
|
- Chris Palmer [[@nophead](https://github.com/nophead)]
|
||||||
- [@paclema]
|
- [[@paclema](https://github.com/paclema)]
|
||||||
- Erik van der Zalm [@ErikZalm]
|
- Erik van der Zalm [[@ErikZalm](https://github.com/ErikZalm)]
|
||||||
- David Braam [@daid]
|
- David Braam [[@daid](https://github.com/daid)]
|
||||||
- Bernhard Kubicek [@bkubicek]
|
- Bernhard Kubicek [[@bkubicek](https://github.com/bkubicek)]
|
||||||
|
|
||||||
More features have been added by:
|
More features have been added by:
|
||||||
- Alberto Cotronei [@MagoKimbra] - English, Italian
|
- Alberto Cotronei [[@MagoKimbra](https://github.com/MagoKimbra)] - English, Italian
|
||||||
- Thomas Moore [@tcm0116]
|
- Thomas Moore [[@tcm0116](https://github.com/tcm0116)]
|
||||||
- Ernesto Martinez [@emartinez167]
|
- Ernesto Martinez [[@emartinez167](https://github.com/emartinez167)]
|
||||||
- Petr Zahradnik [@clexpert]
|
- Petr Zahradnik [[@clexpert](https://github.com/clexpert)]
|
||||||
- Kai [@Kaibob2]
|
- Kai [[@Kaibob2](https://github.com/Kaibob2)]
|
||||||
- Edward Patel [@epatel]
|
- Edward Patel [[@epatel](https://github.com/epatel)]
|
||||||
- F. Malpartida [@fmalpartida] - English, Spanish
|
- F. Malpartida [[@fmalpartida](https://github.com/fmalpartida)] - English, Spanish
|
||||||
- [@esenapaj] - English, Japanese
|
- [[@esenapaj](https://github.com/esenapaj)] - English, Japanese
|
||||||
- [@benlye]
|
- [[@benlye](https://github.com/benlye)]
|
||||||
- [@Tannoo]
|
- [[@Tannoo](https://github.com/Tannoo)]
|
||||||
- [@teemuatlut]
|
- [[@teemuatlut](https://github.com/teemuatlut)]
|
||||||
- [@bgort]
|
- [[@bgort](https://github.com/bgort)]
|
||||||
- [@LVD-AC]
|
- [[@LVD-AC](https://github.com/LVD-AC)]
|
||||||
- [@paulusjacobus]
|
- [[@paulusjacobus](https://github.com/paulusjacobus)]
|
||||||
- ...and many others
|
- ...and many others
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
Loading…
Reference in New Issue
Block a user