浏览代码

Miscellaneous cleanup

Scott Lahteine 7 年前
父节点
当前提交
50f09cc029

+ 19
- 32
Marlin/src/feature/Max7219_Debug_LEDs.cpp 查看文件

63
 
63
 
64
 static uint8_t LEDs[8] = { 0 };
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
 void Max7219_PutByte(uint8_t data) {
72
 void Max7219_PutByte(uint8_t data) {
67
   CRITICAL_SECTION_START
73
   CRITICAL_SECTION_START
68
   for (uint8_t i = 8; i--;) {
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
     data <<= 1;
82
     data <<= 1;
84
   }
83
   }
85
   CRITICAL_SECTION_END
84
   CRITICAL_SECTION_END
86
 }
85
 }
87
 
86
 
88
 void Max7219(const uint8_t reg, const uint8_t data) {
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
   CRITICAL_SECTION_START
89
   CRITICAL_SECTION_START
93
   WRITE(MAX7219_LOAD_PIN, LOW);  // begin
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
   Max7219_PutByte(reg);          // specify register
92
   Max7219_PutByte(reg);          // specify register
98
-  #ifdef CPU_32_BIT
99
-    delayMicroseconds(5);
100
-  #endif
93
+  MS_DELAY();
101
   Max7219_PutByte(data);         // put data
94
   Max7219_PutByte(data);         // put data
102
-  #ifdef CPU_32_BIT
103
-    delayMicroseconds(5);
104
-  #endif
95
+  MS_DELAY();
105
   WRITE(MAX7219_LOAD_PIN, LOW);  // and tell the chip to load the data
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
   WRITE(MAX7219_LOAD_PIN, HIGH);
98
   WRITE(MAX7219_LOAD_PIN, HIGH);
110
   CRITICAL_SECTION_END
99
   CRITICAL_SECTION_END
111
-  #ifdef CPU_32_BIT
112
-    delayMicroseconds(5);
113
-  #endif
100
+  MS_DELAY();
114
 }
101
 }
115
 
102
 
116
 void Max7219_LED_Set(const uint8_t row, const uint8_t col, const bool on) {
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 查看文件

43
       set_home_offset((AxisEnum)i, parser.value_linear_units());
43
       set_home_offset((AxisEnum)i, parser.value_linear_units());
44
 
44
 
45
   #if ENABLED(MORGAN_SCARA)
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
   #endif
48
   #endif
49
 
49
 
50
   report_current_position();
50
   report_current_position();

+ 2
- 2
Marlin/src/gcode/motion/M290.cpp 查看文件

36
   #if ENABLED(BABYSTEP_XY)
36
   #if ENABLED(BABYSTEP_XY)
37
     for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
37
     for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
38
       if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
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
         #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
40
         #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
41
           if (a == Z_AXIS) {
41
           if (a == Z_AXIS) {
42
             zprobe_zoffset += offs;
42
             zprobe_zoffset += offs;
43
             refresh_zprobe_zoffset(true); // 'true' to not babystep
43
             refresh_zprobe_zoffset(true); // 'true' to not babystep
44
           }
44
           }
45
         #endif
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
   #else
48
   #else
49
     if (parser.seenval('Z') || parser.seenval('S')) {
49
     if (parser.seenval('Z') || parser.seenval('S')) {

+ 1
- 2
Marlin/src/module/planner.cpp 查看文件

542
 }
542
 }
543
 
543
 
544
 inline float calculate_volumetric_multiplier(const float &diameter) {
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
 void Planner::calculate_volumetric_multipliers() {
548
 void Planner::calculate_volumetric_multipliers() {

正在加载...
取消
保存