Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#4158 from gudnimg/remove-dead-code-…
Browse files Browse the repository at this point in the history
…gudni-e1e2

Cleanup: remove unused extruder macros
  • Loading branch information
leptun committed Apr 23, 2023
2 parents 9662bb1 + b15beb2 commit ee8b95b
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 504 deletions.
22 changes: 0 additions & 22 deletions Firmware/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#define THERMISTORHEATER_0 TEMP_SENSOR_0
#define HEATER_0_USES_THERMISTOR
#endif
#if TEMP_SENSOR_1 > 0
#define THERMISTORHEATER_1 TEMP_SENSOR_1
#define HEATER_1_USES_THERMISTOR
#endif
#if TEMP_SENSOR_2 > 0
#define THERMISTORHEATER_2 TEMP_SENSOR_2
#define HEATER_2_USES_THERMISTOR
#endif
#if TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED
#define BED_USES_THERMISTOR
Expand All @@ -474,12 +466,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#if TEMP_SENSOR_0 == -1
#define HEATER_0_USES_AD595
#endif
#if TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595
#endif
#if TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595
#endif
#if TEMP_SENSOR_BED == -1
#define BED_USES_AD595
#endif
Expand All @@ -490,14 +476,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP
#endif
#if TEMP_SENSOR_1 == 0
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#endif
#if TEMP_SENSOR_2 == 0
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#endif
#if TEMP_SENSOR_BED == 0
#undef BED_MINTEMP
#undef BED_MAXTEMP
Expand Down
32 changes: 0 additions & 32 deletions Firmware/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,6 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_z() disable_force_z()
#endif // PSU_Delta


//#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
//#ifdef Z_DUAL_STEPPER_DRIVERS
//#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
//#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
//#else
//#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
//#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
//#endif
//#else
//#define enable_z() ;
//#define disable_z() ;
//#endif


#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
#define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON)
#define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON)
Expand All @@ -204,23 +189,6 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_e0() /* nothing */
#endif

#if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e1() /* nothing */
#define disable_e1() /* nothing */
#endif

#if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e2() /* nothing */
#define disable_e2() /* nothing */
#endif


enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
#define X_AXIS_MASK 1
#define Y_AXIS_MASK 2
Expand Down
42 changes: 6 additions & 36 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4938,8 +4938,6 @@ void process_commands()
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();
setTargetBed(0); //set bed target temperature back to 0
lcd_show_fullscreen_message_and_wait_P(_T(MSG_PINDA_CALIBRATION_DONE));
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1);
Expand Down Expand Up @@ -5269,8 +5267,6 @@ void process_commands()
enable_y();
enable_z();
enable_e0();
enable_e1();
enable_e2();
break;

#ifdef SDSUPPORT
Expand Down Expand Up @@ -6211,8 +6207,6 @@ SERIAL_PROTOCOLPGM("\n\n");
disable_heater();
st_synchronize();
disable_e0();
disable_e1();
disable_e2();
finishAndDisableSteppers();
fanSpeed = 0;
_delay(1000); // Wait a little before to switch off
Expand Down Expand Up @@ -6275,23 +6269,17 @@ SERIAL_PROTOCOLPGM("\n\n");
{
st_synchronize();
disable_e0();
disable_e1();
disable_e2();
finishAndDisableSteppers();
}
else
{
st_synchronize();
if (code_seen('X')) disable_x();
if (code_seen('Y')) disable_y();
if (code_seen('Z')) disable_z();
#if ((E0_ENABLE_PIN != X_ENABLE_PIN) && (E1_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
if (code_seen('E')) {
disable_e0();
disable_e1();
disable_e2();
}
#endif
if (code_seen('X')) disable_x();
if (code_seen('Y')) disable_y();
if (code_seen('Z')) disable_z();
#if (E0_ENABLE_PIN != X_ENABLE_PIN) // Only enable on boards that have seperate ENABLE_PINS
if (code_seen('E')) disable_e0();
#endif
}
}
break;
Expand Down Expand Up @@ -9277,15 +9265,6 @@ void controllerFan()
lastMotorCheck = _millis();

if(!READ(X_ENABLE_PIN) || !READ(Y_ENABLE_PIN) || !READ(Z_ENABLE_PIN) || (soft_pwm_bed > 0)
#if EXTRUDERS > 2
|| !READ(E2_ENABLE_PIN)
#endif
#if EXTRUDER > 1
#if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
|| !READ(X2_ENABLE_PIN)
#endif
|| !READ(E1_ENABLE_PIN)
#endif
|| !READ(E0_ENABLE_PIN)) //If any of the drivers are enabled...
{
lastMotor = _millis(); //... set time to NOW so the fan will turn on
Expand Down Expand Up @@ -9318,9 +9297,6 @@ void controllerFan()
*/
static void handleSafetyTimer()
{
#if (EXTRUDERS > 1)
#error Implemented only for one extruder.
#endif //(EXTRUDERS > 1)
if (printer_active() || (!degTargetBed() && !degTargetHotend(0)) || (!safetytimer_inactive_time))
{
safetyTimer.stop();
Expand Down Expand Up @@ -9370,8 +9346,6 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();
}
}
}
Expand Down Expand Up @@ -9459,8 +9433,6 @@ void kill(const char *full_screen_message) {
disable_y();
poweroff_z();
disable_e0();
disable_e1();
disable_e2();

SERIAL_ERROR_START;
SERIAL_ERRORLNRPGM(PSTR("Printer halted. kill() called!"));
Expand Down Expand Up @@ -9571,8 +9543,6 @@ void finishAndDisableSteppers()
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();

#ifndef LA_NOCOMPAT
// Steppers are disabled both when a print is stopped and also via M84 (which is additionally
Expand Down
7 changes: 1 addition & 6 deletions Firmware/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,7 @@ void check_axes_activity()
if((DISABLE_X) && (x_active == 0)) disable_x();
if((DISABLE_Y) && (y_active == 0)) disable_y();
if((DISABLE_Z) && (z_active == 0)) disable_z();
if((DISABLE_E) && (e_active == 0))
{
disable_e0();
disable_e1();
disable_e2();
}
if((DISABLE_E) && (e_active == 0)) disable_e0();
#if defined(FAN_PIN) && FAN_PIN > -1
#ifdef FAN_KICKSTART_TIME
static unsigned long fan_kick_end;
Expand Down
24 changes: 0 additions & 24 deletions Firmware/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,12 +1102,6 @@ void st_init()
#if defined(E0_DIR_PIN) && E0_DIR_PIN > -1
SET_OUTPUT(E0_DIR_PIN);
#endif
#if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
SET_OUTPUT(E1_DIR_PIN);
#endif
#if defined(E2_DIR_PIN) && (E2_DIR_PIN > -1)
SET_OUTPUT(E2_DIR_PIN);
#endif

//Initialize Enable Pins - steppers default to disabled.

Expand Down Expand Up @@ -1141,14 +1135,6 @@ void st_init()
SET_OUTPUT(E0_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
#endif
#if defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
SET_OUTPUT(E1_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E1_ENABLE_PIN,HIGH);
#endif
#if defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
SET_OUTPUT(E2_ENABLE_PIN);
if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH);
#endif

//endstops and pullups
#if defined(X_MIN_PIN) && X_MIN_PIN > -1
Expand Down Expand Up @@ -1246,16 +1232,6 @@ void st_init()
WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
disable_e0();
#endif
#if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1)
SET_OUTPUT(E1_STEP_PIN);
WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
disable_e1();
#endif
#if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1)
SET_OUTPUT(E2_STEP_PIN);
WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
disable_e2();
#endif

// waveform generation = 0100 = CTC
TCCR1B &= ~(1<<WGM13);
Expand Down
Loading

0 comments on commit ee8b95b

Please sign in to comment.