From 51e89a269c17b61feec6563e705391d920179dfe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 22:29:30 -0700 Subject: [PATCH] Overridable Options - Part 9 (PR#2561) Apply `ENABLED` / `DISABLED` macros to temperature-related files. --- Marlin/temperature.cpp | 130 ++++++++++++++++++++--------------------- Marlin/temperature.h | 24 ++++---- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 9f99c1368..fa064adcc 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -34,7 +34,7 @@ #define K2 (1.0-K1) #endif -#if defined(PIDTEMPBED) || defined(PIDTEMP) +#if ENABLED(PIDTEMPBED) || ENABLED(PIDTEMP) #define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0)) #endif @@ -48,39 +48,39 @@ int current_temperature_raw[4] = { 0 }; float current_temperature[4] = { 0.0 }; int current_temperature_bed_raw = 0; float current_temperature_bed = 0.0; -#ifdef TEMP_SENSOR_1_AS_REDUNDANT +#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) int redundant_temperature_raw = 0; float redundant_temperature = 0.0; #endif -#ifdef PIDTEMPBED +#if ENABLED(PIDTEMPBED) float bedKp=DEFAULT_bedKp; float bedKi=(DEFAULT_bedKi*PID_dT); float bedKd=(DEFAULT_bedKd/PID_dT); #endif //PIDTEMPBED -#ifdef FAN_SOFT_PWM +#if ENABLED(FAN_SOFT_PWM) unsigned char fanSpeedSoftPwm; #endif unsigned char soft_pwm_bed; -#ifdef BABYSTEPPING +#if ENABLED(BABYSTEPPING) volatile int babystepsTodo[3] = { 0 }; #endif -#ifdef FILAMENT_SENSOR +#if ENABLED(FILAMENT_SENSOR) int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only #endif -#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) +#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED) enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway }; void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); - #ifdef THERMAL_PROTECTION_HOTENDS + #if ENABLED(THERMAL_PROTECTION_HOTENDS) static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; static millis_t thermal_runaway_timer[4]; // = {0,0,0,0}; #endif - #if defined(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0 + #if ENABLED(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0 static TRState thermal_runaway_bed_state_machine = TRReset; static millis_t thermal_runaway_bed_timer; #endif @@ -92,7 +92,7 @@ unsigned char soft_pwm_bed; static volatile bool temp_meas_ready = false; -#ifdef PIDTEMP +#if ENABLED(PIDTEMP) //static cannot be external: static float temp_iState[EXTRUDERS] = { 0 }; static float temp_dState[EXTRUDERS] = { 0 }; @@ -105,7 +105,7 @@ static volatile bool temp_meas_ready = false; static float temp_iState_max[EXTRUDERS]; static bool pid_reset[EXTRUDERS]; #endif //PIDTEMP -#ifdef PIDTEMPBED +#if ENABLED(PIDTEMPBED) //static cannot be external: static float temp_iState_bed = { 0 }; static float temp_dState_bed = { 0 }; @@ -121,26 +121,26 @@ static volatile bool temp_meas_ready = false; #endif //PIDTEMPBED static unsigned char soft_pwm[EXTRUDERS]; -#ifdef FAN_SOFT_PWM +#if ENABLED(FAN_SOFT_PWM) static unsigned char soft_pwm_fan; #endif #if HAS_AUTO_FAN static millis_t next_auto_fan_check_ms; #endif -#ifdef PIDTEMP - #ifdef PID_PARAMS_PER_EXTRUDER +#if ENABLED(PIDTEMP) + #if ENABLED(PID_PARAMS_PER_EXTRUDER) float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kp); float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Ki*PID_dT); float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kd / PID_dT); - #ifdef PID_ADD_EXTRUSION_RATE + #if ENABLED(PID_ADD_EXTRUSION_RATE) float Kc[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_Kc); #endif // PID_ADD_EXTRUSION_RATE #else //PID_PARAMS_PER_EXTRUDER float Kp = DEFAULT_Kp; float Ki = DEFAULT_Ki * PID_dT; float Kd = DEFAULT_Kd / PID_dT; - #ifdef PID_ADD_EXTRUSION_RATE + #if ENABLED(PID_ADD_EXTRUSION_RATE) float Kc = DEFAULT_Kc; #endif // PID_ADD_EXTRUSION_RATE #endif // PID_PARAMS_PER_EXTRUDER @@ -158,7 +158,7 @@ static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP; #endif -#ifdef TEMP_SENSOR_1_AS_REDUNDANT +#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE }; static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN }; #else @@ -170,7 +170,7 @@ static float analog2temp(int raw, uint8_t e); static float analog2tempBed(int raw); static void updateTemperaturesFromRawValues(); -#ifdef THERMAL_PROTECTION_HOTENDS +#if ENABLED(THERMAL_PROTECTION_HOTENDS) int watch_target_temp[EXTRUDERS] = { 0 }; millis_t watch_heater_next_ms[EXTRUDERS] = { 0 }; #endif @@ -179,11 +179,11 @@ static void updateTemperaturesFromRawValues(); #define SOFT_PWM_SCALE 0 #endif -#ifdef FILAMENT_SENSOR +#if ENABLED(FILAMENT_SENSOR) static int meas_shift_index; //used to point to a delayed sample in buffer for filament width sensor #endif -#ifdef HEATER_0_USES_MAX6675 +#if ENABLED(HEATER_0_USES_MAX6675) static int read_max6675(); #endif @@ -354,12 +354,12 @@ void PID_autotune(float temp, int extruder, int ncycles) { } void updatePID() { - #ifdef PIDTEMP + #if ENABLED(PIDTEMP) for (int e = 0; e < EXTRUDERS; e++) { temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e); } #endif - #ifdef PIDTEMPBED + #if ENABLED(PIDTEMPBED) temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; #endif } @@ -453,7 +453,7 @@ inline void _temp_error(int e, const char *serial_msg, const char *lcd_msg) { SERIAL_ERRORPGM(MSG_STOPPED_HEATER); if (e >= 0) SERIAL_ERRORLN((int)e); else SERIAL_ERRORLNPGM(MSG_HEATER_BED); } - #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE + #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE) if (!killed) { Running = false; killed = true; @@ -473,8 +473,8 @@ void min_temp_error(uint8_t e) { float get_pid_output(int e) { float pid_output; - #ifdef PIDTEMP - #ifndef PID_OPENLOOP + #if ENABLED(PIDTEMP) + #if DISABLED(PID_OPENLOOP) pid_error[e] = target_temperature[e] - current_temperature[e]; dTerm[e] = K2 * PID_PARAM(Kd,e) * (current_temperature[e] - temp_dState[e]) + K1 * dTerm[e]; temp_dState[e] = current_temperature[e]; @@ -510,7 +510,7 @@ float get_pid_output(int e) { pid_output = constrain(target_temperature[e], 0, PID_MAX); #endif //PID_OPENLOOP - #ifdef PID_DEBUG + #if ENABLED(PID_DEBUG) SERIAL_ECHO_START; SERIAL_ECHO(MSG_PID_DEBUG); SERIAL_ECHO(e); @@ -533,10 +533,10 @@ float get_pid_output(int e) { return pid_output; } -#ifdef PIDTEMPBED +#if ENABLED(PIDTEMPBED) float get_pid_output_bed() { float pid_output; - #ifndef PID_OPENLOOP + #if DISABLED(PID_OPENLOOP) pid_error_bed = target_temperature_bed - current_temperature_bed; pTerm_bed = bedKp * pid_error_bed; temp_iState_bed += pid_error_bed; @@ -559,7 +559,7 @@ float get_pid_output(int e) { pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER); #endif // PID_OPENLOOP - #ifdef PID_BED_DEBUG + #if ENABLED(PID_BED_DEBUG) SERIAL_ECHO_START; SERIAL_ECHO(" PID_BED_DEBUG "); SERIAL_ECHO(": Input "); @@ -592,20 +592,20 @@ void manage_heater() { updateTemperaturesFromRawValues(); - #ifdef HEATER_0_USES_MAX6675 + #if ENABLED(HEATER_0_USES_MAX6675) float ct = current_temperature[0]; if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0); if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0); #endif - #if defined(THERMAL_PROTECTION_HOTENDS) || !defined(PIDTEMPBED) || HAS_AUTO_FAN + #if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN millis_t ms = millis(); #endif // Loop through all extruders for (int e = 0; e < EXTRUDERS; e++) { - #ifdef THERMAL_PROTECTION_HOTENDS + #if ENABLED(THERMAL_PROTECTION_HOTENDS) thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); #endif @@ -615,7 +615,7 @@ void manage_heater() { soft_pwm[e] = current_temperature[e] > minttemp[e] && current_temperature[e] < maxttemp[e] ? (int)pid_output >> 1 : 0; // Check if the temperature is failing to increase - #ifdef THERMAL_PROTECTION_HOTENDS + #if ENABLED(THERMAL_PROTECTION_HOTENDS) // Is it time to check this extruder's heater? if (watch_heater_next_ms[e] && ms > watch_heater_next_ms[e]) { @@ -632,7 +632,7 @@ void manage_heater() { #endif // THERMAL_PROTECTION_HOTENDS - #ifdef TEMP_SENSOR_1_AS_REDUNDANT + #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) if (fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) { _temp_error(0, PSTR(MSG_EXTRUDER_SWITCHED_OFF), PSTR(MSG_ERR_REDUNDANT_TEMP)); } @@ -648,7 +648,7 @@ void manage_heater() { #endif // Control the extruder rate based on the width sensor - #ifdef FILAMENT_SENSOR + #if ENABLED(FILAMENT_SENSOR) if (filament_sensor) { meas_shift_index = delay_index1 - meas_delay_cm; if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1; //loop around buffer if needed @@ -662,23 +662,23 @@ void manage_heater() { } #endif //FILAMENT_SENSOR - #ifndef PIDTEMPBED + #if DISABLED(PIDTEMPBED) if (ms < next_bed_check_ms) return; next_bed_check_ms = ms + BED_CHECK_INTERVAL; #endif #if TEMP_SENSOR_BED != 0 - #ifdef THERMAL_PROTECTION_BED + #if ENABLED(THERMAL_PROTECTION_BED) thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); #endif - #ifdef PIDTEMPBED + #if ENABLED(PIDTEMPBED) float pid_output = get_pid_output_bed(); soft_pwm_bed = current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP ? (int)pid_output >> 1 : 0; - #elif defined(BED_LIMIT_SWITCHING) + #elif ENABLED(BED_LIMIT_SWITCHING) // Check if temperature is within the correct band if (current_temperature_bed > BED_MINTEMP && current_temperature_bed < BED_MAXTEMP) { if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) @@ -707,7 +707,7 @@ void manage_heater() { // Derived from RepRap FiveD extruder::getTemperature() // For hot end temperature measurement. static float analog2temp(int raw, uint8_t e) { - #ifdef TEMP_SENSOR_1_AS_REDUNDANT + #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) if (e > EXTRUDERS) #else if (e >= EXTRUDERS) @@ -720,7 +720,7 @@ static float analog2temp(int raw, uint8_t e) { return 0.0; } - #ifdef HEATER_0_USES_MAX6675 + #if ENABLED(HEATER_0_USES_MAX6675) if (e == 0) return 0.25 * raw; #endif @@ -750,7 +750,7 @@ static float analog2temp(int raw, uint8_t e) { // Derived from RepRap FiveD extruder::getTemperature() // For bed temperature measurement. static float analog2tempBed(int raw) { - #ifdef BED_USES_THERMISTOR + #if ENABLED(BED_USES_THERMISTOR) float celsius = 0; byte i; @@ -778,14 +778,14 @@ static float analog2tempBed(int raw) { /* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context, and this function is called from normal context as it is too slow to run in interrupts and will block the stepper routine otherwise */ static void updateTemperaturesFromRawValues() { - #ifdef HEATER_0_USES_MAX6675 + #if ENABLED(HEATER_0_USES_MAX6675) current_temperature_raw[0] = read_max6675(); #endif for (uint8_t e = 0; e < EXTRUDERS; e++) { current_temperature[e] = analog2temp(current_temperature_raw[e], e); } current_temperature_bed = analog2tempBed(current_temperature_bed_raw); - #ifdef TEMP_SENSOR_1_AS_REDUNDANT + #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature = analog2temp(redundant_temperature_raw, 1); #endif #if HAS_FILAMENT_SENSOR @@ -800,7 +800,7 @@ static void updateTemperaturesFromRawValues() { } -#ifdef FILAMENT_SENSOR +#if ENABLED(FILAMENT_SENSOR) // Convert raw Filament Width to millimeters float analog2widthFil() { @@ -834,11 +834,11 @@ void tp_init() { for (int e = 0; e < EXTRUDERS; e++) { // populate with the first value maxttemp[e] = maxttemp[0]; - #ifdef PIDTEMP + #if ENABLED(PIDTEMP) temp_iState_min[e] = 0.0; temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / PID_PARAM(Ki,e); #endif //PIDTEMP - #ifdef PIDTEMPBED + #if ENABLED(PIDTEMPBED) temp_iState_min_bed = 0.0; temp_iState_max_bed = PID_BED_INTEGRAL_DRIVE_MAX / bedKi; #endif //PIDTEMPBED @@ -861,17 +861,17 @@ void tp_init() { #endif #if HAS_FAN SET_OUTPUT(FAN_PIN); - #ifdef FAST_PWM_FAN + #if ENABLED(FAST_PWM_FAN) setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 #endif - #ifdef FAN_SOFT_PWM + #if ENABLED(FAN_SOFT_PWM) soft_pwm_fan = fanSpeedSoftPwm / 2; #endif #endif - #ifdef HEATER_0_USES_MAX6675 + #if ENABLED(HEATER_0_USES_MAX6675) - #ifndef SDSUPPORT + #if DISABLED(SDSUPPORT) OUT_WRITE(SCK_PIN, LOW); OUT_WRITE(MOSI_PIN, HIGH); OUT_WRITE(MISO_PIN, HIGH); @@ -1004,7 +1004,7 @@ void tp_init() { #endif //BED_MAXTEMP } -#ifdef THERMAL_PROTECTION_HOTENDS +#if ENABLED(THERMAL_PROTECTION_HOTENDS) /** * Start Heating Sanity Check for hotends that are below * their target temperature by a configurable margin. @@ -1020,7 +1020,7 @@ void tp_init() { } #endif -#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) +#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED) void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) { @@ -1115,7 +1115,7 @@ void disable_all_heaters() { #endif } -#ifdef HEATER_0_USES_MAX6675 +#if ENABLED(HEATER_0_USES_MAX6675) #define MAX6675_HEAT_INTERVAL 250u static millis_t next_max6675_ms = 0; int max6675_temp = 2000; @@ -1196,11 +1196,11 @@ static unsigned long raw_temp_value[4] = { 0 }; static unsigned long raw_temp_bed_value = 0; static void set_current_temp_raw() { - #if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675) + #if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675) current_temperature_raw[0] = raw_temp_value[0]; #endif #if HAS_TEMP_1 - #ifdef TEMP_SENSOR_1_AS_REDUNDANT + #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature_raw = raw_temp_value[1]; #else current_temperature_raw[1] = raw_temp_value[1]; @@ -1230,7 +1230,7 @@ ISR(TIMER0_COMPB_vect) { static unsigned char pwm_count = BIT(SOFT_PWM_SCALE); // Static members for each heater - #ifdef SLOW_PWM_HEATERS + #if ENABLED(SLOW_PWM_HEATERS) static unsigned char slow_pwm_count = 0; #define ISR_STATICS(n) \ static unsigned char soft_pwm_ ## n; \ @@ -1242,7 +1242,7 @@ ISR(TIMER0_COMPB_vect) { // Statics per heater ISR_STATICS(0); - #if (EXTRUDERS > 1) || defined(HEATERS_PARALLEL) + #if (EXTRUDERS > 1) || ENABLED(HEATERS_PARALLEL) ISR_STATICS(1); #if EXTRUDERS > 2 ISR_STATICS(2); @@ -1259,7 +1259,7 @@ ISR(TIMER0_COMPB_vect) { static unsigned long raw_filwidth_value = 0; #endif - #ifndef SLOW_PWM_HEATERS + #if DISABLED(SLOW_PWM_HEATERS) /** * standard PWM modulation */ @@ -1287,7 +1287,7 @@ ISR(TIMER0_COMPB_vect) { soft_pwm_BED = soft_pwm_bed; WRITE_HEATER_BED(soft_pwm_BED > 0 ? 1 : 0); #endif - #ifdef FAN_SOFT_PWM + #if ENABLED(FAN_SOFT_PWM) soft_pwm_fan = fanSpeedSoftPwm / 2; WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); #endif @@ -1308,7 +1308,7 @@ ISR(TIMER0_COMPB_vect) { if (soft_pwm_BED < pwm_count) WRITE_HEATER_BED(0); #endif - #ifdef FAN_SOFT_PWM + #if ENABLED(FAN_SOFT_PWM) if (soft_pwm_fan < pwm_count) WRITE_FAN(0); #endif @@ -1385,7 +1385,7 @@ ISR(TIMER0_COMPB_vect) { PWM_OFF_ROUTINE(BED); // BED #endif - #ifdef FAN_SOFT_PWM + #if ENABLED(FAN_SOFT_PWM) if (pwm_count == 0) { soft_pwm_fan = fanSpeedSoftPwm / 2; WRITE_FAN(soft_pwm_fan > 0 ? 1 : 0); @@ -1540,7 +1540,7 @@ ISR(TIMER0_COMPB_vect) { for (int i = 0; i < 4; i++) raw_temp_value[i] = 0; raw_temp_bed_value = 0; - #if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675) + #if HAS_TEMP_0 && DISABLED(HEATER_0_USES_MAX6675) #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #define GE0 <= #else @@ -1592,7 +1592,7 @@ ISR(TIMER0_COMPB_vect) { } // temp_count >= OVERSAMPLENR - #ifdef BABYSTEPPING + #if ENABLED(BABYSTEPPING) for (uint8_t axis = X_AXIS; axis <= Z_AXIS; axis++) { int curTodo = babystepsTodo[axis]; //get rid of volatile for performance @@ -1608,7 +1608,7 @@ ISR(TIMER0_COMPB_vect) { #endif //BABYSTEPPING } -#ifdef PIDTEMP +#if ENABLED(PIDTEMP) // Apply the scale factors to the PID values float scalePID_i(float i) { return i * PID_dT; } float unscalePID_i(float i) { return i / PID_dT; } diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 6ab35d52e..ed18aaf5f 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -23,7 +23,7 @@ #include "Marlin.h" #include "planner.h" -#ifdef PID_ADD_EXTRUSION_RATE +#if ENABLED(PID_ADD_EXTRUSION_RATE) #include "stepper.h" #endif @@ -31,7 +31,7 @@ void tp_init(); //initialize the heating void manage_heater(); //it is critical that this is called periodically. -#ifdef FILAMENT_SENSOR +#if ENABLED(FILAMENT_SENSOR) // For converting raw Filament Width to milimeters float analog2widthFil(); @@ -43,13 +43,13 @@ void manage_heater(); //it is critical that this is called periodically. // do not use these routines and variables outside of temperature.cpp extern int target_temperature[4]; extern float current_temperature[4]; -#ifdef SHOW_TEMP_ADC_VALUES +#if ENABLED(SHOW_TEMP_ADC_VALUES) extern int current_temperature_raw[4]; extern int current_temperature_bed_raw; #endif extern int target_temperature_bed; extern float current_temperature_bed; -#ifdef TEMP_SENSOR_1_AS_REDUNDANT +#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) extern float redundant_temperature; #endif @@ -57,9 +57,9 @@ extern float current_temperature_bed; extern unsigned char soft_pwm_bed; #endif -#ifdef PIDTEMP +#if ENABLED(PIDTEMP) - #ifdef PID_PARAMS_PER_EXTRUDER + #if ENABLED(PID_PARAMS_PER_EXTRUDER) extern float Kp[EXTRUDERS], Ki[EXTRUDERS], Kd[EXTRUDERS], Kc[EXTRUDERS]; // one param per extruder #define PID_PARAM(param,e) param[e] // use macro to point to array value #else @@ -73,11 +73,11 @@ extern float current_temperature_bed; #endif -#ifdef PIDTEMPBED +#if ENABLED(PIDTEMPBED) extern float bedKp,bedKi,bedKd; #endif -#ifdef BABYSTEPPING +#if ENABLED(BABYSTEPPING) extern volatile int babystepsTodo[3]; #endif @@ -88,7 +88,7 @@ extern float current_temperature_bed; FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; } FORCE_INLINE float degBed() { return current_temperature_bed; } -#ifdef SHOW_TEMP_ADC_VALUES +#if ENABLED(SHOW_TEMP_ADC_VALUES) FORCE_INLINE float rawHotendTemp(uint8_t extruder) { return current_temperature_raw[extruder]; } FORCE_INLINE float rawBedTemp() { return current_temperature_bed_raw; } #endif @@ -96,13 +96,13 @@ FORCE_INLINE float degBed() { return current_temperature_bed; } FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; } FORCE_INLINE float degTargetBed() { return target_temperature_bed; } -#ifdef THERMAL_PROTECTION_HOTENDS +#if ENABLED(THERMAL_PROTECTION_HOTENDS) void start_watching_heater(int e=0); #endif FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { target_temperature[extruder] = celsius; - #ifdef THERMAL_PROTECTION_HOTENDS + #if ENABLED(THERMAL_PROTECTION_HOTENDS) start_watching_heater(extruder); #endif } @@ -147,7 +147,7 @@ void setExtruderAutoFanState(int pin, bool state); void checkExtruderAutoFans(); FORCE_INLINE void autotempShutdown() { - #ifdef AUTOTEMP + #if ENABLED(AUTOTEMP) if (autotemp_enabled) { autotemp_enabled = false; if (degTargetHotend(active_extruder) > autotemp_min)