@ -20,6 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)
|
||||
|
||||
#include "../../gcode.h"
|
||||
|
||||
#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
|
||||
@ -73,3 +77,34 @@ void GcodeSuite::M907() {
|
||||
LOOP_XYZE(i) if (parser.seen(axis_codes[i])) dac_current_percent(i, parser.value_float());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
|
||||
|
||||
/**
|
||||
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
|
||||
*/
|
||||
void GcodeSuite::M908() {
|
||||
#if HAS_DIGIPOTSS
|
||||
stepper.digitalPotWrite(
|
||||
parser.intval('P'),
|
||||
parser.intval('S')
|
||||
);
|
||||
#endif
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
dac_current_raw(
|
||||
parser.byteval('P', -1),
|
||||
parser.ushortval('S', 0)
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
|
||||
void GcodeSuite::M909() { dac_print_values(); }
|
||||
void GcodeSuite::M910() { dac_commit_eeprom(); }
|
||||
|
||||
#endif // DAC_STEPPER_CURRENT
|
||||
|
||||
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT || HAS_MOTOR_CURRENT_PWM || DIGIPOT_I2C
|
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
|
||||
|
||||
#include "../../gcode.h"
|
||||
|
||||
#if HAS_DIGIPOTSS
|
||||
#include "../../../module/stepper.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
#include "../../../feature/dac/stepper_dac.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M908: Control digital trimpot directly (M908 P<pin> S<current>)
|
||||
*/
|
||||
void GcodeSuite::M908() {
|
||||
#if HAS_DIGIPOTSS
|
||||
stepper.digitalPotWrite(
|
||||
parser.intval('P'),
|
||||
parser.intval('S')
|
||||
);
|
||||
#endif
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
dac_current_raw(
|
||||
parser.byteval('P', -1),
|
||||
parser.ushortval('S', 0)
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAS_DIGIPOTSS || DAC_STEPPER_CURRENT
|
@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/dac/stepper_dac.h"
|
||||
|
||||
void GcodeSuite::M909() {
|
||||
|
||||
dac_print_values();
|
||||
|
||||
}
|
||||
|
||||
#endif // DAC_STEPPER_CURRENT
|
@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/dac/stepper_dac.h"
|
||||
|
||||
void GcodeSuite::M910() {
|
||||
|
||||
dac_commit_eeprom();
|
||||
|
||||
}
|
||||
|
||||
#endif // DAC_STEPPER_CURRENT
|
@ -27,6 +27,21 @@
|
||||
#include "../../../feature/fwretract.h"
|
||||
#include "../../gcode.h"
|
||||
|
||||
/**
|
||||
* M207: Set firmware retraction values
|
||||
*
|
||||
* S[+units] retract_length
|
||||
* W[+units] swap_retract_length (multi-extruder)
|
||||
* F[units/min] retract_feedrate_mm_s
|
||||
* Z[units] retract_zlift
|
||||
*/
|
||||
void GcodeSuite::M207() {
|
||||
if (parser.seen('S')) fwretract.retract_length = parser.value_axis_units(E_AXIS);
|
||||
if (parser.seen('F')) fwretract.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
|
||||
if (parser.seen('Z')) fwretract.retract_zlift = parser.value_linear_units();
|
||||
if (parser.seen('W')) fwretract.swap_retract_length = parser.value_axis_units(E_AXIS);
|
||||
}
|
||||
|
||||
/**
|
||||
* M208: Set firmware un-retraction values
|
||||
*
|
||||
@ -42,4 +57,18 @@ void GcodeSuite::M208() {
|
||||
if (parser.seen('W')) fwretract.swap_retract_recover_length = parser.value_axis_units(E_AXIS);
|
||||
}
|
||||
|
||||
/**
|
||||
* M209: Enable automatic retract (M209 S1)
|
||||
* For slicers that don't support G10/11, reversed extrude-only
|
||||
* moves will be classified as retraction.
|
||||
*/
|
||||
void GcodeSuite::M209() {
|
||||
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
|
||||
if (parser.seen('S')) {
|
||||
fwretract.autoretract_enabled = parser.value_bool();
|
||||
for (uint8_t i = 0; i < EXTRUDERS; i++) fwretract.retracted[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // FWRETRACT
|
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
|
||||
#include "../../../feature/fwretract.h"
|
||||
#include "../../gcode.h"
|
||||
|
||||
/**
|
||||
* M207: Set firmware retraction values
|
||||
*
|
||||
* S[+units] retract_length
|
||||
* W[+units] swap_retract_length (multi-extruder)
|
||||
* F[units/min] retract_feedrate_mm_s
|
||||
* Z[units] retract_zlift
|
||||
*/
|
||||
void GcodeSuite::M207() {
|
||||
if (parser.seen('S')) fwretract.retract_length = parser.value_axis_units(E_AXIS);
|
||||
if (parser.seen('F')) fwretract.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
|
||||
if (parser.seen('Z')) fwretract.retract_zlift = parser.value_linear_units();
|
||||
if (parser.seen('W')) fwretract.swap_retract_length = parser.value_axis_units(E_AXIS);
|
||||
}
|
||||
|
||||
#endif // FWRETRACT
|
@ -1,44 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
|
||||
#include "../../../feature/fwretract.h"
|
||||
#include "../../gcode.h"
|
||||
|
||||
/**
|
||||
* M209: Enable automatic retract (M209 S1)
|
||||
* For slicers that don't support G10/11, reversed extrude-only
|
||||
* moves will be classified as retraction.
|
||||
*/
|
||||
void GcodeSuite::M209() {
|
||||
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
|
||||
if (parser.seen('S')) {
|
||||
fwretract.autoretract_enabled = parser.value_bool();
|
||||
for (uint8_t i = 0; i < EXTRUDERS; i++) fwretract.retracted[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // FWRETRACT
|
@ -44,4 +44,42 @@ void GcodeSuite::M163() {
|
||||
}
|
||||
}
|
||||
|
||||
#if MIXING_VIRTUAL_TOOLS > 1
|
||||
|
||||
/**
|
||||
* M164: Store the current mix factors as a virtual tool.
|
||||
*
|
||||
* S[index] The virtual tool to store
|
||||
*
|
||||
*/
|
||||
void GcodeSuite::M164() {
|
||||
const int tool_index = parser.intval('S');
|
||||
if (tool_index < MIXING_VIRTUAL_TOOLS) {
|
||||
normalize_mix();
|
||||
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
|
||||
mixing_virtual_tool_mix[tool_index][i] = mixing_factor[i];
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MIXING_VIRTUAL_TOOLS > 1
|
||||
|
||||
#if ENABLED(DIRECT_MIXING_IN_G1)
|
||||
|
||||
/**
|
||||
* M165: Set multiple mix factors for a mixing extruder.
|
||||
* Factors that are left out will be set to 0.
|
||||
* All factors together must add up to 1.0.
|
||||
*
|
||||
* A[factor] Mix factor for extruder stepper 1
|
||||
* B[factor] Mix factor for extruder stepper 2
|
||||
* C[factor] Mix factor for extruder stepper 3
|
||||
* D[factor] Mix factor for extruder stepper 4
|
||||
* H[factor] Mix factor for extruder stepper 5
|
||||
* I[factor] Mix factor for extruder stepper 6
|
||||
*
|
||||
*/
|
||||
void GcodeSuite::M165() { gcode_get_mix(); }
|
||||
|
||||
#endif // DIRECT_MIXING_IN_G1
|
||||
|
||||
#endif // MIXING_EXTRUDER
|
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#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 GcodeSuite::M164() {
|
||||
const int tool_index = parser.intval('S');
|
||||
if (tool_index < MIXING_VIRTUAL_TOOLS) {
|
||||
normalize_mix();
|
||||
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
|
||||
mixing_virtual_tool_mix[tool_index][i] = mixing_factor[i];
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MIXING_EXTRUDER && MIXING_VIRTUAL_TOOLS > 1
|
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#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.
|
||||
* All factors together must add up to 1.0.
|
||||
*
|
||||
* A[factor] Mix factor for extruder stepper 1
|
||||
* B[factor] Mix factor for extruder stepper 2
|
||||
* C[factor] Mix factor for extruder stepper 3
|
||||
* D[factor] Mix factor for extruder stepper 4
|
||||
* H[factor] Mix factor for extruder stepper 5
|
||||
* I[factor] Mix factor for extruder stepper 6
|
||||
*
|
||||
*/
|
||||
void GcodeSuite::M165() { gcode_get_mix(); }
|
||||
|
||||
#endif // DIRECT_MIXING_IN_G1
|
155
Marlin/src/gcode/feature/trinamic/M911-M914.cpp
Normal file
155
Marlin/src/gcode/feature/trinamic/M911-M914.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/tmc2130.h"
|
||||
#include "../../../module/stepper_indirection.h"
|
||||
|
||||
inline void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
|
||||
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
/**
|
||||
* M911: Report TMC2130 stepper driver overtemperature pre-warn flag
|
||||
* The flag is held by the library and persist until manually cleared by M912
|
||||
*/
|
||||
void GcodeSuite::M911() {
|
||||
const bool reportX = parser.seen('X'), reportY = parser.seen('Y'), reportZ = parser.seen('Z'), reportE = parser.seen('E'),
|
||||
reportAll = (!reportX && !reportY && !reportZ && !reportE) || (reportX && reportY && reportZ && reportE);
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (reportX || reportAll) tmc2130_report_otpw(stepperX, 'X');
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (reportY || reportAll) tmc2130_report_otpw(stepperY, 'Y');
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
if (reportZ || reportAll) tmc2130_report_otpw(stepperZ, 'Z');
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
if (reportE || reportAll) tmc2130_report_otpw(stepperE0, 'E');
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
|
||||
st.clear_otpw();
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOLNPGM(" prewarn flag cleared");
|
||||
}
|
||||
|
||||
/**
|
||||
* M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
|
||||
*/
|
||||
void GcodeSuite::M912() {
|
||||
const bool clearX = parser.seen('X'), clearY = parser.seen('Y'), clearZ = parser.seen('Z'), clearE = parser.seen('E'),
|
||||
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (clearX || clearAll) tmc2130_clear_otpw(stepperX, 'X');
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (clearY || clearAll) tmc2130_clear_otpw(stepperY, 'Y');
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
if (clearZ || clearAll) tmc2130_clear_otpw(stepperZ, 'Z');
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
if (clearE || clearAll) tmc2130_clear_otpw(stepperE0, 'E');
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(HYBRID_THRESHOLD)
|
||||
|
||||
#include "../../../module/planner.h"
|
||||
|
||||
inline void tmc2130_get_pwmthrs(TMC2130Stepper &st, const char name, const uint16_t spmm) {
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOPGM(" stealthChop max speed set to ");
|
||||
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.stealth_max_speed() * spmm));
|
||||
}
|
||||
inline void tmc2130_set_pwmthrs(TMC2130Stepper &st, const char name, const int32_t thrs, const uint32_t spmm) {
|
||||
st.stealth_max_speed(12650000UL * st.microsteps() / (256 * thrs * spmm));
|
||||
tmc2130_get_pwmthrs(st, name, spmm);
|
||||
}
|
||||
|
||||
/**
|
||||
* M913: Set HYBRID_THRESHOLD speed.
|
||||
*/
|
||||
void GcodeSuite::M913() {
|
||||
uint16_t values[XYZE];
|
||||
LOOP_XYZE(i)
|
||||
values[i] = parser.intval(axis_codes[i]);
|
||||
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (values[X_AXIS]) tmc2130_set_pwmthrs(stepperX, 'X', values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperX, 'X', planner.axis_steps_per_mm[X_AXIS]);
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (values[Y_AXIS]) tmc2130_set_pwmthrs(stepperY, 'Y', values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperY, 'Y', planner.axis_steps_per_mm[Y_AXIS]);
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
if (values[Z_AXIS]) tmc2130_set_pwmthrs(stepperZ, 'Z', values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperZ, 'Z', planner.axis_steps_per_mm[Z_AXIS]);
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
if (values[E_AXIS]) tmc2130_set_pwmthrs(stepperE0, 'E', values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperE0, 'E', planner.axis_steps_per_mm[E_AXIS]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HYBRID_THRESHOLD
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
|
||||
inline void tmc2130_get_sgt(TMC2130Stepper &st, const char name) {
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
|
||||
SERIAL_ECHOLN(st.sgt());
|
||||
}
|
||||
inline void tmc2130_set_sgt(TMC2130Stepper &st, const char name, const int8_t sgt_val) {
|
||||
st.sgt(sgt_val);
|
||||
tmc2130_get_sgt(st, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* M914: Set SENSORLESS_HOMING sensitivity.
|
||||
*/
|
||||
void GcodeSuite::M914() {
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (parser.seen(axis_codes[X_AXIS])) tmc2130_set_sgt(stepperX, 'X', parser.value_int());
|
||||
else tmc2130_get_sgt(stepperX, 'X');
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (parser.seen(axis_codes[Y_AXIS])) tmc2130_set_sgt(stepperY, 'Y', parser.value_int());
|
||||
else tmc2130_get_sgt(stepperY, 'Y');
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // SENSORLESS_HOMING
|
||||
|
||||
#endif // HAVE_TMC2130
|
@ -1,59 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/tmc2130.h"
|
||||
#include "../../../module/stepper_indirection.h"
|
||||
|
||||
inline void tmc2130_report_otpw(TMC2130Stepper &st, const char name) {
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOPGM(" axis temperature prewarn triggered: ");
|
||||
serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
/**
|
||||
* M911: Report TMC2130 stepper driver overtemperature pre-warn flag
|
||||
* The flag is held by the library and persist until manually cleared by M912
|
||||
*/
|
||||
void GcodeSuite::M911() {
|
||||
const bool reportX = parser.seen('X'), reportY = parser.seen('Y'), reportZ = parser.seen('Z'), reportE = parser.seen('E'),
|
||||
reportAll = (!reportX && !reportY && !reportZ && !reportE) || (reportX && reportY && reportZ && reportE);
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (reportX || reportAll) tmc2130_report_otpw(stepperX, 'X');
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (reportY || reportAll) tmc2130_report_otpw(stepperY, 'Y');
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
if (reportZ || reportAll) tmc2130_report_otpw(stepperZ, 'Z');
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
if (reportE || reportAll) tmc2130_report_otpw(stepperE0, 'E');
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC2130
|
@ -1,57 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAVE_TMC2130)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/tmc2130.h"
|
||||
#include "../../../module/stepper_indirection.h"
|
||||
|
||||
inline void tmc2130_clear_otpw(TMC2130Stepper &st, const char name) {
|
||||
st.clear_otpw();
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOLNPGM(" prewarn flag cleared");
|
||||
}
|
||||
|
||||
/**
|
||||
* M912: Clear TMC2130 stepper driver overtemperature pre-warn flag held by the library
|
||||
*/
|
||||
void GcodeSuite::M912() {
|
||||
const bool clearX = parser.seen('X'), clearY = parser.seen('Y'), clearZ = parser.seen('Z'), clearE = parser.seen('E'),
|
||||
clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (clearX || clearAll) tmc2130_clear_otpw(stepperX, 'X');
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (clearY || clearAll) tmc2130_clear_otpw(stepperY, 'Y');
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
if (clearZ || clearAll) tmc2130_clear_otpw(stepperZ, 'Z');
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
if (clearE || clearAll) tmc2130_clear_otpw(stepperE0, 'E');
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC2130
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(HYBRID_THRESHOLD)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/tmc2130.h"
|
||||
#include "../../../module/planner.h"
|
||||
#include "../../../module/stepper_indirection.h"
|
||||
|
||||
inline void tmc2130_get_pwmthrs(TMC2130Stepper &st, const char name, const uint16_t spmm) {
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOPGM(" stealthChop max speed set to ");
|
||||
SERIAL_ECHOLN(12650000UL * st.microsteps() / (256 * st.stealth_max_speed() * spmm));
|
||||
}
|
||||
inline void tmc2130_set_pwmthrs(TMC2130Stepper &st, const char name, const int32_t thrs, const uint32_t spmm) {
|
||||
st.stealth_max_speed(12650000UL * st.microsteps() / (256 * thrs * spmm));
|
||||
tmc2130_get_pwmthrs(st, name, spmm);
|
||||
}
|
||||
|
||||
/**
|
||||
* M913: Set HYBRID_THRESHOLD speed.
|
||||
*/
|
||||
void GcodeSuite::M913() {
|
||||
uint16_t values[XYZE];
|
||||
LOOP_XYZE(i)
|
||||
values[i] = parser.intval(axis_codes[i]);
|
||||
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (values[X_AXIS]) tmc2130_set_pwmthrs(stepperX, 'X', values[X_AXIS], planner.axis_steps_per_mm[X_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperX, 'X', planner.axis_steps_per_mm[X_AXIS]);
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (values[Y_AXIS]) tmc2130_set_pwmthrs(stepperY, 'Y', values[Y_AXIS], planner.axis_steps_per_mm[Y_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperY, 'Y', planner.axis_steps_per_mm[Y_AXIS]);
|
||||
#endif
|
||||
#if ENABLED(Z_IS_TMC2130)
|
||||
if (values[Z_AXIS]) tmc2130_set_pwmthrs(stepperZ, 'Z', values[Z_AXIS], planner.axis_steps_per_mm[Z_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperZ, 'Z', planner.axis_steps_per_mm[Z_AXIS]);
|
||||
#endif
|
||||
#if ENABLED(E0_IS_TMC2130)
|
||||
if (values[E_AXIS]) tmc2130_set_pwmthrs(stepperE0, 'E', values[E_AXIS], planner.axis_steps_per_mm[E_AXIS]);
|
||||
else tmc2130_get_pwmthrs(stepperE0, 'E', planner.axis_steps_per_mm[E_AXIS]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC2130 && HYBRID_THRESHOLD
|
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(HAVE_TMC2130) && ENABLED(SENSORLESS_HOMING)
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/tmc2130.h"
|
||||
#include "../../../module/stepper_indirection.h"
|
||||
|
||||
inline void tmc2130_get_sgt(TMC2130Stepper &st, const char name) {
|
||||
SERIAL_CHAR(name);
|
||||
SERIAL_ECHOPGM(" driver homing sensitivity set to ");
|
||||
SERIAL_ECHOLN(st.sgt());
|
||||
}
|
||||
inline void tmc2130_set_sgt(TMC2130Stepper &st, const char name, const int8_t sgt_val) {
|
||||
st.sgt(sgt_val);
|
||||
tmc2130_get_sgt(st, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* M914: Set SENSORLESS_HOMING sensitivity.
|
||||
*/
|
||||
void GcodeSuite::M914() {
|
||||
#if ENABLED(X_IS_TMC2130)
|
||||
if (parser.seen(axis_codes[X_AXIS])) tmc2130_set_sgt(stepperX, 'X', parser.value_int());
|
||||
else tmc2130_get_sgt(stepperX, 'X');
|
||||
#endif
|
||||
#if ENABLED(Y_IS_TMC2130)
|
||||
if (parser.seen(axis_codes[Y_AXIS])) tmc2130_set_sgt(stepperY, 'Y', parser.value_int());
|
||||
else tmc2130_get_sgt(stepperY, 'Y');
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAVE_TMC2130 && SENSORLESS_HOMING
|
Reference in New Issue
Block a user