From 432b72e7a8238185b20f697818cce091ec19c4e6 Mon Sep 17 00:00:00 2001 From: Ben Lye Date: Thu, 1 Mar 2018 21:14:08 +0000 Subject: [PATCH] Fix DIGITAL_PIN_TO_ANALOG_PIN macro for Atmega1284p (#9883) --- Marlin/pinsDebug.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/pinsDebug.h b/Marlin/pinsDebug.h index a3886122b2..24d058b4f2 100644 --- a/Marlin/pinsDebug.h +++ b/Marlin/pinsDebug.h @@ -26,12 +26,13 @@ bool endstop_monitor_flag = false; // "-" left justify, "28" minimum width of name, pad with blanks #if AVR_ATmega1284_FAMILY - #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(7) && (P) <= analogInputToDigitalPin(0)) -#else + #define DIGITAL_PIN_TO_ANALOG_PIN(P) int(analogInputToDigitalPin(0) - (P)) + #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(7) && (P) <= analogInputToDigitalPin(0)) +#else + #define DIGITAL_PIN_TO_ANALOG_PIN(P) int((P) - analogInputToDigitalPin(0)) #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && ((P) <= analogInputToDigitalPin(15) || (P) <= analogInputToDigitalPin(7))) #endif - /** * This routine minimizes RAM usage by creating a FLASH resident array to * store the pin names, pin numbers and analog/digital flag.