2
2
* Marlin 3D Printer Firmware
3
3
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
4
*
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
5
8
* This program is free software: you can redistribute it and/or modify
6
9
* it under the terms of the GNU General Public License as published by
7
10
* the Free Software Foundation, either version 3 of the License, or
@@ -235,9 +238,9 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin");
235
238
236
239
inline void com_print (const uint8_t N , const uint8_t Z ) {
237
240
const uint8_t * TCCRA = (uint8_t * )TCCR_A (N );
238
- SERIAL_ECHOPAIR (" COM" , AS_CHAR ( '0' + N ));
241
+ SERIAL_ECHOPGM (" COM" , AS_DIGIT ( N ));
239
242
SERIAL_CHAR (Z );
240
- SERIAL_ECHOPAIR (": " , int ((* TCCRA >> (6 - Z * 2 )) & 0x03 ));
243
+ SERIAL_ECHOPGM (": " , int ((* TCCRA >> (6 - Z * 2 )) & 0x03 ));
241
244
}
242
245
243
246
void timer_prefix (uint8_t T , char L , uint8_t N ) { // T - timer L - pwm N - WGM bit layout
@@ -247,7 +250,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
247
250
uint8_t WGM = (((* TCCRB & _BV (WGM_2 )) >> 1 ) | (* TCCRA & (_BV (WGM_0 ) | _BV (WGM_1 ))));
248
251
if (N == 4 ) WGM |= ((* TCCRB & _BV (WGM_3 )) >> 1 );
249
252
250
- SERIAL_ECHOPAIR (" TIMER" , AS_CHAR ( T + '0' ));
253
+ SERIAL_ECHOPGM (" TIMER" , AS_DIGIT ( T ));
251
254
SERIAL_CHAR (L );
252
255
SERIAL_ECHO_SP (3 );
253
256
@@ -259,14 +262,14 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
259
262
const uint16_t * OCRVAL16 = (uint16_t * )OCR_VAL (T , L - 'A' );
260
263
PWM_PRINT (* OCRVAL16 );
261
264
}
262
- SERIAL_ECHOPAIR (" WGM: " , WGM );
265
+ SERIAL_ECHOPGM (" WGM: " , WGM );
263
266
com_print (T ,L );
264
- SERIAL_ECHOPAIR (" CS: " , (* TCCRB & (_BV (CS_0 ) | _BV (CS_1 ) | _BV (CS_2 )) ));
265
- SERIAL_ECHOPAIR (" TCCR" , AS_CHAR ( T + '0' ), "A: " , * TCCRA );
266
- SERIAL_ECHOPAIR (" TCCR" , AS_CHAR ( T + '0' ), "B: " , * TCCRB );
267
+ SERIAL_ECHOPGM (" CS: " , (* TCCRB & (_BV (CS_0 ) | _BV (CS_1 ) | _BV (CS_2 )) ));
268
+ SERIAL_ECHOPGM (" TCCR" , AS_DIGIT ( T ), "A: " , * TCCRA );
269
+ SERIAL_ECHOPGM (" TCCR" , AS_DIGIT ( T ), "B: " , * TCCRB );
267
270
268
271
const uint8_t * TMSK = (uint8_t * )TIMSK (T );
269
- SERIAL_ECHOPAIR (" TIMSK" , AS_CHAR ( T + '0' ), ": " , * TMSK );
272
+ SERIAL_ECHOPGM (" TIMSK" , AS_DIGIT ( T ), ": " , * TMSK );
270
273
271
274
const uint8_t OCIE = L - 'A' + 1 ;
272
275
if (N == 3 ) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6 ) err_is_counter (); }
@@ -393,3 +396,4 @@ static void pwm_details(uint8_t pin) {
393
396
#endif
394
397
395
398
#define PRINT_PIN (p ) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
399
+ #define PRINT_PIN_ANALOG (p ) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
0 commit comments