Browse Source

Merge pull request #6515 from thinkyhead/rc_cleanup_sunday

Some minor cleanups to code formatting
Scott Lahteine 7 years ago
parent
commit
fc9919b749
8 changed files with 134 additions and 205 deletions
  1. 3
    3
      Marlin/Conditionals_post.h
  2. 1
    1
      Marlin/cardreader.cpp
  3. 110
    149
      Marlin/pinsDebug.h
  4. 12
    42
      Marlin/pinsDebug_list.h
  5. 2
    2
      Marlin/pins_OMCA.h
  6. 1
    1
      Marlin/stepper.cpp
  7. 3
    3
      Marlin/ubl.cpp
  8. 2
    4
      Marlin/ubl_motion.cpp

+ 3
- 3
Marlin/Conditionals_post.h View File

@@ -406,9 +406,9 @@
406 406
     #endif
407 407
   #endif
408 408
 
409
-  #define IS_Z2_OR_PROBE(P) (PIN_EXISTS(Z2_MIN_PIN)      && (P == Z2_MIN_PIN) \
410
-                          || PIN_EXISTS(Z2_MAX_PIN)      && (P == Z2_MAX_PIN) \ 
411
-                          || PIN_EXISTS(Z_MIN_PROBE_PIN) && (P == Z_MIN_PROBE_PIN))
409
+  #define IS_Z2_OR_PROBE(P) (   (PIN_EXISTS(Z2_MIN)      && (P) == Z2_MIN_PIN)       \
410
+                             || (PIN_EXISTS(Z2_MAX)      && (P) == Z2_MAX_PIN)       \
411
+                             || (PIN_EXISTS(Z_MIN_PROBE) && (P) == Z_MIN_PROBE_PIN))
412 412
 
413 413
   /**
414 414
    * Set ENDSTOPPULLUPS for active endstop switches

+ 1
- 1
Marlin/cardreader.cpp View File

@@ -233,7 +233,7 @@ void CardReader::initsd() {
233 233
     #define SPI_SPEED SPI_FULL_SPEED
234 234
   #endif
235 235
 
236
-  if (!card.init(SPI_SPEED,SDSS)
236
+  if (!card.init(SPI_SPEED, SDSS)
237 237
     #if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
238 238
       && !card.init(SPI_SPEED, LCD_SDSS)
239 239
     #endif

+ 110
- 149
Marlin/pinsDebug.h View File

@@ -46,21 +46,18 @@ bool endstop_monitor_flag = false;
46 46
 
47 47
 // first pass - put the name strings into FLASH
48 48
 
49
-#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const unsigned char ENTRY_NAME[] PROGMEM = {PIN_NAME};
50
-#define _ADD_PIN(PIN_NAME, COUNTER)  _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER)
51
-#define REPORT_NAME_DIGITAL(NAME, COUNTER)  _ADD_PIN(#NAME, COUNTER)
52
-#define REPORT_NAME_ANALOG(NAME, COUNTER)  _ADD_PIN(#NAME, COUNTER)
53
-
54
-#line 0   // set __LINE__ to a known value for the first pass
49
+#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const unsigned char ENTRY_NAME[] PROGMEM = { PIN_NAME };
50
+#define _ADD_PIN(PIN_NAME, COUNTER) _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER)
51
+#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
52
+#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
55 53
 
56 54
 #include "pinsDebug_list.h"
57
-
58
-#line 59   // set __LINE__ to the correct line number or else compiler error messages don't make sense
55
+#line 56
59 56
 
60 57
 // manually add pins that have names that are macros which don't play well with these macros
61 58
 #if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
62
-  static const char RXD_NAME[] PROGMEM = {"RXD"};
63
-  static const char TXD_NAME[] PROGMEM = {"TXD"};
59
+  static const char RXD_NAME[] PROGMEM = { "RXD" };
60
+  static const char TXD_NAME[] PROGMEM = { "TXD" };
64 61
 #endif
65 62
 
66 63
 /////////////////////////////////////////////////////////////////////////////
@@ -72,11 +69,10 @@ bool endstop_monitor_flag = false;
72 69
 #undef REPORT_NAME_DIGITAL
73 70
 #undef REPORT_NAME_ANALOG
74 71
 
75
-#define _ADD_PIN_2( ENTRY_NAME, NAME, IS_DIGITAL) {(const char*) ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL},
76
-#define _ADD_PIN( NAME, COUNTER, IS_DIGITAL)  _ADD_PIN_2( entry_NAME_##COUNTER, NAME, IS_DIGITAL)
77
-#define REPORT_NAME_DIGITAL(NAME, COUNTER)  _ADD_PIN( NAME, COUNTER, (uint8_t)1)
78
-#define REPORT_NAME_ANALOG(NAME, COUNTER)  _ADD_PIN( analogInputToDigitalPin(NAME), COUNTER, 0)
79
-
72
+#define _ADD_PIN_2(ENTRY_NAME, NAME, IS_DIGITAL) { (const char*)ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL },
73
+#define _ADD_PIN(NAME, COUNTER, IS_DIGITAL) _ADD_PIN_2(entry_NAME_##COUNTER, NAME, IS_DIGITAL)
74
+#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(NAME, COUNTER, (uint8_t)1)
75
+#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(analogInputToDigitalPin(NAME), COUNTER, 0)
80 76
 
81 77
 const char* const pin_array[][3] PROGMEM = {
82 78
 
@@ -92,35 +88,32 @@ const char* const pin_array[][3] PROGMEM = {
92 88
   // manually add pins ...
93 89
   #if SERIAL_PORT == 0
94 90
     #if AVR_ATmega2560_FAMILY
95
-      {RXD_NAME, "0", "1"},
96
-      {TXD_NAME, "1", "1"},
91
+      { RXD_NAME, "0", "1" },
92
+      { TXD_NAME, "1", "1" },
97 93
     #elif AVR_ATmega1284_FAMILY
98
-      {RXD_NAME, "8", "1"},
99
-      {TXD_NAME, "9", "1"},
94
+      { RXD_NAME, "8", "1" },
95
+      { TXD_NAME, "9", "1" },
100 96
     #endif
101 97
   #endif
102 98
 
103
-  #line 0   // set __LINE__ to the SAME known value for the second pass
104 99
   #include "pinsDebug_list.h"
100
+  #line 101
105 101
 
106
-};  // done populating the array
107
-
108
-#line 109  // set __LINE__ to the correct line number or else compiler error messages don't make sense
102
+};
109 103
 
110
-#define n_array (sizeof (pin_array) / sizeof (const char *))/3
104
+#define n_array (sizeof(pin_array) / sizeof(char*)) / 3
111 105
 
112 106
 #ifndef TIMER1B
113 107
   // working with Teensyduino extension so need to re-define some things
114 108
   #include "pinsDebug_Teensyduino.h"
115 109
 #endif
116 110
 
117
-
118 111
 #define PWM_PRINT(V) do{ sprintf(buffer, "PWM:  %4d", V); SERIAL_ECHO(buffer); }while(0)
119
-#define PWM_CASE(N,Z) \
120
-  case TIMER##N##Z: \
112
+#define PWM_CASE(N,Z)                                           \
113
+  case TIMER##N##Z:                                             \
121 114
     if (TCCR##N##A & (_BV(COM##N##Z##1) | _BV(COM##N##Z##0))) { \
122
-      PWM_PRINT(OCR##N##Z); \
123
-      return true; \
115
+      PWM_PRINT(OCR##N##Z);                                     \
116
+      return true;                                              \
124 117
     } else return false
125 118
 
126 119
 /**
@@ -130,71 +123,70 @@ const char* const pin_array[][3] PROGMEM = {
130 123
 static bool pwm_status(uint8_t pin) {
131 124
   char buffer[20];   // for the sprintf statements
132 125
 
133
-  switch(digitalPinToTimer(pin)) {
126
+  switch (digitalPinToTimer(pin)) {
134 127
 
135 128
     #if defined(TCCR0A) && defined(COM0A1)
136 129
       #ifdef TIMER0A
137
-        PWM_CASE(0,A);
130
+        PWM_CASE(0, A);
138 131
       #endif
139
-      PWM_CASE(0,B);
132
+      PWM_CASE(0, B);
140 133
     #endif
141 134
 
142 135
     #if defined(TCCR1A) && defined(COM1A1)
143
-      PWM_CASE(1,A);
144
-      PWM_CASE(1,B);
136
+      PWM_CASE(1, A);
137
+      PWM_CASE(1, B);
145 138
      #if defined(COM1C1) && defined(TIMER1C)
146
-      PWM_CASE(1,C);
139
+      PWM_CASE(1, C);
147 140
      #endif
148 141
     #endif
149 142
 
150 143
     #if defined(TCCR2A) && defined(COM2A1)
151
-      PWM_CASE(2,A);
152
-      PWM_CASE(2,B);
144
+      PWM_CASE(2, A);
145
+      PWM_CASE(2, B);
153 146
     #endif
154 147
 
155 148
     #if defined(TCCR3A) && defined(COM3A1)
156
-      PWM_CASE(3,A);
157
-      PWM_CASE(3,B);
149
+      PWM_CASE(3, A);
150
+      PWM_CASE(3, B);
158 151
       #ifdef COM3C1
159
-        PWM_CASE(3,C);
152
+        PWM_CASE(3, C);
160 153
       #endif
161 154
     #endif
162 155
 
163 156
     #ifdef TCCR4A
164
-      PWM_CASE(4,A);
165
-      PWM_CASE(4,B);
166
-      PWM_CASE(4,C);
157
+      PWM_CASE(4, A);
158
+      PWM_CASE(4, B);
159
+      PWM_CASE(4, C);
167 160
     #endif
168 161
 
169 162
     #if defined(TCCR5A) && defined(COM5A1)
170
-      PWM_CASE(5,A);
171
-      PWM_CASE(5,B);
172
-      PWM_CASE(5,C);
163
+      PWM_CASE(5, A);
164
+      PWM_CASE(5, B);
165
+      PWM_CASE(5, C);
173 166
     #endif
174 167
 
175 168
     case NOT_ON_TIMER:
176 169
     default:
177 170
       return false;
178 171
   }
179
-  SERIAL_PROTOCOLPGM("  ");
172
+  SERIAL_PROTOCOL_SP(2);
180 173
 } // pwm_status
181 174
 
182 175
 
183
-
184 176
 const volatile uint8_t* const PWM_other[][3] PROGMEM = {
185
-    {&TCCR0A, &TCCR0B, &TIMSK0},
186
-    {&TCCR1A, &TCCR1B, &TIMSK1},
177
+    { &TCCR0A, &TCCR0B, &TIMSK0 },
178
+    { &TCCR1A, &TCCR1B, &TIMSK1 },
187 179
   #if defined(TCCR2A) && defined(COM2A1)
188
-    {&TCCR2A, &TCCR2B, &TIMSK2},
180
+    { &TCCR2A, &TCCR2B, &TIMSK2 },
189 181
   #endif
190 182
   #if defined(TCCR3A) && defined(COM3A1)
191
-    {&TCCR3A, &TCCR3B, &TIMSK3},
183
+    { &TCCR3A, &TCCR3B, &TIMSK3 },
192 184
   #endif
193 185
   #ifdef TCCR4A
194
-    {&TCCR4A, &TCCR4B, &TIMSK4},
186
+    { &TCCR4A, &TCCR4B, &TIMSK4 },
195 187
   #endif
196 188
   #if defined(TCCR5A) && defined(COM5A1)
197
-    {&TCCR5A, &TCCR5B, &TIMSK5},
189
+    { &TCCR5A, &TCCR5B, &TIMSK5 },
198 190
   #endif
199 191
 };
200 192
 
@@ -202,35 +194,35 @@ const volatile uint8_t* const PWM_other[][3] PROGMEM = {
202 194
 const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
203 195
 
204 196
   #ifdef TIMER0A
205
-    {&OCR0A,&OCR0B,0},
197
+    { &OCR0A, &OCR0B, 0 },
206 198
   #else
207
-    {0,&OCR0B,0},
199
+    { 0, &OCR0B, 0 },
208 200
   #endif
209 201
 
210 202
   #if defined(COM1C1) && defined(TIMER1C)
211
-   { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B, (const uint8_t*) &OCR1C},
203
+   { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, (const uint8_t*)&OCR1C },
212 204
   #else
213
-   { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B,0},
205
+   { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, 0 },
214 206
   #endif
215 207
 
216 208
   #if defined(TCCR2A) && defined(COM2A1)
217
-    {&OCR2A,&OCR2B,0},
209
+    { &OCR2A, &OCR2B, 0 },
218 210
   #endif
219 211
 
220 212
   #if defined(TCCR3A) && defined(COM3A1)
221 213
     #ifdef COM3C1
222
-      { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B, (const uint8_t*) &OCR3C},
214
+      { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, (const uint8_t*)&OCR3C },
223 215
     #else
224
-      { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B,0},
216
+      { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, 0 },
225 217
     #endif
226 218
   #endif
227 219
 
228 220
   #ifdef TCCR4A
229
-    { (const uint8_t*) &OCR4A, (const uint8_t*) &OCR4B, (const uint8_t*) &OCR4C},
221
+    { (const uint8_t*)&OCR4A, (const uint8_t*)&OCR4B, (const uint8_t*)&OCR4C },
230 222
   #endif
231 223
 
232 224
   #if defined(TCCR5A) && defined(COM5A1)
233
-    { (const uint8_t*) &OCR5A, (const uint8_t*) &OCR5B, (const uint8_t*) &OCR5C},
225
+    { (const uint8_t*)&OCR5A, (const uint8_t*)&OCR5B, (const uint8_t*)&OCR5C },
234 226
   #endif
235 227
 };
236 228
 
@@ -247,39 +239,30 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
247 239
 #define WGM_3      4
248 240
 #define TOIE       0
249 241
 
250
-
251 242
 #define OCR_VAL(T, L)   pgm_read_word(&PWM_OCR[T][L])
252 243
 
253
-
254
-static void err_is_counter() {
255
-  SERIAL_PROTOCOLPGM("   non-standard PWM mode");
256
-}
257
-static void err_is_interrupt() {
258
-  SERIAL_PROTOCOLPGM("   compare interrupt enabled");
259
-}
260
-static void err_prob_interrupt() {
261
-  SERIAL_PROTOCOLPGM("   overflow interrupt enabled");
262
-}
244
+static void err_is_counter()     { SERIAL_PROTOCOLPGM("   non-standard PWM mode"); }
245
+static void err_is_interrupt()   { SERIAL_PROTOCOLPGM("   compare interrupt enabled"); }
246
+static void err_prob_interrupt() { SERIAL_PROTOCOLPGM("   overflow interrupt enabled"); }
263 247
 
264 248
 void com_print(uint8_t N, uint8_t Z) {
265
-  uint8_t *TCCRA = (uint8_t*) TCCR_A(N);
249
+  uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
266 250
   SERIAL_PROTOCOLPGM("    COM");
267 251
   SERIAL_PROTOCOLCHAR(N + '0');
268
-  switch(Z) {
269
-    case 'A' :
252
+  switch (Z) {
253
+    case 'A':
270 254
       SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
271 255
       break;
272
-    case 'B' :
256
+    case 'B':
273 257
       SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
274 258
       break;
275
-    case 'C' :
259
+    case 'C':
276 260
       SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
277 261
       break;
278 262
   }
279 263
 }
280 264
 
281
-
282
-void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  n - WGM bit layout
265
+void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  N - WGM bit layout
283 266
   char buffer[20];   // for the sprintf statements
284 267
   uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
285 268
   uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
@@ -289,14 +272,14 @@ void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  n -
289 272
   SERIAL_PROTOCOLPGM("    TIMER");
290 273
   SERIAL_PROTOCOLCHAR(T + '0');
291 274
   SERIAL_PROTOCOLCHAR(L);
292
-  SERIAL_PROTOCOLPGM("   ");
275
+  SERIAL_PROTOCOL_SP(3);
293 276
 
294 277
   if (N == 3) {
295
-    uint8_t *OCRVAL8 = (uint8_t*) OCR_VAL(T, L - 'A');
278
+    uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A');
296 279
     PWM_PRINT(*OCRVAL8);
297 280
   }
298 281
   else {
299
-    uint16_t *OCRVAL16 = (uint16_t*) OCR_VAL(T, L - 'A');
282
+    uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
300 283
     PWM_PRINT(*OCRVAL16);
301 284
   }
302 285
   SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
@@ -311,92 +294,59 @@ void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  n -
311 294
   SERIAL_PROTOCOLCHAR(T + '0');
312 295
   SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
313 296
 
314
-  uint8_t *TMSK = (uint8_t*) TIMSK(T);
297
+  uint8_t *TMSK = (uint8_t*)TIMSK(T);
315 298
   SERIAL_PROTOCOLPGM("    TIMSK");
316 299
   SERIAL_PROTOCOLCHAR(T + '0');
317 300
   SERIAL_PROTOCOLPAIR(": ", *TMSK);
318 301
 
319 302
   uint8_t OCIE = L - 'A' + 1;
320
-  if (N == 3) {if (WGM == 0 || WGM == 2 || WGM ==  4 || WGM ==  6) err_is_counter();}
321
-  else        {if (WGM == 0 || WGM == 4 || WGM == 12 || WGM == 13) err_is_counter();}
303
+  if (N == 3) { if (WGM == 0 || WGM == 2 || WGM ==  4 || WGM ==  6) err_is_counter(); }
304
+  else        { if (WGM == 0 || WGM == 4 || WGM == 12 || WGM == 13) err_is_counter(); }
322 305
   if (TEST(*TMSK, OCIE)) err_is_interrupt();
323 306
   if (TEST(*TMSK, TOIE)) err_prob_interrupt();
324 307
 }
325 308
 
326 309
 static void pwm_details(uint8_t pin) {
327
-  switch(digitalPinToTimer(pin)) {
310
+  switch (digitalPinToTimer(pin)) {
328 311
 
329 312
     #if defined(TCCR0A) && defined(COM0A1)
330
-
331 313
       #ifdef TIMER0A
332
-        case TIMER0A:
333
-          timer_prefix(0,'A',3);
334
-          break;
314
+        case TIMER0A: timer_prefix(0, 'A', 3); break;
335 315
       #endif
336
-      case TIMER0B:
337
-        timer_prefix(0,'B',3);
338
-        break;
316
+      case TIMER0B: timer_prefix(0, 'B', 3); break;
339 317
     #endif
340 318
 
341 319
     #if defined(TCCR1A) && defined(COM1A1)
342
-      case TIMER1A:
343
-        timer_prefix(1,'A',4);
344
-        break;
345
-      case TIMER1B:
346
-        timer_prefix(1,'B',4);
347
-        break;
320
+      case TIMER1A: timer_prefix(1, 'A', 4); break;
321
+      case TIMER1B: timer_prefix(1, 'B', 4); break;
348 322
       #if defined(COM1C1) && defined(TIMER1C)
349
-        case TIMER1C:
350
-          timer_prefix(1,'C',4);
351
-          break;
323
+        case TIMER1C: timer_prefix(1, 'C', 4); break;
352 324
       #endif
353 325
     #endif
354 326
 
355 327
     #if defined(TCCR2A) && defined(COM2A1)
356
-      case TIMER2A:
357
-        timer_prefix(2,'A',3);
358
-        break;
359
-      case TIMER2B:
360
-        timer_prefix(2,'B',3);
361
-        break;
328
+      case TIMER2A: timer_prefix(2, 'A', 3); break;
329
+      case TIMER2B: timer_prefix(2, 'B', 3); break;
362 330
     #endif
363 331
 
364 332
     #if defined(TCCR3A) && defined(COM3A1)
365
-      case TIMER3A:
366
-        timer_prefix(3,'A',4);
367
-        break;
368
-      case TIMER3B:
369
-        timer_prefix(3,'B',4);
370
-        break;
333
+      case TIMER3A: timer_prefix(3, 'A', 4); break;
334
+      case TIMER3B: timer_prefix(3, 'B', 4); break;
371 335
       #ifdef COM3C1
372
-        case TIMER3C:
373
-          timer_prefix(3,'C',4);
374
-          break;
336
+        case TIMER3C: timer_prefix(3, 'C', 4); break;
375 337
       #endif
376 338
     #endif
377 339
 
378 340
     #ifdef TCCR4A
379
-      case TIMER4A:
380
-        timer_prefix(4,'A',4);
381
-        break;
382
-      case TIMER4B:
383
-        timer_prefix(4,'B',4);
384
-        break;
385
-      case TIMER4C:
386
-        timer_prefix(4,'C',4);
387
-        break;
341
+      case TIMER4A: timer_prefix(4, 'A', 4); break;
342
+      case TIMER4B: timer_prefix(4, 'B', 4); break;
343
+      case TIMER4C: timer_prefix(4, 'C', 4); break;
388 344
     #endif
389 345
 
390 346
     #if defined(TCCR5A) && defined(COM5A1)
391
-      case TIMER5A:
392
-        timer_prefix(5,'A',4);
393
-        break;
394
-      case TIMER5B:
395
-        timer_prefix(5,'B',4);
396
-        break;
397
-      case TIMER5C:
398
-        timer_prefix(5,'C',4);
399
-        break;
347
+      case TIMER5A: timer_prefix(5, 'A', 4); break;
348
+      case TIMER5B: timer_prefix(5, 'B', 4); break;
349
+      case TIMER5C: timer_prefix(5, 'C', 4); break;
400 350
     #endif
401 351
 
402 352
     case NOT_ON_TIMER: break;
@@ -409,11 +359,17 @@ static void pwm_details(uint8_t pin) {
409 359
     // looking for port B7 - PWMs 0A and 1C
410 360
     if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) {
411 361
       #ifndef TEENSYDUINO_IDE
412
-        SERIAL_PROTOCOLPGM("\n .                  TIMER1C is also tied to this pin             ");
413
-        timer_prefix(1,'C',4);
362
+        SERIAL_PROTOCOLPGM("\n .");
363
+        SERIAL_PROTOCOL_SP(18);
364
+        SERIAL_PROTOCOLPGM("TIMER1C is also tied to this pin");
365
+        SERIAL_PROTOCOL_SP(13);
366
+        timer_prefix(1, 'C', 4);
414 367
       #else
415
-        SERIAL_PROTOCOLPGM("\n .                  TIMER0A is also tied to this pin             ");
416
-        timer_prefix(0,'A',3);
368
+        SERIAL_PROTOCOLPGM("\n .");
369
+        SERIAL_PROTOCOL_SP(18);
370
+        SERIAL_PROTOCOLPGM("TIMER0A is also tied to this pin");
371
+        SERIAL_PROTOCOL_SP(13);
372
+        timer_prefix(0, 'A', 3);
417 373
       #endif
418 374
     }
419 375
   #endif
@@ -437,7 +393,7 @@ void print_port(int8_t pin) {   // print port number
437 393
     for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1;
438 394
     SERIAL_CHAR(x);
439 395
   #else
440
-    SERIAL_PROTOCOLPGM("          ");
396
+    SERIAL_PROTOCOL_SP(10);
441 397
   #endif
442 398
 }
443 399
 
@@ -460,10 +416,13 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
460 416
           sprintf(buffer, " (A%2d)  ", int(pin - analogInputToDigitalPin(0)));    // analog pin number
461 417
           SERIAL_ECHO(buffer);
462 418
         }
463
-        else SERIAL_ECHOPGM("        ");   // add padding if not an analog pin
419
+        else SERIAL_ECHO_SP(8);   // add padding if not an analog pin
464 420
       }
465
-      else SERIAL_ECHOPGM(".                         ");  // add padding if not the first instance found
466
-      name_mem_pointer = (char*) pgm_read_word(&pin_array[x][0]);
421
+      else {
422
+        SERIAL_CHAR('.');
423
+        SERIAL_ECHO_SP(25);  // add padding if not the first instance found
424
+      }
425
+      name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]);
467 426
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
468 427
         temp_char = pgm_read_byte(name_mem_pointer + y);
469 428
         if (temp_char != 0) MYSERIAL.write(temp_char);
@@ -506,17 +465,19 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
506 465
       SERIAL_ECHO(buffer);
507 466
     }
508 467
     else
509
-      SERIAL_ECHOPGM("        ");   // add padding if not an analog pin
468
+      SERIAL_ECHO_SP(8);   // add padding if not an analog pin
510 469
     SERIAL_ECHOPGM("<unused/unknown>");
511
-    if (get_pinMode(pin))
512
-      SERIAL_PROTOCOLPAIR("            Output = ", digitalRead_mod(pin));
470
+    if (get_pinMode(pin)) {
471
+      SERIAL_PROTOCOL_SP(12);
472
+      SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin));
473
+    }
513 474
     else {
514 475
       if (IS_ANALOG(pin)) {
515 476
         sprintf(buffer, "   Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0)));
516 477
         SERIAL_ECHO(buffer);
517 478
       }
518 479
       else
519
-        SERIAL_ECHOPGM("         ");   // add padding if not an analog pin
480
+        SERIAL_ECHO_SP(9);   // add padding if not an analog pin
520 481
 
521 482
       SERIAL_PROTOCOLPAIR("   Input  = ", digitalRead_mod(pin));
522 483
     }

+ 12
- 42
Marlin/pinsDebug_list.h View File

@@ -20,12 +20,15 @@
20 20
  *
21 21
  */
22 22
 
23
- // Please update this list when adding new pins to Marlin.
24
- // The order doesn't matter.
25
- // Following this pattern is a must.
26
- // If the new pin name is over 28 characters long then pinsDebug.h will need to be modified.
23
+// Please update this list when adding new pins to Marlin.
24
+// The order doesn't matter.
25
+// Following this pattern is a must.
26
+// If the new pin name is over 28 characters long then pinsDebug.h will need to be modified.
27
+
28
+// Pin list updated from 18 FEB 2017 RCBugfix branch   - max length of pin name is 24
29
+
30
+#line 0 // set __LINE__ to a known value for both passes
27 31
 
28
-  // Pin list updated from 18 FEB 2017 RCBugfix branch   - max length of pin name is 24
29 32
 #if defined(__FD) && __FD >= 0
30 33
   REPORT_NAME_DIGITAL(__FD, __LINE__ )
31 34
 #endif
@@ -224,18 +227,6 @@
224 227
 #if PIN_EXISTS(E4_STEP)
225 228
   REPORT_NAME_DIGITAL(E4_STEP_PIN, __LINE__ )
226 229
 #endif
227
-#if defined(encrot0) && encrot0 >= 0
228
-  REPORT_NAME_DIGITAL(encrot0, __LINE__ )
229
-#endif
230
-#if defined(encrot1) && encrot1 >= 0
231
-  REPORT_NAME_DIGITAL(encrot1, __LINE__ )
232
-#endif
233
-#if defined(encrot2) && encrot2 >= 0
234
-  REPORT_NAME_DIGITAL(encrot2, __LINE__ )
235
-#endif
236
-#if defined(encrot3) && encrot3 >= 0
237
-  REPORT_NAME_DIGITAL(encrot3, __LINE__ )
238
-#endif
239 230
 #if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 < NUM_ANALOG_INPUTS
240 231
   REPORT_NAME_ANALOG(EXT_AUX_A0, __LINE__ )
241 232
 #endif
@@ -317,9 +308,6 @@
317 308
 #if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS
318 309
   REPORT_NAME_ANALOG(FILWIDTH_PIN, __LINE__ )
319 310
 #endif
320
-#if defined(GEN7_VERSION) && GEN7_VERSION >= 0
321
-  REPORT_NAME_DIGITAL(GEN7_VERSION, __LINE__ )
322
-#endif
323 311
 #if PIN_EXISTS(HEATER_0)
324 312
   REPORT_NAME_DIGITAL(HEATER_0_PIN, __LINE__ )
325 313
 #endif
@@ -350,11 +338,11 @@
350 338
 #if PIN_EXISTS(HOME)
351 339
   REPORT_NAME_DIGITAL(HOME_PIN, __LINE__ )
352 340
 #endif
353
-#if defined(I2C_SCL) && I2C_SCL >= 0
354
-  REPORT_NAME_DIGITAL(I2C_SCL, __LINE__ )
341
+#if PIN_EXISTS(I2C_SCL)
342
+  REPORT_NAME_DIGITAL(I2C_SCL_PIN, __LINE__ )
355 343
 #endif
356
-#if defined(I2C_SDA) && I2C_SDA >= 0
357
-  REPORT_NAME_DIGITAL(I2C_SDA, __LINE__ )
344
+#if PIN_EXISTS(I2C_SDA)
345
+  REPORT_NAME_DIGITAL(I2C_SDA_PIN, __LINE__ )
358 346
 #endif
359 347
 #if PIN_EXISTS(KILL)
360 348
   REPORT_NAME_DIGITAL(KILL_PIN, __LINE__ )
@@ -422,9 +410,6 @@
422 410
 #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
423 411
   REPORT_NAME_DIGITAL(MOTOR_CURRENT_PWM_Z_PIN, __LINE__ )
424 412
 #endif
425
-#if defined(NUM_TLCS) && NUM_TLCS >= 0
426
-  REPORT_NAME_DIGITAL(NUM_TLCS, __LINE__ )
427
-#endif
428 413
 #if PIN_EXISTS(ORIG_E0_AUTO_FAN)
429 414
   REPORT_NAME_DIGITAL(ORIG_E0_AUTO_FAN_PIN, __LINE__ )
430 415
 #endif
@@ -545,15 +530,9 @@
545 530
 #if PIN_EXISTS(SS)
546 531
   REPORT_NAME_DIGITAL(SS_PIN, __LINE__ )
547 532
 #endif
548
-#if defined(STAT_LED_BLUE) && STAT_LED_BLUE >= 0
549
-  REPORT_NAME_DIGITAL(STAT_LED_BLUE, __LINE__ )
550
-#endif
551 533
 #if PIN_EXISTS(STAT_LED_BLUE)
552 534
   REPORT_NAME_DIGITAL(STAT_LED_BLUE_PIN, __LINE__ )
553 535
 #endif
554
-#if defined(STAT_LED_RED) && STAT_LED_RED >= 0
555
-  REPORT_NAME_DIGITAL(STAT_LED_RED, __LINE__ )
556
-#endif
557 536
 #if PIN_EXISTS(STAT_LED_RED)
558 537
   REPORT_NAME_DIGITAL(STAT_LED_RED_PIN, __LINE__ )
559 538
 #endif
@@ -599,21 +578,12 @@
599 578
 #if PIN_EXISTS(THERMO_SCK)
600 579
   REPORT_NAME_DIGITAL(THERMO_SCK_PIN, __LINE__ )
601 580
 #endif
602
-#if defined(TLC_BLANK_BIT) && TLC_BLANK_BIT >= 0
603
-  REPORT_NAME_DIGITAL(TLC_BLANK_BIT, __LINE__ )
604
-#endif
605 581
 #if PIN_EXISTS(TLC_BLANK)
606 582
   REPORT_NAME_DIGITAL(TLC_BLANK_PIN, __LINE__ )
607 583
 #endif
608
-#if defined(TLC_CLOCK_BIT) && TLC_CLOCK_BIT >= 0
609
-  REPORT_NAME_DIGITAL(TLC_CLOCK_BIT, __LINE__ )
610
-#endif
611 584
 #if PIN_EXISTS(TLC_CLOCK)
612 585
   REPORT_NAME_DIGITAL(TLC_CLOCK_PIN, __LINE__ )
613 586
 #endif
614
-#if defined(TLC_DATA_BIT) && TLC_DATA_BIT >= 0
615
-  REPORT_NAME_DIGITAL(TLC_DATA_BIT, __LINE__ )
616
-#endif
617 587
 #if PIN_EXISTS(TLC_DATA)
618 588
   REPORT_NAME_DIGITAL(TLC_DATA_PIN, __LINE__ )
619 589
 #endif

+ 2
- 2
Marlin/pins_OMCA.h View File

@@ -111,8 +111,8 @@
111 111
 //
112 112
 #define SDSS               11
113 113
 
114
-#define I2C_SCL            16
115
-#define I2C_SDA            17
114
+#define I2C_SCL_PIN        16
115
+#define I2C_SDA_PIN        17
116 116
 
117 117
 // future proofing
118 118
 #define __FS  20

+ 1
- 1
Marlin/stepper.cpp View File

@@ -1099,7 +1099,7 @@ void Stepper::init() {
1099 1099
   ENABLE_STEPPER_DRIVER_INTERRUPT();
1100 1100
 
1101 1101
   #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
1102
-    ZERO(e_steps);
1102
+    for (uint8_t i = 0; i < COUNT(e_steps); i++) e_steps[i] = 0;
1103 1103
     #if ENABLED(LIN_ADVANCE)
1104 1104
       ZERO(current_adv_steps);
1105 1105
     #endif

+ 3
- 3
Marlin/ubl.cpp View File

@@ -52,7 +52,7 @@
52 52
 
53 53
   static void serial_echo_12x_spaces() {
54 54
     for (uint8_t i = GRID_MAX_POINTS_X - 1; --i;) {
55
-      SERIAL_ECHOPGM("            ");
55
+      SERIAL_ECHO_SP(12);
56 56
       safe_delay(10);
57 57
     }
58 58
   }
@@ -201,12 +201,12 @@
201 201
 
202 202
     if (map0) {
203 203
       serial_echo_xy(UBL_MESH_MIN_X, UBL_MESH_MIN_Y);
204
-      SERIAL_ECHOPGM("    ");
204
+      SERIAL_ECHO_SP(4);
205 205
       serial_echo_12x_spaces();
206 206
       serial_echo_xy(UBL_MESH_MAX_X, UBL_MESH_MIN_Y);
207 207
       SERIAL_EOL;
208 208
       serial_echo_xy(0, 0);
209
-      SERIAL_ECHOPGM("       ");
209
+      SERIAL_ECHO_SP(7);
210 210
       serial_echo_12x_spaces();
211 211
       serial_echo_xy(GRID_MAX_POINTS_X - 1, 0);
212 212
       SERIAL_EOL;

+ 2
- 4
Marlin/ubl_motion.cpp View File

@@ -250,10 +250,8 @@
250 250
     const float m = dy / dx,
251 251
                 c = start[Y_AXIS] - m * start[X_AXIS];
252 252
 
253
-    bool inf_normalized_flag, inf_m_flag; 
254
-
255
-    inf_normalized_flag = isinf(e_normalized_dist);
256
-    inf_m_flag = isinf(m);
253
+    const bool inf_normalized_flag = isinf(e_normalized_dist),
254
+               inf_m_flag = isinf(m);
257 255
 
258 256
     /**
259 257
      * This block handles vertical lines. These are lines that stay within the same

Loading…
Cancel
Save