1. diff --git a/Grbl_Esp32/Machines/spi_daisy_4axis_xyz.h b/Grbl_Esp32/Machines/spi_daisy_4axis_xyz.h
  2. index 0eefb60..d2ddff2 100644
  3. --- a/Grbl_Esp32/Machines/spi_daisy_4axis_xyz.h
  4. +++ b/Grbl_Esp32/Machines/spi_daisy_4axis_xyz.h
  5. @@ -22,7 +22,8 @@
  6. You should have received a copy of the GNU General Public License
  7. along with Grbl_ESP32. If not, see <http://www.gnu.org/licenses/>.
  8. */
  9. -
  10. +#define TRINAMIC_RUN_MODE TRINAMIC_RUN_MODE_STALLGUARD
  11. +#define TRINAMIC_HOMING_MODE TRINAMIC_HOMING_STALLGUARD
  12. #define MACHINE_NAME "SPI_DAISY_4X_XYZ"
  13. #ifdef N_AXIS
  14. diff --git a/Grbl_Esp32/Motors/TrinamicDriverClass.cpp b/Grbl_Esp32/Motors/TrinamicDriverClass.cpp
  15. index ce0cab1..b5a0bcc 100644
  16. --- a/Grbl_Esp32/Motors/TrinamicDriverClass.cpp
  17. +++ b/Grbl_Esp32/Motors/TrinamicDriverClass.cpp
  18. @@ -189,6 +189,25 @@ void TrinamicDriver :: set_mode() {
  19. }
  20. }
  21. +// formats axis values into a string and returns that string in rpt
  22. +static void report_util_axis_values(float* axis_value, char* rpt) {
  23. + uint8_t idx;
  24. + char axisVal[10];
  25. + float unit_conv = 1.0; // unit conversion multiplier..default is mm
  26. + rpt[0] = '\0';
  27. + if (report_inches->get())
  28. + unit_conv = 1.0 / MM_PER_INCH;
  29. + for (idx = 0; idx < N_AXIS; idx++) {
  30. + if (report_inches->get())
  31. + sprintf(axisVal, "%4.4f", axis_value[idx] * unit_conv); // Report inches to 4 decimals
  32. + else
  33. + sprintf(axisVal, "%4.3f", axis_value[idx] * unit_conv); // Report mm to 3 decimals
  34. + strcat(rpt, axisVal);
  35. + if (idx < (N_AXIS - 1))
  36. + strcat(rpt, ",");
  37. + }
  38. +}
  39. +
  40. /*
  41. This is the stallguard tuning info. It is call debug, so it could be generic across all classes.
  42. */
  43. @@ -199,15 +218,21 @@ void TrinamicDriver :: debug_message() {
  44. if (tstep == 0xFFFFF || tstep < 1) // if axis is not moving return
  45. return;
  46. float feedrate = st_get_realtime_rate(); //* settings.microsteps[axis_index] / 60.0 ; // convert mm/min to Hz
  47. -
  48. - grbl_msg_sendf(CLIENT_SERIAL,
  49. + int32_t current_position[N_AXIS]; // Copy current state of the system position variable
  50. + float print_position[N_AXIS];
  51. + memcpy(current_position, sys_position, sizeof(sys_position));
  52. + system_convert_array_steps_to_mpos(print_position, current_position);
  53. + char temp[80];
  54. + report_util_axis_values(print_position, temp);
  55. + grbl_msg_sendf(CLIENT_ALL,
  56. MSG_LEVEL_INFO,
  57. - "%s Stallguard %d SG_Val: %04d Rate: %05.0f mm/min SG_Setting:%d",
  58. + "%s Stallguard %d SG_Val: %04d Rate: %05.0f mm/min SG_Setting:%d MPos:%s",
  59. _axis_name,
  60. tmcstepper->stallguard(),
  61. tmcstepper->sg_result(),
  62. feedrate,
  63. - axis_settings[axis_index]->stallguard->get());
  64. + axis_settings[axis_index]->stallguard->get(),
  65. + temp);
  66. }
  67. // calculate a tstep from a rate
  68. diff --git a/Grbl_Esp32/machine.h b/Grbl_Esp32/machine.h
  69. index 3f987a9..f2e5438 100644
  70. --- a/Grbl_Esp32/machine.h
  71. +++ b/Grbl_Esp32/machine.h
  72. @@ -17,7 +17,7 @@ PWM
  73. // !!! For initial testing, start with test_drive.h which disables
  74. // all I/O pins
  75. // #include "Machines/atari_1020.h"
  76. -#include "Machines/test_drive.h"
  77. +#include "Machines/spi_daisy_4axis_xyz.h"
  78. // !!! For actual use, change the line above to select a board
  79. // from Machines/, for example: