Skip to content

Commit

Permalink
Cleanup pins files, fixup analogtodigitalpin, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 8, 2016
1 parent d781929 commit 5ca6334
Showing 38 changed files with 172 additions and 444 deletions.
5 changes: 0 additions & 5 deletions Marlin/Marlin.h
Original file line number Diff line number Diff line change
@@ -52,11 +52,6 @@

typedef unsigned long millis_t;

// Arduino < 1.0.0 does not define this, so we need to do it ourselves
#ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p) + 0xA0)
#endif

#ifdef USBCON
#include "HardwareSerial.h"
#endif
136 changes: 114 additions & 22 deletions Marlin/pins.h
Original file line number Diff line number Diff line change
@@ -23,20 +23,6 @@
#ifndef PINS_H
#define PINS_H

// Preset optional pins
#define X_MS1_PIN -1
#define X_MS2_PIN -1
#define Y_MS1_PIN -1
#define Y_MS2_PIN -1
#define Z_MS1_PIN -1
#define Z_MS2_PIN -1
#define E0_MS1_PIN -1
#define E0_MS2_PIN -1
#define E1_MS1_PIN -1
#define E1_MS2_PIN -1
#define HEATER_3_PIN -1
#define TEMP_3_PIN -1

#if MB(GEN7_CUSTOM)
#include "pins_GEN7_CUSTOM.h"
#elif MB(GEN7_12)
@@ -157,28 +143,132 @@
#error Unknown MOTHERBOARD value set in Configuration.h
#endif

// Define certain undefined pins
#ifndef X_MS1_PIN
#define X_MS1_PIN -1
#endif
#ifndef X_MS2_PIN
#define X_MS2_PIN -1
#endif
#ifndef Y_MS1_PIN
#define Y_MS1_PIN -1
#endif
#ifndef Y_MS2_PIN
#define Y_MS2_PIN -1
#endif
#ifndef Z_MS1_PIN
#define Z_MS1_PIN -1
#endif
#ifndef Z_MS2_PIN
#define Z_MS2_PIN -1
#endif
#ifndef E0_MS1_PIN
#define E0_MS1_PIN -1
#endif
#ifndef E0_MS2_PIN
#define E0_MS2_PIN -1
#endif
#ifndef E1_MS1_PIN
#define E1_MS1_PIN -1
#endif
#ifndef E1_MS2_PIN
#define E1_MS2_PIN -1
#endif

#ifndef FAN_PIN
#define FAN_PIN -1
#endif
#ifndef FAN1_PIN
#define FAN1_PIN -1
#endif
#ifndef FAN2_PIN
#define FAN2_PIN -1
#endif

#ifndef HEATER_0_PIN
#define HEATER_0_PIN -1
#endif
#ifndef HEATER_1_PIN
#define HEATER_1_PIN -1
#endif
#ifndef HEATER_2_PIN
#define HEATER_2_PIN -1
#endif
#ifndef HEATER_3_PIN
#define HEATER_3_PIN -1
#endif
#ifndef HEATER_BED_PIN
#define HEATER_BED_PIN -1
#endif

#ifndef TEMP_0_PIN
#define TEMP_0_PIN -1
#endif
#ifndef TEMP_1_PIN
#define TEMP_1_PIN -1
#endif
#ifndef TEMP_2_PIN
#define TEMP_2_PIN -1
#endif
#ifndef TEMP_3_PIN
#define TEMP_3_PIN -1
#endif
#ifndef TEMP_BED_PIN
#define TEMP_BED_PIN -1
#endif

#ifndef SD_DETECT_PIN
#define SD_DETECT_PIN -1
#endif
#ifndef SDPOWER
#define SDPOWER -1
#endif
#ifndef SDSS
#define SDSS -1
#endif
#ifndef LED_PIN
#define LED_PIN -1
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN -1
#endif
#ifndef KILL_PIN
#define KILL_PIN -1
#endif
#ifndef SUICIDE_PIN
#define SUICIDE_PIN -1
#endif

// Marlin needs to account for pins that equal -1
#define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : (p) + 0xA0)

// List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, analogInputToDigitalPin(TEMP_0_PIN),
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, HEATER_0_PIN, EXTRUDER_0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN),
#define _E1_PINS
#define _E2_PINS
#define _E3_PINS

#if EXTRUDERS > 1
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, analogInputToDigitalPin(TEMP_1_PIN),
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, E1_MS1_PIN, E1_MS2_PIN, EXTRUDER_1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN),
#if EXTRUDERS > 2
#undef _E2_PINS
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, analogInputToDigitalPin(TEMP_2_PIN),
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, EXTRUDER_2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN),
#if EXTRUDERS > 3
#undef _E3_PINS
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, analogInputToDigitalPin(TEMP_3_PIN),
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, EXTRUDER_3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN),
#endif
#endif
#elif ENABLED(Y_DUAL_STEPPER_DRIVERS) || ENABLED(Z_DUAL_STEPPER_DRIVERS)
#undef _E1_PINS
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN,
#endif

#define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN),

//
// Assign endstop pins for boards with only 3 connectors
//
#ifdef X_STOP_PIN
#if X_HOME_DIR < 0
#define X_MIN_PIN X_STOP_PIN
@@ -209,6 +299,9 @@
#endif
#endif

//
// Disable unused endstop / probe pins
//
#if ENABLED(DISABLE_Z_MIN_PROBE_ENDSTOP) || DISABLED(Z_MIN_PROBE_ENDSTOP) // Allow code to compile regardless of Z_MIN_PROBE_ENDSTOP setting.
#undef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN -1
@@ -270,10 +363,9 @@
X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \
Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \
Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, CONTROLLERFAN_PIN, \
EXTRUDER_0_AUTO_FAN_PIN, EXTRUDER_1_AUTO_FAN_PIN, EXTRUDER_2_AUTO_FAN_PIN, EXTRUDER_3_AUTO_FAN_PIN, \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS \
analogInputToDigitalPin(TEMP_BED_PIN) \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLERFAN_PIN, \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS BED_PINS \
X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \
}

#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
20 changes: 0 additions & 20 deletions Marlin/pins_5DPRINT.h
Original file line number Diff line number Diff line change
@@ -54,8 +54,6 @@
#define E0_ENABLE_PIN 17

#define HEATER_0_PIN 21 // Extruder
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 20 // Bed
// You may need to change FAN_PIN to 16 because Marlin isn't using fastio.h
// for the fan and Teensyduino uses a different pin mapping.
@@ -64,14 +62,6 @@
#define TEMP_0_PIN 1 // Extruder / Analog pin numbering
#define TEMP_BED_PIN 0 // Bed / Analog pin numbering

#define TEMP_1_PIN -1
#define TEMP_2_PIN -1

#define SDPOWER -1
#define LED_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1

// The SDSS pin uses a different pin mapping from file Sd2PinMap.h
#define SDSS 20

@@ -85,15 +75,6 @@
// Microstepping pins
// Note that the pin mapping is not from fastio.h
// See Sd2PinMap.h for the pin configurations

#undef X_MS1_PIN
#undef X_MS2_PIN
#undef Y_MS1_PIN
#undef Y_MS2_PIN
#undef Z_MS1_PIN
#undef Z_MS2_PIN
#undef E0_MS1_PIN
#undef E0_MS2_PIN
#define X_MS1_PIN 25
#define X_MS2_PIN 26
#define Y_MS1_PIN 9
@@ -102,4 +83,3 @@
#define Z_MS2_PIN 6
#define E0_MS1_PIN 5
#define E0_MS2_PIN 4

8 changes: 0 additions & 8 deletions Marlin/pins_99.h
Original file line number Diff line number Diff line change
@@ -43,18 +43,10 @@
#define E0_DIR_PIN 66
#define E0_ENABLE_PIN -1

#define SDPOWER -1
#define SDSS 53
#define LED_PIN -1
#define FAN_PIN -1
#define PS_ON_PIN 9
#define KILL_PIN -1

#define HEATER_0_PIN 13
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define TEMP_0_PIN 6 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_1_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_2_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define HEATER_BED_PIN 4
#define TEMP_BED_PIN 10
18 changes: 0 additions & 18 deletions Marlin/pins_A4JP.h
Original file line number Diff line number Diff line change
@@ -38,18 +38,6 @@
#define SLED_PIN -1
#endif

#undef X_MS1_PIN
#undef X_MS2_PIN
#undef Y_MS1_PIN
#undef Y_MS2_PIN
#undef Z_MS1_PIN
#undef Z_MS2_PIN
#undef E0_MS1_PIN
#undef E0_MS2_PIN
#undef E1_MS1_PIN
#undef E1_MS2_PIN

#undef DIGIPOTSS_PIN
//Fan_2 2

/*****************
@@ -108,9 +96,6 @@
#define HEATER_0_PIN 9
#define TEMP_0_PIN 0
#define HEATER_1_PIN 7
#define TEMP_1_PIN -1
#define HEATER_2_PIN -1
#define TEMP_2_PIN -1

#define E0_STEP_PIN 34
#define E0_DIR_PIN 43
@@ -126,13 +111,10 @@
#define DIGIPOTSS_PIN 38
#define DIGIPOT_CHANNELS {4,5,3,0,1} // X Y Z E0 E1 digipot channels to stepper driver mapping

#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 8
#define PS_ON_PIN 4
#define KILL_PIN -1
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
#define FAN_0_PIN 6 //Glen
#define FAN_1_PIN 2 //Glen

8 changes: 0 additions & 8 deletions Marlin/pins_BRAINWAVE.h
Original file line number Diff line number Diff line change
@@ -55,21 +55,13 @@
#define E0_ATT_PIN 20

#define HEATER_0_PIN 4 // Extruder
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 38 // Bed
#define FAN_PIN 3 // Fan

#define TEMP_0_PIN 7 // Extruder / Analog pin numbering
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_BED_PIN 6 // Bed / Analog pin numbering

#define SDPOWER -1
#define SDSS -1
#define LED_PIN 39
#define PS_ON_PIN -1
#define KILL_PIN -1

#if DISABLED(SDSUPPORT)
// these pins are defined in the SD library if building with SD support
6 changes: 0 additions & 6 deletions Marlin/pins_BRAINWAVE_PRO.h
Original file line number Diff line number Diff line change
@@ -60,21 +60,15 @@
#define E0_ENABLE_PIN 13

#define HEATER_0_PIN 15
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 14 // Bed
#define FAN_PIN 16 // Fan, PWM

#define TEMP_0_PIN 2 // Extruder / Analog pin numbering
#define TEMP_1_PIN 1 // Spare / Analog pin numbering
#define TEMP_2_PIN -1
#define TEMP_BED_PIN 0 // Bed / Analog pin numbering

#define SDPOWER -1
#define SDSS 20
#define LED_PIN 19
#define PS_ON_PIN -1
#define KILL_PIN -1
#define SD_DETECT_PIN 12

#if DISABLED(SDSUPPORT)
Loading

0 comments on commit 5ca6334

Please sign in to comment.