re-enabled heaterpower as storage for the current storage of the heater PWM duty cycle.

the M301 now returns the current PID settings of the machine.
M105 returns heating pwm duty cylce as "@:"
This commit is contained in:
Bernhard Kubicek 2011-11-12 20:37:28 +01:00
parent 36958ee305
commit e9adfa27b5
2 changed files with 30 additions and 23 deletions

View File

@ -647,33 +647,24 @@ inline void process_commands()
break; break;
case 105: // M105 case 105: // M105
//SERIAL_ECHOLN(freeMemory()); //SERIAL_ECHOLN(freeMemory());
#if (TEMP_0_PIN > -1) || defined (HEATER_USES_AD595)
tt = degHotend0();
#endif
#if TEMP_1_PIN > -1
bt = degBed();
#endif
#if (TEMP_0_PIN > -1) || defined (HEATER_USES_AD595) #if (TEMP_0_PIN > -1) || defined (HEATER_USES_AD595)
SERIAL_PROTOCOLPGM("ok T:"); SERIAL_PROTOCOLPGM("ok T:");
SERIAL_PROTOCOL(tt); SERIAL_PROTOCOL( degHotend0());
#if TEMP_1_PIN > -1 #if TEMP_1_PIN > -1
#ifdef PIDTEMP SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL(" B:"); SERIAL_PROTOCOL(degBed());
#if TEMP_1_PIN > -1
SERIAL_PROTOCOLLN(bt);
#else
SERIAL_PROTOCOLLN(HeaterPower);
#endif
#else //not PIDTEMP
SERIAL_PROTOCOLLN("");
#endif //PIDTEMP
#else
SERIAL_PROTOCOLLN("");
#endif //TEMP_1_PIN #endif //TEMP_1_PIN
#else #else
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("No thermistors - no temp"); SERIAL_ERRORLNPGM("No thermistors - no temp");
#endif #endif
#ifdef PIDTEMP
SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOL( HeaterPower);
#endif
SERIAL_PROTOCOLLN("");
return; return;
break; break;
case 109: case 109:
@ -901,6 +892,21 @@ inline void process_commands()
if(code_seen('P')) Kp = code_value(); if(code_seen('P')) Kp = code_value();
if(code_seen('I')) Ki = code_value()*PID_dT; if(code_seen('I')) Ki = code_value()*PID_dT;
if(code_seen('D')) Kd = code_value()/PID_dT; if(code_seen('D')) Kd = code_value()/PID_dT;
#ifdef PID_ADD_EXTRUSION_RATE
if(code_seen('C')) Kc = code_value();
#endif
SERIAL_PROTOCOL("ok p:");
SERIAL_PROTOCOL(Kp);
SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(Ki/PID_dT);
SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOL(Kd*PID_dT);
#ifdef PID_ADD_EXTRUSION_RATE
SERIAL_PROTOCOL(" c:");
SERIAL_PROTOCOL(Kc*PID_dT);
#endif
SERIAL_PROTOCOLLN("");
break; break;
#endif //PIDTEMP #endif //PIDTEMP
case 500: // Store settings in EEPROM case 500: // Store settings in EEPROM

View File

@ -156,6 +156,7 @@ void manage_heater()
pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high
#endif #endif
pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX); pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX);
HeaterPower=pid_output;
} }
#endif //PID_OPENLOOP #endif //PID_OPENLOOP
#ifdef PID_DEBUG #ifdef PID_DEBUG