Explorar el Código

Miscellaneous cleanup

Scott Lahteine hace 7 años
padre
commit
50f09cc029

+ 19
- 32
Marlin/src/feature/Max7219_Debug_LEDs.cpp Ver fichero

@@ -63,54 +63,41 @@
63 63
 
64 64
 static uint8_t LEDs[8] = { 0 };
65 65
 
66
+#ifdef CPU_32_BIT
67
+  #define MS_DELAY() delayMicroseconds(5)  // 32-bit processors need a delay to stabilize the signal
68
+#else
69
+  #define MS_DELAY() NOOP
70
+#endif
71
+
66 72
 void Max7219_PutByte(uint8_t data) {
67 73
   CRITICAL_SECTION_START
68 74
   for (uint8_t i = 8; i--;) {
69
-    #ifdef CPU_32_BIT                    // The 32-bit processors are so fast, a small delay in the code is needed
70
-      delayMicroseconds(5);              // to let the signal wires stabilize.
71
-      WRITE(MAX7219_CLK_PIN, LOW);       // tick
72
-      delayMicroseconds(5);
73
-      WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW);  // send 1 or 0 based on data bit
74
-      delayMicroseconds(5);
75
-      WRITE(MAX7219_CLK_PIN, HIGH);      // tock
76
-      delayMicroseconds(5);
77
-    #else
78
-      WRITE(MAX7219_CLK_PIN, LOW);       // tick
79
-      WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW);  // send 1 or 0 based on data bit
80
-      WRITE(MAX7219_CLK_PIN, HIGH);      // tock
81
-    #endif
82
-
75
+    MS_DELAY();
76
+    WRITE(MAX7219_CLK_PIN, LOW);       // tick
77
+    MS_DELAY();
78
+    WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW);  // send 1 or 0 based on data bit
79
+    MS_DELAY();
80
+    WRITE(MAX7219_CLK_PIN, HIGH);      // tock
81
+    MS_DELAY();
83 82
     data <<= 1;
84 83
   }
85 84
   CRITICAL_SECTION_END
86 85
 }
87 86
 
88 87
 void Max7219(const uint8_t reg, const uint8_t data) {
89
-  #ifdef CPU_32_BIT
90
-    delayMicroseconds(5);
91
-  #endif
88
+  MS_DELAY();
92 89
   CRITICAL_SECTION_START
93 90
   WRITE(MAX7219_LOAD_PIN, LOW);  // begin
94
-  #ifdef CPU_32_BIT              // The 32-bit processors are so fast, a small delay in the code is needed
95
-    delayMicroseconds(5);        // to let the signal wires stabilize.
96
-  #endif
91
+  MS_DELAY();
97 92
   Max7219_PutByte(reg);          // specify register
98
-  #ifdef CPU_32_BIT
99
-    delayMicroseconds(5);
100
-  #endif
93
+  MS_DELAY();
101 94
   Max7219_PutByte(data);         // put data
102
-  #ifdef CPU_32_BIT
103
-    delayMicroseconds(5);
104
-  #endif
95
+  MS_DELAY();
105 96
   WRITE(MAX7219_LOAD_PIN, LOW);  // and tell the chip to load the data
106
-  #ifdef CPU_32_BIT
107
-    delayMicroseconds(5);
108
-  #endif
97
+  MS_DELAY();
109 98
   WRITE(MAX7219_LOAD_PIN, HIGH);
110 99
   CRITICAL_SECTION_END
111
-  #ifdef CPU_32_BIT
112
-    delayMicroseconds(5);
113
-  #endif
100
+  MS_DELAY();
114 101
 }
115 102
 
116 103
 void Max7219_LED_Set(const uint8_t row, const uint8_t col, const bool on) {

+ 2
- 2
Marlin/src/gcode/geometry/M206_M428.cpp Ver fichero

@@ -43,8 +43,8 @@ void GcodeSuite::M206() {
43 43
       set_home_offset((AxisEnum)i, parser.value_linear_units());
44 44
 
45 45
   #if ENABLED(MORGAN_SCARA)
46
-    if (parser.seen('T')) set_home_offset(A_AXIS, parser.value_linear_units()); // Theta
47
-    if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_linear_units()); // Psi
46
+    if (parser.seen('T')) set_home_offset(A_AXIS, parser.value_float()); // Theta
47
+    if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
48 48
   #endif
49 49
 
50 50
   report_current_position();

+ 2
- 2
Marlin/src/gcode/motion/M290.cpp Ver fichero

@@ -36,14 +36,14 @@ void GcodeSuite::M290() {
36 36
   #if ENABLED(BABYSTEP_XY)
37 37
     for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
38 38
       if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
39
-        const float offs = constrain(parser.value_axis_units(a), -2, 2);
39
+        const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
40 40
         #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
41 41
           if (a == Z_AXIS) {
42 42
             zprobe_zoffset += offs;
43 43
             refresh_zprobe_zoffset(true); // 'true' to not babystep
44 44
           }
45 45
         #endif
46
-        thermalManager.babystep_axis(a, offs * planner.axis_steps_per_mm[a]);
46
+        thermalManager.babystep_axis((AxisEnum)a, offs * planner.axis_steps_per_mm[a]);
47 47
       }
48 48
   #else
49 49
     if (parser.seenval('Z') || parser.seenval('S')) {

+ 1
- 2
Marlin/src/module/planner.cpp Ver fichero

@@ -542,8 +542,7 @@ void Planner::check_axes_activity() {
542 542
 }
543 543
 
544 544
 inline float calculate_volumetric_multiplier(const float &diameter) {
545
-  if (!parser.volumetric_enabled || diameter == 0) return 1.0;
546
-  return 1.0 / CIRCLE_AREA(diameter * 0.5);
545
+  return (parser.volumetric_enabled && diameter) ? 1.0 / CIRCLE_AREA(diameter * 0.5) : 1.0;
547 546
 }
548 547
 
549 548
 void Planner::calculate_volumetric_multipliers() {

Loading…
Cancelar
Guardar