@ -49,7 +49,7 @@ block_t *current_block; // A pointer to the block currently being traced
static unsigned char out_bits = 0 ; // The next stepping-bits to be output
static unsigned char out_bits = 0 ; // The next stepping-bits to be output
static unsigned int cleaning_buffer_counter ;
static unsigned int cleaning_buffer_counter ;
# if def Z_DUAL_ENDSTOPS
# if ENABLED( Z_DUAL_ENDSTOPS)
static bool performing_homing = false ,
static bool performing_homing = false ,
locked_z_motor = false ,
locked_z_motor = false ,
locked_z2_motor = false ;
locked_z2_motor = false ;
@ -59,7 +59,7 @@ static unsigned int cleaning_buffer_counter;
static long counter_x , counter_y , counter_z , counter_e ;
static long counter_x , counter_y , counter_z , counter_e ;
volatile static unsigned long step_events_completed ; // The number of step events executed in the current block
volatile static unsigned long step_events_completed ; // The number of step events executed in the current block
# if def ADVANCE
# if ENABLED( ADVANCE)
static long advance_rate , advance , final_advance = 0 ;
static long advance_rate , advance , final_advance = 0 ;
static long old_advance = 0 ;
static long old_advance = 0 ;
static long e_steps [ 4 ] ;
static long e_steps [ 4 ] ;
@ -76,18 +76,18 @@ volatile long endstops_trigsteps[3] = { 0 };
volatile long endstops_stepsTotal , endstops_stepsDone ;
volatile long endstops_stepsTotal , endstops_stepsDone ;
static volatile char endstop_hit_bits = 0 ; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
static volatile char endstop_hit_bits = 0 ; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
# if ndef Z_DUAL_ENDSTOPS
# if DISABLED( Z_DUAL_ENDSTOPS)
static byte
static byte
# else
# else
static uint16_t
static uint16_t
# endif
# endif
old_endstop_bits = 0 ; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
old_endstop_bits = 0 ; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
# if def ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
# if ENABLED( ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
bool abort_on_endstop_hit = false ;
bool abort_on_endstop_hit = false ;
# endif
# endif
# if def MOTOR_CURRENT_PWM_XY_PIN
# if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
int motor_current_setting [ 3 ] = DEFAULT_PWM_MOTOR_CURRENT ;
int motor_current_setting [ 3 ] = DEFAULT_PWM_MOTOR_CURRENT ;
# endif
# endif
@ -101,7 +101,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
//================================ functions ================================
//================================ functions ================================
//===========================================================================
//===========================================================================
# if def DUAL_X_CARRIAGE
# if ENABLED( DUAL_X_CARRIAGE)
# define X_APPLY_DIR(v,ALWAYS) \
# define X_APPLY_DIR(v,ALWAYS) \
if ( extruder_duplication_enabled | | ALWAYS ) { \
if ( extruder_duplication_enabled | | ALWAYS ) { \
X_DIR_WRITE ( v ) ; \
X_DIR_WRITE ( v ) ; \
@ -123,7 +123,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
# define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
# define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
# endif
# endif
# if def Y_DUAL_STEPPER_DRIVERS
# if ENABLED( Y_DUAL_STEPPER_DRIVERS)
# define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }
# define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }
# define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }
# define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }
# else
# else
@ -131,9 +131,9 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
# define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v)
# define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v)
# endif
# endif
# if def Z_DUAL_STEPPER_DRIVERS
# if ENABLED( Z_DUAL_STEPPER_DRIVERS)
# define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
# define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
# if def Z_DUAL_ENDSTOPS
# if ENABLED( Z_DUAL_ENDSTOPS)
# define Z_APPLY_STEP(v,Q) \
# define Z_APPLY_STEP(v,Q) \
if ( performing_homing ) { \
if ( performing_homing ) { \
if ( Z_HOME_DIR > 0 ) { \
if ( Z_HOME_DIR > 0 ) { \
@ -263,7 +263,7 @@ void checkHitEndstops() {
SERIAL_ECHOPAIR ( " Z: " , ( float ) endstops_trigsteps [ Z_AXIS ] / axis_steps_per_unit [ Z_AXIS ] ) ;
SERIAL_ECHOPAIR ( " Z: " , ( float ) endstops_trigsteps [ Z_AXIS ] / axis_steps_per_unit [ Z_AXIS ] ) ;
LCD_MESSAGEPGM ( MSG_ENDSTOPS_HIT " Z " ) ;
LCD_MESSAGEPGM ( MSG_ENDSTOPS_HIT " Z " ) ;
}
}
# if def Z_PROBE_ENDSTOP
# if ENABLED( Z_PROBE_ENDSTOP)
if ( endstop_hit_bits & BIT ( Z_PROBE ) ) {
if ( endstop_hit_bits & BIT ( Z_PROBE ) ) {
SERIAL_ECHOPAIR ( " Z_PROBE: " , ( float ) endstops_trigsteps [ Z_AXIS ] / axis_steps_per_unit [ Z_AXIS ] ) ;
SERIAL_ECHOPAIR ( " Z_PROBE: " , ( float ) endstops_trigsteps [ Z_AXIS ] / axis_steps_per_unit [ Z_AXIS ] ) ;
LCD_MESSAGEPGM ( MSG_ENDSTOPS_HIT " ZP " ) ;
LCD_MESSAGEPGM ( MSG_ENDSTOPS_HIT " ZP " ) ;
@ -273,7 +273,7 @@ void checkHitEndstops() {
endstops_hit_on_purpose ( ) ;
endstops_hit_on_purpose ( ) ;
# if defined(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && defined (SDSUPPORT)
# if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED (SDSUPPORT)
if ( abort_on_endstop_hit ) {
if ( abort_on_endstop_hit ) {
card . sdprinting = false ;
card . sdprinting = false ;
card . closefile ( ) ;
card . closefile ( ) ;
@ -556,7 +556,7 @@ void set_stepper_direction() {
count_direction [ Z_AXIS ] = 1 ;
count_direction [ Z_AXIS ] = 1 ;
}
}
# if ndef ADVANCE
# if DISABLED( ADVANCE)
if ( TEST ( out_bits , E_AXIS ) ) {
if ( TEST ( out_bits , E_AXIS ) ) {
REV_E_DIR ( ) ;
REV_E_DIR ( ) ;
count_direction [ E_AXIS ] = - 1 ;
count_direction [ E_AXIS ] = - 1 ;
@ -577,7 +577,7 @@ FORCE_INLINE void trapezoid_generator_reset() {
set_stepper_direction ( ) ;
set_stepper_direction ( ) ;
}
}
# if def ADVANCE
# if ENABLED( ADVANCE)
advance = current_block - > initial_advance ;
advance = current_block - > initial_advance ;
final_advance = current_block - > final_advance ;
final_advance = current_block - > final_advance ;
// Do E steps + advance steps
// Do E steps + advance steps
@ -630,7 +630,7 @@ ISR(TIMER1_COMPA_vect) {
counter_y = counter_z = counter_e = counter_x ;
counter_y = counter_z = counter_e = counter_x ;
step_events_completed = 0 ;
step_events_completed = 0 ;
# if def Z_LATE_ENABLE
# if ENABLED( Z_LATE_ENABLE)
if ( current_block - > steps [ Z_AXIS ] > 0 ) {
if ( current_block - > steps [ Z_AXIS ] > 0 ) {
enable_z ( ) ;
enable_z ( ) ;
OCR1A = 2000 ; //1ms wait
OCR1A = 2000 ; //1ms wait
@ -638,7 +638,7 @@ ISR(TIMER1_COMPA_vect) {
}
}
# endif
# endif
// #if def ADVANCE
// #if ENABLED( ADVANCE)
// e_steps[current_block->active_extruder] = 0;
// e_steps[current_block->active_extruder] = 0;
// #endif
// #endif
}
}
@ -658,7 +658,7 @@ ISR(TIMER1_COMPA_vect) {
MSerial . checkRx ( ) ; // Check for serial chars.
MSerial . checkRx ( ) ; // Check for serial chars.
# endif
# endif
# if def ADVANCE
# if ENABLED( ADVANCE)
counter_e + = current_block - > steps [ E_AXIS ] ;
counter_e + = current_block - > steps [ E_AXIS ] ;
if ( counter_e > 0 ) {
if ( counter_e > 0 ) {
counter_e - = current_block - > step_event_count ;
counter_e - = current_block - > step_event_count ;
@ -677,7 +677,7 @@ ISR(TIMER1_COMPA_vect) {
STEP_ADD ( x , X ) ;
STEP_ADD ( x , X ) ;
STEP_ADD ( y , Y ) ;
STEP_ADD ( y , Y ) ;
STEP_ADD ( z , Z ) ;
STEP_ADD ( z , Z ) ;
# if ndef ADVANCE
# if DISABLED( ADVANCE)
STEP_ADD ( e , E ) ;
STEP_ADD ( e , E ) ;
# endif
# endif
@ -691,7 +691,7 @@ ISR(TIMER1_COMPA_vect) {
STEP_IF_COUNTER ( x , X ) ;
STEP_IF_COUNTER ( x , X ) ;
STEP_IF_COUNTER ( y , Y ) ;
STEP_IF_COUNTER ( y , Y ) ;
STEP_IF_COUNTER ( z , Z ) ;
STEP_IF_COUNTER ( z , Z ) ;
# if ndef ADVANCE
# if DISABLED( ADVANCE)
STEP_IF_COUNTER ( e , E ) ;
STEP_IF_COUNTER ( e , E ) ;
# endif
# endif
@ -714,7 +714,7 @@ ISR(TIMER1_COMPA_vect) {
timer = calc_timer ( acc_step_rate ) ;
timer = calc_timer ( acc_step_rate ) ;
OCR1A = timer ;
OCR1A = timer ;
acceleration_time + = timer ;
acceleration_time + = timer ;
# if def ADVANCE
# if ENABLED( ADVANCE)
for ( int8_t i = 0 ; i < step_loops ; i + + ) {
for ( int8_t i = 0 ; i < step_loops ; i + + ) {
advance + = advance_rate ;
advance + = advance_rate ;
}
}
@ -743,7 +743,7 @@ ISR(TIMER1_COMPA_vect) {
timer = calc_timer ( step_rate ) ;
timer = calc_timer ( step_rate ) ;
OCR1A = timer ;
OCR1A = timer ;
deceleration_time + = timer ;
deceleration_time + = timer ;
# if def ADVANCE
# if ENABLED( ADVANCE)
for ( int8_t i = 0 ; i < step_loops ; i + + ) {
for ( int8_t i = 0 ; i < step_loops ; i + + ) {
advance - = advance_rate ;
advance - = advance_rate ;
}
}
@ -767,7 +767,7 @@ ISR(TIMER1_COMPA_vect) {
}
}
}
}
# if def ADVANCE
# if ENABLED( ADVANCE)
unsigned char old_OCR0A ;
unsigned char old_OCR0A ;
// Timer interrupt for E. e_steps is set in the main routine;
// Timer interrupt for E. e_steps is set in the main routine;
// Timer 0 is shared with millies
// Timer 0 is shared with millies
@ -845,11 +845,11 @@ void st_init() {
microstep_init ( ) ; //Initialize Microstepping Pins
microstep_init ( ) ; //Initialize Microstepping Pins
// initialise TMC Steppers
// initialise TMC Steppers
# if def HAVE_TMCDRIVER
# if ENABLED( HAVE_TMCDRIVER)
tmc_init ( ) ;
tmc_init ( ) ;
# endif
# endif
// initialise L6470 Steppers
// initialise L6470 Steppers
# if def HAVE_L6470DRIVER
# if ENABLED( HAVE_L6470DRIVER)
L6470_init ( ) ;
L6470_init ( ) ;
# endif
# endif
@ -862,13 +862,13 @@ void st_init() {
# endif
# endif
# if HAS_Y_DIR
# if HAS_Y_DIR
Y_DIR_INIT ;
Y_DIR_INIT ;
# if defined (Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
# if ENABLED (Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
Y2_DIR_INIT ;
Y2_DIR_INIT ;
# endif
# endif
# endif
# endif
# if HAS_Z_DIR
# if HAS_Z_DIR
Z_DIR_INIT ;
Z_DIR_INIT ;
# if defined (Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
# if ENABLED (Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_DIR
Z2_DIR_INIT ;
Z2_DIR_INIT ;
# endif
# endif
# endif
# endif
@ -899,7 +899,7 @@ void st_init() {
Y_ENABLE_INIT ;
Y_ENABLE_INIT ;
if ( ! Y_ENABLE_ON ) Y_ENABLE_WRITE ( HIGH ) ;
if ( ! Y_ENABLE_ON ) Y_ENABLE_WRITE ( HIGH ) ;
# if defined (Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
# if ENABLED (Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
Y2_ENABLE_INIT ;
Y2_ENABLE_INIT ;
if ( ! Y_ENABLE_ON ) Y2_ENABLE_WRITE ( HIGH ) ;
if ( ! Y_ENABLE_ON ) Y2_ENABLE_WRITE ( HIGH ) ;
# endif
# endif
@ -908,7 +908,7 @@ void st_init() {
Z_ENABLE_INIT ;
Z_ENABLE_INIT ;
if ( ! Z_ENABLE_ON ) Z_ENABLE_WRITE ( HIGH ) ;
if ( ! Z_ENABLE_ON ) Z_ENABLE_WRITE ( HIGH ) ;
# if defined (Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE
# if ENABLED (Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_ENABLE
Z2_ENABLE_INIT ;
Z2_ENABLE_INIT ;
if ( ! Z_ENABLE_ON ) Z2_ENABLE_WRITE ( HIGH ) ;
if ( ! Z_ENABLE_ON ) Z2_ENABLE_WRITE ( HIGH ) ;
# endif
# endif
@ -934,56 +934,56 @@ void st_init() {
# if HAS_X_MIN
# if HAS_X_MIN
SET_INPUT ( X_MIN_PIN ) ;
SET_INPUT ( X_MIN_PIN ) ;
# if def ENDSTOPPULLUP_XMIN
# if ENABLED( ENDSTOPPULLUP_XMIN)
WRITE ( X_MIN_PIN , HIGH ) ;
WRITE ( X_MIN_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if HAS_Y_MIN
# if HAS_Y_MIN
SET_INPUT ( Y_MIN_PIN ) ;
SET_INPUT ( Y_MIN_PIN ) ;
# if def ENDSTOPPULLUP_YMIN
# if ENABLED( ENDSTOPPULLUP_YMIN)
WRITE ( Y_MIN_PIN , HIGH ) ;
WRITE ( Y_MIN_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if HAS_Z_MIN
# if HAS_Z_MIN
SET_INPUT ( Z_MIN_PIN ) ;
SET_INPUT ( Z_MIN_PIN ) ;
# if def ENDSTOPPULLUP_ZMIN
# if ENABLED( ENDSTOPPULLUP_ZMIN)
WRITE ( Z_MIN_PIN , HIGH ) ;
WRITE ( Z_MIN_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if HAS_X_MAX
# if HAS_X_MAX
SET_INPUT ( X_MAX_PIN ) ;
SET_INPUT ( X_MAX_PIN ) ;
# if def ENDSTOPPULLUP_XMAX
# if ENABLED( ENDSTOPPULLUP_XMAX)
WRITE ( X_MAX_PIN , HIGH ) ;
WRITE ( X_MAX_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if HAS_Y_MAX
# if HAS_Y_MAX
SET_INPUT ( Y_MAX_PIN ) ;
SET_INPUT ( Y_MAX_PIN ) ;
# if def ENDSTOPPULLUP_YMAX
# if ENABLED( ENDSTOPPULLUP_YMAX)
WRITE ( Y_MAX_PIN , HIGH ) ;
WRITE ( Y_MAX_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if HAS_Z_MAX
# if HAS_Z_MAX
SET_INPUT ( Z_MAX_PIN ) ;
SET_INPUT ( Z_MAX_PIN ) ;
# if def ENDSTOPPULLUP_ZMAX
# if ENABLED( ENDSTOPPULLUP_ZMAX)
WRITE ( Z_MAX_PIN , HIGH ) ;
WRITE ( Z_MAX_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if HAS_Z2_MAX
# if HAS_Z2_MAX
SET_INPUT ( Z2_MAX_PIN ) ;
SET_INPUT ( Z2_MAX_PIN ) ;
# if def ENDSTOPPULLUP_ZMAX
# if ENABLED( ENDSTOPPULLUP_ZMAX)
WRITE ( Z2_MAX_PIN , HIGH ) ;
WRITE ( Z2_MAX_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
# if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined (Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
# if HAS_Z_PROBE && ENABLED (Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
SET_INPUT ( Z_PROBE_PIN ) ;
SET_INPUT ( Z_PROBE_PIN ) ;
# if def ENDSTOPPULLUP_ZPROBE
# if ENABLED( ENDSTOPPULLUP_ZPROBE)
WRITE ( Z_PROBE_PIN , HIGH ) ;
WRITE ( Z_PROBE_PIN , HIGH ) ;
# endif
# endif
# endif
# endif
@ -1007,14 +1007,14 @@ void st_init() {
AXIS_INIT ( x , X2 , X ) ;
AXIS_INIT ( x , X2 , X ) ;
# endif
# endif
# if HAS_Y_STEP
# if HAS_Y_STEP
# if defined (Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP
# if ENABLED (Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_STEP
Y2_STEP_INIT ;
Y2_STEP_INIT ;
Y2_STEP_WRITE ( INVERT_Y_STEP_PIN ) ;
Y2_STEP_WRITE ( INVERT_Y_STEP_PIN ) ;
# endif
# endif
AXIS_INIT ( y , Y , Y ) ;
AXIS_INIT ( y , Y , Y ) ;
# endif
# endif
# if HAS_Z_STEP
# if HAS_Z_STEP
# if defined (Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP
# if ENABLED (Z_DUAL_STEPPER_DRIVERS) && HAS_Z2_STEP
Z2_STEP_INIT ;
Z2_STEP_INIT ;
Z2_STEP_WRITE ( INVERT_Z_STEP_PIN ) ;
Z2_STEP_WRITE ( INVERT_Z_STEP_PIN ) ;
# endif
# endif
@ -1054,7 +1054,7 @@ void st_init() {
TCNT1 = 0 ;
TCNT1 = 0 ;
ENABLE_STEPPER_DRIVER_INTERRUPT ( ) ;
ENABLE_STEPPER_DRIVER_INTERRUPT ( ) ;
# if def ADVANCE
# if ENABLED( ADVANCE)
# if defined(TCCR0A) && defined(WGM01)
# if defined(TCCR0A) && defined(WGM01)
TCCR0A & = ~ BIT ( WGM01 ) ;
TCCR0A & = ~ BIT ( WGM01 ) ;
TCCR0A & = ~ BIT ( WGM00 ) ;
TCCR0A & = ~ BIT ( WGM00 ) ;
@ -1113,7 +1113,7 @@ void quickStop() {
ENABLE_STEPPER_DRIVER_INTERRUPT ( ) ;
ENABLE_STEPPER_DRIVER_INTERRUPT ( ) ;
}
}
# if def BABYSTEPPING
# if ENABLED( BABYSTEPPING)
// MUST ONLY BE CALLED BY AN ISR,
// MUST ONLY BE CALLED BY AN ISR,
// No other ISR should ever interrupt this!
// No other ISR should ever interrupt this!
@ -1146,7 +1146,7 @@ void quickStop() {
case Z_AXIS : {
case Z_AXIS : {
# if ndef DELTA
# if DISABLED(D ELTA)
BABYSTEP_AXIS ( z , Z , BABYSTEP_INVERT_Z ) ;
BABYSTEP_AXIS ( z , Z , BABYSTEP_INVERT_Z ) ;
@ -1272,7 +1272,7 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) {
case 1 : digitalWrite ( Y_MS2_PIN , ms2 ) ; break ;
case 1 : digitalWrite ( Y_MS2_PIN , ms2 ) ; break ;
case 2 : digitalWrite ( Z_MS2_PIN , ms2 ) ; break ;
case 2 : digitalWrite ( Z_MS2_PIN , ms2 ) ; break ;
case 3 : digitalWrite ( E0_MS2_PIN , ms2 ) ; break ;
case 3 : digitalWrite ( E0_MS2_PIN , ms2 ) ; break ;
# if defined(E1_MS2_PIN) && E1_MS2_PIN >= 0
# if PIN_EXISTS(E1_MS2)
case 4 : digitalWrite ( E1_MS2_PIN , ms2 ) ; break ;
case 4 : digitalWrite ( E1_MS2_PIN , ms2 ) ; break ;
# endif
# endif
}
}
@ -1309,7 +1309,7 @@ void microstep_readings() {
# endif
# endif
}
}
# if def Z_DUAL_ENDSTOPS
# if ENABLED( Z_DUAL_ENDSTOPS)
void In_Homing_Process ( bool state ) { performing_homing = state ; }
void In_Homing_Process ( bool state ) { performing_homing = state ; }
void Lock_z_motor ( bool state ) { locked_z_motor = state ; }
void Lock_z_motor ( bool state ) { locked_z_motor = state ; }
void Lock_z2_motor ( bool state ) { locked_z2_motor = state ; }
void Lock_z2_motor ( bool state ) { locked_z2_motor = state ; }