Fix CALIBRATION_GCODE pin handling

This commit is contained in:
Scott Lahteine 2020-02-04 08:32:43 -06:00
parent 081ef46e76
commit 7bf2190f03
7 changed files with 61 additions and 13 deletions

View file

@ -840,8 +840,8 @@
// Define the pin to read during calibration // Define the pin to read during calibration
#ifndef CALIBRATION_PIN #ifndef CALIBRATION_PIN
#define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop //#define CALIBRATION_PIN -1 // Define here to override the default pin
#define CALIBRATION_PIN_INVERTING false // Set to true to invert the pin #define CALIBRATION_PIN_INVERTING false // Set to true to invert the custom pin
//#define CALIBRATION_PIN_PULLDOWN //#define CALIBRATION_PIN_PULLDOWN
#define CALIBRATION_PIN_PULLUP #define CALIBRATION_PIN_PULLUP
#endif #endif

View file

@ -1,3 +1,24 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <http://www.gnu.org/licenses/>.
*
*/
/* EEPROM emulation over flash with reduced wear /* EEPROM emulation over flash with reduced wear
* *

View file

@ -128,13 +128,15 @@ inline void park_above_object(measurements_t &m, const float uncertainty) {
#endif #endif
inline bool read_calibration_pin() { inline bool read_calibration_pin() {
#if HAS_CALIBRATION_PIN return (
return (READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING); #if PIN_EXISTS(CALIBRATION)
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING
return (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); #elif HAS_CUSTOM_PROBE_PIN
#else READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING
return (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING); #else
#endif READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING
#endif
);
} }
/** /**

View file

@ -1443,7 +1443,6 @@
#define HAS_Z4_MIN (PIN_EXISTS(Z4_MIN)) #define HAS_Z4_MIN (PIN_EXISTS(Z4_MIN))
#define HAS_Z4_MAX (PIN_EXISTS(Z4_MAX)) #define HAS_Z4_MAX (PIN_EXISTS(Z4_MAX))
#define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE)) #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE))
#define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION))
// //
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface) // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)

View file

@ -1,4 +1,4 @@
/** /**
* Marlin 3D Printer Firmware * Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* *

View file

@ -256,7 +256,7 @@ void Endstops::init() {
#endif #endif
#endif #endif
#if HAS_CALIBRATION_PIN #if PIN_EXISTS(CALIBRATION)
#if ENABLED(CALIBRATION_PIN_PULLUP) #if ENABLED(CALIBRATION_PIN_PULLUP)
SET_INPUT_PULLUP(CALIBRATION_PIN); SET_INPUT_PULLUP(CALIBRATION_PIN);
#elif ENABLED(CALIBRATION_PIN_PULLDOWN) #elif ENABLED(CALIBRATION_PIN_PULLDOWN)

View file

@ -1,3 +1,25 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <http://www.gnu.org/licenses/>.
*
*/
/** /**
* CNControls V15 for HMS434 with DUE pin assignments * CNControls V15 for HMS434 with DUE pin assignments
*/ */
@ -92,6 +114,10 @@
//#define PWM_2_PIN 13 //#define PWM_2_PIN 13
//#define SPARE_IO 17 //#define SPARE_IO 17
#define BEEPER_PIN 13 #define BEEPER_PIN 13
#define CALIBRATION_PIN 66
#define STAT_LED_BLUE_PIN -1 #define STAT_LED_BLUE_PIN -1
#define STAT_LED_RED_PIN 31 #define STAT_LED_RED_PIN 31
// G425 CALIBRATION_GCODE default pin
#ifndef CALIBRATION_PIN
#define CALIBRATION_PIN 66
#endif