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
     #endif
406
     #endif
407
   #endif
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
    * Set ENDSTOPPULLUPS for active endstop switches
414
    * Set ENDSTOPPULLUPS for active endstop switches

+ 1
- 1
Marlin/cardreader.cpp View File

233
     #define SPI_SPEED SPI_FULL_SPEED
233
     #define SPI_SPEED SPI_FULL_SPEED
234
   #endif
234
   #endif
235
 
235
 
236
-  if (!card.init(SPI_SPEED,SDSS)
236
+  if (!card.init(SPI_SPEED, SDSS)
237
     #if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
237
     #if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
238
       && !card.init(SPI_SPEED, LCD_SDSS)
238
       && !card.init(SPI_SPEED, LCD_SDSS)
239
     #endif
239
     #endif

+ 110
- 149
Marlin/pinsDebug.h View File

46
 
46
 
47
 // first pass - put the name strings into FLASH
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
 #include "pinsDebug_list.h"
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
 // manually add pins that have names that are macros which don't play well with these macros
57
 // manually add pins that have names that are macros which don't play well with these macros
61
 #if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
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
 #endif
61
 #endif
65
 
62
 
66
 /////////////////////////////////////////////////////////////////////////////
63
 /////////////////////////////////////////////////////////////////////////////
72
 #undef REPORT_NAME_DIGITAL
69
 #undef REPORT_NAME_DIGITAL
73
 #undef REPORT_NAME_ANALOG
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
 const char* const pin_array[][3] PROGMEM = {
77
 const char* const pin_array[][3] PROGMEM = {
82
 
78
 
92
   // manually add pins ...
88
   // manually add pins ...
93
   #if SERIAL_PORT == 0
89
   #if SERIAL_PORT == 0
94
     #if AVR_ATmega2560_FAMILY
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
     #elif AVR_ATmega1284_FAMILY
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
     #endif
96
     #endif
101
   #endif
97
   #endif
102
 
98
 
103
-  #line 0   // set __LINE__ to the SAME known value for the second pass
104
   #include "pinsDebug_list.h"
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
 #ifndef TIMER1B
106
 #ifndef TIMER1B
113
   // working with Teensyduino extension so need to re-define some things
107
   // working with Teensyduino extension so need to re-define some things
114
   #include "pinsDebug_Teensyduino.h"
108
   #include "pinsDebug_Teensyduino.h"
115
 #endif
109
 #endif
116
 
110
 
117
-
118
 #define PWM_PRINT(V) do{ sprintf(buffer, "PWM:  %4d", V); SERIAL_ECHO(buffer); }while(0)
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
     if (TCCR##N##A & (_BV(COM##N##Z##1) | _BV(COM##N##Z##0))) { \
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
     } else return false
117
     } else return false
125
 
118
 
126
 /**
119
 /**
130
 static bool pwm_status(uint8_t pin) {
123
 static bool pwm_status(uint8_t pin) {
131
   char buffer[20];   // for the sprintf statements
124
   char buffer[20];   // for the sprintf statements
132
 
125
 
133
-  switch(digitalPinToTimer(pin)) {
126
+  switch (digitalPinToTimer(pin)) {
134
 
127
 
135
     #if defined(TCCR0A) && defined(COM0A1)
128
     #if defined(TCCR0A) && defined(COM0A1)
136
       #ifdef TIMER0A
129
       #ifdef TIMER0A
137
-        PWM_CASE(0,A);
130
+        PWM_CASE(0, A);
138
       #endif
131
       #endif
139
-      PWM_CASE(0,B);
132
+      PWM_CASE(0, B);
140
     #endif
133
     #endif
141
 
134
 
142
     #if defined(TCCR1A) && defined(COM1A1)
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
      #if defined(COM1C1) && defined(TIMER1C)
138
      #if defined(COM1C1) && defined(TIMER1C)
146
-      PWM_CASE(1,C);
139
+      PWM_CASE(1, C);
147
      #endif
140
      #endif
148
     #endif
141
     #endif
149
 
142
 
150
     #if defined(TCCR2A) && defined(COM2A1)
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
     #endif
146
     #endif
154
 
147
 
155
     #if defined(TCCR3A) && defined(COM3A1)
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
       #ifdef COM3C1
151
       #ifdef COM3C1
159
-        PWM_CASE(3,C);
152
+        PWM_CASE(3, C);
160
       #endif
153
       #endif
161
     #endif
154
     #endif
162
 
155
 
163
     #ifdef TCCR4A
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
     #endif
160
     #endif
168
 
161
 
169
     #if defined(TCCR5A) && defined(COM5A1)
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
     #endif
166
     #endif
174
 
167
 
175
     case NOT_ON_TIMER:
168
     case NOT_ON_TIMER:
176
     default:
169
     default:
177
       return false;
170
       return false;
178
   }
171
   }
179
-  SERIAL_PROTOCOLPGM("  ");
172
+  SERIAL_PROTOCOL_SP(2);
180
 } // pwm_status
173
 } // pwm_status
181
 
174
 
182
 
175
 
183
-
184
 const volatile uint8_t* const PWM_other[][3] PROGMEM = {
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
   #if defined(TCCR2A) && defined(COM2A1)
179
   #if defined(TCCR2A) && defined(COM2A1)
188
-    {&TCCR2A, &TCCR2B, &TIMSK2},
180
+    { &TCCR2A, &TCCR2B, &TIMSK2 },
189
   #endif
181
   #endif
190
   #if defined(TCCR3A) && defined(COM3A1)
182
   #if defined(TCCR3A) && defined(COM3A1)
191
-    {&TCCR3A, &TCCR3B, &TIMSK3},
183
+    { &TCCR3A, &TCCR3B, &TIMSK3 },
192
   #endif
184
   #endif
193
   #ifdef TCCR4A
185
   #ifdef TCCR4A
194
-    {&TCCR4A, &TCCR4B, &TIMSK4},
186
+    { &TCCR4A, &TCCR4B, &TIMSK4 },
195
   #endif
187
   #endif
196
   #if defined(TCCR5A) && defined(COM5A1)
188
   #if defined(TCCR5A) && defined(COM5A1)
197
-    {&TCCR5A, &TCCR5B, &TIMSK5},
189
+    { &TCCR5A, &TCCR5B, &TIMSK5 },
198
   #endif
190
   #endif
199
 };
191
 };
200
 
192
 
202
 const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
194
 const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
203
 
195
 
204
   #ifdef TIMER0A
196
   #ifdef TIMER0A
205
-    {&OCR0A,&OCR0B,0},
197
+    { &OCR0A, &OCR0B, 0 },
206
   #else
198
   #else
207
-    {0,&OCR0B,0},
199
+    { 0, &OCR0B, 0 },
208
   #endif
200
   #endif
209
 
201
 
210
   #if defined(COM1C1) && defined(TIMER1C)
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
   #else
204
   #else
213
-   { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B,0},
205
+   { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, 0 },
214
   #endif
206
   #endif
215
 
207
 
216
   #if defined(TCCR2A) && defined(COM2A1)
208
   #if defined(TCCR2A) && defined(COM2A1)
217
-    {&OCR2A,&OCR2B,0},
209
+    { &OCR2A, &OCR2B, 0 },
218
   #endif
210
   #endif
219
 
211
 
220
   #if defined(TCCR3A) && defined(COM3A1)
212
   #if defined(TCCR3A) && defined(COM3A1)
221
     #ifdef COM3C1
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
     #else
215
     #else
224
-      { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B,0},
216
+      { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, 0 },
225
     #endif
217
     #endif
226
   #endif
218
   #endif
227
 
219
 
228
   #ifdef TCCR4A
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
   #endif
222
   #endif
231
 
223
 
232
   #if defined(TCCR5A) && defined(COM5A1)
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
   #endif
226
   #endif
235
 };
227
 };
236
 
228
 
247
 #define WGM_3      4
239
 #define WGM_3      4
248
 #define TOIE       0
240
 #define TOIE       0
249
 
241
 
250
-
251
 #define OCR_VAL(T, L)   pgm_read_word(&PWM_OCR[T][L])
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
 void com_print(uint8_t N, uint8_t Z) {
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
   SERIAL_PROTOCOLPGM("    COM");
250
   SERIAL_PROTOCOLPGM("    COM");
267
   SERIAL_PROTOCOLCHAR(N + '0');
251
   SERIAL_PROTOCOLCHAR(N + '0');
268
-  switch(Z) {
269
-    case 'A' :
252
+  switch (Z) {
253
+    case 'A':
270
       SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
254
       SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
271
       break;
255
       break;
272
-    case 'B' :
256
+    case 'B':
273
       SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
257
       SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
274
       break;
258
       break;
275
-    case 'C' :
259
+    case 'C':
276
       SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
260
       SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
277
       break;
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
   char buffer[20];   // for the sprintf statements
266
   char buffer[20];   // for the sprintf statements
284
   uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
267
   uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
285
   uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
268
   uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
289
   SERIAL_PROTOCOLPGM("    TIMER");
272
   SERIAL_PROTOCOLPGM("    TIMER");
290
   SERIAL_PROTOCOLCHAR(T + '0');
273
   SERIAL_PROTOCOLCHAR(T + '0');
291
   SERIAL_PROTOCOLCHAR(L);
274
   SERIAL_PROTOCOLCHAR(L);
292
-  SERIAL_PROTOCOLPGM("   ");
275
+  SERIAL_PROTOCOL_SP(3);
293
 
276
 
294
   if (N == 3) {
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
     PWM_PRINT(*OCRVAL8);
279
     PWM_PRINT(*OCRVAL8);
297
   }
280
   }
298
   else {
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
     PWM_PRINT(*OCRVAL16);
283
     PWM_PRINT(*OCRVAL16);
301
   }
284
   }
302
   SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
285
   SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
311
   SERIAL_PROTOCOLCHAR(T + '0');
294
   SERIAL_PROTOCOLCHAR(T + '0');
312
   SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
295
   SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
313
 
296
 
314
-  uint8_t *TMSK = (uint8_t*) TIMSK(T);
297
+  uint8_t *TMSK = (uint8_t*)TIMSK(T);
315
   SERIAL_PROTOCOLPGM("    TIMSK");
298
   SERIAL_PROTOCOLPGM("    TIMSK");
316
   SERIAL_PROTOCOLCHAR(T + '0');
299
   SERIAL_PROTOCOLCHAR(T + '0');
317
   SERIAL_PROTOCOLPAIR(": ", *TMSK);
300
   SERIAL_PROTOCOLPAIR(": ", *TMSK);
318
 
301
 
319
   uint8_t OCIE = L - 'A' + 1;
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
   if (TEST(*TMSK, OCIE)) err_is_interrupt();
305
   if (TEST(*TMSK, OCIE)) err_is_interrupt();
323
   if (TEST(*TMSK, TOIE)) err_prob_interrupt();
306
   if (TEST(*TMSK, TOIE)) err_prob_interrupt();
324
 }
307
 }
325
 
308
 
326
 static void pwm_details(uint8_t pin) {
309
 static void pwm_details(uint8_t pin) {
327
-  switch(digitalPinToTimer(pin)) {
310
+  switch (digitalPinToTimer(pin)) {
328
 
311
 
329
     #if defined(TCCR0A) && defined(COM0A1)
312
     #if defined(TCCR0A) && defined(COM0A1)
330
-
331
       #ifdef TIMER0A
313
       #ifdef TIMER0A
332
-        case TIMER0A:
333
-          timer_prefix(0,'A',3);
334
-          break;
314
+        case TIMER0A: timer_prefix(0, 'A', 3); break;
335
       #endif
315
       #endif
336
-      case TIMER0B:
337
-        timer_prefix(0,'B',3);
338
-        break;
316
+      case TIMER0B: timer_prefix(0, 'B', 3); break;
339
     #endif
317
     #endif
340
 
318
 
341
     #if defined(TCCR1A) && defined(COM1A1)
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
       #if defined(COM1C1) && defined(TIMER1C)
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
       #endif
324
       #endif
353
     #endif
325
     #endif
354
 
326
 
355
     #if defined(TCCR2A) && defined(COM2A1)
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
     #endif
330
     #endif
363
 
331
 
364
     #if defined(TCCR3A) && defined(COM3A1)
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
       #ifdef COM3C1
335
       #ifdef COM3C1
372
-        case TIMER3C:
373
-          timer_prefix(3,'C',4);
374
-          break;
336
+        case TIMER3C: timer_prefix(3, 'C', 4); break;
375
       #endif
337
       #endif
376
     #endif
338
     #endif
377
 
339
 
378
     #ifdef TCCR4A
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
     #endif
344
     #endif
389
 
345
 
390
     #if defined(TCCR5A) && defined(COM5A1)
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
     #endif
350
     #endif
401
 
351
 
402
     case NOT_ON_TIMER: break;
352
     case NOT_ON_TIMER: break;
409
     // looking for port B7 - PWMs 0A and 1C
359
     // looking for port B7 - PWMs 0A and 1C
410
     if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) {
360
     if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) {
411
       #ifndef TEENSYDUINO_IDE
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
       #else
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
       #endif
373
       #endif
418
     }
374
     }
419
   #endif
375
   #endif
437
     for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1;
393
     for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1;
438
     SERIAL_CHAR(x);
394
     SERIAL_CHAR(x);
439
   #else
395
   #else
440
-    SERIAL_PROTOCOLPGM("          ");
396
+    SERIAL_PROTOCOL_SP(10);
441
   #endif
397
   #endif
442
 }
398
 }
443
 
399
 
460
           sprintf(buffer, " (A%2d)  ", int(pin - analogInputToDigitalPin(0)));    // analog pin number
416
           sprintf(buffer, " (A%2d)  ", int(pin - analogInputToDigitalPin(0)));    // analog pin number
461
           SERIAL_ECHO(buffer);
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
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
426
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
468
         temp_char = pgm_read_byte(name_mem_pointer + y);
427
         temp_char = pgm_read_byte(name_mem_pointer + y);
469
         if (temp_char != 0) MYSERIAL.write(temp_char);
428
         if (temp_char != 0) MYSERIAL.write(temp_char);
506
       SERIAL_ECHO(buffer);
465
       SERIAL_ECHO(buffer);
507
     }
466
     }
508
     else
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
     SERIAL_ECHOPGM("<unused/unknown>");
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
     else {
474
     else {
514
       if (IS_ANALOG(pin)) {
475
       if (IS_ANALOG(pin)) {
515
         sprintf(buffer, "   Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0)));
476
         sprintf(buffer, "   Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0)));
516
         SERIAL_ECHO(buffer);
477
         SERIAL_ECHO(buffer);
517
       }
478
       }
518
       else
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
       SERIAL_PROTOCOLPAIR("   Input  = ", digitalRead_mod(pin));
482
       SERIAL_PROTOCOLPAIR("   Input  = ", digitalRead_mod(pin));
522
     }
483
     }

+ 12
- 42
Marlin/pinsDebug_list.h View File

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
 #if defined(__FD) && __FD >= 0
32
 #if defined(__FD) && __FD >= 0
30
   REPORT_NAME_DIGITAL(__FD, __LINE__ )
33
   REPORT_NAME_DIGITAL(__FD, __LINE__ )
31
 #endif
34
 #endif
224
 #if PIN_EXISTS(E4_STEP)
227
 #if PIN_EXISTS(E4_STEP)
225
   REPORT_NAME_DIGITAL(E4_STEP_PIN, __LINE__ )
228
   REPORT_NAME_DIGITAL(E4_STEP_PIN, __LINE__ )
226
 #endif
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
 #if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 < NUM_ANALOG_INPUTS
230
 #if defined(EXT_AUX_A0) && EXT_AUX_A0 >= 0 && EXT_AUX_A0 < NUM_ANALOG_INPUTS
240
   REPORT_NAME_ANALOG(EXT_AUX_A0, __LINE__ )
231
   REPORT_NAME_ANALOG(EXT_AUX_A0, __LINE__ )
241
 #endif
232
 #endif
317
 #if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS
308
 #if PIN_EXISTS(FILWIDTH) && FILWIDTH_PIN < NUM_ANALOG_INPUTS
318
   REPORT_NAME_ANALOG(FILWIDTH_PIN, __LINE__ )
309
   REPORT_NAME_ANALOG(FILWIDTH_PIN, __LINE__ )
319
 #endif
310
 #endif
320
-#if defined(GEN7_VERSION) && GEN7_VERSION >= 0
321
-  REPORT_NAME_DIGITAL(GEN7_VERSION, __LINE__ )
322
-#endif
323
 #if PIN_EXISTS(HEATER_0)
311
 #if PIN_EXISTS(HEATER_0)
324
   REPORT_NAME_DIGITAL(HEATER_0_PIN, __LINE__ )
312
   REPORT_NAME_DIGITAL(HEATER_0_PIN, __LINE__ )
325
 #endif
313
 #endif
350
 #if PIN_EXISTS(HOME)
338
 #if PIN_EXISTS(HOME)
351
   REPORT_NAME_DIGITAL(HOME_PIN, __LINE__ )
339
   REPORT_NAME_DIGITAL(HOME_PIN, __LINE__ )
352
 #endif
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
 #endif
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
 #endif
346
 #endif
359
 #if PIN_EXISTS(KILL)
347
 #if PIN_EXISTS(KILL)
360
   REPORT_NAME_DIGITAL(KILL_PIN, __LINE__ )
348
   REPORT_NAME_DIGITAL(KILL_PIN, __LINE__ )
422
 #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
410
 #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
423
   REPORT_NAME_DIGITAL(MOTOR_CURRENT_PWM_Z_PIN, __LINE__ )
411
   REPORT_NAME_DIGITAL(MOTOR_CURRENT_PWM_Z_PIN, __LINE__ )
424
 #endif
412
 #endif
425
-#if defined(NUM_TLCS) && NUM_TLCS >= 0
426
-  REPORT_NAME_DIGITAL(NUM_TLCS, __LINE__ )
427
-#endif
428
 #if PIN_EXISTS(ORIG_E0_AUTO_FAN)
413
 #if PIN_EXISTS(ORIG_E0_AUTO_FAN)
429
   REPORT_NAME_DIGITAL(ORIG_E0_AUTO_FAN_PIN, __LINE__ )
414
   REPORT_NAME_DIGITAL(ORIG_E0_AUTO_FAN_PIN, __LINE__ )
430
 #endif
415
 #endif
545
 #if PIN_EXISTS(SS)
530
 #if PIN_EXISTS(SS)
546
   REPORT_NAME_DIGITAL(SS_PIN, __LINE__ )
531
   REPORT_NAME_DIGITAL(SS_PIN, __LINE__ )
547
 #endif
532
 #endif
548
-#if defined(STAT_LED_BLUE) && STAT_LED_BLUE >= 0
549
-  REPORT_NAME_DIGITAL(STAT_LED_BLUE, __LINE__ )
550
-#endif
551
 #if PIN_EXISTS(STAT_LED_BLUE)
533
 #if PIN_EXISTS(STAT_LED_BLUE)
552
   REPORT_NAME_DIGITAL(STAT_LED_BLUE_PIN, __LINE__ )
534
   REPORT_NAME_DIGITAL(STAT_LED_BLUE_PIN, __LINE__ )
553
 #endif
535
 #endif
554
-#if defined(STAT_LED_RED) && STAT_LED_RED >= 0
555
-  REPORT_NAME_DIGITAL(STAT_LED_RED, __LINE__ )
556
-#endif
557
 #if PIN_EXISTS(STAT_LED_RED)
536
 #if PIN_EXISTS(STAT_LED_RED)
558
   REPORT_NAME_DIGITAL(STAT_LED_RED_PIN, __LINE__ )
537
   REPORT_NAME_DIGITAL(STAT_LED_RED_PIN, __LINE__ )
559
 #endif
538
 #endif
599
 #if PIN_EXISTS(THERMO_SCK)
578
 #if PIN_EXISTS(THERMO_SCK)
600
   REPORT_NAME_DIGITAL(THERMO_SCK_PIN, __LINE__ )
579
   REPORT_NAME_DIGITAL(THERMO_SCK_PIN, __LINE__ )
601
 #endif
580
 #endif
602
-#if defined(TLC_BLANK_BIT) && TLC_BLANK_BIT >= 0
603
-  REPORT_NAME_DIGITAL(TLC_BLANK_BIT, __LINE__ )
604
-#endif
605
 #if PIN_EXISTS(TLC_BLANK)
581
 #if PIN_EXISTS(TLC_BLANK)
606
   REPORT_NAME_DIGITAL(TLC_BLANK_PIN, __LINE__ )
582
   REPORT_NAME_DIGITAL(TLC_BLANK_PIN, __LINE__ )
607
 #endif
583
 #endif
608
-#if defined(TLC_CLOCK_BIT) && TLC_CLOCK_BIT >= 0
609
-  REPORT_NAME_DIGITAL(TLC_CLOCK_BIT, __LINE__ )
610
-#endif
611
 #if PIN_EXISTS(TLC_CLOCK)
584
 #if PIN_EXISTS(TLC_CLOCK)
612
   REPORT_NAME_DIGITAL(TLC_CLOCK_PIN, __LINE__ )
585
   REPORT_NAME_DIGITAL(TLC_CLOCK_PIN, __LINE__ )
613
 #endif
586
 #endif
614
-#if defined(TLC_DATA_BIT) && TLC_DATA_BIT >= 0
615
-  REPORT_NAME_DIGITAL(TLC_DATA_BIT, __LINE__ )
616
-#endif
617
 #if PIN_EXISTS(TLC_DATA)
587
 #if PIN_EXISTS(TLC_DATA)
618
   REPORT_NAME_DIGITAL(TLC_DATA_PIN, __LINE__ )
588
   REPORT_NAME_DIGITAL(TLC_DATA_PIN, __LINE__ )
619
 #endif
589
 #endif

+ 2
- 2
Marlin/pins_OMCA.h View File

111
 //
111
 //
112
 #define SDSS               11
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
 // future proofing
117
 // future proofing
118
 #define __FS  20
118
 #define __FS  20

+ 1
- 1
Marlin/stepper.cpp View File

1099
   ENABLE_STEPPER_DRIVER_INTERRUPT();
1099
   ENABLE_STEPPER_DRIVER_INTERRUPT();
1100
 
1100
 
1101
   #if ENABLED(ADVANCE) || ENABLED(LIN_ADVANCE)
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
     #if ENABLED(LIN_ADVANCE)
1103
     #if ENABLED(LIN_ADVANCE)
1104
       ZERO(current_adv_steps);
1104
       ZERO(current_adv_steps);
1105
     #endif
1105
     #endif

+ 3
- 3
Marlin/ubl.cpp View File

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

+ 2
- 4
Marlin/ubl_motion.cpp View File

250
     const float m = dy / dx,
250
     const float m = dy / dx,
251
                 c = start[Y_AXIS] - m * start[X_AXIS];
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
      * This block handles vertical lines. These are lines that stay within the same
257
      * This block handles vertical lines. These are lines that stay within the same

Loading…
Cancel
Save