chiark / gitweb /
re-enabled heaterpower as storage for the current storage of the heater PWM duty...
authorBernhard Kubicek <kubicek@gmx.at>
Sat, 12 Nov 2011 19:37:28 +0000 (20:37 +0100)
committerBernhard Kubicek <kubicek@gmx.at>
Sat, 12 Nov 2011 19:37:28 +0000 (20:37 +0100)
the M301 now returns the current PID settings of the machine.
M105 returns heating pwm duty cylce as "@:"

Marlin/Marlin.pde
Marlin/temperature.cpp

index 672591a72d1aa0ea81b982eb7363f117663f50d5..4c1ece07e3c9e3f8f94b21b90f3d26497c4bb3e8 100644 (file)
@@ -647,33 +647,24 @@ inline void process_commands()
       break;
     case 105: // M105
       //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)
         SERIAL_PROTOCOLPGM("ok T:");
-        SERIAL_PROTOCOL(tt); 
+        SERIAL_PROTOCOL( degHotend0()); 
         #if TEMP_1_PIN > -1 
-          #ifdef PIDTEMP
-            SERIAL_PROTOCOL(" B:");
-            #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
-        #else
-          SERIAL_ERROR_START;
-          SERIAL_ERRORLNPGM("No thermistors - no temp");
+          SERIAL_PROTOCOLPGM(" B:");  
+          SERIAL_PROTOCOL(degBed());
+        #endif //TEMP_1_PIN
+      #else
+        SERIAL_ERROR_START;
+        SERIAL_ERRORLNPGM("No thermistors - no temp");
       #endif
+      #ifdef PIDTEMP
+        SERIAL_PROTOCOLPGM(" @:");
+        SERIAL_PROTOCOL( HeaterPower); 
+       
+      #endif
+        SERIAL_PROTOCOLLN("");
       return;
       break;
     case 109: 
@@ -901,6 +892,21 @@ inline void process_commands()
       if(code_seen('P')) Kp = code_value();
       if(code_seen('I')) Ki = 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;
     #endif //PIDTEMP
     case 500: // Store settings in EEPROM
index 83c173b28c06804ba825b48760ca3b6f12364919..0772cb324f586efdc012544a5dd9be0246f991dc 100644 (file)
@@ -156,6 +156,7 @@ void manage_heater()
             pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high\r
           #endif\r
           pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX);\r
+          HeaterPower=pid_output;\r
         }\r
     #endif //PID_OPENLOOP\r
     #ifdef PID_DEBUG\r