Browse Source

Move reset LA state from G80 to M84

Move la10c_reset into finishAndDisableStepper, which is called in both
via lcd_print_stop() and indirectly via M84, saving some space.

M84 is checked-for to determine a complete file, so it's a superior
candidate to G80 (which some people avoid due to MBL issues).
Yuri D'Elia 4 years ago
parent
commit
5082f2a36e
5 changed files with 19 additions and 22 deletions
  1. 1 1
      Firmware/Marlin.h
  2. 18 5
      Firmware/Marlin_main.cpp
  3. 0 11
      Firmware/stepper.cpp
  4. 0 2
      Firmware/stepper.h
  5. 0 3
      Firmware/ultralcd.cpp

+ 1 - 1
Firmware/Marlin.h

@@ -238,8 +238,8 @@ void get_coordinates();
 void prepare_move();
 void kill(const char *full_screen_message = NULL, unsigned char id = 0);
 void Stop();
-
 bool IsStopped();
+void finishAndDisableSteppers();
 
 //put an ASCII command at the end of the current buffer.
 void enquecommand(const char *cmd, bool from_progmem = false);

+ 18 - 5
Firmware/Marlin_main.cpp

@@ -4864,11 +4864,6 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
 	case_G80:
 	{
 		mesh_bed_leveling_flag = true;
-#ifndef LA_NOCOMPAT
-        // When printing via USB there's no clear boundary between prints. Abuse MBL to indicate
-        // the beginning of a new print, allowing a new autodetected setting just after G80.
-        la10c_reset();
-#endif
 #ifndef PINDA_THERMISTOR
         static bool run = false; // thermistor-less PINDA temperature compensation is running
 #endif // ndef PINDA_THERMISTOR
@@ -9698,6 +9693,24 @@ void Stop()
 
 bool IsStopped() { return Stopped; };
 
+void finishAndDisableSteppers()
+{
+  st_synchronize();
+  disable_x();
+  disable_y();
+  disable_z();
+  disable_e0();
+  disable_e1();
+  disable_e2();
+
+#ifndef LA_NOCOMPAT
+  // Steppers are disabled both when a print is stopped and also via M84 (which is additionally
+  // checked-for to indicate a complete file), so abuse this function to reset the LA detection
+  // state for the next print.
+  la10c_reset();
+#endif
+}
+
 #ifdef FAST_PWM_FAN
 void setPwmFrequency(uint8_t pin, int val)
 {

+ 0 - 11
Firmware/stepper.cpp

@@ -1356,17 +1356,6 @@ float st_get_position_mm(uint8_t axis)
 }
 
 
-void finishAndDisableSteppers()
-{
-  st_synchronize();
-  disable_x();
-  disable_y();
-  disable_z();
-  disable_e0();
-  disable_e1();
-  disable_e2();
-}
-
 void quickStop()
 {
   DISABLE_STEPPER_DRIVER_INTERRUPT();

+ 0 - 2
Firmware/stepper.h

@@ -69,8 +69,6 @@ void invert_z_endstop(bool endstop_invert);
 
 void checkStepperErrors(); //Print errors detected by the stepper
 
-void finishAndDisableSteppers();
-
 extern block_t *current_block;  // A pointer to the block currently being traced
 extern bool x_min_endstop;
 extern bool x_max_endstop;

+ 0 - 3
Firmware/ultralcd.cpp

@@ -7340,9 +7340,6 @@ void lcd_print_stop()
 #ifdef MESH_BED_LEVELING
     mbl.active = false; //also prevents undoing the mbl compensation a second time in the second planner_abort_hard()
 #endif
-#ifndef LA_NOCOMPAT
-    la10c_reset();
-#endif
 
 	lcd_setstatuspgm(_T(MSG_PRINT_ABORTED));
 	stoptime = _millis();