mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 05:48:43 +00:00
Add whole-degree accessors, simplify some temperature-related features (#21685)
This commit is contained in:
parent
384e09aa7c
commit
c4620bb528
@ -40,9 +40,9 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
uint8_t PrinterEventLEDs::old_intensity = 0;
|
||||
|
||||
inline uint8_t pel_intensity(const_float_t start, const_float_t current, const_float_t target) {
|
||||
if (uint16_t(start) == uint16_t(target)) return 255;
|
||||
return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f);
|
||||
inline uint8_t pel_intensity(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
if (start == target) return 255;
|
||||
return (uint8_t)map(constrain(current, start, target), start, target, 0, 255);
|
||||
}
|
||||
|
||||
inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) {
|
||||
@ -58,7 +58,7 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
#if HAS_TEMP_HOTEND
|
||||
|
||||
void PrinterEventLEDs::onHotendHeating(const_float_t start, const_float_t current, const_float_t target) {
|
||||
void PrinterEventLEDs::onHotendHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
const uint8_t blue = pel_intensity(start, current, target);
|
||||
if (blue != old_intensity) {
|
||||
old_intensity = blue;
|
||||
@ -70,7 +70,7 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
|
||||
void PrinterEventLEDs::onBedHeating(const_float_t start, const_float_t current, const_float_t target) {
|
||||
void PrinterEventLEDs::onBedHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
const uint8_t red = pel_intensity(start, current, target);
|
||||
if (red != old_intensity) {
|
||||
old_intensity = red;
|
||||
@ -82,7 +82,7 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
|
||||
void PrinterEventLEDs::onChamberHeating(const_float_t start, const_float_t current, const_float_t target) {
|
||||
void PrinterEventLEDs::onChamberHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
const uint8_t green = pel_intensity(start, current, target);
|
||||
if (green != old_intensity) {
|
||||
old_intensity = green;
|
||||
|
@ -41,21 +41,21 @@ private:
|
||||
public:
|
||||
#if HAS_TEMP_HOTEND
|
||||
static inline LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
|
||||
static void onHotendHeating(const_float_t start, const_float_t current, const_float_t target);
|
||||
static void onHotendHeating(const celsius_t start, const celsius_t current, const celsius_t target);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
static inline LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static void onBedHeating(const_float_t start, const_float_t current, const_float_t target);
|
||||
static void onBedHeating(const celsius_t start, const celsius_t current, const celsius_t target);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static inline LEDColor onChamberHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static void onChamberHeating(const_float_t start, const_float_t current, const_float_t target);
|
||||
static void onChamberHeating(const celsius_t start, const celsius_t current, const celsius_t target);
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER
|
||||
static inline void onHeatingDone() { leds.set_white(); }
|
||||
static inline void onHeatingDone() { leds.set_white(); }
|
||||
static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); }
|
||||
#endif
|
||||
|
||||
|
@ -36,10 +36,10 @@ void handle_status_leds() {
|
||||
static millis_t next_status_led_update_ms = 0;
|
||||
if (ELAPSED(millis(), next_status_led_update_ms)) {
|
||||
next_status_led_update_ms += 500; // Update every 0.5s
|
||||
float max_temp = TERN0(HAS_HEATED_BED, _MAX(thermalManager.degTargetBed(), thermalManager.degBed()));
|
||||
celsius_t max_temp = TERN0(HAS_HEATED_BED, _MAX(thermalManager.degTargetBed(), thermalManager.wholeDegBed()));
|
||||
HOTEND_LOOP()
|
||||
max_temp = _MAX(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
||||
const int8_t new_red = (max_temp > 55.0) ? HIGH : (max_temp < 54.0 || old_red < 0) ? LOW : old_red;
|
||||
max_temp = _MAX(max_temp, thermalManager.wholeDegHotend(e), thermalManager.degTargetHotend(e));
|
||||
const int8_t new_red = (max_temp > 55) ? HIGH : (max_temp < 54 || old_red < 0) ? LOW : old_red;
|
||||
if (new_red != old_red) {
|
||||
old_red = new_red;
|
||||
#if PIN_EXISTS(STAT_LED_RED)
|
||||
|
@ -143,7 +143,7 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
|
||||
|
||||
// Allow interruption by Emergency Parser M108
|
||||
wait_for_heatup = TERN1(PREVENT_COLD_EXTRUSION, !thermalManager.allow_cold_extrude);
|
||||
while (wait_for_heatup && ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW)
|
||||
while (wait_for_heatup && ABS(thermalManager.wholeDegHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > (TEMP_WINDOW))
|
||||
idle();
|
||||
wait_for_heatup = false;
|
||||
|
||||
|
@ -71,7 +71,7 @@ bool ProbeTempComp::set_offset(const TempSensorID tsi, const uint8_t idx, const
|
||||
|
||||
void ProbeTempComp::print_offsets() {
|
||||
LOOP_L_N(s, TSI_COUNT) {
|
||||
float temp = cali_info[s].start_temp;
|
||||
celsius_t temp = cali_info[s].start_temp;
|
||||
for (int16_t i = -1; i < cali_info[s].measurements; ++i) {
|
||||
SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") :
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
@ -114,8 +114,8 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
|
||||
}
|
||||
|
||||
const uint8_t measurements = cali_info[tsi].measurements;
|
||||
const float start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const celsius_t start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
int16_t * const data = sensor_z_offsets[tsi];
|
||||
|
||||
// Extrapolate
|
||||
@ -159,19 +159,19 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const_float_t temp, float &meas_z) {
|
||||
void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius_t temp, float &meas_z) {
|
||||
if (WITHIN(temp, cali_info[tsi].start_temp, cali_info[tsi].end_temp))
|
||||
meas_z -= get_offset_for_temperature(tsi, temp);
|
||||
}
|
||||
|
||||
float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const_float_t temp) {
|
||||
float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const celsius_t temp) {
|
||||
const uint8_t measurements = cali_info[tsi].measurements;
|
||||
const float start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const celsius_t start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const int16_t * const data = sensor_z_offsets[tsi];
|
||||
|
||||
auto point = [&](uint8_t i) {
|
||||
return xy_float_t({start_temp + i*res_temp, static_cast<float>(data[i])});
|
||||
auto point = [&](uint8_t i) -> xy_float_t {
|
||||
return xy_float_t({ static_cast<float>(start_temp) + i * res_temp, static_cast<float>(data[i]) });
|
||||
};
|
||||
|
||||
auto linear_interp = [](const_float_t x, xy_float_t p1, xy_float_t p2) {
|
||||
@ -207,17 +207,18 @@ bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d
|
||||
|
||||
if (!WITHIN(calib_idx, 2, cali_info[tsi].measurements)) return false;
|
||||
|
||||
const float start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const celsius_t start_temp = cali_info[tsi].start_temp,
|
||||
res_temp = cali_info[tsi].temp_res;
|
||||
const int16_t * const data = sensor_z_offsets[tsi];
|
||||
|
||||
float sum_x = start_temp,
|
||||
sum_x2 = sq(start_temp),
|
||||
sum_xy = 0, sum_y = 0;
|
||||
|
||||
float xi = static_cast<float>(start_temp);
|
||||
LOOP_L_N(i, calib_idx) {
|
||||
const float xi = start_temp + (i + 1) * res_temp,
|
||||
yi = static_cast<float>(data[i]);
|
||||
const float yi = static_cast<float>(data[i]);
|
||||
xi += res_temp;
|
||||
sum_x += xi;
|
||||
sum_x2 += sq(xi);
|
||||
sum_xy += xi * yi;
|
||||
|
@ -34,9 +34,9 @@ enum TempSensorID : uint8_t {
|
||||
|
||||
typedef struct {
|
||||
uint8_t measurements; // Max. number of measurements to be stored (35 - 80°C)
|
||||
float temp_res, // Resolution in °C between measurements
|
||||
start_temp, // Base measurement; z-offset == 0
|
||||
end_temp;
|
||||
celsius_t temp_res, // Resolution in °C between measurements
|
||||
start_temp, // Base measurement; z-offset == 0
|
||||
end_temp;
|
||||
} temp_calib_t;
|
||||
|
||||
/**
|
||||
@ -50,25 +50,25 @@ typedef struct {
|
||||
#define PTC_SAMPLE_COUNT 10U
|
||||
#endif
|
||||
#ifndef PTC_SAMPLE_RES
|
||||
#define PTC_SAMPLE_RES 5.0f
|
||||
#define PTC_SAMPLE_RES 5
|
||||
#endif
|
||||
#ifndef PTC_SAMPLE_START
|
||||
#define PTC_SAMPLE_START 30.0f
|
||||
#define PTC_SAMPLE_START 30
|
||||
#endif
|
||||
#define PTC_SAMPLE_END ((PTC_SAMPLE_START) + (PTC_SAMPLE_COUNT) * (PTC_SAMPLE_RES))
|
||||
|
||||
// Bed temperature calibration constants
|
||||
#ifndef BTC_PROBE_TEMP
|
||||
#define BTC_PROBE_TEMP 30.0f
|
||||
#define BTC_PROBE_TEMP 30
|
||||
#endif
|
||||
#ifndef BTC_SAMPLE_COUNT
|
||||
#define BTC_SAMPLE_COUNT 10U
|
||||
#endif
|
||||
#ifndef BTC_SAMPLE_STEP
|
||||
#define BTC_SAMPLE_RES 5.0f
|
||||
#define BTC_SAMPLE_RES 5
|
||||
#endif
|
||||
#ifndef BTC_SAMPLE_START
|
||||
#define BTC_SAMPLE_START 60.0f
|
||||
#define BTC_SAMPLE_START 60
|
||||
#endif
|
||||
#define BTC_SAMPLE_END ((BTC_SAMPLE_START) + (BTC_SAMPLE_COUNT) * (BTC_SAMPLE_RES))
|
||||
|
||||
@ -77,7 +77,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
#ifndef PTC_PROBE_RAISE
|
||||
#define PTC_PROBE_RAISE 10.0f
|
||||
#define PTC_PROBE_RAISE 10
|
||||
#endif
|
||||
|
||||
static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
|
||||
@ -124,7 +124,7 @@ class ProbeTempComp {
|
||||
static void prepare_new_calibration(const_float_t init_meas_z);
|
||||
static void push_back_new_measurement(const TempSensorID tsi, const_float_t meas_z);
|
||||
static bool finish_calibration(const TempSensorID tsi);
|
||||
static void compensate_measurement(const TempSensorID tsi, const_float_t temp, float &meas_z);
|
||||
static void compensate_measurement(const TempSensorID tsi, const celsius_t temp, float &meas_z);
|
||||
|
||||
private:
|
||||
static uint8_t calib_idx;
|
||||
@ -135,7 +135,7 @@ class ProbeTempComp {
|
||||
*/
|
||||
static float init_measurement;
|
||||
|
||||
static float get_offset_for_temperature(const TempSensorID tsi, const_float_t temp);
|
||||
static float get_offset_for_temperature(const TempSensorID tsi, const celsius_t temp);
|
||||
|
||||
/**
|
||||
* Fit a linear function in measured temperature offsets
|
||||
|
@ -103,9 +103,9 @@ void GcodeSuite::G76() {
|
||||
return (timeout && ELAPSED(ms, timeout));
|
||||
};
|
||||
|
||||
auto wait_for_temps = [&](const float tb, const float tp, millis_t &ntr, const millis_t timeout=0) {
|
||||
auto wait_for_temps = [&](const celsius_t tb, const celsius_t tp, millis_t &ntr, const millis_t timeout=0) {
|
||||
say_waiting_for(); SERIAL_ECHOLNPGM("bed and probe temperature.");
|
||||
while (fabs(thermalManager.degBed() - tb) > 0.1f || thermalManager.degProbe() > tp)
|
||||
while (thermalManager.wholeDegBed() != tb || thermalManager.wholeDegProbe() > tp)
|
||||
if (report_temps(ntr, timeout)) return true;
|
||||
return false;
|
||||
};
|
||||
@ -180,7 +180,7 @@ void GcodeSuite::G76() {
|
||||
target_probe = temp_comp.bed_calib_probe_temp;
|
||||
|
||||
say_waiting_for(); SERIAL_ECHOLNPGM(" cooling.");
|
||||
while (thermalManager.degBed() > target_bed || thermalManager.degProbe() > target_probe)
|
||||
while (thermalManager.wholeDegBed() > target_bed || thermalManager.wholeDegProbe() > target_probe)
|
||||
report_temps(next_temp_report);
|
||||
|
||||
// Disable leveling so it won't mess with us
|
||||
@ -204,7 +204,7 @@ void GcodeSuite::G76() {
|
||||
do_blocking_move_to(noz_pos_xyz);
|
||||
say_waiting_for_probe_heating();
|
||||
SERIAL_EOL();
|
||||
while (thermalManager.degProbe() < target_probe)
|
||||
while (thermalManager.wholeDegProbe() < target_probe)
|
||||
report_temps(next_temp_report);
|
||||
|
||||
const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
|
||||
@ -350,7 +350,7 @@ void GcodeSuite::M192() {
|
||||
return;
|
||||
}
|
||||
|
||||
const float target_temp = parser.value_celsius();
|
||||
const celsius_t target_temp = parser.value_celsius();
|
||||
ui.set_status_P(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT(MSG_PROBE_HEATING) : GET_TEXT(MSG_PROBE_COOLING));
|
||||
thermalManager.wait_for_probe(target_temp, no_wait_for_cooling);
|
||||
}
|
||||
|
@ -525,10 +525,10 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) {
|
||||
#if HAS_HEATED_BED
|
||||
const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0);
|
||||
const celsius_t t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater_id)),
|
||||
const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
|
||||
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
|
||||
#else
|
||||
const celsius_t t1 = thermalManager.degHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||
const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||
#endif
|
||||
|
||||
if (prefix >= 0) lcd_put_wchar(prefix);
|
||||
@ -557,11 +557,11 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr
|
||||
|
||||
#if HAS_COOLER
|
||||
FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
|
||||
const float t1 = thermalManager.degCooler(), t2 = thermalManager.degTargetCooler();
|
||||
const celsius_t t2 = thermalManager.degTargetCooler();
|
||||
|
||||
if (prefix >= 0) lcd_put_wchar(prefix);
|
||||
|
||||
lcd_put_u8str(i16tostr3rj(t1 + 0.5));
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegCooler()));
|
||||
lcd_put_wchar('/');
|
||||
|
||||
#if !HEATER_IDLE_HANDLER
|
||||
@ -574,7 +574,7 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
|
||||
}
|
||||
else
|
||||
#endif
|
||||
lcd_put_u8str(i16tostr3left(t2 + 0.5));
|
||||
lcd_put_u8str(i16tostr3left(t2));
|
||||
|
||||
if (prefix >= 0) {
|
||||
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
||||
|
@ -434,10 +434,10 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
|
||||
uint8_t pic_hot_bits;
|
||||
#if HAS_HEATED_BED
|
||||
const bool isBed = heater_id < 0;
|
||||
const celsius_t t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater_id)),
|
||||
const celsius_t t1 = (isBed ? thermalManager.wholeDegBed() : thermalManager.wholeDegHotend(heater_id)),
|
||||
t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id));
|
||||
#else
|
||||
const celsius_t t1 = thermalManager.degHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||
const celsius_t t1 = thermalManager.wholeDegHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id);
|
||||
#endif
|
||||
|
||||
#if HOTENDS < 2
|
||||
@ -803,7 +803,7 @@ void MarlinUI::draw_status_screen() {
|
||||
if (!PanelDetected) return;
|
||||
lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
|
||||
lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str_P(PSTR(" E")); lcd.write('1' + extruder); lcd.write(' ');
|
||||
lcd.print(i16tostr3rj(thermalManager.degHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
|
||||
lcd.print(i16tostr3rj(thermalManager.wholeDegHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
|
||||
lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
|
||||
lcd.print_line();
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
|
||||
lcd_put_wchar((char)('1' + extruder));
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.degHotend(extruder)));
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
lcd_put_wchar('/');
|
||||
|
||||
if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
|
||||
|
@ -213,7 +213,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
|
||||
|
||||
const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id);
|
||||
|
||||
const celsius_t temp = thermalManager.degHotend(heater_id),
|
||||
const celsius_t temp = thermalManager.wholeDegHotend(heater_id),
|
||||
target = thermalManager.degTargetHotend(heater_id);
|
||||
|
||||
#if DISABLED(STATUS_HOTEND_ANIM)
|
||||
@ -310,7 +310,7 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
|
||||
|
||||
const uint8_t tx = STATUS_BED_TEXT_X;
|
||||
|
||||
const celsius_t temp = thermalManager.degBed(),
|
||||
const celsius_t temp = thermalManager.wholeDegBed(),
|
||||
target = thermalManager.degTargetBed();
|
||||
|
||||
#if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
|
||||
@ -380,14 +380,14 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co
|
||||
_draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
|
||||
#endif
|
||||
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
||||
_draw_centered_temp(thermalManager.degChamber(), STATUS_CHAMBER_TEXT_X, 28);
|
||||
_draw_centered_temp(thermalManager.wholeDegChamber(), STATUS_CHAMBER_TEXT_X, 28);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DO_DRAW_COOLER
|
||||
FORCE_INLINE void _draw_cooler_status() {
|
||||
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
||||
_draw_centered_temp(thermalManager.degCooler(), STATUS_COOLER_TEXT_X, 28);
|
||||
_draw_centered_temp(thermalManager.wholeDegCooler(), STATUS_COOLER_TEXT_X, 28);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -721,14 +721,14 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
|
||||
const duration_t elapsed = print_job_timer.duration();
|
||||
duration_t remaining = TERN0(USE_M73_REMAINING_TIME, ui.get_remaining_time());
|
||||
const uint16_t feedrate_perc = feedrate_percentage;
|
||||
const celsius_t extruder_1_temp = thermalManager.degHotend(0),
|
||||
const celsius_t extruder_1_temp = thermalManager.wholeDegHotend(0),
|
||||
extruder_1_target = thermalManager.degTargetHotend(0);
|
||||
#if HAS_MULTI_HOTEND
|
||||
const celsius_t extruder_2_temp = thermalManager.degHotend(1),
|
||||
const celsius_t extruder_2_temp = thermalManager.wholeDegHotend(1),
|
||||
extruder_2_target = thermalManager.degTargetHotend(1);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
const celsius_t bed_temp = thermalManager.degBed(),
|
||||
const celsius_t bed_temp = thermalManager.wholeDegBed(),
|
||||
bed_target = thermalManager.degTargetBed();
|
||||
#endif
|
||||
|
||||
|
@ -1583,7 +1583,7 @@ void _draw_xyz_position(const bool force) {
|
||||
void update_variable() {
|
||||
#if HAS_HOTEND
|
||||
static celsius_t _hotendtemp = 0, _hotendtarget = 0;
|
||||
const celsius_t hc = thermalManager.degHotend(0),
|
||||
const celsius_t hc = thermalManager.wholeDegHotend(0),
|
||||
ht = thermalManager.degTargetHotend(0);
|
||||
const bool _new_hotend_temp = _hotendtemp != hc,
|
||||
_new_hotend_target = _hotendtarget != ht;
|
||||
@ -1592,7 +1592,7 @@ void update_variable() {
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
static celsius_t _bedtemp = 0, _bedtarget = 0;
|
||||
const celsius_t bc = thermalManager.degBed(),
|
||||
const celsius_t bc = thermalManager.wholeDegBed(),
|
||||
bt = thermalManager.degTargetBed();
|
||||
const bool _new_bed_temp = _bedtemp != bc,
|
||||
_new_bed_target = _bedtarget != bt;
|
||||
@ -1880,7 +1880,7 @@ void Draw_Status_Area(const bool with_update) {
|
||||
|
||||
#if HAS_HOTEND
|
||||
DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
|
||||
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.degHotend(0));
|
||||
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.wholeDegHotend(0));
|
||||
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
|
||||
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
|
||||
|
||||
@ -1891,7 +1891,7 @@ void Draw_Status_Area(const bool with_update) {
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
|
||||
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.degBed());
|
||||
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.wholeDegBed());
|
||||
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
|
||||
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
|
||||
#endif
|
||||
@ -2709,7 +2709,7 @@ void HMI_AxisMove() {
|
||||
case 4: // Extruder
|
||||
// window tips
|
||||
#ifdef PREVENT_COLD_EXTRUSION
|
||||
if (thermalManager.degHotend(0) < EXTRUDE_MINTEMP) {
|
||||
if (thermalManager.wholeDegHotend(0) < (EXTRUDE_MINTEMP)) {
|
||||
HMI_flag.ETempTooLow_flag = true;
|
||||
Popup_Window_ETempTooLow();
|
||||
DWIN_UpdateLCD();
|
||||
|
@ -486,7 +486,7 @@ void lv_draw_dialog(uint8_t type) {
|
||||
|
||||
void filament_sprayer_temp() {
|
||||
char buf[20] = {0};
|
||||
sprintf(buf, preheat_menu.value_state, thermalManager.degHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
|
||||
strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
|
||||
strcat_P(public_buf_l, PSTR(": "));
|
||||
@ -522,7 +522,7 @@ void filament_dialog_handle() {
|
||||
}
|
||||
|
||||
if (uiCfg.filament_load_heat_flg) {
|
||||
const celsius_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
||||
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
||||
if (abs(diff) < 2 || diff > 0) {
|
||||
uiCfg.filament_load_heat_flg = false;
|
||||
lv_clear_dialog();
|
||||
@ -538,7 +538,7 @@ void filament_dialog_handle() {
|
||||
}
|
||||
|
||||
if (uiCfg.filament_unload_heat_flg) {
|
||||
const celsius_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
||||
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
||||
if (abs(diff) < 2 || diff > 0) {
|
||||
uiCfg.filament_unload_heat_flg = false;
|
||||
lv_clear_dialog();
|
||||
|
@ -195,7 +195,7 @@ void disp_ext_speed() {
|
||||
|
||||
void disp_hotend_temp() {
|
||||
char buf[20] = {0};
|
||||
sprintf(buf, extrude_menu.temp_value, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
sprintf(buf, extrude_menu.temp_value, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
strcpy(public_buf_l, extrude_menu.temper_text);
|
||||
strcat(public_buf_l, buf);
|
||||
lv_label_set_text(tempText, public_buf_l);
|
||||
|
@ -50,8 +50,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
switch (obj->mks_obj_id) {
|
||||
case ID_FILAMNT_IN:
|
||||
uiCfg.filament_load_heat_flg = true;
|
||||
if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1
|
||||
|| gCfgItems.filament_limit_temp <= thermalManager.degHotend(uiCfg.extruderIndex)) {
|
||||
if (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|
||||
|| gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)) {
|
||||
lv_clear_filament_change();
|
||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
|
||||
}
|
||||
@ -67,8 +67,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
case ID_FILAMNT_OUT:
|
||||
uiCfg.filament_unload_heat_flg = true;
|
||||
if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
|
||||
&& (abs((int)(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1
|
||||
|| thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
|
||||
&& (abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|
||||
|| thermalManager.wholeDegHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp)
|
||||
) {
|
||||
lv_clear_filament_change();
|
||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
|
||||
@ -154,7 +154,7 @@ void disp_filament_temp() {
|
||||
public_buf_l[0] = '\0';
|
||||
|
||||
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
|
||||
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
|
||||
strcat_P(public_buf_l, PSTR(": "));
|
||||
strcat(public_buf_l, buf);
|
||||
|
@ -216,12 +216,12 @@ void disp_desire_temp() {
|
||||
|
||||
if (uiCfg.curTempType == 0) {
|
||||
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
|
||||
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||
}
|
||||
else {
|
||||
#if HAS_HEATED_BED
|
||||
strcat(public_buf_l, preheat_menu.hotbed);
|
||||
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
|
||||
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
|
||||
#endif
|
||||
}
|
||||
strcat_P(public_buf_l, PSTR(": "));
|
||||
|
@ -219,18 +219,18 @@ void lv_draw_printing() {
|
||||
}
|
||||
|
||||
void disp_ext_temp() {
|
||||
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
|
||||
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
|
||||
lv_label_set_text(labelExt1, public_buf_l);
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
|
||||
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
|
||||
lv_label_set_text(labelExt2, public_buf_l);
|
||||
#endif
|
||||
}
|
||||
|
||||
void disp_bed_temp() {
|
||||
#if HAS_HEATED_BED
|
||||
sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
|
||||
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
|
||||
lv_label_set_text(labelBed, public_buf_l);
|
||||
#endif
|
||||
}
|
||||
|
@ -104,14 +104,14 @@ void disp_det_error() {
|
||||
lv_obj_t *e1, *e2, *e3, *bed;
|
||||
void mks_disp_test() {
|
||||
char buf[30] = {0};
|
||||
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
|
||||
sprintf_P(buf, PSTR("e1:%d"), thermalManager.wholeDegHotend(0));
|
||||
lv_label_set_text(e1, buf);
|
||||
#if HAS_MULTI_HOTEND
|
||||
sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
|
||||
sprintf_P(buf, PSTR("e2:%d"), thermalManager.wholeDegHotend(1));
|
||||
lv_label_set_text(e2, buf);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.degBed());
|
||||
sprintf_P(buf, PSTR("bed:%d"), thermalManager.wholeDegBed());
|
||||
lv_label_set_text(bed, buf);
|
||||
#endif
|
||||
}
|
||||
@ -138,20 +138,20 @@ void lv_draw_ready_print() {
|
||||
|
||||
e1 = lv_label_create_empty(scr);
|
||||
lv_obj_set_pos(e1, 20, 20);
|
||||
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0));
|
||||
sprintf_P(buf, PSTR("e1: %d"), thermalManager.wholeDegHotend(0));
|
||||
lv_label_set_text(e1, buf);
|
||||
|
||||
#if HAS_MULTI_HOTEND
|
||||
e2 = lv_label_create_empty(scr);
|
||||
lv_obj_set_pos(e2, 20, 45);
|
||||
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1));
|
||||
sprintf_P(buf, PSTR("e1: %d"), thermalManager.wholeDegHotend(1));
|
||||
lv_label_set_text(e2, buf);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
bed = lv_label_create_empty(scr);
|
||||
lv_obj_set_pos(bed, 20, 95);
|
||||
sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.degBed());
|
||||
sprintf_P(buf, PSTR("bed: %d"), thermalManager.wholeDegBed());
|
||||
lv_label_set_text(bed, buf);
|
||||
#endif
|
||||
|
||||
@ -219,7 +219,7 @@ void lv_draw_ready_print() {
|
||||
itoa(thermalManager.degHotend(0), buf, 10);
|
||||
lv_label_set_text(labelExt1, buf);
|
||||
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
|
||||
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
|
||||
lv_label_set_text(labelExt1Target, buf);
|
||||
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||
|
||||
@ -227,7 +227,7 @@ void lv_draw_ready_print() {
|
||||
itoa(thermalManager.degHotend(1), buf, 10);
|
||||
lv_label_set_text(labelExt2, buf);
|
||||
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
|
||||
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
|
||||
lv_label_set_text(labelExt2Target, buf);
|
||||
lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||
#endif
|
||||
@ -236,7 +236,7 @@ void lv_draw_ready_print() {
|
||||
itoa(thermalManager.degBed(), buf, 10);
|
||||
lv_label_set_text(labelBed, buf);
|
||||
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());
|
||||
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
|
||||
lv_label_set_text(labelBedTarget, buf);
|
||||
lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||
#endif
|
||||
@ -257,15 +257,15 @@ void lv_draw_ready_print() {
|
||||
|
||||
void lv_temp_refr() {
|
||||
#if HAS_HEATED_BED
|
||||
sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
|
||||
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
|
||||
lv_label_set_text(labelBed, public_buf_l);
|
||||
#endif
|
||||
|
||||
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
|
||||
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
|
||||
lv_label_set_text(labelExt1, public_buf_l);
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
|
||||
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
|
||||
lv_label_set_text(labelExt2, public_buf_l);
|
||||
#endif
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
char *outBuf = (char *)tempBuf;
|
||||
char tbuf[34];
|
||||
|
||||
sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
|
||||
sprintf_P(tbuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
|
||||
|
||||
const int tlen = strlen(tbuf);
|
||||
|
||||
@ -895,7 +895,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
strcpy_P(outBuf, PSTR(" B:"));
|
||||
outBuf += 3;
|
||||
#if HAS_HEATED_BED
|
||||
sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degBed(), (int)thermalManager.degTargetBed());
|
||||
sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegBed(), thermalManager.degTargetBed());
|
||||
#else
|
||||
strcpy_P(outBuf, PSTR("0 /0"));
|
||||
#endif
|
||||
@ -908,7 +908,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
strcat_P(outBuf, PSTR(" T1:"));
|
||||
outBuf += 4;
|
||||
#if HAS_MULTI_HOTEND
|
||||
sprintf_P(outBuf, PSTR("%d /%d"), (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
|
||||
sprintf_P(outBuf, PSTR("%d /%d"), thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
|
||||
#else
|
||||
strcat_P(outBuf, PSTR("0 /0"));
|
||||
#endif
|
||||
@ -918,15 +918,15 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
}
|
||||
else {
|
||||
sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
|
||||
thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
|
||||
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
|
||||
#if HAS_HEATED_BED
|
||||
thermalManager.degBed(), thermalManager.degTargetBed(),
|
||||
thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
|
||||
#else
|
||||
0, 0,
|
||||
#endif
|
||||
thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
|
||||
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
|
||||
#if HAS_MULTI_HOTEND
|
||||
thermalManager.degHotend(1), thermalManager.degTargetHotend(1)
|
||||
thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1)
|
||||
#else
|
||||
0, 0
|
||||
#endif
|
||||
|
@ -172,9 +172,9 @@ void process_lcd_eb_command(const char *command) {
|
||||
|
||||
sprintf_P(message_buffer,
|
||||
PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}{TQ:%03i}{TT:%s}"),
|
||||
int(thermalManager.degHotend(0)), thermalManager.degTargetHotend(0),
|
||||
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
|
||||
#if HAS_HEATED_BED
|
||||
int(thermalManager.degBed()), thermalManager.degTargetBed(),
|
||||
thermalManager.wholeDegBed(), thermalManager.degTargetBed(),
|
||||
#else
|
||||
0, 0,
|
||||
#endif
|
||||
@ -303,9 +303,9 @@ void process_lcd_s_command(const char *command) {
|
||||
// temperature information
|
||||
char message_buffer[MAX_CURLY_COMMAND];
|
||||
sprintf_P(message_buffer, PSTR("{T0:%03i/%03i}{T1:000/000}{TP:%03i/%03i}"),
|
||||
int(thermalManager.degHotend(0)), thermalManager.degTargetHotend(0),
|
||||
thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0),
|
||||
#if HAS_HEATED_BED
|
||||
int(thermalManager.degBed()), thermalManager.degTargetBed()
|
||||
thermalManager.wholeDegBed(), thermalManager.degTargetBed()
|
||||
#else
|
||||
0, 0
|
||||
#endif
|
||||
|
@ -918,7 +918,7 @@ namespace ExtUI {
|
||||
thermalManager.updatePID();
|
||||
}
|
||||
|
||||
void startPIDTune(const_float_t temp, extruder_t tool) {
|
||||
void startPIDTune(const celsius_t temp, extruder_t tool) {
|
||||
thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true);
|
||||
}
|
||||
#endif
|
||||
@ -935,7 +935,7 @@ namespace ExtUI {
|
||||
thermalManager.updatePID();
|
||||
}
|
||||
|
||||
void startBedPIDTune(const_float_t temp) {
|
||||
void startBedPIDTune(const celsius_t temp) {
|
||||
thermalManager.PID_autotune(temp, H_BED, 4, true);
|
||||
}
|
||||
#endif
|
||||
|
@ -117,18 +117,18 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
||||
celsius_t currentTemperature, targetTemperature;
|
||||
|
||||
if (Heater >= 0) { // HotEnd
|
||||
currentTemperature = thermalManager.degHotend(Heater);
|
||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
||||
}
|
||||
#if HAS_HEATED_BED
|
||||
else if (Heater == H_BED) {
|
||||
currentTemperature = thermalManager.degBed();
|
||||
currentTemperature = thermalManager.wholeDegBed();
|
||||
targetTemperature = thermalManager.degTargetBed();
|
||||
}
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
else if (Heater == H_CHAMBER) {
|
||||
currentTemperature = thermalManager.degChamber();
|
||||
currentTemperature = thermalManager.wholeDegChamber();
|
||||
#if HAS_HEATED_CHAMBER
|
||||
targetTemperature = thermalManager.degTargetChamber();
|
||||
#else
|
||||
@ -138,7 +138,7 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
||||
#endif
|
||||
#if HAS_TEMP_COOLER
|
||||
else if (Heater == H_COOLER) {
|
||||
currentTemperature = thermalManager.degCooler();
|
||||
currentTemperature = thermalManager.wholeDegCooler();
|
||||
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
||||
}
|
||||
#endif
|
||||
@ -451,7 +451,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
||||
tft_string.add('E');
|
||||
tft_string.add((char)('1' + extruder));
|
||||
tft_string.add(' ');
|
||||
tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
|
||||
tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.add(" / ");
|
||||
tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
|
@ -117,18 +117,18 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
||||
celsius_t currentTemperature, targetTemperature;
|
||||
|
||||
if (Heater >= 0) { // HotEnd
|
||||
currentTemperature = thermalManager.degHotend(Heater);
|
||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
||||
}
|
||||
#if HAS_HEATED_BED
|
||||
else if (Heater == H_BED) {
|
||||
currentTemperature = thermalManager.degBed();
|
||||
currentTemperature = thermalManager.wholeDegBed();
|
||||
targetTemperature = thermalManager.degTargetBed();
|
||||
}
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
else if (Heater == H_CHAMBER) {
|
||||
currentTemperature = thermalManager.degChamber();
|
||||
currentTemperature = thermalManager.wholeDegChamber();
|
||||
#if HAS_HEATED_CHAMBER
|
||||
targetTemperature = thermalManager.degTargetChamber();
|
||||
#else
|
||||
@ -138,7 +138,7 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
||||
#endif
|
||||
#if HAS_TEMP_COOLER
|
||||
else if (Heater == H_COOLER) {
|
||||
currentTemperature = thermalManager.degCooler();
|
||||
currentTemperature = thermalManager.wholeDegCooler();
|
||||
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
||||
}
|
||||
#endif
|
||||
@ -438,7 +438,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
||||
tft_string.add('E');
|
||||
tft_string.add((char)('1' + extruder));
|
||||
tft_string.add(' ');
|
||||
tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
|
||||
tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.add(" / ");
|
||||
tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
|
@ -117,18 +117,18 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
||||
celsius_t currentTemperature, targetTemperature;
|
||||
|
||||
if (Heater >= 0) { // HotEnd
|
||||
currentTemperature = thermalManager.degHotend(Heater);
|
||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
||||
}
|
||||
#if HAS_HEATED_BED
|
||||
else if (Heater == H_BED) {
|
||||
currentTemperature = thermalManager.degBed();
|
||||
currentTemperature = thermalManager.wholeDegBed();
|
||||
targetTemperature = thermalManager.degTargetBed();
|
||||
}
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
else if (Heater == H_CHAMBER) {
|
||||
currentTemperature = thermalManager.degChamber();
|
||||
currentTemperature = thermalManager.wholeDegChamber();
|
||||
#if HAS_HEATED_CHAMBER
|
||||
targetTemperature = thermalManager.degTargetChamber();
|
||||
#else
|
||||
@ -138,7 +138,7 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
||||
#endif
|
||||
#if HAS_TEMP_COOLER
|
||||
else if (Heater == H_COOLER) {
|
||||
currentTemperature = thermalManager.degCooler();
|
||||
currentTemperature = thermalManager.wholeDegCooler();
|
||||
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
||||
}
|
||||
#endif
|
||||
@ -438,7 +438,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
||||
tft_string.add('E');
|
||||
tft_string.add((char)('1' + extruder));
|
||||
tft_string.add(' ');
|
||||
tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
|
||||
tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.add(" / ");
|
||||
tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
|
@ -383,8 +383,8 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
||||
|
||||
DEBUG_EOL();
|
||||
|
||||
TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.degHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
|
||||
TERN_(WAIT_FOR_BED_HEAT, if (bed_temp > thermalManager.degBed() + (TEMP_BED_WINDOW)) thermalManager.wait_for_bed_heating());
|
||||
TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.wholeDegHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
|
||||
TERN_(WAIT_FOR_BED_HEAT, if (bed_temp > thermalManager.wholeDegBed() + (TEMP_BED_WINDOW)) thermalManager.wait_for_bed_heating());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -499,7 +499,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
||||
* Needs sufficient heater power to make some overshoot at target
|
||||
* temperature to succeed.
|
||||
*/
|
||||
void Temperature::PID_autotune(const_float_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) {
|
||||
void Temperature::PID_autotune(const celsius_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) {
|
||||
float current_temp = 0.0;
|
||||
int cycles = 0;
|
||||
bool heating = true;
|
||||
@ -3815,10 +3815,10 @@ void Temperature::isr() {
|
||||
#define MIN_DELTA_SLOPE_TIME_PROBE 600
|
||||
#endif
|
||||
|
||||
bool Temperature::wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling/*=true*/) {
|
||||
bool Temperature::wait_for_probe(const celsius_t target_temp, bool no_wait_for_cooling/*=true*/) {
|
||||
|
||||
const bool wants_to_cool = isProbeAboveTemp(target_temp);
|
||||
const bool will_wait = !(wants_to_cool && no_wait_for_cooling);
|
||||
const bool wants_to_cool = isProbeAboveTemp(target_temp),
|
||||
will_wait = !(wants_to_cool && no_wait_for_cooling);
|
||||
if (will_wait)
|
||||
SERIAL_ECHOLNPAIR("Waiting for probe to ", (wants_to_cool ? PSTR("cool down") : PSTR("heat up")), " to ", target_temp, " degrees.");
|
||||
|
||||
|
@ -358,12 +358,8 @@ class Temperature {
|
||||
static bool allow_cold_extrude;
|
||||
static celsius_t extrude_min_temp;
|
||||
static inline bool tooCold(const celsius_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); }
|
||||
static inline bool tooColdToExtrude(const uint8_t E_NAME) {
|
||||
return tooCold(degHotend(HOTEND_INDEX));
|
||||
}
|
||||
static inline bool targetTooColdToExtrude(const uint8_t E_NAME) {
|
||||
return tooCold(degTargetHotend(HOTEND_INDEX));
|
||||
}
|
||||
static inline bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); }
|
||||
static inline bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); }
|
||||
#else
|
||||
static inline bool tooColdToExtrude(const uint8_t) { return false; }
|
||||
static inline bool targetTooColdToExtrude(const uint8_t) { return false; }
|
||||
@ -635,6 +631,10 @@ class Temperature {
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
|
||||
}
|
||||
|
||||
static inline celsius_t wholeDegHotend(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, static_cast<celsius_t>(temp_hotend[HOTEND_INDEX].celsius + 0.5f));
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static inline int16_t rawHotendTemp(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].raw);
|
||||
@ -687,11 +687,11 @@ class Temperature {
|
||||
#endif
|
||||
|
||||
static inline bool still_heating(const uint8_t e) {
|
||||
return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
|
||||
return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(wholeDegHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS;
|
||||
}
|
||||
|
||||
static inline bool degHotendNear(const uint8_t e, const_float_t temp) {
|
||||
return ABS(degHotend(e) - temp) < (TEMP_HYSTERESIS);
|
||||
static inline bool degHotendNear(const uint8_t e, const celsius_t temp) {
|
||||
return ABS(wholeDegHotend(e) - temp) < (TEMP_HYSTERESIS);
|
||||
}
|
||||
|
||||
#endif // HAS_HOTEND
|
||||
@ -702,6 +702,7 @@ class Temperature {
|
||||
static inline int16_t rawBedTemp() { return temp_bed.raw; }
|
||||
#endif
|
||||
static inline celsius_t degBed() { return temp_bed.celsius; }
|
||||
static inline celsius_t wholeDegBed() { return static_cast<celsius_t>(degBed() + 0.5f); }
|
||||
static inline celsius_t degTargetBed() { return temp_bed.target; }
|
||||
static inline bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; }
|
||||
static inline bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; }
|
||||
@ -726,8 +727,8 @@ class Temperature {
|
||||
|
||||
static void wait_for_bed_heating();
|
||||
|
||||
static inline bool degBedNear(const_float_t temp) {
|
||||
return ABS(degBed() - temp) < (TEMP_BED_HYSTERESIS);
|
||||
static inline bool degBedNear(const celsius_t temp) {
|
||||
return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS);
|
||||
}
|
||||
|
||||
#endif // HAS_HEATED_BED
|
||||
@ -737,9 +738,10 @@ class Temperature {
|
||||
static inline int16_t rawProbeTemp() { return temp_probe.raw; }
|
||||
#endif
|
||||
static inline celsius_t degProbe() { return temp_probe.celsius; }
|
||||
static inline bool isProbeBelowTemp(const_float_t target_temp) { return temp_probe.celsius < target_temp; }
|
||||
static inline bool isProbeAboveTemp(const_float_t target_temp) { return temp_probe.celsius > target_temp; }
|
||||
static bool wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling=true);
|
||||
static inline celsius_t wholeDegProbe() { return static_cast<celsius_t>(degProbe() + 0.5f); }
|
||||
static inline bool isProbeBelowTemp(const celsius_t target_temp) { return wholeDegProbe() < target_temp; }
|
||||
static inline bool isProbeAboveTemp(const celsius_t target_temp) { return wholeDegProbe() > target_temp; }
|
||||
static bool wait_for_probe(const celsius_t target_temp, bool no_wait_for_cooling=true);
|
||||
#endif
|
||||
|
||||
#if WATCH_PROBE
|
||||
@ -753,6 +755,7 @@ class Temperature {
|
||||
static inline int16_t rawChamberTemp() { return temp_chamber.raw; }
|
||||
#endif
|
||||
static inline celsius_t degChamber() { return temp_chamber.celsius; }
|
||||
static inline celsius_t wholeDegChamber() { return static_cast<celsius_t>(degChamber() + 0.5f); }
|
||||
#if HAS_HEATED_CHAMBER
|
||||
static inline celsius_t degTargetChamber() { return temp_chamber.target; }
|
||||
static inline bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; }
|
||||
@ -779,6 +782,7 @@ class Temperature {
|
||||
static inline int16_t rawCoolerTemp() { return temp_cooler.raw; }
|
||||
#endif
|
||||
static inline celsius_t degCooler() { return temp_cooler.celsius; }
|
||||
static inline celsius_t wholeDegCooler() { return static_cast<celsius_t>(temp_cooler.celsius + 0.5f); }
|
||||
#if HAS_COOLER
|
||||
static inline celsius_t degTargetCooler() { return temp_cooler.target; }
|
||||
static inline bool isLaserHeating() { return temp_cooler.target > temp_cooler.celsius; }
|
||||
@ -827,7 +831,7 @@ class Temperature {
|
||||
static bool pid_debug_flag;
|
||||
#endif
|
||||
|
||||
static void PID_autotune(const_float_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false);
|
||||
static void PID_autotune(const celsius_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false);
|
||||
|
||||
#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
|
||||
static bool adaptive_fan_slowing;
|
||||
|
Loading…
Reference in New Issue
Block a user