Browse Source

Move T (tool change) to cpp

pull/1/head
Scott Lahteine 7 years ago
parent
commit
07cf75883f
  1. 18
      Marlin/src/Marlin.cpp
  2. 7
      Marlin/src/gcode/control/T.cpp
  3. 6
      Marlin/src/gcode/gcode.cpp
  4. 2
      Marlin/src/gcode/gcode.h
  5. 9
      Marlin/src/module/tool_change.cpp
  6. 2
      Marlin/src/module/tool_change.h

18
Marlin/src/Marlin.cpp

@ -54,10 +54,6 @@
#include "libs/buzzer.h"
#endif
#if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE)
#include "module/tool_change.h"
#endif
#if ENABLED(DIGIPOT_I2C)
#include "feature/digipot/digipot.h"
#endif
@ -138,6 +134,10 @@
#include "feature/caselight.h"
#endif
#if (ENABLED(SWITCHING_EXTRUDER) && !DONT_SWITCH) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
#include "module/tool_change.h"
#endif
bool Running = true;
/**
@ -320,8 +320,6 @@ void quickstop_stepper() {
SYNC_PLAN_POSITION_KINEMATIC();
}
#include "gcode/control/T.h"
#if ENABLED(USE_CONTROLLER_FAN)
void controllerFan() {
@ -932,13 +930,7 @@ void setup() {
#endif
#if ENABLED(PARKING_EXTRUDER)
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
pe_activate_magnet(0);
pe_activate_magnet(1);
#else
pe_deactivate_magnet(0);
pe_deactivate_magnet(1);
#endif
pe_magnet_init();
#endif
}

7
Marlin/src/gcode/control/T.h → Marlin/src/gcode/control/T.cpp

@ -20,15 +20,20 @@
*
*/
#include "../gcode.h"
#include "../../module/tool_change.h"
#if ENABLED(DEBUG_LEVELING_FEATURE) || HOTENDS > 1
#include "../../module/motion.h"
#endif
/**
* T0-T3: Switch tool, usually switching extruders
*
* F[units/min] Set the movement feedrate
* S1 Don't move the tool in XY after change
*/
void gcode_T(uint8_t tmp_extruder) {
void GcodeSuite::T(const uint8_t tmp_extruder) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {

6
Marlin/src/gcode/gcode.cpp

@ -116,8 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
//
// Placeholders for non-migrated codes
//
extern void gcode_T(uint8_t tmp_extruder);
#if ENABLED(M100_FREE_MEMORY_WATCHER)
extern void M100_dump_routine(const char * const title, const char *start, const char *end);
#endif
@ -690,9 +688,7 @@ void GcodeSuite::process_next_command() {
}
break;
case 'T':
gcode_T(parser.codenum);
break;
case 'T': T(parser.codenum); break; // Tn: Tool Change
default: parser.unknown_command_error();
}

2
Marlin/src/gcode/gcode.h

@ -722,7 +722,7 @@ private:
static void M999();
static void T(uint8_t tmp_extruder);
static void T(const uint8_t tmp_extruder);
};

9
Marlin/src/module/tool_change.cpp

@ -84,6 +84,15 @@
#if ENABLED(PARKING_EXTRUDER)
void pe_magnet_init() {
for (uint8_t n = 0; n <= 1; ++n)
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
pe_activate_magnet(n);
#else
pe_deactivate_magnet(n);
#endif
}
void pe_set_magnet(const uint8_t extruder_num, const uint8_t state) {
switch (extruder_num) {
case 1: OUT_WRITE(SOL1_PIN, state); break;

2
Marlin/src/module/tool_change.h

@ -46,6 +46,8 @@
inline void pe_activate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, PE_MAGNET_ON_STATE); }
inline void pe_deactivate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, !PE_MAGNET_ON_STATE); }
void pe_magnet_init();
#endif // PARKING_EXTRUDER
/**

Loading…
Cancel
Save