Skip to content

Commit

Permalink
tweaking pinsDebug …
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 12, 2021
1 parent 2e6ebe3 commit 47d96ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 7 additions & 5 deletions Marlin/src/HAL/STM32/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
// make a list of the Arduino pin numbers in the Port/Pin order
//

#define _PIN_ADD_2(NAME_ALPHA, ARDUINO_NUM) { {NAME_ALPHA}, ARDUINO_NUM },
#define _PIN_ADD(NAME_ALPHA, ARDUINO_NUM) { NAME_ALPHA, ARDUINO_NUM },
#define PIN_ADD(NAME) _PIN_ADD(#NAME, NAME)

Expand Down Expand Up @@ -109,8 +108,8 @@ const XrefInfo pin_xref[] PROGMEM = {
* Translation of routines & variables used by pinsDebug.h
*/

#if PA0 > NUM_DIGITAL_PINS
#define HAS_HIGH_ANALOG_PINS 1
#if PA0 >= NUM_DIGITAL_PINS
#define HAS_HIGH_ANALOG_PINS 1
#endif
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS + TERN0(HAS_HIGH_ANALOG_PINS, NUM_ANALOG_INPUTS)
#define VALID_PIN(ANUM) ((ANUM) >= 0 && (ANUM) < NUMBER_PINS_TOTAL)
Expand Down Expand Up @@ -209,8 +208,11 @@ void port_print(const pin_t Ard_num) {
if (Ard_num > NUM_DIGITAL_PINS && calc_p > 7) calc_p += 8;
SERIAL_ECHOPGM(" M42 P", calc_p);
SERIAL_CHAR(' ');
if (calc_p < 10) SERIAL_CHAR(' ');
if (calc_p < 100) SERIAL_CHAR(' ');
if (calc_p < 100) {
SERIAL_CHAR(' ');
if (calc_p < 10)
SERIAL_CHAR(' ');
}
}

bool pwm_status(const pin_t Ard_num) {
Expand Down
15 changes: 7 additions & 8 deletions Marlin/src/gcode/config/M43.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ void GcodeSuite::M43() {

// 'P' Get the range of pins to test or watch
uint8_t first_pin = PARSED_PIN_INDEX('P', 0),
last_pin = parser.seenval('P') ? first_pin : TERN(HAS_HIGH_ANALOG_PINS, NUM_DIGITAL_PINS, NUMBER_PINS_TOTAL) -1;

last_pin = parser.seenval('P') ? first_pin : TERN(HAS_HIGH_ANALOG_PINS, NUM_DIGITAL_PINS, NUMBER_PINS_TOTAL) - 1;

if (first_pin > last_pin) return;

Expand All @@ -334,12 +333,12 @@ void GcodeSuite::M43() {
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
pinMode(pin, INPUT_PULLUP);
delay(1);
/*
if (IS_ANALOG(pin))
pin_state[pin - first_pin] = analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)); // int16_t pin_state[...]
else
//*/
pin_state[i - first_pin] = extDigitalRead(pin);
/*
if (IS_ANALOG(pin))
pin_state[pin - first_pin] = analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)); // int16_t pin_state[...]
else
//*/
pin_state[i - first_pin] = extDigitalRead(pin);
}

#if HAS_RESUME_CONTINUE
Expand Down

0 comments on commit 47d96ee

Please sign in to comment.