|
@@ -382,7 +382,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
382
|
382
|
chamber_info_t Temperature::temp_chamber; // = { 0 }
|
383
|
383
|
#if HAS_HEATED_CHAMBER
|
384
|
384
|
millis_t next_cool_check_ms_2 = 0;
|
385
|
|
- float old_temp = 9999;
|
|
385
|
+ celsius_float_t old_temp = 9999;
|
386
|
386
|
int16_t Temperature::mintemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_LO_TEMP,
|
387
|
387
|
Temperature::maxtemp_raw_CHAMBER = TEMP_SENSOR_CHAMBER_RAW_HI_TEMP;
|
388
|
388
|
TERN_(WATCH_CHAMBER, chamber_watch_t Temperature::watch_chamber{0});
|
|
@@ -395,7 +395,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
395
|
395
|
#if HAS_COOLER
|
396
|
396
|
bool flag_cooler_state;
|
397
|
397
|
//bool flag_cooler_excess = false;
|
398
|
|
- float previous_temp = 9999;
|
|
398
|
+ celsius_float_t previous_temp = 9999;
|
399
|
399
|
int16_t Temperature::mintemp_raw_COOLER = TEMP_SENSOR_COOLER_RAW_LO_TEMP,
|
400
|
400
|
Temperature::maxtemp_raw_COOLER = TEMP_SENSOR_COOLER_RAW_HI_TEMP;
|
401
|
401
|
#if WATCH_COOLER
|
|
@@ -421,8 +421,8 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
|
421
|
421
|
#endif
|
422
|
422
|
|
423
|
423
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
424
|
|
- celsius_t Temperature::redundant_temperature_raw = 0;
|
425
|
|
- float Temperature::redundant_temperature = 0.0;
|
|
424
|
+ int16_t Temperature::redundant_temperature_raw = 0;
|
|
425
|
+ celsius_float_t Temperature::redundant_temperature = 0.0;
|
426
|
426
|
#endif
|
427
|
427
|
|
428
|
428
|
volatile bool Temperature::raw_temps_ready = false;
|
|
@@ -508,7 +508,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
508
|
508
|
long t_high = 0, t_low = 0;
|
509
|
509
|
|
510
|
510
|
PID_t tune_pid = { 0, 0, 0 };
|
511
|
|
- float maxT = 0, minT = 10000;
|
|
511
|
+ celsius_float_t maxT = 0, minT = 10000;
|
512
|
512
|
|
513
|
513
|
const bool isbed = (heater_id == H_BED);
|
514
|
514
|
const bool ischamber = (heater_id == H_CHAMBER);
|
|
@@ -544,9 +544,9 @@ volatile bool Temperature::raw_temps_ready = false;
|
544
|
544
|
#define GTV(C,B,H) C_GTV(ischamber, C, B_GTV(isbed, B, H))
|
545
|
545
|
const uint16_t watch_temp_period = GTV(WATCH_CHAMBER_TEMP_PERIOD, WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD);
|
546
|
546
|
const uint8_t watch_temp_increase = GTV(WATCH_CHAMBER_TEMP_INCREASE, WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE);
|
547
|
|
- const float watch_temp_target = target - float(watch_temp_increase + GTV(TEMP_CHAMBER_HYSTERESIS, TEMP_BED_HYSTERESIS, TEMP_HYSTERESIS) + 1);
|
|
547
|
+ const celsius_float_t watch_temp_target = celsius_float_t(target - watch_temp_increase + GTV(TEMP_CHAMBER_HYSTERESIS, TEMP_BED_HYSTERESIS, TEMP_HYSTERESIS) + 1);
|
548
|
548
|
millis_t temp_change_ms = next_temp_ms + SEC_TO_MS(watch_temp_period);
|
549
|
|
- float next_watch_temp = 0.0;
|
|
549
|
+ celsius_float_t next_watch_temp = 0.0;
|
550
|
550
|
bool heated = false;
|
551
|
551
|
#endif
|
552
|
552
|
|
|
@@ -567,7 +567,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
567
|
567
|
SHV(bias);
|
568
|
568
|
|
569
|
569
|
#if ENABLED(PRINTER_EVENT_LEDS)
|
570
|
|
- const float start_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius);
|
|
570
|
+ const celsius_float_t start_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius);
|
571
|
571
|
LEDColor color = ONHEATINGSTART();
|
572
|
572
|
#endif
|
573
|
573
|
|
|
@@ -2338,7 +2338,7 @@ void Temperature::init() {
|
2338
|
2338
|
*
|
2339
|
2339
|
* TODO: Embed the last 3 parameters during init, if not less optimal
|
2340
|
2340
|
*/
|
2341
|
|
- void Temperature::tr_state_machine_t::run(const_float_t current, const_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) {
|
|
2341
|
+ void Temperature::tr_state_machine_t::run(const_celsius_float_t current, const_celsius_float_t target, const heater_id_t heater_id, const uint16_t period_seconds, const celsius_t hysteresis_degc) {
|
2342
|
2342
|
|
2343
|
2343
|
#if HEATER_IDLE_HANDLER
|
2344
|
2344
|
// Convert the given heater_id_t to an idle array index
|
|
@@ -3373,7 +3373,16 @@ void Temperature::isr() {
|
3373
|
3373
|
|
3374
|
3374
|
#include "../gcode/gcode.h"
|
3375
|
3375
|
|
3376
|
|
- static void print_heater_state(const_float_t c, const_float_t t
|
|
3376
|
+ /**
|
|
3377
|
+ * Print a single heater state in the form:
|
|
3378
|
+ * Bed: " B:nnn.nn /nnn.nn"
|
|
3379
|
+ * Chamber: " C:nnn.nn /nnn.nn"
|
|
3380
|
+ * Probe: " P:nnn.nn /nnn.nn"
|
|
3381
|
+ * Cooler: " L:nnn.nn /nnn.nn"
|
|
3382
|
+ * Extruder: " T0:nnn.nn /nnn.nn"
|
|
3383
|
+ * With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
|
|
3384
|
+ */
|
|
3385
|
+ static void print_heater_state(const_celsius_float_t c, const_celsius_float_t t
|
3377
|
3386
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
3378
|
3387
|
, const float r
|
3379
|
3388
|
#endif
|
|
@@ -3557,12 +3566,12 @@ void Temperature::isr() {
|
3557
|
3566
|
#endif
|
3558
|
3567
|
|
3559
|
3568
|
#if ENABLED(PRINTER_EVENT_LEDS)
|
3560
|
|
- const float start_temp = degHotend(target_extruder);
|
|
3569
|
+ const celsius_float_t start_temp = degHotend(target_extruder);
|
3561
|
3570
|
printerEventLEDs.onHotendHeatingStart();
|
3562
|
3571
|
#endif
|
3563
|
3572
|
|
3564
|
3573
|
bool wants_to_cool = false;
|
3565
|
|
- float target_temp = -1.0, old_temp = 9999.0;
|
|
3574
|
+ celsius_float_t target_temp = -1.0, old_temp = 9999.0;
|
3566
|
3575
|
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
|
3567
|
3576
|
wait_for_heatup = true;
|
3568
|
3577
|
do {
|
|
@@ -3592,7 +3601,7 @@ void Temperature::isr() {
|
3592
|
3601
|
idle();
|
3593
|
3602
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
3594
|
3603
|
|
3595
|
|
- const float temp = degHotend(target_extruder);
|
|
3604
|
+ const celsius_float_t temp = degHotend(target_extruder);
|
3596
|
3605
|
|
3597
|
3606
|
#if ENABLED(PRINTER_EVENT_LEDS)
|
3598
|
3607
|
// Gradually change LED strip from violet to red as nozzle heats up
|
|
@@ -3601,7 +3610,7 @@ void Temperature::isr() {
|
3601
|
3610
|
|
3602
|
3611
|
#if TEMP_RESIDENCY_TIME > 0
|
3603
|
3612
|
|
3604
|
|
- const float temp_diff = ABS(target_temp - temp);
|
|
3613
|
+ const celsius_float_t temp_diff = ABS(target_temp - temp);
|
3605
|
3614
|
|
3606
|
3615
|
if (!residency_start_ms) {
|
3607
|
3616
|
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
@@ -3695,12 +3704,12 @@ void Temperature::isr() {
|
3695
|
3704
|
#endif
|
3696
|
3705
|
|
3697
|
3706
|
#if ENABLED(PRINTER_EVENT_LEDS)
|
3698
|
|
- const float start_temp = degBed();
|
|
3707
|
+ const celsius_float_t start_temp = degBed();
|
3699
|
3708
|
printerEventLEDs.onBedHeatingStart();
|
3700
|
3709
|
#endif
|
3701
|
3710
|
|
3702
|
3711
|
bool wants_to_cool = false;
|
3703
|
|
- float target_temp = -1, old_temp = 9999;
|
|
3712
|
+ celsius_float_t target_temp = -1, old_temp = 9999;
|
3704
|
3713
|
millis_t now, next_temp_ms = 0, next_cool_check_ms = 0;
|
3705
|
3714
|
wait_for_heatup = true;
|
3706
|
3715
|
do {
|
|
@@ -3730,7 +3739,7 @@ void Temperature::isr() {
|
3730
|
3739
|
idle();
|
3731
|
3740
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
3732
|
3741
|
|
3733
|
|
- const float temp = degBed();
|
|
3742
|
+ const celsius_float_t temp = degBed();
|
3734
|
3743
|
|
3735
|
3744
|
#if ENABLED(PRINTER_EVENT_LEDS)
|
3736
|
3745
|
// Gradually change LED strip from blue to violet as bed heats up
|
|
@@ -3739,7 +3748,7 @@ void Temperature::isr() {
|
3739
|
3748
|
|
3740
|
3749
|
#if TEMP_BED_RESIDENCY_TIME > 0
|
3741
|
3750
|
|
3742
|
|
- const float temp_diff = ABS(target_temp - temp);
|
|
3751
|
+ const celsius_float_t temp_diff = ABS(target_temp - temp);
|
3743
|
3752
|
|
3744
|
3753
|
if (!residency_start_ms) {
|
3745
|
3754
|
// Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
|
|
@@ -4021,11 +4030,11 @@ void Temperature::isr() {
|
4021
|
4030
|
idle();
|
4022
|
4031
|
gcode.reset_stepper_timeout(); // Keep steppers powered
|
4023
|
4032
|
|
4024
|
|
- const float current_temp = degCooler();
|
|
4033
|
+ const celsius_float_t current_temp = degCooler();
|
4025
|
4034
|
|
4026
|
4035
|
#if TEMP_COOLER_RESIDENCY_TIME > 0
|
4027
|
4036
|
|
4028
|
|
- const float temp_diff = ABS(target_temp - temp);
|
|
4037
|
+ const celsius_float_t temp_diff = ABS(target_temp - temp);
|
4029
|
4038
|
|
4030
|
4039
|
if (!residency_start_ms) {
|
4031
|
4040
|
// Start the TEMP_COOLER_RESIDENCY_TIME timer when we reach target temp for the first time.
|