Chamber temperature monitoring and auto fan control.

This is an initial cut for feedback, updated for 2.0.x.

Chamber temperature is currently reported along with hot end and bed
temperatures to serial. The format is just like that used for hot end
and bed temperatures, but using 'C' prefix. As there is no heater,
target is always 0. Is this appropriate, is there a better way to report
chamber temperatures?

Chamber temperatures are not reported on the LCD in any way.

When auto chamber fan is enabled, it currently just uses the same
temperature threshold as the other auto controlled fans.

As the chamber temperature is not connected to any heater, it doesn't
undergo mintemp/maxtemp monitoring. This would need to change in the
future if chamber heating became a feature.
This commit is contained in:
Lenbok 2018-02-24 19:38:58 +13:00 committed by Scott Lahteine
parent 5b3bda1c16
commit 0e8242180d
11 changed files with 153 additions and 14 deletions

View File

@ -316,6 +316,7 @@
#define TEMP_SENSOR_3 0 #define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0 #define TEMP_SENSOR_4 0
#define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_CHAMBER 0
// Dummy thermistor constant temperature readings, for use with 998 and 999 // Dummy thermistor constant temperature readings, for use with 998 and 999
#define DUMMY_THERMISTOR_998_VALUE 25 #define DUMMY_THERMISTOR_998_VALUE 25

View File

@ -230,6 +230,7 @@
#define E2_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1
#define E4_AUTO_FAN_PIN -1 #define E4_AUTO_FAN_PIN -1
#define CHAMBER_AUTO_FAN_PIN -1
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed

View File

@ -242,9 +242,9 @@ typedef enum {
//find out which harware PWMs are already in use //find out which harware PWMs are already in use
#if PIN_EXISTS(CONTROLLER_FAN) #if PIN_EXISTS(CONTROLLER_FAN)
#define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN) #define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
#else #else
#define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN) #define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN)
#endif #endif
#if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2) #if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)

View File

@ -389,6 +389,15 @@
#define BED_USES_THERMISTOR #define BED_USES_THERMISTOR
#endif #endif
#if TEMP_SENSOR_CHAMBER <= -2
#error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_CHAMBER"
#elif TEMP_SENSOR_CHAMBER == -1
#define CHAMBER_USES_AD595
#elif TEMP_SENSOR_CHAMBER > 0
#define THERMISTORCHAMBER TEMP_SENSOR_CHAMBER
#define CHAMBER_USES_THERMISTOR
#endif
#ifdef __SAM3X8E__ #ifdef __SAM3X8E__
#define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595)) #define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595))
#endif #endif
@ -754,7 +763,8 @@
#define HAS_TEMP_4 (PIN_EXISTS(TEMP_4) && TEMP_SENSOR_4 != 0 && TEMP_SENSOR_4 > -2) #define HAS_TEMP_4 (PIN_EXISTS(TEMP_4) && TEMP_SENSOR_4 != 0 && TEMP_SENSOR_4 > -2)
#define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)) #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2) #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_TEMP_BED) #define HAS_TEMP_CHAMBER (PIN_EXISTS(TEMP_CHAMBER) && TEMP_SENSOR_CHAMBER != 0 && TEMP_SENSOR_CHAMBER > -2)
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_TEMP_BED || HAS_TEMP_CHAMBER)
// Heaters // Heaters
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
@ -775,7 +785,8 @@
#define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN)) #define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN))
#define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN)) #define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN))
#define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN)) #define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN))
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3) #define HAS_AUTO_CHAMBER_FAN (PIN_EXISTS(CHAMBER_AUTO_FAN))
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_CHAMBER_FAN)
#define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) #define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) #define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) #define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
@ -786,6 +797,11 @@
#define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) #define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) #define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) #define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
#define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN)
// Other fans // Other fans
#define HAS_FAN0 (PIN_EXISTS(FAN)) #define HAS_FAN0 (PIN_EXISTS(FAN))

View File

@ -83,10 +83,12 @@ Temperature thermalManager;
// public: // public:
float Temperature::current_temperature[HOTENDS] = { 0.0 }, float Temperature::current_temperature[HOTENDS] = { 0.0 },
Temperature::current_temperature_chamber = 0.0,
Temperature::current_temperature_bed = 0.0; Temperature::current_temperature_bed = 0.0;
int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
Temperature::target_temperature[HOTENDS] = { 0 }, Temperature::target_temperature[HOTENDS] = { 0 },
Temperature::current_temperature_chamber_raw = 0,
Temperature::current_temperature_bed_raw = 0; Temperature::current_temperature_bed_raw = 0;
#if ENABLED(AUTO_POWER_E_FANS) #if ENABLED(AUTO_POWER_E_FANS)
@ -179,6 +181,7 @@ volatile bool Temperature::temp_meas_ready = false;
#endif #endif
uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 }, uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 },
Temperature::raw_temp_chamber_value = 0,
Temperature::raw_temp_bed_value = 0; Temperature::raw_temp_bed_value = 0;
// Init min and max temp with extreme values to prevent false errors during startup // Init min and max temp with extreme values to prevent false errors during startup
@ -550,19 +553,22 @@ int Temperature::getHeaterPower(int heater) {
#if HAS_AUTO_FAN #if HAS_AUTO_FAN
void Temperature::checkExtruderAutoFans() { void Temperature::checkExtruderAutoFans() {
static const pin_t fanPin[] PROGMEM = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN }; static const pin_t fanPin[] PROGMEM = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN, CHAMBER_AUTO_FAN_PIN };
static const uint8_t fanBit[] PROGMEM = { static const uint8_t fanBit[] PROGMEM = {
0, 0,
AUTO_1_IS_0 ? 0 : 1, AUTO_1_IS_0 ? 0 : 1,
AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 : 2, AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 : 2,
AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3, AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3,
AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4 AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4,
AUTO_CHAMBER_IS_0 ? 0 : AUTO_CHAMBER_IS_1 ? 1 : AUTO_CHAMBER_IS_2 ? 2 : AUTO_CHAMBER_IS_3 ? 3 : AUTO_CHAMBER_IS_4 ? 4 : 5
}; };
uint8_t fanState = 0; uint8_t fanState = 0;
HOTEND_LOOP() HOTEND_LOOP()
if (current_temperature[e] > EXTRUDER_AUTO_FAN_TEMPERATURE) if (current_temperature[e] > EXTRUDER_AUTO_FAN_TEMPERATURE)
SBI(fanState, pgm_read_byte(&fanBit[e])); SBI(fanState, pgm_read_byte(&fanBit[e]));
if (current_temperature_chamber > EXTRUDER_AUTO_FAN_TEMPERATURE)
SBI(fanState, pgm_read_byte(&fanBit[5]));
uint8_t fanDone = 0; uint8_t fanDone = 0;
for (uint8_t f = 0; f < COUNT(fanPin); f++) { for (uint8_t f = 0; f < COUNT(fanPin); f++) {
@ -998,6 +1004,42 @@ float Temperature::analog2temp(const int raw, const uint8_t e) {
} }
#endif // HAS_TEMP_BED #endif // HAS_TEMP_BED
#if HAS_TEMP_CHAMBER
// Derived from RepRap FiveD extruder::getTemperature()
// For chamber temperature measurement.
float Temperature::analog2tempChamber(const int raw) {
#if ENABLED(CHAMBER_USES_THERMISTOR)
float celsius = 0;
byte i;
for (i = 1; i < CHAMBERTEMPTABLE_LEN; i++) {
if (PGM_RD_W(CHAMBERTEMPTABLE[i][0]) > raw) {
celsius = PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1]) +
(raw - PGM_RD_W(CHAMBERTEMPTABLE[i - 1][0])) *
(float)(PGM_RD_W(CHAMBERTEMPTABLE[i][1]) - PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1])) /
(float)(PGM_RD_W(CHAMBERTEMPTABLE[i][0]) - PGM_RD_W(CHAMBERTEMPTABLE[i - 1][0]));
break;
}
}
// Overflow: Set to last value in the table
if (i == CHAMBERTEMPTABLE_LEN) celsius = PGM_RD_W(CHAMBERTEMPTABLE[i - 1][1]);
return celsius;
#elif defined(CHAMBER_USES_AD595)
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN)) + TEMP_SENSOR_AD595_OFFSET;
#else
UNUSED(raw);
return 0;
#endif
}
#endif // HAS_TEMP_CHAMBER
/** /**
* Get the raw values into the actual temperatures. * Get the raw values into the actual temperatures.
* The raw values are created in interrupt context, * The raw values are created in interrupt context,
@ -1013,6 +1055,9 @@ void Temperature::updateTemperaturesFromRawValues() {
#if HAS_TEMP_BED #if HAS_TEMP_BED
current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw); current_temperature_bed = Temperature::analog2tempBed(current_temperature_bed_raw);
#endif #endif
#if HAS_TEMP_CHAMBER
current_temperature_chamber = Temperature::analog2tempChamber(current_temperature_chamber_raw);
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
redundant_temperature = Temperature::analog2temp(redundant_temperature_raw, 1); redundant_temperature = Temperature::analog2temp(redundant_temperature_raw, 1);
#endif #endif
@ -1076,7 +1121,7 @@ void Temperature::init() {
inited = true; inited = true;
#endif #endif
#if MB(RUMBA) && (TEMP_SENSOR_0 == -1 || TEMP_SENSOR_1 == -1 || TEMP_SENSOR_2 == -1 || TEMP_SENSOR_BED == -1) #if MB(RUMBA) && (TEMP_SENSOR_0 == -1 || TEMP_SENSOR_1 == -1 || TEMP_SENSOR_2 == -1 || TEMP_SENSOR_BED == -1 || TEMP_SENSOR_CHAMBER == -1)
// Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR = _BV(JTD); MCUCR = _BV(JTD);
MCUCR = _BV(JTD); MCUCR = _BV(JTD);
@ -1162,6 +1207,9 @@ void Temperature::init() {
#if HAS_TEMP_BED #if HAS_TEMP_BED
HAL_ANALOG_SELECT(TEMP_BED_PIN); HAL_ANALOG_SELECT(TEMP_BED_PIN);
#endif #endif
#if HAS_TEMP_CHAMBER
HAL_ANALOG_SELECT(TEMP_CHAMBER_PIN);
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
HAL_ANALOG_SELECT(FILWIDTH_PIN); HAL_ANALOG_SELECT(FILWIDTH_PIN);
#endif #endif
@ -1227,6 +1275,16 @@ void Temperature::init() {
SET_OUTPUT(E4_AUTO_FAN_PIN); SET_OUTPUT(E4_AUTO_FAN_PIN);
#endif #endif
#endif #endif
#if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_0 && !AUTO_CHAMBER_IS_1 && !AUTO_CHAMBER_IS_2 && !AUTO_CHAMBER_IS_3 && ! AUTO_CHAMBER_IS_4
#if CHAMBER_AUTO_FAN_PIN == FAN1_PIN
SET_OUTPUT(CHAMBER_AUTO_FAN_PIN);
#if ENABLED(FAST_PWM_FAN)
setPwmFrequency(CHAMBER_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
#endif
#else
SET_OUTPUT(CHAMBER_AUTO_FAN_PIN);
#endif
#endif
// Wait for temperature measurement to settle // Wait for temperature measurement to settle
delay(250); delay(250);
@ -1630,6 +1688,7 @@ void Temperature::set_current_temp_raw() {
#endif #endif
#endif #endif
current_temperature_bed_raw = raw_temp_bed_value; current_temperature_bed_raw = raw_temp_bed_value;
current_temperature_chamber_raw = raw_temp_chamber_value;
temp_meas_ready = true; temp_meas_ready = true;
} }
@ -1994,6 +2053,15 @@ void Temperature::isr() {
break; break;
#endif #endif
#if HAS_TEMP_CHAMBER
case PrepareTemp_CHAMBER:
HAL_START_ADC(TEMP_CHAMBER_PIN);
break;
case MeasureTemp_CHAMBER:
raw_temp_chamber_value += ADC;
break;
#endif
#if HAS_TEMP_1 #if HAS_TEMP_1
case PrepareTemp_1: case PrepareTemp_1:
HAL_START_ADC(TEMP_1_PIN); HAL_START_ADC(TEMP_1_PIN);
@ -2080,6 +2148,7 @@ void Temperature::isr() {
ZERO(raw_temp_value); ZERO(raw_temp_value);
raw_temp_bed_value = 0; raw_temp_bed_value = 0;
raw_temp_chamber_value = 0;
#define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1) #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1)
@ -2191,15 +2260,17 @@ void Temperature::isr() {
#if NUM_SERIAL > 1 #if NUM_SERIAL > 1
, const int8_t port=-1 , const int8_t port=-1
#endif #endif
, const int8_t e=-2 , const int8_t e=-3
) { ) {
#if !(HAS_TEMP_BED && HAS_TEMP_HOTEND) && HOTENDS <= 1 #if !(HAS_TEMP_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1
UNUSED(e); UNUSED(e);
#endif #endif
SERIAL_PROTOCOLCHAR_P(port, ' '); SERIAL_PROTOCOLCHAR_P(port, ' ');
SERIAL_PROTOCOLCHAR_P(port, SERIAL_PROTOCOLCHAR_P(port,
#if HAS_TEMP_BED && HAS_TEMP_HOTEND #if HAS_TEMP_CHAMBER && HAS_TEMP_BED && HAS_TEMP_HOTEND
e == -2 ? 'C' : e == -1 ? 'B' : 'T'
#elif HAS_TEMP_BED && HAS_TEMP_HOTEND
e == -1 ? 'B' : 'T' e == -1 ? 'B' : 'T'
#elif HAS_TEMP_HOTEND #elif HAS_TEMP_HOTEND
'T' 'T'
@ -2246,6 +2317,14 @@ void Temperature::isr() {
, -1 // BED , -1 // BED
); );
#endif #endif
#if HAS_TEMP_CHAMBER
print_heater_state(degChamber(), 0
#if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawChamberTemp()
#endif
, -2 // CHAMBER
);
#endif
#if HOTENDS > 1 #if HOTENDS > 1
HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e) HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e)
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)

View File

@ -74,6 +74,10 @@ enum ADCSensorState : char {
PrepareTemp_BED, PrepareTemp_BED,
MeasureTemp_BED, MeasureTemp_BED,
#endif #endif
#if HAS_TEMP_CHAMBER
PrepareTemp_CHAMBER,
MeasureTemp_CHAMBER,
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
Prepare_FILWIDTH, Prepare_FILWIDTH,
Measure_FILWIDTH, Measure_FILWIDTH,
@ -113,9 +117,11 @@ class Temperature {
public: public:
static float current_temperature[HOTENDS], static float current_temperature[HOTENDS],
current_temperature_chamber,
current_temperature_bed; current_temperature_bed;
static int16_t current_temperature_raw[HOTENDS], static int16_t current_temperature_raw[HOTENDS],
target_temperature[HOTENDS], target_temperature[HOTENDS],
current_temperature_chamber_raw,
current_temperature_bed_raw; current_temperature_bed_raw;
#if ENABLED(AUTO_POWER_E_FANS) #if ENABLED(AUTO_POWER_E_FANS)
@ -244,6 +250,7 @@ class Temperature {
#endif #endif
static uint16_t raw_temp_value[MAX_EXTRUDERS], static uint16_t raw_temp_value[MAX_EXTRUDERS],
raw_temp_chamber_value,
raw_temp_bed_value; raw_temp_bed_value;
// Init min and max temp with extreme values to prevent false errors during startup // Init min and max temp with extreme values to prevent false errors during startup
@ -315,6 +322,9 @@ class Temperature {
#if HAS_TEMP_BED #if HAS_TEMP_BED
static float analog2tempBed(const int raw); static float analog2tempBed(const int raw);
#endif #endif
#if HAS_TEMP_CHAMBER
static float analog2tempChamber(const int raw);
#endif
/** /**
* Called from the Temperature ISR * Called from the Temperature ISR
@ -369,6 +379,7 @@ class Temperature {
return current_temperature[HOTEND_INDEX]; return current_temperature[HOTEND_INDEX];
} }
FORCE_INLINE static float degBed() { return current_temperature_bed; } FORCE_INLINE static float degBed() { return current_temperature_bed; }
FORCE_INLINE static float degChamber() { return current_temperature_chamber; }
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) { FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) {
@ -378,6 +389,7 @@ class Temperature {
return current_temperature_raw[HOTEND_INDEX]; return current_temperature_raw[HOTEND_INDEX];
} }
FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; } FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; }
FORCE_INLINE static int16_t rawChamberTemp() { return current_temperature_chamber_raw; }
#endif #endif
FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) { FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) {

View File

@ -47,6 +47,10 @@
#define HEATER_BED_RAW_HI_TEMP 16383 #define HEATER_BED_RAW_HI_TEMP 16383
#define HEATER_BED_RAW_LO_TEMP 0 #define HEATER_BED_RAW_LO_TEMP 0
#endif #endif
#if THERMISTORCHAMBER == 20
#define HEATER_CHAMBER_RAW_HI_TEMP 16383
#define HEATER_CHAMBER_RAW_LO_TEMP 0
#endif
const short temptable_20[][2] PROGMEM = { const short temptable_20[][2] PROGMEM = {
{ OV( 0), 0 }, { OV( 0), 0 },
{ OV(227), 1 }, { OV(227), 1 },

View File

@ -28,7 +28,7 @@
#define OVERSAMPLENR 16 #define OVERSAMPLENR 16
#define OV(N) int16_t((N) * (OVERSAMPLENR)) #define OV(N) int16_t((N) * (OVERSAMPLENR))
#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n) #define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n || THERMISTORCHAMBER == n)
// Pt1000 and Pt100 handling // Pt1000 and Pt100 handling
// //
@ -190,6 +190,15 @@
#endif #endif
#endif #endif
#ifdef THERMISTORCHAMBER
#define CHAMBERTEMPTABLE TT_NAME(THERMISTORCHAMBER)
#define CHAMBERTEMPTABLE_LEN COUNT(CHAMBERTEMPTABLE)
#else
#ifdef CHAMBER_USES_THERMISTOR
#error "No chamber thermistor table specified"
#endif
#endif
// Set the high and low raw values for the heaters // Set the high and low raw values for the heaters
// For thermistors the highest temperature results in the lowest ADC value // For thermistors the highest temperature results in the lowest ADC value
// For thermocouples the highest temperature results in the highest ADC value // For thermocouples the highest temperature results in the highest ADC value
@ -247,5 +256,14 @@
#define HEATER_BED_RAW_LO_TEMP 0 #define HEATER_BED_RAW_LO_TEMP 0
#endif #endif
#endif #endif
#ifndef HEATER_CHAMBER_RAW_HI_TEMP
#ifdef CHAMBER_USES_THERMISTOR
#define HEATER_CHAMBER_RAW_HI_TEMP 0
#define HEATER_CHAMBER_RAW_LO_TEMP 16383
#else
#define HEATER_CHAMBER_RAW_HI_TEMP 16383
#define HEATER_CHAMBER_RAW_LO_TEMP 0
#endif
#endif
#endif // THERMISTORS_H_ #endif // THERMISTORS_H_

View File

@ -618,6 +618,13 @@
#define E4_AUTO_FAN_PIN -1 #define E4_AUTO_FAN_PIN -1
#endif #endif
#endif #endif
#ifndef CHAMBER_AUTO_FAN_PIN
#ifdef ORIG_CHAMBER_AUTO_FAN_PIN
#define CHAMBER_AUTO_FAN_PIN ORIG_CHAMBER_AUTO_FAN_PIN
#else
#define CHAMBER_AUTO_FAN_PIN -1
#endif
#endif
// List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! // List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, E0_CS_PIN, #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, E0_CS_PIN,

View File

@ -83,9 +83,6 @@
#if PIN_EXISTS(TEMP_CHAMBER) && TEMP_CHAMBER_PIN < NUM_ANALOG_INPUTS #if PIN_EXISTS(TEMP_CHAMBER) && TEMP_CHAMBER_PIN < NUM_ANALOG_INPUTS
REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN)
#endif #endif
#if PIN_EXISTS(TEMP_X) && TEMP_X_PIN < NUM_ANALOG_INPUTS
REPORT_NAME_ANALOG(__LINE__, TEMP_X_PIN)
#endif
#if PIN_EXISTS(ADC_KEYPAD) && ADC_KEYPAD_PIN < NUM_ANALOG_INPUTS #if PIN_EXISTS(ADC_KEYPAD) && ADC_KEYPAD_PIN < NUM_ANALOG_INPUTS
REPORT_NAME_ANALOG(__LINE__, ADC_KEYPAD_PIN) REPORT_NAME_ANALOG(__LINE__, ADC_KEYPAD_PIN)
#endif #endif
@ -166,6 +163,9 @@
#if PIN_EXISTS(CASE_LIGHT) #if PIN_EXISTS(CASE_LIGHT)
REPORT_NAME_DIGITAL(__LINE__, CASE_LIGHT_PIN) REPORT_NAME_DIGITAL(__LINE__, CASE_LIGHT_PIN)
#endif #endif
#if PIN_EXISTS(CHAMBER_AUTO_FAN)
REPORT_NAME_DIGITAL(__LINE__, CHAMBER_AUTO_FAN_PIN)
#endif
#if PIN_EXISTS(CONTROLLER_FAN) #if PIN_EXISTS(CONTROLLER_FAN)
REPORT_NAME_DIGITAL(__LINE__, CONTROLLER_FAN_PIN) REPORT_NAME_DIGITAL(__LINE__, CONTROLLER_FAN_PIN)
#endif #endif

View File

@ -107,6 +107,7 @@
// optional for extruder 4 or chamber: // optional for extruder 4 or chamber:
//#define TEMP_X_PIN 12 // Analog Input (default connector for thermistor *T3* on rumba board is used) //#define TEMP_X_PIN 12 // Analog Input (default connector for thermistor *T3* on rumba board is used)
//#define TEMP_CHAMBER_PIN 12 // Analog Input (default connector for thermistor *T3* on rumba board is used)
#if TEMP_SENSOR_BED == -1 #if TEMP_SENSOR_BED == -1
#define TEMP_BED_PIN 7 // Analog Input (connector *K3* on RUMBA thermocouple ADD ON is used <-- this can't be used when TEMP_SENSOR_2 is defined as thermocouple) #define TEMP_BED_PIN 7 // Analog Input (connector *K3* on RUMBA thermocouple ADD ON is used <-- this can't be used when TEMP_SENSOR_2 is defined as thermocouple)