@ -66,6 +66,7 @@
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_EINSYRAMBO 
    # define LULZBOT_USE_EINSYRAMBO 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_AUTOLEVELING 
    # define LULZBOT_USE_AUTOLEVELING 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_SENSORLESS_HOMING 
    # define LULZBOT_SENSORLESS_HOMING 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_SENSORLESS_PROBING 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_BAUDRATE 115200 
    # define LULZBOT_BAUDRATE 115200 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_UUID "4479bf92-7e47-4c2c-be95-64dd01bd413b" 
    # define LULZBOT_UUID "4479bf92-7e47-4c2c-be95-64dd01bd413b" 
 
			
		
	
		
		
			
				
					
					# endif # endif  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -107,9 +108,7 @@
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_EARLY_EINSY 
    # define LULZBOT_USE_EARLY_EINSY 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TWO_PIECE_BED 
    # define LULZBOT_TWO_PIECE_BED 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_AUTOLEVELING 
    # define LULZBOT_USE_AUTOLEVELING 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_MIN_ENDSTOPS 
    # define LULZBOT_SENSORLESS_HOMING 
 
			
				
				
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_MAX_ENDSTOPS 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_NORMALLY_CLOSED_ENDSTOPS 
 
			
		
	
		
		
	
		
		
			
				
					
					    # define LULZBOT_BAUDRATE 250000 
    # define LULZBOT_BAUDRATE 250000 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_PRINTCOUNTER 
    # define LULZBOT_PRINTCOUNTER 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_UUID "e5502411-d46d-421d-ba3a-a20126d7930f" 
    # define LULZBOT_UUID "e5502411-d46d-421d-ba3a-a20126d7930f" 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -125,9 +124,7 @@
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_LCD_DISPLAY 
    # define LULZBOT_USE_LCD_DISPLAY 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TWO_PIECE_BED 
    # define LULZBOT_TWO_PIECE_BED 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_AUTOLEVELING 
    # define LULZBOT_USE_AUTOLEVELING 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_MIN_ENDSTOPS 
    # define LULZBOT_SENSORLESS_HOMING 
 
			
				
				
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_MAX_ENDSTOPS 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_USE_NORMALLY_CLOSED_ENDSTOPS 
 
			
		
	
		
		
	
		
		
			
				
					
					    # define LULZBOT_BAUDRATE 250000 
    # define LULZBOT_BAUDRATE 250000 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_PRINTCOUNTER 
    # define LULZBOT_PRINTCOUNTER 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_UUID "e5502411-d46d-421d-ba3a-a20126d7930f" 
    # define LULZBOT_UUID "e5502411-d46d-421d-ba3a-a20126d7930f" 
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1021,10 +1018,6 @@
 
			
		
	
		
		
			
				
					
					        st . shaft_dir ( 1 ) ;  \
        st . shaft_dir ( 1 ) ;  \
 
			
		
	
		
		
			
				
					
					        st . external_ref ( 0 ) ;      /* I_scale_analog  = 0 */  \
        st . external_ref ( 0 ) ;      /* I_scale_analog  = 0 */  \
 
			
		
	
		
		
			
				
					
					        st . internal_sense_R ( 0 ) ;  /* internal_Rsense = 0 */  \
        st . internal_sense_R ( 0 ) ;  /* internal_Rsense = 0 */  \
 
			
		
	
		
		
			
				
					
					        /* Disable short protection since this generates false positives
 
 
			
		
	
		
		
			
				
					
					           on  the  Z  axis  when  probing . 
 
			
		
	
		
		
			
				
					
					         */  \
 
			
		
	
		
		
			
				
					
					        //st.disable_short_protection(1)
 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_HEALTHCHECK(AXIS) \ 
    # define LULZBOT_TMC_HEALTHCHECK(AXIS) \ 
 
			
		
	
		
		
			
				
					
					        {  \
        {  \
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1033,7 +1026,7 @@
 
			
		
	
		
		
			
				
					
					            AXIS # # _DIR_WRITE ( 0 ) ;  DIR_0     =  ( stepper # # AXIS . IOIN ( )  > >  1 )  &  0 b1 ;  \
            AXIS # # _DIR_WRITE ( 0 ) ;  DIR_0     =  ( stepper # # AXIS . IOIN ( )  > >  1 )  &  0 b1 ;  \
 
			
		
	
		
		
			
				
					
					            AXIS # # _DIR_WRITE ( 1 ) ;  DIR_1     =  ( stepper # # AXIS . IOIN ( )  > >  1 )  &  0 b1 ;  \
            AXIS # # _DIR_WRITE ( 1 ) ;  DIR_1     =  ( stepper # # AXIS . IOIN ( )  > >  1 )  &  0 b1 ;  \
 
			
		
	
		
		
			
				
					
					            if ( ! ALWAYS_1  | |  DIR_0  ! =  0  | |  DIR_1  ! =  1 )  {  \
            if ( ! ALWAYS_1  | |  DIR_0  ! =  0  | |  DIR_1  ! =  1 )  {  \
 
			
		
	
		
		
			
				
					
					                SERIAL_ PROTOCOL PGM( " Failed TMC driver health check! " ) ;  \
                SERIAL_ ECHO PGM( " Failed TMC driver health check! " ) ;  \
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					            }  \
            }  \
 
			
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1043,6 +1036,8 @@
 
			
		
	
		
		
			
				
					
					            uint32_t  IOIN        =  stepper # # AXIS . IOIN ( ) ;  \
            uint32_t  IOIN        =  stepper # # AXIS . IOIN ( ) ;  \
 
			
		
	
		
		
			
				
					
					            uint32_t  IHOLD_IRUN  =  stepper # # AXIS . IHOLD_IRUN ( ) ;  \
            uint32_t  IHOLD_IRUN  =  stepper # # AXIS . IHOLD_IRUN ( ) ;  \
 
			
		
	
		
		
			
				
					
					            uint32_t  CHOPCONF    =  stepper # # AXIS . CHOPCONF ( ) ;  \
            uint32_t  CHOPCONF    =  stepper # # AXIS . CHOPCONF ( ) ;  \
 
			
		
	
		
		
			
				
					
					            uint32_t  COOLCONF    =  stepper # # AXIS . COOLCONF ( ) ;  \
 
			
		
	
		
		
			
				
					
					            int8_t    SGT         =  ( COOLCONF   > >  16 )  &  0 b1111111 ;  \
 
			
		
	
		
		
			
				
					
					            uint16_t  SG_RESULT   =  ( DRVSTATUS )        &  0 b111111111 ;  \
            uint16_t  SG_RESULT   =  ( DRVSTATUS )        &  0 b111111111 ;  \
 
			
		
	
		
		
			
				
					
					            bool  drv_enn         =  ( IOIN       > >   4 )  &  0 b1 ;  \
            bool  drv_enn         =  ( IOIN       > >   4 )  &  0 b1 ;  \
 
			
		
	
		
		
			
				
					
					            bool  stst            =  ( DRVSTATUS  > >  31 )  &  0 b1 ;  \
            bool  stst            =  ( DRVSTATUS  > >  31 )  &  0 b1 ;  \
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1056,29 +1051,38 @@
 
			
		
	
		
		
			
				
					
					            uint16_t  ihold       =  ( IHOLD_IRUN )       &  0 b11111 ;  \
            uint16_t  ihold       =  ( IHOLD_IRUN )       &  0 b11111 ;  \
 
			
		
	
		
		
			
				
					
					            uint16_t  irun        =  ( IHOLD_IRUN  > >  8 )  &  0 b11111 ;  \
            uint16_t  irun        =  ( IHOLD_IRUN  > >  8 )  &  0 b11111 ;  \
 
			
		
	
		
		
			
				
					
					            bool  vsense          =  ( CHOPCONF   > >  17 )  &  0 b1 ;  \
            bool  vsense          =  ( CHOPCONF   > >  17 )  &  0 b1 ;  \
 
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOLPGM ( " TMC_ "  # AXIS  " :  " ) ;  \
            SERIAL_ECHOPGM ( "   "  # AXIS  " : " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( ! drv_enn )  SERIAL_PROTOCOLPGM ( " en  " ) ;  \
            SERIAL_ECHOPGM ( "  ihr: " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( stst )      SERIAL_PROTOCOLPGM ( " st  " ) ;  \
            SERIAL_ECHO ( ihold ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( olb )       SERIAL_PROTOCOLPGM ( " olb  " ) ;  \
            SERIAL_ECHOPGM ( " / " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( ola )       SERIAL_PROTOCOLPGM ( " ola  " ) ;  \
            SERIAL_ECHO ( irun ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( s2gb )      SERIAL_PROTOCOLPGM ( " s2gb  " ) ;  \
            SERIAL_ECHOPGM ( "  vsen: " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( s2ga )      SERIAL_PROTOCOLPGM ( " s2ga  " ) ;  \
            SERIAL_ECHO ( vsense ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( otpw )      SERIAL_PROTOCOLPGM ( " otpw  " ) ;  \
            if ( stepper # # AXIS . coolstep_min_speed ( )  = =  1024UL  *  1024UL  -  1UL )  {  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( ot )        SERIAL_PROTOCOLPGM ( " ot  " ) ;  \
                SERIAL_ECHOPGM ( "  sgt: " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            if ( fsactive )  SERIAL_PROTOCOLPGM ( " fsactive  " ) ;  \
                SERIAL_ECHO ( LULZBOT_SIGN_EXTEND_SGT ( SGT ) ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOLPGM ( " ihold_irun: " ) ;  \
                if ( num_sg  >  0 )  {  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOL ( ihold ) ;  \
                    SERIAL_ECHOPGM ( "  avg_sg: " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOLPGM ( " / " ) ;  \
                    SERIAL_ECHO ( sum_sg_ # # AXIS / num_sg ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOL ( irun ) ;  \
                }  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOLPGM ( "  vsense: " ) ;  \
            }  else  {  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOL ( vsense ) ;  \
                SERIAL_ECHOPGM ( "  stealth " ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOLPGM ( "  SGR: " ) ;  \
            }  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_PROTOCOLLN ( SG_RESULT ) ;  \
            if ( ! drv_enn )  SERIAL_ECHOPGM ( "  en " ) ;  \
 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					            if ( stst )      SERIAL_ECHOPGM ( "  st " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( olb )       SERIAL_ECHOPGM ( "  olb " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( ola )       SERIAL_ECHOPGM ( "  ola " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( s2gb )      SERIAL_ECHOPGM ( "  s2gb " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( s2ga )      SERIAL_ECHOPGM ( "  s2ga " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( otpw )      SERIAL_ECHOPGM ( "  otpw " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( ot )        SERIAL_ECHOPGM ( "  ot " ) ;  \
 
			
		
	
		
		
			
				
					
					            if ( fsactive )  SERIAL_ECHOPGM ( "  fsactive " ) ;  \
 
			
		
	
		
		
			
				
					
					            SERIAL_ECHOLN ( " " ) ;  \
 
			
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    /* For reasons unknown, s2ga and s2gb seem to be getting triggered
 
    # define LULZBOT_SIGN_EXTEND_SGT(sgt) int8_t(sgt | ((sgt << 1) & 0x80)) 
 
			
				
				
			
		
	
		
		
			
				
					
					     *  during  probing  at  the  end  of  Z  motions .  This  checks  to  see  if 
  
			
				
				
			
		
	
		
		
			
				
					
					     *  these  flags  are  set ,  and  if  so ,  resets  the  drivers  */ 
    /* This checks to see if the s2ga and s2gb flags are set  
 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_CHECK_S2G(AXIS, WHERE) \ 
    # define LULZBOT_TMC_CHECK_S2G(AXIS, WHERE) \ 
 
			
		
	
		
		
			
				
					
					        {  \
        {  \
 
			
		
	
		
		
			
				
					
					            safe_delay ( 100 ) ;  \
            safe_delay ( 100 ) ;  \
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1086,76 +1090,65 @@
 
			
		
	
		
		
			
				
					
					            bool  s2gb           =  ( DRVSTATUS  > >  28 )  &  0 b1 ;  \
            bool  s2gb           =  ( DRVSTATUS  > >  28 )  &  0 b1 ;  \
 
			
		
	
		
		
			
				
					
					            bool  s2ga           =  ( DRVSTATUS  > >  27 )  &  0 b1 ;  \
            bool  s2ga           =  ( DRVSTATUS  > >  27 )  &  0 b1 ;  \
 
			
		
	
		
		
			
				
					
					            if ( s2ga  | |  s2gb )  {  \
            if ( s2ga  | |  s2gb )  {  \
 
			
		
	
		
		
			
				
					
					                SERIAL_PROTOCOLLN ( " s2g detected in checkpoint# "  # WHERE ) ;  \
                SERIAL_ECHOLN ( " s2g detected in checkpoint# "  # WHERE ) ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					                /* Z_ENABLE_WRITE(!Z_ENABLE_ON); */  \
 
			
		
	
		
		
			
				
					
					                /* Z_ENABLE_WRITE( Z_ENABLE_ON); */  \
 
			
		
	
		
		
	
		
		
			
				
					
					            }  \
            }  \
 
			
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_PROBE_DIAGNOSTICS(TRIGGERED) \ 
    # define LULZBOT_PROBE_DIAGNOSTICS(TRIGGERED) \ 
 
			
		
	
		
		
			
				
					
					        if ( TRIGGERED )  \
        if ( TRIGGERED )  \
 
			
		
	
		
		
			
				
					
					            SERIAL_E RROR LNPGM( " Probe triggered " ) ;  \
            SERIAL_E CHO LNPGM( " Probe triggered " ) ;  \
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					        else  \
        else  \
 
			
		
	
		
		
			
				
					
					            SERIAL_ERRORLNPGM ( " Probe not triggered " ) ; 
            SERIAL_ERRORLNPGM ( " Probe not triggered " ) ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    /* The following function accumulates the average of a
 
    /* The following function accumulates the average of a
 
 
			
		
	
		
		
			
				
					
					       stallguard  value  during  a  planner  move  and  reports 
       stallguard  values  during  a  planner  move  */ 
 
			
				
				
			
		
	
		
		
			
				
					
					       it  once  the  motion  ends  */ 
    # define LULZBOT_TMC_STALLGUARD_AVG_VARS \ 
 
			
				
				
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_STALLGUARD_AVERAGE(AXIS, SUM, NUM) \ 
        static  uint8_t    current_tail ,  tally_freq  =  10 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					        static  uint8_t    current_tail ;  \
        static  uint32_t   sum_sg_X  =  0 ,  sum_sg_Y  =  0 ,  sum_sg_Z  =  0 ,  sum_sg_E0  =  0 ,  num_sg  =  0 ; 
 
			
				
				
			
		
	
		
		
			
				
					
					        static  uint32_t   SUM ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					        static  uint16_t   NUM ;  \
    # define LULZBOT_TMC_STALLGUARD_AVG_FUNC \ 
 
			
				
				
			
		
	
		
		
			
				
					
					        if ( current_tail  ! =  planner . block_buffer_tail )  {  \
        if ( - - tally_freq  = =  0 )  {  \
 
			
				
				
			
		
	
		
		
			
				
					
					            current_tail  =  planner . block_buffer_tail ;  \
            tally_freq  =  10 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            /* When the planner finishes move, report results */  \
            if ( planner . blocks_queued ( ) )  {  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SERIAL_ECHOLNPAIR ( # AXIS  "  avg_sg:  " ,  SUM / NUM ) ;  \
                /* Reset accumulators at the start of each movement */  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SUM  =  0 ;  \
                if ( current_tail  ! =  planner . block_buffer_tail )  {  \
 
			
				
				
			
		
	
		
		
			
				
					
					            NUM  =  0 ;  \
                    current_tail  =  planner . block_buffer_tail ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					        }  else  if ( planner . blocks_queued ( ) )  {  \
                    sum_sg_X  =  sum_sg_Y  =  sum_sg_Z  =  sum_sg_E0  =  num_sg  =  0 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					            /* While in motion, accumulate sg values */  \
                }  \
 
			
				
				
			
		
	
		
		
			
				
					
					            SUM  + =  stepper # # AXIS . DRV_STATUS ( )  &  0 b111111111 ;  \
                /* While in motion, accumulate sg values */  \
 
			
				
				
			
		
	
		
		
			
				
					
					            NUM + + ;  \
                sum_sg_X   + =  stepperX . DRV_STATUS ( )   &  0 b111111111 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					        } 
                sum_sg_Y   + =  stepperY . DRV_STATUS ( )   &  0 b111111111 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					
                sum_sg_Z   + =  stepperZ . DRV_STATUS ( )   &  0 b111111111 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					    /* The following function reports when the average of the
 
                sum_sg_E0  + =  stepperE0 . DRV_STATUS ( )  &  0 b111111111 ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					       stallguard  value  changes  significantly  */ 
                num_sg + + ;  \
 
			
				
				
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_STALLGUARD_REPORT_CHANGES(AXIS, SUM, NUM, THRESH) \ 
 
			
		
	
		
		
			
				
					
					        static  uint8_t    current_tail ;  \
 
			
		
	
		
		
			
				
					
					        static  uint32_t   SUM ;  \
 
			
		
	
		
		
			
				
					
					        static  uint16_t   NUM ;  \
 
			
		
	
		
		
			
				
					
					        static  uint16_t   last_avg ;  \
 
			
		
	
		
		
			
				
					
					        if ( current_tail  ! =  planner . block_buffer_tail )  {  \
 
			
		
	
		
		
			
				
					
					            current_tail  =  planner . block_buffer_tail ;  \
 
			
		
	
		
		
			
				
					
					            uint16_t  avg  =  SUM / NUM ;  \
 
			
		
	
		
		
			
				
					
					            if ( abs ( int ( last_avg )  -  avg )  >  last_avg  *  THRESH )  {  \
 
			
		
	
		
		
			
				
					
					                SERIAL_ECHOLNPAIR ( " Detected changed in sg value: " ,  avg  -  last_avg ) ;  \
 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					            }  \
            }  \
 
			
		
	
		
		
			
				
					
					            SERIAL_ECHOLNPAIR ( # AXIS  "  avg_sg:  " ,  avg ) ;  \
 
			
		
	
		
		
			
				
					
					            last_avg  =  avg ;  \
 
			
		
	
		
		
			
				
					
					            SUM  =  0 ;  \
 
			
		
	
		
		
			
				
					
					            NUM  =  0 ;  \
 
			
		
	
		
		
			
				
					
					        }  else  if ( planner . blocks_queued ( ) )  {  \
 
			
		
	
		
		
			
				
					
					            /* While in motion, accumulate sg values */  \
 
			
		
	
		
		
			
				
					
					            SUM  + =  stepper # # AXIS . DRV_STATUS ( )  &  0 b111111111 ;  \
 
			
		
	
		
		
			
				
					
					            NUM + + ;  \
 
			
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_G0G1_STALLGUARD_REPORT \ 
 
			
		
	
		
		
			
				
					
					        LULZBOT_TMC_STALLGUARD_AVERAGE ( E0 ,  sg_sum_e ,  sg_num_e ) 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    //#define LULZBOT_TMC_G0G1_STALLGUARD_REPORT
 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_M119_STALLGUARD_REPORT \ 
    # define LULZBOT_TMC_M119_STALLGUARD_REPORT \ 
 
			
		
	
		
		
			
				
					
					        SERIAL_ECHOLNPGM ( " TMC2130 Status: " ) ;  \
 
			
		
	
		
		
			
				
					
					        LULZBOT_TMC_REPORT ( X )  \
        LULZBOT_TMC_REPORT ( X )  \
 
			
		
	
		
		
			
				
					
					        LULZBOT_TMC_REPORT ( Y )  \
        LULZBOT_TMC_REPORT ( Y )  \
 
			
		
	
		
		
			
				
					
					        LULZBOT_TMC_REPORT ( Z ) 
        LULZBOT_TMC_REPORT ( Z )  \
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					        LULZBOT_TMC_REPORT ( E0 ) 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_ENABLE_STALLGUARD(st) \ 
 
			
		
	
		
		
			
				
					
					        /* Enable stallguard by disabling steathchop */  \
 
			
		
	
		
		
			
				
					
					        st . coolstep_min_speed ( 1024UL  *  1024UL  -  1UL ) ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC2130_ADV { \ 
    # define LULZBOT_TMC2130_ADV { \ 
 
			
		
	
		
		
			
				
					
					            /* Turn off stealhchop for extruder motor */  \
            /* Turn off stealhchop for extruder motor */  \
 
			
		
	
		
		
			
				
					
					            stepperE0 . coolstep_min_speed ( 1024UL  *  1024UL  -  1UL ) ;  \
            LULZBOT_ENABLE_STALLGUARD ( stepperE0 ) 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					            /* Set stallguard value for filament sensing */  \
            /* Set stallguard value for filament sensing */  \
 
			
		
	
		
		
			
				
					
					            stepperE0 . sg_stall_value ( 5 ) ;  \
            stepperE0 . sg_stall_value ( 5 ) ;  \
 
			
		
	
		
		
			
				
					
					            /* Turn off stealhchop for Z motor */  \
 
			
		
	
		
		
			
				
					
					            LULZBOT_ENABLE_STALLGUARD ( stepperZ )  \
 
			
		
	
		
		
			
				
					
					            /* Set stallguard value for Z sensing */  \
 
			
		
	
		
		
			
				
					
					            stepperZ . sg_stall_value ( 5 ) ;  \
 
			
		
	
		
		
			
				
					
					        } 
        } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_M914_DISABLES_STEALTHCHOP(st) \ 
 
			
		
	
		
		
			
				
					
					        LULZBOT_ENABLE_STALLGUARD ( st ) 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					# else # else  
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_M119_STALLGUARD_REPORT 
    # define LULZBOT_TMC_M119_STALLGUARD_REPORT 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_TMC_G0G1_STALLGUARD_REPORT 
    # define LULZBOT_TMC_G0G1_STALLGUARD_REPORT 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1179,6 +1172,11 @@
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_Z_MAX_ENDSTOP_INVERTING   LULZBOT_NORMALLY_OPEN_ENDSTOP 
    # define LULZBOT_Z_MAX_ENDSTOP_INVERTING   LULZBOT_NORMALLY_OPEN_ENDSTOP 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # if defined(LULZBOT_SENSORLESS_PROBING) 
 
			
		
	
		
		
			
				
					
					        # define LULZBOT_Z_MIN_ENDSTOP_INVERTING         LULZBOT_NORMALLY_CLOSED_ENDSTOP 
 
			
		
	
		
		
			
				
					
					        # define LULZBOT_Z_MIN_PROBE_ENDSTOP_INVERTING   LULZBOT_NORMALLY_CLOSED_ENDSTOP 
 
			
		
	
		
		
			
				
					
					    # endif 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_X_HOME_BUMP_MM                0 
    # define LULZBOT_X_HOME_BUMP_MM                0 
 
			
		
	
		
		
			
				
					
					    # define LULZBOT_Y_HOME_BUMP_MM                0 
    # define LULZBOT_Y_HOME_BUMP_MM                0