Move M163-M165 MIXING_EXTRUDER to cpp

This commit is contained in:
Scott Lahteine
2017-09-18 00:06:16 -05:00
parent 8ca0b2fd68
commit 1a37ebc76d
10 changed files with 166 additions and 84 deletions

View File

@ -20,6 +20,13 @@
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(MIXING_EXTRUDER)
#include "../../gcode.h"
#include "../../../feature/mixing.h"
/**
* M163: Set a single mix factor for a mixing extruder
* This is called "weight" by some systems.
@ -28,7 +35,7 @@
* P[float] The mix value
*
*/
void gcode_M163() {
void GcodeSuite::M163() {
const int mix_index = parser.intval('S');
if (mix_index < MIXING_STEPPERS) {
float mix_value = parser.floatval('P');
@ -36,3 +43,5 @@ void gcode_M163() {
mixing_factor[mix_index] = RECIPROCAL(mix_value);
}
}
#endif // MIXING_EXTRUDER

View File

@ -20,13 +20,20 @@
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
#include "../../gcode.h"
#include "../../../feature/mixing.h"
/**
* M164: Store the current mix factors as a virtual tool.
*
* S[index] The virtual tool to store
*
*/
void gcode_M164() {
void GcodeSuite::M164() {
const int tool_index = parser.intval('S');
if (tool_index < MIXING_VIRTUAL_TOOLS) {
normalize_mix();
@ -34,3 +41,5 @@ void gcode_M164() {
mixing_virtual_tool_mix[tool_index][i] = mixing_factor[i];
}
}
#endif // MIXING_EXTRUDER && MIXING_VIRTUAL_TOOLS > 1

View File

@ -20,6 +20,13 @@
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(DIRECT_MIXING_IN_G1)
#include "../../gcode.h"
#include "../../../feature/mixing.h"
/**
* M165: Set multiple mix factors for a mixing extruder.
* Factors that are left out will be set to 0.
@ -33,4 +40,6 @@
* I[factor] Mix factor for extruder stepper 6
*
*/
void gcode_M165() { gcode_get_mix(); }
void GcodeSuite::M165() { gcode_get_mix(); }
#endif // DIRECT_MIXING_IN_G1

View File

@ -116,9 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
//
// Placeholders for non-migrated codes
//
extern void gcode_M163();
extern void gcode_M164();
extern void gcode_M165();
extern void gcode_M999();
extern void gcode_T(uint8_t tmp_extruder);
@ -462,18 +459,12 @@ void GcodeSuite::process_next_command() {
#endif
#if ENABLED(MIXING_EXTRUDER)
case 163: // M163: Set a component weight for mixing extruder
gcode_M163();
break;
case 163: M163(); break; // M163: Set a component weight for mixing extruder
#if MIXING_VIRTUAL_TOOLS > 1
case 164: // M164: Save current mix as a virtual extruder
gcode_M164();
break;
case 164: M164(); break; // M164: Save current mix as a virtual extruder
#endif
#if ENABLED(DIRECT_MIXING_IN_G1)
case 165: // M165: Set multiple mix weights
gcode_M165();
break;
case 165: M165(); break; // M165: Set multiple mix weights
#endif
#endif