gcode_process.c: we can't rely on next_target.P being zero.
... simply because P is used for many commands and none of them cares to clean it after usage. This fixes a bug where setting the default heater without temp sensor (M106) worked only after a G4 Pxxx command.
This commit is contained in:
parent
9dd7426f9d
commit
9aa1d2337f
|
|
@ -439,11 +439,12 @@ void process_gcode_command() {
|
||||||
//?
|
//?
|
||||||
if ( ! next_target.seen_S)
|
if ( ! next_target.seen_S)
|
||||||
break;
|
break;
|
||||||
#ifdef HEATER_EXTRUDER
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_EXTRUDER
|
||||||
next_target.P = HEATER_EXTRUDER;
|
next_target.P = HEATER_EXTRUDER;
|
||||||
// else use the first available device
|
#else
|
||||||
#endif
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
temp_set(next_target.P, next_target.S);
|
temp_set(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -485,11 +486,12 @@ void process_gcode_command() {
|
||||||
// wait for all moves to complete
|
// wait for all moves to complete
|
||||||
queue_wait();
|
queue_wait();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HEATER_FAN
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_FAN
|
||||||
next_target.P = HEATER_FAN;
|
next_target.P = HEATER_FAN;
|
||||||
// else use the first available device
|
#else
|
||||||
#endif
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
if ( ! next_target.seen_S)
|
if ( ! next_target.seen_S)
|
||||||
break;
|
break;
|
||||||
heater_set(next_target.P, next_target.S);
|
heater_set(next_target.P, next_target.S);
|
||||||
|
|
@ -660,11 +662,12 @@ void process_gcode_command() {
|
||||||
//? --- M130: heater P factor ---
|
//? --- M130: heater P factor ---
|
||||||
//? Undocumented.
|
//? Undocumented.
|
||||||
// P factor in counts per degreeC of error
|
// P factor in counts per degreeC of error
|
||||||
#ifdef HEATER_EXTRUDER
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_EXTRUDER
|
||||||
next_target.P = HEATER_EXTRUDER;
|
next_target.P = HEATER_EXTRUDER;
|
||||||
// else use the first available device
|
#else
|
||||||
#endif
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_p(next_target.P, next_target.S);
|
pid_set_p(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
|
|
@ -673,10 +676,12 @@ void process_gcode_command() {
|
||||||
//? --- M131: heater I factor ---
|
//? --- M131: heater I factor ---
|
||||||
//? Undocumented.
|
//? Undocumented.
|
||||||
// I factor in counts per C*s of integrated error
|
// I factor in counts per C*s of integrated error
|
||||||
#ifdef HEATER_EXTRUDER
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_EXTRUDER
|
||||||
next_target.P = HEATER_EXTRUDER;
|
next_target.P = HEATER_EXTRUDER;
|
||||||
#endif
|
#else
|
||||||
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_i(next_target.P, next_target.S);
|
pid_set_i(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
|
|
@ -685,10 +690,12 @@ void process_gcode_command() {
|
||||||
//? --- M132: heater D factor ---
|
//? --- M132: heater D factor ---
|
||||||
//? Undocumented.
|
//? Undocumented.
|
||||||
// D factor in counts per degreesC/second
|
// D factor in counts per degreesC/second
|
||||||
#ifdef HEATER_EXTRUDER
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_EXTRUDER
|
||||||
next_target.P = HEATER_EXTRUDER;
|
next_target.P = HEATER_EXTRUDER;
|
||||||
#endif
|
#else
|
||||||
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_d(next_target.P, next_target.S);
|
pid_set_d(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
|
|
@ -696,10 +703,12 @@ void process_gcode_command() {
|
||||||
case 133:
|
case 133:
|
||||||
//? --- M133: heater I limit ---
|
//? --- M133: heater I limit ---
|
||||||
//? Undocumented.
|
//? Undocumented.
|
||||||
#ifdef HEATER_EXTRUDER
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_EXTRUDER
|
||||||
next_target.P = HEATER_EXTRUDER;
|
next_target.P = HEATER_EXTRUDER;
|
||||||
#endif
|
#else
|
||||||
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_i_limit(next_target.P, next_target.S);
|
pid_set_i_limit(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
|
|
@ -716,11 +725,13 @@ void process_gcode_command() {
|
||||||
//? --- M136: PRINT PID settings to host ---
|
//? --- M136: PRINT PID settings to host ---
|
||||||
//? Undocumented.
|
//? Undocumented.
|
||||||
//? This comand is only available in DEBUG builds.
|
//? This comand is only available in DEBUG builds.
|
||||||
#ifdef HEATER_EXTRUDER
|
if ( ! next_target.seen_P)
|
||||||
if ( ! next_target.seen_P)
|
#ifdef HEATER_EXTRUDER
|
||||||
next_target.P = HEATER_EXTRUDER;
|
next_target.P = HEATER_EXTRUDER;
|
||||||
|
#else
|
||||||
|
next_target.P = 0;
|
||||||
|
#endif
|
||||||
heater_print(next_target.P);
|
heater_print(next_target.P);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue