@ -878,8 +878,8 @@ void tp_init()
{
{
# 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))
//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 = ( 1 < < JTD ) ;
MCUCR = BIT ( JTD ) ;
MCUCR = ( 1 < < JTD ) ;
MCUCR = BIT ( JTD ) ;
# endif
# endif
// Finish init of mult extruder arrays
// Finish init of mult extruder arrays
@ -937,13 +937,13 @@ void tp_init()
# endif //HEATER_0_USES_MAX6675
# endif //HEATER_0_USES_MAX6675
# ifdef DIDR2
# ifdef DIDR2
# define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= 1 << pin; else DIDR2 |= 1 << (pin - 8); }while(0)
# define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT (pin - 8); }while(0)
# else
# else
# define ANALOG_SELECT(pin) do{ DIDR0 |= 1 << pin ; }while(0)
# define ANALOG_SELECT(pin) do{ DIDR0 |= BIT(pin) ; }while(0)
# endif
# endif
// Set analog inputs
// Set analog inputs
ADCSRA = 1 < < ADEN | 1 < < ADSC | 1 < < ADIF | 0x07 ;
ADCSRA = BIT ( ADEN ) | BIT ( ADSC ) | BIT ( ADIF ) | 0x07 ;
DIDR0 = 0 ;
DIDR0 = 0 ;
# ifdef DIDR2
# ifdef DIDR2
DIDR2 = 0 ;
DIDR2 = 0 ;
@ -970,7 +970,7 @@ void tp_init()
// Use timer0 for temperature measurement
// Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt
// Interleave temperature interrupt with millies interrupt
OCR0B = 128 ;
OCR0B = 128 ;
TIMSK0 | = ( 1 < < OCIE0B ) ;
TIMSK0 | = BIT ( OCIE0B ) ;
// Wait for temperature measurement to settle
// Wait for temperature measurement to settle
delay ( 250 ) ;
delay ( 250 ) ;
@ -1174,12 +1174,12 @@ void disable_heater() {
max6675_temp = 0 ;
max6675_temp = 0 ;
# ifdef PRR
# ifdef PRR
PRR & = ~ ( 1 < < PRSPI ) ;
PRR & = ~ BIT ( PRSPI ) ;
# elif defined(PRR0)
# elif defined(PRR0)
PRR0 & = ~ ( 1 < < PRSPI ) ;
PRR0 & = ~ BIT ( PRSPI ) ;
# endif
# endif
SPCR = ( 1 < < MSTR ) | ( 1 < < SPE ) | ( 1 < < SPR0 ) ;
SPCR = BIT ( MSTR ) | BIT ( SPE ) | BIT ( SPR0 ) ;
// enable TT_MAX6675
// enable TT_MAX6675
WRITE ( MAX6675_SS , 0 ) ;
WRITE ( MAX6675_SS , 0 ) ;
@ -1190,13 +1190,13 @@ void disable_heater() {
// read MSB
// read MSB
SPDR = 0 ;
SPDR = 0 ;
for ( ; ( SPSR & ( 1 < < SPIF ) ) = = 0 ; ) ;
for ( ; ( SPSR & BIT ( SPIF ) ) = = 0 ; ) ;
max6675_temp = SPDR ;
max6675_temp = SPDR ;
max6675_temp < < = 8 ;
max6675_temp < < = 8 ;
// read LSB
// read LSB
SPDR = 0 ;
SPDR = 0 ;
for ( ; ( SPSR & ( 1 < < SPIF ) ) = = 0 ; ) ;
for ( ; ( SPSR & BIT ( SPIF ) ) = = 0 ; ) ;
max6675_temp | = SPDR ;
max6675_temp | = SPDR ;
// disable TT_MAX6675
// disable TT_MAX6675
@ -1246,7 +1246,7 @@ ISR(TIMER0_COMPB_vect) {
static unsigned long raw_temp_3_value = 0 ;
static unsigned long raw_temp_3_value = 0 ;
static unsigned long raw_temp_bed_value = 0 ;
static unsigned long raw_temp_bed_value = 0 ;
static TempState temp_state = StartupDelay ;
static TempState temp_state = StartupDelay ;
static unsigned char pwm_count = ( 1 < < SOFT_PWM_SCALE ) ;
static unsigned char pwm_count = BIT ( SOFT_PWM_SCALE ) ;
// Static members for each heater
// Static members for each heater
# ifdef SLOW_PWM_HEATERS
# ifdef SLOW_PWM_HEATERS
@ -1331,7 +1331,7 @@ ISR(TIMER0_COMPB_vect) {
if ( soft_pwm_fan < pwm_count ) WRITE_FAN ( 0 ) ;
if ( soft_pwm_fan < pwm_count ) WRITE_FAN ( 0 ) ;
# endif
# endif
pwm_count + = ( 1 < < SOFT_PWM_SCALE ) ;
pwm_count + = BIT ( SOFT_PWM_SCALE ) ;
pwm_count & = 0x7f ;
pwm_count & = 0x7f ;
# else // SLOW_PWM_HEATERS
# else // SLOW_PWM_HEATERS
@ -1412,7 +1412,7 @@ ISR(TIMER0_COMPB_vect) {
if ( soft_pwm_fan < pwm_count ) WRITE_FAN ( 0 ) ;
if ( soft_pwm_fan < pwm_count ) WRITE_FAN ( 0 ) ;
# endif //FAN_SOFT_PWM
# endif //FAN_SOFT_PWM
pwm_count + = ( 1 < < SOFT_PWM_SCALE ) ;
pwm_count + = BIT ( SOFT_PWM_SCALE ) ;
pwm_count & = 0x7f ;
pwm_count & = 0x7f ;
// increment slow_pwm_count only every 64 pwm_count circa 65.5ms
// increment slow_pwm_count only every 64 pwm_count circa 65.5ms
@ -1438,9 +1438,9 @@ ISR(TIMER0_COMPB_vect) {
# endif // SLOW_PWM_HEATERS
# endif // SLOW_PWM_HEATERS
# define SET_ADMUX_ADCSRA(pin) ADMUX = (1 << REFS0) | (pin & 0x07); ADCSRA |= 1<<ADSC
# define SET_ADMUX_ADCSRA(pin) ADMUX = BIT(REFS0) | (pin & 0x07); ADCSRA |= BIT(ADSC)
# ifdef MUX5
# ifdef MUX5
# define START_ADC(pin) if (pin > 7) ADCSRB = 1 << MUX5 ; else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
# define START_ADC(pin) if (pin > 7) ADCSRB = BIT(MUX5) ; else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
# else
# else
# define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
# define START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
# endif
# endif