Support two MAX6675 thermocouples (#8686)
This commit is contained in:
parent
0e610815e4
commit
ca21ac6b9b
21 changed files with 190 additions and 98 deletions
|
@ -275,12 +275,12 @@
|
||||||
#elif TEMP_SENSOR_0 == -3
|
#elif TEMP_SENSOR_0 == -3
|
||||||
#define HEATER_0_USES_MAX6675
|
#define HEATER_0_USES_MAX6675
|
||||||
#define MAX6675_IS_MAX31855
|
#define MAX6675_IS_MAX31855
|
||||||
#define MAX6675_TMIN -270
|
#define HEATER_0_MAX6675_TMIN -270
|
||||||
#define MAX6675_TMAX 1800
|
#define HEATER_0_MAX6675_TMAX 1800
|
||||||
#elif TEMP_SENSOR_0 == -2
|
#elif TEMP_SENSOR_0 == -2
|
||||||
#define HEATER_0_USES_MAX6675
|
#define HEATER_0_USES_MAX6675
|
||||||
#define MAX6675_TMIN 0
|
#define HEATER_0_MAX6675_TMIN 0
|
||||||
#define MAX6675_TMAX 1024
|
#define HEATER_0_MAX6675_TMAX 1024
|
||||||
#elif TEMP_SENSOR_0 == -1
|
#elif TEMP_SENSOR_0 == -1
|
||||||
#define HEATER_0_USES_AD595
|
#define HEATER_0_USES_AD595
|
||||||
#elif TEMP_SENSOR_0 == 0
|
#elif TEMP_SENSOR_0 == 0
|
||||||
|
@ -294,9 +294,19 @@
|
||||||
#if TEMP_SENSOR_1 == -4
|
#if TEMP_SENSOR_1 == -4
|
||||||
#define HEATER_1_USES_AD8495
|
#define HEATER_1_USES_AD8495
|
||||||
#elif TEMP_SENSOR_1 == -3
|
#elif TEMP_SENSOR_1 == -3
|
||||||
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_1."
|
#if TEMP_SENSOR_0 == -2
|
||||||
|
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
|
||||||
|
#endif
|
||||||
|
#define HEATER_1_USES_MAX6675
|
||||||
|
#define HEATER_1_MAX6675_TMIN -270
|
||||||
|
#define HEATER_1_MAX6675_TMAX 1800
|
||||||
#elif TEMP_SENSOR_1 == -2
|
#elif TEMP_SENSOR_1 == -2
|
||||||
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_1."
|
#if TEMP_SENSOR_0 == -3
|
||||||
|
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0 then TEMP_SENSOR_1 must match."
|
||||||
|
#endif
|
||||||
|
#define HEATER_1_USES_MAX6675
|
||||||
|
#define HEATER_1_MAX6675_TMIN 0
|
||||||
|
#define HEATER_1_MAX6675_TMAX 1024
|
||||||
#elif TEMP_SENSOR_1 == -1
|
#elif TEMP_SENSOR_1 == -1
|
||||||
#define HEATER_1_USES_AD595
|
#define HEATER_1_USES_AD595
|
||||||
#elif TEMP_SENSOR_1 == 0
|
#elif TEMP_SENSOR_1 == 0
|
||||||
|
|
|
@ -335,6 +335,10 @@
|
||||||
#error "MBL_Z_STEP is now MESH_EDIT_Z_STEP. Please update your configuration."
|
#error "MBL_Z_STEP is now MESH_EDIT_Z_STEP. Please update your configuration."
|
||||||
#elif defined(CHDK)
|
#elif defined(CHDK)
|
||||||
#error "CHDK is now CHDK_PIN. Please update your Configuration_adv.h."
|
#error "CHDK is now CHDK_PIN. Please update your Configuration_adv.h."
|
||||||
|
#elif defined(MAX6675_SS)
|
||||||
|
#error "MAX6675_SS is now MAX6675_SS_PIN. Please update your configuration and/or pins."
|
||||||
|
#elif defined(MAX6675_SS2)
|
||||||
|
#error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BOARD_MKS_13 -47
|
#define BOARD_MKS_13 -47
|
||||||
|
@ -1280,7 +1284,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
|
||||||
*/
|
*/
|
||||||
#if !HAS_HEATER_0
|
#if !HAS_HEATER_0
|
||||||
#error "HEATER_0_PIN not defined for this board."
|
#error "HEATER_0_PIN not defined for this board."
|
||||||
#elif !PIN_EXISTS(TEMP_0) && !(defined(MAX6675_SS) && MAX6675_SS >= 0)
|
#elif !PIN_EXISTS(TEMP_0) && !PIN_EXISTS(MAX6675_SS)
|
||||||
#error "TEMP_0_PIN not defined for this board."
|
#error "TEMP_0_PIN not defined for this board."
|
||||||
#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR)))
|
#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR)))
|
||||||
#error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
|
#error "E0_STEP_PIN or E0_DIR_PIN not defined for this board."
|
||||||
|
@ -1291,16 +1295,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pins are required for heaters
|
// Pins are required for heaters
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675) && !(defined(MAX6675_SS) && MAX6675_SS >= 0)
|
#if ENABLED(HEATER_0_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS)
|
||||||
#error "MAX6675_SS (required for TEMP_SENSOR_0) not defined for this board."
|
#error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
|
||||||
#elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1
|
#elif (HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)) && !HAS_HEATER_1
|
||||||
#error "HEATER_1_PIN not defined for this board."
|
#error "HEATER_1_PIN not defined for this board."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
#if TEMP_SENSOR_1 == 0
|
#if ENABLED(HEATER_1_USES_MAX6675) && !PIN_EXISTS(MAX6675_SS2)
|
||||||
|
#error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board."
|
||||||
|
#elif TEMP_SENSOR_1 == 0
|
||||||
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
|
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
|
||||||
#elif !PIN_EXISTS(TEMP_1)
|
#elif !PIN_EXISTS(TEMP_1) && !PIN_EXISTS(MAX6675_SS2)
|
||||||
#error "TEMP_1_PIN not defined for this board."
|
#error "TEMP_1_PIN not defined for this board."
|
||||||
#endif
|
#endif
|
||||||
#if HOTENDS > 2
|
#if HOTENDS > 2
|
||||||
|
|
|
@ -775,8 +775,13 @@ 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.0)) max_temp_error(0);
|
if (current_temperature[0] > MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(0);
|
||||||
if (current_temperature[0] < MAX(HEATER_0_MINTEMP, MAX6675_TMIN + .01)) min_temp_error(0);
|
if (current_temperature[0] < MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
if (current_temperature[1] > MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(1);
|
||||||
|
if (current_temperature[1] < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER
|
#if WATCH_HOTENDS || WATCH_THE_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER
|
||||||
|
@ -953,7 +958,9 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 1:
|
case 1:
|
||||||
#if ENABLED(HEATER_1_USES_AD595)
|
#if ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
return raw * 0.25;
|
||||||
|
#elif ENABLED(HEATER_1_USES_AD595)
|
||||||
return TEMP_AD595(raw);
|
return TEMP_AD595(raw);
|
||||||
#elif ENABLED(HEATER_1_USES_AD8495)
|
#elif ENABLED(HEATER_1_USES_AD8495)
|
||||||
return TEMP_AD8495(raw);
|
return TEMP_AD8495(raw);
|
||||||
|
@ -1036,7 +1043,10 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
|
||||||
*/
|
*/
|
||||||
void Temperature::updateTemperaturesFromRawValues() {
|
void Temperature::updateTemperaturesFromRawValues() {
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||||
current_temperature_raw[0] = read_max6675();
|
current_temperature_raw[0] = READ_MAX6675(0);
|
||||||
|
#endif
|
||||||
|
#if ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
current_temperature_raw[1] = READ_MAX6675(1);
|
||||||
#endif
|
#endif
|
||||||
HOTEND_LOOP() current_temperature[e] = analog_to_celsius_hotend(current_temperature_raw[e], e);
|
HOTEND_LOOP() current_temperature[e] = analog_to_celsius_hotend(current_temperature_raw[e], e);
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
|
@ -1170,10 +1180,14 @@ void Temperature::init() {
|
||||||
max6675_spi.init();
|
max6675_spi.init();
|
||||||
|
|
||||||
OUT_WRITE(SS_PIN, HIGH);
|
OUT_WRITE(SS_PIN, HIGH);
|
||||||
OUT_WRITE(MAX6675_SS, HIGH);
|
OUT_WRITE(MAX6675_SS_PIN, HIGH);
|
||||||
|
|
||||||
#endif // HEATER_0_USES_MAX6675
|
#endif // HEATER_0_USES_MAX6675
|
||||||
|
|
||||||
|
#if ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
OUT_WRITE(MAX6675_SS2_PIN, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
HAL_adc_init();
|
HAL_adc_init();
|
||||||
|
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
|
@ -1595,47 +1609,71 @@ void Temperature::disable_all_heaters() {
|
||||||
|
|
||||||
#endif // PROBING_HEATERS_OFF
|
#endif // PROBING_HEATERS_OFF
|
||||||
|
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
#if HAS_MAX6675
|
||||||
|
|
||||||
#define MAX6675_HEAT_INTERVAL 250u
|
int Temperature::read_max6675(
|
||||||
|
#if COUNT_6675 > 1
|
||||||
|
const uint8_t hindex
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
#if COUNT_6675 == 1
|
||||||
|
constexpr uint8_t hindex = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX6675_HEAT_INTERVAL 250UL
|
||||||
|
|
||||||
#if ENABLED(MAX6675_IS_MAX31855)
|
#if ENABLED(MAX6675_IS_MAX31855)
|
||||||
uint32_t max6675_temp = 2000;
|
static uint32_t max6675_temp = 2000;
|
||||||
#define MAX6675_ERROR_MASK 7
|
#define MAX6675_ERROR_MASK 7
|
||||||
#define MAX6675_DISCARD_BITS 18
|
#define MAX6675_DISCARD_BITS 18
|
||||||
#define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64
|
#define MAX6675_SPEED_BITS 3 // (_BV(SPR1)) // clock ÷ 64
|
||||||
#else
|
#else
|
||||||
uint16_t max6675_temp = 2000;
|
static uint16_t max6675_temp = 2000;
|
||||||
#define MAX6675_ERROR_MASK 4
|
#define MAX6675_ERROR_MASK 4
|
||||||
#define MAX6675_DISCARD_BITS 3
|
#define MAX6675_DISCARD_BITS 3
|
||||||
#define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16
|
#define MAX6675_SPEED_BITS 2 // (_BV(SPR0)) // clock ÷ 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int Temperature::read_max6675() {
|
// Return last-read value between readings
|
||||||
|
static millis_t next_max6675_ms[COUNT_6675] = { 0 };
|
||||||
static millis_t next_max6675_ms = 0;
|
|
||||||
|
|
||||||
millis_t ms = millis();
|
millis_t ms = millis();
|
||||||
|
if (PENDING(ms, next_max6675_ms[hindex])) return int(max6675_temp);
|
||||||
|
next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL;
|
||||||
|
|
||||||
if (PENDING(ms, next_max6675_ms)) return (int)max6675_temp;
|
//
|
||||||
|
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
||||||
next_max6675_ms = ms + MAX6675_HEAT_INTERVAL;
|
//
|
||||||
|
#if MB(MIGHTYBOARD_REVE)
|
||||||
spiBegin();
|
spiBegin();
|
||||||
spiInit(MAX6675_SPEED_BITS);
|
spiInit(MAX6675_SPEED_BITS);
|
||||||
|
#endif
|
||||||
|
|
||||||
WRITE(MAX6675_SS, 0); // enable TT_MAX6675
|
#if COUNT_6675 > 1
|
||||||
|
#define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
|
||||||
|
#elif ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
#define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
|
||||||
|
#else
|
||||||
|
#define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WRITE_MAX6675(LOW); // enable TT_MAX6675
|
||||||
|
|
||||||
DELAY_NS(100); // Ensure 100ns delay
|
DELAY_NS(100); // Ensure 100ns delay
|
||||||
|
|
||||||
// Read a big-endian temperature value
|
// Read a big-endian temperature value
|
||||||
max6675_temp = 0;
|
max6675_temp = 0;
|
||||||
for (uint8_t i = sizeof(max6675_temp); i--;) {
|
for (uint8_t i = sizeof(max6675_temp); i--;) {
|
||||||
max6675_temp |= spiRec();
|
max6675_temp |= (
|
||||||
|
#if MB(MIGHTYBOARD_REVE)
|
||||||
|
max6675_spi.receive()
|
||||||
|
#else
|
||||||
|
spiRec()
|
||||||
|
#endif
|
||||||
|
);
|
||||||
if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
|
if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE(MAX6675_SS, 1); // disable TT_MAX6675
|
WRITE_MAX6675(HIGH); // disable TT_MAX6675
|
||||||
|
|
||||||
if (max6675_temp & MAX6675_ERROR_MASK) {
|
if (max6675_temp & MAX6675_ERROR_MASK) {
|
||||||
SERIAL_ERROR_START();
|
SERIAL_ERROR_START();
|
||||||
|
@ -1651,7 +1689,17 @@ void Temperature::disable_all_heaters() {
|
||||||
#else
|
#else
|
||||||
SERIAL_ERRORLNPGM("MAX6675");
|
SERIAL_ERRORLNPGM("MAX6675");
|
||||||
#endif
|
#endif
|
||||||
max6675_temp = MAX6675_TMAX * 4; // thermocouple open
|
|
||||||
|
// Thermocouple open
|
||||||
|
max6675_temp = 4 * (
|
||||||
|
#if COUNT_6675 > 1
|
||||||
|
hindex ? HEATER_1_MAX6675_TMAX : HEATER_0_MAX6675_TMAX
|
||||||
|
#elif ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
HEATER_1_MAX6675_TMAX
|
||||||
|
#else
|
||||||
|
HEATER_0_MAX6675_TMAX
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
max6675_temp >>= MAX6675_DISCARD_BITS;
|
max6675_temp >>= MAX6675_DISCARD_BITS;
|
||||||
|
@ -1660,24 +1708,28 @@ void Temperature::disable_all_heaters() {
|
||||||
if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000;
|
if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (int)max6675_temp;
|
return int(max6675_temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HEATER_0_USES_MAX6675
|
#endif // HAS_MAX6675
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get raw temperatures
|
* Get raw temperatures
|
||||||
*/
|
*/
|
||||||
void Temperature::set_current_temp_raw() {
|
void Temperature::set_current_temp_raw() {
|
||||||
|
|
||||||
#if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675)
|
#if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675)
|
||||||
current_temperature_raw[0] = raw_temp_value[0];
|
current_temperature_raw[0] = raw_temp_value[0];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TEMP_ADC_1
|
#if HAS_TEMP_ADC_1
|
||||||
|
|
||||||
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||||
redundant_temperature_raw = raw_temp_value[1];
|
redundant_temperature_raw = raw_temp_value[1];
|
||||||
#else
|
#elif DISABLED(HEATER_1_USES_MAX6675)
|
||||||
current_temperature_raw[1] = raw_temp_value[1];
|
current_temperature_raw[1] = raw_temp_value[1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TEMP_ADC_2
|
#if HAS_TEMP_ADC_2
|
||||||
current_temperature_raw[2] = raw_temp_value[2];
|
current_temperature_raw[2] = raw_temp_value[2];
|
||||||
#if HAS_TEMP_ADC_3
|
#if HAS_TEMP_ADC_3
|
||||||
|
@ -1690,6 +1742,7 @@ void Temperature::set_current_temp_raw() {
|
||||||
#endif // HAS_TEMP_ADC_4
|
#endif // HAS_TEMP_ADC_4
|
||||||
#endif // HAS_TEMP_ADC_3
|
#endif // HAS_TEMP_ADC_3
|
||||||
#endif // HAS_TEMP_ADC_2
|
#endif // HAS_TEMP_ADC_2
|
||||||
|
|
||||||
#endif // HAS_TEMP_ADC_1
|
#endif // HAS_TEMP_ADC_1
|
||||||
|
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
|
@ -1771,17 +1824,17 @@ void Temperature::readings_ready() {
|
||||||
|
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
|
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
|
||||||
#define GEBED <=
|
#define BEDCMP(A,B) ((A)<=(B))
|
||||||
#else
|
#else
|
||||||
#define GEBED >=
|
#define BEDCMP(A,B) ((A)>=(B))
|
||||||
#endif
|
#endif
|
||||||
const bool bed_on = (target_temperature_bed > 0)
|
const bool bed_on = (target_temperature_bed > 0)
|
||||||
#if ENABLED(PIDTEMPBED)
|
#if ENABLED(PIDTEMPBED)
|
||||||
|| (soft_pwm_amount_bed > 0)
|
|| (soft_pwm_amount_bed > 0)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
if (current_temperature_bed_raw GEBED bed_maxttemp_raw) max_temp_error(-1);
|
if (BEDCMP(current_temperature_bed_raw, bed_maxttemp_raw)) max_temp_error(-1);
|
||||||
if (bed_minttemp_raw GEBED current_temperature_bed_raw && bed_on) min_temp_error(-1);
|
if (BEDCMP(bed_minttemp_raw, current_temperature_bed_raw) && bed_on) min_temp_error(-1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -632,8 +632,23 @@ class Temperature {
|
||||||
|
|
||||||
static void updateTemperaturesFromRawValues();
|
static void updateTemperaturesFromRawValues();
|
||||||
|
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
#define HAS_MAX6675 (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675))
|
||||||
static int read_max6675();
|
#if HAS_MAX6675
|
||||||
|
#if ENABLED(HEATER_0_USES_MAX6675) && ENABLED(HEATER_1_USES_MAX6675)
|
||||||
|
#define COUNT_6675 2
|
||||||
|
#else
|
||||||
|
#define COUNT_6675 1
|
||||||
|
#endif
|
||||||
|
#if COUNT_6675 > 1
|
||||||
|
#define READ_MAX6675(N) read_max6675(N)
|
||||||
|
#else
|
||||||
|
#define READ_MAX6675(N) read_max6675()
|
||||||
|
#endif
|
||||||
|
static int read_max6675(
|
||||||
|
#if COUNT_6675 > 1
|
||||||
|
const uint8_t hindex=0
|
||||||
|
#endif
|
||||||
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void checkExtruderAutoFans();
|
static void checkExtruderAutoFans();
|
||||||
|
|
|
@ -572,8 +572,11 @@
|
||||||
#if PIN_EXISTS(MAX6675_SCK)
|
#if PIN_EXISTS(MAX6675_SCK)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SCK_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SCK_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if defined(MAX6675_SS) && MAX6675_SS >= 0
|
#if PIN_EXISTS(MAX6675_SS)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS)
|
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(MAX6675_SS2)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, MAX6675_SS2_PIN)
|
||||||
#endif
|
#endif
|
||||||
// #if defined(MISO) && MISO >= 0
|
// #if defined(MISO) && MISO >= 0
|
||||||
// REPORT_NAME_DIGITAL(__LINE__, MISO)
|
// REPORT_NAME_DIGITAL(__LINE__, MISO)
|
||||||
|
@ -803,11 +806,11 @@
|
||||||
#if PIN_EXISTS(SUICIDE)
|
#if PIN_EXISTS(SUICIDE)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, SUICIDE_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if defined(THERMO_CS1) && THERMO_CS1 >= 0
|
#if PIN_EXISTS(THERMO_CS1)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1)
|
REPORT_NAME_DIGITAL(__LINE__, THERMO_CS1_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if defined(THERMO_CS2) && THERMO_CS2 >= 0
|
#if PIN_EXISTS(THERMO_CS2)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2)
|
REPORT_NAME_DIGITAL(__LINE__, THERMO_CS2_PIN)
|
||||||
#endif
|
#endif
|
||||||
#if PIN_EXISTS(THERMO_DO)
|
#if PIN_EXISTS(THERMO_DO)
|
||||||
REPORT_NAME_DIGITAL(__LINE__, THERMO_DO_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, THERMO_DO_PIN)
|
||||||
|
|
|
@ -85,9 +85,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS -1
|
#define MAX6675_SS_PIN -1
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS -1
|
#define MAX6675_SS_PIN -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -77,9 +77,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 53
|
#define MAX6675_SS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 53
|
#define MAX6675_SS_PIN 53
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -113,9 +113,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -113,9 +113,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -113,9 +113,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -136,12 +136,14 @@
|
||||||
//
|
//
|
||||||
#define THERMO_SCK_PIN 78 // E2
|
#define THERMO_SCK_PIN 78 // E2
|
||||||
#define THERMO_DO_PIN 3 // E5
|
#define THERMO_DO_PIN 3 // E5
|
||||||
#define THERMO_CS1 5 // E3
|
#define THERMO_CS1_PIN 5 // E3
|
||||||
#define THERMO_CS2 2 // E4
|
#define THERMO_CS2_PIN 2 // E4
|
||||||
|
|
||||||
#define MAX6675_SS THERMO_CS1
|
#define MAX6675_SS_PIN THERMO_CS1_PIN
|
||||||
|
#define MAX6675_SS2_PIN THERMO_CS2_PIN
|
||||||
#define MAX6675_SCK_PIN THERMO_SCK_PIN
|
#define MAX6675_SCK_PIN THERMO_SCK_PIN
|
||||||
#define MAX6675_DO_PIN THERMO_DO_PIN
|
#define MAX6675_DO_PIN THERMO_DO_PIN
|
||||||
|
|
||||||
//
|
//
|
||||||
// Augmentation for auto-assigning plugs
|
// Augmentation for auto-assigning plugs
|
||||||
//
|
//
|
||||||
|
|
|
@ -172,9 +172,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 53
|
#define MAX6675_SS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 49
|
#define MAX6675_SS_PIN 49
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -205,9 +205,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -64,11 +64,11 @@
|
||||||
#define TEMP_BED_PIN 10 // Analog Input
|
#define TEMP_BED_PIN 10 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#undef MAX6675_SS
|
#undef MAX6675_SS_PIN
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 69 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 69 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 69 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 69 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -112,9 +112,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 53
|
#define MAX6675_SS_PIN 53
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 49
|
#define MAX6675_SS_PIN 49
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -77,9 +77,9 @@
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -87,12 +87,11 @@
|
||||||
#define TEMP_BED_PIN 11 // Analog Input
|
#define TEMP_BED_PIN 11 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
|
#undef MAX6675_SS_PIN
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#undef MAX6675_SS
|
#define MAX6675_SS_PIN 67 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#define MAX6675_SS 67 // Do not use pin 53 if there is even the remote possibility of using Display/SD card
|
|
||||||
#else
|
#else
|
||||||
#undef MAX6675_SS
|
#define MAX6675_SS_PIN 67 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#define MAX6675_SS 67 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -73,11 +73,11 @@
|
||||||
#define TEMP_BED_PIN 15 // Analog Input
|
#define TEMP_BED_PIN 15 // Analog Input
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#undef MAX6675_SS
|
#undef MAX6675_SS_PIN
|
||||||
#if DISABLED(SDSUPPORT)
|
#if DISABLED(SDSUPPORT)
|
||||||
#define MAX6675_SS 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card
|
#define MAX6675_SS_PIN 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card
|
||||||
#else
|
#else
|
||||||
#define MAX6675_SS 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
#define MAX6675_SS_PIN 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -158,11 +158,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
//#if DISABLED(SDSUPPORT)
|
/*
|
||||||
// #define MAX6675_SS 53
|
#if DISABLED(SDSUPPORT)
|
||||||
//#else
|
#define MAX6675_SS_PIN 53
|
||||||
// #define MAX6675_SS 49
|
#else
|
||||||
//#endif
|
#define MAX6675_SS_PIN 49
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc. Functions
|
// Misc. Functions
|
||||||
|
|
|
@ -144,11 +144,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
//#if DISABLED(SDSUPPORT)
|
/*
|
||||||
// #define MAX6675_SS 53
|
#if DISABLED(SDSUPPORT)
|
||||||
//#else
|
#define MAX6675_SS_PIN 53
|
||||||
// #define MAX6675_SS 49
|
#else
|
||||||
//#endif
|
#define MAX6675_SS_PIN 49
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc. Functions
|
// Misc. Functions
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
#define SPI_FLASH_CS -1
|
#define SPI_FLASH_CS -1
|
||||||
|
|
||||||
// SPI for Max6675 or Max31855 Thermocouple
|
// SPI for Max6675 or Max31855 Thermocouple
|
||||||
#define MAX6675_SS 65
|
#define MAX6675_SS_PIN 65
|
||||||
#define MAX31855_SS0 65
|
#define MAX31855_SS0 65
|
||||||
#define MAX31855_SS1 52
|
#define MAX31855_SS1 52
|
||||||
#define MAX31855_SS2 50
|
#define MAX31855_SS2 50
|
||||||
|
|
Reference in a new issue