Read size for MAX6675 from sizeof(max6675_temp)

master
Scott Lahteine 9 years ago
parent ac69fad96d
commit 8a2587f017

@ -1219,13 +1219,11 @@ void disable_all_heaters() {
#define MAX6675_HEAT_INTERVAL 250u #define MAX6675_HEAT_INTERVAL 250u
#if ENABLED(MAX6675_IS_MAX31855) #if ENABLED(MAX6675_IS_MAX31855)
unsigned long max6675_temp = 2000; uint32_t max6675_temp = 2000;
#define MAX6675_READ_BYTES 4
#define MAX6675_ERROR_MASK 7 #define MAX6675_ERROR_MASK 7
#define MAX6675_DISCARD_BITS 18 #define MAX6675_DISCARD_BITS 18
#else #else
unsigned int max6675_temp = 2000; uint16_t max6675_temp = 2000;
#define MAX6675_READ_BYTES 2
#define MAX6675_ERROR_MASK 4 #define MAX6675_ERROR_MASK 4
#define MAX6675_DISCARD_BITS 3 #define MAX6675_DISCARD_BITS 3
#endif #endif
@ -1257,7 +1255,7 @@ void disable_all_heaters() {
// Read a big-endian temperature value // Read a big-endian temperature value
max6675_temp = 0; max6675_temp = 0;
for (uint8_t i = MAX6675_READ_BYTES; i--;) { for (uint8_t i = sizeof(max6675_temp); i--;) {
SPDR = 0; SPDR = 0;
for (;!TEST(SPSR, SPIF);); for (;!TEST(SPSR, SPIF););
max6675_temp |= SPDR; max6675_temp |= SPDR;

Loading…
Cancel
Save