File tree Expand file tree Collapse file tree 10 files changed +123
-14
lines changed Expand file tree Collapse file tree 10 files changed +123
-14
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
1111
1212---
1313
14- Latest build date is 20210726 , see the [ changelog] ( changelog.md ) for details.
14+ Latest build date is 20210803 , see the [ changelog] ( changelog.md ) for details.
1515
1616---
1717
Original file line number Diff line number Diff line change 11## grblHAL changelog
22
3+ Build 20210803:
4+
5+ Core:
6+ * Added optional HAL entry point for stepper motor enumeration (axis vs. motor id). Used by motors plugin.
7+ * Improved optional driver support files.
8+
9+ Drivers & plugins:
10+ * Added F103RC support and a board map for the BTT SKR MINI E3 V2.0 to the STMF1xx driver.
11+ * Added tentative plasma plugin support to the SAM3X8E \( Arduino Due\) driver.
12+ * Updated motors plugin to match updated [ Trinamic library] ( https://github.com/terjeio/Trinamic-library ) , added support for TMC2209++.
13+ * Some minor bug fixes and improvements.
14+
315Build 20210726:
416
517Core:
Original file line number Diff line number Diff line change 102102#ifndef TRINAMIC_I2C
103103#define TRINAMIC_I2C 0
104104#endif
105+ #if TRINAMIC_ENABLE && TRINAMIC_I2C
106+ #define TRINAMIC_MOTOR_ENABLE 1
107+ #else
108+ #define TRINAMIC_MOTOR_ENABLE 0
109+ #endif
105110#ifndef TRINAMIC_DEV
106111#define TRINAMIC_DEV 0
107112#endif
Original file line number Diff line number Diff line change 3434#else
3535#define GRBL_VERSION "1.1f"
3636#endif
37- #define GRBL_VERSION_BUILD "20210715 "
37+ #define GRBL_VERSION_BUILD "20210803 "
3838
3939// The following symbols are set here if not already set by the compiler or in config.h
4040// Do NOT change here!
Original file line number Diff line number Diff line change @@ -323,10 +323,35 @@ typedef struct {
323323 control_signals_callback_ptr interrupt_callback ; //!< Callback for informing about control switches events. _Set by the core at startup.
324324} control_signals_ptrs_t ;
325325
326+
326327/**************
327328 * Steppers *
328329 **************/
329330
331+ /*! \brief Motor vs. axis mapping
332+ __NOTE:__ id and axis values are equal for primary motors, unequal for secondary (ganged) motors.
333+ */
334+ typedef union {
335+ uint32_t value ;
336+ struct {
337+ uint32_t id : 8 ,
338+ axis : 8 ;
339+ };
340+ } motor_map_t ;
341+
342+ /*! \brief Signature of the callback function to receive motor vs. axis mappings.
343+ \param motor a motor_map_t struct.
344+ */
345+ typedef void (* motor_iterator_callback_ptr )(motor_map_t motor );
346+
347+
348+ /*! \brief Pointer to function for iterating over stepper motor vs. axis mappings.
349+
350+ \param callback pointer to a #motor_iterator_callback_ptr function to be called for each motor.
351+ */
352+ typedef void (* motor_iterator_ptr )(motor_iterator_callback_ptr callback );
353+
354+
330355/*! \brief Pointer to function for enabling all stepper motors and the main stepper interrupt.
331356
332357The first interrupt should be generated after a short delay to allow the drivers time to apply power to the motors.
@@ -418,6 +443,7 @@ typedef struct {
418443 stepper_interrupt_callback_ptr interrupt_callback ; //!< Callback for informing about the next step pulse to output. _Set by the core at startup._
419444 stepper_get_auto_squared_ptr get_auto_squared ; //!< Optional handler getting which axes are configured for auto squaring.
420445 stepper_output_step_ptr output_step ; //!< Optional handler for outputting a single step pulse. _Experimental._
446+ motor_iterator_ptr motor_iterator ; //!< Optional handler iteration over motor vs. axis mappings. Required for the motors plugin (Trinamic drivers).
421447} stepper_ptrs_t ;
422448
423449
Original file line number Diff line number Diff line change 373373#endif // Z_DOUBLED
374374
375375#ifdef X_DOUBLED
376- #undef X_DOUBLED
376+ #define X2_MOTOR (N_AXIS + X_DOUBLED - 1)
377377#endif
378378#ifdef Y_DOUBLED
379- #undef Y_DOUBLED
379+ #define Y2_MOTOR (N_AXIS + Y_DOUBLED - 1)
380380#endif
381381#ifdef Z_DOUBLED
382- #undef Z_DOUBLED
382+ #define Z2_MOTOR (N_AXIS + Z_DOUBLED - 1)
383383#endif
384384
385385#endif // N_GANGED
609609#endif
610610
611611#ifndef STEPPERS_ENABLE_MASK
612+
612613#ifdef STEPPERS_ENABLE_BIT
613614#define STEPPERS_ENABLE_MASK STEPPERS_ENABLE_BIT
614615#else
616+
617+ #if N_AXIS >=4 && !defined(A_ENABLE_BIT )
618+ #define A_ENABLE_BIT 0
619+ #endif
620+ #if N_AXIS >=5 && !defined(B_ENABLE_BIT )
621+ #define B_ENABLE_BIT 0
622+ #endif
623+ #if N_AXIS >= 6 && !defined(C_ENABLE_BIT )
624+ #define C_ENABLE_BIT 0
625+ #endif
626+
615627#if N_AXIS == 3
616628#define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT)
617629#elif N_AXIS == 4
626638#define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT|C_ENABLE_BIT|U_ENABLE_BIT|V_ENABLE_BIT)
627639#endif
628640#endif
629- #endif
641+
642+ #endif // STEPPERS_ENABLE_MASK
630643
631644#ifndef LIMIT_MASK
645+
646+ #if N_AXIS >=4 && !defined(A_LIMIT_BIT )
647+ #ifdef A_LIMIT_PIN
648+ #define A_LIMIT_BIT (1<<A_LIMIT_PIN)
649+ #else
650+ #define A_LIMIT_BIT 0
651+ #endif
652+ #endif
653+ #if N_AXIS >=5 && !defined(B_LIMIT_BIT )
654+ #ifdef B_LIMIT_PIN
655+ #define B_LIMIT_BIT (1<<B_LIMIT_PIN)
656+ #else
657+ #define B_LIMIT_BIT 0
658+ #endif
659+ #endif
660+ #if N_AXIS >= 6 && !defined(C_LIMIT_BIT )
661+ #ifdef A_LIMIT_PIN
662+ #define C_LIMIT_BIT (1<<A_LIMIT_PIN)
663+ #else
664+ #define C_LIMIT_BIT 0
665+ #endif
666+ #endif
667+
632668#if N_AXIS == 3
633669#define LIMIT_MASK (X_LIMIT_BIT|Y_LIMIT_BIT|Z_LIMIT_BIT)
634670#elif N_AXIS == 4
642678#else
643679#define LIMIT_MASK (X_LIMIT_BIT|Y_LIMIT_BIT|Z_LIMIT_BIT|A_LIMIT_BIT|B_LIMIT_BIT|C_LIMIT_BIT|U_LIMIT_BIT|V_LIMIT_BIT)
644680#endif
681+
682+ #endif // LIMIT_MASK
683+
684+ #ifndef N_GANGED
685+ #define N_GANGED 0
686+ #endif
687+
688+ static void motor_iterator (motor_iterator_callback_ptr callback )
689+ {
690+ motor_map_t motor ;
691+
692+ for (motor .id = 0 ; motor .id < N_AXIS + N_GANGED ; motor .id ++ )
693+ {
694+ if (motor .id < N_AXIS )
695+ motor .axis = motor .id ;
696+ else switch (motor .id ) {
697+ #ifdef X2_MOTOR
698+ case X2_MOTOR :
699+ motor .axis = X_AXIS ;
700+ break ;
701+ #endif
702+ #ifdef Y2_MOTOR
703+ case Y2_MOTOR :
704+ motor .axis = Y_AXIS ;
705+ break ;
706+ #endif
707+ #ifdef Z2_MOTOR
708+ case Z2_MOTOR :
709+ motor .axis = Z_AXIS ;
710+ break ;
645711#endif
712+ }
713+ callback (motor );
714+ }
715+ }
646716
647717/*EOF*/
Original file line number Diff line number Diff line change @@ -194,7 +194,8 @@ bool nvs_buffer_alloc (void)
194194{
195195 assert (NVS_SIZE >= GRBL_NVS_SIZE );
196196
197- nvsbuffer = malloc (NVS_SIZE );
197+ if ((nvsbuffer = malloc (NVS_SIZE )))
198+ memset (nvsbuffer , 0 , NVS_SIZE );
198199
199200 return nvsbuffer != NULL ;
200201}
Original file line number Diff line number Diff line change 2121
2222#pragma once
2323
24- #if defined(STM32F103xB ) || defined(STM32F401xC ) || defined(STM32F407xx ) || defined(STM32F411xE ) || defined(STM32F446xx ) || defined(STM32F756xx )
24+ #if defined(STM32F103xB ) || defined(STM32F103xE ) || defined( STM32F401xC ) || defined(STM32F407xx ) || defined(STM32F411xE ) || defined(STM32F446xx ) || defined(STM32F756xx )
2525#define STM32_PLATFORM
2626#endif
2727
Original file line number Diff line number Diff line change 2323 along with Grbl. If not, see <http://www.gnu.org/licenses/>.
2424*/
2525
26- #if PLASMA_ENABLE
27- extern void plasma_init (void );
28- plasma_init ();
29- #endif
30-
3126#if TRINAMIC_ENABLE
3227 extern bool trinamic_init (void );
3328 trinamic_init ();
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ int16_t stream_get_null (void)
4141 return SERIAL_NO_DATA ;
4242}
4343
44- static bool await_toolchange_ack (char c )
44+ ISR_CODE static bool await_toolchange_ack (char c )
4545{
4646 if (c == CMD_TOOL_ACK && !stream .rxbuffer -> backup ) {
4747 memcpy (& rxbackup , stream .rxbuffer , sizeof (stream_rx_buffer_t ));
You can’t perform that action at this time.
0 commit comments