Переглянути джерело

🎨 Fix comments, formatting

Scott Lahteine 2 роки тому
джерело
коміт
6cbd7a48d1

+ 2
- 3
Marlin/src/core/macros.h Переглянути файл

644
 #define IS_PROBE(V...) SECOND(V, 0)     // Get the second item passed, or 0
644
 #define IS_PROBE(V...) SECOND(V, 0)     // Get the second item passed, or 0
645
 #define PROBE() ~, 1                    // Second item will be 1 if this is passed
645
 #define PROBE() ~, 1                    // Second item will be 1 if this is passed
646
 #define _NOT_0 PROBE()
646
 #define _NOT_0 PROBE()
647
-#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
648
-#define _BOOL(x) NOT(NOT(x))            // NOT('0') gets '0'. Anything else gets '1'.
647
+#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) //   NOT('0') gets '1'. Anything else gets '0'.
648
+#define _BOOL(x) NOT(NOT(x))            // _BOOL('0') gets '0'. Anything else gets '1'.
649
 
649
 
650
 #define IF_ELSE(TF) _IF_ELSE(_BOOL(TF))
650
 #define IF_ELSE(TF) _IF_ELSE(_BOOL(TF))
651
 #define _IF_ELSE(TF) _CAT(_IF_, TF)
651
 #define _IF_ELSE(TF) _CAT(_IF_, TF)
659
 #define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())
659
 #define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())
660
 #define _END_OF_ARGUMENTS_() 0
660
 #define _END_OF_ARGUMENTS_() 0
661
 
661
 
662
-
663
 // Simple Inline IF Macros, friendly to use in other macro definitions
662
 // Simple Inline IF Macros, friendly to use in other macro definitions
664
 #define IF(O, A, B) ((O) ? (A) : (B))
663
 #define IF(O, A, B) ((O) ? (A) : (B))
665
 #define IF_0(O, A) IF(O, A, 0)
664
 #define IF_0(O, A) IF(O, A, 0)

+ 2
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h Переглянути файл

240
   #define IS_PROBE(V...) SECOND(V, 0)     // Get the second item passed, or 0
240
   #define IS_PROBE(V...) SECOND(V, 0)     // Get the second item passed, or 0
241
   #define PROBE() ~, 1                    // Second item will be 1 if this is passed
241
   #define PROBE() ~, 1                    // Second item will be 1 if this is passed
242
   #define _NOT_0 PROBE()
242
   #define _NOT_0 PROBE()
243
-  #define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
244
-  #define _BOOL(x) NOT(NOT(x))            // NOT('0') gets '0'. Anything else gets '1'.
243
+  #define NOT(x) IS_PROBE(_CAT(_NOT_, x)) //   NOT('0') gets '1'. Anything else gets '0'.
244
+  #define _BOOL(x) NOT(NOT(x))            // _BOOL('0') gets '0'. Anything else gets '1'.
245
 
245
 
246
   #define _DO_1(W,C,A)       (_##W##_1(A))
246
   #define _DO_1(W,C,A)       (_##W##_1(A))
247
   #define _DO_2(W,C,A,B)     (_##W##_1(A) C _##W##_1(B))
247
   #define _DO_2(W,C,A,B)     (_##W##_1(A) C _##W##_1(B))

+ 4
- 7
Marlin/src/lcd/marlinui.cpp Переглянути файл

489
         ui.manual_move.menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
489
         ui.manual_move.menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
490
         ui.encoderPosition = dir;
490
         ui.encoderPosition = dir;
491
         switch (axis) {
491
         switch (axis) {
492
-          case X_AXIS: { void lcd_move_x(); lcd_move_x(); } break;
493
-          #if HAS_Y_AXIS
494
-            case Y_AXIS: { void lcd_move_y(); lcd_move_y(); } break;
495
-          #endif
496
-          #if HAS_Z_AXIS
497
-            case Z_AXIS: { void lcd_move_z(); lcd_move_z(); } break;
498
-          #endif
492
+          case X_AXIS:
493
+          TERN_(HAS_Y_AXIS, case Y_AXIS:)
494
+          TERN_(HAS_Z_AXIS, case Z_AXIS:)
495
+            lcd_move_axis(axis);
499
           default: break;
496
           default: break;
500
         }
497
         }
501
       }
498
       }

+ 29
- 25
Marlin/src/module/planner.cpp Переглянути файл

2049
     #endif
2049
     #endif
2050
   #elif ENABLED(MARKFORGED_XY)
2050
   #elif ENABLED(MARKFORGED_XY)
2051
     steps_dist_mm.a      = (da - db) * mm_per_step[A_AXIS];
2051
     steps_dist_mm.a      = (da - db) * mm_per_step[A_AXIS];
2052
-    steps_dist_mm.b      = db * mm_per_step[B_AXIS];
2052
+    steps_dist_mm.b      =       db  * mm_per_step[B_AXIS];
2053
   #elif ENABLED(MARKFORGED_YX)
2053
   #elif ENABLED(MARKFORGED_YX)
2054
-    steps_dist_mm.a      = da * mm_per_step[A_AXIS];
2054
+    steps_dist_mm.a      =       da  * mm_per_step[A_AXIS];
2055
     steps_dist_mm.b      = (db - da) * mm_per_step[B_AXIS];
2055
     steps_dist_mm.b      = (db - da) * mm_per_step[B_AXIS];
2056
   #else
2056
   #else
2057
     XYZ_CODE(
2057
     XYZ_CODE(
2097
       block->millimeters = millimeters;
2097
       block->millimeters = millimeters;
2098
     else {
2098
     else {
2099
       /**
2099
       /**
2100
-       * Distance for interpretation of feedrate in accordance with LinuxCNC (the successor of NIST
2101
-       * RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode.
2102
-       * Assume that X, Y, Z are the primary linear axes and U, V, W are secondary linear axes and A, B, C are
2103
-       * rotational axes. Then dX, dY, dZ are the displacements of the primary linear axes and dU, dV, dW are the displacements of linear axes and
2104
-       * dA, dB, dC are the displacements of rotational axes.
2105
-       * The time it takes to execute move command with feedrate F is t = D/F, where D is the total distance, calculated as follows:
2100
+       * Distance for interpretation of feedrate in accordance with LinuxCNC (the successor of
2101
+       * NIST RS274NGC interpreter - version 3) and its default CANON_XYZ feed reference mode.
2102
+       *
2103
+       * Assume:
2104
+       *   - X, Y, Z are the primary linear axes;
2105
+       *   - U, V, W are secondary linear axes;
2106
+       *   - A, B, C are rotational axes.
2107
+       *
2108
+       * Then:
2109
+       *   - dX, dY, dZ are the displacements of the primary linear axes;
2110
+       *   - dU, dV, dW are the displacements of linear axes;
2111
+       *   - dA, dB, dC are the displacements of rotational axes.
2112
+       *
2113
+       * The time it takes to execute move command with feedrate F is t = D/F,
2114
+       * where D is the total distance, calculated as follows:
2106
        *   D^2 = dX^2 + dY^2 + dZ^2
2115
        *   D^2 = dX^2 + dY^2 + dZ^2
2107
        *   if D^2 == 0 (none of XYZ move but any secondary linear axes move, whether other axes are moved or not):
2116
        *   if D^2 == 0 (none of XYZ move but any secondary linear axes move, whether other axes are moved or not):
2108
        *     D^2 = dU^2 + dV^2 + dW^2
2117
        *     D^2 = dU^2 + dV^2 + dW^2
2111
        */
2120
        */
2112
       float distance_sqr = (
2121
       float distance_sqr = (
2113
         #if ENABLED(ARTICULATED_ROBOT_ARM)
2122
         #if ENABLED(ARTICULATED_ROBOT_ARM)
2114
-          // For articulated robots, interpreting feedrate like LinuxCNC would require inverse kinematics. As a workaround, pretend that motors sit on n mutually orthogonal
2115
-          // axes and assume that we could think of distance as magnitude of an n-vector in an n-dimensional Euclidian space.
2123
+          // For articulated robots, interpreting feedrate like LinuxCNC would require inverse kinematics. As a workaround,
2124
+          // assume that motors sit on a mutually-orthogonal axes and we can think of distance as magnitude of an n-vector
2125
+          // in an n-dimensional Euclidian space.
2116
           NUM_AXIS_GANG(
2126
           NUM_AXIS_GANG(
2117
               sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z),
2127
               sq(steps_dist_mm.x), + sq(steps_dist_mm.y), + sq(steps_dist_mm.z),
2118
             + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k),
2128
             + sq(steps_dist_mm.i), + sq(steps_dist_mm.j), + sq(steps_dist_mm.k),
2120
           );
2130
           );
2121
         #elif ENABLED(FOAMCUTTER_XYUV)
2131
         #elif ENABLED(FOAMCUTTER_XYUV)
2122
           #if HAS_J_AXIS
2132
           #if HAS_J_AXIS
2123
-          // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane
2124
-          _MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j))
2133
+            // Special 5 axis kinematics. Return the largest distance move from either X/Y or I/J plane
2134
+            _MAX(sq(steps_dist_mm.x) + sq(steps_dist_mm.y), sq(steps_dist_mm.i) + sq(steps_dist_mm.j))
2125
           #else // Foamcutter with only two axes (XY)
2135
           #else // Foamcutter with only two axes (XY)
2126
             sq(steps_dist_mm.x) + sq(steps_dist_mm.y)
2136
             sq(steps_dist_mm.x) + sq(steps_dist_mm.y)
2127
           #endif
2137
           #endif
2132
         #elif CORE_IS_YZ
2142
         #elif CORE_IS_YZ
2133
           XYZ_GANG(sq(steps_dist_mm.x),      + sq(steps_dist_mm.head.y), + sq(steps_dist_mm.head.z))
2143
           XYZ_GANG(sq(steps_dist_mm.x),      + sq(steps_dist_mm.head.y), + sq(steps_dist_mm.head.z))
2134
         #else
2144
         #else
2135
-          XYZ_GANG(sq(steps_dist_mm.x),       + sq(steps_dist_mm.y),      + sq(steps_dist_mm.z))
2145
+          XYZ_GANG(sq(steps_dist_mm.x),      + sq(steps_dist_mm.y),      + sq(steps_dist_mm.z))
2136
         #endif
2146
         #endif
2137
       );
2147
       );
2138
 
2148
 
2165
 
2175
 
2166
     /**
2176
     /**
2167
      * At this point at least one of the axes has more steps than
2177
      * At this point at least one of the axes has more steps than
2168
-     * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped as
2169
-     * zero-length. It's important to not apply corrections
2170
-     * to blocks that would get dropped!
2178
+     * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped
2179
+     * as zero-length. It's important to not apply corrections to blocks
2180
+     * that would get dropped!
2171
      *
2181
      *
2172
      * A correction function is permitted to add steps to an axis, it
2182
      * A correction function is permitted to add steps to an axis, it
2173
      * should *never* remove steps!
2183
      * should *never* remove steps!
2203
 
2213
 
2204
   #if ENABLED(AUTO_POWER_CONTROL)
2214
   #if ENABLED(AUTO_POWER_CONTROL)
2205
     if (NUM_AXIS_GANG(
2215
     if (NUM_AXIS_GANG(
2206
-         block->steps.x,
2207
-      || block->steps.y,
2208
-      || block->steps.z,
2209
-      || block->steps.i,
2210
-      || block->steps.j,
2211
-      || block->steps.k,
2212
-      || block->steps.u,
2213
-      || block->steps.v,
2214
-      || block->steps.w
2216
+         block->steps.x, || block->steps.y, || block->steps.z,
2217
+      || block->steps.i, || block->steps.j, || block->steps.k,
2218
+      || block->steps.u, || block->steps.v, || block->steps.w
2215
     )) powerManager.power_on();
2219
     )) powerManager.power_on();
2216
   #endif
2220
   #endif
2217
 
2221
 

+ 4
- 8
Marlin/src/module/stepper/trinamic.cpp Переглянути файл

1030
   // Using a fixed-length character array for the port name allows this to be constexpr compatible.
1030
   // Using a fixed-length character array for the port name allows this to be constexpr compatible.
1031
   struct SanityHwSerialDetails { const char port[20]; uint32_t address; };
1031
   struct SanityHwSerialDetails { const char port[20]; uint32_t address; };
1032
   #define TMC_HW_DETAIL_ARGS(A) TERN(A##_HAS_HW_SERIAL, STRINGIFY(A##_HARDWARE_SERIAL), ""), TERN0(A##_HAS_HW_SERIAL, A##_SLAVE_ADDRESS)
1032
   #define TMC_HW_DETAIL_ARGS(A) TERN(A##_HAS_HW_SERIAL, STRINGIFY(A##_HARDWARE_SERIAL), ""), TERN0(A##_HAS_HW_SERIAL, A##_SLAVE_ADDRESS)
1033
-  #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) },
1034
-  constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = {
1035
-    MAP(TMC_HW_DETAIL, ALL_AXIS_NAMES)
1036
-  };
1033
+  #define TMC_HW_DETAIL(A) { TMC_HW_DETAIL_ARGS(A) }
1034
+  constexpr SanityHwSerialDetails sanity_tmc_hw_details[] = { MAPLIST(TMC_HW_DETAIL, ALL_AXIS_NAMES) };
1037
 
1035
 
1038
   // constexpr compatible string comparison
1036
   // constexpr compatible string comparison
1039
   constexpr bool str_eq_ce(const char * a, const char * b) {
1037
   constexpr bool str_eq_ce(const char * a, const char * b) {
1057
 #if ANY_AXIS_HAS(SW_SERIAL)
1055
 #if ANY_AXIS_HAS(SW_SERIAL)
1058
   struct SanitySwSerialDetails { int32_t txpin; int32_t rxpin; uint32_t address; };
1056
   struct SanitySwSerialDetails { int32_t txpin; int32_t rxpin; uint32_t address; };
1059
   #define TMC_SW_DETAIL_ARGS(A) TERN(A##_HAS_SW_SERIAL, A##_SERIAL_TX_PIN, -1), TERN(A##_HAS_SW_SERIAL, A##_SERIAL_RX_PIN, -1), TERN0(A##_HAS_SW_SERIAL, A##_SLAVE_ADDRESS)
1057
   #define TMC_SW_DETAIL_ARGS(A) TERN(A##_HAS_SW_SERIAL, A##_SERIAL_TX_PIN, -1), TERN(A##_HAS_SW_SERIAL, A##_SERIAL_RX_PIN, -1), TERN0(A##_HAS_SW_SERIAL, A##_SLAVE_ADDRESS)
1060
-  #define TMC_SW_DETAIL(A) TMC_SW_DETAIL_ARGS(A),
1061
-  constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = {
1062
-    MAP(TMC_SW_DETAIL, ALL_AXIS_NAMES)
1063
-  };
1058
+  #define TMC_SW_DETAIL(A) { TMC_SW_DETAIL_ARGS(A) }
1059
+  constexpr SanitySwSerialDetails sanity_tmc_sw_details[] = { MAPLIST(TMC_SW_DETAIL, ALL_AXIS_NAMES) };
1064
 
1060
 
1065
   constexpr bool sc_sw_done(size_t start, size_t end) { return start == end; }
1061
   constexpr bool sc_sw_done(size_t start, size_t end) { return start == end; }
1066
   constexpr bool sc_sw_skip(int32_t txpin) { return txpin < 0; }
1062
   constexpr bool sc_sw_skip(int32_t txpin) { return txpin < 0; }

Завантаження…
Відмінити
Зберегти