diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 3928078d64bcb..39cc1d5689c79 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -1260,8 +1260,8 @@
#define DISABLE_IDLE_E // Shut down all idle extruders
// Default Minimum Feedrates for printing and travel moves
-#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum feedrate. Set with M205 S.
-#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s. °/s for rotational-only moves) Minimum travel feedrate. Set with M205 T.
+#define DEFAULT_MINIMUMFEEDRATE 0.0 // (mm/s) Minimum feedrate. Set with M205 S.
+#define DEFAULT_MINTRAVELFEEDRATE 0.0 // (mm/s) Minimum travel feedrate. Set with M205 T.
// Minimum time that a segment needs to take as the buffer gets emptied
#define DEFAULT_MINSEGMENTTIME 20000 // (µs) Set with M205 B.
diff --git a/Marlin/src/HAL/AVR/pinsDebug.h b/Marlin/src/HAL/AVR/pinsDebug.h
index b4352fdf1fa94..e9bc09a4bf5b4 100644
--- a/Marlin/src/HAL/AVR/pinsDebug.h
+++ b/Marlin/src/HAL/AVR/pinsDebug.h
@@ -22,7 +22,23 @@
#pragma once
/**
- * PWM print routines for Atmel 8 bit AVR CPUs
+ * Pins Debugging for Atmel 8 bit AVR CPUs
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#include "../../inc/MarlinConfig.h"
@@ -39,30 +55,30 @@
#include "pinsDebug_Teensyduino.h"
// Can't use the "digitalPinToPort" function from the Teensyduino type IDEs
// portModeRegister takes a different argument
- #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
- #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
- #define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
- #define getValidPinMode(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin))
+ #define digitalPinToTimer_DEBUG(P) digitalPinToTimer(P)
+ #define digitalPinToBitMask_DEBUG(P) digitalPinToBitMask(P)
+ #define digitalPinToPort_DEBUG(P) digitalPinToPort(P)
+ #define getValidPinMode(P) (*portModeRegister(P) & digitalPinToBitMask_DEBUG(P))
#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
#include "pinsDebug_plus_70.h"
- #define digitalPinToTimer_DEBUG(p) digitalPinToTimer_plus_70(p)
- #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask_plus_70(p)
- #define digitalPinToPort_DEBUG(p) digitalPinToPort_plus_70(p)
+ #define digitalPinToTimer_DEBUG(P) digitalPinToTimer_plus_70(P)
+ #define digitalPinToBitMask_DEBUG(P) digitalPinToBitMask_plus_70(P)
+ #define digitalPinToPort_DEBUG(P) digitalPinToPort_plus_70(P)
bool getValidPinMode(pin_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
#else
- #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
- #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
- #define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
+ #define digitalPinToTimer_DEBUG(P) digitalPinToTimer(P)
+ #define digitalPinToBitMask_DEBUG(P) digitalPinToBitMask(P)
+ #define digitalPinToPort_DEBUG(P) digitalPinToPort(P)
bool getValidPinMode(pin_t pin) {return *portModeRegister(digitalPinToPort_DEBUG(pin)) & digitalPinToBitMask_DEBUG(pin); }
- #define getPinByIndex(p) pgm_read_byte(&pin_array[p].pin)
+ #define getPinByIndex(x) pgm_read_byte(&pin_array[x].pin)
#endif
-#define isValidPin(pin) (pin >= 0 && pin < NUM_DIGITAL_PINS ? 1 : 0)
+#define isValidPin(P) (P >= 0 && P < NUMBER_PINS_TOTAL)
#if AVR_ATmega1284_FAMILY
#define isAnalogPin(P) WITHIN(P, analogInputToDigitalPin(7), analogInputToDigitalPin(0))
#define digitalPinToAnalogIndex(P) int(isAnalogPin(P) ? (P) - analogInputToDigitalPin(7) : -1)
@@ -72,11 +88,11 @@
#define isAnalogPin(P) (_ANALOG1(P) || _ANALOG2(P))
#define digitalPinToAnalogIndex(P) int(_ANALOG1(P) ? (P) - analogInputToDigitalPin(0) : _ANALOG2(P) ? (P) - analogInputToDigitalPin(8) + 8 : -1)
#endif
-#define getPinByIndex(p) pgm_read_byte(&pin_array[p].pin)
+#define getPinByIndex(x) pgm_read_byte(&pin_array[x].pin)
#define MULTI_NAME_PAD 26 // space needed to be pretty if not first name assigned to a pin
-void printPinNameByIndex(uint8_t x) {
- PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[x].name);
+void printPinNameByIndex(const uint8_t index) {
+ PGM_P const name_mem_pointer = (PGM_P)pgm_read_ptr(&pin_array[index].name);
for (uint8_t y = 0; y < MAX_NAME_LENGTH; ++y) {
char temp_char = pgm_read_byte(name_mem_pointer + y);
if (temp_char != 0)
@@ -109,7 +125,7 @@ void printPinNameByIndex(uint8_t x) {
* Print a pin's PWM status.
* Return true if it's currently a PWM pin.
*/
-bool pwm_status(uint8_t pin) {
+bool pwm_status(const uint8_t pin) {
char buffer[20]; // for the sprintf statements
switch (digitalPinToTimer_DEBUG(pin)) {
@@ -276,7 +292,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
if (TEST(*TMSK, TOIE)) err_prob_interrupt();
}
-void printPinPWM(uint8_t pin) {
+void printPinPWM(const uint8_t pin) {
switch (digitalPinToTimer_DEBUG(pin)) {
#if ABTEST(0)
@@ -386,7 +402,7 @@ void printPinPort(const pin_t pin) { // print port number
#endif
}
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3d "), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
#undef ABTEST
diff --git a/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h
index c812d4fb1131b..463a77ec1d084 100644
--- a/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h
+++ b/Marlin/src/HAL/AVR/pinsDebug_Teensyduino.h
@@ -102,7 +102,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
// digitalPinToBitMask(pin) is OK
-#define digitalRead_mod(p) extDigitalRead(p) // Teensyduino's version of digitalRead doesn't
+#define digitalRead_mod(P) extDigitalRead(P) // Teensyduino's version of digitalRead doesn't
// disable the PWMs so we can use it as is
// portModeRegister(pin) is OK
diff --git a/Marlin/src/HAL/DUE/pinsDebug.h b/Marlin/src/HAL/DUE/pinsDebug.h
index e320189ed9556..e9e364dcec77c 100644
--- a/Marlin/src/HAL/DUE/pinsDebug.h
+++ b/Marlin/src/HAL/DUE/pinsDebug.h
@@ -19,13 +19,26 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
- * Support routines for Due
- */
-
-/**
- * Translation of routines & variables used by pinsDebug.h
+ * Pins Debugging for DUE
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#include "../shared/Marduino.h"
@@ -63,20 +76,20 @@
#define NUMBER_PINS_TOTAL PINS_COUNT
-#define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin
+#define digitalRead_mod(P) extDigitalRead(P) // AVR digitalRead disabled PWM before it read the pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
-#define getPinByIndex(p) pin_array[p].pin
-#define getPinIsDigitalByIndex(p) pin_array[p].is_digital
-#define isValidPin(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
-#define digitalPinToAnalogIndex(p) int(p - analogInputToDigitalPin(0))
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%02d"), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define getPinByIndex(x) pin_array[x].pin
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define digitalPinToAnalogIndex(P) int(P - analogInputToDigitalPin(0))
#define isAnalogPin(P) WITHIN(P, pin_t(analogInputToDigitalPin(0)), pin_t(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
-#define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \
- ((g_APinDescription[pin].ulPinAttribute & PIN_ATTR_PWM) == PIN_ATTR_PWM))
+#define pwm_status(P) (((g_pinStatus[P] & 0xF) == PIN_STATUS_PWM) && \
+ ((g_APinDescription[P].ulPinAttribute & PIN_ATTR_PWM) == PIN_ATTR_PWM))
#define MULTI_NAME_PAD 14 // space needed to be pretty if not first name assigned to a pin
-bool getValidPinMode(int8_t pin) { // 1: output, 0: input
+bool getValidPinMode(const pin_t pin) { // 1: output, 0: input
volatile Pio* port = g_APinDescription[pin].pPort;
uint32_t mask = g_APinDescription[pin].ulPin;
uint8_t pin_status = g_pinStatus[pin] & 0xF;
@@ -85,7 +98,7 @@ bool getValidPinMode(int8_t pin) { // 1: output, 0: input
|| pwm_status(pin));
}
-void printPinPWM(int32_t pin) {
+void printPinPWM(const int32_t pin) {
if (pwm_status(pin)) {
uint32_t chan = g_APinDescription[pin].ulPWMChannel;
SERIAL_ECHOPGM("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY);
diff --git a/Marlin/src/HAL/ESP32/fastio.h b/Marlin/src/HAL/ESP32/fastio.h
index c8e3f7e343e97..a85423d768126 100644
--- a/Marlin/src/HAL/ESP32/fastio.h
+++ b/Marlin/src/HAL/ESP32/fastio.h
@@ -37,6 +37,10 @@
// Set pin as output
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT)
+// TODO: Store set modes in an array and use those to get the mode
+#define _IS_OUTPUT(IO) true
+#define _IS_INPUT(IO) true
+
// Set pin as input with pullup mode
#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)
@@ -70,6 +74,9 @@
// Set pin as output and init
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
+#define IS_INPUT(IO) _IS_INPUT(IO)
+
// digitalRead/Write wrappers
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
diff --git a/Marlin/src/HAL/ESP32/ota.cpp b/Marlin/src/HAL/ESP32/ota.cpp
index 01f5924871ff6..be5847b83147e 100644
--- a/Marlin/src/HAL/ESP32/ota.cpp
+++ b/Marlin/src/HAL/ESP32/ota.cpp
@@ -22,11 +22,15 @@
#ifdef ARDUINO_ARCH_ESP32
+#include
+
+#undef ENABLED
+#undef DISABLED
+
#include "../../inc/MarlinConfigPre.h"
#if ALL(WIFISUPPORT, OTASUPPORT)
-#include
#include
#include
#include
diff --git a/Marlin/src/HAL/ESP32/pinsDebug.h b/Marlin/src/HAL/ESP32/pinsDebug.h
new file mode 100644
index 0000000000000..42304b2a0be00
--- /dev/null
+++ b/Marlin/src/HAL/ESP32/pinsDebug.h
@@ -0,0 +1,71 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+#pragma once
+
+#error "PINS_DEBUGGING is not yet supported for ESP32!"
+
+/**
+ * Pins Debugging for ESP32
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
+ */
+
+#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
+#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
+
+#define digitalRead_mod(P) extDigitalRead(P)
+#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%02d"), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define getPinByIndex(x) pin_array[x].pin
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define digitalPinToAnalogIndex(P) int(P - analogInputToDigitalPin(0))
+#define isAnalogPin(P) WITHIN(P, pin_t(analogInputToDigitalPin(0)), pin_t(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
+bool pwm_status(const pin_t) { return false; }
+
+void printPinPort(const pin_t) {}
+
+static bool getValidPinMode(const pin_t pin) {
+ return isValidPin(pin) && !IS_INPUT(pin);
+}
+
+void printPinPWM(const int32_t pin) {
+ if (pwm_status(pin)) {
+ //uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
+ //SERIAL_ECHOPGM("PWM = ", duty);
+ }
+}
diff --git a/Marlin/src/HAL/HC32/pinsDebug.h b/Marlin/src/HAL/HC32/pinsDebug.h
index c00ddf3ba2524..e80b5a081e4db 100644
--- a/Marlin/src/HAL/HC32/pinsDebug.h
+++ b/Marlin/src/HAL/HC32/pinsDebug.h
@@ -18,41 +18,47 @@
*/
#pragma once
+/**
+ * Pins Debugging for HC32
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
+ */
+
#include "../../inc/MarlinConfig.h"
#include "fastio.h"
#include
-//
-// Translation of routines & variables used by pinsDebug.h
-//
#ifndef BOARD_NR_GPIO_PINS
#error "Expected BOARD_NR_GPIO_PINS not found."
#endif
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
-#define isValidPin(pin) IS_GPIO_PIN(pin)
+#define isValidPin(P) IS_GPIO_PIN(P)
// Note: pin_array is defined in `Marlin/src/pins/pinsDebug.h`, and since this file is included
// after it, it is available in this file as well.
-#define getPinByIndex(p) pin_t(pin_array[p].pin)
-#define digitalRead_mod(p) extDigitalRead(p)
-#define printPinNumber(p) \
- do { \
- sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); \
- SERIAL_ECHO(buffer); \
- } while (0)
-#define printPinAnalog(p) \
- do { \
- sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); \
- SERIAL_ECHO(buffer); \
- } while (0)
-#define PRINT_PORT(p) printPinPort(p)
-#define printPinNameByIndex(x) \
- do { \
- sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); \
- SERIAL_ECHO(buffer); \
- } while (0)
+#define getPinByIndex(x) pin_t(pin_array[x].pin)
+#define digitalRead_mod(P) extDigitalRead(P)
+
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(P)); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+
+#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 21 // Space needed to be pretty if not first name assigned to a pin
@@ -71,13 +77,13 @@
#define M43_NEVER_TOUCH(Q) (IS_HOST_USART_PIN(Q) || IS_OSC_PIN(Q))
#endif
-static int8_t digitalPinToAnalogIndex(pin_t pin) {
+int8_t digitalPinToAnalogIndex(const pin_t pin) {
if (!isValidPin(pin)) return -1;
const int8_t adc_channel = int8_t(PIN_MAP[pin].adc_info.channel);
return pin_t(adc_channel);
}
-static bool isAnalogPin(pin_t pin) {
+bool isAnalogPin(pin_t pin) {
if (!isValidPin(pin)) return false;
if (PIN_MAP[pin].adc_info.channel != ADC_PIN_INVALID)
@@ -86,12 +92,12 @@ static bool isAnalogPin(pin_t pin) {
return false;
}
-static bool getValidPinMode(const pin_t pin) {
+bool getValidPinMode(const pin_t pin) {
return isValidPin(pin) && !IS_INPUT(pin);
}
-static bool getPinIsDigitalByIndex(const int16_t array_pin) {
- const pin_t pin = getPinByIndex(array_pin);
+bool getPinIsDigitalByIndex(const int16_t index) {
+ const pin_t pin = getPinByIndex(index);
return (!isAnalogPin(pin));
}
diff --git a/Marlin/src/HAL/LINUX/include/pinmapping.h b/Marlin/src/HAL/LINUX/include/pinmapping.h
index b766f303886d4..0b0e4fd2cdaf8 100644
--- a/Marlin/src/HAL/LINUX/include/pinmapping.h
+++ b/Marlin/src/HAL/LINUX/include/pinmapping.h
@@ -37,29 +37,29 @@ constexpr uint8_t NUM_ANALOG_INPUTS = 16;
constexpr uint8_t analog_offset = NUM_DIGITAL_PINS - NUM_ANALOG_INPUTS;
// Get the digital pin for an analog index
-constexpr pin_t analogInputToDigitalPin(const int8_t p) {
- return (WITHIN(p, 0, NUM_ANALOG_INPUTS) ? analog_offset + p : P_NC);
+constexpr pin_t analogInputToDigitalPin(const int8_t a) {
+ return (WITHIN(a, 0, NUM_ANALOG_INPUTS - 1) ? analog_offset + a : P_NC);
}
// Get the analog index for a digital pin
-constexpr int8_t digitalPinToAnalogIndex(const pin_t p) {
- return (WITHIN(p, analog_offset, NUM_DIGITAL_PINS) ? p - analog_offset : P_NC);
+constexpr int8_t digitalPinToAnalogIndex(const pin_t pin) {
+ return (WITHIN(pin, analog_offset, NUM_DIGITAL_PINS - 1) ? pin - analog_offset : P_NC);
}
// Return the index of a pin number
constexpr int16_t GET_PIN_MAP_INDEX(const pin_t pin) { return pin; }
// Test whether the pin is valid
-constexpr bool isValidPin(const pin_t p) { return WITHIN(p, 0, NUM_DIGITAL_PINS); }
+constexpr bool isValidPin(const pin_t pin) { return WITHIN(pin, 0, NUM_DIGITAL_PINS - 1); }
// Test whether the pin is PWM
-constexpr bool PWM_PIN(const pin_t p) { return false; }
+constexpr bool PWM_PIN(const pin_t) { return false; }
// Test whether the pin is interruptible
-constexpr bool INTERRUPT_PIN(const pin_t p) { return false; }
+constexpr bool INTERRUPT_PIN(const pin_t) { return false; }
// Get the pin number at the given index
-constexpr pin_t GET_PIN_MAP_PIN(const int16_t ind) { return ind; }
+constexpr pin_t GET_PIN_MAP_PIN(const int16_t x) { return pin_t(x); }
// Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
diff --git a/Marlin/src/HAL/LINUX/pinsDebug.h b/Marlin/src/HAL/LINUX/pinsDebug.h
index 59290df6e05bc..aacb626105d11 100644
--- a/Marlin/src/HAL/LINUX/pinsDebug.h
+++ b/Marlin/src/HAL/LINUX/pinsDebug.h
@@ -19,26 +19,46 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
- * Support routines for X86_64
- */
-
-/**
- * Translation of routines & variables used by pinsDebug.h
+ * Pins Debugging for Linux Native
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
-#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0)
-#define digitalRead_mod(p) digitalRead(p)
-#define getPinByIndex(p) pin_array[p].pin
-#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
+#define getPinByIndex(x) pin_array[x].pin
+
+#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
+
// active ADC function/mode/code values for PINSEL registers
-constexpr int8_t ADC_pin_mode(pin_t pin) { return -1; }
+constexpr int8_t ADC_pin_mode(const pin_t) { return -1; }
+
+// The pin and index are the same on this platform
+bool getPinIsDigitalByIndex(const pin_t pin) {
+ return (!isAnalogPin(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
+}
+
+#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0)
+
+#define digitalRead_mod(P) digitalRead(P)
int8_t get_pin_mode(const pin_t pin) { return isValidPin(pin) ? 0 : -1; }
@@ -50,11 +70,11 @@ bool getValidPinMode(const pin_t pin) {
return (Gpio::getMode(pin) != 0); // Input/output state
}
-bool getPinIsDigitalByIndex(const pin_t pin) {
- return (!isAnalogPin(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
-}
-
-void printPinPWM(const pin_t pin) {}
+void printPinPWM(const pin_t) {}
bool pwm_status(const pin_t) { return false; }
void printPinPort(const pin_t) {}
+
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3d "), P); SERIAL_ECHO(buffer); }while(0)
+
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
diff --git a/Marlin/src/HAL/LPC1768/pinsDebug.h b/Marlin/src/HAL/LPC1768/pinsDebug.h
index a520874e2fc69..5baeadd0dd72e 100644
--- a/Marlin/src/HAL/LPC1768/pinsDebug.h
+++ b/Marlin/src/HAL/LPC1768/pinsDebug.h
@@ -19,22 +19,35 @@
* along with this program. If not, see .
*
*/
+#pragma once
/**
- * Support routines for LPC1768
- */
-
-/**
- * Translation of routines & variables used by pinsDebug.h
+ * Pins Debugging for LPC1768/9
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
-#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0)
-#define digitalRead_mod(p) extDigitalRead(p)
-#define getPinByIndex(p) pin_array[p].pin
+#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0)
+#define digitalRead_mod(P) extDigitalRead(P)
+#define getPinByIndex(x) pin_array[x].pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("P%d_%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR("_A%d "), LPC176x::pin_get_adc_channel(pin)); SERIAL_ECHO(buffer); }while(0)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("P%d_%02d"), LPC176x::pin_port(P), LPC176x::pin_bit(P)); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR("_A%d "), LPC176x::pin_get_adc_channel(P)); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 17 // space needed to be pretty if not first name assigned to a pin
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
diff --git a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp
index 6c74821d30396..1354c79b31efa 100644
--- a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp
+++ b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp
@@ -25,7 +25,7 @@
#include "../../inc/MarlinConfig.h"
#include "pinsDebug.h"
-int8_t ADC_pin_mode(pin_t pin) { return -1; }
+int8_t ADC_pin_mode(const pin_t) { return -1; }
int8_t get_pin_mode(const pin_t pin) { return isValidPin(pin) ? 0 : -1; }
@@ -37,6 +37,7 @@ bool getValidPinMode(const pin_t pin) {
return (Gpio::getMode(pin) != 0); // Input/output state
}
+// The pin and index are the same on this platform
bool getPinIsDigitalByIndex(const pin_t pin) {
return !isAnalogPin(pin) || get_pin_mode(pin) != ADC_pin_mode(pin);
}
diff --git a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h
index 8fea5765d8f45..752802d43808f 100644
--- a/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h
+++ b/Marlin/src/HAL/NATIVE_SIM/pinsDebug.h
@@ -19,30 +19,43 @@
* along with this program. If not, see .
*
*/
-
-/**
- * Support routines for X86_64
- */
#pragma once
/**
- * Translation of routines & variables used by pinsDebug.h
+ * Pins Debugging for x86_64
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
-#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0)
-#define digitalRead_mod(p) digitalRead(p)
-#define getPinByIndex(p) pin_array[p].pin
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0)
+#define digitalRead_mod(P) digitalRead(P)
+#define getPinByIndex(x) pin_array[x].pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3d "), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
// Active ADC function/mode/code values for PINSEL registers
-int8_t ADC_pin_mode(pin_t pin);
-int8_t get_pin_mode(const pin_t pin);
-bool getValidPinMode(const pin_t pin);
-bool getPinIsDigitalByIndex(const pin_t pin);
+int8_t ADC_pin_mode(const pin_t);
+int8_t get_pin_mode(const pin_t);
+bool getValidPinMode(const pin_t);
+bool getPinIsDigitalByIndex(const pin_t);
void printPinPort(const pin_t);
void printPinPWM(const pin_t);
bool pwm_status(const pin_t);
diff --git a/Marlin/src/HAL/SAMD21/pinsDebug.h b/Marlin/src/HAL/SAMD21/pinsDebug.h
index cc20f289f6d76..387516aa79309 100644
--- a/Marlin/src/HAL/SAMD21/pinsDebug.h
+++ b/Marlin/src/HAL/SAMD21/pinsDebug.h
@@ -22,41 +22,57 @@
#pragma once
/**
- * SAMD21 HAL developed by Bart Meijer (brupje)
- * Based on SAMD51 HAL by Giuliano Zaro (AKA GMagician)
+ * Pins Debugging for SAMD21
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#define NUMBER_PINS_TOTAL PINS_COUNT
-#define digitalRead_mod(p) extDigitalRead(p)
-#define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0)
+#define digitalRead_mod(P) extDigitalRead(P)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
-#define getPinByIndex(p) pin_array[p].pin
-#define getPinIsDigitalByIndex(p) pin_array[p].is_digital
-#define isValidPin(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL)
-#define isAnalogPin(P) (digitalPinToAnalogIndex(P)!=-1)
-#define pwm_status(pin) digitalPinHasPWM(pin)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3d "), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define getPinByIndex(x) pin_array[x].pin
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define isAnalogPin(P) (digitalPinToAnalogIndex(P) != -1)
+#define pwm_status(P) digitalPinHasPWM(P)
#define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
// uses pin index
#define M43_NEVER_TOUCH(Q) ((Q) >= 75)
-bool getValidPinMode(int8_t pin) { // 1: output, 0: input
+bool getValidPinMode(const int8_t pin) { // 1: output, 0: input
const EPortType samdport = g_APinDescription[pin].ulPort;
const uint32_t samdpin = g_APinDescription[pin].ulPin;
return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN;
}
-void printPinPWM(int32_t pin) {
+void printPinPWM(const int32_t pin) {
if (pwm_status(pin)) {
//uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
//SERIAL_ECHOPGM("PWM = ", duty);
}
}
+void printPinPort(const pin_t) {}
+
/**
* SAMD21 Board pin| PORT | Label
* ----------------+--------+-------
diff --git a/Marlin/src/HAL/SAMD51/pinsDebug.h b/Marlin/src/HAL/SAMD51/pinsDebug.h
index 00f246f21a5db..1518c615c9346 100644
--- a/Marlin/src/HAL/SAMD51/pinsDebug.h
+++ b/Marlin/src/HAL/SAMD51/pinsDebug.h
@@ -22,40 +22,57 @@
#pragma once
/**
- * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
+ * Pins Debugging for SAMD51
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#define NUMBER_PINS_TOTAL PINS_COUNT
-#define digitalRead_mod(p) extDigitalRead(p)
-#define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0)
+#define digitalRead_mod(P) extDigitalRead(P)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
-#define getPinByIndex(p) pin_array[p].pin
-#define getPinIsDigitalByIndex(p) pin_array[p].is_digital
-#define isValidPin(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
-#define isAnalogPin(P) (digitalPinToAnalogIndex(P)!=-1)
-#define pwm_status(pin) digitalPinHasPWM(pin)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3d "), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define getPinByIndex(x) pin_array[x].pin
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define isAnalogPin(P) (digitalPinToAnalogIndex(P) != -1)
+#define pwm_status(P) digitalPinHasPWM(P)
#define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
// uses pin index
#define M43_NEVER_TOUCH(Q) ((Q) >= 75)
-bool getValidPinMode(int8_t pin) { // 1: output, 0: input
+bool getValidPinMode(const int8_t pin) { // 1: output, 0: input
const EPortType samdport = g_APinDescription[pin].ulPort;
const uint32_t samdpin = g_APinDescription[pin].ulPin;
return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN;
}
-void printPinPWM(int32_t pin) {
+void printPinPWM(const int32_t pin) {
if (pwm_status(pin)) {
//uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
//SERIAL_ECHOPGM("PWM = ", duty);
}
}
+void printPinPort(const pin_t) {}
+
/**
* AGCM4 Board pin | PORT | Label
* ----------------+--------+-------
diff --git a/Marlin/src/HAL/STM32/pinsDebug.h b/Marlin/src/HAL/STM32/pinsDebug.h
index cce705410c729..8f4e0b818410e 100644
--- a/Marlin/src/HAL/STM32/pinsDebug.h
+++ b/Marlin/src/HAL/STM32/pinsDebug.h
@@ -21,6 +21,26 @@
*/
#pragma once
+/**
+ * Pins Debugging for STM32
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
+ */
+
#include
#ifndef NUM_DIGITAL_PINS
@@ -34,11 +54,11 @@
* that a CPU has.
*
* VARIABLES:
- * Ard_num - Arduino pin number - defined by the platform. It is used by digitalRead and
- * digitalWrite commands and by M42.
- * - does not contain port/pin info
- * - is not in port/pin order
- * - typically a variant will only assign Ard_num to port/pins that are actually used
+ * A - Arduino pin number - defined by the platform. It is used by digitalRead and
+ * digitalWrite commands and by M42.
+ * - does not contain port/pin info
+ * - is not in port/pin order
+ * - typically a variant will only assign Ard_num to port/pins that are actually used
* Index - M43 counter - only used to get Ard_num
* x - a parameter/argument used to search the pin_array to try to find a signal name
* associated with a Ard_num
@@ -98,15 +118,11 @@ const XrefInfo pin_xref[] PROGMEM = {
#define MODE_PIN_ALT 2 // Alternate function mode
#define MODE_PIN_ANALOG 3 // Analog mode
-#define PIN_NUM(P) (P & 0x000F)
-#define PIN_NUM_ALPHA_LEFT(P) (((P & 0x000F) < 10) ? ('0' + (P & 0x000F)) : '1')
-#define PIN_NUM_ALPHA_RIGHT(P) (((P & 0x000F) > 9) ? ('0' + (P & 0x000F) - 10) : 0 )
-#define PORT_NUM(P) ((P >> 4) & 0x0007)
-#define PORT_ALPHA(P) ('A' + (P >> 4))
-
-/**
- * Translation of routines & variables used by pinsDebug.h
- */
+#define PIN_NUM(P) ((P) & 0x000F)
+#define PIN_NUM_ALPHA_LEFT(P) ((((P) & 0x000F) < 10) ? ('0' + ((P) & 0x000F)) : '1')
+#define PIN_NUM_ALPHA_RIGHT(P) ((((P) & 0x000F) > 9) ? ('0' + ((P) & 0x000F) - 10) : 0 )
+#define PORT_NUM(P) (((P) >> 4) & 0x0007)
+#define PORT_ALPHA(P) ('A' + ((P) >> 4))
#if NUM_ANALOG_FIRST >= NUM_DIGITAL_PINS
#define HAS_HIGH_ANALOG_PINS 1
@@ -116,10 +132,10 @@ const XrefInfo pin_xref[] PROGMEM = {
#endif
#define NUMBER_PINS_TOTAL ((NUM_DIGITAL_PINS) + TERN0(HAS_HIGH_ANALOG_PINS, NUM_ANALOG_INPUTS))
#define isValidPin(P) (WITHIN(P, 0, (NUM_DIGITAL_PINS) - 1) || TERN0(HAS_HIGH_ANALOG_PINS, WITHIN(P, NUM_ANALOG_FIRST, NUM_ANALOG_LAST)))
-#define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads
+#define digitalRead_mod(A) extDigitalRead(A) // must use Arduino pin numbers when doing reads
#define printPinNumber(Q)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
-#define digitalPinToAnalogIndex(ANUM) -1 // will report analog pin number in the print port routine
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define digitalPinToAnalogIndex(P) -1 // will report analog pin number in the print port routine
// x is a variable used to search pin_array
#define getPinIsDigitalByIndex(x) ((bool) pin_array[x].is_digital)
@@ -130,27 +146,27 @@ const XrefInfo pin_xref[] PROGMEM = {
//
// Pin Mapping for M43
//
-#define GET_PIN_MAP_PIN_M43(Index) pin_xref[Index].Ard_num
+#define GET_PIN_MAP_PIN_M43(I) pin_xref[I].Ard_num
#ifndef M43_NEVER_TOUCH
- #define _M43_NEVER_TOUCH(Index) (Index >= 9 && Index <= 12) // SERIAL/USB pins: PA9(TX) PA10(RX) PA11(USB_DM) PA12(USB_DP)
+ #define _M43_NEVER_TOUCH(I) WITHIN(I, 9, 12) // SERIAL/USB pins: PA9(TX) PA10(RX) PA11(USB_DM) PA12(USB_DP)
#ifdef KILL_PIN
- #define M43_NEVER_TOUCH(Index) m43_never_touch(Index)
+ #define M43_NEVER_TOUCH(I) m43_never_touch(I)
- bool m43_never_touch(const pin_t Index) {
+ bool m43_never_touch(const pin_t I) {
static pin_t M43_kill_index = -1;
if (M43_kill_index < 0)
for (M43_kill_index = 0; M43_kill_index < NUMBER_PINS_TOTAL; M43_kill_index++)
if (KILL_PIN == GET_PIN_MAP_PIN_M43(M43_kill_index)) break;
- return _M43_NEVER_TOUCH(Index) || Index == M43_kill_index; // KILL_PIN and SERIAL/USB
+ return _M43_NEVER_TOUCH(I) || I == M43_kill_index; // KILL_PIN and SERIAL/USB
}
#else
- #define M43_NEVER_TOUCH(Index) _M43_NEVER_TOUCH(Index)
+ #define M43_NEVER_TOUCH(I) _M43_NEVER_TOUCH(I)
#endif
#endif
-uint8_t get_pin_mode(const pin_t Ard_num) {
- const PinName dp = digitalPinToPinName(Ard_num);
+uint8_t get_pin_mode(const pin_t A) {
+ const PinName dp = digitalPinToPinName(A);
uint32_t ll_pin = STM_LL_GPIO_PIN(dp);
GPIO_TypeDef *port = get_GPIO_Port(STM_PORT(dp));
uint32_t mode = LL_GPIO_GetPinMode(port, ll_pin);
@@ -164,41 +180,41 @@ uint8_t get_pin_mode(const pin_t Ard_num) {
}
}
-bool getValidPinMode(const pin_t Ard_num) {
- const uint8_t pin_mode = get_pin_mode(Ard_num);
+bool getValidPinMode(const pin_t A) {
+ const uint8_t pin_mode = get_pin_mode(A);
return pin_mode == MODE_PIN_OUTPUT || pin_mode == MODE_PIN_ALT; // assume all alt definitions are PWM
}
-int8_t digital_pin_to_analog_pin(const pin_t Ard_num) {
- if (WITHIN(Ard_num, NUM_ANALOG_FIRST, NUM_ANALOG_LAST))
- return Ard_num - NUM_ANALOG_FIRST;
+int8_t digital_pin_to_analog_pin(const pin_t A) {
+ if (WITHIN(A, NUM_ANALOG_FIRST, NUM_ANALOG_LAST))
+ return A - NUM_ANALOG_FIRST;
- const int8_t ind = digitalPinToAnalogIndex(Ard_num);
+ const int8_t ind = digitalPinToAnalogIndex(A);
return (ind < NUM_ANALOG_INPUTS) ? ind : -1;
}
-bool isAnalogPin(const pin_t Ard_num) {
- return get_pin_mode(Ard_num) == MODE_PIN_ANALOG;
+bool isAnalogPin(const pin_t A) {
+ return get_pin_mode(A) == MODE_PIN_ANALOG;
}
-bool is_digital(const pin_t Ard_num) {
- const uint8_t pin_mode = get_pin_mode(pin_array[Ard_num].pin);
+bool is_digital(const pin_t A) {
+ const uint8_t pin_mode = get_pin_mode(pin_array[A].pin);
return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT;
}
-void printPinPort(const pin_t Ard_num) {
+void printPinPort(const pin_t A) {
char buffer[16];
- pin_t Index;
- for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++)
- if (Ard_num == GET_PIN_MAP_PIN_M43(Index)) break;
+ pin_t I;
+ for (I = 0; I < NUMBER_PINS_TOTAL; I++)
+ if (A == GET_PIN_MAP_PIN_M43(I)) break;
- const char * ppa = pin_xref[Index].Port_pin_alpha;
+ const char * ppa = pin_xref[I].Port_pin_alpha;
sprintf_P(buffer, PSTR("%s"), ppa);
SERIAL_ECHO(buffer);
if (ppa[3] == '\0') SERIAL_CHAR(' ');
// print analog pin number
- const int8_t Port_pin = digital_pin_to_analog_pin(Ard_num);
+ const int8_t Port_pin = digital_pin_to_analog_pin(A);
if (Port_pin >= 0) {
sprintf_P(buffer, PSTR(" (A%d) "), Port_pin);
SERIAL_ECHO(buffer);
@@ -208,8 +224,8 @@ void printPinPort(const pin_t Ard_num) {
SERIAL_ECHO_SP(7);
// Print number to be used with M42
- int calc_p = Ard_num;
- if (Ard_num > NUM_DIGITAL_PINS) {
+ int calc_p = A;
+ if (A > NUM_DIGITAL_PINS) {
calc_p -= NUM_ANALOG_FIRST;
if (calc_p > 7) calc_p += 8;
}
@@ -222,15 +238,15 @@ void printPinPort(const pin_t Ard_num) {
}
}
-bool pwm_status(const pin_t Ard_num) {
- return get_pin_mode(Ard_num) == MODE_PIN_ALT;
+bool pwm_status(const pin_t A) {
+ return get_pin_mode(A) == MODE_PIN_ALT;
}
-void printPinPWM(const pin_t Ard_num) {
+void printPinPWM(const pin_t A) {
#ifndef STM32F1xx
- if (pwm_status(Ard_num)) {
+ if (pwm_status(A)) {
uint32_t alt_all = 0;
- const PinName dp = digitalPinToPinName(Ard_num);
+ const PinName dp = digitalPinToPinName(A);
pin_t pin_number = uint8_t(PIN_NUM(dp));
const bool over_7 = pin_number >= 8;
const uint8_t ind = over_7 ? 1 : 0;
diff --git a/Marlin/src/HAL/STM32F1/pinsDebug.h b/Marlin/src/HAL/STM32F1/pinsDebug.h
index ab8bc8816eaea..9191614587b47 100644
--- a/Marlin/src/HAL/STM32F1/pinsDebug.h
+++ b/Marlin/src/HAL/STM32F1/pinsDebug.h
@@ -22,11 +22,23 @@
#pragma once
/**
- * Support routines for MAPLE_STM32F1
- */
-
-/**
- * Translation of routines & variables used by pinsDebug.h
+ * Pins Debugging for Maple STM32F1
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#ifndef BOARD_NR_GPIO_PINS // Only in MAPLE_STM32F1
@@ -39,11 +51,11 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
-#define isValidPin(pin) (pin >= 0 && pin < BOARD_NR_GPIO_PINS)
-#define getPinByIndex(p) pin_t(pin_array[p].pin)
-#define digitalRead_mod(p) extDigitalRead(p)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
+#define isValidPin(P) (P >= 0 && P < BOARD_NR_GPIO_PINS)
+#define getPinByIndex(x) pin_t(pin_array[x].pin)
+#define digitalRead_mod(P) extDigitalRead(P)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(P)); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 21 // space needed to be pretty if not first name assigned to a pin
@@ -78,8 +90,8 @@ bool getValidPinMode(const pin_t pin) {
return isValidPin(pin) && !IS_INPUT(pin);
}
-bool getPinIsDigitalByIndex(const int16_t array_pin) {
- const pin_t pin = getPinByIndex(array_pin);
+bool getPinIsDigitalByIndex(const int16_t index) {
+ const pin_t pin = getPinByIndex(index);
return (!isAnalogPin(pin)
#ifdef NUM_ANALOG_INPUTS
|| PIN_MAP[pin].adc_channel >= NUM_ANALOG_INPUTS
diff --git a/Marlin/src/HAL/TEENSY31_32/pinsDebug.h b/Marlin/src/HAL/TEENSY31_32/pinsDebug.h
index d4a91ce801c2d..741909bf0a402 100644
--- a/Marlin/src/HAL/TEENSY31_32/pinsDebug.h
+++ b/Marlin/src/HAL/TEENSY31_32/pinsDebug.h
@@ -1 +1,71 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+#pragma once
+
#error "PINS_DEBUGGING is not yet supported for Teensy 3.1 / 3.2!"
+
+/**
+ * Pins Debugging for ESP32
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
+ */
+
+#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
+#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
+
+#define digitalRead_mod(P) extDigitalRead(P)
+#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%02d"), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define getPinByIndex(x) pin_array[x].pin
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define digitalPinToAnalogIndex(P) int(P - analogInputToDigitalPin(0))
+#define isAnalogPin(P) WITHIN(P, pin_t(analogInputToDigitalPin(0)), pin_t(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1)))
+bool pwm_status(const pin_t) { return false; }
+
+void printPinPort(const pin_t) {}
+
+static bool getValidPinMode(const pin_t pin) {
+ return isValidPin(pin) /* && !IS_INPUT(pin) */ ;
+}
+
+void printPinPWM(const int32_t pin) {
+ if (pwm_status(pin)) {
+ //uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
+ //SERIAL_ECHOPGM("PWM = ", duty);
+ }
+}
diff --git a/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h b/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h
index 843905a8510a2..8f2651d3ed438 100644
--- a/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h
+++ b/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h
@@ -48,3 +48,7 @@
#if USING_PULLDOWNS
#error "PULLDOWN pin mode is not available for Teensy 3.5/3.6."
#endif
+
+#if ENABLED(PINS_DEBUGGING)
+ #error "PINS_DEBUGGING is not yet supported for Teensy 3.5/3.6. Needs is_output(pin), etc."
+#endif
diff --git a/Marlin/src/HAL/TEENSY35_36/pinsDebug.h b/Marlin/src/HAL/TEENSY35_36/pinsDebug.h
index 34efc18ccc119..f0f61b8bbe8ff 100644
--- a/Marlin/src/HAL/TEENSY35_36/pinsDebug.h
+++ b/Marlin/src/HAL/TEENSY35_36/pinsDebug.h
@@ -22,7 +22,23 @@
#pragma once
/**
- * HAL Pins Debugging for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
+ * Pins Debugging for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0)
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
@@ -53,6 +69,15 @@
#define TPM1_CH1_PIN 17
#endif
+#define getPinByIndex(x) pin_array[x].pin
+#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define digitalPinToAnalogIndex(P) int(P - analogInputToDigitalPin(0))
+#define getValidPinMode(P) (isValidPin(P) && IS_OUTPUT(P))
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%02d"), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+
#define isAnalogPin(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(9)) || ((P) >= analogInputToDigitalPin(12) && (P) <= analogInputToDigitalPin(20))
void printAnalogPin(char buffer[], int8_t pin) {
@@ -77,7 +102,7 @@ void analog_pin_state(char buffer[], int8_t pin) {
* Print a pin's PWM status.
* Return true if it's currently a PWM pin.
*/
-bool pwm_status(int8_t pin) {
+bool pwm_status(const int8_t pin) {
char buffer[20]; // for the sprintf statements
switch (pin) {
FTM_CASE(0,0);
@@ -108,4 +133,6 @@ bool pwm_status(int8_t pin) {
SERIAL_ECHOPGM(" ");
}
-void printPinPWM(uint8_t pin) { /* TODO */ }
+void printPinPWM(const pin_t) { /* TODO */ }
+
+void printPinPort(const pin_t) {}
diff --git a/Marlin/src/HAL/TEENSY40_41/pinsDebug.h b/Marlin/src/HAL/TEENSY40_41/pinsDebug.h
index 40565491d66c1..3307b3f71fd67 100644
--- a/Marlin/src/HAL/TEENSY40_41/pinsDebug.h
+++ b/Marlin/src/HAL/TEENSY40_41/pinsDebug.h
@@ -22,25 +22,40 @@
#pragma once
/**
- * HAL Pins Debugging for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
+ * Pins Debugging for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
+ *
+ * - NUMBER_PINS_TOTAL
+ * - MULTI_NAME_PAD
+ * - getPinByIndex(index)
+ * - printPinNameByIndex(index)
+ * - getPinIsDigitalByIndex(index)
+ * - digitalPinToAnalogIndex(pin)
+ * - getValidPinMode(pin)
+ * - isValidPin(pin)
+ * - isAnalogPin(pin)
+ * - digitalRead_mod(pin)
+ * - pwm_status(pin)
+ * - printPinPWM(pin)
+ * - printPinPort(pin)
+ * - printPinNumber(pin)
+ * - printPinAnalog(pin)
*/
#warning "PINS_DEBUGGING is not fully supported for Teensy 4.0 / 4.1 so 'M43' may cause hangs."
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
-#define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin
+#define getPinByIndex(x) pin_array[x].pin
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
-#define printPinNumber(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0)
-#define printPinAnalog(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(pin)); SERIAL_ECHO(buffer); }while(0)
-#define getPinByIndex(p) pin_array[p].pin
-#define getPinIsDigitalByIndex(p) pin_array[p].is_digital
-#define isValidPin(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
-#define digitalPinToAnalogIndex(p) int(p - analogInputToDigitalPin(0))
-#define getValidPinMode(PIN) (isValidPin(pin) && IS_OUTPUT(pin))
-#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
-
+#define getPinIsDigitalByIndex(x) pin_array[x].is_digital
+#define digitalPinToAnalogIndex(P) int(P - analogInputToDigitalPin(0))
+#define getValidPinMode(P) (isValidPin(P) && IS_OUTPUT(P))
+#define isValidPin(P) (P >= 0 && P < pin_t(NUMBER_PINS_TOTAL))
#define isAnalogPin(P) (pin_t(P) >= analogInputToDigitalPin(0) && pin_t(P) <= analogInputToDigitalPin(13)) || (pin_t(P) >= analogInputToDigitalPin(14) && pin_t(P) <= analogInputToDigitalPin(17))
+#define digitalRead_mod(P) extDigitalRead(P) // AVR digitalRead disabled PWM before it read the pin
+#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%02d"), P); SERIAL_ECHO(buffer); }while(0)
+#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
+#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
struct pwm_pin_info_struct {
uint8_t type; // 0=no pwm, 1=flexpwm, 2=quad
diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp
index c695cd328fdf8..893607792acdd 100644
--- a/Marlin/src/gcode/config/M43.cpp
+++ b/Marlin/src/gcode/config/M43.cpp
@@ -71,11 +71,13 @@ inline void toggle_pins() {
else {
hal.watchdog_refresh();
printPinStateExt(pin, ignore_protection, true, F("Pulsing "));
- #ifdef __STM32F1__
- const auto prior_mode = _GET_MODE(i);
- #else
- const bool prior_mode = getValidPinMode(pin);
- #endif
+ const auto prior_mode = (
+ #ifdef __STM32F1__
+ _GET_MODE(i)
+ #else
+ getValidPinMode(pin)
+ #endif
+ );
#if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
if (pin == TEENSY_E2) {
SET_OUTPUT(TEENSY_E2);
diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp
index 8d6bb4771a0eb..535ed48039591 100644
--- a/Marlin/src/gcode/host/M360.cpp
+++ b/Marlin/src/gcode/host/M360.cpp
@@ -61,7 +61,9 @@ void GcodeSuite::M360() {
PGMSTR(X_STR, "X");
PGMSTR(Y_STR, "Y");
PGMSTR(Z_STR, "Z");
- PGMSTR(JERK_STR, "Jerk");
+ #if ANY(CLASSIC_JERK, HAS_LINEAR_E_JERK)
+ PGMSTR(JERK_STR, "Jerk");
+ #endif
//
// Basics and Enabled items
diff --git a/buildroot/tests/HC32F460C_aquila_101 b/buildroot/tests/HC32F460C_aquila_101
index 0544720891a73..00b286fa6df11 100755
--- a/buildroot/tests/HC32F460C_aquila_101
+++ b/buildroot/tests/HC32F460C_aquila_101
@@ -8,7 +8,7 @@ set -e
restore_configs
opt_set MOTHERBOARD BOARD_AQUILA_V101 SERIAL_PORT 1
-opt_enable EEPROM_SETTINGS SDSUPPORT EMERGENCY_PARSER
+opt_enable EEPROM_SETTINGS SDSUPPORT EMERGENCY_PARSER PINS_DEBUGGING
exec_test $1 $2 "Default Configuration with Fallback SD EEPROM" "$3"
# cleanup
diff --git a/buildroot/tests/LPC1768 b/buildroot/tests/LPC1768
index 5891ae0d8572a..3a08af8ae82ed 100755
--- a/buildroot/tests/LPC1768
+++ b/buildroot/tests/LPC1768
@@ -17,7 +17,9 @@ restore_configs
opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB SERIAL_PORT_3 3 \
NEOPIXEL_TYPE NEO_RGB RGB_LED_R_PIN P2_12 RGB_LED_G_PIN P1_23 RGB_LED_B_PIN P1_22 RGB_LED_W_PIN P1_24
opt_enable FYSETC_MINI_12864_2_1 SDSUPPORT SDCARD_READONLY SERIAL_PORT_2 RGBW_LED E_DUAL_STEPPER_DRIVERS \
- NEOPIXEL_LED NEOPIXEL_IS_SEQUENTIAL NEOPIXEL_STARTUP_TEST NEOPIXEL_BKGD_INDEX_FIRST NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_COLOR NEOPIXEL_BKGD_TIMEOUT_COLOR NEOPIXEL_BKGD_ALWAYS_ON
+ NEOPIXEL_LED NEOPIXEL_IS_SEQUENTIAL NEOPIXEL_STARTUP_TEST NEOPIXEL_BKGD_INDEX_FIRST NEOPIXEL_BKGD_INDEX_LAST \
+ NEOPIXEL_BKGD_COLOR NEOPIXEL_BKGD_TIMEOUT_COLOR NEOPIXEL_BKGD_ALWAYS_ON \
+ PINS_DEBUGGING
exec_test $1 $2 "ReARM EFB VIKI2, SDSUPPORT, 2 Serial ports (USB CDC + UART0), NeoPixel" "$3"
#restore_configs
diff --git a/buildroot/tests/SAMD51_grandcentral_m4 b/buildroot/tests/SAMD51_grandcentral_m4
index da2cdd30b0d0d..d4c4cea122198 100755
--- a/buildroot/tests/SAMD51_grandcentral_m4
+++ b/buildroot/tests/SAMD51_grandcentral_m4
@@ -27,5 +27,5 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS \
SENSORLESS_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY Z2_STALL_SENSITIVITY \
- EDGE_STEPPING TMC_DEBUG
+ EDGE_STEPPING TMC_DEBUG PINS_DEBUGGING
exec_test $1 $2 "Grand Central M4 with assorted features" "$3"
diff --git a/buildroot/tests/teensy41 b/buildroot/tests/teensy41
index e0e573ca43ff1..6cf3f4aba3a30 100755
--- a/buildroot/tests/teensy41
+++ b/buildroot/tests/teensy41
@@ -28,7 +28,7 @@ opt_enable MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \
PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \
- HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT HOST_STATUS_NOTIFICATIONS
+ HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT HOST_STATUS_NOTIFICATIONS PINS_DEBUGGING
opt_add EXTUI_EXAMPLE
exec_test $1 $2 "Teensy4.1 with many features" "$3"
diff --git a/ini/native.ini b/ini/native.ini
index 69233cdf0001e..5b62c87add5ed 100644
--- a/ini/native.ini
+++ b/ini/native.ini
@@ -83,7 +83,7 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
#
# MacPorts:
-# sudo port install gcc14 glm libsdl2 libsdl2_net
+# sudo port install gcc14 glm mesa libsdl2 libsdl2_net
#
# cd /opt/local/bin
# sudo rm gcc g++ cc ld
@@ -92,24 +92,18 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
# cd -
# rehash
#
-# Use 'sudo port install mesa' to get a if no Xcode is installed.
-# If Xcode is installed be sure to run `xcode-select --install` first.
-#
#==================================================================================
#
# Homebrew:
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
#
-# brew install gcc@14 glm sdl2 sdl2_net
+# brew install gcc@14 glm mesa sdl2 sdl2_net
#
# cd /opt/homebrew/bin
# sudo rm -f gcc g++ cc
# sudo ln -s gcc-14 gcc ; sudo ln -s g++-14 g++ ; sudo ln -s g++ cc
# cd -
#
-# Use 'brew install mesa' to get a if no Xcode is installed.
-# If Xcode is installed be sure to run `xcode-select --install` first.
-#
[simulator_macos]
build_unflags = -g3 -lGL -fstack-protector-strong