Move T (tool change) to cpp

This commit is contained in:
Scott Lahteine 2017-09-18 01:05:44 -05:00
parent 927524af6b
commit 07cf75883f
6 changed files with 24 additions and 20 deletions

View File

@ -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
}

View File

@ -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)) {

View File

@ -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();
}

View File

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

View File

@ -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;

View File

@ -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
/**