Treat temperature as integer, when possible
This commit is contained in:
@ -99,10 +99,10 @@ class Temperature {
|
||||
|
||||
static float current_temperature[HOTENDS],
|
||||
current_temperature_bed;
|
||||
static int current_temperature_raw[HOTENDS],
|
||||
target_temperature[HOTENDS],
|
||||
current_temperature_bed_raw,
|
||||
target_temperature_bed;
|
||||
static int16_t current_temperature_raw[HOTENDS],
|
||||
target_temperature[HOTENDS],
|
||||
current_temperature_bed_raw,
|
||||
target_temperature_bed;
|
||||
|
||||
static volatile bool in_temp_isr;
|
||||
|
||||
@ -217,33 +217,33 @@ class Temperature {
|
||||
static millis_t next_bed_check_ms;
|
||||
#endif
|
||||
|
||||
static unsigned long raw_temp_value[MAX_EXTRUDERS],
|
||||
raw_temp_bed_value;
|
||||
static uint16_t raw_temp_value[MAX_EXTRUDERS],
|
||||
raw_temp_bed_value;
|
||||
|
||||
// Init min and max temp with extreme values to prevent false errors during startup
|
||||
static int minttemp_raw[HOTENDS],
|
||||
maxttemp_raw[HOTENDS],
|
||||
minttemp[HOTENDS],
|
||||
maxttemp[HOTENDS];
|
||||
static int16_t minttemp_raw[HOTENDS],
|
||||
maxttemp_raw[HOTENDS],
|
||||
minttemp[HOTENDS],
|
||||
maxttemp[HOTENDS];
|
||||
|
||||
#ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
|
||||
static int consecutive_low_temperature_error[HOTENDS];
|
||||
static uint8_t consecutive_low_temperature_error[HOTENDS];
|
||||
#endif
|
||||
|
||||
#ifdef MILLISECONDS_PREHEAT_TIME
|
||||
static unsigned long preheat_end_time[HOTENDS];
|
||||
static millis_t preheat_end_time[HOTENDS];
|
||||
#endif
|
||||
|
||||
#ifdef BED_MINTEMP
|
||||
static int bed_minttemp_raw;
|
||||
static int16_t bed_minttemp_raw;
|
||||
#endif
|
||||
|
||||
#ifdef BED_MAXTEMP
|
||||
static int bed_maxttemp_raw;
|
||||
static int16_t bed_maxttemp_raw;
|
||||
#endif
|
||||
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
static int meas_shift_index; // Index of a delayed sample in buffer
|
||||
static int16_t meas_shift_index; // Index of a delayed sample in buffer
|
||||
#endif
|
||||
|
||||
#if HAS_AUTO_FAN
|
||||
@ -323,31 +323,31 @@ class Temperature {
|
||||
//inline so that there is no performance decrease.
|
||||
//deg=degreeCelsius
|
||||
|
||||
static float degHotend(uint8_t e) {
|
||||
static int16_t degHotend(uint8_t e) {
|
||||
#if HOTENDS == 1
|
||||
UNUSED(e);
|
||||
#endif
|
||||
return current_temperature[HOTEND_INDEX];
|
||||
}
|
||||
static float degBed() { return current_temperature_bed; }
|
||||
static int16_t degBed() { return current_temperature_bed; }
|
||||
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
static float rawHotendTemp(uint8_t e) {
|
||||
#if HOTENDS == 1
|
||||
UNUSED(e);
|
||||
#endif
|
||||
return current_temperature_raw[HOTEND_INDEX];
|
||||
}
|
||||
static float rawBedTemp() { return current_temperature_bed_raw; }
|
||||
static int16_t rawHotendTemp(uint8_t e) {
|
||||
#if HOTENDS == 1
|
||||
UNUSED(e);
|
||||
#endif
|
||||
return current_temperature_raw[HOTEND_INDEX];
|
||||
}
|
||||
static int16_t rawBedTemp() { return current_temperature_bed_raw; }
|
||||
#endif
|
||||
|
||||
static float degTargetHotend(uint8_t e) {
|
||||
static int16_t degTargetHotend(uint8_t e) {
|
||||
#if HOTENDS == 1
|
||||
UNUSED(e);
|
||||
#endif
|
||||
return target_temperature[HOTEND_INDEX];
|
||||
}
|
||||
static float degTargetBed() { return target_temperature_bed; }
|
||||
static int16_t degTargetBed() { return target_temperature_bed; }
|
||||
|
||||
#if WATCH_HOTENDS
|
||||
static void start_watching_heater(uint8_t e = 0);
|
||||
@ -357,14 +357,14 @@ class Temperature {
|
||||
static void start_watching_bed();
|
||||
#endif
|
||||
|
||||
static void setTargetHotend(const float& celsius, uint8_t e) {
|
||||
static void setTargetHotend(const int16_t &celsius, uint8_t e) {
|
||||
#if HOTENDS == 1
|
||||
UNUSED(e);
|
||||
#endif
|
||||
#ifdef MILLISECONDS_PREHEAT_TIME
|
||||
if (celsius == 0.0f)
|
||||
if (celsius == 0)
|
||||
reset_preheat_time(HOTEND_INDEX);
|
||||
else if (target_temperature[HOTEND_INDEX] == 0.0f)
|
||||
else if (target_temperature[HOTEND_INDEX] == 0)
|
||||
start_preheat_time(HOTEND_INDEX);
|
||||
#endif
|
||||
target_temperature[HOTEND_INDEX] = celsius;
|
||||
@ -373,7 +373,7 @@ class Temperature {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void setTargetBed(const float& celsius) {
|
||||
static void setTargetBed(const int16_t &celsius) {
|
||||
target_temperature_bed = celsius;
|
||||
#if WATCH_THE_BED
|
||||
start_watching_bed();
|
||||
|
Reference in New Issue
Block a user