@@ -107,7 +107,12 @@ void spindle_init()
107107
108108uint8_t spindle_get_state ()
109109{
110- uint16_t pin = 0 ;
110+ #if defined (STM32F103C8 )
111+ uint16_t pin = 0 ;
112+ #else
113+ uint8_t pin = 0 ;
114+ #endif
115+
111116 #ifdef VARIABLE_SPINDLE
112117 #ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
113118#ifdef AVRTARGET
@@ -116,7 +121,7 @@ uint8_t spindle_get_state()
116121#if defined (STM32F103C8 )
117122 pin = GPIO_ReadInputData (SPINDLE_ENABLE_PORT );
118123#endif
119- // No spindle direction output pin.
124+ // No spindle direction output pin.
120125 #ifdef INVERT_SPINDLE_ENABLE_PIN
121126 if (bit_isfalse (pin ,(1 <<SPINDLE_ENABLE_BIT ))) { return (SPINDLE_STATE_CW ); }
122127 #else
@@ -125,7 +130,7 @@ uint8_t spindle_get_state()
125130 #else
126131#ifdef AVRTARGET
127132 pin = SPINDLE_DIRECTION_PORT ;
128- if (SPINDLE_TCCRA_REGISTER & (1 <<SPINDLE_COMB_BIT ))
133+ if (SPINDLE_TCCRA_REGISTER & (1 <<SPINDLE_COMB_BIT ))
129134#endif
130135#if defined (STM32F103C8 )
131136 pin = GPIO_ReadInputData (SPINDLE_DIRECTION_PORT );
@@ -324,12 +329,12 @@ void spindle_stop()
324329{
325330 if (sys .abort ) { return ; } // Block during abort.
326331 if (state == SPINDLE_DISABLE ) { // Halt or set spindle direction and rpm.
327-
332+
328333 #ifdef VARIABLE_SPINDLE
329334 sys .spindle_speed = 0.0f ;
330335 #endif
331336 spindle_stop ();
332-
337+
333338 } else {
334339 #ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
335340 if (state == SPINDLE_ENABLE_CW ) {
@@ -339,7 +344,7 @@ void spindle_stop()
339344 SetSpindleDirectionBit ();
340345 }
341346 #endif
342-
347+
343348 #ifdef VARIABLE_SPINDLE
344349 // NOTE: Assumes all calls to this function is when Grbl is not moving or must remain off.
345350 if (settings .flags & BITFLAG_LASER_MODE ) {
@@ -355,15 +360,15 @@ void spindle_stop()
355360 ResetSpindleEnablebit ();
356361 #else
357362 SetSpindleEnablebit ();
358- #endif
363+ #endif
359364 #endif
360365 }
361-
366+
362367 sys .report_ovr_counter = 0 ; // Set to report change immediately
363368}
364369
365370
366- // G-code parser entry-point for setting spindle state. Forces a planner buffer sync and bails
371+ // G-code parser entry-point for setting spindle state. Forces a planner buffer sync and bails
367372// if an abort or check-mode is active.
368373#ifdef VARIABLE_SPINDLE
369374 void spindle_sync (uint8_t state , float rpm )
0 commit comments