Browse Source

Merge pull request #3615 from thinkyhead/rc_whats_up_with_M112

Report current position to host after M206 / M428
Scott Lahteine 8 years ago
parent
commit
66540f8b84
1 changed files with 15 additions and 9 deletions
  1. 15
    9
      Marlin/Marlin_main.cpp

+ 15
- 9
Marlin/Marlin_main.cpp View File

504
 void serial_echopair_P(const char* s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
504
 void serial_echopair_P(const char* s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
505
 void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
505
 void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
506
 
506
 
507
-void gcode_M114();
507
+static void report_current_position();
508
 
508
 
509
 #if ENABLED(DEBUG_LEVELING_FEATURE)
509
 #if ENABLED(DEBUG_LEVELING_FEATURE)
510
   void print_xyz(const char* prefix, const float x, const float y, const float z) {
510
   void print_xyz(const char* prefix, const float x, const float y, const float z) {
2886
     }
2886
     }
2887
   #endif
2887
   #endif
2888
 
2888
 
2889
-  gcode_M114(); // Send end position to RepetierHost
2890
-
2889
+  report_current_position();
2891
 }
2890
 }
2892
 
2891
 
2893
 #if ENABLED(MESH_BED_LEVELING)
2892
 #if ENABLED(MESH_BED_LEVELING)
3595
       }
3594
       }
3596
     #endif
3595
     #endif
3597
 
3596
 
3598
-    gcode_M114(); // Send end position to RepetierHost
3599
-
3597
+    report_current_position();
3600
   }
3598
   }
3601
 
3599
 
3602
   #if DISABLED(Z_PROBE_SLED) // could be avoided
3600
   #if DISABLED(Z_PROBE_SLED) // could be avoided
3632
       #endif
3630
       #endif
3633
       stow_z_probe(false); // Retract Z Servo endstop if available. Z_PROBE_SLED is missed here.
3631
       stow_z_probe(false); // Retract Z Servo endstop if available. Z_PROBE_SLED is missed here.
3634
 
3632
 
3635
-      gcode_M114(); // Send end position to RepetierHost
3633
+      report_current_position();
3636
     }
3634
     }
3637
 
3635
 
3638
   #endif //!Z_PROBE_SLED
3636
   #endif //!Z_PROBE_SLED
4229
 
4227
 
4230
     clean_up_after_endstop_move();
4228
     clean_up_after_endstop_move();
4231
 
4229
 
4232
-    gcode_M114(); // Send end position to RepetierHost
4230
+    report_current_position();
4233
   }
4231
   }
4234
 
4232
 
4235
 #endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST
4233
 #endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST
4878
 }
4876
 }
4879
 
4877
 
4880
 /**
4878
 /**
4881
- * M114: Output current position to serial port
4879
+ * Output the current position to serial
4882
  */
4880
  */
4883
-inline void gcode_M114() {
4881
+static void report_current_position() {
4884
   SERIAL_PROTOCOLPGM("X:");
4882
   SERIAL_PROTOCOLPGM("X:");
4885
   SERIAL_PROTOCOL(current_position[X_AXIS]);
4883
   SERIAL_PROTOCOL(current_position[X_AXIS]);
4886
   SERIAL_PROTOCOLPGM(" Y:");
4884
   SERIAL_PROTOCOLPGM(" Y:");
4942
 }
4940
 }
4943
 
4941
 
4944
 /**
4942
 /**
4943
+ * M114: Output current position to serial port
4944
+ */
4945
+inline void gcode_M114() { report_current_position(); }
4946
+
4947
+/**
4945
  * M115: Capabilities string
4948
  * M115: Capabilities string
4946
  */
4949
  */
4947
 inline void gcode_M115() {
4950
 inline void gcode_M115() {
5196
     if (code_seen('T')) set_home_offset(X_AXIS, code_value()); // Theta
5199
     if (code_seen('T')) set_home_offset(X_AXIS, code_value()); // Theta
5197
     if (code_seen('P')) set_home_offset(Y_AXIS, code_value()); // Psi
5200
     if (code_seen('P')) set_home_offset(Y_AXIS, code_value()); // Psi
5198
   #endif
5201
   #endif
5202
+
5199
   sync_plan_position();
5203
   sync_plan_position();
5204
+  report_current_position();
5200
 }
5205
 }
5201
 
5206
 
5202
 #if ENABLED(DELTA)
5207
 #if ENABLED(DELTA)
5915
 
5920
 
5916
   if (!err) {
5921
   if (!err) {
5917
     sync_plan_position();
5922
     sync_plan_position();
5923
+    report_current_position();
5918
     LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
5924
     LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED);
5919
     #if HAS_BUZZER
5925
     #if HAS_BUZZER
5920
       buzz(200, 659);
5926
       buzz(200, 659);

Loading…
Cancel
Save