🧑‍💻 Fix pins debug / FastIO issues (#27261)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp
2024-07-14 16:33:11 +12:00
committed by GitHub
parent ad4de747ad
commit ce796cec97
31 changed files with 212 additions and 212 deletions
+12 -12
View File
@@ -63,18 +63,18 @@ inline void toggle_pins() {
for (uint8_t i = start; i <= end; ++i) {
pin_t pin = GET_PIN_MAP_PIN_M43(i);
if (!VALID_PIN(pin)) continue;
if (!isValidPin(pin)) continue;
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) {
report_pin_state_extended(pin, ignore_protection, true, F("Untouched "));
printPinStateExt(pin, ignore_protection, true, F("Untouched "));
SERIAL_EOL();
}
else {
hal.watchdog_refresh();
report_pin_state_extended(pin, ignore_protection, true, F("Pulsing "));
printPinStateExt(pin, ignore_protection, true, F("Pulsing "));
#ifdef __STM32F1__
const auto prior_mode = _GET_MODE(i);
#else
const bool prior_mode = GET_PINMODE(pin);
const bool prior_mode = getValidPinMode(pin);
#endif
#if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO
if (pin == TEENSY_E2) {
@@ -326,14 +326,14 @@ void GcodeSuite::M43() {
bool can_watch = false;
for (uint8_t i = first_pin; i <= last_pin; ++i) {
pin_t pin = GET_PIN_MAP_PIN_M43(i);
if (!VALID_PIN(pin)) continue;
if (!isValidPin(pin)) continue;
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
can_watch = true;
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[...]
if (isAnalogPin(pin))
pin_state[pin - first_pin] = analogRead(digitalPinToAnalogIndex(pin)); // int16_t pin_state[...]
else
//*/
pin_state[i - first_pin] = extDigitalRead(pin);
@@ -369,17 +369,17 @@ void GcodeSuite::M43() {
for (;;) {
for (uint8_t i = first_pin; i <= last_pin; ++i) {
const pin_t pin = GET_PIN_MAP_PIN_M43(i);
if (!VALID_PIN(pin)) continue;
if (!isValidPin(pin)) continue;
if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue;
const byte val =
/*
IS_ANALOG(pin)
? analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)) : // int16_t val
isAnalogPin(pin)
? analogRead(digitalPinToAnalogIndex(pin)) : // int16_t val
:
//*/
extDigitalRead(pin);
if (val != pin_state[i - first_pin]) {
report_pin_state_extended(pin, ignore_protection, true);
printPinStateExt(pin, ignore_protection, true);
pin_state[i - first_pin] = val;
}
}
@@ -398,7 +398,7 @@ void GcodeSuite::M43() {
// Report current state of selected pin(s)
for (uint8_t i = first_pin; i <= last_pin; ++i) {
const pin_t pin = GET_PIN_MAP_PIN_M43(i);
if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true);
if (isValidPin(pin)) printPinStateExt(pin, ignore_protection, true);
}
}
}