My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../../inc/MarlinConfig.h"
  23. #if HAS_L64XX
  24. #include "../../gcode.h"
  25. #include "../../../libs/L64XX/L64XX_Marlin.h"
  26. #include "../../../module/stepper/indirection.h"
  27. void echo_yes_no(const bool yes);
  28. inline void L6470_say_status(const L64XX_axis_t axis) {
  29. if (L64xxManager.spi_abort) return;
  30. const L64XX_Marlin::L64XX_shadow_t &sh = L64xxManager.shadow;
  31. L64xxManager.get_status(axis);
  32. L64xxManager.say_axis(axis);
  33. #if ENABLED(L6470_CHITCHAT)
  34. char temp_buf[20];
  35. sprintf_P(temp_buf, PSTR(" status: %4x "), sh.STATUS_AXIS_RAW);
  36. SERIAL_ECHO(temp_buf);
  37. print_bin(sh.STATUS_AXIS_RAW);
  38. switch (sh.STATUS_AXIS_LAYOUT) {
  39. case L6470_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6470"); break;
  40. case L6474_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6474"); break;
  41. case L6480_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6480/powerSTEP01"); break;
  42. }
  43. #endif
  44. SERIAL_ECHOPGM("\n...OUTPUT: ");
  45. SERIAL_ECHOF(sh.STATUS_AXIS & STATUS_HIZ ? F("OFF") : F("ON "));
  46. SERIAL_ECHOPGM(" BUSY: "); echo_yes_no((sh.STATUS_AXIS & STATUS_BUSY) == 0);
  47. SERIAL_ECHOPGM(" DIR: ");
  48. SERIAL_ECHOF((((sh.STATUS_AXIS & STATUS_DIR) >> 4) ^ L64xxManager.index_to_dir[axis]) ? F("FORWARD") : F("REVERSE"));
  49. if (sh.STATUS_AXIS_LAYOUT == L6480_STATUS_LAYOUT) {
  50. SERIAL_ECHOPGM(" Last Command: ");
  51. if (sh.STATUS_AXIS & sh.STATUS_AXIS_WRONG_CMD) SERIAL_ECHOPGM("VALID");
  52. else SERIAL_ECHOPGM("ERROR");
  53. SERIAL_ECHOPGM("\n...THERMAL: ");
  54. switch ((sh.STATUS_AXIS & (sh.STATUS_AXIS_TH_SD | sh.STATUS_AXIS_TH_WRN)) >> 11) {
  55. case 0: SERIAL_ECHOPGM("DEVICE SHUTDOWN"); break;
  56. case 1: SERIAL_ECHOPGM("BRIDGE SHUTDOWN"); break;
  57. case 2: SERIAL_ECHOPGM("WARNING "); break;
  58. case 3: SERIAL_ECHOPGM("OK "); break;
  59. }
  60. }
  61. else {
  62. SERIAL_ECHOPGM(" Last Command: ");
  63. if (!(sh.STATUS_AXIS & sh.STATUS_AXIS_WRONG_CMD)) SERIAL_ECHOPGM("IN");
  64. SERIAL_ECHOPGM("VALID ");
  65. SERIAL_ECHOF(sh.STATUS_AXIS & sh.STATUS_AXIS_NOTPERF_CMD ? F("COMPLETED ") : F("Not PERFORMED"));
  66. SERIAL_ECHOPGM("\n...THERMAL: ", !(sh.STATUS_AXIS & sh.STATUS_AXIS_TH_SD) ? "SHUTDOWN " : !(sh.STATUS_AXIS & sh.STATUS_AXIS_TH_WRN) ? "WARNING " : "OK ");
  67. }
  68. SERIAL_ECHOPGM(" OVERCURRENT:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_OCD) == 0);
  69. if (sh.STATUS_AXIS_LAYOUT != L6474_STATUS_LAYOUT) {
  70. SERIAL_ECHOPGM(" STALL:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_STEP_LOSS_A) == 0 || (sh.STATUS_AXIS & sh.STATUS_AXIS_STEP_LOSS_B) == 0);
  71. SERIAL_ECHOPGM(" STEP-CLOCK MODE:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_SCK_MOD) != 0);
  72. }
  73. else {
  74. SERIAL_ECHOPGM(" STALL: NA "
  75. " STEP-CLOCK MODE: NA"
  76. " UNDER VOLTAGE LOCKOUT: "); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_UVLO) == 0);
  77. }
  78. SERIAL_EOL();
  79. }
  80. /**
  81. * M122: Debug L6470 drivers
  82. */
  83. void GcodeSuite::M122() {
  84. L64xxManager.pause_monitor(true); // Keep monitor_driver() from stealing status
  85. L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway
  86. //if (parser.seen('S'))
  87. // tmc_set_report_interval(parser.value_bool());
  88. //else
  89. #if AXIS_IS_L64XX(X)
  90. L6470_say_status(X);
  91. #endif
  92. #if AXIS_IS_L64XX(X2)
  93. L6470_say_status(X2);
  94. #endif
  95. #if AXIS_IS_L64XX(Y)
  96. L6470_say_status(Y);
  97. #endif
  98. #if AXIS_IS_L64XX(Y2)
  99. L6470_say_status(Y2);
  100. #endif
  101. #if AXIS_IS_L64XX(Z)
  102. L6470_say_status(Z);
  103. #endif
  104. #if AXIS_IS_L64XX(Z2)
  105. L6470_say_status(Z2);
  106. #endif
  107. #if AXIS_IS_L64XX(Z3)
  108. L6470_say_status(Z3);
  109. #endif
  110. #if AXIS_IS_L64XX(Z4)
  111. L6470_say_status(Z4);
  112. #endif
  113. #if AXIS_IS_L64XX(E0)
  114. L6470_say_status(E0);
  115. #endif
  116. #if AXIS_IS_L64XX(E1)
  117. L6470_say_status(E1);
  118. #endif
  119. #if AXIS_IS_L64XX(E2)
  120. L6470_say_status(E2);
  121. #endif
  122. #if AXIS_IS_L64XX(E3)
  123. L6470_say_status(E3);
  124. #endif
  125. #if AXIS_IS_L64XX(E4)
  126. L6470_say_status(E4);
  127. #endif
  128. #if AXIS_IS_L64XX(E5)
  129. L6470_say_status(E5);
  130. #endif
  131. #if AXIS_IS_L64XX(E6)
  132. L6470_say_status(E6);
  133. #endif
  134. #if AXIS_IS_L64XX(E7)
  135. L6470_say_status(E7);
  136. #endif
  137. L64xxManager.spi_active = false; // done with all SPI transfers - clear handshake flags
  138. L64xxManager.spi_abort = false;
  139. L64xxManager.pause_monitor(false);
  140. }
  141. #endif // HAS_L64XX