Commit 449d646b authored by MagoKimbra's avatar MagoKimbra

New Update

parent 5d4c2d2b
/**
* Comunication.h - serial messages functions
* Part of Marlin
*
* Author: Simone Primarosa
*/
#ifndef COMUNICATION_H
#define COMUNICATION_H
#ifdef AT90USB
#include "HardwareSerial.h"
#endif
#ifndef __SAM3X8E__
#include "MarlinSerial.h"
#endif
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
#include "WString.h"
#ifdef AT90USB
#ifdef BTENABLED
#define MYSERIAL bt
#else
#define MYSERIAL Serial
#endif // BTENABLED
#else
#ifdef __SAM3X8E__
#define MYSERIAL Serial
#else
#define MYSERIAL MSerial
#endif
#endif
#define START "start" //start for host
#define OK "ok " //ok answer for host
#define ER "Error:" //error for host
#define DB "echo: " //message for user
#define RS "Resend:" //resend for host
#define PAUSE "//action:pause" //command for host that support action
#define RESUME "//action:resume" //command for host that support action
#define DISCONNECT "//action:disconnect" //command for host that support action
#define SERIAL_INIT(baud) MYSERIAL.begin(baud), delay(1)
#define SERIAL_WRITE(x) MYSERIAL.write(x)
#define SERIAL_PRINT(msg, args...) MYSERIAL.print(msg, ##args)
#define SERIAL_ENDL MYSERIAL.println()
FORCE_INLINE void PS_PGM(const char *str) {
char ch;
while ((ch = pgm_read_byte(str++))) { SERIAL_WRITE(ch); }
}
#define ECHO_ENDL SERIAL_ENDL
#define ECHO_PGM(message) PS_PGM(PSTR(message))
#define ECHO_MV(msg, val, args...) ECHO_PGM(msg),ECHO_V(val, ##args)
#define ECHO_VM(val, msg, args...) ECHO_V(val, ##args),ECHO_PGM(msg)
#define ECHO_M(msg) ECHO_PGM(msg)
#define ECHO_V SERIAL_PRINT
#define ECHO_C SERIAL_WRITE
#define ECHO_S(srt) ECHO_PGM(srt)
#define ECHO_E ECHO_ENDL
#define ECHO_SM(srt, msg) ECHO_S(srt),ECHO_M(msg)
#define ECHO_SV(srt, val, args...) ECHO_S(srt),ECHO_V(val, ##args)
#define ECHO_SMV(srt, msg, val, args...) ECHO_S(srt),ECHO_MV(msg, val, ##args)
#define ECHO_SVM(srt, val, msg, args...) ECHO_S(srt),ECHO_VM(val, msg, ##args)
#define ECHO_EM(msg) ECHO_M(msg),ECHO_E
#define ECHO_EV(val, args...) ECHO_V(val, ##args),ECHO_E
#define ECHO_EMV(msg, val, args...) ECHO_MV(msg, val, ##args),ECHO_E
#define ECHO_EVM(val, msg, args...) ECHO_VM(val, msg, ##args),ECHO_E
#define ECHO_LM(srt, msg) ECHO_S(srt),ECHO_M(msg),ECHO_E
#define ECHO_LV(srt, val) ECHO_S(srt),ECHO_V(val),ECHO_E
#define ECHO_LMV(srt, msg, val, args...) ECHO_S(srt),ECHO_MV(msg, val, ##args),ECHO_E
#define ECHO_LVM(srt, val, msg, args...) ECHO_S(srt),ECHO_VM(val, msg, ##args),ECHO_E
#endif
/**
* Conditionals.h
* Defines that depend on configuration but are not editable.
*/
#ifndef CONDITIONALS_H
#ifndef M_PI
#define M_PI 3.1415926536
#endif
#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define CONFIGURATION_LCD
#if defined(MAKRPANEL)
#define DOGLCD
#define SDSUPPORT
#define DEFAULT_LCD_CONTRAST 17
#define ULTIPANEL
#define NEWPANEL
#endif
#if defined(miniVIKI) || defined(VIKI2)
#define ULTRA_LCD //general LCD support, also 16x2
#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
#ifdef miniVIKI
#define DEFAULT_LCD_CONTRAST 95
#else
#define DEFAULT_LCD_CONTRAST 40
#endif
#define ENCODER_PULSES_PER_STEP 4
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#ifdef PANEL_ONE
#define SDSUPPORT
#define ULTIMAKERCONTROLLER
#endif
#ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
#define DOGLCD
#define U8GLIB_ST7920
#define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif
#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
#define ULTIPANEL
#define NEWPANEL
#endif
#if defined(RADDS_DISPLAY)
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 1
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef REPRAPWORLD_KEYPAD
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef RA_CONTROL_PANEL
#define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
#define NEWPANEL
#endif
/**
* I2C PANELS
*/
#ifdef LCD_I2C_SAINSMART_YWROBOT
// This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
// Make sure it is placed in the Arduino libraries directory.
#define LCD_I2C_TYPE_PCF8575
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
#define NEWPANEL
#endif
// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
#ifdef LCD_I2C_PANELOLU2
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
// Note: The PANELOLU2 encoder click input can either be directly connected to a pin
// (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4
#endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#ifdef LCD_USE_I2C_BUZZER
#define LCD_FEEDBACK_FREQUENCY_HZ 1000
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
#endif
#define ULTIPANEL
#define NEWPANEL
#endif
// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
#ifdef LCD_I2C_VIKI
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// Note: The pause/stop/resume LCD button pin should be connected to the Arduino
// BTN_ENC pin (or set BTN_ENC to -1 if not used)
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
#define ULTIPANEL
#define NEWPANEL
#endif
// Shift register panels
// ---------------------
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#ifdef SAV_3DLCD
#define SR_LCD_2W_NL // Non latching 2 wire shiftregister
#define ULTIPANEL
#define NEWPANEL
#endif
#ifdef ULTIPANEL
#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
#define ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 20
#define LCD_HEIGHT 4
#endif
#else //no panel but just LCD
#ifdef ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#endif
#endif
#endif
#ifdef DOGLCD
/* Custom characters defined in font font_6x10_marlin_symbols */
// \x00 intentionally skipped to avoid problems in strings
#define LCD_STR_REFRESH "\x01"
#define LCD_STR_FOLDER "\x02"
#define LCD_STR_ARROW_RIGHT "\x03"
#define LCD_STR_UPLEVEL "\x04"
#define LCD_STR_CLOCK "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_BEDTEMP "\x07"
#define LCD_STR_THERMOMETER "\x08"
#define LCD_STR_DEGREE "\x09"
#define LCD_STR_SPECIAL_MAX '\x09'
// Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
// Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
#else
/* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string!
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
#endif
/**
* Default LCD contrast for dogm-like LCD displays
*/
#if defined(DOGLCD) && !defined(DEFAULT_LCD_CONTRAST)
#define DEFAULT_LCD_CONTRAST 32
#endif
#ifdef DOGLCD
#define HAS_LCD_CONTRAST
#ifdef U8GLIB_ST7920
#undef HAS_LCD_CONTRAST
#endif
#endif
#else // CONFIGURATION_LCD
#define CONDITIONALS_H
#ifndef __SAM3X8E__
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
#endif
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "pins.h"
/**
* ENDSTOPPULLUPS
*/
#ifdef ENDSTOPPULLUPS
#define ENDSTOPPULLUP_XMAX
#define ENDSTOPPULLUP_YMAX
#define ENDSTOPPULLUP_ZMAX
#define ENDSTOPPULLUP_XMIN
#define ENDSTOPPULLUP_YMIN
#define ENDSTOPPULLUP_ZMIN
#define ENDSTOPPULLUP_EMIN
#define ENDSTOPPULLUP_ZPROBE
#endif
/**
* ENDSTOP LOGICAL
*/
#if MB(ALLIGATOR)
#define X_MIN_ENDSTOP_INVERTING !X_MIN_ENDSTOP_LOGIC
#define Y_MIN_ENDSTOP_INVERTING !Y_MIN_ENDSTOP_LOGIC
#define Z_MIN_ENDSTOP_INVERTING !Z_MIN_ENDSTOP_LOGIC
#define E_MIN_ENDSTOP_INVERTING !E_MIN_ENDSTOP_LOGIC
#define X_MAX_ENDSTOP_INVERTING !X_MAX_ENDSTOP_LOGIC
#define Y_MAX_ENDSTOP_INVERTING !Y_MAX_ENDSTOP_LOGIC
#define Z_MAX_ENDSTOP_INVERTING !Z_MAX_ENDSTOP_LOGIC
#define Z_PROBE_ENDSTOP_INVERTING !Z_PROBE_ENDSTOP_LOGIC
#else
#define X_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_LOGIC
#define Y_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_LOGIC
#define Z_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_LOGIC
#define E_MIN_ENDSTOP_INVERTING E_MIN_ENDSTOP_LOGIC
#define X_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_LOGIC
#define Y_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_LOGIC
#define Z_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_LOGIC
#define Z_PROBE_ENDSTOP_INVERTING Z_PROBE_ENDSTOP_LOGIC
#endif
/**
* Firmware Test
*/
#ifdef FIRMWARE_TEST
#undef BAUDRATE
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
#endif
/**
* SINGLENOZZLE
*/
#ifdef SINGLENOZZLE
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#else
#define HOTENDS EXTRUDERS
#endif
/**
* DRIVER_EXTRUDERS
*/
#if !defined(MKR4) && !defined(NPR2)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#endif
/**
* Axis lengths
*/
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
/**
* SCARA
*/
#ifdef SCARA
#undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome
#endif
/**
* DELTA
*/
#ifdef DELTA
#undef SLOWDOWN //DELTA not needs SLOWDOWN
// DELTA must have same valour for 3 axis endstop hits
#undef Y_HOME_BUMP_MM
#undef Z_HOME_BUMP_MM
#define Y_HOME_BUMP_MM X_HOME_BUMP_MM
#define Z_HOME_BUMP_MM X_HOME_BUMP_MM
#endif
/**
* AUTOSET LOCATIONS OF LIMIT SWITCHES
* Added by ZetaPhoenix 09-15-2012
*/
#ifdef MANUAL_HOME_POSITIONS // Use manual limit switch locations
#define X_HOME_POS MANUAL_X_HOME_POS
#define Y_HOME_POS MANUAL_Y_HOME_POS
#define Z_HOME_POS MANUAL_Z_HOME_POS
#else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits
#ifdef BED_CENTER_AT_0_0
#define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5
#define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5
#else
#define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
#define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
#endif
#define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
#endif //!MANUAL_HOME_POSITIONS
/**
* Auto Bed Leveling
*/
#ifdef ENABLE_AUTO_BED_LEVELING
// Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#endif
/**
* Servo Leveling
*/
#define SERVO_LEVELING (NUM_SERVOS > 0 && defined(ENABLE_AUTO_BED_LEVELING))
#define SERVO_LEVELING_DELAY (SERVO_LEVELING && PROBE_SERVO_DEACTIVATION_DELAY > 0)
/**
* MAX_STEP_FREQUENCY differs for TOSHIBA OR ARDUINO DUE OR ARDUINO MEGA
*/
#ifdef __SAM3X8E__
#ifdef CONFIG_STEPPERS_TOSHIBA
#define MAX_STEP_FREQUENCY 120000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else
#define MAX_STEP_FREQUENCY 320000 // Max step frequency for the Due is approx. 330kHz
#define DOUBLE_STEP_FREQUENCY 100000 //96kHz is close to maximum for an Arduino Due
#endif
#else
#ifdef CONFIG_STEPPERS_TOSHIBA
#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
#define DOUBLE_STEP_FREQUENCY MAX_STEP_FREQUENCY
#else
#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Arduino mega
#endif
#endif
// MS1 MS2 Stepper Driver Microstepping mode table
#define MICROSTEP1 LOW,LOW
#define MICROSTEP2 HIGH,LOW
#define MICROSTEP4 LOW,HIGH
#define MICROSTEP8 HIGH,HIGH
#if MB(ALLIGATOR)
#define MICROSTEP16 LOW,LOW
#define MICROSTEP32 HIGH,HIGH
#else
#define MICROSTEP16 HIGH,HIGH
#endif
/**
* Advance calculated values
*/
#ifdef ADVANCE
#define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * M_PI)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA)
#endif
#ifdef ULTIPANEL
#undef SDCARDDETECTINVERTED
#endif
// Power Signal Control Definitions
// By default use Normal definition
#ifndef POWER_SUPPLY
#define POWER_SUPPLY 0
#endif
#if (POWER_SUPPLY == 1) // 1 = ATX
#define PS_ON_AWAKE LOW
#define PS_ON_ASLEEP HIGH
#elif (POWER_SUPPLY == 2) // 2 = X-Box 360 203W
#define PS_ON_AWAKE HIGH
#define PS_ON_ASLEEP LOW
#endif
#define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON))
/**
* Temp Sensor defines
*/
#if TEMP_SENSOR_0 == -2
#define HEATER_0_USES_MAX6675
#elif TEMP_SENSOR_0 == -1
#define HEATER_0_USES_AD595
#elif TEMP_SENSOR_0 == 0
#undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP
#elif TEMP_SENSOR_0 > 0
#define THERMISTORHEATER_0 TEMP_SENSOR_0
#define HEATER_0_USES_THERMISTOR
#endif
#if TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595
#elif TEMP_SENSOR_1 == 0
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#elif TEMP_SENSOR_1 > 0
#define THERMISTORHEATER_1 TEMP_SENSOR_1
#define HEATER_1_USES_THERMISTOR
#endif
#if TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595
#elif TEMP_SENSOR_2 == 0
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#elif TEMP_SENSOR_2 > 0
#define THERMISTORHEATER_2 TEMP_SENSOR_2
#define HEATER_2_USES_THERMISTOR
#endif
#if TEMP_SENSOR_3 == -1
#define HEATER_3_USES_AD595
#elif TEMP_SENSOR_3 == 0
#undef HEATER_3_MINTEMP
#undef HEATER_3_MAXTEMP
#elif TEMP_SENSOR_3 > 0
#define THERMISTORHEATER_3 TEMP_SENSOR_3
#define HEATER_3_USES_THERMISTOR
#endif
#if TEMP_SENSOR_BED == -1
#define BED_USES_AD595
#elif TEMP_SENSOR_BED == 0
#undef BED_MINTEMP
#undef BED_MAXTEMP
#elif TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED
#define BED_USES_THERMISTOR
#endif
/**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS
*/
#if EXTRUDERS > 3
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif EXTRUDERS > 2
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
#elif EXTRUDERS > 1
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#endif
/**
* ARRAY_BY_HOTENDS based on HOTENDS
*/
#if HOTENDS > 3
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif HOTENDS > 2
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2, v3 }
#elif HOTENDS > 1
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1, v2 }
#else
#define ARRAY_BY_HOTENDS(v1, v2, v3, v4) { v1 }
#endif
/**
* Shorthand for pin tests, used wherever needed
*/
#define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 != -2)
#define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0)
#define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0)
#define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0)
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0)
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
#define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN))
#define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN))
#define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN))
#define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN))
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
#define HAS_FAN (PIN_EXISTS(FAN))
#define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
#define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
#define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
#define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
#define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
#define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && PIN_EXISTS(FILWIDTH))
#define HAS_POWER_CONSUMPTION_SENSOR (defined(POWER_CONSUMPTION) && PIN_EXISTS(POWER_CONSUMPTION))
#define HAS_FILRUNOUT (defined(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FILRUNOUT))
#define HAS_HOME (PIN_EXISTS(HOME))
#define HAS_KILL (PIN_EXISTS(KILL))
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
#define HAS_X_MIN (PIN_EXISTS(X_MIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_PROBE (PIN_EXISTS(Z_PROBE))
#define HAS_E_MIN (PIN_EXISTS(E_MIN))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_MICROSTEPS (PIN_EXISTS(X_MS1))
#define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
#define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
#define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
#define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
#define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
#define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
#define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
#define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E0E1 (PIN_EXISTS(E0E1_CHOICE))
#define HAS_E0E2 (PIN_EXISTS(E0E2_CHOICE))
#define HAS_E0E3 (PIN_EXISTS(E0E3_CHOICE))
#define HAS_E0E4 (PIN_EXISTS(E0E4_CHOICE))
#define HAS_E1E3 (PIN_EXISTS(E1E3_CHOICE))
#define HAS_BTN_BACK (PIN_EXISTS(BTN_BACK))
/**
* Helper Macros for heaters and extruder fan
*/
#ifdef INVERTED_HEATER_PINS
#define WRITE_HEATER(pin,value) WRITE(pin,!value)
#else
#define WRITE_HEATER(pin,value) WRITE(pin,value)
#endif
#define WRITE_HEATER_0P(v) WRITE_HEATER(HEATER_0_PIN, v)
#if HOTENDS > 1 || defined(HEATERS_PARALLEL)
#define WRITE_HEATER_1(v) WRITE_HEATER(HEATER_1_PIN, v)
#if HOTENDS > 2
#define WRITE_HEATER_2(v) WRITE_HEATER(HEATER_2_PIN, v)
#if HOTENDS > 3
#define WRITE_HEATER_3(v) WRITE_HEATER(HEATER_3_PIN, v)
#endif
#endif
#endif
#ifdef HEATERS_PARALLEL
#define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
#else
#define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
#endif
#if HAS_HEATER_BED
#define WRITE_HEATER_BED(v) WRITE_HEATER(HEATER_BED_PIN, v)
#endif
#if HAS_FAN
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
/**
* Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h
*/
#define HAS_LCD_FILAMENT_SENSOR (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY))
#define HAS_LCD_POWER_SENSOR (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#endif //CONFIGURATION_LCD
#endif //CONDITIONALS_H
......@@ -20,11 +20,7 @@
// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
<<<<<<< HEAD
#define STRING_VERSION " 4.1.1"
=======
#define STRING_VERSION "4.1.2"
>>>>>>> origin/master
#define STRING_URL "reprap.org"
#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
......@@ -228,16 +224,10 @@
#define K1 0.95 // Smoothing factor within the PID
// HotEnd{HE0,HE1,HE2,HE3}
<<<<<<< HEAD
#define DEFAULT_Kp {40,40,40,40} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {07,07,07,07} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {60,60,60,60} // Kd for E0, E1, E2, E3
=======
#define DEFAULT_Kp {40, 40, 40, 40} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {07, 07, 07, 07} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {60, 60, 60, 60} // Kd for E0, E1, E2, E3
//===========================================================================
>>>>>>> origin/master
//===========================================================================
......@@ -455,38 +445,14 @@ your extruder heater takes 2 minutes to hit the target on heating.
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
//define this to enable EEPROM support
//#define EEPROM_SETTINGS
#define EEPROM_CHITCHAT
//#define EEPROM_CHITCHAT
// to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
// please keep turned on if you can.
//#define DISABLE_M503
//===========================================================================
//====================== EXTRA SETTINGS ON SD ===============================
// Uncomment SD_SETTINGS to enable the firmware to write some configuration,
// that require frequent update, on the SD card.
//#define SD_SETTINGS
#define SD_CFG_SECONDS 60 //seconds between update
#define CFG_SD_FILE "info.cfg" //name of the configuration file
#define CFG_SD_MAX_KEY_LEN 3+1 //icrease this if you add key name longer than the actual value.
#define CFG_SD_MAX_VALUE_LEN 12+1 //this should be enought for int, long and float if you need to retrive strings increase this carefully
//===========================================================================
<<<<<<< HEAD
//=================================== EXTRA SETTINGS ON SD ================================
// Uncomment SD_SETTINGS to enable the firmware to write some configuration, that require frequent update, on the SD card.
#define SD_SETTINGS
#define SD_CFG_SECONDS 10 //seconds between update
#define CFG_SD_FILE "config.cfg" //name of the configuration file
#define CFG_SD_MAX_KEY_LEN 3+1 //icrease this if you add key name longer than the actual value.
#define CFG_SD_MAX_VALUE_LEN 12+1 //this should be enought for int, long and float if you need to retrive strings increase this carefully
//========================= Bowden Filament management ======================
=======
//==================== Bowden Filament management ===========================
>>>>>>> origin/master
//#define EASY_LOAD
#define BOWDEN_LENGTH 250 // mm
......
......@@ -11,7 +11,7 @@
#ifndef CONFIGURATION_ADV_H
#define CONFIGURATION_ADV_H
#include "Conditionals.h"
#include "conditionals.h"
//===========================================================================
//=============================Thermal Settings ============================
......@@ -46,22 +46,17 @@
//The M105 command return, besides traditional information, the ADC value read from temperature sensors.
//#define SHOW_TEMP_ADC_VALUES
<<<<<<< HEAD
// extruder idle oozing prevention
//if the extruder motor is idle for more than SECONDS, and the temperature over MINTEMP, some filament is retracted. The filament retracted is re-added before the next extrusion
//or when the target temperature is less than EXTRUDE_MINTEMP.
=======
//extruder idle oozing prevention
//if the extruder motor is idle for more than SECONDS, and the temperature over MINTEMP,
//some filament is retracted. The filament retracted is re-added before the next extrusion
//or when the target temperature is less than EXTRUDE_MINTEMP and the actual temperature
//is greater than IDLE_OOZING_MINTEMP and less than IDLE_OOZING_FEEDRATE
>>>>>>> origin/master
//#define IDLE_OOZING_PREVENT
#define IDLE_OOZING_MINTEMP EXTRUDE_MINTEMP + 25
#define IDLE_OOZING_MINTEMP EXTRUDE_MINTEMP + 5
#define IDLE_OOZING_MAXTEMP IDLE_OOZING_MINTEMP + 5
#define IDLE_OOZING_FEEDRATE 45 //default feedrate for retracting (mm/s)
#define IDLE_OOZING_SECONDS 10
#define IDLE_OOZING_LENGTH 10 //default retract length (positive mm)
#define IDLE_OOZING_LENGTH 15 //default retract length (positive mm)
#define IDLE_OOZING_RECOVER_LENGTH 0 //default additional recover length (mm, added to retract length when recovering)
#define IDLE_OOZING_RECOVER_FEEDRATE 50 //default feedrate for recovering from retraction (mm/s)
......@@ -526,7 +521,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#endif
#include "Conditionals.h"
#include "SanityCheck.h"
#include "conditionals.h"
#include "sanitycheck.h"
#endif //CONFIGURATION_ADV_H
......@@ -267,8 +267,8 @@ endif
CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp \
MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp \
SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp \
stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
stepper.cpp temperature.cpp cardreader.cpp configuration_store.cpp \
watchdog.cpp SPI.cpp servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
vector_3.cpp qr_solve.cpp
ifeq ($(LIQUID_TWI2), 0)
CXXSRC += LiquidCrystal.cpp
......
......@@ -240,7 +240,9 @@ extern bool axis_known_position[3];
extern float lastpos[4];
extern float zprobe_zoffset;
// Lifetime stats
extern unsigned long printer_usage_seconds; //this can old about 136 year before go overflow. If you belive that you can live more than this please contact me.
extern millis_t config_last_update;
#ifdef PREVENT_DANGEROUS_EXTRUDE
extern float extrude_min_temp;
......@@ -293,15 +295,6 @@ extern int fanSpeed;
extern int laser_ttl_modulation;
#endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
<<<<<<< HEAD
extern unsigned long config_last_update;
=======
extern millis_t config_last_update;
>>>>>>> origin/master
extern bool config_readed;
#endif
extern millis_t print_job_start_ms;
extern millis_t print_job_stop_ms;
......@@ -314,7 +307,16 @@ extern uint8_t active_driver;
extern void digipot_i2c_init();
#endif
// Debug with repetier
/**
* Debug with repetier
*/
enum DebugFlags {
DEBUG_ECHO = BIT(0),
DEBUG_INFO = BIT(1),
DEBUG_ERRORS = BIT(2),
DEBUG_DRYRUN = BIT(3),
DEBUG_COMMUNICATION = BIT(4)
};
extern uint8_t debugLevel;
extern inline bool debugDryrun() {
return ((debugLevel & 8) != 0);
......
/* -*- c++ -*- */
/*
Reprap firmware 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/>.
*/
/*
This firmware is a mashup between Sprinter and grbl.
(https://github.com/kliment/Sprinter)
(https://github.com/simen/grbl/tree)
It has preliminary support for Matthew Roberts advance algorithm
http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
*/
/* All the implementation is done in *.cpp files to get better compatibility with avr-gcc without the Arduino IDE */
/* Use this file to help the Arduino IDE find which Arduino libraries are needed and to keep documentation on GCode */
#include "Configuration.h"
#include "pins.h"
#ifdef ULTRA_LCD
#if defined(LCD_I2C_TYPE_PCF8575)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)
#include <Wire.h>
#include <LiquidTWI2.h>
#elif defined(DOGLCD)
#include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/)
#else
#include <LiquidCrystal.h> // library for character LCD
#endif
#endif
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
#include <SPI.h>
#endif
#if defined(DIGIPOT_I2C)
#include <Wire.h>
#endif
......@@ -36,18 +36,18 @@
#include "motion_control.h"
#include "cardreader.h"
#include "watchdog.h"
#include "ConfigurationStore.h"
#include "configuration_store.h"
#include "language.h"
#include "pins_arduino.h"
#include "math.h"
#ifdef BLINKM
#include "BlinkM.h"
#include "blinkm.h"
#include "Wire.h"
#endif
#if NUM_SERVOS > 0
#include "Servo.h"
#include "servo.h"
#endif
#if HAS_DIGIPOTSS
......@@ -136,7 +136,7 @@
* M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
* Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
* IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
* M111 - Debug mode
* M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
* M112 - Emergency stop
* M114 - Output current position to serial port
* M115 - Capabilities string
......@@ -217,6 +217,8 @@
bool Running = true;
uint8_t debugLevel = DEBUG_INFO|DEBUG_COMMUNICATION;
static float feedrate = 1500.0, next_feedrate, saved_feedrate;
float current_position[NUM_AXIS] = { 0.0 };
float destination[NUM_AXIS] = { 0.0 };
......@@ -244,7 +246,7 @@ float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
uint8_t active_extruder = 0;
uint8_t active_driver = 0;
uint8_t debugLevel = 0;
int fanSpeed = 0;
bool cancel_heatup = false;
......@@ -268,7 +270,9 @@ static uint8_t target_extruder;
bool no_wait_for_cooling = true;
bool target_direction;
// Lifetime stats
unsigned long printer_usage_seconds;
millis_t config_last_update = 0;
#ifndef DELTA
int xy_travel_speed = XY_TRAVEL_SPEED;
......@@ -407,15 +411,6 @@ unsigned long printer_usage_seconds;
#ifdef SDSUPPORT
static bool fromsd[BUFSIZE];
#ifdef SD_SETTINGS
<<<<<<< HEAD
unsigned long config_last_update = 0;
bool config_readed = false;
=======
millis_t config_last_update = 0;
bool config_readed = false;
>>>>>>> origin/master
#endif
#endif
#ifdef FILAMENTCHANGEENABLE
......@@ -701,16 +696,12 @@ void setup() {
for (int8_t i = 0; i < BUFSIZE; i++) fromsd[i] = false;
#endif
// load lifetime stats and power consumation from EEPROM
load_lifetime_stats();
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
// loads custom configuration from SDCARD if available else uses defaults
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
ConfigSD_ResetDefault(); //this reset variable to default value as we can't load in the setup for different reason. Will load the value in the loop()
#else
ConfigSD_RetrieveSettings();
#endif
tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner;
watchdog_init();
......@@ -718,19 +709,7 @@ void setup() {
setup_photpin();
setup_laserbeampin(); // Initialize Laserbeam pin
servo_init();
#ifdef SDSUPPORT
card.initsd();
#endif
// loads custom configuration from SDCARD if available else uses defaults
#ifdef SDSTUPPORT
if(!IS_SD_INSERTED) ConfigSD_ResetDefault();
else
#endif
{
ConfigSD_RetrieveSettings();
}
lcd_init();
_delay_ms(1000); // wait 1sec to display the splash screen
......@@ -789,11 +768,7 @@ void loop() {
if (strstr_P(command, PSTR("M29"))) {
// M29 closes the file
card.closeFile();
<<<<<<< HEAD
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
=======
ECHO_EM(MSG_FILE_SAVED);
>>>>>>> origin/master
}
else {
// Write the string from the read buffer to SD
......@@ -856,7 +831,8 @@ void get_command() {
strchr_pointer = strchr(command, 'N');
gcode_N = (strtol(strchr_pointer + 1, NULL, 10));
if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) {
ECHO_LMV(ER, MSG_ERR_LINE_NO, gcode_LastN);
ECHO_SMV(ER, MSG_ERR_LINE_NO1, gcode_LastN + 1);
ECHO_EMV(MSG_ERR_LINE_NO2, gcode_N);
FlushSerialRequestResend();
serial_count = 0;
return;
......@@ -988,8 +964,11 @@ void get_command() {
}
bool code_has_value() {
char c = strchr_pointer[1];
return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.';
int i = 1;
char c = strchr_pointer[i];
if (c == '-' || c == '+') c = strchr_pointer[++i];
if (c == '.') c = strchr_pointer[++i];
return (c >= '0' && c <= '9');
}
float code_value() {
......@@ -2659,7 +2638,7 @@ inline void gcode_G28(boolean home_x = false, boolean home_y = false) {
homeZ = code_seen(axis_codes[Z_AXIS]),
homeE = code_seen(axis_codes[E_AXIS]);
home_all_axis = !(homeX || homeY || homeZ || homeE) || (homeX && homeY && homeZ);
home_all_axis = (!homeX && !homeY && !homeZ && !homeE) || (homeX && homeY && homeZ);
#ifdef NPR2
if((home_all_axis) || (code_seen(axis_codes[E_AXIS]))) {
......@@ -3844,12 +3823,12 @@ inline void gcode_M42() {
}
}
double X_probe_location, Y_probe_location,
X_current = X_probe_location = st_get_position_mm(X_AXIS),
Y_current = Y_probe_location = st_get_position_mm(Y_AXIS),
double X_current = st_get_position_mm(X_AXIS),
Y_current = st_get_position_mm(Y_AXIS),
Z_current = st_get_position_mm(Z_AXIS),
Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING,
ext_position = st_get_position_mm(E_AXIS);
E_current = st_get_position_mm(E_AXIS),
X_probe_location = X_current, Y_probe_location = Y_current,
Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING;
bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
......@@ -3884,7 +3863,7 @@ inline void gcode_M42() {
st_synchronize();
plan_bed_level_matrix.set_to_identity();
plan_buffer_line(X_current, Y_current, Z_start_location, ext_position, homing_feedrate[Z_AXIS]/60, active_extruder, active_driver);
plan_buffer_line(X_current, Y_current, Z_start_location, E_current, homing_feedrate[Z_AXIS]/60, active_extruder, active_driver);
st_synchronize();
//
......@@ -3895,13 +3874,13 @@ inline void gcode_M42() {
if (verbose_level > 2)
ECHO_LM(DB, "Positioning the probe...");
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, ext_position, homing_feedrate[X_AXIS]/60, active_extruder, active_driver);
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, E_current, homing_feedrate[X_AXIS]/60, active_extruder, active_driver);
st_synchronize();
current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
current_position[E_AXIS] = ext_position = st_get_position_mm(E_AXIS);
current_position[E_AXIS] = E_current = st_get_position_mm(E_AXIS);
//
// OK, do the initial probe to get us close to the bed.
......@@ -3916,7 +3895,7 @@ inline void gcode_M42() {
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, ext_position, homing_feedrate[X_AXIS]/60, active_extruder, active_driver);
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, E_current, homing_feedrate[X_AXIS]/60, active_extruder, active_driver);
st_synchronize();
current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
......@@ -4002,7 +3981,7 @@ inline void gcode_M42() {
if (verbose_level > 0) ECHO_E;
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder, active_driver);
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, E_current, homing_feedrate[Z_AXIS]/60, active_extruder, active_driver);
st_synchronize();
if (deploy_probe_for_each_reading) {
......@@ -4270,7 +4249,7 @@ inline void gcode_M109() {
* M111: Debug mode Repetier Host compatibile
*/
inline void gcode_M111() {
if (code_seen('S')) debugLevel = code_value_short();
debugLevel = code_seen('S') ? code_value_short() : DEBUG_INFO|DEBUG_COMMUNICATION;
if (debugDryrun()) {
ECHO_LM(DB, MSG_DRYRUN_ENABLED);
setTargetBed(0);
......@@ -5734,6 +5713,11 @@ inline void gcode_T() {
*** Process Commands and dispatch them to handlers ***
******************************************************/
void process_commands() {
if ((debugLevel & DEBUG_ECHO)) {
ECHO_LV(DB, command_queue[cmd_queue_index_r]);
}
if(code_seen('G')) {
int gCode = code_value_short();
switch(gCode) {
......@@ -5894,7 +5878,7 @@ void process_commands() {
case 109: // M109 Wait for temperature
gcode_M109(); break;
case 111: // M111 - Debug mode
case 111: // M111 Set debug level
gcode_M111(); break;
case 112: // M112 Emergency Stop
gcode_M112(); break;
......@@ -6540,6 +6524,9 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
&& !ignore_stepper_queue && !blocks_queued())
disable_all_steppers();
// Store in EEPROM Time life and power consumation
if((ms - config_last_update) > 60000UL) save_lifetime_stats();
#ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH
if (chdkActive && ms > chdkHigh + CHDK_DELAY) {
chdkActive = false;
......@@ -6671,30 +6658,6 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
}
}
#endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
if(!config_readed) {
ConfigSD_RetrieveSettings(true);
}
else if((millis() - config_last_update) > SD_CFG_SECONDS*1000) {
ConfigSD_StoreSettings();
}
#endif
#ifdef TEMP_STAT_LEDS
handle_status_leds();
#endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
if(IS_SD_INSERTED && !IS_SD_PRINTING) {
if(!config_readed) {
ConfigSD_RetrieveSettings(true);
ConfigSD_StoreSettings();
}
else if((millis() - config_last_update) > SD_CFG_SECONDS*1000UL) {
ConfigSD_StoreSettings();
}
}
#endif
#ifdef TEMP_STAT_LEDS
handle_status_leds();
......
/**
* SanityCheck.h
*
* Test configuration values for errors at compile-time.
*/
#ifndef SANITYCHECK_H
#define SANITYCHECK_H
/**
* Dual Stepper Drivers
*/
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Y_DUAL_STEPPER_DRIVERS)
#error You cannot have dual stepper drivers for both Y and Z.
#endif
/**
* Progress Bar
*/
#ifdef LCD_PROGRESS_BAR
#ifndef SDSUPPORT
#error LCD_PROGRESS_BAR requires SDSUPPORT.
#endif
#ifdef DOGLCD
#error LCD_PROGRESS_BAR does not apply to graphical displays.
#endif
#ifdef FILAMENT_LCD_DISPLAY
#error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
#endif
#ifdef POWER_CONSUMPTION_LCD_DISPLAY
#error LCD_PROGRESS_BAR and POWER_CONSUMPTION_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
#endif
#endif
/**
* Babystepping
*/
#ifdef BABYSTEPPING
#ifdef COREXY
#error BABYSTEPPING not implemented for COREXY yet.
#endif
#ifdef SCARA
#error BABYSTEPPING is not implemented for SCARA yet.
#endif
#if defined(DELTA) && defined(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on deltabots.
#endif
#endif
/**
* Filament Change with Extruder Runout Prevention
*/
#if defined(FILAMENTCHANGEENABLE) && defined(EXTRUDER_RUNOUT_PREVENT)
#error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE.
#endif
/**
* Extruder Runout Prevention
*/
#if defined(EXTRUDER_RUNOUT_PREVENT) && EXTRUDER_RUNOUT_MINTEMP < EXTRUDE_MINTEMP
#error EXTRUDER_RUNOUT_MINTEMP have to be greater than EXTRUDE_MINTEMP
#endif
/**
* Idle oozing prevent with Extruder Runout Prevention
*/
#if defined(EXTRUDER_RUNOUT_PREVENT) && defined(IDLE_OOZING_PREVENT)
#error EXTRUDER_RUNOUT_PREVENT and IDLE_OOZING_PREVENT are incopatible. Please comment one of them.
#endif
/**
* Idle oozing prevent
*/
#if defined(IDLE_OOZING_PREVENT) && IDLE_OOZING_MINTEMP < EXTRUDE_MINTEMP
#error IDLE_OOZING_MINTEMP have to be greater than EXTRUDE_MINTEMP
#endif
/**
* Options only for EXTRUDERS == 1
*/
#if EXTRUDERS > 1
#if EXTRUDERS > 4
#error The maximum number of EXTRUDERS is 4.
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#error EXTRUDERS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT.
#endif
#ifdef HEATERS_PARALLEL
#error EXTRUDERS must be 1 with HEATERS_PARALLEL.
#endif
#ifdef Y_DUAL_STEPPER_DRIVERS
#error EXTRUDERS must be 1 with Y_DUAL_STEPPER_DRIVERS.
#endif
#ifdef Z_DUAL_STEPPER_DRIVERS
#error EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS.
#endif
#endif // EXTRUDERS > 1
/**
* Limited number of servos
*/
#if NUM_SERVOS > 4
#error The maximum number of SERVOS in Marlin is 4.
#endif
/**
* Required LCD language
*/
#if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN)&& !defined(DISPLAY_CHARSET_HD44780_CYRILLIC)
#error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN or DISPLAY_CHARSET_HD44780_CYRILLIC for your LCD controller.
#endif
/**
* Auto Bed Leveling
*/
#ifdef ENABLE_AUTO_BED_LEVELING
/**
* Require a Z Min pin
*/
#if Z_MIN_PIN == -1
#if Z_PROBE_PIN == -1 || (!defined(Z_PROBE_ENDSTOP) || defined(DISABLE_Z_PROBE_ENDSTOP)) // It's possible for someone to set a pin for the Z Probe, but not enable it.
#ifdef Z_PROBE_REPEATABILITY_TEST
#error You must have a Z_MIN or Z_PROBE endstop to enable Z_PROBE_REPEATABILITY_TEST.
#else
#error ENABLE_AUTO_BED_LEVELING requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_PROBE_PIN must point to a valid hardware pin.
#endif
#endif
#endif
/**
* Require a Z Probe Pin if Z_PROBE_ENDSTOP is enabled.
*/
#if defined(Z_PROBE_ENDSTOP)
#ifndef Z_PROBE_PIN
#error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP
#endif
#if Z_PROBE_PIN == -1
#error You must set Z_PROBE_PIN to a valid pin if you enable Z_PROBE_ENDSTOP
#endif
// Forcing Servo definitions can break some hall effect sensor setups. Leaving these here for further comment.
// #ifndef NUM_SERVOS
// #error You must have NUM_SERVOS defined and there must be at least 1 configured to use Z_PROBE_ENDSTOP
// #endif
// #if defined(NUM_SERVOS) && NUM_SERVOS < 1
// #error You must have at least 1 servo defined for NUM_SERVOS to use Z_PROBE_ENDSTOP
// #endif
// #ifndef SERVO_ENDSTOPS
// #error You must have SERVO_ENDSTOPS defined and have the Z index set to at least 0 or above to use Z_PROBE_ENDSTOP
// #endif
// #ifndef SERVO_ENDSTOP_ANGLES
// #error You must have SERVO_ENDSTOP_ANGLES defined for Z Extend and Retract to use Z_PROBE_AND_ENSTOP
// #endif
#endif
/**
* Check if Probe_Offset * Grid Points is greater than Probing Range
*/
#ifdef AUTO_BED_LEVELING_GRID
// Make sure probing points are reachable
#if LEFT_PROBE_BED_POSITION < MIN_PROBE_X
#error "The given LEFT_PROBE_BED_POSITION can't be reached by the probe."
#elif RIGHT_PROBE_BED_POSITION > MAX_PROBE_X
#error "The given RIGHT_PROBE_BED_POSITION can't be reached by the probe."
#elif FRONT_PROBE_BED_POSITION < MIN_PROBE_Y
#error "The given FRONT_PROBE_BED_POSITION can't be reached by the probe."
#elif BACK_PROBE_BED_POSITION > MAX_PROBE_Y
#error "The given BACK_PROBE_BED_POSITION can't be reached by the probe."
#endif
#define PROBE_SIZE_X (X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1))
#define PROBE_SIZE_Y (Y_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1))
#define PROBE_AREA_WIDTH (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION)
#define PROBE_AREA_DEPTH (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION)
#if X_PROBE_OFFSET_FROM_EXTRUDER < 0
#if PROBE_SIZE_X <= -PROBE_AREA_WIDTH
#define X_PROBE_ERROR
#endif
#elif PROBE_SIZE_X >= PROBE_AREA_WIDTH
#define X_PROBE_ERROR
#endif
#ifdef X_PROBE_ERROR
#error The X axis probing range is too small to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS
#endif
#if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
#if PROBE_SIZE_Y <= -PROBE_AREA_DEPTH
#define Y_PROBE_ERROR
#endif
#elif PROBE_SIZE_Y >= PROBE_AREA_DEPTH
#define Y_PROBE_ERROR
#endif
#ifdef Y_PROBE_ERROR
#error The Y axis probing range is too small to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS
#endif
#undef PROBE_SIZE_X
#undef PROBE_SIZE_Y
#undef PROBE_AREA_WIDTH
#undef PROBE_AREA_DEPTH
#else // !AUTO_BED_LEVELING_GRID
// Check the triangulation points
#if ABL_PROBE_PT_1_X < MIN_PROBE_X || ABL_PROBE_PT_1_X > MAX_PROBE_X
#error "The given ABL_PROBE_PT_1_X can't be reached by the probe."
#elif ABL_PROBE_PT_2_X < MIN_PROBE_X || ABL_PROBE_PT_2_X > MAX_PROBE_X
#error "The given ABL_PROBE_PT_2_X can't be reached by the probe."
#elif ABL_PROBE_PT_3_X < MIN_PROBE_X || ABL_PROBE_PT_3_X > MAX_PROBE_X
#error "The given ABL_PROBE_PT_3_X can't be reached by the probe."
#elif ABL_PROBE_PT_1_Y < MIN_PROBE_Y || ABL_PROBE_PT_1_Y > MAX_PROBE_Y
#error "The given ABL_PROBE_PT_1_Y can't be reached by the probe."
#elif ABL_PROBE_PT_2_Y < MIN_PROBE_Y || ABL_PROBE_PT_2_Y > MAX_PROBE_Y
#error "The given ABL_PROBE_PT_2_Y can't be reached by the probe."
#elif ABL_PROBE_PT_3_Y < MIN_PROBE_Y || ABL_PROBE_PT_3_Y > MAX_PROBE_Y
#error "The given ABL_PROBE_PT_3_Y can't be reached by the probe."
#endif
#endif // !AUTO_BED_LEVELING_GRID
#endif // ENABLE_AUTO_BED_LEVELING
/**
* ULTIPANEL encoder
*/
#if defined(ULTIPANEL) && !defined(NEWPANEL) && !defined(SR_LCD_2W_NL) && !defined(SHIFT_CLK)
#error ULTIPANEL requires some kind of encoder.
#endif
/**
* Delta & Z_PROBE_ENDSTOP
*/
#if defined(DELTA) && defined(Z_PROBE_ENDSTOP)
#ifndef Z_PROBE_PIN
#error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP
#endif
#if Z_PROBE_PIN == -1
#error You must set Z_PROBE_PIN to a valid pin if you enable Z_PROBE_ENDSTOP
#endif
#endif
/**
* Allen Key Z Probe requires Auto Bed Leveling grid and Delta
*/
#if defined(Z_PROBE_ALLEN_KEY) && !(defined(AUTO_BED_LEVELING_GRID) && defined(DELTA))
#error Invalid use of Z_PROBE_ALLEN_KEY.
#endif
/**
* Dual X Carriage requirements
*/
#ifdef DUAL_X_CARRIAGE
#if EXTRUDERS == 1 || defined(COREXY) \
|| !HAS_X2_ENABLE || !HAS_X2_STEP || !HAS_X2_DIR \
|| !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
|| !HAS_X_MAX
#error Missing or invalid definitions for DUAL_X_CARRIAGE mode.
#endif
#if X_HOME_DIR != -1 || X2_HOME_DIR != 1
#error Please use canonical x-carriage assignment.
#endif
#endif // DUAL_X_CARRIAGE
/**
* Make sure auto fan pins don't conflict with the fan pin
*/
#if HAS_AUTO_FAN && HAS_FAN
#if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
#error You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN
#elif EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN
#error You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN
#elif EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN
#error You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN
#elif EXTRUDER_3_AUTO_FAN_PIN == FAN_PIN
#error You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to FAN_PIN
#endif
#endif
#if HAS_FAN && CONTROLLERFAN_PIN == FAN_PIN
#error You cannot set CONTROLLERFAN_PIN equal to FAN_PIN
#endif
/**
* Test required HEATER defines
*/
#if HOTENDS > 3
#if !HAS_HEATER_3
#error HEATER_3_PIN not defined for this board
#endif
#elif HOTENDS > 2
#if !HAS_HEATER_2
#error HEATER_2_PIN not defined for this board
#endif
#elif HOTENDS > 1 || defined(HEATERS_PARALLEL)
#if !HAS_HEATER_1
#error HEATER_1_PIN not defined for this board
#endif
#endif
#if !HAS_HEATER_0
#error HEATER_0_PIN not defined for this board
#endif
#endif //SANITYCHECK_H
/*
Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
The servos are pulsed in the background using the value most recently written using the write() method
Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
The methods are:
Servo - Class for manipulating servo motors connected to Arduino pins.
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180.
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
#include "Configuration.h"
#if NUM_SERVOS > 0
#include <avr/interrupt.h>
#include <Arduino.h>
#include "Servo.h"
#define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009
#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
//#define NBR_TIMERS (MAX_SERVOS / SERVOS_PER_TIMER)
static servo_t servos[MAX_SERVOS]; // static array of servo structures
static volatile int8_t Channel[_Nbr_16timers ]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
uint8_t ServoCount = 0; // the total number of attached servos
// convenience macros
#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo
#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER) // returns the index of the servo on this timer
#define SERVO_INDEX(_timer,_channel) ((_timer*SERVOS_PER_TIMER) + _channel) // macro to access servo index by timer and channel
#define SERVO(_timer,_channel) (servos[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel
#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4) // minimum value in uS for this servo
#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4) // maximum value in uS for this servo
/************ static functions common to all instances ***********************/
static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn, volatile uint16_t* OCRnA) {
if (Channel[timer] < 0)
*TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
else {
if (SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive)
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,LOW); // pulse this channel low if activated
}
Channel[timer]++; // increment to the next channel
if (SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
*OCRnA = *TCNTn + SERVO(timer,Channel[timer]).ticks;
if (SERVO(timer,Channel[timer]).Pin.isActive) // check if activated
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high
}
else {
// finished all channels so wait for the refresh period to expire before starting over
if ( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) ) // allow a few ticks to ensure the next OCR1A not missed
*OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
else
*OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed
Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
}
}
#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
// Interrupt handlers for Arduino
#if defined(_useTimer1)
SIGNAL (TIMER1_COMPA_vect) { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
#endif
#if defined(_useTimer3)
SIGNAL (TIMER3_COMPA_vect) { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
#endif
#if defined(_useTimer4)
SIGNAL (TIMER4_COMPA_vect) { handle_interrupts(_timer4, &TCNT4, &OCR4A); }
#endif
#if defined(_useTimer5)
SIGNAL (TIMER5_COMPA_vect) { handle_interrupts(_timer5, &TCNT5, &OCR5A); }
#endif
#else //!WIRING
// Interrupt handlers for Wiring
#if defined(_useTimer1)
void Timer1Service() { handle_interrupts(_timer1, &TCNT1, &OCR1A); }
#endif
#if defined(_useTimer3)
void Timer3Service() { handle_interrupts(_timer3, &TCNT3, &OCR3A); }
#endif
#endif //!WIRING
static void initISR(timer16_Sequence_t timer) {
#if defined(_useTimer1)
if (timer == _timer1) {
TCCR1A = 0; // normal counting mode
TCCR1B = _BV(CS11); // set prescaler of 8
TCNT1 = 0; // clear the timer count
#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
TIFR |= _BV(OCF1A); // clear any pending interrupts;
TIMSK |= _BV(OCIE1A); // enable the output compare interrupt
#else
// here if not ATmega8 or ATmega128
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
TIMSK1 |= _BV(OCIE1A); // enable the output compare interrupt
#endif
#if defined(WIRING)
timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
#endif
}
#endif
#if defined(_useTimer3)
if (timer == _timer3) {
TCCR3A = 0; // normal counting mode
TCCR3B = _BV(CS31); // set prescaler of 8
TCNT3 = 0; // clear the timer count
#if defined(__AVR_ATmega128__)
TIFR |= _BV(OCF3A); // clear any pending interrupts;
ETIMSK |= _BV(OCIE3A); // enable the output compare interrupt
#else
TIFR3 = _BV(OCF3A); // clear any pending interrupts;
TIMSK3 = _BV(OCIE3A) ; // enable the output compare interrupt
#endif
#if defined(WIRING)
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
#endif
}
#endif
#if defined(_useTimer4)
if (timer == _timer4) {
TCCR4A = 0; // normal counting mode
TCCR4B = _BV(CS41); // set prescaler of 8
TCNT4 = 0; // clear the timer count
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
TIMSK4 = _BV(OCIE4A) ; // enable the output compare interrupt
}
#endif
#if defined(_useTimer5)
if (timer == _timer5) {
TCCR5A = 0; // normal counting mode
TCCR5B = _BV(CS51); // set prescaler of 8
TCNT5 = 0; // clear the timer count
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
TIMSK5 = _BV(OCIE5A) ; // enable the output compare interrupt
}
#endif
}
static void finISR(timer16_Sequence_t timer) {
// Disable use of the given timer
#if defined(WIRING)
if (timer == _timer1) {
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
TIMSK1
#else
TIMSK
#endif
&= ~_BV(OCIE1A); // disable timer 1 output compare interrupt
timerDetach(TIMER1OUTCOMPAREA_INT);
}
else if (timer == _timer3) {
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
TIMSK3
#else
ETIMSK
#endif
&= ~_BV(OCIE3A); // disable the timer3 output compare A interrupt
timerDetach(TIMER3OUTCOMPAREA_INT);
}
#else //!WIRING
// For arduino - in future: call here to a currently undefined function to reset the timer
#endif
}
static boolean isTimerActive(timer16_Sequence_t timer) {
// returns true if any servo is active on this timer
for(uint8_t channel=0; channel < SERVOS_PER_TIMER; channel++) {
if (SERVO(timer,channel).Pin.isActive)
return true;
}
return false;
}
/****************** end of static functions ******************************/
Servo::Servo() {
if ( ServoCount < MAX_SERVOS) {
this->servoIndex = ServoCount++; // assign a servo index to this instance
servos[this->servoIndex].ticks = usToTicks(DEFAULT_PULSE_WIDTH); // store default values - 12 Aug 2009
}
else
this->servoIndex = INVALID_SERVO; // too many servos
}
uint8_t Servo::attach(int pin) {
return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
}
uint8_t Servo::attach(int pin, int min, int max) {
if (this->servoIndex < MAX_SERVOS ) {
#if defined(ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if (pin > 0) this->pin = pin; else pin = this->pin;
#endif
pinMode(pin, OUTPUT); // set servo pin to output
servos[this->servoIndex].Pin.nbr = pin;
// todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
this->min = (MIN_PULSE_WIDTH - min) / 4; //resolution of min/max is 4 uS
this->max = (MAX_PULSE_WIDTH - max) / 4;
// initialize the timer if it has not already been initialized
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
if (!isTimerActive(timer)) initISR(timer);
servos[this->servoIndex].Pin.isActive = true; // this must be set after the check for isTimerActive
}
return this->servoIndex;
}
void Servo::detach() {
servos[this->servoIndex].Pin.isActive = false;
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
if (!isTimerActive(timer)) finISR(timer);
}
void Servo::write(int value) {
if (value < MIN_PULSE_WIDTH) { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
if (value < 0) value = 0;
if (value > 180) value = 180;
value = map(value, 0, 180, SERVO_MIN(), SERVO_MAX());
}
this->writeMicroseconds(value);
}
void Servo::writeMicroseconds(int value) {
// calculate and store the values for the given channel
byte channel = this->servoIndex;
if (channel < MAX_SERVOS) { // ensure channel is valid
if (value < SERVO_MIN()) // ensure pulse width is valid
value = SERVO_MIN();
else if (value > SERVO_MAX())
value = SERVO_MAX();
value = value - TRIM_DURATION;
value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009
uint8_t oldSREG = SREG;
cli();
servos[channel].ticks = value;
SREG = oldSREG;
}
}
// return the value as degrees
int Servo::read() { return map( this->readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180); }
int Servo::readMicroseconds() {
return (this->servoIndex == INVALID_SERVO) ? 0 : ticksToUs(servos[this->servoIndex].ticks) + TRIM_DURATION;
}
bool Servo::attached() { return servos[this->servoIndex].Pin.isActive; }
#endif
/*
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
The servos are pulsed in the background using the value most recently written using the write() method
Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
The sequence used to seize timers is defined in timers.h
The methods are:
Servo - Class for manipulating servo motors connected to Arduino pins.
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180.
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
#ifndef Servo_h
#define Servo_h
#include <inttypes.h>
/*
* Defines for 16 bit timers used with Servo library
*
* If _useTimerX is defined then TimerX is a 16 bit timer on the current board
* timer16_Sequence_t enumerates the sequence that the timers should be allocated
* _Nbr_16timers indicates how many 16 bit timers are available.
*
*/
// Say which 16 bit timers can be used and in what order
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define _useTimer5
//#define _useTimer1
#define _useTimer3
#define _useTimer4
//typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer5, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_ATmega32U4__)
//#define _useTimer1
#define _useTimer3
//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define _useTimer3
//#define _useTimer1
//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) ||defined(__AVR_ATmega2561__)
#define _useTimer3
//#define _useTimer1
//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#else // everything else
//#define _useTimer1
//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _Nbr_16timers } timer16_Sequence_t ;
#endif
#define Servo_VERSION 2 // software version of this library
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
#define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
#define INVALID_SERVO 255 // flag indicating an invalid servo index
typedef struct {
uint8_t nbr :6 ; // a pin number from 0 to 63
uint8_t isActive :1 ; // true if this channel is enabled, pin not pulsed if false
} ServoPin_t;
typedef struct {
ServoPin_t Pin;
unsigned int ticks;
} servo_t;
class Servo {
public:
Servo();
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
void detach();
void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
void writeMicroseconds(int value); // Write pulse width in microseconds
int read(); // returns current pulse width as an angle between 0 and 180 degrees
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
bool attached(); // return true if this servo is attached, otherwise false
#if defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0
int pin; // store the hardware pin of the servo
#endif
private:
uint8_t servoIndex; // index into the channel data for this servo
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
};
#endif
/*
BlinkM.cpp - Library for controlling a BlinkM over i2c
blinkm.cpp - Library for controlling a BlinkM over i2c
Created by Tim Koster, August 21 2013.
*/
#include "Marlin.h"
#ifdef BLINKM
#include "BlinkM.h"
#include "blinkm.h"
void SendColors(byte red, byte grn, byte blu) {
Wire.begin();
......
/*
BlinkM.h
blinkm.h
Library header file for BlinkM library
*/
#if ARDUINO >= 100
......
......@@ -21,9 +21,14 @@
#define BOARD_RAMBO 301 // Rambo
#define BOARD_DUEMILANOVE_328P 4 // Duemilanove w/ ATMega328P pin assignments
#define BOARD_RADDS 402 // RADDS
#define BOARD_RAMPS_FDV1 403 // RAMPS-FD V1
#define BOARD_RAMPS_FDV2 404 // RAMPS-FD V2
#define BOARD_RAMPS4DUE 433 // RAMPS4DUE with AndrewBCN's RAMPS mods (http://forums.reprap.org/read.php?219,479626,page=1)
#define BOARD_GEN6 5 // Gen6
#define BOARD_GEN6_DELUXE 51 // Gen6 deluxe
#define BOARD_ALLIGATOR 502 // ALLIGATOR R2 ARM 32
#define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2
#define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above
......
......@@ -186,32 +186,6 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/,
if (file.isOpen()) { //replacing current file by new file, or subfile call
if (!replace_current) {
if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
<<<<<<< HEAD
SERIAL_ERROR_START;
SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");
SERIAL_ERRORLN(SD_PROCEDURE_DEPTH);
kill();
return;
}
SERIAL_ECHO_START;
SERIAL_ECHOPGM("SUBROUTINE CALL target:\"");
SERIAL_ECHO(name);
SERIAL_ECHOPGM("\" parent:\"");
//store current filename and position
getAbsFilename(filenames[file_subcall_ctr]);
SERIAL_ECHO(filenames[file_subcall_ctr]);
SERIAL_ECHOPGM("\" pos");
SERIAL_ECHOLN(sdpos);
filespos[file_subcall_ctr] = sdpos;
file_subcall_ctr++;
}
else {
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Now doing file: ");
SERIAL_ECHOLN(name);
=======
ECHO_LMV(ER, MSG_SD_MAX_DEPTH, SD_PROCEDURE_DEPTH);
kill();
return;
......@@ -221,7 +195,6 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/,
filespos[file_subcall_ctr] = sdpos;
file_subcall_ctr++;
>>>>>>> origin/master
}
file.close();
}
......@@ -277,22 +250,11 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/,
else { //write
if (file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
saving = true;
<<<<<<< HEAD
SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
SERIAL_PROTOCOLLN(name);
if(lcd_status) lcd_setstatus(fname);
}
else {
SERIAL_PROTOCOLPGM(MSG_SD_OPEN_FILE_FAIL);
SERIAL_PROTOCOL(fname);
SERIAL_PROTOCOLCHAR('.');
=======
ECHO_LMV(OK, MSG_SD_WRITE_TO_FILE, name);
if(lcd_status) lcd_setstatus(fname);
}
else {
ECHO_LMV(ER, MSG_SD_OPEN_FILE_FAIL,fname);
>>>>>>> origin/master
}
}
}
......@@ -419,94 +381,6 @@ void CardReader::closeFile(bool store_location) {
}
}
void CardReader::parseKeyLine(char *key, char *value, int &len_k, int &len_v) {
if (!cardOK || !isFileOpen()) return;
int ln_buf = 0;
char ln_char;
bool ln_space = false, ln_ignore = false, key_found = false;
while(!eof()) { //READ KEY
ln_char = (char)get();
if(ln_char == '\n') {
ln_buf = 0;
ln_ignore = false; //We've reached a new line try to find a key again
continue;
}
if(ln_ignore) continue;
if(ln_char == ' ') {
ln_space = true;
continue;
}
if(ln_char == '=') {
key[ln_buf] = '\0';
len_k = ln_buf;
key_found = true;
break; //key finded and buffered
}
if(ln_char == ';' || ln_buf+1 >= len_k || ln_space && ln_buf > 0) { //comments on key is not allowd. Also key len can't be longer than len_k or contain spaces. Stop buffering and try the next line
ln_ignore = true;
continue;
}
ln_space = false;
key[ln_buf] = ln_char;
ln_buf++;
}
if(!key_found) { //definitly there isn't no more key that can be readed in the file
key[0] = '\0';
value[0] = '\0';
len_k = 0;
len_v = 0;
return;
}
ln_buf = 0;
ln_ignore = false;
while(!eof()) { //READ VALUE
ln_char = (char)get();
if(ln_char == '\n') {
value[ln_buf] = '\0';
len_v = ln_buf;
break; //new line reached, we can stop
}
if(ln_ignore|| ln_char == ' ' && ln_buf == 0) continue; //ignore also initial spaces of the value
if(ln_char == ';' || ln_buf+1 >= len_v) { //comments reached or value len longer than len_v. Stop buffering and go to the next line.
ln_ignore = true;
continue;
}
value[ln_buf] = ln_char;
ln_buf++;
}
}
void CardReader::unparseKeyLine(const char *key, char *value) {
if (!cardOK || !isFileOpen()) return;
file.writeError = false;
file.write(key);
if (file.writeError) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
return;
}
file.writeError = false;
file.write("=");
if (file.writeError) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
return;
}
file.writeError = false;
file.write(value);
if (file.writeError) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
return;
}
file.writeError = false;
file.write("\n");
if (file.writeError) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
}
}
/**
* File parser for KEY->VALUE format from files
*
......
......@@ -18,17 +18,10 @@ public:
//this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset
void checkautostart(bool x);
<<<<<<< HEAD
void openFile(char* name,bool read,bool replace_current=true, bool lcd_status=true);
void openLogFile(char* name);
void removeFile(char* name);
void closeFile(bool store_location=false);
=======
void openFile(char* name, bool read, bool replace_current = true, bool lcd_status = true);
void openLogFile(char* name);
void removeFile(char* name);
void closeFile(bool store_location = false);
>>>>>>> origin/master
void parseKeyLine(char *key, char *value, int &len_k, int &len_v);
void unparseKeyLine(const char *key, char *value);
void release();
......
/**
* ConfigurationStore.cpp
* configuration_store.cpp
*
* Configuration and EEPROM storage
*
......@@ -95,13 +95,13 @@
*
*
*/
#include "Marlin.h"
#include "language.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
#include "cardreader.h"
#include "ConfigurationStore.h"
#include "configuration_store.h"
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
uint8_t c;
......@@ -115,6 +115,7 @@ void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
value++;
};
}
void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
do {
*value = eeprom_read_byte((unsigned char*)pos);
......@@ -122,6 +123,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
value++;
} while (--size);
}
#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value))
#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value))
......@@ -130,6 +132,8 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
#define DUMMY_PID_VALUE 3000.0f
#define EEPROM_OFFSET 100
#define LIFETIME_EEPROM_OFFSET 600
#define LIFETIME_MAGIC "L99"
#ifdef EEPROM_SETTINGS
......@@ -555,31 +559,9 @@ void Config_ResetDefault() {
idleoozing_enabled = true;
#endif
<<<<<<< HEAD
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
=======
ECHO_LM(DB, "Hardcoded Default Settings Loaded");
}
void ConfigSD_ResetDefault() {
#ifdef POWER_CONSUMPTION
power_consumption_hour = 0;
#endif
printer_usage_seconds = 0;
ECHO_LM(DB, "Hardcoded SD Default Settings Loaded");
>>>>>>> origin/master
}
void ConfigSD_ResetDefault() {
#ifdef POWER_CONSUMPTION
power_consumption_hour = 0;
#endif
printer_usage_seconds = 0;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Hardcoded SD Default Settings Loaded");
}
#ifndef DISABLE_M503
void Config_PrintSettings(bool forReplay) {
......@@ -811,30 +793,10 @@ void Config_PrintSettings(bool forReplay) {
ECHO_LM(DB, "Filament settings: Disabled");
}
}
<<<<<<< HEAD
=======
if (printer_usage_seconds > 0) ConfigSD_PrintSettings(forReplay);
>>>>>>> origin/master
}
void ConfigSD_PrintSettings(bool forReplay) {
// Always have this function, even with SD_SETTINGS disabled, the current values will be shown
// Print Lifetime stats
#ifdef POWER_CONSUMPTION
if (!forReplay) {
<<<<<<< HEAD
SERIAL_ECHOLNPGM("Watt/h consumed:");
SERIAL_ECHO_START;
}
SERIAL_ECHOPAIR(" W/h", power_consumption_hour);
SERIAL_EOL;
#endif
if (!forReplay) {
SERIAL_ECHOLNPGM("Power on time:");
SERIAL_ECHO_START;
}
SERIAL_ECHOPAIR(" s", printer_usage_seconds);
SERIAL_EOL;
=======
ECHO_LM(DB, "Watt/h consumed:");
}
ECHO_LVM(DB, power_consumption_hour," W/h");
......@@ -846,87 +808,50 @@ void ConfigSD_PrintSettings(bool forReplay) {
int hours = printer_usage_seconds / 60 / 60, minutes = (printer_usage_seconds / 60) % 60;
sprintf_P(time, PSTR("%i " MSG_END_HOUR " %i " MSG_END_MINUTE), hours, minutes);
ECHO_LV(DB, time);
>>>>>>> origin/master
}
#endif //!DISABLE_M503
<<<<<<< HEAD
=======
/**
* Configuration on SD card
*
* Author: Simone Primarosa
* Lifetime on EEPROM
*
*/
void load_lifetime_stats() {
int i = LIFETIME_EEPROM_OFFSET;
char stored_magic[4];
char magic[4] = LIFETIME_MAGIC;
EEPROM_READ_VAR(i, stored_magic); // read magic
>>>>>>> origin/master
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
void ConfigSD_StoreSettings() {
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return;
card.openFile(CFG_SD_FILE, false, true, false);
char buff[CFG_SD_MAX_VALUE_LEN];
if (strncmp(magic, stored_magic, 3) != 0) {
#ifdef POWER_CONSUMPTION
ltoa(power_consumption_hour,buff,10);
card.unparseKeyLine(cfgSD_KEY[SD_CFG_PWR], buff);
power_consumption_hour = 0;
#endif
ltoa(printer_usage_seconds,buff,10);
card.unparseKeyLine(cfgSD_KEY[SD_CFG_TME], buff);
card.closeFile(false);
config_last_update = millis();
printer_usage_seconds = 0;
}
void ConfigSD_RetrieveSettings(bool addValue) {
<<<<<<< HEAD
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return;
=======
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting || !card.cardOK) return;
>>>>>>> origin/master
char key[CFG_SD_MAX_KEY_LEN], value[CFG_SD_MAX_VALUE_LEN];
int k_idx;
int k_len, v_len;
card.openFile(CFG_SD_FILE, true, true, false);
while(true) {
k_len = CFG_SD_MAX_KEY_LEN;
v_len = CFG_SD_MAX_VALUE_LEN;
card.parseKeyLine(key, value, k_len, v_len);
if(k_len == 0 || v_len == 0) break; //no valid key or value founded
k_idx = ConfigSD_KeyIndex(key);
if(k_idx == -1) continue; //unknow key ignore it
switch(k_idx) {
#ifdef POWER_CONSUMPTION
case SD_CFG_PWR: {
if(addValue) power_consumption_hour += (unsigned long)atol(value);
else power_consumption_hour = (unsigned long)atol(value);
}
break;
#endif
case SD_CFG_TME: {
if(addValue) printer_usage_seconds += (unsigned long)atol(value);
else printer_usage_seconds = (unsigned long)atol(value);
}
break;
}
}
card.closeFile(false);
config_readed = true;
<<<<<<< HEAD
config_last_update = millis();
=======
ConfigSD_PrintSettings(true);
>>>>>>> origin/master
}
int ConfigSD_KeyIndex(char *key) { //At the moment a binary search algorithm is used for simplicity, if it will be necessary (Eg. tons of key), an hash search algorithm will be implemented.
int begin = 0, end = SD_CFG_END - 1, middle, cond;
while(begin <= end) {
middle = (begin + end) / 2;
cond = strcmp(cfgSD_KEY[middle], key);
if(!cond) return middle;
else if(cond < 0) begin = middle + 1;
else end = middle - 1;
}
return -1;
else {
EEPROM_READ_VAR(i, printer_usage_seconds);
#ifdef POWER_CONSUMPTION
EEPROM_READ_VAR(i, power_consumption_hour);
#endif
}
#endif
}
void save_lifetime_stats() {
int i = LIFETIME_EEPROM_OFFSET;
char magic[4] = "000";
EEPROM_WRITE_VAR(i, magic); // invalidate data first
EEPROM_WRITE_VAR(i, printer_usage_seconds);
#ifdef POWER_CONSUMPTION
EEPROM_WRITE_VAR(i, power_consumption_hour);
#endif
char magic2[4] = LIFETIME_MAGIC;
int j = LIFETIME_EEPROM_OFFSET;
EEPROM_WRITE_VAR(j, magic2); // validate data
config_last_update = millis();
}
#ifndef CONFIGURATIONSTORE_H
#define CONFIGURATIONSTORE_H
#ifndef CONFIGURATION_STORE_H
#define CONFIGURATION_STORE_H
#include "Configuration.h"
void Config_ResetDefault();
void ConfigSD_ResetDefault();
void load_lifetime_stats();
void save_lifetime_stats();
#ifndef DISABLE_M503
void Config_PrintSettings(bool forReplay=false);
......@@ -22,35 +23,4 @@ void ConfigSD_ResetDefault();
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
static const char *cfgSD_KEY[] = { //Keep this in lexicographical order for better search performance(O(Nlog2(N)) insted of O(N*N)) (if you don't keep this sorted, the algorithm for find the key index won't work, keep attention.)
#ifdef POWER_CONSUMPTION
"PWR",
#endif
"TME",
};
<<<<<<< HEAD
=======
>>>>>>> origin/master
enum cfgSD_ENUM { //This need to be in the same order as cfgSD_KEY
#ifdef POWER_CONSUMPTION
SD_CFG_PWR,
#endif
SD_CFG_TME,
SD_CFG_END //Leave this always as the last
};
<<<<<<< HEAD
=======
>>>>>>> origin/master
void ConfigSD_StoreSettings();
void ConfigSD_RetrieveSettings(bool addValue = false);
int ConfigSD_KeyIndex(char *key);
#else
FORCE_INLINE void ConfigSD_RetrieveSettings() { ConfigSD_ResetDefault(); ConfigSD_PrintSettings(); }
#endif
#endif //CONFIGURATIONSTORE_H
#endif //CONFIGURATION_STORE_H
......@@ -273,9 +273,9 @@ static void lcd_implementation_status_screen() {
#if HAS_LCD_POWER_SENSOR
if (millis() < print_millis + 1000) {
uint16_t time = (millis() - print_job_start_ms) / 60000;
lcd_print(itostr2(time / 60));
lcd_print(itostr2(time/60));
lcd_print(':');
lcd_print(itostr2(time % 60));
lcd_print(itostr2(time%60));
}
else {
lcd_print(itostr4(power_consumption_hour-startpower));
......@@ -283,9 +283,9 @@ static void lcd_implementation_status_screen() {
}
#else
uint16_t time = (millis() - print_job_start_ms) / 60000;
lcd_print(itostr2(time / 60));
lcd_print(itostr2(time/60));
lcd_print(':');
lcd_print(itostr2(time % 60));
lcd_print(itostr2(time%60));
#endif
}
else {
......
......@@ -3,5 +3,6 @@
.\bdf2u8g.exe -b 32 -e 255 HD44780_C.bdf HD44780_C_5x7 dogm_font_data_HD44780_C.h
.\bdf2u8g.exe -b 32 -e 255 HD44780_J.bdf HD44780_J_5x7 dogm_font_data_HD44780_J.h
.\bdf2u8g.exe -b 32 -e 255 ISO10646-1.bdf ISO10646_1_5x7 dogm_font_data_ISO10646_1.h
.\bdf2u8g.exe -b 32 -e 255 ISO10646-1-Marlin.bdf ISO10646_1_Marlin_5x7 dogm_font_data_ISO10646_1_Marlin.h
.\bdf2u8g.exe -b 32 -e 255 ISO10646_5_Cyrillic.bdf ISO10646_5_Cyrillic_5x7 dogm_font_data_ISO10646_5_Cyrillic.h
.\bdf2u8g.exe -b 32 -e 255 ISO10646_Kana.bdf ISO10646_Kana_5x7 dogm_font_data_ISO10646_Kana.h
......@@ -94,7 +94,8 @@
#define MSG_OK "ok"
#define MSG_WAIT "wait"
#define MSG_FILE_SAVED "Done saving file."
#define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: "
#define MSG_ERR_LINE_NO1 "Line Number out of sequence. Expected: "
#define MSG_ERR_LINE_NO2 " Got: "
#define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "
#define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: "
#define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "
......
......@@ -18,9 +18,14 @@
*301 BOARD_RAMBO - Rambo
*
* 4 BOARD_DUEMILANOVE_328P - Duemilanove w/ ATMega328P pin assignment
*401 BOARD_RADDS - Radds Arduino DUE
*403 BOARD_RAMPS_FD_V1 - Ramps FD version 1 Arduino DUE
*404 BOARD_RAMPS_FD_V2 - Ramps FD version 2 Arduino DUE
*
* 5 BOARD_GEN6 - Gen6
* 51 BOARD_GEN6_DELUXE - Gen6 deluxe
*502 BOARD_ALLIGATOR - Alligator R2 ARM 32 Arduino DUE
*
* 6 BOARD_SANGUINOLOLU_11 - Sanguinololu < 1.2
* 62 BOARD_SANGUINOLOLU_12 - Sanguinololu 1.2 and above
......@@ -63,7 +68,7 @@
#include "boards.h"
// Preset optional pins
/// Preset optional pins
#define X_MS1_PIN -1
#define X_MS2_PIN -1
#define Y_MS1_PIN -1
......@@ -93,27 +98,27 @@
#endif
//x axis pins
#define X_STEP_PIN 21 // different from standard GEN7
#define X_DIR_PIN 20 // different from standard GEN7
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 21 // different from standard GEN7
#define ORIG_X_DIR_PIN 20 // different from standard GEN7
#define ORIG_X_ENABLE_PIN 24
#define X_STOP_PIN 0
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define ORIG_Y_ENABLE_PIN 24
#define Y_STOP_PIN 1
//z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define ORIG_Z_STEP_PIN 26
#define ORIG_Z_DIR_PIN 25
#define ORIG_Z_ENABLE_PIN 24
#define Z_STOP_PIN 2
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 28
#define ORIG_E0_DIR_PIN 27
#define ORIG_E0_ENABLE_PIN 24
#define TEMP_0_PIN 2
#define TEMP_1_PIN -1
......@@ -129,15 +134,15 @@
#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support
#define LED_PIN -1
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#define PS_ON_PIN 19
//our pin for debugging.
#define DEBUG_PIN -1
//our RS485 pins
//#define TX_ENABLE_PIN 12
//#define RX_ENABLE_PIN 13
//#define TORIG_X_ENABLE_PIN 12
//#define RORIG_X_ENABLE_PIN 13
#define BEEPER -1
#define SDCARDDETECT -1
......@@ -179,28 +184,28 @@
#endif
//X axis pins
#define X_STEP_PIN 19
#define X_DIR_PIN 18
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 19
#define ORIG_X_DIR_PIN 18
#define ORIG_X_ENABLE_PIN 24
#define X_STOP_PIN 7
//Y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define ORIG_Y_ENABLE_PIN 24
#define Y_STOP_PIN 5
//Z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define ORIG_Z_STEP_PIN 26
#define ORIG_Z_DIR_PIN 25
#define ORIG_Z_ENABLE_PIN 24
#define Z_MIN_PIN 1
#define Z_MAX_PIN 0
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 28
#define ORIG_E0_DIR_PIN 27
#define ORIG_E0_ENABLE_PIN 24
#define TEMP_0_PIN 1
#define TEMP_1_PIN -1
......@@ -218,7 +223,7 @@
#define SDSS -1 // SCL pin of I2C header
#define LED_PIN -1
#define FAN_PIN 31
#define ORIG_FAN_PIN 31
#define PS_ON_PIN 15
//All these generations of Gen7 supply thermistor power
......@@ -229,8 +234,8 @@
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#define TORIG_X_ENABLE_PIN 12
#define RORIG_X_ENABLE_PIN 13
#endif
/****************************************************************************************/
......@@ -254,28 +259,28 @@
#endif
//X axis pins
#define X_STEP_PIN 19
#define X_DIR_PIN 18
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 19
#define ORIG_X_DIR_PIN 18
#define ORIG_X_ENABLE_PIN 24
#define X_STOP_PIN 7
//Y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define ORIG_Y_ENABLE_PIN 24
#define Y_STOP_PIN 5
//Z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define ORIG_Z_STEP_PIN 26
#define ORIG_Z_DIR_PIN 25
#define ORIG_Z_ENABLE_PIN 24
#define Z_MIN_PIN 1
#define Z_MAX_PIN 0
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 28
#define ORIG_E0_DIR_PIN 27
#define ORIG_E0_ENABLE_PIN 24
#define TEMP_0_PIN 1
#define TEMP_1_PIN -1
......@@ -293,7 +298,7 @@
#define SDSS -1 // SCL pin of I2C header
#define LED_PIN -1
#define FAN_PIN -1 // Gen7 v1.3 removed the fan pin
#define ORIG_FAN_PIN -1 // Gen7 v1.3 removed the fan pin
#define PS_ON_PIN 15
//All these generations of Gen7 supply thermistor power
......@@ -304,8 +309,8 @@
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#define TORIG_X_ENABLE_PIN 12
#define RORIG_X_ENABLE_PIN 13
#endif
/****************************************************************************************/
......@@ -326,27 +331,27 @@
#endif
//X axis pins
#define X_STEP_PIN 29
#define X_DIR_PIN 28
#define X_ENABLE_PIN 25
#define ORIG_X_STEP_PIN 29
#define ORIG_X_DIR_PIN 28
#define ORIG_X_ENABLE_PIN 25
#define X_STOP_PIN 0
//Y axis pins
#define Y_STEP_PIN 27
#define Y_DIR_PIN 26
#define Y_ENABLE_PIN 25
#define ORIG_Y_STEP_PIN 27
#define ORIG_Y_DIR_PIN 26
#define ORIG_Y_ENABLE_PIN 25
#define Y_STOP_PIN 1
//Z axis pins
#define Z_STEP_PIN 23
#define Z_DIR_PIN 22
#define Z_ENABLE_PIN 25
#define ORIG_Z_STEP_PIN 23
#define ORIG_Z_DIR_PIN 22
#define ORIG_Z_ENABLE_PIN 25
#define Z_STOP_PIN 2
//extruder pins
#define E0_STEP_PIN 19
#define E0_DIR_PIN 18
#define E0_ENABLE_PIN 25
#define ORIG_E0_STEP_PIN 19
#define ORIG_E0_DIR_PIN 18
#define ORIG_E0_ENABLE_PIN 25
#define TEMP_0_PIN 1
#define TEMP_1_PIN -1
......@@ -364,7 +369,7 @@
#define SDSS -1 // SCL pin of I2C header
#define LED_PIN -1
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#define PS_ON_PIN 15
......@@ -372,8 +377,8 @@
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#define TORIG_X_ENABLE_PIN 12
#define RORIG_X_ENABLE_PIN 13
#endif // GEN7
/****************************************************************************************/
......@@ -395,48 +400,48 @@
#define LARGE_FLASH true
//X motor stepper
#define X_STEP_PIN 14
#define X_DIR_PIN 15
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 14
#define ORIG_X_DIR_PIN 15
#define ORIG_X_ENABLE_PIN 24
//X endstop
#define X_MIN_PIN 3
#define X_MAX_PIN -1
//Y motor stepper
#define Y_STEP_PIN 35
#define Y_DIR_PIN 36
#define Y_ENABLE_PIN 31
#define ORIG_Y_STEP_PIN 35
#define ORIG_Y_DIR_PIN 36
#define ORIG_Y_ENABLE_PIN 31
//Y endstop
#define Y_MIN_PIN 2
#define Y_MAX_PIN -1
//Z motor stepper
#define Z_STEP_PIN 40
#define Z_DIR_PIN 41
#define Z_ENABLE_PIN 37
#define ORIG_Z_STEP_PIN 40
#define ORIG_Z_DIR_PIN 41
#define ORIG_Z_ENABLE_PIN 37
//Z endstop
#define Z_MIN_PIN 5
#define Z_MAX_PIN -1
//Extruder 0 stepper
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 25
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 25
//Extruder 1 stepper
#define E1_STEP_PIN 33
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 33
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS -1
#define LED_PIN -1
//FAN
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1
......@@ -495,28 +500,28 @@
#endif
//x axis pins
#define X_STEP_PIN 19
#define X_DIR_PIN 18
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 19
#define ORIG_X_DIR_PIN 18
#define ORIG_X_ENABLE_PIN 24
#define X_STOP_PIN 2
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define ORIG_Y_ENABLE_PIN 24
#define Y_STOP_PIN 0
//z axis pins
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define ORIG_Z_STEP_PIN 26
#define ORIG_Z_DIR_PIN 25
#define ORIG_Z_ENABLE_PIN 24
#define Z_MIN_PIN 1
#define Z_MAX_PIN 0
//extruder pins
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 28
#define ORIG_E0_DIR_PIN 27
#define ORIG_E0_ENABLE_PIN 24
#define TEMP_0_PIN 1
#define TEMP_1_PIN -1
......@@ -536,9 +541,9 @@
#if (GEN7_VERSION >= 13)
// Gen7 v1.3 removed the fan pin
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#else
#define FAN_PIN 31
#define ORIG_FAN_PIN 31
#endif
#define PS_ON_PIN 15
......@@ -550,8 +555,8 @@
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#define TORIG_X_ENABLE_PIN 12
#define RORIG_X_ENABLE_PIN 13
#endif // SETHI
/****************************************************************************************/
......@@ -571,40 +576,40 @@
#endif
#define X_STEP_PIN 49
#define X_DIR_PIN 13
#define X_ENABLE_PIN 48
#define ORIG_X_STEP_PIN 49
#define ORIG_X_DIR_PIN 13
#define ORIG_X_ENABLE_PIN 48
#define X_MIN_PIN 35
#define X_MAX_PIN -1 //34
#define Y_STEP_PIN 11
#define Y_DIR_PIN 9
#define Y_ENABLE_PIN 12
#define ORIG_Y_STEP_PIN 11
#define ORIG_Y_DIR_PIN 9
#define ORIG_Y_ENABLE_PIN 12
#define Y_MIN_PIN 33
#define Y_MAX_PIN -1 //32
#define Z_STEP_PIN 7
#define Z_DIR_PIN 6
#define Z_ENABLE_PIN 8
#define ORIG_Z_STEP_PIN 7
#define ORIG_Z_DIR_PIN 6
#define ORIG_Z_ENABLE_PIN 8
#define Z_MIN_PIN 31
#define Z_MAX_PIN -1 //30
#define E2_STEP_PIN 43
#define E2_DIR_PIN 47
#define E2_ENABLE_PIN 42
#define ORIG_E2_STEP_PIN 43
#define ORIG_E2_DIR_PIN 47
#define ORIG_E2_ENABLE_PIN 42
#define E1_STEP_PIN 18
#define E1_DIR_PIN 19
#define E1_ENABLE_PIN 38
#define ORIG_E1_STEP_PIN 18
#define ORIG_E1_DIR_PIN 19
#define ORIG_E1_ENABLE_PIN 38
#define E0_STEP_PIN 40
#define E0_DIR_PIN 41
#define E0_ENABLE_PIN 37
#define ORIG_E0_STEP_PIN 40
#define ORIG_E0_DIR_PIN 41
#define ORIG_E0_ENABLE_PIN 37
#define SDPOWER -1
#define LED_PIN -1 //Use +12V Aux port for LED Ring
#define FAN_PIN 16 //5V PWM
#define ORIG_FAN_PIN 16 //5V PWM
#define PS_ON_PIN 10 //Set to -1 if using a manual switch on the PWRSW Connector
#define SLEEP_WAKE_PIN 26 //This feature still needs work
......@@ -693,38 +698,38 @@
#define DEBUG_PIN 0
// x axis
#define X_STEP_PIN 15
#define X_DIR_PIN 18
#define ORIG_X_STEP_PIN 15
#define ORIG_X_DIR_PIN 18
#define X_MIN_PIN 20
//Alex Checar #define X_STOP_PIN 20
#define X_ENABLE_PIN 24 //actually uses Y_enable_pin
#define ORIG_X_ENABLE_PIN 24 //actually uses ORIG_Y_DIR_PIN
#define X_MAX_PIN -1
// y axes
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define Y_MIN_PIN 25
//Alex Checar #define Y_STOP_PIN 25
#define Y_ENABLE_PIN 24 //shared with X_enable_pin
#define ORIG_Y_ENABLE_PIN 24 //shared with ORIG_X_ENABLE_PIN
#define Y_MAX_PIN -1
// z axes
#define Z_STEP_PIN 27
#define Z_DIR_PIN 28
#define ORIG_Z_STEP_PIN 27
#define ORIG_Z_DIR_PIN 28
#define Z_MIN_PIN 30
//Alex Checar #define Z_STOP_PIN 30
#define Z_ENABLE_PIN 29
#define ORIG_Z_ENABLE_PIN 29
#define Z_MAX_PIN -1
//extruder pins
#define E0_STEP_PIN 12
#define E0_DIR_PIN 17
#define E0_ENABLE_PIN 3
#define ORIG_E0_STEP_PIN 12
#define ORIG_E0_DIR_PIN 17
#define ORIG_E0_ENABLE_PIN 3
#define HEATER_0_PIN 16
#define TEMP_0_PIN 0
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
//bed pins
#define HEATER_BED_PIN -1
......@@ -763,27 +768,27 @@
// Uncomment the following line for RAMPS v1.0
//#define RAMPS_V_1_0
#define X_STEP_PIN 26
#define X_DIR_PIN 28
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 26
#define ORIG_X_DIR_PIN 28
#define ORIG_X_ENABLE_PIN 24
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define Y_STEP_PIN 38
#define Y_DIR_PIN 40
#define Y_ENABLE_PIN 36
#define ORIG_Y_STEP_PIN 38
#define ORIG_Y_DIR_PIN 40
#define ORIG_Y_ENABLE_PIN 36
#define Y_MIN_PIN 16
#define Y_MAX_PIN 17
#define Z_STEP_PIN 44
#define Z_DIR_PIN 46
#define Z_ENABLE_PIN 42
#define ORIG_Z_STEP_PIN 44
#define ORIG_Z_DIR_PIN 46
#define ORIG_Z_ENABLE_PIN 42
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define E0_STEP_PIN 32
#define E0_DIR_PIN 34
#define E0_ENABLE_PIN 30
#define ORIG_E0_STEP_PIN 32
#define ORIG_E0_DIR_PIN 34
#define ORIG_E0_ENABLE_PIN 30
#define SDPOWER 48
#define SDSS 53
......@@ -794,11 +799,11 @@
#ifdef RAMPS_V_1_0 // RAMPS_V_1_0
#define HEATER_0_PIN 12 // RAMPS 1.0
#define HEATER_BED_PIN -1 // RAMPS 1.0
#define FAN_PIN 11 // RAMPS 1.0
#define ORIG_FAN_PIN 11 // RAMPS 1.0
#else // RAMPS_V_1_1 or RAMPS_V_1_2
#define HEATER_0_PIN 10 // RAMPS 1.1
#define HEATER_BED_PIN 8 // RAMPS 1.1
#define FAN_PIN 9 // RAMPS 1.1
#define ORIG_FAN_PIN 9 // RAMPS 1.1
#endif
#define HEATER_1_PIN -1
......@@ -844,16 +849,16 @@
#define LARGE_FLASH true
//X axis pins
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
//Y axis pins
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
......@@ -862,9 +867,9 @@
#define Y2_ENABLE_PIN 30
//Z axis pins
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define Z_PROBE_PIN 18
......@@ -874,19 +879,19 @@
#define Z2_ENABLE_PIN 30
//E axis pins
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 9
#define ORIG_FAN_PIN 9
#define PS_ON_PIN 12
#define HEATER_0_PIN 10 // Hotend 1
......@@ -1050,16 +1055,16 @@
#define LARGE_FLASH true
//X axis pins
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
//Y axis pins
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
......@@ -1068,9 +1073,9 @@
#define Y2_ENABLE_PIN 30
//Z axis pins
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define Z_PROBE_PIN 18
......@@ -1080,19 +1085,19 @@
#define Z2_ENABLE_PIN 30
//E axis pins
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 4
#define ORIG_FAN_PIN 4
#define PS_ON_PIN 12
#define HEATER_0_PIN 10 // HOTEND 1
......@@ -1250,16 +1255,16 @@
#define LARGE_FLASH true
//X axis pins
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
//Y axis pins
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
......@@ -1268,9 +1273,9 @@
#define Y2_ENABLE_PIN 30
//Z axis pins
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define Z_PROBE_PIN 18
......@@ -1280,19 +1285,19 @@
#define Z2_ENABLE_PIN 30
//E axis pins
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 9
#define ORIG_FAN_PIN 9
#define PS_ON_PIN 12
#define HEATER_0_PIN 10 // HOTEND 1
......@@ -1450,16 +1455,16 @@
#define LARGE_FLASH true
//X axis pins
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
//Y axis pins
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
......@@ -1468,9 +1473,9 @@
#define Y2_ENABLE_PIN 30
//Z axis pins
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define Z_PROBE_PIN 18
......@@ -1480,19 +1485,19 @@
#define Z2_ENABLE_PIN 30
//E axis pins
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 8
#define ORIG_FAN_PIN 8
#define PS_ON_PIN 12
#define HEATER_0_PIN 10 // HOTEND 1
......@@ -1648,27 +1653,27 @@
#define LARGE_FLASH true
#define X_STEP_PIN 37
#define X_DIR_PIN 48
#define ORIG_X_STEP_PIN 37
#define ORIG_X_DIR_PIN 48
#define X_MIN_PIN 12
#define X_MAX_PIN 24
#define X_ENABLE_PIN 29
#define ORIG_X_ENABLE_PIN 29
#define X_MS1_PIN 40
#define X_MS2_PIN 41
#define Y_STEP_PIN 36
#define Y_DIR_PIN 49
#define ORIG_Y_STEP_PIN 36
#define ORIG_Y_DIR_PIN 49
#define Y_MIN_PIN 11
#define Y_MAX_PIN 23
#define Y_ENABLE_PIN 28
#define ORIG_Y_ENABLE_PIN 28
#define Y_MS1_PIN 69
#define Y_MS2_PIN 39
#define Z_STEP_PIN 35
#define Z_DIR_PIN 47
#define ORIG_Z_STEP_PIN 35
#define ORIG_Z_DIR_PIN 47
#define Z_MIN_PIN 10
#define Z_MAX_PIN 30
#define Z_ENABLE_PIN 27
#define ORIG_Z_ENABLE_PIN 27
#define Z_MS1_PIN 68
#define Z_MS2_PIN 67
......@@ -1688,15 +1693,15 @@
#endif
#define TEMP_2_PIN -1
#define E0_STEP_PIN 34
#define E0_DIR_PIN 43
#define E0_ENABLE_PIN 26
#define ORIG_E0_STEP_PIN 34
#define ORIG_E0_DIR_PIN 43
#define ORIG_E0_ENABLE_PIN 26
#define E0_MS1_PIN 65
#define E0_MS2_PIN 66
#define E1_STEP_PIN 33
#define E1_DIR_PIN 42
#define E1_ENABLE_PIN 25
#define ORIG_E1_STEP_PIN 33
#define ORIG_E1_DIR_PIN 42
#define ORIG_E1_ENABLE_PIN 25
#define E1_MS1_PIN 63
#define E1_MS2_PIN 64
......@@ -1706,7 +1711,7 @@
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 8
#define ORIG_FAN_PIN 8
#define PS_ON_PIN 4
#define KILL_PIN -1 //80 with Smart Controller LCD
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
......@@ -1786,29 +1791,29 @@
#error Oops! Make sure you have 'Arduino Duemilanove w/ ATMega328' selected from the 'Tools -> Boards' menu.
#endif
#define X_STEP_PIN 19
#define X_DIR_PIN 18
#define X_ENABLE_PIN -1
#define ORIG_X_STEP_PIN 19
#define ORIG_X_DIR_PIN 18
#define ORIG_X_ENABLE_PIN -1
#define X_STOP_PIN 17
#define Y_STEP_PIN 10
#define Y_DIR_PIN 7
#define Y_ENABLE_PIN -1
#define ORIG_Y_STEP_PIN 10
#define ORIG_Y_DIR_PIN 7
#define ORIG_Y_ENABLE_PIN -1
#define Y_STOP_PIN 8
#define Z_STEP_PIN 13
#define Z_DIR_PIN 3
#define Z_ENABLE_PIN 2
#define ORIG_Z_STEP_PIN 13
#define ORIG_Z_DIR_PIN 3
#define ORIG_Z_ENABLE_PIN 2
#define Z_STOP_PIN 4
#define E0_STEP_PIN 11
#define E0_DIR_PIN 12
#define E0_ENABLE_PIN -1
#define ORIG_E0_STEP_PIN 11
#define ORIG_E0_DIR_PIN 12
#define ORIG_E0_ENABLE_PIN -1
#define SDPOWER -1
#define SDSS -1
#define LED_PIN -1
#define FAN_PIN 5
#define ORIG_FAN_PIN 5
#define PS_ON_PIN -1
#define KILL_PIN -1
......@@ -1825,6 +1830,334 @@
/****************************************************************************************/
/****************************************************************************************
* 401
*
* RADDS
****************************************************************************************/
#if MB(RADDS)
#define KNOWN_BOARD 1
//
#ifndef __SAM3X8E__
#error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu.
#endif
//
#define RADDS
#define ORIG_X_STEP_PIN 24
#define ORIG_X_DIR_PIN 23
#define ORIG_X_ENABLE_PIN 26
#define ORIG_Y_STEP_PIN 17
#define ORIG_Y_DIR_PIN 16
#define ORIG_Y_ENABLE_PIN 22
#define ORIG_Z_STEP_PIN 2
#define ORIG_Z_DIR_PIN 3
#define ORIG_Z_ENABLE_PIN 15
#define X_MIN_PIN 28
#define X_MAX_PIN -1 // 34 //Max endstops default to disabled "-1", set to commented value to enable.
#define Y_MIN_PIN 30
#define Y_MAX_PIN -1 // 36
#define Z_MIN_PIN 32
#define Z_MAX_PIN -1 // 38
#define ORIG_E0_STEP_PIN 61
#define ORIG_E0_DIR_PIN 60
#define ORIG_E0_ENABLE_PIN 62
#define ORIG_E1_STEP_PIN 64
#define ORIG_E1_DIR_PIN 63
#define ORIG_E1_ENABLE_PIN 65
#define ORIG_E2_STEP_PIN 51
#define ORIG_E2_DIR_PIN 53
#define ORIG_E2_ENABLE_PIN 49
#define SDPOWER -1
#define SDSS 10
#define LED_PIN -1
#define BEEPER 41
#define ORIG_FAN_PIN -1
//#define CONTROLLERORIG_FAN_PIN 8 //Pin used for the fan to cool controller
#define PS_ON_PIN 40
#define KILL_PIN -1
#define HEATER_BED_PIN 7 // BED
#define HEATER_0_PIN 13
#define HEATER_1_PIN 12
#define HEATER_2_PIN 11
#define TEMP_BED_PIN 4 // ANALOG NUMBERING
#define TEMP_0_PIN 0 // ANALOG NUMBERING
#define TEMP_1_PIN -1 // 1 // ANALOG NUMBERING
#define TEMP_2_PIN -1 // 2 // ANALOG NUMBERING
#define TEMP_3_PIN -1 // 3 // ANALOG NUMBERING
#ifdef NUM_SERVOS
#define SERVO0_PIN 5
#if NUM_SERVOS > 1
#define SERVO1_PIN 6
#endif
#if NUM_SERVOS > 2
#define SERVO2_PIN 39
#endif
#if NUM_SERVOS > 3
#define SERVO3_PIN 40
#endif
#endif
#ifdef ULTRA_LCD
// RADDS LCD panel
#ifdef NEWPANEL
#define LCD_PINS_RS 42
#define LCD_PINS_ENABLE 43
#define LCD_PINS_D4 44
#define LCD_PINS_D5 45
#define LCD_PINS_D6 46
#define LCD_PINS_D7 47
#ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
#define BEEPER 41
#define BTN_EN1 52
#define BTN_EN2 50
#define BTN_ENC 48
#define SDCARDDETECT 14
#endif
#endif
#endif //ULTRA_LCD
// SPI for Max6675 Thermocouple
//works with radds??? #ifndef SDSUPPORT
//// these pins are defined in the SD library if building with SD support
// #define MAX_SCK_PIN 52
// #define MAX_MISO_PIN 50
// #define MAX_MOSI_PIN 51
// #define MAX6675_SS 53
//#else
// #define MAX6675_SS 49
//#endif
#endif //RADDS
/****************************************************************************************/
/****************************************************************************************
* 403 - 404
* Arduino Due pin assignment
* Ramps - FD v1 & v2
****************************************************************************************/
#if MB(RAMPS_FDV1) || MB(RAMPS_FDV2)
#define KNOWN_BOARD 1
#ifndef __SAM3X8E__
#error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu.
#endif
#if MB(RAMPS_FDV1)
#define INVERTED_HEATER_PINS
#define RAMPS_FDV1
#define INVERTED_HEATER_PINS
// No EEPROM
// Use 4k7 thermistor tables
#else
#define RAMPS_FDV2
// EEPROM supported
// Use 1k thermistor tables
#endif
#define ORIG_X_STEP_PIN 63
#define ORIG_X_DIR_PIN 62
#define ORIG_X_ENABLE_PIN 48
#define X_MIN_PIN 22
#define X_MAX_PIN 2
#define ORIG_Y_STEP_PIN 65
#define ORIG_Y_DIR_PIN 64
#define ORIG_Y_ENABLE_PIN 46
#define Y_MIN_PIN 24
#define Y_MAX_PIN 15
#define ORIG_Z_STEP_PIN 67
#define ORIG_Z_DIR_PIN 66
#define ORIG_Z_ENABLE_PIN 44
#define Z_MIN_PIN 26
#define Z_MAX_PIN -1
#define ORIG_E0_STEP_PIN 36
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 42
#define ORIG_E1_STEP_PIN 43
#define ORIG_E1_DIR_PIN 41
#define ORIG_E1_ENABLE_PIN 39
#define ORIG_E2_STEP_PIN 32
#define ORIG_E2_DIR_PIN 47
#define ORIG_E2_ENABLE_PIN 45
#define SDPOWER -1
#define SDSS 4
#define LED_PIN 13
#define BEEPER -1
#define ORIG_FAN_PIN -1
#define CONTROLLERORIG_FAN_PIN -1 //Pin used for the fan to cool controller
#define PS_ON_PIN -1
#define KILL_PIN -1
#define HEATER_BED_PIN 8 // BED
#define HEATER_0_PIN 9
#define HEATER_1_PIN 10
#define HEATER_2_PIN 11
#define TEMP_BED_PIN 0 // ANALOG NUMBERING
#define TEMP_0_PIN 1 // ANALOG NUMBERING
#define TEMP_1_PIN -1 // 2 // ANALOG NUMBERING
#define TEMP_2_PIN -1 // 3 // ANALOG NUMBERING
#define TEMP_3_PIN -1 // ANALOG NUMBERING
#define TEMP_4_PIN -1 // ANALOG NUMBERING
#ifdef NUM_SERVOS
#define SERVO0_PIN 11
#if NUM_SERVOS > 1
#define SERVO1_PIN 6
#endif
#if NUM_SERVOS > 2
#define SERVO2_PIN 5
#endif
#if NUM_SERVOS > 3
#define SERVO3_PIN 4
#endif
#endif
#ifdef ULTRA_LCD
#ifdef NEWPANEL
// ramps-fd lcd adaptor
#define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23
#define LCD_PINS_D5 25
#define LCD_PINS_D6 27
#define LCD_PINS_D7 29
#ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
#define BEEPER 37
#define BTN_EN1 33
#define BTN_EN2 31
#define BTN_ENC 35
#define SDCARDDETECT 49
#endif
#endif
#endif //ULTRA_LCD
// SPI for Max6675 Thermocouple
#ifndef SDSUPPORT
// these pins are defined in the SD library if building with SD support
#define MAX_SCK_PIN 52
#define MAX_MISO_PIN 50
#define MAX_MOSI_PIN 51
#define MAX6675_SS 53
#else
#define MAX6675_SS 49
#endif
#endif //RAMPS-FD
/****************************************************************************************/
/****************************************************************************************
* 433
* Arduino Due pin assignment
* for RAMPS4DUE (http://forums.reprap.org/read.php?219,479626,page=1)
****************************************************************************************/
#if MB(RAMPS4DUE)
#define KNOWN_BOARD 1
#ifndef __SAM3X8E__
#error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu.
#endif
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define Z_PROBE_PIN -1
#define Y2_STEP_PIN 36
#define Y2_DIR_PIN 34
#define Y2_ENABLE_PIN 30
#undef Z2_STEP_PIN
#undef Z2_DIR_PIN
#undef Z2_ENABLE_PIN
#define Z2_STEP_PIN 36
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#endif
/****************************************************************************************/
/****************************************************************************************
* 5 - 51
......@@ -1841,27 +2174,27 @@
#endif
//x axis pins
#define X_STEP_PIN 15
#define X_DIR_PIN 18
#define X_ENABLE_PIN 19
#define ORIG_X_STEP_PIN 15
#define ORIG_X_DIR_PIN 18
#define ORIG_X_ENABLE_PIN 19
#define X_STOP_PIN 20
//y axis pins
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define ORIG_Y_ENABLE_PIN 24
#define Y_STOP_PIN 25
//z axis pins
#define Z_STEP_PIN 27
#define Z_DIR_PIN 28
#define Z_ENABLE_PIN 29
#define ORIG_Z_STEP_PIN 27
#define ORIG_Z_DIR_PIN 28
#define ORIG_Z_ENABLE_PIN 29
#define Z_STOP_PIN 30
//extruder pins
#define E0_STEP_PIN 4 //Edited @ EJE Electronics 20100715
#define E0_DIR_PIN 2 //Edited @ EJE Electronics 20100715
#define E0_ENABLE_PIN 3 //Added @ EJE Electronics 20100715
#define ORIG_E0_STEP_PIN 4 //Edited @ EJE Electronics 20100715
#define ORIG_E0_DIR_PIN 2 //Edited @ EJE Electronics 20100715
#define ORIG_E0_ENABLE_PIN 3 //Added @ EJE Electronics 20100715
#define TEMP_0_PIN 5 //changed @ rkoeppl 20110410
#define TEMP_1_PIN -1 //changed @ rkoeppl 20110410
......@@ -1880,7 +2213,7 @@
#define SDPOWER -1
#define SDSS 17
#define LED_PIN -1 //changed @ rkoeppl 20110410
#define FAN_PIN -1 //changed @ rkoeppl 20110410
#define ORIG_FAN_PIN -1 //changed @ rkoeppl 20110410
#define PS_ON_PIN -1 //changed @ rkoeppl 20110410
#define KILL_PIN -1 //changed @ drakelive 20120830
//our pin for debugging.
......@@ -1888,14 +2221,136 @@
#define DEBUG_PIN 0
//our RS485 pins
#define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13
#define TORIG_X_ENABLE_PIN 12
#define RORIG_X_ENABLE_PIN 13
#endif // GEN6 || GEN6_DELUXE
/****************************************************************************************/
/****************************************************************************************
* 502
* Arduino Due pin assignment
* Alligator R2
****************************************************************************************/
#if MB(ALLIGATOR)
#define KNOWN_BOARD 1
#ifndef __SAM3X8E__
#error Oops! Make sure you have 'Alligator 3D Printer Board' selected from the 'Tools -> Boards' menu.
#endif
#define ALLIGATOR
#define SPI_CHAN_DAC 1
// X AXIS
#define ORIG_X_STEP_PIN 96 // PB24
#define ORIG_X_DIR_PIN 2 // PB25
#define ORIG_X_ENABLE_PIN 24 // PA15, motor RESET pin
#define X_MIN_PIN 33 // PC1
#define X_MAX_PIN 34 // PC2
#define X_MS1_PIN 99 // PC10
// Y AXIS
#define ORIG_Y_STEP_PIN 94 // PB22
#define ORIG_Y_DIR_PIN 95 // PB23
#define ORIG_Y_ENABLE_PIN 24 // PA15, motor RESET pin
#define Y_MIN_PIN 35 // PC3
#define Y_MAX_PIN 37 // PC5
#define Y_MS1_PIN 10 // PC29
// Z AXIS
#define ORIG_Z_STEP_PIN 98 // PC27
#define ORIG_Z_DIR_PIN 3 // PC28
#define ORIG_Z_ENABLE_PIN 24 // PA15, motor RESET pin
#define Z_MIN_PIN 38 // PC6
#define Z_MAX_PIN 39 // PC7
#define Z_MS1_PIN 44 // PC19
#define Z_PROBE_PIN 38 // PC6
// E AXIS
#define ORIG_E0_STEP_PIN 5 // PC25
#define ORIG_E0_DIR_PIN 4 // PC26
#define ORIG_E0_ENABLE_PIN 24 // PA15, motor RESET pin
#define E0_MS1_PIN 45 // PC18
/*
#define ORIG_E1_STEP_PIN 28 // PD3 on piggy
#define ORIG_E1_DIR_PIN 27 // PD2 on piggy
#define ORIG_E1_ENABLE_PIN -1
#define E1_MS1_PIN -1
#define ORIG_E2_STEP_PIN 11 // PD7 on piggy
#define ORIG_E2_DIR_PIN 29 // PD6 on piggy
#define ORIG_E2_ENABLE_PIN -1
#define E2_MS_PIN -1
#define ORIG_E3_STEP_PIN 30 // PD9 on piggy
#define ORIG_E3_DIR_PIN 12 // PD8 on piggy
#define ORIG_E3_ENABLE_PIN -1
#define E3_MS_PIN -1
*/
#define MOTOR_FAULT_PIN 22 // PB26 , motor X-Y-Z-E0 motor FAULT
#define SDPOWER -1
#define SDSS 77 // PA28
#define SDCARDDETECT 87 // PA29
#define SDCARDDETECTINVERTED false
#define LED_PIN -1
#define ORIG_FAN_PIN 92 // PA5
#define FAN2_PIN 31 // PA7
#define PS_ON_PIN -1
#define KILL_PIN -1
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
#define HEAT_OFF_INT_PIN 50 // PC13 on raspberry expansion
// Note that on the Due pin A0 on the board is channel 2 on the ARM chip
#define HEATER_BED_PIN 69 // PA0
#define HEATER_0_PIN 68 // PA1
/*
#define HEATER_1_PIN 8 // PC22 on piggy
#define HEATER_2_PIN 9 // PC21 on piggy
#define HEATER_3_PIN 97 // PC20 on piggy
*/
#define TEMP_BED_PIN 0 // PA16
#define TEMP_0_PIN 1 // PA24, analog pin
/*
#define TEMP_1_PIN 5 // PA23 analog pin on piggy
#define TEMP_2_PIN 4 // PA22, analog pin on piggy
#define TEMP_3_PIN 3 // PA6, analog on piggy
*/
#define LED_RED_PIN 40 // PC8
#define LED_GREEN_PIN 41 // PC9
#define CASE_LIGHTS_PIN 36 // PC4
#define EXP_VOLTAGE_LEVEL_PIN 65
#define DAC_SYNC 53 // PB14
//64K SPI EEPROM
#define SPI_CHAN_EEPROM1 2
#define SPI_EEPROM1_CS 25 // PD0
//2K SPI EEPROM
#define SPI_EEPROM2_CS 26 // PD1
//** FLASH SPI**/
//32Mb
#define SPI_FLASH_CS 23 //PA14
#endif //ALLIGATOR
/****************************************************************************************/
/****************************************************************************************
* 6 - 62 - 63 - 64 - 65
* 6 - Sanguinololu <1.2
......@@ -1935,41 +2390,41 @@
#endif
#endif
#define X_STEP_PIN 15
#define X_DIR_PIN 21
#define ORIG_X_STEP_PIN 15
#define ORIG_X_DIR_PIN 21
#define X_STOP_PIN 18
#define Y_STEP_PIN 22
#define Y_DIR_PIN 23
#define ORIG_Y_STEP_PIN 22
#define ORIG_Y_DIR_PIN 23
#define Y_STOP_PIN 19
#define Z_STEP_PIN 3
#define Z_DIR_PIN 2
#define ORIG_Z_STEP_PIN 3
#define ORIG_Z_DIR_PIN 2
#define Z_STOP_PIN 20
#define E0_STEP_PIN 1
#define E0_DIR_PIN 0
#define ORIG_E0_STEP_PIN 1
#define ORIG_E0_DIR_PIN 0
#define LED_PIN -1
#define FAN_PIN -1
#if FAN_PIN == 12 || FAN_PIN ==13
#define ORIG_FAN_PIN -1
#if ORIG_FAN_PIN == 12 || ORIG_FAN_PIN ==13
#define FAN_SOFT_PWM
#endif
#ifdef MELZI
#define LED_PIN 27 /* On some broken versions of the Sanguino libraries the pin definitions are wrong, which then needs LED_PIN as pin 28. But you better upgrade your Sanguino libraries! See #368. */
#define FAN_PIN 4 // Works for Panelolu2 too
#define ORIG_FAN_PIN 4 // Works for Panelolu2 too
#endif
#ifdef STB
#define FAN_PIN 4
#define ORIG_FAN_PIN 4
// Uncomment this if you have the first generation (V1.10) of STBs board
#define LCD_PIN_BL 17 // LCD backlight LED
#endif
#ifdef AZTEEG_X1
#define FAN_PIN 4
#define ORIG_FAN_PIN 4
#endif
#if NUM_SERVOS > 0
......@@ -1998,22 +2453,22 @@
#ifdef SANGUINOLOLU_V_1_2
#define HEATER_BED_PIN 12 // (bed)
#define X_ENABLE_PIN 14
#define Y_ENABLE_PIN 14
#define Z_ENABLE_PIN 26
#define E0_ENABLE_PIN 14
#define ORIG_X_ENABLE_PIN 14
#define ORIG_Y_ENABLE_PIN 14
#define ORIG_Z_ENABLE_PIN 26
#define ORIG_E0_ENABLE_PIN 14
#ifdef LCD_I2C_PANELOLU2
#define FAN_PIN 4 // Uses Transistor1 (PWM) on Panelolu2's Sanguino Adapter Board to drive the fan
#define ORIG_FAN_PIN 4 // Uses Transistor1 (PWM) on Panelolu2's Sanguino Adapter Board to drive the fan
#endif
#else
#define HEATER_BED_PIN 14 // (bed)
#define X_ENABLE_PIN -1
#define Y_ENABLE_PIN -1
#define Z_ENABLE_PIN -1
#define E0_ENABLE_PIN -1
#define ORIG_X_ENABLE_PIN -1
#define ORIG_Y_ENABLE_PIN -1
#define ORIG_Z_ENABLE_PIN -1
#define ORIG_E0_ENABLE_PIN -1
#endif
......@@ -2117,21 +2572,21 @@
#define LARGE_FLASH true
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
......@@ -2143,19 +2598,19 @@
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 9
#define ORIG_FAN_PIN 9
#define PS_ON_PIN 12
#if defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
......@@ -2309,21 +2764,21 @@
#define LARGE_FLASH true
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
......@@ -2335,27 +2790,27 @@
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define E2_STEP_PIN 23
#define E2_DIR_PIN 25
#define E2_ENABLE_PIN 40
#define ORIG_E2_STEP_PIN 23
#define ORIG_E2_DIR_PIN 25
#define ORIG_E2_ENABLE_PIN 40
#define E3_STEP_PIN 27
#define E3_DIR_PIN 29
#define E3_ENABLE_PIN 41
#define ORIG_E3_STEP_PIN 27
#define ORIG_E3_DIR_PIN 29
#define ORIG_E3_ENABLE_PIN 41
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 9
#define ORIG_FAN_PIN 9
#define PS_ON_PIN 12
#if defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
......@@ -2513,23 +2968,23 @@
#define LARGE_FLASH true
#define X_STEP_PIN 25
#define X_DIR_PIN 23
#define ORIG_X_STEP_PIN 25
#define ORIG_X_DIR_PIN 23
#define X_MIN_PIN 22
#define X_MAX_PIN 24
#define X_ENABLE_PIN 27
#define ORIG_X_ENABLE_PIN 27
#define Y_STEP_PIN 31
#define Y_DIR_PIN 33
#define ORIG_Y_STEP_PIN 31
#define ORIG_Y_DIR_PIN 33
#define Y_MIN_PIN 26
#define Y_MAX_PIN 28
#define Y_ENABLE_PIN 29
#define ORIG_Y_ENABLE_PIN 29
#define Z_STEP_PIN 37
#define Z_DIR_PIN 39
#define ORIG_Z_STEP_PIN 37
#define ORIG_Z_DIR_PIN 39
#define Z_MIN_PIN 30
#define Z_MAX_PIN 32
#define Z_ENABLE_PIN 35
#define ORIG_Z_ENABLE_PIN 35
#define HEATER_BED_PIN 4
#define TEMP_BED_PIN 10
......@@ -2543,18 +2998,18 @@
#define HEATER_2_PIN -1
#define TEMP_2_PIN -1
#define E0_STEP_PIN 43
#define E0_DIR_PIN 45
#define E0_ENABLE_PIN 41
#define ORIG_E0_STEP_PIN 43
#define ORIG_E0_DIR_PIN 45
#define ORIG_E0_ENABLE_PIN 41
#define E1_STEP_PIN 49
#define E1_DIR_PIN 47
#define E1_ENABLE_PIN 48
#define ORIG_E1_STEP_PIN 49
#define ORIG_E1_DIR_PIN 47
#define ORIG_E1_ENABLE_PIN 48
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 7
#define ORIG_FAN_PIN 7
#define PS_ON_PIN 12
#define KILL_PIN -1
#define SUICIDE_PIN 54 //PIN that has to be turned on right after start, to keep power flowing.
......@@ -2619,38 +3074,38 @@
#define LARGE_FLASH true
#define X_STEP_PIN 26
#define X_DIR_PIN 28
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 26
#define ORIG_X_DIR_PIN 28
#define ORIG_X_ENABLE_PIN 24
#define X_MIN_PIN 41
#define X_MAX_PIN 37
#define Y_STEP_PIN 60 // A6
#define Y_DIR_PIN 61 // A7
#define Y_ENABLE_PIN 22
#define ORIG_Y_STEP_PIN 60 // A6
#define ORIG_Y_DIR_PIN 61 // A7
#define ORIG_Y_ENABLE_PIN 22
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
#define Z_STEP_PIN 54 // A0
#define Z_DIR_PIN 55 // A1
#define Z_ENABLE_PIN 56 // A2
#define ORIG_Z_STEP_PIN 54 // A0
#define ORIG_Z_DIR_PIN 55 // A1
#define ORIG_Z_ENABLE_PIN 56 // A2
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define E0_STEP_PIN 31
#define E0_DIR_PIN 32
#define E0_ENABLE_PIN 38
#define ORIG_E0_STEP_PIN 31
#define ORIG_E0_DIR_PIN 32
#define ORIG_E0_ENABLE_PIN 38
#define E1_STEP_PIN 34
#define E1_DIR_PIN 36
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 34
#define ORIG_E1_DIR_PIN 36
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 7 // IO pin. Buffer needed
#define ORIG_FAN_PIN 7 // IO pin. Buffer needed
#define PS_ON_PIN 12
#define KILL_PIN -1
......@@ -2718,41 +3173,41 @@
#define LARGE_FLASH true
#define X_STEP_PIN 26
#define X_DIR_PIN 27
#define X_ENABLE_PIN 25
#define ORIG_X_STEP_PIN 26
#define ORIG_X_DIR_PIN 27
#define ORIG_X_ENABLE_PIN 25
#define X_MIN_PIN 37
#define X_MAX_PIN 40 //2 //Max endstops default to disabled "-1", set to commented value to enable.
#define Y_STEP_PIN 4 // A6
#define Y_DIR_PIN 54 // A0
#define Y_ENABLE_PIN 5
#define ORIG_Y_STEP_PIN 4 // A6
#define ORIG_Y_DIR_PIN 54 // A0
#define ORIG_Y_ENABLE_PIN 5
#define Y_MIN_PIN 41
#define Y_MAX_PIN 38 //15
#define Z_STEP_PIN 56 // A2
#define Z_DIR_PIN 60 // A6
#define Z_ENABLE_PIN 55 // A1
#define ORIG_Z_STEP_PIN 56 // A2
#define ORIG_Z_DIR_PIN 60 // A6
#define ORIG_Z_ENABLE_PIN 55 // A1
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define E0_STEP_PIN 35
#define E0_DIR_PIN 36
#define E0_ENABLE_PIN 34
#define ORIG_E0_STEP_PIN 35
#define ORIG_E0_DIR_PIN 36
#define ORIG_E0_ENABLE_PIN 34
#define E1_STEP_PIN 29
#define E1_DIR_PIN 39
#define E1_ENABLE_PIN 28
#define ORIG_E1_STEP_PIN 29
#define ORIG_E1_DIR_PIN 39
#define ORIG_E1_ENABLE_PIN 28
#define E2_STEP_PIN 23
#define E2_DIR_PIN 24
#define E2_ENABLE_PIN 22
#define ORIG_E2_STEP_PIN 23
#define ORIG_E2_DIR_PIN 24
#define ORIG_E2_ENABLE_PIN 22
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 13
#define FAN_PIN 7
#define ORIG_FAN_PIN 7
#define FAN2_PIN 6
#define PS_ON_PIN 12
#define KILL_PIN -1
......@@ -2831,42 +3286,42 @@
#define LARGE_FLASH true
#define X_STEP_PIN 48
#define X_DIR_PIN 47
#define X_ENABLE_PIN 49
#define ORIG_X_STEP_PIN 48
#define ORIG_X_DIR_PIN 47
#define ORIG_X_ENABLE_PIN 49
#define X_MIN_PIN 5
#define X_MAX_PIN -1 //2 //Max endstops default to disabled "-1", set to commented value to enable.
#define Y_STEP_PIN 39 // A6
#define Y_DIR_PIN 40 // A0
#define Y_ENABLE_PIN 38
#define ORIG_Y_STEP_PIN 39 // A6
#define ORIG_Y_DIR_PIN 40 // A0
#define ORIG_Y_ENABLE_PIN 38
#define Y_MIN_PIN 2
#define Y_MAX_PIN -1 //15
#define Z_STEP_PIN 42 // A2
#define Z_DIR_PIN 43 // A6
#define Z_ENABLE_PIN 41 // A1
#define ORIG_Z_STEP_PIN 42 // A2
#define ORIG_Z_DIR_PIN 43 // A6
#define ORIG_Z_ENABLE_PIN 41 // A1
#define Z_MIN_PIN 6
#define Z_MAX_PIN -1
#define E0_STEP_PIN 45
#define E0_DIR_PIN 44
#define E0_ENABLE_PIN 27
#define ORIG_E0_STEP_PIN 45
#define ORIG_E0_DIR_PIN 44
#define ORIG_E0_ENABLE_PIN 27
#define E1_STEP_PIN 36
#define E1_DIR_PIN 35
#define E1_ENABLE_PIN 37
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 35
#define ORIG_E1_ENABLE_PIN 37
#define E2_STEP_PIN -1
#define E2_DIR_PIN -1
#define E2_ENABLE_PIN -1
#define ORIG_E2_STEP_PIN -1
#define ORIG_E2_DIR_PIN -1
#define ORIG_E2_ENABLE_PIN -1
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 46
#define FAN_PIN 9
#define ORIG_FAN_PIN 9
#define FAN2_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1
......@@ -2927,35 +3382,35 @@
#define LARGE_FLASH true
#define X_STEP_PIN 58
#define X_DIR_PIN 57
#define X_ENABLE_PIN 59
#define ORIG_X_STEP_PIN 58
#define ORIG_X_DIR_PIN 57
#define ORIG_X_ENABLE_PIN 59
#define X_MIN_PIN 37
#define X_MAX_PIN 40 //2 //Max endstops default to disabled "-1", set to commented value to enable.
#define Y_STEP_PIN 5 // A6
#define Y_DIR_PIN 17 // A0
#define Y_ENABLE_PIN 4
#define ORIG_Y_STEP_PIN 5 // A6
#define ORIG_Y_DIR_PIN 17 // A0
#define ORIG_Y_ENABLE_PIN 4
#define Y_MIN_PIN 41
#define Y_MAX_PIN 38 //15
#define Z_STEP_PIN 16 // A2
#define Z_DIR_PIN 11 // A6
#define Z_ENABLE_PIN 3 // A1
#define ORIG_Z_STEP_PIN 16 // A2
#define ORIG_Z_DIR_PIN 11 // A6
#define ORIG_Z_ENABLE_PIN 3 // A1
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 29
#define ORIG_E0_STEP_PIN 28
#define ORIG_E0_DIR_PIN 27
#define ORIG_E0_ENABLE_PIN 29
#define E1_STEP_PIN 25
#define E1_DIR_PIN 24
#define E1_ENABLE_PIN 26
#define ORIG_E1_STEP_PIN 25
#define ORIG_E1_DIR_PIN 24
#define ORIG_E1_ENABLE_PIN 26
#define E2_STEP_PIN 22
#define E2_DIR_PIN 60
#define E2_ENABLE_PIN 23
#define ORIG_E2_STEP_PIN 22
#define ORIG_E2_DIR_PIN 60
#define ORIG_E2_ENABLE_PIN 23
#define SDPOWER -1
#define SDSS 53
......@@ -2981,7 +3436,7 @@
#define HEATER_1_PIN 8
#define HEATER_2_PIN 9
#define HEATER_BED_PIN 10
#define FAN_PIN 6
#define ORIG_FAN_PIN 6
#define FAN2_PIN 7
#if TEMP_SENSOR_0 == -1
......@@ -3054,23 +3509,23 @@
#define LARGE_FLASH true
#define X_STEP_PIN 25
#define X_DIR_PIN 23
#define ORIG_X_STEP_PIN 25
#define ORIG_X_DIR_PIN 23
#define X_MIN_PIN 15
#define X_MAX_PIN 14
#define X_ENABLE_PIN 27
#define ORIG_X_ENABLE_PIN 27
#define Y_STEP_PIN 31
#define Y_DIR_PIN 33
#define ORIG_Y_STEP_PIN 31
#define ORIG_Y_DIR_PIN 33
#define Y_MIN_PIN 17
#define Y_MAX_PIN 16
#define Y_ENABLE_PIN 29
#define ORIG_Y_ENABLE_PIN 29
#define Z_STEP_PIN 37
#define Z_DIR_PIN 39
#define ORIG_Z_STEP_PIN 37
#define ORIG_Z_DIR_PIN 39
#define Z_MIN_PIN 19
#define Z_MAX_PIN 18
#define Z_ENABLE_PIN 35
#define ORIG_Z_ENABLE_PIN 35
#define HEATER_BED_PIN -1
#define TEMP_BED_PIN -1
......@@ -3084,18 +3539,18 @@
#define HEATER_2_PIN -1
#define TEMP_2_PIN -1
#define E0_STEP_PIN 43
#define E0_DIR_PIN 45
#define E0_ENABLE_PIN 41
#define ORIG_E0_STEP_PIN 43
#define ORIG_E0_DIR_PIN 45
#define ORIG_E0_ENABLE_PIN 41
#define E1_STEP_PIN -1
#define E1_DIR_PIN -1
#define E1_ENABLE_PIN -1
#define ORIG_E1_STEP_PIN -1
#define ORIG_E1_DIR_PIN -1
#define ORIG_E1_ENABLE_PIN -1
#define SDPOWER -1
#define SDSS -1
#define LED_PIN -1
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
......@@ -3124,20 +3579,20 @@
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
#endif
#define X_STEP_PIN 25
#define X_DIR_PIN 23
#define ORIG_X_STEP_PIN 25
#define ORIG_X_DIR_PIN 23
#define X_STOP_PIN 22
#define X_ENABLE_PIN 27
#define ORIG_X_ENABLE_PIN 27
#define Y_STEP_PIN 32
#define Y_DIR_PIN 33
#define ORIG_Y_STEP_PIN 32
#define ORIG_Y_DIR_PIN 33
#define Y_STOP_PIN 26
#define Y_ENABLE_PIN 31
#define ORIG_Y_ENABLE_PIN 31
#define Z_STEP_PIN 35
#define Z_DIR_PIN 36
#define ORIG_Z_STEP_PIN 35
#define ORIG_Z_DIR_PIN 36
#define Z_STOP_PIN 29
#define Z_ENABLE_PIN 34
#define ORIG_Z_ENABLE_PIN 34
#define HEATER_BED_PIN 4
#define TEMP_BED_PIN 10
......@@ -3151,18 +3606,18 @@
#define HEATER_2_PIN -1
#define TEMP_2_PIN -1
#define E0_STEP_PIN 42
#define E0_DIR_PIN 43
#define E0_ENABLE_PIN 37
#define ORIG_E0_STEP_PIN 42
#define ORIG_E0_DIR_PIN 43
#define ORIG_E0_ENABLE_PIN 37
#define E1_STEP_PIN 49
#define E1_DIR_PIN 47
#define E1_ENABLE_PIN 48
#define ORIG_E1_STEP_PIN 49
#define ORIG_E1_DIR_PIN 47
#define ORIG_E1_ENABLE_PIN 48
#define SDPOWER -1
#define SDSS 53
#define LED_PIN 8
#define FAN_PIN 7
#define ORIG_FAN_PIN 7
#define PS_ON_PIN -1
#define KILL_PIN -1
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
......@@ -3216,21 +3671,21 @@
#define LARGE_FLASH true
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 63
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 63
#define Z_MIN_PIN 18
#define Z_MAX_PIN -1
......@@ -3242,20 +3697,20 @@
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 25
#define LED_PIN 13
#define FAN_PIN 8 // IO pin. Buffer needed
#define ORIG_FAN_PIN 8 // IO pin. Buffer needed
#define PS_ON_PIN 12
......@@ -3342,21 +3797,21 @@
#define LARGE_FLASH true
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define ORIG_X_STEP_PIN 54
#define ORIG_X_DIR_PIN 55
#define ORIG_X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define ORIG_Y_STEP_PIN 60
#define ORIG_Y_DIR_PIN 61
#define ORIG_Y_ENABLE_PIN 56
#define Y_MIN_PIN 14
#define Y_MAX_PIN 15
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 46
#define ORIG_Z_DIR_PIN 48
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 18
#define Z_MAX_PIN -1
......@@ -3368,20 +3823,20 @@
#define Z2_DIR_PIN 34
#define Z2_ENABLE_PIN 30
#define E0_STEP_PIN 26
#define E0_DIR_PIN 28
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 26
#define ORIG_E0_DIR_PIN 28
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 36
#define E1_DIR_PIN 34
#define E1_ENABLE_PIN 30
#define ORIG_E1_STEP_PIN 36
#define ORIG_E1_DIR_PIN 34
#define ORIG_E1_ENABLE_PIN 30
#define SDPOWER -1
#define SDSS 25
#define LED_PIN 13
#define FAN_PIN 8 // IO pin. Buffer needed
#define ORIG_FAN_PIN 8 // IO pin. Buffer needed
#define PS_ON_PIN 12
......@@ -3476,28 +3931,28 @@
#define LARGE_FLASH true
#define X_STEP_PIN 0
#define X_DIR_PIN 1
#define X_ENABLE_PIN 39
#define ORIG_X_STEP_PIN 0
#define ORIG_X_DIR_PIN 1
#define ORIG_X_ENABLE_PIN 39
#define Y_STEP_PIN 2
#define Y_DIR_PIN 3
#define Y_ENABLE_PIN 38
#define ORIG_Y_STEP_PIN 2
#define ORIG_Y_DIR_PIN 3
#define ORIG_Y_ENABLE_PIN 38
#define Z_STEP_PIN 4
#define Z_DIR_PIN 5
#define Z_ENABLE_PIN 23
#define ORIG_Z_STEP_PIN 4
#define ORIG_Z_DIR_PIN 5
#define ORIG_Z_ENABLE_PIN 23
#define E0_STEP_PIN 6
#define E0_DIR_PIN 7
#define E0_ENABLE_PIN 19
#define ORIG_E0_STEP_PIN 6
#define ORIG_E0_DIR_PIN 7
#define ORIG_E0_ENABLE_PIN 19
#define HEATER_0_PIN 21 // Extruder
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 20 // Bed
#define FAN_PIN 22 // Fan
// You may need to change FAN_PIN to 16 because Marlin isn't using fastio.h
#define ORIG_FAN_PIN 22 // Fan
// You may need to change ORIG_FAN_PIN to 16 because Marlin isn't using fastio.h
// for the fan and Teensyduino uses a different pin mapping.
#if MB(TEENSYLU) // Teensylu
......@@ -3552,39 +4007,39 @@
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif
#define X_STEP_PIN 17
#define X_DIR_PIN 16
#define X_ENABLE_PIN 48
#define ORIG_X_STEP_PIN 17
#define ORIG_X_DIR_PIN 16
#define ORIG_X_ENABLE_PIN 48
#define X_MIN_PIN 37
#define X_MAX_PIN 36
#define Y_STEP_PIN 54
#define Y_DIR_PIN 47
#define Y_ENABLE_PIN 55
#define ORIG_Y_STEP_PIN 54
#define ORIG_Y_DIR_PIN 47
#define ORIG_Y_ENABLE_PIN 55
#define Y_MIN_PIN 35
#define Y_MAX_PIN 34
#define Z_STEP_PIN 57
#define Z_DIR_PIN 56
#define Z_ENABLE_PIN 62
#define ORIG_Z_STEP_PIN 57
#define ORIG_Z_DIR_PIN 56
#define ORIG_Z_ENABLE_PIN 62
#define Z_MIN_PIN 33
#define Z_MAX_PIN 32
#define E0_STEP_PIN 23
#define E0_DIR_PIN 22
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 23
#define ORIG_E0_DIR_PIN 22
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN 26
#define E1_DIR_PIN 25
#define E1_ENABLE_PIN 27
#define ORIG_E1_STEP_PIN 26
#define ORIG_E1_DIR_PIN 25
#define ORIG_E1_ENABLE_PIN 27
#define E2_STEP_PIN 29
#define E2_DIR_PIN 28
#define E2_ENABLE_PIN 39
#define ORIG_E2_STEP_PIN 29
#define ORIG_E2_DIR_PIN 28
#define ORIG_E2_ENABLE_PIN 39
#define LED_PIN 13
#define FAN_PIN 7
#define ORIG_FAN_PIN 7
//additional FAN1 PIN (e.g. useful for electronics fan or light on/off) on PIN 8
#define PS_ON_PIN 45
......@@ -3677,34 +4132,34 @@
#error Oops! Make sure you have 'Brainwave' selected from the 'Tools -> Boards' menu.
#endif
#define X_STEP_PIN 27
#define X_DIR_PIN 29
#define X_ENABLE_PIN 28
#define ORIG_X_STEP_PIN 27
#define ORIG_X_DIR_PIN 29
#define ORIG_X_ENABLE_PIN 28
#define X_STOP_PIN 7
#define X_ATT_PIN 26
#define Y_STEP_PIN 31
#define Y_DIR_PIN 33
#define Y_ENABLE_PIN 32
#define ORIG_Y_STEP_PIN 31
#define ORIG_Y_DIR_PIN 33
#define ORIG_Y_ENABLE_PIN 32
#define Y_STOP_PIN 6
#define Y_ATT_PIN 30
#define Z_STEP_PIN 17
#define Z_DIR_PIN 19
#define Z_ENABLE_PIN 18
#define ORIG_Z_STEP_PIN 17
#define ORIG_Z_DIR_PIN 19
#define ORIG_Z_ENABLE_PIN 18
#define Z_STOP_PIN 5
#define Z_ATT_PIN 16
#define E0_STEP_PIN 21
#define E0_DIR_PIN 23
#define E0_ENABLE_PIN 22
#define ORIG_E0_STEP_PIN 21
#define ORIG_E0_DIR_PIN 23
#define ORIG_E0_ENABLE_PIN 22
#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 ORIG_FAN_PIN 3 // Fan
#define TEMP_0_PIN 7 // Extruder / Analog pin numbering
#define TEMP_1_PIN -1
......@@ -3749,27 +4204,27 @@
#define LARGE_FLASH true
#define X_STEP_PIN 0
#define X_DIR_PIN 1
#define X_ENABLE_PIN 39
#define ORIG_X_STEP_PIN 0
#define ORIG_X_DIR_PIN 1
#define ORIG_X_ENABLE_PIN 39
#define Y_STEP_PIN 2
#define Y_DIR_PIN 3
#define Y_ENABLE_PIN 38
#define ORIG_Y_STEP_PIN 2
#define ORIG_Y_DIR_PIN 3
#define ORIG_Y_ENABLE_PIN 38
#define Z_STEP_PIN 4
#define Z_DIR_PIN 5
#define Z_ENABLE_PIN 23
#define ORIG_Z_STEP_PIN 4
#define ORIG_Z_DIR_PIN 5
#define ORIG_Z_ENABLE_PIN 23
#define E0_STEP_PIN 6
#define E0_DIR_PIN 7
#define E0_ENABLE_PIN 19
#define ORIG_E0_STEP_PIN 6
#define ORIG_E0_DIR_PIN 7
#define ORIG_E0_ENABLE_PIN 19
#define HEATER_0_PIN 21 // Extruder
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 20 // Bed
#define FAN_PIN 16 // Fan -- from Teensyduino environment.
#define ORIG_FAN_PIN 16 // Fan -- from Teensyduino environment.
// For the fan and Teensyduino uses a different pin mapping.
#define X_STOP_PIN 13
#define Y_STOP_PIN 14
......@@ -3891,27 +4346,27 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
// or build from command line with: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84 make
#endif
#define X_STEP_PIN 28 // 0 Marlin
#define X_DIR_PIN 29 // 1 Marlin
#define X_ENABLE_PIN 26
#define ORIG_X_STEP_PIN 28 // 0 Marlin
#define ORIG_X_DIR_PIN 29 // 1 Marlin
#define ORIG_X_ENABLE_PIN 26
#define Y_STEP_PIN 30 // 2 Marlin
#define Y_DIR_PIN 31 // 3
#define Y_ENABLE_PIN 26 // Shared w/x
#define ORIG_Y_STEP_PIN 30 // 2 Marlin
#define ORIG_Y_DIR_PIN 31 // 3
#define ORIG_Y_ENABLE_PIN 26 // Shared w/x
#define Z_STEP_PIN 32 // 4
#define Z_DIR_PIN 33 // 5
#define Z_ENABLE_PIN 26 // Shared w/x
#define ORIG_Z_STEP_PIN 32 // 4
#define ORIG_Z_DIR_PIN 33 // 5
#define ORIG_Z_ENABLE_PIN 26 // Shared w/x
#define E0_STEP_PIN 34 // 6
#define E0_DIR_PIN 35 // 7
#define E0_ENABLE_PIN 26 // Shared w/x
#define ORIG_E0_STEP_PIN 34 // 6
#define ORIG_E0_DIR_PIN 35 // 7
#define ORIG_E0_ENABLE_PIN 26 // Shared w/x
#define HEATER_0_PIN 15 // 21 // Extruder
#define HEATER_1_PIN -1
#define HEATER_2_PIN -1
#define HEATER_BED_PIN 14 // 20 // Bed
#define FAN_PIN 16 // 22 // Fan
#define ORIG_FAN_PIN 16 // 22 // Fan
#define X_STOP_PIN 2
#define Y_STOP_PIN 3
......@@ -3972,32 +4427,32 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define LARGE_FLASH true
#define X_STEP_PIN 0
#define X_DIR_PIN 1
#define X_ENABLE_PIN 23
#define ORIG_X_STEP_PIN 0
#define ORIG_X_DIR_PIN 1
#define ORIG_X_ENABLE_PIN 23
#define X_STOP_PIN 37
#define Y_STEP_PIN 2
#define Y_DIR_PIN 3
#define Y_ENABLE_PIN 19
#define ORIG_Y_STEP_PIN 2
#define ORIG_Y_DIR_PIN 3
#define ORIG_Y_ENABLE_PIN 19
#define Y_STOP_PIN 36
#define Z_STEP_PIN 4
#define Z_DIR_PIN 5
#define Z_ENABLE_PIN 18
#define ORIG_Z_STEP_PIN 4
#define ORIG_Z_DIR_PIN 5
#define ORIG_Z_ENABLE_PIN 18
#define Z_STOP_PIN 39
#define E0_STEP_PIN 6
#define E0_DIR_PIN 7
#define E0_ENABLE_PIN 17
#define ORIG_E0_STEP_PIN 6
#define ORIG_E0_DIR_PIN 7
#define ORIG_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
// You may need to change ORIG_FAN_PIN to 16 because Marlin isn't using fastio.h
// for the fan and Teensyduino uses a different pin mapping.
#define FAN_PIN 16 // Fan
#define ORIG_FAN_PIN 16 // Fan
#define TEMP_0_PIN 1 // Extruder / Analog pin numbering
#define TEMP_BED_PIN 0 // Bed / Analog pin numbering
......@@ -4052,24 +4507,24 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#endif
#endif
#define X_STEP_PIN 15
#define X_DIR_PIN 18
#define ORIG_X_STEP_PIN 15
#define ORIG_X_DIR_PIN 18
#define X_STOP_PIN 20
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define Y_STOP_PIN 25
#define Z_STEP_PIN 27
#define Z_DIR_PIN 28
#define ORIG_Z_STEP_PIN 27
#define ORIG_Z_DIR_PIN 28
#define Z_STOP_PIN 30
#define E0_STEP_PIN 17
#define E0_DIR_PIN 21
#define ORIG_E0_STEP_PIN 17
#define ORIG_E0_DIR_PIN 21
#define LED_PIN -1
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#define PS_ON_PIN 14
#define KILL_PIN -1
......@@ -4077,10 +4532,10 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define HEATER_0_PIN 12 // (extruder)
#define HEATER_BED_PIN 16 // (bed)
#define X_ENABLE_PIN 19
#define Y_ENABLE_PIN 24
#define Z_ENABLE_PIN 29
#define E0_ENABLE_PIN 13
#define ORIG_X_ENABLE_PIN 19
#define ORIG_Y_ENABLE_PIN 24
#define ORIG_Z_ENABLE_PIN 29
#define ORIG_E0_ENABLE_PIN 13
#define TEMP_0_PIN 0 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder)
#define TEMP_1_PIN -1
......@@ -4134,38 +4589,38 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#error Oops! Make sure you have 'SanguinoA' selected from the 'Tools -> Boards' menu.
#endif
#define X_STEP_PIN 21
#define X_DIR_PIN 20
#define X_ENABLE_PIN 24
#define ORIG_X_STEP_PIN 21
#define ORIG_X_DIR_PIN 20
#define ORIG_X_ENABLE_PIN 24
#define X_STOP_PIN 0
#define Y_STEP_PIN 23
#define Y_DIR_PIN 22
#define Y_ENABLE_PIN 24
#define ORIG_Y_STEP_PIN 23
#define ORIG_Y_DIR_PIN 22
#define ORIG_Y_ENABLE_PIN 24
#define Y_STOP_PIN 1
#define Z_STEP_PIN 26
#define Z_DIR_PIN 25
#define Z_ENABLE_PIN 24
#define ORIG_Z_STEP_PIN 26
#define ORIG_Z_DIR_PIN 25
#define ORIG_Z_ENABLE_PIN 24
#define Z_STOP_PIN 2
#define E0_STEP_PIN 28
#define E0_DIR_PIN 27
#define E0_ENABLE_PIN 24
#define ORIG_E0_STEP_PIN 28
#define ORIG_E0_DIR_PIN 27
#define ORIG_E0_ENABLE_PIN 24
#define E1_STEP_PIN -1 // 19
#define E1_DIR_PIN -1 // 18
#define E1_ENABLE_PIN 24
#define ORIG_E1_STEP_PIN -1 // 19
#define ORIG_E1_DIR_PIN -1 // 18
#define ORIG_E1_ENABLE_PIN 24
#define E2_STEP_PIN -1 // 17
#define E2_DIR_PIN -1 // 16
#define E2_ENABLE_PIN 24
#define ORIG_E2_STEP_PIN -1 // 17
#define ORIG_E2_DIR_PIN -1 // 16
#define ORIG_E2_ENABLE_PIN 24
#define SDPOWER -1
#define SDSS 11
#define SDCARDDETECT -1 // 10 optional also used as mode pin
#define LED_PIN -1
#define FAN_PIN 3
#define ORIG_FAN_PIN 3
#define PS_ON_PIN -1
#define KILL_PIN -1
......@@ -4188,24 +4643,24 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. (Final OMCA board)
#endif
#define X_STEP_PIN 26
#define X_DIR_PIN 25
#define X_ENABLE_PIN 10
#define ORIG_X_STEP_PIN 26
#define ORIG_X_DIR_PIN 25
#define ORIG_X_ENABLE_PIN 10
#define X_STOP_PIN 0
#define Y_STEP_PIN 28
#define Y_DIR_PIN 27
#define Y_ENABLE_PIN 10
#define ORIG_Y_STEP_PIN 28
#define ORIG_Y_DIR_PIN 27
#define ORIG_Y_ENABLE_PIN 10
#define Y_STOP_PIN 1
#define Z_STEP_PIN 23
#define Z_DIR_PIN 22
#define Z_ENABLE_PIN 10
#define ORIG_Z_STEP_PIN 23
#define ORIG_Z_DIR_PIN 22
#define ORIG_Z_ENABLE_PIN 10
#define Z_STOP_PIN 2
#define E0_STEP_PIN 24
#define E0_DIR_PIN 21
#define E0_ENABLE_PIN 10
#define ORIG_E0_STEP_PIN 24
#define ORIG_E0_DIR_PIN 21
#define ORIG_E0_ENABLE_PIN 10
/* future proofing */
#define __FS 20
......@@ -4215,19 +4670,19 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define UNUSED_PWM 14 /* PWM on LEFT connector */
#define E1_STEP_PIN -1 // 21
#define E1_DIR_PIN -1 // 20
#define E1_ENABLE_PIN -1 // 19
#define ORIG_E1_STEP_PIN -1 // 21
#define ORIG_E1_DIR_PIN -1 // 20
#define ORIG_E1_ENABLE_PIN -1 // 19
#define E2_STEP_PIN -1 // 21
#define E2_DIR_PIN -1 // 20
#define E2_ENABLE_PIN -1 // 18
#define ORIG_E2_STEP_PIN -1 // 21
#define ORIG_E2_DIR_PIN -1 // 20
#define ORIG_E2_ENABLE_PIN -1 // 18
#define SDPOWER -1
#define SDSS 11
#define SDCARDDETECT -1 // 10 optional also used as mode pin
#define LED_PIN -1
#define FAN_PIN 14 /* PWM on MIDDLE connector */
#define ORIG_FAN_PIN 14 /* PWM on MIDDLE connector */
#define PS_ON_PIN -1
#define KILL_PIN -1
......@@ -4263,31 +4718,31 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#endif
#endif
#define X_STEP_PIN 28
#define X_DIR_PIN 63
#define X_ENABLE_PIN 29
#define ORIG_X_STEP_PIN 28
#define ORIG_X_DIR_PIN 63
#define ORIG_X_ENABLE_PIN 29
#define X_MIN_PIN 47
#define X_MAX_PIN -1 //2 //Max endstops default to disabled "-1", set to commented value to enable.
#define Y_STEP_PIN 14 // A6
#define Y_DIR_PIN 15 // A0
#define Y_ENABLE_PIN 39
#define ORIG_Y_STEP_PIN 14 // A6
#define ORIG_Y_DIR_PIN 15 // A0
#define ORIG_Y_ENABLE_PIN 39
#define Y_MIN_PIN 48
#define Y_MAX_PIN -1 //15
#define Z_STEP_PIN 31 // A2
#define Z_DIR_PIN 32 // A6
#define Z_ENABLE_PIN 30 // A1
#define ORIG_Z_STEP_PIN 31 // A2
#define ORIG_Z_DIR_PIN 32 // A6
#define ORIG_Z_ENABLE_PIN 30 // A1
#define Z_MIN_PIN 49
#define Z_MAX_PIN -1
#define E0_STEP_PIN 34 //34
#define E0_DIR_PIN 35 //35
#define E0_ENABLE_PIN 33 //33
#define ORIG_E0_STEP_PIN 34 //34
#define ORIG_E0_DIR_PIN 35 //35
#define ORIG_E0_ENABLE_PIN 33 //33
#define E1_STEP_PIN 37 //37
#define E1_DIR_PIN 40 //40
#define E1_ENABLE_PIN 36 //36
#define ORIG_E1_STEP_PIN 37 //37
#define ORIG_E1_DIR_PIN 40 //40
#define ORIG_E1_ENABLE_PIN 36 //36
#define Y2_STEP_PIN 37
#define Y2_DIR_PIN 40
......@@ -4301,7 +4756,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define SDSS 11
#define SDCARDDETECT -1 // 10 optional also used as mode pin
#define LED_PIN 13
#define FAN_PIN 7
#define ORIG_FAN_PIN 7
#define PS_ON_PIN -1
#define KILL_PIN -1
#define SOL1_PIN 16
......@@ -4330,29 +4785,29 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#if MB(99)
#define KNOWN_BOARD 1
#define X_STEP_PIN 2
#define X_DIR_PIN 3
#define X_ENABLE_PIN -1
#define ORIG_X_STEP_PIN 2
#define ORIG_X_DIR_PIN 3
#define ORIG_X_ENABLE_PIN -1
#define X_STOP_PIN 16
#define Y_STEP_PIN 5
#define Y_DIR_PIN 6
#define Y_ENABLE_PIN -1
#define ORIG_Y_STEP_PIN 5
#define ORIG_Y_DIR_PIN 6
#define ORIG_Y_ENABLE_PIN -1
#define Y_STOP_PIN 67
#define Z_STEP_PIN 62
#define Z_DIR_PIN 63
#define Z_ENABLE_PIN -1
#define ORIG_Z_STEP_PIN 62
#define ORIG_Z_DIR_PIN 63
#define ORIG_Z_ENABLE_PIN -1
#define Z_STOP_PIN 59
#define E0_STEP_PIN 65
#define E0_DIR_PIN 66
#define E0_ENABLE_PIN -1
#define ORIG_E0_STEP_PIN 65
#define ORIG_E0_DIR_PIN 66
#define ORIG_E0_ENABLE_PIN -1
#define SDPOWER -1
#define SDSS 53
#define LED_PIN -1
#define FAN_PIN -1
#define ORIG_FAN_PIN -1
#define PS_ON_PIN 9
#define KILL_PIN -1
......@@ -4370,6 +4825,38 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
/****************************************************************************************
*********** Available chip select pins for HW SPI are 4 10 52 77 ************************
/****************************************************************************************/
#if (SDSS == 4) || (SDSS == 10) || (SDSS == 52) || (SDSS == 77)
#if (SDSS == 4)
#define SPI_PIN 87
#define SPI_CHAN 1
#elif (SDSS == 10)
#define SPI_PIN 77
#define SPI_CHAN 0
#elif (SDSS == 52)
#define SPI_PIN 86
#define SPI_CHAN 2
#else
#define SPI_PIN 77
#define SPI_CHAN 0
#endif
#define MOSI_PIN 75
#define MISO_PIN 74
#define SCK_PIN 76
#define SS_PIN 77
//#define DUE_SOFTWARE_SPI
#else
#define DUE_SOFTWARE_SPI
#define MOSI_PIN 51
#define MISO_PIN 50
#define SCK_PIN 52
#endif
/****************************************************************************************/
/****************************************************************************************
********************************* END MOTHERBOARD ***************************************
/****************************************************************************************/
......@@ -4498,30 +4985,51 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define TEMP_3_PIN -1
#elif HOTENDS == 2
#undef HEATER_2_PIN
#undef HEATER_3_PIN
#define HEATER_2_PIN -1
#define HEATER_3_PIN -1
#undef TEMP_2_PIN
#undef TEMP_3_PIN
#define TEMP_2_PIN -1
#define TEMP_3_PIN -1
#elif HOTENDS == 3
#undef HEATER_3_PIN
#define HEATER_3_PIN -1
#undef TEMP_3_PIN
#define TEMP_3_PIN -1
#endif
#ifdef MKR4
#if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS==1) // Use this for one driver and two extruder
#if (EXTRUDERS == 2) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and two extruder
#define E0E1_CHOICE_PIN 5
#elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and 3 extruder
#define E0E1_CHOICE_PIN 5
#elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS==2) // Use this for two driver and 3 extruder
#define E0E2_CHOICE_PIN 6
#elif (EXTRUDERS == 4) && (DRIVER_EXTRUDERS == 1) // Use this for one driver and 4 extruder
#define E0E1_CHOICE_PIN 4
#define E0E2_CHOICE_PIN 5
#define E0E3_CHOICE_PIN 6
#elif (EXTRUDERS == 3) && (DRIVER_EXTRUDERS == 2) // Use this for two driver and 3 extruder
#define E0E2_CHOICE_PIN 5
#elif (EXTRUDERS == 4) && (DRIVER_EXTRUDERS==2) // Use this for two driver and 4 extruder
#elif (EXTRUDERS == 4) && (DRIVER_EXTRUDERS == 2) // Use this for two driver and 4 extruder
#define E0E2_CHOICE_PIN 5
#define E1E3_CHOICE_PIN 6
#endif //EXTRUDERS
#endif //MKR4
#ifdef NPR2
#define E_MIN_PIN -1
#define E_MIN_PIN -1
#endif //NPR2
#ifdef LASERBEAM
#define LASER_PWR_PIN 42
#define LASER_TTL_PIN 44
#define LASER_PWR_PIN 41
#define LASER_TTL_PIN 42
#endif
#ifdef FILAMENT_RUNOUT_SENSOR
#define FILRUNOUT_PIN -1
#define FILRUNOUT_PIN -1
#endif
#ifdef POWER_CONSUMPTION
......
......@@ -3,39 +3,47 @@
//============================================================================
//X axis pins
#define ORIG_X_STEP_PIN X_STEP_PIN
#define ORIG_X_DIR_PIN X_DIR_PIN
#define ORIG_X_ENABLE_PIN X_ENABLE_PIN
#define X_STEP_PIN ORIG_X_STEP_PIN
#define X_DIR_PIN ORIG_X_DIR_PIN
#define X_ENABLE_PIN ORIG_X_ENABLE_PIN
//Y axis pins
#define ORIG_Y_STEP_PIN Y_STEP_PIN
#define ORIG_Y_DIR_PIN Y_DIR_PIN
#define ORIG_Y_ENABLE_PIN Y_ENABLE_PIN
#define Y_STEP_PIN ORIG_Y_STEP_PIN
#define Y_DIR_PIN ORIG_Y_DIR_PIN
#define Y_ENABLE_PIN ORIG_Y_ENABLE_PIN
//Z axis pins
#define ORIG_Z_STEP_PIN Z_STEP_PIN
#define ORIG_Z_DIR_PIN Z_DIR_PIN
#define ORIG_Z_ENABLE_PIN Z_ENABLE_PIN
#define Z_STEP_PIN ORIG_Z_STEP_PIN
#define Z_DIR_PIN ORIG_Z_DIR_PIN
#define Z_ENABLE_PIN ORIG_Z_ENABLE_PIN
//E axis pins
#define ORIG_E0_STEP_PIN E0_STEP_PIN
#define ORIG_E0_DIR_PIN E0_DIR_PIN
#define ORIG_E0_ENABLE_PIN E0_ENABLE_PIN
#define ORIG_E1_STEP_PIN E1_STEP_PIN
#define ORIG_E1_DIR_PIN E1_DIR_PIN
#define ORIG_E1_ENABLE_PIN E1_ENABLE_PIN
#define ORIG_E2_STEP_PIN E2_STEP_PIN
#define ORIG_E2_DIR_PIN E2_DIR_PIN
#define ORIG_E2_ENABLE_PIN E2_ENABLE_PIN
#define ORIG_E3_STEP_PIN E3_STEP_PIN
#define ORIG_E3_DIR_PIN E3_DIR_PIN
#define ORIG_E3_ENABLE_PIN E3_ENABLE_PIN
#if DRIVER_EXTRUDERS > 0
#define E0_STEP_PIN ORIG_E0_STEP_PIN
#define E0_DIR_PIN ORIG_E0_DIR_PIN
#define E0_ENABLE_PIN ORIG_E0_ENABLE_PIN
#endif
#if DRIVER_EXTRUDERS > 1
#define E1_STEP_PIN ORIG_E1_STEP_PIN
#define E1_DIR_PIN ORIG_E1_DIR_PIN
#define E1_ENABLE_PIN ORIG_E1_ENABLE_PIN
#endif
#if DRIVER_EXTRUDERS > 2
#define E2_STEP_PIN ORIG_E2_STEP_PIN
#define E2_DIR_PIN ORIG_E2_DIR_PIN
#define E2_ENABLE_PIN ORIG_E2_ENABLE_PIN
#endif
#if DRIVER_EXTRUDERS > 3
#define E3_STEP_PIN ORIG_E3_STEP_PIN
#define E3_DIR_PIN ORIG_E3_DIR_PIN
#define E3_ENABLE_PIN ORIG_E3_ENABLE_PIN
#endif
//FAN pin
#define ORIG_FAN_PIN FAN_PIN
#define FAN_PIN ORIG_FAN_PIN
//============================================================================
......
......@@ -1040,7 +1040,7 @@ float junction_deviation = 0.1;
float nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]);
float ny = position[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]);
float nz = position[Z_AXIS] = lround(z * axis_steps_per_unit[Z_AXIS]);
float ne = position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + extruder]);
float ne = position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]);
st_set_position(nx, ny, nz, ne);
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
......@@ -1048,7 +1048,7 @@ float junction_deviation = 0.1;
}
void plan_set_e_position(const float &e) {
position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + extruder]);
position[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + active_extruder]);
st_set_e_position(position[E_AXIS]);
}
......
......@@ -509,14 +509,22 @@ ISR(TIMER1_COMPA_vect) {
count_direction[Y_AXIS] = 1;
}
#define _ENDSTOP(axis, minmax) axis ##_## minmax ##_endstop
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
#define _OLD_ENDSTOP(axis, minmax) old_## axis ##_## minmax ##_endstop
#define _AXIS(AXIS) AXIS ##_AXIS
#define _ENDSTOP_HIT(axis) endstop_## axis ##_hit
#define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \
bool axis ##_## minmax ##_endstop = (READ(AXIS ##_## MINMAX ##_PIN) != AXIS ##_## MINMAX ##_ENDSTOP_INVERTING); \
if (axis ##_## minmax ##_endstop && old_## axis ##_## minmax ##_endstop && (current_block->steps[AXIS ##_AXIS] > 0)) { \
endstops_trigsteps[AXIS ##_AXIS] = count_position[AXIS ##_AXIS]; \
endstop_## axis ##_hit = true; \
bool _ENDSTOP(axis, minmax) = (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)); \
if (_ENDSTOP(axis, minmax) && _OLD_ENDSTOP(axis, minmax) && (current_block->steps[_AXIS(AXIS)] > 0)) { \
endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \
_ENDSTOP_HIT(axis) = true; \
step_events_completed = current_block->step_event_count; \
} \
old_## axis ##_## minmax ##_endstop = axis ##_## minmax ##_endstop;
_OLD_ENDSTOP(axis, minmax) = _ENDSTOP(axis, minmax);
// Check X and Y endstops
if (check_endstops) {
......@@ -714,6 +722,11 @@ ISR(TIMER1_COMPA_vect) {
}
#endif //ADVANCE
#define _COUNTER(axis) counter_## axis
#define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
#define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
#ifdef CONFIG_STEPPERS_TOSHIBA
/**
* The Toshiba stepper controller require much longer pulses.
......@@ -722,8 +735,8 @@ ISR(TIMER1_COMPA_vect) {
* lag to allow it work with without needing NOPs
*/
#define STEP_ADD(axis, AXIS) \
counter_## axis += current_block->steps[AXIS ##_AXIS]; \
if (counter_## axis > 0) { AXIS ##_STEP_WRITE(HIGH); }
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { _WRITE_STEP(AXIS, HIGH); }
STEP_ADD(x,X);
STEP_ADD(y,Y);
STEP_ADD(z,Z);
......@@ -732,10 +745,10 @@ ISR(TIMER1_COMPA_vect) {
#endif
#define STEP_IF_COUNTER(axis, AXIS) \
if (counter_## axis > 0) { \
counter_## axis -= current_block->step_event_count; \
count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \
AXIS ##_STEP_WRITE(LOW); \
if (_COUNTER(axis) > 0) { \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_WRITE_STEP(AXIS, LOW); \
}
STEP_IF_COUNTER(x, X);
......@@ -748,12 +761,12 @@ ISR(TIMER1_COMPA_vect) {
#else // !CONFIG_STEPPERS_TOSHIBA
#define APPLY_MOVEMENT(axis, AXIS) \
counter_## axis += current_block->steps[AXIS ##_AXIS]; \
if (counter_## axis > 0) { \
AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN,0); \
counter_## axis -= current_block->step_event_count; \
count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \
AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN,0); \
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
APPLY_MOVEMENT(x, X);
......@@ -1079,10 +1092,13 @@ void st_init() {
#endif
#endif
#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
#define _DISABLE(axis) disable_## axis()
#define AXIS_INIT(axis, AXIS, PIN) \
AXIS ##_STEP_INIT; \
AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
disable_## axis()
_STEP_INIT(AXIS); \
_WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \
_DISABLE(axis)
#define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
......@@ -1230,14 +1246,19 @@ void quickStop() {
// No other ISR should ever interrupt this!
void babystep(const uint8_t axis, const bool direction) {
#define _ENABLE(axis) enable_## axis()
#define _READ_DIR(AXIS) AXIS ##_DIR_READ
#define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
#define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
#define BABYSTEP_AXIS(axis, AXIS, INVERT) { \
enable_## axis(); \
uint8_t old_pin = AXIS ##_DIR_READ; \
AXIS ##_APPLY_DIR(INVERT_## AXIS ##_DIR^direction^INVERT, true); \
AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN, true); \
_ENABLE(axis); \
uint8_t old_pin = _READ_DIR(AXIS); \
_APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
delayMicroseconds(2); \
AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN, true); \
AXIS ##_APPLY_DIR(old_pin, true); \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
_APPLY_DIR(AXIS, old_pin); \
}
switch(axis) {
......
......@@ -25,7 +25,7 @@
#include "stepper_indirection.h"
#if MB(ALLIGATOR)
#include "ExternalDac.h"
#include "external_dac.h"
#endif
#if DRIVER_EXTRUDERS > 3
......
......@@ -795,21 +795,12 @@ static void updateTemperaturesFromRawValues() {
watt_overflow--;
}
#endif
<<<<<<< HEAD
static unsigned int second_overflow = 0;
second_overflow += from_last_update;
if(second_overflow >= 1000) {
printer_usage_seconds++;
second_overflow -= 1000;
=======
static unsigned int second_overflow = 0;
second_overflow += from_last_update;
if(second_overflow >= 1000) {
printer_usage_seconds++;
second_overflow -= 1000;
>>>>>>> origin/master
}
last_update = temp_last_update;
//Reset the watchdog after we know we have a temperature measurement.
......
......@@ -25,6 +25,9 @@
#include "planner.h"
#include "stepper.h"
// for smoother temperature
#define MEDIAN_COUNT 10
// public functions
void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically.
......
......@@ -5,7 +5,7 @@
#include "cardreader.h"
#include "temperature.h"
#include "stepper.h"
#include "ConfigurationStore.h"
#include "configuration_store.h"
int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
......
......@@ -662,7 +662,7 @@ static void lcd_implementation_status_screen() {
}
#if HAS_LCD_POWER_SENSOR
#if HAS_LCD_FILAMENT_SENSOR
else if (millis() < previous_lcd_status_ms + 10000)
else if (millis() < message_millis + 10000)
#else
else
#endif
......
......@@ -43,10 +43,10 @@ void watchdog_reset()
#ifdef WATCHDOG_RESET_MANUAL
ISR(WDT_vect)
{
ECHO_LM(MSG_WATCHDOG_RESET);
//TODO: This message gets overwritten by the kill() call
LCD_ALERTMESSAGEPGM("ERR:Please Reset");//16 characters so it fits on a 16x2 display
lcd_update();
ECHO_LM(MSG_WATCHDOG_RESET);
kill(); //kill blocks
while(1); //wait for user or serial reset
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment