Merge pull request #6811 from thinkyhead/bf_temp_float_stuff
Restore current temp accessors to float
This commit is contained in:
commit
c2ca85aeb2
@ -6684,7 +6684,8 @@ inline void gcode_M104() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (code_value_temp_abs() > thermalManager.degHotend(target_extruder)) lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
|
if (code_value_temp_abs() > thermalManager.degHotend(target_extruder))
|
||||||
|
lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTOTEMP)
|
#if ENABLED(AUTOTEMP)
|
||||||
@ -8290,7 +8291,7 @@ inline void gcode_M226() {
|
|||||||
// Report current state
|
// Report current state
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis"));
|
SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis"));
|
||||||
SERIAL_ECHOPAIR("abled (min temp ", int(thermalManager.extrude_min_temp + 0.5));
|
SERIAL_ECHOPAIR("abled (min temp ", thermalManager.extrude_min_temp);
|
||||||
SERIAL_ECHOLNPGM("C)");
|
SERIAL_ECHOLNPGM("C)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11909,9 +11910,8 @@ void prepare_move_to_destination() {
|
|||||||
#if HAS_TEMP_BED
|
#if HAS_TEMP_BED
|
||||||
max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
|
max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
|
||||||
#endif
|
#endif
|
||||||
HOTEND_LOOP() {
|
HOTEND_LOOP()
|
||||||
max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
||||||
}
|
|
||||||
bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
|
bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
|
||||||
if (new_led != red_led) {
|
if (new_led != red_led) {
|
||||||
red_led = new_led;
|
red_led = new_led;
|
||||||
|
@ -103,24 +103,24 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCH_HOTENDS
|
#if WATCH_HOTENDS
|
||||||
int Temperature::watch_target_temp[HOTENDS] = { 0 };
|
uint16_t Temperature::watch_target_temp[HOTENDS] = { 0 };
|
||||||
millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
|
millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCH_THE_BED
|
#if WATCH_THE_BED
|
||||||
int Temperature::watch_target_bed_temp = 0;
|
uint16_t Temperature::watch_target_bed_temp = 0;
|
||||||
millis_t Temperature::watch_bed_next_ms = 0;
|
millis_t Temperature::watch_bed_next_ms = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||||
bool Temperature::allow_cold_extrude = false;
|
bool Temperature::allow_cold_extrude = false;
|
||||||
float Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
|
uint16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
|
|
||||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||||
int Temperature::redundant_temperature_raw = 0;
|
uint16_t Temperature::redundant_temperature_raw = 0;
|
||||||
float Temperature::redundant_temperature = 0.0;
|
float Temperature::redundant_temperature = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -695,66 +695,47 @@ void Temperature::manage_heater() {
|
|||||||
updateTemperaturesFromRawValues(); // also resets the watchdog
|
updateTemperaturesFromRawValues(); // also resets the watchdog
|
||||||
|
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||||
if (current_temperature[0] > min(HEATER_0_MAXTEMP, MAX6675_TMAX - 1)) max_temp_error(0);
|
if (current_temperature[0] > min(HEATER_0_MAXTEMP, MAX6675_TMAX - 1.0)) max_temp_error(0);
|
||||||
if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + 0.01)) min_temp_error(0);
|
if (current_temperature[0] < max(HEATER_0_MINTEMP, MAX6675_TMIN + .01)) min_temp_error(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
|
#if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN
|
||||||
millis_t ms = millis();
|
millis_t ms = millis();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Loop through all hotends
|
|
||||||
HOTEND_LOOP() {
|
HOTEND_LOOP() {
|
||||||
|
|
||||||
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
|
||||||
|
// Check for thermal runaway
|
||||||
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
|
thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float pid_output = get_pid_output(e);
|
soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)get_pid_output(e) >> 1 : 0;
|
||||||
|
|
||||||
// Check if temperature is within the correct range
|
|
||||||
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
|
#if WATCH_HOTENDS
|
||||||
|
// Make sure temperature is increasing
|
||||||
// Is it time to check this extruder's heater?
|
if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder?
|
||||||
if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) {
|
if (degHotend(e) < watch_target_temp[e]) // Failed to increase enough?
|
||||||
// Has it failed to increase enough?
|
|
||||||
if (degHotend(e) < watch_target_temp[e]) {
|
|
||||||
// Stop!
|
|
||||||
_temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
|
_temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
|
||||||
}
|
else // Start again if the target is still far off
|
||||||
else {
|
|
||||||
// Start again if the target is still far off
|
|
||||||
start_watching_heater(e);
|
start_watching_heater(e);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // THERMAL_PROTECTION_HOTENDS
|
|
||||||
|
|
||||||
// Check if the temperature is failing to increase
|
|
||||||
#if WATCH_THE_BED
|
#if WATCH_THE_BED
|
||||||
|
// Make sure temperature is increasing
|
||||||
// Is it time to check the bed?
|
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed?
|
||||||
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {
|
if (degBed() < watch_target_bed_temp) // Failed to increase enough?
|
||||||
// Has it failed to increase enough?
|
|
||||||
if (degBed() < watch_target_bed_temp) {
|
|
||||||
// Stop!
|
|
||||||
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
|
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
|
||||||
}
|
else // Start again if the target is still far off
|
||||||
else {
|
|
||||||
// Start again if the target is still far off
|
|
||||||
start_watching_bed();
|
start_watching_bed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif // THERMAL_PROTECTION_HOTENDS
|
|
||||||
|
|
||||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||||
if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
|
// Make sure measured temperatures are close together
|
||||||
|
if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
|
||||||
_temp_error(0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
|
_temp_error(0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // HOTEND_LOOP
|
} // HOTEND_LOOP
|
||||||
@ -792,9 +773,7 @@ void Temperature::manage_heater() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
float pid_output = get_pid_output_bed();
|
soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 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
|
||||||
|
@ -158,18 +158,18 @@ class Temperature {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCH_HOTENDS
|
#if WATCH_HOTENDS
|
||||||
static int watch_target_temp[HOTENDS];
|
static uint16_t watch_target_temp[HOTENDS];
|
||||||
static millis_t watch_heater_next_ms[HOTENDS];
|
static millis_t watch_heater_next_ms[HOTENDS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCH_THE_BED
|
#if WATCH_THE_BED
|
||||||
static int watch_target_bed_temp;
|
static uint16_t watch_target_bed_temp;
|
||||||
static millis_t watch_bed_next_ms;
|
static millis_t watch_bed_next_ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||||
static bool allow_cold_extrude;
|
static bool allow_cold_extrude;
|
||||||
static float extrude_min_temp;
|
static uint16_t extrude_min_temp;
|
||||||
static bool tooColdToExtrude(uint8_t e) {
|
static bool tooColdToExtrude(uint8_t e) {
|
||||||
#if HOTENDS == 1
|
#if HOTENDS == 1
|
||||||
UNUSED(e);
|
UNUSED(e);
|
||||||
@ -183,7 +183,7 @@ class Temperature {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||||
static int redundant_temperature_raw;
|
static uint16_t redundant_temperature_raw;
|
||||||
static float redundant_temperature;
|
static float redundant_temperature;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -327,13 +327,13 @@ class Temperature {
|
|||||||
//inline so that there is no performance decrease.
|
//inline so that there is no performance decrease.
|
||||||
//deg=degreeCelsius
|
//deg=degreeCelsius
|
||||||
|
|
||||||
static int16_t degHotend(uint8_t e) {
|
static float degHotend(uint8_t e) {
|
||||||
#if HOTENDS == 1
|
#if HOTENDS == 1
|
||||||
UNUSED(e);
|
UNUSED(e);
|
||||||
#endif
|
#endif
|
||||||
return current_temperature[HOTEND_INDEX];
|
return current_temperature[HOTEND_INDEX];
|
||||||
}
|
}
|
||||||
static int16_t degBed() { return current_temperature_bed; }
|
static float degBed() { return current_temperature_bed; }
|
||||||
|
|
||||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||||
static int16_t rawHotendTemp(uint8_t e) {
|
static int16_t rawHotendTemp(uint8_t e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user