241 lines
7.4 KiB
Plaintext
241 lines
7.4 KiB
Plaintext
#ifndef _CONFIG_H
|
|
#define _CONFIG_H
|
|
|
|
/*
|
|
Values reflecting the gearing of your machine.
|
|
All numbers are integers, so no decimals, please :-)
|
|
*/
|
|
|
|
// calculate these values appropriate for your machine
|
|
// for threaded rods, this is (steps motor per turn) / (pitch of the thread)
|
|
// for belts, this is (steps per motor turn) / (number of gear teeth) / (belt module)
|
|
// half-stepping doubles the number, quarter stepping requires * 4, etc.
|
|
#define STEPS_PER_MM_X 320
|
|
#define STEPS_PER_MM_Y 320
|
|
#define STEPS_PER_MM_Z 320
|
|
|
|
// http://blog.arcol.hu/?p=157 may help with this next one
|
|
#define STEPS_PER_MM_E 320
|
|
|
|
/*
|
|
Values depending on the capabilities of your stepper motors and other mechanics.
|
|
All numbers are integers, no decimals allowed.
|
|
*/
|
|
|
|
// used for G0 rapid moves and as a cap for all other feedrates
|
|
#define MAXIMUM_FEEDRATE_X 200
|
|
#define MAXIMUM_FEEDRATE_Y 200
|
|
#define MAXIMUM_FEEDRATE_Z 100
|
|
#define MAXIMUM_FEEDRATE_E 200
|
|
|
|
// used when searching endstops and as default feedrate
|
|
#define SEARCH_FEEDRATE_X 50
|
|
#define SEARCH_FEEDRATE_Y 50
|
|
#define SEARCH_FEEDRATE_Z 50
|
|
#define SEARCH_FEEDRATE_E 50
|
|
|
|
// extruder settings
|
|
#define TEMP_HYSTERESIS 20
|
|
#define TEMP_RESIDENCY_TIME 60
|
|
|
|
// this is how many steps to suck back the filament by when we stop
|
|
#define E_STARTSTOP_STEPS 20
|
|
|
|
/*
|
|
acceleration, reprap style.
|
|
Each movement starts at the speed of the previous command and accelerates or decelerates linearly to reach target speed at the end of the movement.
|
|
Can also be set in Makefile
|
|
*/
|
|
#define ACCELERATION_REPRAP
|
|
|
|
/*
|
|
acceleration and deceleration ramping.
|
|
Each movement starts at (almost) no speed, linearly accelerates to target speed and decelerates just in time to smoothly stop at the target. alternative to ACCELERATION_REPRAP
|
|
Can also be set in Makefile
|
|
*/
|
|
//#define ACCELERATION_RAMPING
|
|
|
|
// how fast to accelerate when using ACCELERATION_RAMPING
|
|
// smaller values give quicker acceleration
|
|
// valid range = 1 to 8,000,000; 500,000 is a good starting point
|
|
#define ACCELERATION_STEEPNESS 500000
|
|
|
|
#ifdef ACCELERATION_REPRAP
|
|
#ifdef ACCELERATION_RAMPING
|
|
#error Cant use ACCELERATION_REPRAP and ACCELERATION_RAMPING together.
|
|
#endif
|
|
#endif
|
|
|
|
// which temperature sensor are you using?
|
|
// #define TEMP_MAX6675
|
|
#define TEMP_THERMISTOR
|
|
// #define TEMP_AD595
|
|
|
|
// if you selected thermistor or AD595, what pin is it on?
|
|
#define TEMP_PIN_CHANNEL AIO0_PIN
|
|
#define ANALOG_MASK MASK(TEMP_PIN_CHANNEL)
|
|
|
|
/*
|
|
Firmware build options
|
|
*/
|
|
|
|
// this option makes the step interrupt interruptible.
|
|
// this should help immensely with dropped serial characters, but may also make debugging infuriating due to the complexities arising from nested interrupts
|
|
#define STEP_INTERRUPT_INTERRUPTIBLE 1
|
|
|
|
/*
|
|
Xon/Xoff flow control.
|
|
Redundant when using RepRap Host for sending GCode, but mandatory when sending GCode files with a plain terminal emulator, like GtkTerm (Linux), CoolTerm (Mac) or HyperTerminal (Windows).
|
|
Can also be set in Makefile
|
|
*/
|
|
// #define XONXOFF
|
|
|
|
/*
|
|
move buffer size, in number of moves
|
|
note that each move takes a fair chunk of ram (69 bytes as of this writing) so don't make the buffer too big - a bigger serial readbuffer may help more than increasing this unless your gcodes are more than 70 characters long on average.
|
|
however, a larger movebuffer will probably help with lots of short consecutive moves, as each move takes a bunch of math (hence time) to set up so a longer buffer allows more of the math to be done during preceding longer moves
|
|
*/
|
|
#define MOVEBUFFER_SIZE 8
|
|
|
|
/*
|
|
FiveD on Arduino implements a watchdog, which has to be reset every 250ms or it will reboot the controller. As rebooting (and letting the GCode sending application trying to continue the build with a then different Home point) is probably even worse than just hanging, and there is no better restore code in place, this is disabled for now.
|
|
*/
|
|
// #define USE_WATCHDOG
|
|
|
|
/*
|
|
analog subsystem stuff
|
|
REFERENCE - which analog reference to use. see analog.h for choices
|
|
ANALOG_MASK - which analog inputs we will be using, bitmask. eg; #define ANALOG_MASK MASK(AIO0_PIN) | MASK(3) for AIN0 and AIN3
|
|
*/
|
|
#define REFERENCE REFERENCE_AREF
|
|
|
|
#ifndef ANALOG_MASK
|
|
#define ANALOG_MASK 0
|
|
#endif
|
|
|
|
/*
|
|
Machine Pin Definitions
|
|
|
|
- make sure to avoid duplicate usage of a pin
|
|
|
|
- comment out pins not in use, as this drops the corresponding code and makes operations faster
|
|
*/
|
|
|
|
#include "arduino.h"
|
|
|
|
/*
|
|
RESERVED pins
|
|
we NEED these for communication
|
|
*/
|
|
|
|
#define RESERVED_RXD DIO0
|
|
#define RESERVED_TXD DIO1
|
|
|
|
/*
|
|
these pins are used for the MAX6675
|
|
*/
|
|
#define RESERVED_SCK DIO13
|
|
#define RESERVED_MISO DIO12
|
|
#define RESERVED_MOSI DIO11
|
|
#define RESERVED_SS DIO10
|
|
|
|
/*
|
|
user defined pins
|
|
adjust to suit your electronics,
|
|
or adjust your electronics to suit this
|
|
*/
|
|
|
|
#define X_STEP_PIN AIO0
|
|
#define X_DIR_PIN AIO1
|
|
#define X_MIN_PIN AIO2
|
|
|
|
#define Y_STEP_PIN AIO3
|
|
#define Y_DIR_PIN AIO4
|
|
#define Y_MIN_PIN AIO5
|
|
|
|
#define Z_STEP_PIN DIO2
|
|
#define Z_DIR_PIN DIO3
|
|
#define Z_MIN_PIN DIO4
|
|
|
|
#define E_STEP_PIN DIO7
|
|
#define E_DIR_PIN DIO8
|
|
|
|
#define STEPPER_ENABLE_PIN DIO9
|
|
|
|
// list of PWM-able pins and corresponding timers
|
|
// timer1 is used for step timing so don't use OC1A/OC1B (DIO9/DIO10)
|
|
// OC0A DIO6
|
|
// OC0B DIO5
|
|
// OC1A DIO9
|
|
// OC1B DIO10
|
|
// OC2A DIO11
|
|
// OC2B DIO3
|
|
|
|
#define HEATER_PIN DIO6
|
|
#define HEATER_PWM OCR0A
|
|
|
|
#define FAN_PIN DIO5
|
|
#define FAN_PWM OCR0B
|
|
|
|
// --------------------------------------------------------------------------
|
|
// you shouldn't need to edit anything below this line
|
|
|
|
// same as above with 25.4 scale factor
|
|
#define STEPS_PER_IN_X ((uint32_t) ((25.4 * STEPS_PER_MM_X) + 0.5))
|
|
#define STEPS_PER_IN_Y ((uint32_t) ((25.4 * STEPS_PER_MM_Y) + 0.5))
|
|
#define STEPS_PER_IN_Z ((uint32_t) ((25.4 * STEPS_PER_MM_Z) + 0.5))
|
|
#define STEPS_PER_IN_E ((uint32_t) ((25.4 * STEPS_PER_MM_E) + 0.5))
|
|
|
|
// inverse, used in distance calculation during DDA setup
|
|
#define UM_PER_STEP_X ((uint32_t) ((1000.0 / STEPS_PER_MM_X) + 0.5))
|
|
#define UM_PER_STEP_Y ((uint32_t) ((1000.0 / STEPS_PER_MM_Y) + 0.5))
|
|
#define UM_PER_STEP_Z ((uint32_t) ((1000.0 / STEPS_PER_MM_Z) + 0.5))
|
|
#define UM_PER_STEP_E ((uint32_t) ((1000.0 / STEPS_PER_MM_E) + 0.5))
|
|
|
|
/*
|
|
Heater
|
|
*/
|
|
|
|
#ifdef HEATER_PWM
|
|
#define enable_heater() do { TCCR0A |= MASK(COM0A1); } while (0)
|
|
#define disable_heater() do { TCCR0A &= ~MASK(COM0A1); } while (0)
|
|
#else
|
|
#define enable_heater() WRITE(HEATER_PIN, 1)
|
|
#define disable_heater() WRITE(HEATER_PIN, 0)
|
|
#endif
|
|
|
|
/*
|
|
fan
|
|
*/
|
|
|
|
#ifdef FAN_PIN
|
|
#ifdef FAN_PWM
|
|
#define enable_fan() do { TCCR0A |= MASK(COM0B1); } while (0)
|
|
#define disable_fan() do { TCCR0A &= ~MASK(COM0B1); } while (0)
|
|
#else
|
|
#define enable_fan() WRITE(FAN_PIN, 1)
|
|
#define disable_fan() WRITE(FAN_PIN, 0);
|
|
#endif
|
|
#else
|
|
#define enable_fan() if (0) {}
|
|
#define disable_fan() if (0) {}
|
|
#endif
|
|
|
|
/*
|
|
Stepper Enable (ATX PSU pwr_good signal?)
|
|
*/
|
|
|
|
#ifdef STEPPER_ENABLE_PIN
|
|
// for connection to stepper driver ENABLE pins (negative asserted)
|
|
// #define power_on() WRITE(STEPPER_ENABLE_PIN, 0)
|
|
// #define power_off() WRITE(STEPPER_ENABLE_PIN, 1)
|
|
// for connection to ATX PSU PWR_ON signal
|
|
#define power_on() do { WRITE(STEPPER_ENABLE_PIN, 0); SET_OUTPUT(STEPPER_ENABLE_PIN); } while (0)
|
|
#define power_off() SET_INPUT(STEPPER_ENABLE_PIN)
|
|
#else
|
|
#define power_on() if (0) {}
|
|
#define power_off() if (0) {}
|
|
#endif
|
|
|
|
#endif /* _CONFIG_H */
|