Optimize target_extruder, ignore T with mixing (#12432)
* Optimize target_extruder, ignore T with mixing * Give G-code Tn parity with tool_change
This commit is contained in:
@ -39,10 +39,15 @@
|
||||
* M104: Set hot end temperature
|
||||
*/
|
||||
void GcodeSuite::M104() {
|
||||
if (get_target_extruder_from_command()) return;
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
const uint8_t e = target_extruder;
|
||||
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
|
||||
constexpr int8_t e = 0;
|
||||
#else
|
||||
const int8_t e = get_target_extruder_from_command();
|
||||
if (e < 0) return;
|
||||
#endif
|
||||
|
||||
if (parser.seenval('S')) {
|
||||
const int16_t temp = parser.value_celsius();
|
||||
@ -82,9 +87,15 @@ void GcodeSuite::M104() {
|
||||
*/
|
||||
void GcodeSuite::M109() {
|
||||
|
||||
if (get_target_extruder_from_command()) return;
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
|
||||
constexpr int8_t target_extruder = 0;
|
||||
#else
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
#endif
|
||||
|
||||
const bool no_wait_for_cooling = parser.seenval('S'),
|
||||
set_temp = no_wait_for_cooling || parser.seenval('R');
|
||||
if (set_temp) {
|
||||
|
@ -31,7 +31,9 @@
|
||||
* M105: Read hot end and bed temperature
|
||||
*/
|
||||
void GcodeSuite::M105() {
|
||||
if (get_target_extruder_from_command()) return;
|
||||
|
||||
const int8_t target_extruder = get_target_extruder_from_command();
|
||||
if (target_extruder < 0) return;
|
||||
|
||||
#if NUM_SERIAL > 1
|
||||
const int16_t port = command_queue_port[cmd_queue_index_r];
|
||||
@ -39,9 +41,9 @@ void GcodeSuite::M105() {
|
||||
|
||||
#if HAS_TEMP_SENSOR
|
||||
SERIAL_PROTOCOLPGM_P(port, MSG_OK);
|
||||
thermalManager.print_heaterstates(
|
||||
thermalManager.print_heater_states(target_extruder
|
||||
#if NUM_SERIAL > 1
|
||||
port
|
||||
, port
|
||||
#endif
|
||||
);
|
||||
#else // !HAS_TEMP_SENSOR
|
||||
|
@ -20,6 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/temperature.h"
|
||||
|
||||
@ -32,26 +36,36 @@
|
||||
* U<bool> with a non-zero value will apply the result to current settings
|
||||
*/
|
||||
void GcodeSuite::M303() {
|
||||
#if HAS_PID_HEATING
|
||||
const int e = parser.intval('E'), c = parser.intval('C', 5);
|
||||
const bool u = parser.boolval('U');
|
||||
|
||||
int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150);
|
||||
const int8_t e = parser.byteval('E');
|
||||
|
||||
if (WITHIN(e, 0, HOTENDS - 1))
|
||||
target_extruder = e;
|
||||
|
||||
#if DISABLED(BUSY_WHILE_HEATING)
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
if (!WITHIN(e, 0
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
-1
|
||||
#endif
|
||||
|
||||
thermalManager.PID_autotune(temp, e, c, u);
|
||||
|
||||
#if DISABLED(BUSY_WHILE_HEATING)
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
,
|
||||
#if ENABLED(PIDTEMP)
|
||||
HOTENDS
|
||||
#endif
|
||||
#else
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ERRORLNPGM(MSG_ERR_M303_DISABLED);
|
||||
-1
|
||||
)) {
|
||||
SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM);
|
||||
return;
|
||||
}
|
||||
|
||||
const int c = parser.intval('C', 5);
|
||||
const bool u = parser.boolval('U');
|
||||
const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150);
|
||||
|
||||
#if DISABLED(BUSY_WHILE_HEATING)
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
#endif
|
||||
|
||||
thermalManager.PID_autotune(temp, e, c, u);
|
||||
|
||||
#if DISABLED(BUSY_WHILE_HEATING)
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // HAS_PID_HEATING
|
||||
|
Reference in New Issue
Block a user