Browse Source

Improve conditions for HAS_TEMP

and use them in temperuture.h

Flattened the if structure - the preprocessor is doing the work - not the Arduino. Arduino.
pull/1/head
AnHardt 10 years ago
parent
commit
3f2e863206
  1. 10
      Marlin/Conditionals.h
  2. 43
      Marlin/temperature.cpp

10
Marlin/Conditionals.h

@ -345,11 +345,11 @@
/**
* Shorthand for pin tests, for temperature.cpp
*/
#define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
#define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
#define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
#define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
#define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
#define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0 && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2)
#define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0 && TEMP_SENSOR_1 != 0)
#define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0 && TEMP_SENSOR_2 != 0)
#define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0 && TEMP_SENSOR_3 != 0)
#define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0 && TEMP_SENSOR_BED != 0)
#define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
#define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
#define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0)

43
Marlin/temperature.cpp

@ -1543,7 +1543,7 @@ ISR(TIMER0_COMPB_vect) {
if ((minttemp_raw[0]) GE0 (current_temperature_raw[0])) min_temp_error(0);
#endif
#if EXTRUDERS > 1
#if HAS_TEMP_1
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
#define GE1 <=
#else
@ -1551,30 +1551,29 @@ ISR(TIMER0_COMPB_vect) {
#endif
if ((current_temperature_raw[1]) GE1 (maxttemp_raw[1])) max_temp_error(1);
if ((minttemp_raw[1]) GE1 (current_temperature_raw[1])) min_temp_error(1);
#endif // TEMP_SENSOR_1
#if EXTRUDERS > 2
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
#define GE2 <=
#else
#define GE2 >=
#endif
if ((current_temperature_raw[2]) GE2 (maxttemp_raw[2])) max_temp_error(2);
if ((minttemp_raw[2]) GE2 (current_temperature_raw[2])) min_temp_error(2);
#if EXTRUDERS > 3
#if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
#define GE3 <=
#else
#define GE3 >=
#endif
if ((current_temperature_raw[3]) GE3 (maxttemp_raw[3])) max_temp_error(3);
if ((minttemp_raw[3]) GE3 (current_temperature_raw[3])) min_temp_error(3);
#if HAS_TEMP_2
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
#define GE2 <=
#else
#define GE2 >=
#endif
if ((current_temperature_raw[2]) GE2 (maxttemp_raw[2])) max_temp_error(2);
if ((minttemp_raw[2]) GE2 (current_temperature_raw[2])) min_temp_error(2);
#endif // TEMP_SENSOR_2
#endif // EXTRUDERS > 3
#endif // EXTRUDERS > 2
#endif // EXTRUDERS > 1
#if HAS_TEMP_3
#if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
#define GE3 <=
#else
#define GE3 >=
#endif
if ((current_temperature_raw[3]) GE3 (maxttemp_raw[3])) max_temp_error(3);
if ((minttemp_raw[3]) GE3 (current_temperature_raw[3])) min_temp_error(3);
#endif // TEMP_SENSOR_3
#if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
#if HAS_TEMP_BED
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
#define GEBED <=
#else

Loading…
Cancel
Save