Browse Source

Merge ConformingHostMessages (PR#2822)

Richard Wackerbarth 9 years ago
parent
commit
ae4acc42ec
3 changed files with 91 additions and 73 deletions
  1. 4
    0
      Marlin/Marlin.h
  2. 83
    60
      Marlin/Marlin_main.cpp
  3. 4
    13
      Marlin/temperature.cpp

+ 4
- 0
Marlin/Marlin.h View File

@@ -351,6 +351,10 @@ extern uint8_t active_extruder;
351 351
   extern void digipot_i2c_init();
352 352
 #endif
353 353
 
354
+#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
355
+  void print_heaterstates();
356
+#endif
357
+
354 358
 extern void calculate_volumetric_multipliers();
355 359
 
356 360
 #endif //MARLIN_H

+ 83
- 60
Marlin/Marlin_main.cpp View File

@@ -288,7 +288,6 @@ static millis_t stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000L;
288 288
 millis_t print_job_start_ms = 0; ///< Print job start time
289 289
 millis_t print_job_stop_ms = 0;  ///< Print job stop time
290 290
 static uint8_t target_extruder;
291
-bool no_wait_for_cooling = true;
292 291
 bool target_direction;
293 292
 
294 293
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
@@ -3803,14 +3802,9 @@ inline void gcode_M104() {
3803 3802
   }
3804 3803
 }
3805 3804
 
3806
-/**
3807
- * M105: Read hot end and bed temperature
3808
- */
3809
-inline void gcode_M105() {
3810
-  if (setTargetedHotend(105)) return;
3805
+#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
3811 3806
 
3812
-  #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
3813
-    SERIAL_PROTOCOLPGM(MSG_OK);
3807
+  void print_heaterstates() {
3814 3808
     #if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)
3815 3809
       SERIAL_PROTOCOLPGM(" T:");
3816 3810
       SERIAL_PROTOCOL_F(degHotend(target_extruder), 1);
@@ -3823,52 +3817,78 @@ inline void gcode_M105() {
3823 3817
       SERIAL_PROTOCOLPGM(" /");
3824 3818
       SERIAL_PROTOCOL_F(degTargetBed(), 1);
3825 3819
     #endif
3826
-    for (int8_t e = 0; e < EXTRUDERS; ++e) {
3827
-      SERIAL_PROTOCOLPGM(" T");
3828
-      SERIAL_PROTOCOL(e);
3829
-      SERIAL_PROTOCOLCHAR(':');
3830
-      SERIAL_PROTOCOL_F(degHotend(e), 1);
3831
-      SERIAL_PROTOCOLPGM(" /");
3832
-      SERIAL_PROTOCOL_F(degTargetHotend(e), 1);
3833
-    }
3820
+    #if EXTRUDERS > 1
3821
+      for (int8_t e = 0; e < EXTRUDERS; ++e) {
3822
+        SERIAL_PROTOCOLPGM(" T");
3823
+        SERIAL_PROTOCOL(e);
3824
+        SERIAL_PROTOCOLCHAR(':');
3825
+        SERIAL_PROTOCOL_F(degHotend(e), 1);
3826
+        SERIAL_PROTOCOLPGM(" /");
3827
+        SERIAL_PROTOCOL_F(degTargetHotend(e), 1);
3828
+      }
3829
+    #endif
3830
+    #if HAS_TEMP_BED
3831
+      SERIAL_PROTOCOLPGM(" B@:");
3832
+      #ifdef BED_WATTS
3833
+        SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127);
3834
+        SERIAL_PROTOCOLCHAR('W');
3835
+      #else
3836
+        SERIAL_PROTOCOL(getHeaterPower(-1));
3837
+      #endif
3838
+    #endif
3839
+    SERIAL_PROTOCOLPGM(" @:");
3840
+    #ifdef EXTRUDER_WATTS
3841
+      SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127);
3842
+      SERIAL_PROTOCOLCHAR('W');
3843
+    #else
3844
+      SERIAL_PROTOCOL(getHeaterPower(target_extruder));
3845
+    #endif
3846
+    #if EXTRUDERS > 1
3847
+      for (int8_t e = 0; e < EXTRUDERS; ++e) {
3848
+        SERIAL_PROTOCOLPGM(" @");
3849
+        SERIAL_PROTOCOL(e);
3850
+        SERIAL_PROTOCOLCHAR(':');
3851
+        #ifdef EXTRUDER_WATTS
3852
+          SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(e)) / 127);
3853
+          SERIAL_PROTOCOLCHAR('W');
3854
+        #else
3855
+          SERIAL_PROTOCOL(getHeaterPower(e));
3856
+        #endif
3857
+      }
3858
+    #endif
3859
+    #if ENABLED(SHOW_TEMP_ADC_VALUES)
3860
+      #if HAS_TEMP_BED
3861
+        SERIAL_PROTOCOLPGM("    ADC B:");
3862
+        SERIAL_PROTOCOL_F(degBed(), 1);
3863
+        SERIAL_PROTOCOLPGM("C->");
3864
+        SERIAL_PROTOCOL_F(rawBedTemp() / OVERSAMPLENR, 0);
3865
+      #endif
3866
+      for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
3867
+        SERIAL_PROTOCOLPGM("  T");
3868
+        SERIAL_PROTOCOL(cur_extruder);
3869
+        SERIAL_PROTOCOLCHAR(':');
3870
+        SERIAL_PROTOCOL_F(degHotend(cur_extruder), 1);
3871
+        SERIAL_PROTOCOLPGM("C->");
3872
+        SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder) / OVERSAMPLENR, 0);
3873
+      }
3874
+    #endif
3875
+  }
3876
+#endif
3877
+
3878
+/**
3879
+ * M105: Read hot end and bed temperature
3880
+ */
3881
+inline void gcode_M105() {
3882
+  if (setTargetedHotend(105)) return;
3883
+
3884
+  #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
3885
+    SERIAL_PROTOCOLPGM(MSG_OK);
3886
+    print_heaterstates();
3834 3887
   #else // !HAS_TEMP_0 && !HAS_TEMP_BED
3835 3888
     SERIAL_ERROR_START;
3836 3889
     SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
3837 3890
   #endif
3838 3891
 
3839
-  SERIAL_PROTOCOLPGM(" @:");
3840
-  #ifdef EXTRUDER_WATTS
3841
-    SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127);
3842
-    SERIAL_PROTOCOLCHAR('W');
3843
-  #else
3844
-    SERIAL_PROTOCOL(getHeaterPower(target_extruder));
3845
-  #endif
3846
-
3847
-  SERIAL_PROTOCOLPGM(" B@:");
3848
-  #ifdef BED_WATTS
3849
-    SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127);
3850
-    SERIAL_PROTOCOLCHAR('W');
3851
-  #else
3852
-    SERIAL_PROTOCOL(getHeaterPower(-1));
3853
-  #endif
3854
-
3855
-  #if ENABLED(SHOW_TEMP_ADC_VALUES)
3856
-    #if HAS_TEMP_BED
3857
-      SERIAL_PROTOCOLPGM("    ADC B:");
3858
-      SERIAL_PROTOCOL_F(degBed(), 1);
3859
-      SERIAL_PROTOCOLPGM("C->");
3860
-      SERIAL_PROTOCOL_F(rawBedTemp() / OVERSAMPLENR, 0);
3861
-    #endif
3862
-    for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
3863
-      SERIAL_PROTOCOLPGM("  T");
3864
-      SERIAL_PROTOCOL(cur_extruder);
3865
-      SERIAL_PROTOCOLCHAR(':');
3866
-      SERIAL_PROTOCOL_F(degHotend(cur_extruder), 1);
3867
-      SERIAL_PROTOCOLPGM("C->");
3868
-      SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder) / OVERSAMPLENR, 0);
3869
-    }
3870
-  #endif
3871
-
3872 3892
   SERIAL_EOL;
3873 3893
 }
3874 3894
 
@@ -3890,6 +3910,8 @@ inline void gcode_M105() {
3890 3910
  * M109: Wait for extruder(s) to reach temperature
3891 3911
  */
3892 3912
 inline void gcode_M109() {
3913
+  bool no_wait_for_cooling = true;
3914
+
3893 3915
   if (setTargetedHotend(109)) return;
3894 3916
   if (marlin_debug_flags & DEBUG_DRYRUN) return;
3895 3917
 
@@ -3931,10 +3953,9 @@ inline void gcode_M109() {
3931 3953
 
3932 3954
   { // while loop
3933 3955
     if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting
3934
-      SERIAL_PROTOCOLPGM("T:");
3935
-      SERIAL_PROTOCOL_F(degHotend(target_extruder), 1);
3936
-      SERIAL_PROTOCOLPGM(" E:");
3937
-      SERIAL_PROTOCOL((int)target_extruder);
3956
+      #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
3957
+        print_heaterstates();
3958
+      #endif
3938 3959
       #ifdef TEMP_RESIDENCY_TIME
3939 3960
         SERIAL_PROTOCOLPGM(" W:");
3940 3961
         if (residency_start_ms > -1) {
@@ -3976,6 +3997,8 @@ inline void gcode_M109() {
3976 3997
    *       Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
3977 3998
    */
3978 3999
   inline void gcode_M190() {
4000
+    bool no_wait_for_cooling = true;
4001
+
3979 4002
     if (marlin_debug_flags & DEBUG_DRYRUN) return;
3980 4003
 
3981 4004
     LCD_MESSAGEPGM(MSG_BED_HEATING);
@@ -3993,13 +4016,10 @@ inline void gcode_M109() {
3993 4016
       if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up.
3994 4017
         temp_ms = ms;
3995 4018
         float tt = degHotend(active_extruder);
3996
-        SERIAL_PROTOCOLPGM("T:");
3997
-        SERIAL_PROTOCOL(tt);
3998
-        SERIAL_PROTOCOLPGM(" E:");
3999
-        SERIAL_PROTOCOL((int)active_extruder);
4000
-        SERIAL_PROTOCOLPGM(" B:");
4001
-        SERIAL_PROTOCOL_F(degBed(), 1);
4002
-        SERIAL_EOL;
4019
+        #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
4020
+          print_heaterstates();
4021
+          SERIAL_EOL;
4022
+        #endif
4003 4023
       }
4004 4024
       idle();
4005 4025
     }
@@ -4912,6 +4932,9 @@ inline void gcode_M303() {
4912 4932
   int e = code_seen('E') ? code_value_short() : 0;
4913 4933
   int c = code_seen('C') ? code_value_short() : 5;
4914 4934
   float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
4935
+
4936
+  if (e >=0 && e < EXTRUDERS)
4937
+    target_extruder = e;
4915 4938
   PID_autotune(temp, e, c);
4916 4939
 }
4917 4940
 

+ 4
- 13
Marlin/temperature.cpp View File

@@ -328,19 +328,10 @@ void PID_autotune(float temp, int extruder, int ncycles) {
328 328
     }
329 329
     // Every 2 seconds...
330 330
     if (ms > temp_ms + 2000) {
331
-      int p;
332
-      if (extruder < 0) {
333
-        p = soft_pwm_bed;
334
-        SERIAL_PROTOCOLPGM(MSG_B);
335
-      }
336
-      else {
337
-        p = soft_pwm[extruder];
338
-        SERIAL_PROTOCOLPGM(MSG_T);
339
-      }
340
-
341
-      SERIAL_PROTOCOL(input);
342
-      SERIAL_PROTOCOLPGM(MSG_AT);
343
-      SERIAL_PROTOCOLLN(p);
331
+      #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
332
+        print_heaterstates();
333
+        SERIAL_EOL;
334
+      #endif
344 335
 
345 336
       temp_ms = ms;
346 337
     } // every 2 seconds

Loading…
Cancel
Save