summaryrefslogtreecommitdiff
path: root/trunk/darwin/firmware/Sanguino/Sanguino3G/ArduinoSlaveExtruder/Configuration.h.dist
blob: 346e0b82aebcab4161d9c4736ca154bd6f624ccc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/****************************************************************************************
 * Here's where you define the overall electronics setup for your machine.
 ****************************************************************************************/

//
// CHOOSE WHICH EXTRUDER YOU'RE USING:
//
//#define EXTRUDER_CONTROLLER_VERSION_2_0
//#define EXTRUDER_CONTROLLER_VERSION_2_1
#define EXTRUDER_CONTROLLER_VERSION_2_2

#define TEMPERATURE_SAMPLES 5
#define SERIAL_SPEED 38400

//the address for commands to listen to
#define RS485_ADDRESS 0
#define PACKET_TIMEOUT 100

/****************************************************************************************
 * Here's where you define the way your motors are driven.
 ****************************************************************************************/
//PWM
#define MOTOR_STYLE 0
//ENCODER
//#define MOTOR_STYLE 1 
//STEPPER
//define MOTOR_STYLE 2 

//do you want to reverse the motor?
#define DELAY_FOR_STOP 5
#define MOTOR_REVERSE_DURATION 300
#define MOTOR_FORWARD_DURATION 300

/****************************************************************************************
 * Here's where you define the speed PID behavior for an encoder
 ****************************************************************************************/
//#define INVERT_QUADRATURE
#define MIN_SPEED 50              //minimum PWM speed to use
#define MAX_SPEED 255             //maximum PWM speed to use
#define SPEED_ERROR_MARGIN 10     //our error margin (to prevent constant seeking)
#define SPEED_INITIAL_PGAIN 1     //our proportional gain.
#define SPEED_INITIAL_IGAIN 100   //our integral gain.
#define SPEED_INITIAL_DGAIN 10    //our derivative gain.


/****************************************************************************************
 * Here's where you define the configuration for the stepper.
 ****************************************************************************************/
#define MOTOR_STEPS 200              //number of steps per revolution
#define MOTOR_STEP_MULTIPLIER 2      //step multiplier (full = 1, half=2, etc.)

/****************************************************************************************
 * Sanguino Pin Assignment
 ****************************************************************************************/

//these are the pins for the v2.0 Extruder Controller
#if defined(EXTRUDER_CONTROLLER_VERSION_2_0) || defined(EXTRUDER_CONTROLLER_VERSION_2_1) || defined(EXTRUDER_CONTROLLER_VERSION_2_2)

#define ENCODER_A_PIN 2
#define ENCODER_B_PIN 3

#define RX_ENABLE_PIN 4
#define TX_ENABLE_PIN 16

#define MOTOR_1_SPEED_PIN 5
#define MOTOR_1_DIR_PIN 7
#define MOTOR_2_SPEED_PIN 6
#define MOTOR_2_DIR_PIN 8

#define SERVO1_PIN 9
#define SERVO2_PIN 10

#define HEATER_PIN 11
#define FAN_PIN 12
#define VALVE_PIN 15

#define THERMISTOR_PIN 3

#define DEBUG_PIN 13

#endif

//quadrature encoder behavior
#ifdef INVERT_QUADRATURE
#define QUADRATURE_INCREMENT speed_error--;
#define QUADRATURE_DECREMENT speed_error++;
#else
#define QUADRATURE_INCREMENT speed_error++;
#define QUADRATURE_DECREMENT speed_error--;
#endif