enum.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #ifndef __ENUM_H__
  23. #define __ENUM_H__
  24. #include "MarlinConfig.h"
  25. /**
  26. * Axis indices as enumerated constants
  27. *
  28. * - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
  29. * - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers, corresponding to XYZ on Cartesians
  30. * - X_HEAD, Y_HEAD, and Z_HEAD should be used for Steppers on Core kinematics
  31. */
  32. enum AxisEnum : unsigned char {
  33. X_AXIS = 0,
  34. A_AXIS = 0,
  35. Y_AXIS = 1,
  36. B_AXIS = 1,
  37. Z_AXIS = 2,
  38. C_AXIS = 2,
  39. E_CART = 3,
  40. #if ENABLED(HANGPRINTER) // Hangprinter order: A_AXIS, B_AXIS, C_AXIS, D_AXIS, E_AXIS
  41. D_AXIS = 3,
  42. E_AXIS = 4,
  43. #else
  44. E_AXIS = 3,
  45. #endif
  46. X_HEAD, Y_HEAD, Z_HEAD,
  47. ALL_AXES = 0xFE,
  48. NO_AXIS = 0xFF
  49. };
  50. #define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=S; VAR<=N; VAR++)
  51. #define LOOP_S_L_N(VAR, S, N) for (uint8_t VAR=S; VAR<N; VAR++)
  52. #define LOOP_LE_N(VAR, N) LOOP_S_LE_N(VAR, 0, N)
  53. #define LOOP_L_N(VAR, N) LOOP_S_L_N(VAR, 0, N)
  54. #define LOOP_NA(VAR) LOOP_L_N(VAR, NUM_AXIS)
  55. #define LOOP_XYZ(VAR) LOOP_S_LE_N(VAR, X_AXIS, Z_AXIS)
  56. #define LOOP_XYZE(VAR) LOOP_S_LE_N(VAR, X_AXIS, E_CART)
  57. #define LOOP_XYZE_N(VAR) LOOP_S_L_N(VAR, X_AXIS, XYZE_N)
  58. #define LOOP_MOV_AXIS(VAR) LOOP_S_L_N(VAR, A_AXIS, MOV_AXIS)
  59. #define LOOP_NUM_AXIS(VAR) LOOP_S_L_N(VAR, A_AXIS, NUM_AXIS)
  60. #define LOOP_NUM_AXIS_N(VAR) LOOP_S_L_N(VAR, A_AXIS, NUM_AXIS_N)
  61. typedef enum {
  62. LINEARUNIT_MM,
  63. LINEARUNIT_INCH
  64. } LinearUnit;
  65. typedef enum {
  66. TEMPUNIT_C,
  67. TEMPUNIT_K,
  68. TEMPUNIT_F
  69. } TempUnit;
  70. /**
  71. * Debug flags
  72. * Not yet widely applied
  73. */
  74. enum DebugFlags : unsigned char {
  75. DEBUG_NONE = 0,
  76. DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed
  77. DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output
  78. DEBUG_ERRORS = _BV(2), ///< Not implemented
  79. DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands
  80. DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
  81. DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling
  82. DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling
  83. DEBUG_ALL = 0xFF
  84. };
  85. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  86. enum AdvancedPauseMenuResponse : char {
  87. ADVANCED_PAUSE_RESPONSE_WAIT_FOR,
  88. ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE,
  89. ADVANCED_PAUSE_RESPONSE_RESUME_PRINT
  90. };
  91. #if ENABLED(ULTIPANEL)
  92. enum AdvancedPauseMessage : char {
  93. ADVANCED_PAUSE_MESSAGE_INIT,
  94. ADVANCED_PAUSE_MESSAGE_UNLOAD,
  95. ADVANCED_PAUSE_MESSAGE_INSERT,
  96. ADVANCED_PAUSE_MESSAGE_LOAD,
  97. ADVANCED_PAUSE_MESSAGE_PURGE,
  98. #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
  99. ADVANCED_PAUSE_MESSAGE_CONTINUOUS_PURGE,
  100. #endif
  101. ADVANCED_PAUSE_MESSAGE_OPTION,
  102. ADVANCED_PAUSE_MESSAGE_RESUME,
  103. ADVANCED_PAUSE_MESSAGE_STATUS,
  104. ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE,
  105. ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT
  106. };
  107. #endif
  108. enum AdvancedPauseMode : char {
  109. ADVANCED_PAUSE_MODE_PAUSE_PRINT,
  110. ADVANCED_PAUSE_MODE_LOAD_FILAMENT,
  111. ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT
  112. };
  113. #endif
  114. /**
  115. * States for managing Marlin and host communication
  116. * Marlin sends messages if blocked or busy
  117. */
  118. #if ENABLED(HOST_KEEPALIVE_FEATURE)
  119. enum MarlinBusyState : char {
  120. NOT_BUSY, // Not in a handler
  121. IN_HANDLER, // Processing a GCode
  122. IN_PROCESS, // Known to be blocking command input (as in G29)
  123. PAUSED_FOR_USER, // Blocking pending any input
  124. PAUSED_FOR_INPUT // Blocking pending text input (concept)
  125. };
  126. #endif
  127. /**
  128. * SD Card
  129. */
  130. enum LsAction : char { LS_SerialPrint, LS_Count, LS_GetFilename };
  131. /**
  132. * Ultra LCD
  133. */
  134. enum LCDViewAction : char {
  135. LCDVIEW_NONE,
  136. LCDVIEW_REDRAW_NOW,
  137. LCDVIEW_CALL_REDRAW_NEXT,
  138. LCDVIEW_CLEAR_CALL_REDRAW,
  139. LCDVIEW_CALL_NO_REDRAW
  140. };
  141. /**
  142. * Dual X Carriage modes. A Dual Nozzle can also do duplication.
  143. */
  144. #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
  145. enum DualXMode : char {
  146. DXC_FULL_CONTROL_MODE, // DUAL_X_CARRIAGE only
  147. DXC_AUTO_PARK_MODE, // DUAL_X_CARRIAGE only
  148. DXC_DUPLICATION_MODE
  149. };
  150. #endif
  151. /**
  152. * Workspace planes only apply to G2/G3 moves
  153. * (and "canned cycles" - not a current feature)
  154. */
  155. #if ENABLED(CNC_WORKSPACE_PLANES)
  156. enum WorkspacePlane : char { PLANE_XY, PLANE_ZX, PLANE_YZ };
  157. #endif
  158. #endif // __ENUM_H__