Browse Source

Fix Baby Stepping on 32-Bit platforms (#8001)

Also, Max7219 debug code was used for this effort.   It has been
improved and hardened.
Roxy-3D 7 years ago
parent
commit
6cb26c98c8

+ 7
- 16
Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h View File

125
 
125
 
126
 // Optional custom name for your RepStrap or other custom machine
126
 // Optional custom name for your RepStrap or other custom machine
127
 // Displayed in the LCD "Ready" message
127
 // Displayed in the LCD "Ready" message
128
-#define CUSTOM_MACHINE_NAME "FT-2020 v2"
128
+#define CUSTOM_MACHINE_NAME "FT-2020 v3"
129
 
129
 
130
 // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
130
 // Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
131
 // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
131
 // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
691
 
691
 
692
 // X and Y axis travel speed (mm/m) between probes
692
 // X and Y axis travel speed (mm/m) between probes
693
 #define XY_PROBE_SPEED 7500
693
 #define XY_PROBE_SPEED 7500
694
+
694
 // Speed for the first approach when double-probing (with PROBE_DOUBLE_TOUCH)
695
 // Speed for the first approach when double-probing (with PROBE_DOUBLE_TOUCH)
695
 #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
696
 #define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z
696
 
697
 
750
 #define INVERT_X_DIR false
751
 #define INVERT_X_DIR false
751
 #define INVERT_Y_DIR true
752
 #define INVERT_Y_DIR true
752
 #define INVERT_Z_DIR true
753
 #define INVERT_Z_DIR true
754
+
753
 // Enable this option for Toshiba stepper drivers
755
 // Enable this option for Toshiba stepper drivers
754
 //#define CONFIG_STEPPERS_TOSHIBA
756
 //#define CONFIG_STEPPERS_TOSHIBA
755
 
757
 
789
 #define Y_MAX_POS 182
791
 #define Y_MAX_POS 182
790
 #define Z_MAX_POS 175
792
 #define Z_MAX_POS 175
791
 
793
 
792
-/**
793
- * Software Endstops
794
- *
795
- * - Prevent moves outside the set machine bounds.
796
- * - Individual axes can be disabled, if desired.
797
- * - X and Y only apply to Cartesian robots.
798
- * - Use 'M211' to set software endstops on/off or report current state
799
- */
800
-
801
-// Min software endstops curtail movement below minimum coordinate bounds
794
+// If enabled, axes won't move below MIN_POS in response to movement commands.
802
 //#define MIN_SOFTWARE_ENDSTOPS
795
 //#define MIN_SOFTWARE_ENDSTOPS
803
 #if ENABLED(MIN_SOFTWARE_ENDSTOPS)
796
 #if ENABLED(MIN_SOFTWARE_ENDSTOPS)
804
   #define MIN_SOFTWARE_ENDSTOP_X
797
   #define MIN_SOFTWARE_ENDSTOP_X
806
   #define MIN_SOFTWARE_ENDSTOP_Z
799
   #define MIN_SOFTWARE_ENDSTOP_Z
807
 #endif
800
 #endif
808
 
801
 
809
-// Max software endstops curtail movement above maximum coordinate bounds
802
+// If enabled, axes won't move above MAX_POS in response to movement commands.
810
 #define MAX_SOFTWARE_ENDSTOPS
803
 #define MAX_SOFTWARE_ENDSTOPS
811
 #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
804
 #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
812
   #define MAX_SOFTWARE_ENDSTOP_X
805
   #define MAX_SOFTWARE_ENDSTOP_X
939
   #define ABL_PROBE_PT_3_X 170
932
   #define ABL_PROBE_PT_3_X 170
940
   #define ABL_PROBE_PT_3_Y 10
933
   #define ABL_PROBE_PT_3_Y 10
941
 
934
 
942
-
943
-
944
 #elif ENABLED(AUTO_BED_LEVELING_UBL)
935
 #elif ENABLED(AUTO_BED_LEVELING_UBL)
945
 
936
 
946
   //===========================================================================
937
   //===========================================================================
1681
 // leaving it undefined or defining as 0 will disable the servo subsystem
1672
 // leaving it undefined or defining as 0 will disable the servo subsystem
1682
 // If unsure, leave commented / disabled
1673
 // If unsure, leave commented / disabled
1683
 //
1674
 //
1684
-#define NUM_SERVOS 2 // Servo index starts with 0 for M280 command
1675
+#define NUM_SERVOS 1 // Servo index starts with 0 for M280 command
1685
 
1676
 
1686
 // Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
1677
 // Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle.
1687
 // 300ms is a good value but you can try less delay.
1678
 // 300ms is a good value but you can try less delay.
1688
 // If the servo can't reach the requested position, increase it.
1679
 // If the servo can't reach the requested position, increase it.
1689
-#define SERVO_DELAY { 500, 500 }
1680
+#define SERVO_DELAY { 500 }
1690
 
1681
 
1691
 // Servo deactivation
1682
 // Servo deactivation
1692
 //
1683
 //

+ 13
- 7
Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h View File

534
   #endif
534
   #endif
535
 
535
 
536
   // Show a progress bar on HD44780 LCDs for SD printing
536
   // Show a progress bar on HD44780 LCDs for SD printing
537
-  #define LCD_PROGRESS_BAR
537
+  //#define LCD_PROGRESS_BAR
538
 
538
 
539
   #if ENABLED(LCD_PROGRESS_BAR)
539
   #if ENABLED(LCD_PROGRESS_BAR)
540
     // Amount of time (ms) to show the bar
540
     // Amount of time (ms) to show the bar
592
   // Enable this option and reduce the value to optimize screen updates.
592
   // Enable this option and reduce the value to optimize screen updates.
593
   // The normal delay is 10µs. Use the lowest value that still gives a reliable display.
593
   // The normal delay is 10µs. Use the lowest value that still gives a reliable display.
594
   //#define DOGM_SPI_DELAY_US 5
594
   //#define DOGM_SPI_DELAY_US 5
595
+
595
 #endif // DOGLCD
596
 #endif // DOGLCD
596
 
597
 
597
 // @section safety
598
 // @section safety
620
 #if ENABLED(BABYSTEPPING)
621
 #if ENABLED(BABYSTEPPING)
621
   //#define BABYSTEP_XY              // Also enable X/Y Babystepping. Not supported on DELTA!
622
   //#define BABYSTEP_XY              // Also enable X/Y Babystepping. Not supported on DELTA!
622
   #define BABYSTEP_INVERT_Z false    // Change if Z babysteps should go the other way
623
   #define BABYSTEP_INVERT_Z false    // Change if Z babysteps should go the other way
623
-  #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion.
624
+  #define BABYSTEP_MULTIPLICATOR 16  // Babysteps are very small. Increase for faster motion.
624
   //#define BABYSTEP_ZPROBE_OFFSET   // Enable to combine M851 and Babystepping
625
   //#define BABYSTEP_ZPROBE_OFFSET   // Enable to combine M851 and Babystepping
625
   #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
626
   #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
626
   #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
627
   #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
1313
   #define USER_DESC_4 "Heat Bed/Home/Level"
1314
   #define USER_DESC_4 "Heat Bed/Home/Level"
1314
   #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
1315
   #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
1315
 
1316
 
1316
-  //#define USER_DESC_5 "Home & Info"
1317
-  //#define USER_GCODE_5 "G28\nM503"
1317
+  #define USER_DESC_5 "Home & Info"
1318
+  #define USER_GCODE_5 "G28\nM503"
1318
 #endif
1319
 #endif
1319
 
1320
 
1320
 /**
1321
 /**
1423
 //#define MAX7219_DIN_PIN   57  // on RAMPS
1424
 //#define MAX7219_DIN_PIN   57  // on RAMPS
1424
 //#define MAX7219_LOAD_PIN  44  // on RAMPS
1425
 //#define MAX7219_LOAD_PIN  44  // on RAMPS
1425
 
1426
 
1426
-  #define MAX7219_CLK_PIN   77 // on Re-ARM       // Configuration of the 3 pins to control the display
1427
-  #define MAX7219_DIN_PIN   78 // on Re-ARM
1428
-  #define MAX7219_LOAD_PIN  79 // on Re-ARM
1427
+//#define MAX7219_CLK_PIN   77 // on Re-ARM       // Configuration of the 3 pins to control the display
1428
+//#define MAX7219_DIN_PIN   78 // on Re-ARM
1429
+//#define MAX7219_LOAD_PIN  79 // on Re-ARM
1430
+
1431
+  #define MAX7219_CLK_PIN   30 // for RAMPS E1     // Configuration of the 3 pins to control the display
1432
+  #define MAX7219_DIN_PIN   34 // for RAMPS E1
1433
+  #define MAX7219_LOAD_PIN  36 // for RAMPS E1
1429
 
1434
 
1430
   /**
1435
   /**
1431
    * Sample debug features
1436
    * Sample debug features
1432
    * If you add more debug displays, be careful to avoid conflicts!
1437
    * If you add more debug displays, be careful to avoid conflicts!
1433
    */
1438
    */
1434
   #define MAX7219_DEBUG_PRINTER_ALIVE    // Blink corner LED of 8x8 matrix to show that the firmware is functioning
1439
   #define MAX7219_DEBUG_PRINTER_ALIVE    // Blink corner LED of 8x8 matrix to show that the firmware is functioning
1440
+
1435
   #define MAX7219_DEBUG_STEPPER_HEAD  3  // Show the stepper queue head position on this and the next LED matrix row
1441
   #define MAX7219_DEBUG_STEPPER_HEAD  3  // Show the stepper queue head position on this and the next LED matrix row
1436
   #define MAX7219_DEBUG_STEPPER_TAIL  5  // Show the stepper queue tail position on this and the next LED matrix row
1442
   #define MAX7219_DEBUG_STEPPER_TAIL  5  // Show the stepper queue tail position on this and the next LED matrix row
1437
 
1443
 

+ 170
- 35
Marlin/src/feature/Max7219_Debug_LEDs.cpp View File

39
  * void Max7219_init();
39
  * void Max7219_init();
40
  * void Max7219_PutByte(uint8_t data);
40
  * void Max7219_PutByte(uint8_t data);
41
  * void Max7219(uint8_t reg, uint8_t data);
41
  * void Max7219(uint8_t reg, uint8_t data);
42
- * void Max7219_LED_On(uint8_t row, uint8_t col);
43
- * void Max7219_LED_Off(uint8_t row, uint8_t col);
44
- * void Max7219_LED_Toggle(uint8_t row, uint8_t col);
42
+ * void Max7219_LED_On(uint8_t col, uint8_t row);
43
+ * void Max7219_LED_Off(uint8_t col, uint8_t row);
44
+ * void Max7219_LED_Toggle(uint8_t col, uint8_t row);
45
  * void Max7219_Clear_Row(uint8_t row);
45
  * void Max7219_Clear_Row(uint8_t row);
46
  * void Max7219_Clear_Column(uint8_t col);
46
  * void Max7219_Clear_Column(uint8_t col);
47
  * void Max7219_Set_Row(uint8_t row, uint8_t val);
47
  * void Max7219_Set_Row(uint8_t row, uint8_t val);
48
+ * void Max7219_Set_2_Rows(uint8_t row, uint16_t val);
49
+ * void Max7219_Set_4_Rows(uint8_t row, uint32_t val);
48
  * void Max7219_Set_Column(uint8_t col, uint8_t val);
50
  * void Max7219_Set_Column(uint8_t col, uint8_t val);
49
  * void Max7219_idle_tasks();
51
  * void Max7219_idle_tasks();
50
  */
52
  */
62
 static uint8_t LEDs[8] = { 0 };
64
 static uint8_t LEDs[8] = { 0 };
63
 
65
 
64
 void Max7219_PutByte(uint8_t data) {
66
 void Max7219_PutByte(uint8_t data) {
67
+  CRITICAL_SECTION_START
65
   for (uint8_t i = 8; i--;) {
68
   for (uint8_t i = 8; i--;) {
66
     #ifdef CPU_32_BIT                    // The 32-bit processors are so fast, a small delay in the code is needed
69
     #ifdef CPU_32_BIT                    // The 32-bit processors are so fast, a small delay in the code is needed
67
-                                         // to let the signal wires stabilize.
70
+      delayMicroseconds(5);              // to let the signal wires stabilize.
68
       WRITE(MAX7219_CLK_PIN, LOW);       // tick
71
       WRITE(MAX7219_CLK_PIN, LOW);       // tick
69
       delayMicroseconds(5);
72
       delayMicroseconds(5);
70
       WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW);  // send 1 or 0 based on data bit
73
       WRITE(MAX7219_DIN_PIN, (data & 0x80) ? HIGH : LOW);  // send 1 or 0 based on data bit
79
 
82
 
80
     data <<= 1;
83
     data <<= 1;
81
   }
84
   }
85
+  CRITICAL_SECTION_END
82
 }
86
 }
83
 
87
 
84
 void Max7219(const uint8_t reg, const uint8_t data) {
88
 void Max7219(const uint8_t reg, const uint8_t data) {
89
+  #ifdef CPU_32_BIT
90
+    delayMicroseconds(5);
91
+  #endif
92
+  CRITICAL_SECTION_START
85
   WRITE(MAX7219_LOAD_PIN, LOW);  // begin
93
   WRITE(MAX7219_LOAD_PIN, LOW);  // begin
86
   #ifdef CPU_32_BIT              // The 32-bit processors are so fast, a small delay in the code is needed
94
   #ifdef CPU_32_BIT              // The 32-bit processors are so fast, a small delay in the code is needed
87
     delayMicroseconds(5);        // to let the signal wires stabilize.
95
     delayMicroseconds(5);        // to let the signal wires stabilize.
88
   #endif
96
   #endif
89
   Max7219_PutByte(reg);          // specify register
97
   Max7219_PutByte(reg);          // specify register
98
+  #ifdef CPU_32_BIT
99
+    delayMicroseconds(5);
100
+  #endif
90
   Max7219_PutByte(data);         // put data
101
   Max7219_PutByte(data);         // put data
91
   #ifdef CPU_32_BIT
102
   #ifdef CPU_32_BIT
92
     delayMicroseconds(5);
103
     delayMicroseconds(5);
96
     delayMicroseconds(5);
107
     delayMicroseconds(5);
97
   #endif
108
   #endif
98
   WRITE(MAX7219_LOAD_PIN, HIGH);
109
   WRITE(MAX7219_LOAD_PIN, HIGH);
110
+  CRITICAL_SECTION_END
111
+  #ifdef CPU_32_BIT
112
+    delayMicroseconds(5);
113
+  #endif
99
 }
114
 }
100
 
115
 
101
 void Max7219_LED_Set(const uint8_t row, const uint8_t col, const bool on) {
116
 void Max7219_LED_Set(const uint8_t row, const uint8_t col, const bool on) {
102
-  if (row > 7 || col > 7) return;
117
+  if (row > 7 || col > 7) {
118
+    int r,c;
119
+    r = row;
120
+    c = col;
121
+    SERIAL_ECHOPAIR("??? Max7219_LED_Set(",r);
122
+    SERIAL_ECHOPAIR(",",c);
123
+    SERIAL_ECHO(")\n");
124
+    return;
125
+  }
103
   if (TEST(LEDs[row], col) == on) return; // if LED is already on/off, leave alone
126
   if (TEST(LEDs[row], col) == on) return; // if LED is already on/off, leave alone
104
   if (on) SBI(LEDs[row], col); else CBI(LEDs[row], col);
127
   if (on) SBI(LEDs[row], col); else CBI(LEDs[row], col);
105
   Max7219(8 - row, LEDs[row]);
128
   Max7219(8 - row, LEDs[row]);
106
 }
129
 }
107
 
130
 
108
-void Max7219_LED_On(const uint8_t row, const uint8_t col) {
109
-  Max7219_LED_Set(row, col, true);
131
+void Max7219_LED_On(const uint8_t col, const uint8_t row) {
132
+  if (row > 7 || col > 7) {
133
+    int r,c;
134
+    r = row;
135
+    c = col;
136
+    SERIAL_ECHOPAIR("??? Max7219_LED_On(",c);
137
+    SERIAL_ECHOPAIR(",",r);
138
+    SERIAL_ECHO(")\n");
139
+    return;
140
+  }
141
+  Max7219_LED_Set(col, row, true);
110
 }
142
 }
111
 
143
 
112
-void Max7219_LED_Off(const uint8_t row, const uint8_t col) {
113
-  Max7219_LED_Set(row, col, false);
144
+void Max7219_LED_Off(const uint8_t col, const uint8_t row) {
145
+  if (row > 7 || col > 7) {
146
+    int r,c;
147
+    r = row;
148
+    c = col;
149
+    SERIAL_ECHOPAIR("??? Max7219_LED_Off(",r);
150
+    SERIAL_ECHOPAIR(",",c);
151
+    SERIAL_ECHO(")\n");
152
+    return;
153
+  }
154
+  Max7219_LED_Set(col, row, false);
114
 }
155
 }
115
 
156
 
116
-void Max7219_LED_Toggle(const uint8_t row, const uint8_t col) {
117
-  if (row > 7 || col > 7) return;
157
+void Max7219_LED_Toggle(const uint8_t col, const uint8_t row) {
158
+  if (row > 7 || col > 7) {
159
+    int r,c;
160
+    r = row;
161
+    c = col;
162
+    SERIAL_ECHOPAIR("??? Max7219_LED_Toggle(",r);
163
+    SERIAL_ECHOPAIR(",",c);
164
+    SERIAL_ECHO(")\n");
165
+    return;
166
+  }
118
   if (TEST(LEDs[row], col))
167
   if (TEST(LEDs[row], col))
119
-    Max7219_LED_Off(row, col);
168
+    Max7219_LED_Off(col, row);
120
   else
169
   else
121
-    Max7219_LED_On(row, col);
170
+    Max7219_LED_On(col, row);
122
 }
171
 }
123
 
172
 
124
 void Max7219_Clear_Column(const uint8_t col) {
173
 void Max7219_Clear_Column(const uint8_t col) {
125
-  if (col > 7) return;
174
+  if (col > 7) {
175
+    int c;
176
+    c = col;
177
+    SERIAL_ECHOPAIR("??? Max7219_Clear_Column(",c);
178
+    SERIAL_ECHO(")\n");
179
+    return;
180
+  }
126
   LEDs[col] = 0;
181
   LEDs[col] = 0;
127
   Max7219(8 - col, LEDs[col]);
182
   Max7219(8 - col, LEDs[col]);
128
 }
183
 }
129
 
184
 
130
 void Max7219_Clear_Row(const uint8_t row) {
185
 void Max7219_Clear_Row(const uint8_t row) {
131
-  if (row > 7) return;
186
+  if (row > 7) {
187
+    int r;
188
+    r = row;
189
+    SERIAL_ECHOPAIR("??? Max7219_Clear_Row(",r);
190
+    SERIAL_ECHO(")\n");
191
+    return;
192
+  }
132
   for (uint8_t c = 0; c <= 7; c++)
193
   for (uint8_t c = 0; c <= 7; c++)
133
     Max7219_LED_Off(c, row);
194
     Max7219_LED_Off(c, row);
134
 }
195
 }
135
 
196
 
136
 void Max7219_Set_Row(const uint8_t row, const uint8_t val) {
197
 void Max7219_Set_Row(const uint8_t row, const uint8_t val) {
137
-  if (row > 7) return;
198
+  if (row > 7 || val>255) {
199
+    int r, v;
200
+    r = row;
201
+    v = val;
202
+    SERIAL_ECHOPAIR("??? Max7219_Set_Row(",r);
203
+    SERIAL_ECHOPAIR(",",v);
204
+    SERIAL_ECHO(")\n");
205
+    return;
206
+  }
138
   for (uint8_t b = 0; b <= 7; b++)
207
   for (uint8_t b = 0; b <= 7; b++)
139
     if (TEST(val, b))
208
     if (TEST(val, b))
140
       Max7219_LED_On(7 - b, row);
209
       Max7219_LED_On(7 - b, row);
142
       Max7219_LED_Off(7 - b, row);
211
       Max7219_LED_Off(7 - b, row);
143
 }
212
 }
144
 
213
 
214
+void Max7219_Set_2_Rows(const uint8_t row, const uint16_t val) {
215
+  if (row > 6 || val>65535) {
216
+    int r, v;
217
+    r = row;
218
+    v = val;
219
+    SERIAL_ECHOPAIR("??? Max7219_Set_2_Rows(",r);
220
+    SERIAL_ECHOPAIR(",",v);
221
+    SERIAL_ECHO(")\n");
222
+    return;
223
+  }
224
+  Max7219_Set_Row(row+1, (val & 0xff00) >> 8 );
225
+  Max7219_Set_Row(row+0, (val & 0xff));
226
+}
227
+
228
+void Max7219_Set_4_Rows(const uint8_t row, const uint32_t val) {
229
+  if (row > 4 ) {
230
+    int r;
231
+    long v;
232
+    r = row;
233
+    v = val;
234
+    SERIAL_ECHOPAIR("??? Max7219_Set_4_Rows(",r);
235
+    SERIAL_ECHOPAIR(",",v);
236
+    SERIAL_ECHO(")\n");
237
+    return;
238
+  }
239
+  Max7219_Set_Row(row+3, (val & 0xff000000) >> 24);
240
+  Max7219_Set_Row(row+2, (val & 0xff0000) >> 16);
241
+  Max7219_Set_Row(row+1, (val & 0xff00) >> 8);
242
+  Max7219_Set_Row(row+0, (val & 0xff));
243
+}
244
+
145
 void Max7219_Set_Column(const uint8_t col, const uint8_t val) {
245
 void Max7219_Set_Column(const uint8_t col, const uint8_t val) {
146
-  if (col > 7) return;
246
+  if (val > 255 || col > 7) {
247
+    int v,c;
248
+    v = val;
249
+    c = col;
250
+    SERIAL_ECHOPAIR("??? Max7219_Column(",c);
251
+    SERIAL_ECHOPAIR(",",v);
252
+    SERIAL_ECHO(")\n");
253
+    return;
254
+  }
147
   LEDs[col] = val;
255
   LEDs[col] = val;
148
   Max7219(8 - col, LEDs[col]);
256
   Max7219(8 - col, LEDs[col]);
149
 }
257
 }
206
 * or clear a row is not very significant.
314
 * or clear a row is not very significant.
207
 */
315
 */
208
 void Max7219_idle_tasks() {
316
 void Max7219_idle_tasks() {
317
+#if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
318
+  CRITICAL_SECTION_START
319
+  #if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_QUEUE
320
+    uint8_t head;
321
+    head = planner.block_buffer_head;
322
+  #endif
323
+  #if MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
324
+    uint8_t tail;
325
+    tail = planner.block_buffer_tail;
326
+  #endif
327
+  CRITICAL_SECTION_END
328
+#endif
329
+
209
   #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE)
330
   #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE)
210
     static int debug_cnt = 0;
331
     static int debug_cnt = 0;
211
-    #ifdef CPU_32_BIT  
212
-      if (debug_cnt++ > 400) {
332
+    #ifdef CPU_32_BIT
333
+      if (debug_cnt++ > 1000) {
213
     #else
334
     #else
214
       if (debug_cnt++ > 100) {
335
       if (debug_cnt++ > 100) {
215
     #endif
336
     #endif
219
   #endif
340
   #endif
220
 
341
 
221
   #ifdef MAX7219_DEBUG_STEPPER_HEAD
342
   #ifdef MAX7219_DEBUG_STEPPER_HEAD
222
-    Max7219_Clear_Row(MAX7219_DEBUG_STEPPER_HEAD);
223
-    Max7219_Clear_Row(MAX7219_DEBUG_STEPPER_HEAD + 1);
224
-    if ( planner.block_buffer_head < 8)
225
-      Max7219_LED_On( planner.block_buffer_head, MAX7219_DEBUG_STEPPER_HEAD);
226
-    else
227
-      Max7219_LED_On( planner.block_buffer_head-8, MAX7219_DEBUG_STEPPER_HEAD+1);
343
+    static int16_t last_head_cnt=0;
344
+    if (last_head_cnt != head) {
345
+      if ( last_head_cnt < 8)
346
+        Max7219_LED_Off( last_head_cnt, MAX7219_DEBUG_STEPPER_HEAD);
347
+      else
348
+        Max7219_LED_Off( last_head_cnt-8, MAX7219_DEBUG_STEPPER_HEAD+1);
349
+
350
+      last_head_cnt = head;
351
+      if ( head < 8)
352
+        Max7219_LED_On(head, MAX7219_DEBUG_STEPPER_HEAD);
353
+      else
354
+        Max7219_LED_On(head-8, MAX7219_DEBUG_STEPPER_HEAD+1);
355
+    }
228
   #endif
356
   #endif
229
 
357
 
230
   #ifdef MAX7219_DEBUG_STEPPER_TAIL
358
   #ifdef MAX7219_DEBUG_STEPPER_TAIL
231
-    Max7219_Clear_Row(MAX7219_DEBUG_STEPPER_TAIL);
232
-    Max7219_Clear_Row(MAX7219_DEBUG_STEPPER_TAIL + 1);
233
-    if ( planner.block_buffer_tail < 8)
234
-      Max7219_LED_On( planner.block_buffer_tail, MAX7219_DEBUG_STEPPER_TAIL );
235
-    else
236
-      Max7219_LED_On( planner.block_buffer_tail-8, MAX7219_DEBUG_STEPPER_TAIL+1 );
359
+    static int16_t last_tail_cnt=0;
360
+    if (last_tail_cnt != tail) {
361
+      if ( last_tail_cnt < 8)
362
+        Max7219_LED_Off( last_tail_cnt, MAX7219_DEBUG_STEPPER_TAIL);
363
+      else
364
+        Max7219_LED_Off( last_tail_cnt-8, MAX7219_DEBUG_STEPPER_TAIL+1);
365
+
366
+      last_tail_cnt = tail;
367
+      if ( tail < 8)
368
+        Max7219_LED_On(tail, MAX7219_DEBUG_STEPPER_TAIL);
369
+      else
370
+        Max7219_LED_On(tail-8, MAX7219_DEBUG_STEPPER_TAIL+1);
371
+    }
237
   #endif
372
   #endif
238
 
373
 
239
   #ifdef MAX7219_DEBUG_STEPPER_QUEUE
374
   #ifdef MAX7219_DEBUG_STEPPER_QUEUE
240
     static int16_t last_depth = 0;
375
     static int16_t last_depth = 0;
241
-    int16_t current_depth = planner.block_buffer_head - planner.block_buffer_tail;
376
+    int16_t current_depth = head - tail;
242
     if (current_depth != last_depth) {  // usually, no update will be needed.
377
     if (current_depth != last_depth) {  // usually, no update will be needed.
243
       if (current_depth < 0) current_depth += BLOCK_BUFFER_SIZE;
378
       if (current_depth < 0) current_depth += BLOCK_BUFFER_SIZE;
244
       NOMORE(current_depth, BLOCK_BUFFER_SIZE);
379
       NOMORE(current_depth, BLOCK_BUFFER_SIZE);
249
                     en = max(current_depth, last_depth);
384
                     en = max(current_depth, last_depth);
250
       if (current_depth < last_depth)
385
       if (current_depth < last_depth)
251
         for (uint8_t i = st; i <= en; i++)   // clear the highest order LEDs
386
         for (uint8_t i = st; i <= en; i++)   // clear the highest order LEDs
252
-          Max7219_LED_Off(i >> 1, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1));
387
+            Max7219_LED_Off(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1));
253
       else
388
       else
254
-        for (uint8_t i = st; i <= en; i++)   // set the highest order LEDs
255
-          Max7219_LED_On(i >> 1, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1));
389
+          for (uint8_t i = st; i <= en; i++)   // set the LEDs to current depth
390
+            Max7219_LED_On(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1));
256
 
391
 
257
       last_depth = current_depth;
392
       last_depth = current_depth;
258
     }
393
     }

+ 4
- 2
Marlin/src/feature/Max7219_Debug_LEDs.h View File

40
  * void Max7219_PutByte(uint8_t data);
40
  * void Max7219_PutByte(uint8_t data);
41
  * void Max7219(uint8_t reg, uint8_t data);
41
  * void Max7219(uint8_t reg, uint8_t data);
42
  * void Max7219_LED_Set(uint8_t row, uint8_t col, bool on);
42
  * void Max7219_LED_Set(uint8_t row, uint8_t col, bool on);
43
- * void Max7219_LED_On(uint8_t row, uint8_t col);
44
- * void Max7219_LED_Off(uint8_t row, uint8_t col);
43
+ * void Max7219_LED_On(uint8_t col, uint8_t row);
44
+ * void Max7219_LED_Off(uint8_t col, uint8_t row);
45
  * void Max7219_LED_Toggle(uint8_t row, uint8_t col);
45
  * void Max7219_LED_Toggle(uint8_t row, uint8_t col);
46
  * void Max7219_Clear_Row(uint8_t row);
46
  * void Max7219_Clear_Row(uint8_t row);
47
  * void Max7219_Clear_Column(uint8_t col);
47
  * void Max7219_Clear_Column(uint8_t col);
48
  * void Max7219_Set_Row(uint8_t row, uint8_t val);
48
  * void Max7219_Set_Row(uint8_t row, uint8_t val);
49
+ * void Max7219_Set_2_Rows(uint8_t row, uint16_t val);
50
+ * void Max7219_Set_4_Rows(uint8_t row, uint32_t val);
49
  * void Max7219_Set_Column(uint8_t col, uint8_t val);
51
  * void Max7219_Set_Column(uint8_t col, uint8_t val);
50
  * void Max7219_idle_tasks();
52
  * void Max7219_idle_tasks();
51
  */
53
  */

+ 1
- 0
Marlin/src/module/stepper.cpp View File

1294
       _ENABLE(AXIS);                                        \
1294
       _ENABLE(AXIS);                                        \
1295
       _SAVE_START;                                          \
1295
       _SAVE_START;                                          \
1296
       _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
1296
       _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
1297
+      _PULSE_WAIT;                                          \
1297
       _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true);     \
1298
       _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true);     \
1298
       _PULSE_WAIT;                                          \
1299
       _PULSE_WAIT;                                          \
1299
       _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true);      \
1300
       _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true);      \

+ 1
- 1
Marlin/src/module/temperature.h View File

441
 
441
 
442
     #if ENABLED(BABYSTEPPING)
442
     #if ENABLED(BABYSTEPPING)
443
 
443
 
444
-      static void babystep_axis(const AxisEnum axis, const int distance) {
444
+      static void babystep_axis(const AxisEnum axis, const int16_t distance) {
445
         if (axis_known_position[axis]) {
445
         if (axis_known_position[axis]) {
446
           #if IS_CORE
446
           #if IS_CORE
447
             #if ENABLED(BABYSTEP_XY)
447
             #if ENABLED(BABYSTEP_XY)

Loading…
Cancel
Save