Selaa lähdekoodia

Merge pull request #1 from ErikZalm/Marlin_v1

merge
midopple 12 vuotta sitten
vanhempi
commit
7ced55b97c
38 muutettua tiedostoa jossa 6747 lisäystä ja 2647 poistoa
  1. 1
    1
      ArduinoAddons/Arduino_0.xx/Gen6/bootloaders/atmega644p/ATmegaBOOT.c
  2. 1
    1
      ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega644p/ATmegaBOOT.c
  3. 1
    1
      ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal/LiquidCrystal.cpp
  4. 1
    1
      ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/chessengine.c
  5. 1
    1
      ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal/LiquidCrystal.cpp
  6. 1
    1
      ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/chessengine.c
  7. 1
    1
      ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega/ATmegaBOOT_168.c
  8. 1
    1
      ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c
  9. 1
    1
      ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c.tst
  10. 251
    72
      Marlin/Configuration.h
  11. 12
    1
      Marlin/ConfigurationStore.cpp
  12. 47
    15
      Marlin/Configuration_adv.h
  13. 3
    3
      Marlin/DOGMbitmaps.h
  14. 1
    1
      Marlin/LiquidCrystalRus.cpp
  15. 18
    11
      Marlin/Makefile
  16. 18
    3
      Marlin/Marlin.h
  17. 12
    6
      Marlin/Marlin.pde
  18. 691
    328
      Marlin/Marlin_main.cpp
  19. 341
    0
      Marlin/Servo.cpp
  20. 132
    0
      Marlin/Servo.h
  21. 13
    7
      Marlin/cardreader.cpp
  22. 4
    1
      Marlin/cardreader.h
  23. 33
    9
      Marlin/dogm_lcd_implementation.h
  24. 585
    0
      Marlin/example_configurations/delta/Configuration.h
  25. 396
    0
      Marlin/example_configurations/delta/Configuration_adv.h
  26. 695
    1
      Marlin/fastio.h
  27. 1524
    1472
      Marlin/language.h
  28. 742
    292
      Marlin/pins.h
  29. 76
    28
      Marlin/planner.cpp
  30. 7
    1
      Marlin/planner.h
  31. 133
    154
      Marlin/stepper.cpp
  32. 211
    84
      Marlin/temperature.cpp
  33. 3
    0
      Marlin/temperature.h
  34. 250
    42
      Marlin/ultralcd.cpp
  35. 32
    1
      Marlin/ultralcd.h
  36. 268
    26
      Marlin/ultralcd_implementation_hitachi_HD44780.h
  37. 131
    0
      Marlin/ultralcd_st7920_u8glib_rrd.h
  38. 109
    80
      README.md

+ 1
- 1
ArduinoAddons/Arduino_0.xx/Gen6/bootloaders/atmega644p/ATmegaBOOT.c Näytä tiedosto

@@ -168,7 +168,7 @@ int main(void)
168 168
     WDTCSR = 0;
169 169
 
170 170
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
171
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
171
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
172 172
       app_start();  // skip bootloader
173 173
 #endif
174 174
 

+ 1
- 1
ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega644p/ATmegaBOOT.c Näytä tiedosto

@@ -168,7 +168,7 @@ int main(void)
168 168
     WDTCSR = 0;
169 169
 
170 170
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
171
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
171
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
172 172
       app_start();  // skip bootloader
173 173
 #endif
174 174
 

+ 1
- 1
ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal/LiquidCrystal.cpp Näytä tiedosto

@@ -21,7 +21,7 @@
21 21
 //    S = 0; No shift 
22 22
 //
23 23
 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
24
-// can't assume that its in that state when a sketch starts (and the
24
+// can't assume that it's in that state when a sketch starts (and the
25 25
 // LiquidCrystal constructor is called).
26 26
 
27 27
 LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,

+ 1
- 1
ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/chessengine.c Näytä tiedosto

@@ -72,7 +72,7 @@
72 72
 	- Castling: Need to check for fields under attack
73 73
 	    --> done
74 74
 	
75
-	- Check for WIN / LOOSE situation, perhaps call ce_Eval() once on the top-level board setup
75
+	- Check for WIN / LOSE situation, perhaps call ce_Eval() once on the top-level board setup
76 76
 	    just after the real move
77 77
 	- cleanup cu_Move
78 78
 	    --> almost done

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal/LiquidCrystal.cpp Näytä tiedosto

@@ -21,7 +21,7 @@
21 21
 //    S = 0; No shift 
22 22
 //
23 23
 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
24
-// can't assume that its in that state when a sketch starts (and the
24
+// can't assume that it's in that state when a sketch starts (and the
25 25
 // LiquidCrystal constructor is called).
26 26
 
27 27
 LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/chessengine.c Näytä tiedosto

@@ -72,7 +72,7 @@
72 72
 	- Castling: Need to check for fields under attack
73 73
 	    --> done
74 74
 	
75
-	- Check for WIN / LOOSE situation, perhaps call ce_Eval() once on the top-level board setup
75
+	- Check for WIN / LOSE situation, perhaps call ce_Eval() once on the top-level board setup
76 76
 	    just after the real move
77 77
 	- cleanup cu_Move
78 78
 	    --> almost done

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega/ATmegaBOOT_168.c Näytä tiedosto

@@ -301,7 +301,7 @@ int main(void)
301 301
 	WDTCSR = 0;
302 302
 
303 303
 	// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
304
-	if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
304
+	if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
305 305
 		app_start();  // skip bootloader
306 306
 #else
307 307
 	asm volatile("nop\n\t");

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c Näytä tiedosto

@@ -172,7 +172,7 @@ int main(void)
172 172
     WDTCSR = 0;
173 173
 
174 174
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
175
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
175
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
176 176
       app_start();  // skip bootloader
177 177
 #endif
178 178
 

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c.tst Näytä tiedosto

@@ -172,7 +172,7 @@ int main(void)
172 172
     WDTCSR = 0;
173 173
 
174 174
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
175
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
175
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
176 176
       app_start();  // skip bootloader
177 177
 #endif
178 178
 

+ 251
- 72
Marlin/Configuration.h Näytä tiedosto

@@ -1,15 +1,15 @@
1 1
 #ifndef CONFIGURATION_H
2 2
 #define CONFIGURATION_H
3 3
 
4
-// This configurtion file contains the basic settings.
5
-// Advanced settings can be found in Configuration_adv.h 
4
+// This configuration file contains the basic settings.
5
+// Advanced settings can be found in Configuration_adv.h
6 6
 // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
7 7
 
8
-//User specified version info of this build to display in [Pronterface, etc] terminal window during startup.
9
-//Implementation of an idea by Prof Braino to inform user that any changes made
10
-//to this build by the user have been successfully uploaded into firmware.
8
+// User-specified version info of this build to display in [Pronterface, etc] terminal window during
9
+// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
10
+// build by the user have been successfully uploaded into firmware.
11 11
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
12
-#define STRING_CONFIG_H_AUTHOR "(none, default config)" //Who made the changes.
12
+#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
13 13
 
14 14
 // SERIAL_PORT selects which serial port should be used for communication with the host.
15 15
 // This allows the connection of wireless adapters (for instance) to non-default port pins.
@@ -26,8 +26,9 @@
26 26
 // 12 = Gen7 v1.3
27 27
 // 13 = Gen7 v1.4
28 28
 // 3  = MEGA/RAMPS up to 1.2 = 3
29
-// 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Bed, Fan)
29
+// 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
30 30
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
31
+// 35 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan)
31 32
 // 4  = Duemilanove w/ ATMega328P pin assignment
32 33
 // 5  = Gen6
33 34
 // 51 = Gen6 deluxe
@@ -35,28 +36,77 @@
35 36
 // 62 = Sanguinololu 1.2 and above
36 37
 // 63 = Melzi
37 38
 // 64 = STB V1.1
39
+// 65 = Azteeg X1
40
+// 66 = Melzi with ATmega1284 (MaKr3d version)
38 41
 // 7  = Ultimaker
39 42
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
43
+// 77 = 3Drag Controller
40 44
 // 8  = Teensylu
41 45
 // 80 = Rumba
42 46
 // 81 = Printrboard (AT90USB1286)
43 47
 // 82 = Brainwave (AT90USB646)
44 48
 // 9  = Gen3+
45 49
 // 70 = Megatronics
50
+// 701= Megatronics v2.0
51
+// 702= Minitronics v1.0
46 52
 // 90 = Alpha OMCA board
47 53
 // 91 = Final OMCA board
48 54
 // 301 = Rambo
55
+// 21 = Elefu Ra Board (v3)
49 56
 
50 57
 #ifndef MOTHERBOARD
51 58
 #define MOTHERBOARD 7
52 59
 #endif
53 60
 
61
+// Define this to set a custom name for your generic Mendel,
62
+// #define CUSTOM_MENDEL_NAME "This Mendel"
63
+
64
+// This defines the number of extruders
65
+#define EXTRUDERS 1
66
+
54 67
 //// The following define selects which power supply you have. Please choose the one that matches your setup
55 68
 // 1 = ATX
56 69
 // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
57 70
 
58 71
 #define POWER_SUPPLY 1
59 72
 
73
+
74
+//===========================================================================
75
+//============================== Delta Settings =============================
76
+//===========================================================================
77
+// Enable DELTA kinematics
78
+//#define DELTA
79
+
80
+// Make delta curves from many straight lines (linear interpolation).
81
+// This is a trade-off between visible corners (not enough segments)
82
+// and processor overload (too many expensive sqrt calls).
83
+#define DELTA_SEGMENTS_PER_SECOND 200
84
+
85
+// Center-to-center distance of the holes in the diagonal push rods.
86
+#define DELTA_DIAGONAL_ROD 250.0 // mm
87
+
88
+// Horizontal offset from middle of printer to smooth rod center.
89
+#define DELTA_SMOOTH_ROD_OFFSET 175.0 // mm
90
+
91
+// Horizontal offset of the universal joints on the end effector.
92
+#define DELTA_EFFECTOR_OFFSET 33.0 // mm
93
+
94
+// Horizontal offset of the universal joints on the carriages.
95
+#define DELTA_CARRIAGE_OFFSET 18.0 // mm
96
+
97
+// Effective horizontal distance bridged by diagonal push rods.
98
+#define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
99
+
100
+// Effective X/Y positions of the three vertical towers.
101
+#define SIN_60 0.8660254037844386
102
+#define COS_60 0.5
103
+#define DELTA_TOWER1_X -SIN_60*DELTA_RADIUS // front left tower
104
+#define DELTA_TOWER1_Y -COS_60*DELTA_RADIUS
105
+#define DELTA_TOWER2_X SIN_60*DELTA_RADIUS // front right tower
106
+#define DELTA_TOWER2_Y -COS_60*DELTA_RADIUS
107
+#define DELTA_TOWER3_X 0.0 // back middle tower
108
+#define DELTA_TOWER3_Y DELTA_RADIUS
109
+
60 110
 //===========================================================================
61 111
 //=============================Thermal Settings  ============================
62 112
 //===========================================================================
@@ -77,25 +127,30 @@
77 127
 // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
78 128
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
79 129
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
130
+// 60 is 100k Maker's Tool Works Kapton Bed Thermister
80 131
 //
81
-//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k 
132
+//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
82 133
 //                          (but gives greater accuracy and more stable PID)
83 134
 // 51 is 100k thermistor - EPCOS (1k pullup)
84 135
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
85 136
 // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup)
86 137
 
87 138
 #define TEMP_SENSOR_0 -1
88
-#define TEMP_SENSOR_1 0
139
+#define TEMP_SENSOR_1 -1
89 140
 #define TEMP_SENSOR_2 0
90 141
 #define TEMP_SENSOR_BED 0
91 142
 
143
+// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
144
+//#define TEMP_SENSOR_1_AS_REDUNDANT 
145
+#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
146
+
92 147
 // Actual temperature must be close to target for this long before M109 returns success
93
-#define TEMP_RESIDENCY_TIME 10	// (seconds)
148
+#define TEMP_RESIDENCY_TIME 10  // (seconds)
94 149
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
95
-#define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
150
+#define TEMP_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.
96 151
 
97 152
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
98
-// to check that the wiring to the thermistor is not broken. 
153
+// to check that the wiring to the thermistor is not broken.
99 154
 // Otherwise this would lead to the heater being powered on all the time.
100 155
 #define HEATER_0_MINTEMP 5
101 156
 #define HEATER_1_MINTEMP 5
@@ -118,57 +173,57 @@
118 173
 // PID settings:
119 174
 // Comment the following line to disable PID and enable bang-bang.
120 175
 #define PIDTEMP
121
-#define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
122
-#define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
176
+#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
177
+#define PID_MAX 255 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
123 178
 #ifdef PIDTEMP
124
-  //#define PID_DEBUG // Sends debug data to the serial port. 
179
+  //#define PID_DEBUG // Sends debug data to the serial port.
125 180
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
126 181
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
127 182
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
128 183
   #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
129
-  #define K1 0.95 //smoothing factor withing the PID
184
+  #define K1 0.95 //smoothing factor within the PID
130 185
   #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
131 186
 
132 187
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
133 188
 // Ultimaker
134 189
     #define  DEFAULT_Kp 22.2
135
-    #define  DEFAULT_Ki 1.08  
136
-    #define  DEFAULT_Kd 114  
190
+    #define  DEFAULT_Ki 1.08
191
+    #define  DEFAULT_Kd 114
137 192
 
138 193
 // Makergear
139 194
 //    #define  DEFAULT_Kp 7.0
140
-//    #define  DEFAULT_Ki 0.1  
141
-//    #define  DEFAULT_Kd 12  
195
+//    #define  DEFAULT_Ki 0.1
196
+//    #define  DEFAULT_Kd 12
142 197
 
143
-// Mendel Parts V9 on 12V    
198
+// Mendel Parts V9 on 12V
144 199
 //    #define  DEFAULT_Kp 63.0
145 200
 //    #define  DEFAULT_Ki 2.25
146 201
 //    #define  DEFAULT_Kd 440
147 202
 #endif // PIDTEMP
148 203
 
149 204
 // Bed Temperature Control
150
-// Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
205
+// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
151 206
 //
152
-// uncomment this to enable PID on the bed.   It uses the same ferquency PWM as the extruder. 
207
+// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
153 208
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
154 209
 // which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
155
-// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. 
156
-// If your configuration is significantly different than this and you don't understand the issues involved, you proabaly 
210
+// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
211
+// If your configuration is significantly different than this and you don't understand the issues involved, you probably
157 212
 // shouldn't use bed PID until someone else verifies your hardware works.
158 213
 // If this is enabled, find your own PID constants below.
159 214
 //#define PIDTEMPBED
160 215
 //
161 216
 //#define BED_LIMIT_SWITCHING
162 217
 
163
-// This sets the max power delived to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
218
+// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
164 219
 // all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
165
-// setting this to anything other than 256 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
220
+// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
166 221
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
167
-#define MAX_BED_POWER 256 // limits duty cycle to bed; 256=full current
222
+#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
168 223
 
169 224
 #ifdef PIDTEMPBED
170 225
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
171
-//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, argressive factor of .15 (vs .1, 1, 10)
226
+//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
172 227
     #define  DEFAULT_bedKp 10.00
173 228
     #define  DEFAULT_bedKi .023
174 229
     #define  DEFAULT_bedKd 305.4
@@ -200,17 +255,17 @@
200 255
 // Uncomment the following line to enable CoreXY kinematics
201 256
 // #define COREXY
202 257
 
203
-// corse Endstop Settings
258
+// coarse Endstop Settings
204 259
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
205 260
 
206 261
 #ifndef ENDSTOPPULLUPS
207
-  // fine Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined
208
-  #define ENDSTOPPULLUP_XMAX
209
-  #define ENDSTOPPULLUP_YMAX
210
-  #define ENDSTOPPULLUP_ZMAX
211
-  #define ENDSTOPPULLUP_XMIN
212
-  #define ENDSTOPPULLUP_YMIN
213
-  //#define ENDSTOPPULLUP_ZMIN
262
+  // fine Enstop settings: Individual Pullups. will be ignored if ENDSTOPPULLUPS is defined
263
+  // #define ENDSTOPPULLUP_XMAX
264
+  // #define ENDSTOPPULLUP_YMAX
265
+  // #define ENDSTOPPULLUP_ZMAX
266
+  // #define ENDSTOPPULLUP_XMIN
267
+  // #define ENDSTOPPULLUP_YMIN
268
+  // #define ENDSTOPPULLUP_ZMIN
214 269
 #endif
215 270
 
216 271
 #ifdef ENDSTOPPULLUPS
@@ -223,10 +278,16 @@
223 278
 #endif
224 279
 
225 280
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
226
-const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
227
-const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
228
-const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
281
+const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
282
+const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
283
+const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
229 284
 //#define DISABLE_MAX_ENDSTOPS
285
+//#define DISABLE_MIN_ENDSTOPS
286
+
287
+// Disable max endstops for compatibility with endstop checking routine
288
+#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
289
+  #define DISABLE_MAX_ENDSTOPS
290
+#endif
230 291
 
231 292
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
232 293
 #define X_ENABLE_ON 0
@@ -253,8 +314,8 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
253 314
 #define Y_HOME_DIR -1
254 315
 #define Z_HOME_DIR -1
255 316
 
256
-#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
257
-#define max_software_endstops true  //If true, axis won't move to coordinates greater than the defined lengths below.
317
+#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
318
+#define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.
258 319
 // Travel limits after homing
259 320
 #define X_MAX_POS 205
260 321
 #define X_MIN_POS 0
@@ -272,22 +333,24 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
272 333
 //#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
273 334
 
274 335
 //Manual homing switch locations:
336
+// For deltabots this means top and center of the cartesian print volume.
275 337
 #define MANUAL_X_HOME_POS 0
276 338
 #define MANUAL_Y_HOME_POS 0
277 339
 #define MANUAL_Z_HOME_POS 0
340
+//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
278 341
 
279 342
 //// MOVEMENT SETTINGS
280 343
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
281 344
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
282 345
 
283
-// default settings 
346
+// default settings
284 347
 
285
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for ultimaker
348
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for Ultimaker
286 349
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
287 350
 #define DEFAULT_MAX_ACCELERATION      {9000,9000,100,10000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
288 351
 
289
-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
290
-#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
352
+#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
353
+#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
291 354
 
292 355
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
293 356
 // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
@@ -295,7 +358,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
295 358
 // #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
296 359
 // #define EXTRUDER_OFFSET_Y {0.0, 5.00}  // (in mm) for each extruder, offset of the hotend on the Y axis
297 360
 
298
-// The speed change that does not require acceleration (i.e. the software might assume it can be done instanteneously)
361
+// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
299 362
 #define DEFAULT_XYJERK                20.0    // (mm/sec)
300 363
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
301 364
 #define DEFAULT_EJERK                 5.0    // (mm/sec)
@@ -307,7 +370,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
307 370
 // EEPROM
308 371
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
309 372
 // M500 - stores paramters in EEPROM
310
-// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
373
+// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
311 374
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
312 375
 //define this to enable eeprom support
313 376
 //#define EEPROM_SETTINGS
@@ -315,15 +378,28 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
315 378
 // please keep turned on if you can.
316 379
 //#define EEPROM_CHITCHAT
317 380
 
381
+// Preheat Constants
382
+#define PLA_PREHEAT_HOTEND_TEMP 180 
383
+#define PLA_PREHEAT_HPB_TEMP 70
384
+#define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
385
+
386
+#define ABS_PREHEAT_HOTEND_TEMP 240
387
+#define ABS_PREHEAT_HPB_TEMP 100
388
+#define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
389
+
318 390
 //LCD and SD support
319 391
 //#define ULTRA_LCD  //general lcd support, also 16x2
320
-//#define DOGLCD	// Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
392
+//#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
321 393
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
322 394
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
323 395
 
324 396
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
325 397
 //#define ULTIPANEL  //the ultipanel as on thingiverse
326 398
 
399
+// The MaKr3d Makr-Panel with graphic controller and SD support
400
+// http://reprap.org/wiki/MaKr3d_MaKrPanel
401
+//#define MAKRPANEL
402
+
327 403
 // The RepRapDiscount Smart Controller (white PCB)
328 404
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
329 405
 //#define REPRAP_DISCOUNT_SMART_CONTROLLER
@@ -338,7 +414,25 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
338 414
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
339 415
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
340 416
 
417
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
418
+// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
419
+//#define REPRAPWORLD_KEYPAD
420
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
421
+
422
+// The Elefu RA Board Control Panel
423
+// http://www.elefu.com/index.php?route=product/product&product_id=53
424
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
425
+//#define RA_CONTROL_PANEL
426
+
341 427
 //automatic expansion
428
+#if defined (MAKRPANEL)
429
+ #define DOGLCD
430
+ #define SDSUPPORT
431
+ #define ULTIPANEL
432
+ #define NEWPANEL
433
+ #define DEFAULT_LCD_CONTRAST 17
434
+#endif
435
+
342 436
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
343 437
  #define DOGLCD
344 438
  #define U8GLIB_ST7920
@@ -348,44 +442,104 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
348 442
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
349 443
  #define ULTIPANEL
350 444
  #define NEWPANEL
351
-#endif 
445
+#endif
352 446
 
353
-// Preheat Constants
354
-#define PLA_PREHEAT_HOTEND_TEMP 180 
355
-#define PLA_PREHEAT_HPB_TEMP 70
356
-#define PLA_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
447
+#if defined(REPRAPWORLD_KEYPAD)
448
+  #define NEWPANEL
449
+  #define ULTIPANEL
450
+#endif
451
+#if defined(RA_CONTROL_PANEL)
452
+ #define ULTIPANEL
453
+ #define NEWPANEL
454
+ #define LCD_I2C_TYPE_PCA8574
455
+ #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
456
+#endif
357 457
 
358
-#define ABS_PREHEAT_HOTEND_TEMP 240
359
-#define ABS_PREHEAT_HPB_TEMP 100
360
-#define ABS_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
458
+//I2C PANELS
361 459
 
460
+//#define LCD_I2C_SAINSMART_YWROBOT
461
+#ifdef LCD_I2C_SAINSMART_YWROBOT
462
+  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
463
+  // Make sure it is placed in the Arduino libraries directory.
464
+  #define LCD_I2C_TYPE_PCF8575
465
+  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
466
+  #define NEWPANEL
467
+  #define ULTIPANEL 
468
+#endif
469
+
470
+// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
471
+//#define LCD_I2C_PANELOLU2
472
+#ifdef LCD_I2C_PANELOLU2
473
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
474
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
475
+  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
476
+  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin 
477
+  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). 
478
+  #define LCD_I2C_TYPE_MCP23017
479
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
480
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
481
+  #define NEWPANEL
482
+  #define ULTIPANEL 
483
+#endif
484
+
485
+// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
486
+//#define LCD_I2C_VIKI
487
+#ifdef LCD_I2C_VIKI
488
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
489
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
490
+  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
491
+  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
492
+  #define LCD_I2C_TYPE_MCP23017 
493
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
494
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
495
+  #define NEWPANEL
496
+  #define ULTIPANEL 
497
+#endif
362 498
 
363 499
 #ifdef ULTIPANEL
364 500
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
365 501
   #define SDSUPPORT
366 502
   #define ULTRA_LCD
367
-	#ifdef DOGLCD	// Change number of lines to match the DOG graphic display
368
-		#define LCD_WIDTH 20
369
-		#define LCD_HEIGHT 5
370
-	#else
371
-		#define LCD_WIDTH 20
372
-		#define LCD_HEIGHT 4
373
-	#endif
374
-#else //no panel but just lcd 
503
+  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
504
+    #define LCD_WIDTH 20
505
+    #define LCD_HEIGHT 5
506
+  #else
507
+    #define LCD_WIDTH 20
508
+    #define LCD_HEIGHT 4
509
+  #endif
510
+#else //no panel but just lcd
375 511
   #ifdef ULTRA_LCD
376
-	#ifdef DOGLCD	// Change number of lines to match the 128x64 graphics display
377
-		#define LCD_WIDTH 20
378
-		#define LCD_HEIGHT 5
379
-	#else
380
-		#define LCD_WIDTH 16
381
-		#define LCD_HEIGHT 2
382
-	#endif    
512
+  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
513
+    #define LCD_WIDTH 20
514
+    #define LCD_HEIGHT 5
515
+  #else
516
+    #define LCD_WIDTH 16
517
+    #define LCD_HEIGHT 2
518
+  #endif
383 519
   #endif
384 520
 #endif
385 521
 
522
+// default LCD contrast for dogm-like LCD displays
523
+#ifdef DOGLCD
524
+# ifndef DEFAULT_LCD_CONTRAST
525
+#  define DEFAULT_LCD_CONTRAST 32
526
+# endif
527
+#endif
528
+
386 529
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
387 530
 //#define FAST_PWM_FAN
388 531
 
532
+// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
533
+// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
534
+// is too low, you should also increment SOFT_PWM_SCALE.
535
+//#define FAN_SOFT_PWM
536
+
537
+// Incrementing this by 1 will double the software PWM frequency,
538
+// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
539
+// However, control resolution will be halved for each increment;
540
+// at zero value, there are 128 effective control positions.
541
+#define SOFT_PWM_SCALE 0
542
+
389 543
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
390 544
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
391 545
 // #define PHOTOGRAPH_PIN     23
@@ -393,6 +547,31 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
393 547
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
394 548
 //#define SF_ARC_FIX
395 549
 
550
+// Support for the BariCUDA Paste Extruder.
551
+//#define BARICUDA
552
+
553
+/*********************************************************************\
554
+* R/C SERVO support
555
+* Sponsored by TrinityLabs, Reworked by codexmas
556
+**********************************************************************/
557
+
558
+// Number of servos
559
+//
560
+// If you select a configuration below, this will receive a default value and does not need to be set manually
561
+// set it manually if you have more servos than extruders and wish to manually control some
562
+// leaving it undefined or defining as 0 will disable the servo subsystem
563
+// If unsure, leave commented / disabled
564
+//
565
+//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
566
+
567
+// Servo Endstops
568
+// 
569
+// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
570
+// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
571
+// 
572
+//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
573
+//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
574
+
396 575
 #include "Configuration_adv.h"
397 576
 #include "thermistortables.h"
398 577
 

+ 12
- 1
Marlin/ConfigurationStore.cpp Näytä tiedosto

@@ -37,7 +37,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
37 37
 // the default values are used whenever there is a change to the data, to prevent
38 38
 // wrong data being written to the variables.
39 39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
-#define EEPROM_VERSION "V07"
40
+#define EEPROM_VERSION "V08"
41 41
 
42 42
 #ifdef EEPROM_SETTINGS
43 43
 void Config_StoreSettings() 
@@ -78,6 +78,10 @@ void Config_StoreSettings()
78 78
     EEPROM_WRITE_VAR(i,dummy);
79 79
     EEPROM_WRITE_VAR(i,dummy);
80 80
   #endif
81
+  #ifndef DOGLCD
82
+    int lcd_contrast = 32;
83
+  #endif
84
+  EEPROM_WRITE_VAR(i,lcd_contrast);
81 85
   char ver2[4]=EEPROM_VERSION;
82 86
   i=EEPROM_OFFSET;
83 87
   EEPROM_WRITE_VAR(i,ver2); // validate data
@@ -198,6 +202,10 @@ void Config_RetrieveSettings()
198 202
         EEPROM_READ_VAR(i,Kp);
199 203
         EEPROM_READ_VAR(i,Ki);
200 204
         EEPROM_READ_VAR(i,Kd);
205
+        #ifndef DOGLCD
206
+        int lcd_contrast;
207
+        #endif
208
+        EEPROM_READ_VAR(i,lcd_contrast);
201 209
 
202 210
 		// Call updatePID (similar to when we have processed M301)
203 211
 		updatePID();
@@ -244,6 +252,9 @@ void Config_ResetDefault()
244 252
     absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
245 253
     absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
246 254
 #endif
255
+#ifdef DOGLCD
256
+    lcd_contrast = DEFAULT_LCD_CONTRAST;
257
+#endif
247 258
 #ifdef PIDTEMP
248 259
     Kp = DEFAULT_Kp;
249 260
     Ki = scalePID_i(DEFAULT_Ki);

+ 47
- 15
Marlin/Configuration_adv.h Näytä tiedosto

@@ -18,12 +18,6 @@
18 18
 //#define WATCH_TEMP_PERIOD 40000 //40 seconds
19 19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20 20
 
21
-// Wait for Cooldown
22
-// This defines if the M109 call should not block if it is cooling down.
23
-// example: From a current temp of 220, you set M109 S200. 
24
-// if CooldownNoWait is defined M109 will not wait for the cooldown to finish
25
-#define CooldownNoWait true
26
-
27 21
 #ifdef PIDTEMP
28 22
   // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
29 23
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
@@ -63,21 +57,31 @@
63 57
 //This is for controlling a fan to cool down the stepper drivers
64 58
 //it will turn on when any driver is enabled
65 59
 //and turn off after the set amount of seconds from last driver being disabled again
66
-//#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
67
-#define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
60
+#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
61
+#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
62
+#define CONTROLLERFAN_SPEED 255  // == full speed
68 63
 
69 64
 // When first starting the main fan, run it at full speed for the
70 65
 // given number of milliseconds.  This gets the fan spinning reliably
71 66
 // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
72 67
 //#define FAN_KICKSTART_TIME 100
73 68
 
69
+// Extruder cooling fans
70
+// Configure fan pin outputs to automatically turn on/off when the associated
71
+// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
72
+// Multiple extruders can be assigned to the same pin in which case 
73
+// the fan will turn on when any selected extruder is above the threshold.
74
+#define EXTRUDER_0_AUTO_FAN_PIN   -1
75
+#define EXTRUDER_1_AUTO_FAN_PIN   -1
76
+#define EXTRUDER_2_AUTO_FAN_PIN   -1
77
+#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
78
+#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
79
+
80
+
74 81
 //===========================================================================
75 82
 //=============================Mechanical Settings===========================
76 83
 //===========================================================================
77 84
 
78
-// This defines the number of extruders
79
-#define EXTRUDERS 1
80
-
81 85
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
82 86
 
83 87
 
@@ -142,6 +146,31 @@
142 146
   #define EXTRUDERS 1
143 147
 #endif
144 148
 
149
+// Enable this for dual x-carriage printers. 
150
+// A dual x-carriage design has the advantage that the inactive extruder can be parked which
151
+// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
152
+// allowing faster printing speeds.
153
+//#define DUAL_X_CARRIAGE
154
+#ifdef DUAL_X_CARRIAGE
155
+// Configuration for second X-carriage
156
+// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
157
+// the second x-carriage always homes to the maximum endstop.
158
+#define X2_MIN_POS 88     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
159
+#define X2_MAX_POS 350.45 // set maximum to the distance between toolheads when both heads are homed 
160
+#define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
161
+#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
162
+    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
163
+    // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
164
+    // without modifying the firmware (through the "M218 T1 X???" command).
165
+    // Remember: you should set the second extruder x-offset to 0 in your slicer.
166
+
167
+// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
168
+#define X2_ENABLE_PIN 29
169
+#define X2_STEP_PIN 25
170
+#define X2_DIR_PIN 23
171
+
172
+#endif // DUAL_X_CARRIAGE
173
+    
145 174
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
146 175
 #define X_HOME_RETRACT_MM 5 
147 176
 #define Y_HOME_RETRACT_MM 5 
@@ -210,9 +239,9 @@
210 239
 //  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
211 240
 //#define WATCHDOG_RESET_MANUAL
212 241
 #endif
213
-
214
-// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
215
-//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
242
+
243
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
244
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
216 245
 
217 246
 // extruder advance constant (s2/mm3)
218 247
 //
@@ -276,7 +305,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
276 305
 #else
277 306
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
278 307
 #endif
279
-
308
+
280 309
 
281 310
 //The ASCII buffer for recieving from the serial:
282 311
 #define MAX_CMD_SIZE 96
@@ -308,6 +337,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
308 337
 //===========================================================================
309 338
 //=============================  Define Defines  ============================
310 339
 //===========================================================================
340
+#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
341
+  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
342
+#endif
311 343
 
312 344
 #if TEMP_SENSOR_0 > 0
313 345
   #define THERMISTORHEATER_0 TEMP_SENSOR_0

+ 3
- 3
Marlin/DOGMbitmaps.h Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 #define START_BMPWIDTH 	60	//Width in pixels
2 2
 #define START_BMPHEIGHT 	64	//Height in pixels
3 3
 #define START_BMPBYTEWIDTH 	8	//Width in bytes
4
-unsigned char start_bmp[574] PROGMEM = { //AVR-GCC, WinAVR
4
+const unsigned char start_bmp[574] PROGMEM = { //AVR-GCC, WinAVR
5 5
 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,
6 6
 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,
7 7
 0xFF,0xFF,0xFF,0xF9,0xFF,0xFF,0xFF,0xF0,
@@ -71,7 +71,7 @@ unsigned char start_bmp[574] PROGMEM = { //AVR-GCC, WinAVR
71 71
 #define STATUS_SCREENWIDTH 		115	//Width in pixels
72 72
 #define STATUS_SCREENHEIGHT 	19	//Height in pixels
73 73
 #define STATUS_SCREENBYTEWIDTH 	15	//Width in bytes
74
-unsigned char status_screen0_bmp[] PROGMEM = { //AVR-GCC, WinAVR
74
+const unsigned char status_screen0_bmp[] PROGMEM = { //AVR-GCC, WinAVR
75 75
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xE0,
76 76
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xE0,
77 77
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x0C,0x60,
@@ -96,7 +96,7 @@ unsigned char status_screen0_bmp[] PROGMEM = { //AVR-GCC, WinAVR
96 96
 #define STATUS_SCREENWIDTH 		115	//Width in pixels
97 97
 #define STATUS_SCREENHEIGHT 	19	//Height in pixels
98 98
 #define STATUS_SCREENBYTEWIDTH 	15	//Width in bytes
99
-unsigned char status_screen1_bmp[] PROGMEM = { //AVR-GCC, WinAVR
99
+const unsigned char status_screen1_bmp[] PROGMEM = { //AVR-GCC, WinAVR
100 100
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xE0,
101 101
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xE0,
102 102
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0xF8,0x60,

+ 1
- 1
Marlin/LiquidCrystalRus.cpp Näytä tiedosto

@@ -36,7 +36,7 @@ const PROGMEM uint8_t utf_recode[] =
36 36
 //    S = 0; No shift 
37 37
 //
38 38
 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
39
-// can't assume that its in that state when a sketch starts (and the
39
+// can't assume that it's in that state when a sketch starts (and the
40 40
 // LiquidCrystal constructor is called).
41 41
 // 
42 42
 // modified 27 Jul 2011

+ 18
- 11
Marlin/Makefile Näytä tiedosto

@@ -1,12 +1,12 @@
1 1
 # Sprinter Arduino Project Makefile
2
-# 
2
+#
3 3
 # Makefile Based on:
4 4
 # Arduino 0011 Makefile
5 5
 # Arduino adaptation by mellis, eighthave, oli.keller
6 6
 # Marlin adaption by Daid
7 7
 #
8 8
 # This has been tested with Arduino 0022.
9
-# 
9
+#
10 10
 # This makefile allows you to build sketches from the command line
11 11
 # without the Arduino environment (or Java).
12 12
 #
@@ -21,7 +21,7 @@
21 21
 #     (e.g. UPLOAD_PORT = /dev/tty.USB0).  If the exact name of this file
22 22
 #     changes, you can use * as a wildcard (e.g. UPLOAD_PORT = /dev/tty.usb*).
23 23
 #
24
-#  3. Set the line containing "MCU" to match your board's processor. 
24
+#  3. Set the line containing "MCU" to match your board's processor.
25 25
 #     Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
26 26
 #     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
27 27
 #     change F_CPU to 8000000. If you are using Gen7 electronics, you
@@ -44,7 +44,7 @@ ARDUINO_INSTALL_DIR  ?= ../../arduino-0022
44 44
 ARDUINO_VERSION      ?= 22
45 45
 
46 46
 # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
47
-AVR_TOOLS_PATH ?= 
47
+AVR_TOOLS_PATH ?=
48 48
 
49 49
 #Programmer configuration
50 50
 UPLOAD_RATE        ?= 115200
@@ -114,6 +114,12 @@ MCU              ?= atmega644p
114 114
 else ifeq  ($(HARDWARE_MOTHERBOARD),63)
115 115
 HARDWARE_VARIANT ?= Sanguino
116 116
 MCU              ?= atmega644p
117
+else ifeq  ($(HARDWARE_MOTHERBOARD),65)
118
+HARDWARE_VARIANT ?= Sanguino
119
+MCU              ?= atmega1284p
120
+else ifeq  ($(HARDWARE_MOTHERBOARD),66)
121
+HARDWARE_VARIANT ?= Sanguino
122
+MCU              ?= atmega1284p
117 123
 
118 124
 #Ultimaker
119 125
 else ifeq  ($(HARDWARE_MOTHERBOARD),7)
@@ -213,7 +219,7 @@ CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
213 219
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
214 220
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
215 221
 	watchdog.cpp
216
-CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp
222
+CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp Servo.cpp Tone.cpp
217 223
 
218 224
 #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
219 225
 ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
@@ -277,6 +283,7 @@ ifneq ($(HARDWARE_MOTHERBOARD),)
277 283
 CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
278 284
 endif
279 285
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
286
+CEXTRA = -fno-use-cxa-atexit
280 287
 
281 288
 CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING)
282 289
 CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) -Wall    $(CEXTRA) $(CTUNING)
@@ -287,7 +294,7 @@ LDFLAGS = -lm
287 294
 # Programming support using avrdude. Settings and variables.
288 295
 AVRDUDE_PORT = $(UPLOAD_PORT)
289 296
 AVRDUDE_WRITE_FLASH = -U flash:w:$(BUILD_DIR)/$(TARGET).hex:i
290
-AVRDUDE_FLAGS = -D -C $(ARDUINO_INSTALL_DIR)/hardware/tools/avrdude.conf \
297
+AVRDUDE_FLAGS = -D -C $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf \
291 298
 	-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
292 299
 	-b $(UPLOAD_RATE)
293 300
 
@@ -317,19 +324,19 @@ endif
317 324
 # Default target.
318 325
 all: sizeafter
319 326
 
320
-build: $(BUILD_DIR) elf hex 
327
+build: $(BUILD_DIR) elf hex
321 328
 
322 329
 # Creates the object directory
323
-$(BUILD_DIR): 
330
+$(BUILD_DIR):
324 331
 	$P mkdir -p $(BUILD_DIR)
325 332
 
326 333
 elf: $(BUILD_DIR)/$(TARGET).elf
327 334
 hex: $(BUILD_DIR)/$(TARGET).hex
328 335
 eep: $(BUILD_DIR)/$(TARGET).eep
329
-lss: $(BUILD_DIR)/$(TARGET).lss 
336
+lss: $(BUILD_DIR)/$(TARGET).lss
330 337
 sym: $(BUILD_DIR)/$(TARGET).sym
331 338
 
332
-# Program the device.  
339
+# Program the device.
333 340
 # Do not try to reset an arduino if it's not one
334 341
 upload: $(BUILD_DIR)/$(TARGET).hex
335 342
 ifeq (${AVRDUDE_PROGRAMMER}, arduino)
@@ -356,7 +363,7 @@ COFFCONVERT=$(OBJCOPY) --debugging \
356 363
 	--change-section-address .data-0x800000 \
357 364
 	--change-section-address .bss-0x800000 \
358 365
 	--change-section-address .noinit-0x800000 \
359
-	--change-section-address .eeprom-0x810000 
366
+	--change-section-address .eeprom-0x810000
360 367
 
361 368
 
362 369
 coff: $(BUILD_DIR)/$(TARGET).elf

+ 18
- 3
Marlin/Marlin.h Näytä tiedosto

@@ -96,7 +96,11 @@ void process_commands();
96 96
 
97 97
 void manage_inactivity();
98 98
 
99
-#if X_ENABLE_PIN > -1
99
+#if defined(DUAL_X_CARRIAGE) && defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 \
100
+    && defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
101
+  #define  enable_x() do { WRITE(X_ENABLE_PIN, X_ENABLE_ON); WRITE(X2_ENABLE_PIN, X_ENABLE_ON); } while (0)
102
+  #define disable_x() do { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); WRITE(X2_ENABLE_PIN,!X_ENABLE_ON); } while (0)
103
+#elif defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
100 104
   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
101 105
   #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
102 106
 #else
@@ -104,7 +108,7 @@ void manage_inactivity();
104 108
   #define disable_x() ;
105 109
 #endif
106 110
 
107
-#if Y_ENABLE_PIN > -1
111
+#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
108 112
   #define  enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
109 113
   #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
110 114
 #else
@@ -112,7 +116,7 @@ void manage_inactivity();
112 116
   #define disable_y() ;
113 117
 #endif
114 118
 
115
-#if Z_ENABLE_PIN > -1
119
+#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
116 120
   #ifdef Z_DUAL_STEPPER_DRIVERS
117 121
     #define  enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
118 122
     #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); }
@@ -157,6 +161,9 @@ void FlushSerialRequestResend();
157 161
 void ClearToSend();
158 162
 
159 163
 void get_coordinates();
164
+#ifdef DELTA
165
+void calculate_delta(float cartesian[3]);
166
+#endif
160 167
 void prepare_move();
161 168
 void kill();
162 169
 void Stop();
@@ -186,6 +193,14 @@ extern float add_homeing[3];
186 193
 extern float min_pos[3];
187 194
 extern float max_pos[3];
188 195
 extern int fanSpeed;
196
+#ifdef BARICUDA
197
+extern int ValvePressure;
198
+extern int EtoPPressure;
199
+#endif
200
+
201
+#ifdef FAN_SOFT_PWM
202
+extern unsigned char fanSpeedSoftPwm;
203
+#endif
189 204
 
190 205
 #ifdef FWRETRACT
191 206
 extern bool autoretract_enabled;

+ 12
- 6
Marlin/Marlin.pde Näytä tiedosto

@@ -34,13 +34,19 @@
34 34
 #include "pins.h"
35 35
 
36 36
 #ifdef ULTRA_LCD
37
-	#ifdef DOGLCD
38
-		#include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/)
39
-	#else
40
-		#include <LiquidCrystal.h> // library for character LCD
41
-	#endif
37
+  #if defined(LCD_I2C_TYPE_PCF8575)
38
+    #include <Wire.h>
39
+    #include <LiquidCrystal_I2C.h>
40
+  #elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)
41
+    #include <Wire.h>
42
+    #include <LiquidTWI2.h>
43
+  #elif defined(DOGLCD)
44
+    #include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/)
45
+  #else
46
+    #include <LiquidCrystal.h> // library for character LCD
47
+  #endif
42 48
 #endif
43 49
 
44
-#if DIGIPOTSS_PIN > -1
50
+#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
45 51
 #include <SPI.h>
46 52
 #endif

+ 691
- 328
Marlin/Marlin_main.cpp
File diff suppressed because it is too large
Näytä tiedosto


+ 341
- 0
Marlin/Servo.cpp Näytä tiedosto

@@ -0,0 +1,341 @@
1
+/*
2
+ Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
3
+ Copyright (c) 2009 Michael Margolis.  All right reserved.
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+ */
19
+
20
+/*
21
+
22
+ A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
23
+ The servos are pulsed in the background using the value most recently written using the write() method
24
+
25
+ Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
26
+ Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
27
+
28
+ The methods are:
29
+
30
+ Servo - Class for manipulating servo motors connected to Arduino pins.
31
+
32
+ attach(pin )  - Attaches a servo motor to an i/o pin.
33
+ attach(pin, min, max  ) - Attaches to a pin setting min and max values in microseconds
34
+ default min is 544, max is 2400
35
+
36
+ write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
37
+ writeMicroseconds() - Sets the servo pulse width in microseconds
38
+ read()      - Gets the last written servo pulse width as an angle between 0 and 180.
39
+ readMicroseconds()   - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
40
+ attached()  - Returns true if there is a servo attached.
41
+ detach()    - Stops an attached servos from pulsing its i/o pin.
42
+
43
+*/
44
+#include "Configuration.h" 
45
+
46
+#ifdef NUM_SERVOS
47
+#include <avr/interrupt.h>
48
+#include <Arduino.h>
49
+
50
+#include "Servo.h"
51
+
52
+#define usToTicks(_us)    (( clockCyclesPerMicrosecond()* _us) / 8)     // converts microseconds to tick (assumes prescale of 8)  // 12 Aug 2009
53
+#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
54
+
55
+
56
+#define TRIM_DURATION       2                               // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
57
+
58
+//#define NBR_TIMERS        (MAX_SERVOS / SERVOS_PER_TIMER)
59
+
60
+static servo_t servos[MAX_SERVOS];                          // static array of servo structures
61
+static volatile int8_t Channel[_Nbr_16timers ];             // counter for the servo being pulsed for each timer (or -1 if refresh interval)
62
+
63
+uint8_t ServoCount = 0;                                     // the total number of attached servos
64
+
65
+
66
+// convenience macros
67
+#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo
68
+#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER)       // returns the index of the servo on this timer
69
+#define SERVO_INDEX(_timer,_channel)  ((_timer*SERVOS_PER_TIMER) + _channel)     // macro to access servo index by timer and channel
70
+#define SERVO(_timer,_channel)  (servos[SERVO_INDEX(_timer,_channel)])            // macro to access servo class by timer and channel
71
+
72
+#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4)  // minimum value in uS for this servo
73
+#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4)  // maximum value in uS for this servo
74
+
75
+/************ static functions common to all instances ***********************/
76
+
77
+static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn, volatile uint16_t* OCRnA)
78
+{
79
+  if( Channel[timer] < 0 )
80
+    *TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
81
+  else{
82
+    if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive == true )
83
+      digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,LOW); // pulse this channel low if activated
84
+  }
85
+
86
+  Channel[timer]++;    // increment to the next channel
87
+  if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
88
+    *OCRnA = *TCNTn + SERVO(timer,Channel[timer]).ticks;
89
+    if(SERVO(timer,Channel[timer]).Pin.isActive == true)     // check if activated
90
+      digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high
91
+  }
92
+  else {
93
+    // finished all channels so wait for the refresh period to expire before starting over
94
+    if( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) )  // allow a few ticks to ensure the next OCR1A not missed
95
+      *OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
96
+    else
97
+      *OCRnA = *TCNTn + 4;  // at least REFRESH_INTERVAL has elapsed
98
+    Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
99
+  }
100
+}
101
+
102
+#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
103
+// Interrupt handlers for Arduino
104
+#if defined(_useTimer1)
105
+SIGNAL (TIMER1_COMPA_vect)
106
+{
107
+  handle_interrupts(_timer1, &TCNT1, &OCR1A);
108
+}
109
+#endif
110
+
111
+#if defined(_useTimer3)
112
+SIGNAL (TIMER3_COMPA_vect)
113
+{
114
+  handle_interrupts(_timer3, &TCNT3, &OCR3A);
115
+}
116
+#endif
117
+
118
+#if defined(_useTimer4)
119
+SIGNAL (TIMER4_COMPA_vect)
120
+{
121
+  handle_interrupts(_timer4, &TCNT4, &OCR4A);
122
+}
123
+#endif
124
+
125
+#if defined(_useTimer5)
126
+SIGNAL (TIMER5_COMPA_vect)
127
+{
128
+  handle_interrupts(_timer5, &TCNT5, &OCR5A);
129
+}
130
+#endif
131
+
132
+#elif defined WIRING
133
+// Interrupt handlers for Wiring
134
+#if defined(_useTimer1)
135
+void Timer1Service()
136
+{
137
+  handle_interrupts(_timer1, &TCNT1, &OCR1A);
138
+}
139
+#endif
140
+#if defined(_useTimer3)
141
+void Timer3Service()
142
+{
143
+  handle_interrupts(_timer3, &TCNT3, &OCR3A);
144
+}
145
+#endif
146
+#endif
147
+
148
+
149
+static void initISR(timer16_Sequence_t timer)
150
+{
151
+#if defined (_useTimer1)
152
+  if(timer == _timer1) {
153
+    TCCR1A = 0;             // normal counting mode
154
+    TCCR1B = _BV(CS11);     // set prescaler of 8
155
+    TCNT1 = 0;              // clear the timer count
156
+#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
157
+    TIFR |= _BV(OCF1A);      // clear any pending interrupts;
158
+    TIMSK |=  _BV(OCIE1A) ;  // enable the output compare interrupt
159
+#else
160
+    // here if not ATmega8 or ATmega128
161
+    TIFR1 |= _BV(OCF1A);     // clear any pending interrupts;
162
+    TIMSK1 |=  _BV(OCIE1A) ; // enable the output compare interrupt
163
+#endif
164
+#if defined(WIRING)
165
+    timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
166
+#endif
167
+  }
168
+#endif
169
+
170
+#if defined (_useTimer3)
171
+  if(timer == _timer3) {
172
+    TCCR3A = 0;             // normal counting mode
173
+    TCCR3B = _BV(CS31);     // set prescaler of 8
174
+    TCNT3 = 0;              // clear the timer count
175
+#if defined(__AVR_ATmega128__)
176
+    TIFR |= _BV(OCF3A);     // clear any pending interrupts;
177
+	ETIMSK |= _BV(OCIE3A);  // enable the output compare interrupt
178
+#else
179
+    TIFR3 = _BV(OCF3A);     // clear any pending interrupts;
180
+    TIMSK3 =  _BV(OCIE3A) ; // enable the output compare interrupt
181
+#endif
182
+#if defined(WIRING)
183
+    timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service);  // for Wiring platform only
184
+#endif
185
+  }
186
+#endif
187
+
188
+#if defined (_useTimer4)
189
+  if(timer == _timer4) {
190
+    TCCR4A = 0;             // normal counting mode
191
+    TCCR4B = _BV(CS41);     // set prescaler of 8
192
+    TCNT4 = 0;              // clear the timer count
193
+    TIFR4 = _BV(OCF4A);     // clear any pending interrupts;
194
+    TIMSK4 =  _BV(OCIE4A) ; // enable the output compare interrupt
195
+  }
196
+#endif
197
+
198
+#if defined (_useTimer5)
199
+  if(timer == _timer5) {
200
+    TCCR5A = 0;             // normal counting mode
201
+    TCCR5B = _BV(CS51);     // set prescaler of 8
202
+    TCNT5 = 0;              // clear the timer count
203
+    TIFR5 = _BV(OCF5A);     // clear any pending interrupts;
204
+    TIMSK5 =  _BV(OCIE5A) ; // enable the output compare interrupt
205
+  }
206
+#endif
207
+}
208
+
209
+static void finISR(timer16_Sequence_t timer)
210
+{
211
+    //disable use of the given timer
212
+#if defined WIRING   // Wiring
213
+  if(timer == _timer1) {
214
+    #if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
215
+    TIMSK1 &=  ~_BV(OCIE1A) ;  // disable timer 1 output compare interrupt
216
+    #else
217
+    TIMSK &=  ~_BV(OCIE1A) ;  // disable timer 1 output compare interrupt
218
+    #endif
219
+    timerDetach(TIMER1OUTCOMPAREA_INT);
220
+  }
221
+  else if(timer == _timer3) {
222
+    #if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
223
+    TIMSK3 &= ~_BV(OCIE3A);    // disable the timer3 output compare A interrupt
224
+    #else
225
+    ETIMSK &= ~_BV(OCIE3A);    // disable the timer3 output compare A interrupt
226
+    #endif
227
+    timerDetach(TIMER3OUTCOMPAREA_INT);
228
+  }
229
+#else
230
+    //For arduino - in future: call here to a currently undefined function to reset the timer
231
+#endif
232
+}
233
+
234
+static boolean isTimerActive(timer16_Sequence_t timer)
235
+{
236
+  // returns true if any servo is active on this timer
237
+  for(uint8_t channel=0; channel < SERVOS_PER_TIMER; channel++) {
238
+    if(SERVO(timer,channel).Pin.isActive == true)
239
+      return true;
240
+  }
241
+  return false;
242
+}
243
+
244
+
245
+/****************** end of static functions ******************************/
246
+
247
+Servo::Servo()
248
+{
249
+  if( ServoCount < MAX_SERVOS) {
250
+    this->servoIndex = ServoCount++;                    // assign a servo index to this instance
251
+	servos[this->servoIndex].ticks = usToTicks(DEFAULT_PULSE_WIDTH);   // store default values  - 12 Aug 2009
252
+  }
253
+  else
254
+    this->servoIndex = INVALID_SERVO ;  // too many servos
255
+}
256
+
257
+uint8_t Servo::attach(int pin)
258
+{
259
+  return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
260
+}
261
+
262
+uint8_t Servo::attach(int pin, int min, int max)
263
+{
264
+  if(this->servoIndex < MAX_SERVOS ) {
265
+    pinMode( pin, OUTPUT) ;                                   // set servo pin to output
266
+    servos[this->servoIndex].Pin.nbr = pin;
267
+    // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
268
+    this->min  = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
269
+    this->max  = (MAX_PULSE_WIDTH - max)/4;
270
+    // initialize the timer if it has not already been initialized
271
+    timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
272
+    if(isTimerActive(timer) == false)
273
+      initISR(timer);
274
+    servos[this->servoIndex].Pin.isActive = true;  // this must be set after the check for isTimerActive
275
+  }
276
+  return this->servoIndex ;
277
+}
278
+
279
+void Servo::detach()
280
+{
281
+  servos[this->servoIndex].Pin.isActive = false;
282
+  timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
283
+  if(isTimerActive(timer) == false) {
284
+    finISR(timer);
285
+  }
286
+}
287
+
288
+void Servo::write(int value)
289
+{
290
+  if(value < MIN_PULSE_WIDTH)
291
+  {  // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
292
+    if(value < 0) value = 0;
293
+    if(value > 180) value = 180;
294
+    value = map(value, 0, 180, SERVO_MIN(),  SERVO_MAX());
295
+  }
296
+  this->writeMicroseconds(value);
297
+}
298
+
299
+void Servo::writeMicroseconds(int value)
300
+{
301
+  // calculate and store the values for the given channel
302
+  byte channel = this->servoIndex;
303
+  if( (channel < MAX_SERVOS) )   // ensure channel is valid
304
+  {
305
+    if( value < SERVO_MIN() )          // ensure pulse width is valid
306
+      value = SERVO_MIN();
307
+    else if( value > SERVO_MAX() )
308
+      value = SERVO_MAX();
309
+
310
+  	value = value - TRIM_DURATION;
311
+    value = usToTicks(value);  // convert to ticks after compensating for interrupt overhead - 12 Aug 2009
312
+
313
+    uint8_t oldSREG = SREG;
314
+    cli();
315
+    servos[channel].ticks = value;
316
+    SREG = oldSREG;
317
+  }
318
+}
319
+
320
+int Servo::read() // return the value as degrees
321
+{
322
+  return  map( this->readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180);
323
+}
324
+
325
+int Servo::readMicroseconds()
326
+{
327
+  unsigned int pulsewidth;
328
+  if( this->servoIndex != INVALID_SERVO )
329
+    pulsewidth = ticksToUs(servos[this->servoIndex].ticks)  + TRIM_DURATION ;   // 12 aug 2009
330
+  else
331
+    pulsewidth  = 0;
332
+
333
+  return pulsewidth;
334
+}
335
+
336
+bool Servo::attached()
337
+{
338
+  return servos[this->servoIndex].Pin.isActive ;
339
+}
340
+
341
+#endif

+ 132
- 0
Marlin/Servo.h Näytä tiedosto

@@ -0,0 +1,132 @@
1
+/*
2
+  Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
3
+  Copyright (c) 2009 Michael Margolis.  All right reserved.
4
+
5
+  This library is free software; you can redistribute it and/or
6
+  modify it under the terms of the GNU Lesser General Public
7
+  License as published by the Free Software Foundation; either
8
+  version 2.1 of the License, or (at your option) any later version.
9
+
10
+  This library is distributed in the hope that it will be useful,
11
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+  Lesser General Public License for more details.
14
+
15
+  You should have received a copy of the GNU Lesser General Public
16
+  License along with this library; if not, write to the Free Software
17
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+*/
19
+
20
+/*
21
+
22
+  A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
23
+  The servos are pulsed in the background using the value most recently written using the write() method
24
+
25
+  Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
26
+  Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
27
+  The sequence used to sieze timers is defined in timers.h
28
+
29
+  The methods are:
30
+
31
+   Servo - Class for manipulating servo motors connected to Arduino pins.
32
+
33
+   attach(pin )  - Attaches a servo motor to an i/o pin.
34
+   attach(pin, min, max  ) - Attaches to a pin setting min and max values in microseconds
35
+   default min is 544, max is 2400
36
+
37
+   write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
38
+   writeMicroseconds() - Sets the servo pulse width in microseconds
39
+   read()      - Gets the last written servo pulse width as an angle between 0 and 180.
40
+   readMicroseconds()   - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
41
+   attached()  - Returns true if there is a servo attached.
42
+   detach()    - Stops an attached servos from pulsing its i/o pin.
43
+ */
44
+
45
+#ifndef Servo_h
46
+#define Servo_h
47
+
48
+#include <inttypes.h>
49
+
50
+/*
51
+ * Defines for 16 bit timers used with  Servo library
52
+ *
53
+ * If _useTimerX is defined then TimerX is a 16 bit timer on the curent board
54
+ * timer16_Sequence_t enumerates the sequence that the timers should be allocated
55
+ * _Nbr_16timers indicates how many 16 bit timers are available.
56
+ *
57
+ */
58
+
59
+// Say which 16 bit timers can be used and in what order
60
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
61
+#define _useTimer5
62
+//#define _useTimer1
63
+#define _useTimer3
64
+#define _useTimer4
65
+//typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
66
+typedef enum { _timer5, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
67
+
68
+#elif defined(__AVR_ATmega32U4__)
69
+//#define _useTimer1
70
+#define _useTimer3
71
+//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
72
+typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
73
+
74
+#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
75
+#define _useTimer3
76
+//#define _useTimer1
77
+//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
78
+typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
79
+
80
+#elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
81
+#define _useTimer3
82
+//#define _useTimer1
83
+//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
84
+typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
85
+
86
+#else  // everything else
87
+//#define _useTimer1
88
+//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
89
+typedef enum { _Nbr_16timers } timer16_Sequence_t ;
90
+#endif
91
+
92
+#define Servo_VERSION           2      // software version of this library
93
+
94
+#define MIN_PULSE_WIDTH       544     // the shortest pulse sent to a servo
95
+#define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo
96
+#define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached
97
+#define REFRESH_INTERVAL    20000     // minumim time to refresh servos in microseconds
98
+
99
+#define SERVOS_PER_TIMER       12     // the maximum number of servos controlled by one timer
100
+#define MAX_SERVOS   (_Nbr_16timers  * SERVOS_PER_TIMER)
101
+
102
+#define INVALID_SERVO         255     // flag indicating an invalid servo index
103
+
104
+typedef struct  {
105
+  uint8_t nbr        :6 ;             // a pin number from 0 to 63
106
+  uint8_t isActive   :1 ;             // true if this channel is enabled, pin not pulsed if false
107
+} ServoPin_t   ;
108
+
109
+typedef struct {
110
+  ServoPin_t Pin;
111
+  unsigned int ticks;
112
+} servo_t;
113
+
114
+class Servo
115
+{
116
+public:
117
+  Servo();
118
+  uint8_t attach(int pin);           // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
119
+  uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
120
+  void detach();
121
+  void write(int value);             // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds
122
+  void writeMicroseconds(int value); // Write pulse width in microseconds
123
+  int read();                        // returns current pulse width as an angle between 0 and 180 degrees
124
+  int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
125
+  bool attached();                   // return true if this servo is attached, otherwise false
126
+private:
127
+   uint8_t servoIndex;               // index into the channel data for this servo
128
+   int8_t min;                       // minimum is this value times 4 added to MIN_PULSE_WIDTH
129
+   int8_t max;                       // maximum is this value times 4 added to MAX_PULSE_WIDTH
130
+};
131
+
132
+#endif

+ 13
- 7
Marlin/cardreader.cpp Näytä tiedosto

@@ -18,6 +18,8 @@ CardReader::CardReader()
18 18
    saving = false;
19 19
    logging = false;
20 20
    autostart_atmillis=0;
21
+   workDirDepth = 0;
22
+   memset(workDirParents, 0, sizeof(workDirParents));
21 23
 
22 24
    autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
23 25
    lastnr=0;
@@ -204,7 +206,6 @@ void CardReader::startFileprint()
204 206
   if(cardOK)
205 207
   {
206 208
     sdprinting = true;
207
-    
208 209
   }
209 210
 }
210 211
 
@@ -521,19 +522,24 @@ void CardReader::chdir(const char * relpath)
521 522
   }
522 523
   else
523 524
   {
524
-    workDirParentParent=workDirParent;
525
-    workDirParent=*parent;
526
-    
525
+    if (workDirDepth < MAX_DIR_DEPTH) {
526
+      for (int d = ++workDirDepth; d--;)
527
+        workDirParents[d+1] = workDirParents[d];
528
+      workDirParents[0]=*parent;
529
+    }
527 530
     workDir=newfile;
528 531
   }
529 532
 }
530 533
 
531 534
 void CardReader::updir()
532 535
 {
533
-  if(!workDir.isRoot())
536
+  if(workDirDepth > 0)
534 537
   {
535
-    workDir=workDirParent;
536
-    workDirParent=workDirParentParent;
538
+    --workDirDepth;
539
+    workDir = workDirParents[0];
540
+    int d;
541
+    for (int d = 0; d < workDirDepth; d++)
542
+      workDirParents[d] = workDirParents[d+1];
537 543
   }
538 544
 }
539 545
 

+ 4
- 1
Marlin/cardreader.h Näytä tiedosto

@@ -3,6 +3,8 @@
3 3
 
4 4
 #ifdef SDSUPPORT
5 5
 
6
+#define MAX_DIR_DEPTH 10
7
+
6 8
 #include "SdFile.h"
7 9
 enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename};
8 10
 class CardReader
@@ -53,7 +55,8 @@ public:
53 55
   bool filenameIsDir;
54 56
   int lastnr; //last number of the autostart;
55 57
 private:
56
-  SdFile root,*curDir,workDir,workDirParent,workDirParentParent;
58
+  SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
59
+  uint16_t workDirDepth;
57 60
   Sd2Card card;
58 61
   SdVolume volume;
59 62
   SdFile file;

+ 33
- 9
Marlin/dogm_lcd_implementation.h Näytä tiedosto

@@ -19,12 +19,25 @@
19 19
 * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
20 20
 **/
21 21
 
22
+#ifdef ULTIPANEL
23
+#define BLEN_A 0
24
+#define BLEN_B 1
25
+#define BLEN_C 2
26
+#define EN_A (1<<BLEN_A)
27
+#define EN_B (1<<BLEN_B)
28
+#define EN_C (1<<BLEN_C)
29
+#define encrot0 0
30
+#define encrot1 2
31
+#define encrot2 3
32
+#define encrot3 1
33
+#define LCD_CLICKED (buttons&EN_C)
34
+#endif
22 35
 
23
-// CHANGE_DE begin ***
24
-#include <U8glib.h>	// DE_U8glib
36
+#include <U8glib.h>
25 37
 #include "DOGMbitmaps.h"
26 38
 #include "dogm_font_data_marlin.h"
27 39
 #include "ultralcd.h"
40
+#include "ultralcd_st7920_u8glib_rrd.h"
28 41
 
29 42
 
30 43
 /* Russian language not supported yet, needs custom font
@@ -61,17 +74,28 @@
61 74
 
62 75
 #define FONT_STATUSMENU	u8g_font_6x9
63 76
 
77
+int lcd_contrast;
64 78
 
65 79
 // LCD selection
66 80
 #ifdef U8GLIB_ST7920
67
-// SPI Com: SCK = en = (D4), MOSI = rw = (RS), CS = di = (ENABLE)
68
-U8GLIB_ST7920_128X64_1X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS);
81
+//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
82
+U8GLIB_ST7920_128X64_RRD u8g(0);
83
+#elif defined(MAKRPANEL)
84
+// The MaKrPanel display, ST7565 controller as well
85
+U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
69 86
 #else
87
+// for regular DOGM128 display with HW-SPI
70 88
 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
71 89
 #endif
72 90
 
73 91
 static void lcd_implementation_init()
74 92
 {
93
+#ifdef LCD_PIN_BL
94
+	pinMode(LCD_PIN_BL, OUTPUT);	// Enable LCD backlight
95
+	digitalWrite(LCD_PIN_BL, HIGH);
96
+#endif
97
+
98
+        u8g.setContrast(lcd_contrast);	
75 99
 	//  Uncomment this if you have the first generation (V1.10) of STBs board
76 100
 	//  pinMode(17, OUTPUT);	// Enable LCD backlight
77 101
 	//  digitalWrite(17, HIGH);
@@ -88,11 +112,11 @@ static void lcd_implementation_init()
88 112
 	u8g.setRot90();	// Rotate screen by 90°
89 113
 #endif
90 114
 
91
-#ifdef LCD_SCREEN_ROT_180;
115
+#ifdef LCD_SCREEN_ROT_180
92 116
 	u8g.setRot180();	// Rotate screen by 180°
93 117
 #endif
94 118
 
95
-#ifdef LCD_SCREEN_ROT_270;
119
+#ifdef LCD_SCREEN_ROT_270
96 120
 	u8g.setRot270();	// Rotate screen by 270°
97 121
 #endif
98 122
 
@@ -105,14 +129,14 @@ static void lcd_implementation_init()
105 129
 			u8g.setFont(u8g_font_6x10_marlin);
106 130
 			u8g.drawStr(62,10,"MARLIN"); 
107 131
 			u8g.setFont(u8g_font_5x8);
108
-			u8g.drawStr(62,19,"V1.0.0 RC2");
132
+			u8g.drawStr(62,19,"V1.0.0 RC2-mm");
109 133
 			u8g.setFont(u8g_font_6x10_marlin);
110 134
 			u8g.drawStr(62,28,"by ErikZalm");
111 135
 			u8g.drawStr(62,41,"DOGM128 LCD");
112 136
 			u8g.setFont(u8g_font_5x8);
113 137
 			u8g.drawStr(62,48,"enhancements");
114 138
 			u8g.setFont(u8g_font_5x8);
115
-			u8g.drawStr(62,55,"by STB");
139
+			u8g.drawStr(62,55,"by STB, MM");
116 140
 			u8g.drawStr(62,61,"uses u");
117 141
 			u8g.drawStr90(92,57,"8");
118 142
 			u8g.drawStr(100,61,"glib");
@@ -266,7 +290,7 @@ static void lcd_implementation_status_screen()
266 290
  // Fan
267 291
  u8g.setFont(FONT_STATUSMENU);
268 292
  u8g.setPrintPos(104,27);
269
- #if FAN_PIN > 0
293
+ #if defined(FAN_PIN) && FAN_PIN > -1
270 294
  u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
271 295
  u8g.print("%");
272 296
  #else

+ 585
- 0
Marlin/example_configurations/delta/Configuration.h Näytä tiedosto

@@ -0,0 +1,585 @@
1
+#ifndef CONFIGURATION_H
2
+#define CONFIGURATION_H
3
+
4
+// This configuration file contains the basic settings.
5
+// Advanced settings can be found in Configuration_adv.h
6
+// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
7
+
8
+// User-specified version info of this build to display in [Pronterface, etc] terminal window during
9
+// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
10
+// build by the user have been successfully uploaded into firmware.
11
+#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
12
+#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
13
+
14
+// SERIAL_PORT selects which serial port should be used for communication with the host.
15
+// This allows the connection of wireless adapters (for instance) to non-default port pins.
16
+// Serial port 0 is still used by the Arduino bootloader regardless of this setting.
17
+#define SERIAL_PORT 0
18
+
19
+// This determines the communication speed of the printer
20
+#define BAUDRATE 250000
21
+//#define BAUDRATE 115200
22
+
23
+//// The following define selects which electronics board you have. Please choose the one that matches your setup
24
+// 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
25
+// 11 = Gen7 v1.1, v1.2 = 11
26
+// 12 = Gen7 v1.3
27
+// 13 = Gen7 v1.4
28
+// 3  = MEGA/RAMPS up to 1.2 = 3
29
+// 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
30
+// 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
31
+// 35 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Fan)
32
+// 4  = Duemilanove w/ ATMega328P pin assignment
33
+// 5  = Gen6
34
+// 51 = Gen6 deluxe
35
+// 6  = Sanguinololu < 1.2
36
+// 62 = Sanguinololu 1.2 and above
37
+// 63 = Melzi
38
+// 64 = STB V1.1
39
+// 65 = Azteeg X1
40
+// 66 = Melzi with ATmega1284 (MaKr3d version)
41
+// 7  = Ultimaker
42
+// 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
43
+// 77 = 3Drag Controller
44
+// 8  = Teensylu
45
+// 80 = Rumba
46
+// 81 = Printrboard (AT90USB1286)
47
+// 82 = Brainwave (AT90USB646)
48
+// 9  = Gen3+
49
+// 70 = Megatronics
50
+// 701= Megatronics v2.0
51
+// 702= Minitronics v1.0
52
+// 90 = Alpha OMCA board
53
+// 91 = Final OMCA board
54
+// 301 = Rambo
55
+// 21 = Elefu Ra Board (v3)
56
+
57
+#ifndef MOTHERBOARD
58
+#define MOTHERBOARD 33
59
+#endif
60
+
61
+// Define this to set a custom name for your generic Mendel,
62
+// #define CUSTOM_MENDEL_NAME "This Mendel"
63
+
64
+// This defines the number of extruders
65
+#define EXTRUDERS 1
66
+
67
+//// The following define selects which power supply you have. Please choose the one that matches your setup
68
+// 1 = ATX
69
+// 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
70
+
71
+#define POWER_SUPPLY 1
72
+
73
+
74
+//===========================================================================
75
+//============================== Delta Settings =============================
76
+//===========================================================================
77
+// Enable DELTA kinematics and most of the default configuration for Deltas
78
+#define DELTA
79
+
80
+// Make delta curves from many straight lines (linear interpolation).
81
+// This is a trade-off between visible corners (not enough segments)
82
+// and processor overload (too many expensive sqrt calls).
83
+#define DELTA_SEGMENTS_PER_SECOND 200
84
+
85
+// Center-to-center distance of the holes in the diagonal push rods.
86
+#define DELTA_DIAGONAL_ROD 250.0 // mm
87
+
88
+// Horizontal offset from middle of printer to smooth rod center.
89
+#define DELTA_SMOOTH_ROD_OFFSET 175.0 // mm
90
+
91
+// Horizontal offset of the universal joints on the end effector.
92
+#define DELTA_EFFECTOR_OFFSET 33.0 // mm
93
+
94
+// Horizontal offset of the universal joints on the carriages.
95
+#define DELTA_CARRIAGE_OFFSET 18.0 // mm
96
+
97
+// Effective horizontal distance bridged by diagonal push rods.
98
+#define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
99
+
100
+// Effective X/Y positions of the three vertical towers.
101
+#define SIN_60 0.8660254037844386
102
+#define COS_60 0.5
103
+#define DELTA_TOWER1_X -SIN_60*DELTA_RADIUS // front left tower
104
+#define DELTA_TOWER1_Y -COS_60*DELTA_RADIUS
105
+#define DELTA_TOWER2_X SIN_60*DELTA_RADIUS // front right tower
106
+#define DELTA_TOWER2_Y -COS_60*DELTA_RADIUS
107
+#define DELTA_TOWER3_X 0.0 // back middle tower
108
+#define DELTA_TOWER3_Y DELTA_RADIUS
109
+
110
+//===========================================================================
111
+//=============================Thermal Settings  ============================
112
+//===========================================================================
113
+//
114
+//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
115
+//
116
+//// Temperature sensor settings:
117
+// -2 is thermocouple with MAX6675 (only for sensor 0)
118
+// -1 is thermocouple with AD595
119
+// 0 is not used
120
+// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
121
+// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
122
+// 3 is mendel-parts thermistor (4.7k pullup)
123
+// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
124
+// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan) (4.7k pullup)
125
+// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
126
+// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
127
+// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
128
+// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
129
+// 10 is 100k RS thermistor 198-961 (4.7k pullup)
130
+// 60 is 100k Maker's Tool Works Kapton Bed Thermister
131
+//
132
+//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
133
+//                          (but gives greater accuracy and more stable PID)
134
+// 51 is 100k thermistor - EPCOS (1k pullup)
135
+// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
136
+// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup)
137
+
138
+#define TEMP_SENSOR_0 -1
139
+#define TEMP_SENSOR_1 -1
140
+#define TEMP_SENSOR_2 0
141
+#define TEMP_SENSOR_BED 0
142
+
143
+// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
144
+//#define TEMP_SENSOR_1_AS_REDUNDANT 
145
+#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
146
+
147
+// Actual temperature must be close to target for this long before M109 returns success
148
+#define TEMP_RESIDENCY_TIME 10  // (seconds)
149
+#define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
150
+#define TEMP_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.
151
+
152
+// The minimal temperature defines the temperature below which the heater will not be enabled It is used
153
+// to check that the wiring to the thermistor is not broken.
154
+// Otherwise this would lead to the heater being powered on all the time.
155
+#define HEATER_0_MINTEMP 5
156
+#define HEATER_1_MINTEMP 5
157
+#define HEATER_2_MINTEMP 5
158
+#define BED_MINTEMP 5
159
+
160
+// When temperature exceeds max temp, your heater will be switched off.
161
+// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
162
+// You should use MINTEMP for thermistor short/failure protection.
163
+#define HEATER_0_MAXTEMP 275
164
+#define HEATER_1_MAXTEMP 275
165
+#define HEATER_2_MAXTEMP 275
166
+#define BED_MAXTEMP 150
167
+
168
+// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
169
+// average current. The value should be an integer and the heat bed will be turned on for 1 interval of
170
+// HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
171
+//#define HEATER_BED_DUTY_CYCLE_DIVIDER 4
172
+
173
+// PID settings:
174
+// Comment the following line to disable PID and enable bang-bang.
175
+#define PIDTEMP
176
+#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
177
+#define PID_MAX 255 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
178
+#ifdef PIDTEMP
179
+  //#define PID_DEBUG // Sends debug data to the serial port.
180
+  //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
181
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
182
+                                  // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
183
+  #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
184
+  #define K1 0.95 //smoothing factor within the PID
185
+  #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
186
+
187
+// If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
188
+// Ultimaker
189
+    #define  DEFAULT_Kp 22.2
190
+    #define  DEFAULT_Ki 1.08
191
+    #define  DEFAULT_Kd 114
192
+
193
+// Makergear
194
+//    #define  DEFAULT_Kp 7.0
195
+//    #define  DEFAULT_Ki 0.1
196
+//    #define  DEFAULT_Kd 12
197
+
198
+// Mendel Parts V9 on 12V
199
+//    #define  DEFAULT_Kp 63.0
200
+//    #define  DEFAULT_Ki 2.25
201
+//    #define  DEFAULT_Kd 440
202
+#endif // PIDTEMP
203
+
204
+// Bed Temperature Control
205
+// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
206
+//
207
+// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
208
+// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
209
+// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
210
+// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
211
+// If your configuration is significantly different than this and you don't understand the issues involved, you probably
212
+// shouldn't use bed PID until someone else verifies your hardware works.
213
+// If this is enabled, find your own PID constants below.
214
+//#define PIDTEMPBED
215
+//
216
+//#define BED_LIMIT_SWITCHING
217
+
218
+// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
219
+// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
220
+// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
221
+// so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
222
+#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
223
+
224
+#ifdef PIDTEMPBED
225
+//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
226
+//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
227
+    #define  DEFAULT_bedKp 10.00
228
+    #define  DEFAULT_bedKi .023
229
+    #define  DEFAULT_bedKd 305.4
230
+
231
+//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
232
+//from pidautotune
233
+//    #define  DEFAULT_bedKp 97.1
234
+//    #define  DEFAULT_bedKi 1.41
235
+//    #define  DEFAULT_bedKd 1675.16
236
+
237
+// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
238
+#endif // PIDTEMPBED
239
+
240
+
241
+
242
+//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
243
+//can be software-disabled for whatever purposes by
244
+#define PREVENT_DANGEROUS_EXTRUDE
245
+//if PREVENT_DANGEROUS_EXTRUDE is on, you can still disable (uncomment) very long bits of extrusion separately.
246
+#define PREVENT_LENGTHY_EXTRUDE
247
+
248
+#define EXTRUDE_MINTEMP 170
249
+#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
250
+
251
+//===========================================================================
252
+//=============================Mechanical Settings===========================
253
+//===========================================================================
254
+
255
+// Uncomment the following line to enable CoreXY kinematics
256
+// #define COREXY
257
+
258
+// coarse Endstop Settings
259
+#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
260
+
261
+#ifndef ENDSTOPPULLUPS
262
+  // fine Enstop settings: Individual Pullups. will be ignored if ENDSTOPPULLUPS is defined
263
+  // #define ENDSTOPPULLUP_XMAX
264
+  // #define ENDSTOPPULLUP_YMAX
265
+  // #define ENDSTOPPULLUP_ZMAX
266
+  // #define ENDSTOPPULLUP_XMIN
267
+  // #define ENDSTOPPULLUP_YMIN
268
+  // #define ENDSTOPPULLUP_ZMIN
269
+#endif
270
+
271
+#ifdef ENDSTOPPULLUPS
272
+  #define ENDSTOPPULLUP_XMAX
273
+  #define ENDSTOPPULLUP_YMAX
274
+  #define ENDSTOPPULLUP_ZMAX
275
+  #define ENDSTOPPULLUP_XMIN
276
+  #define ENDSTOPPULLUP_YMIN
277
+  #define ENDSTOPPULLUP_ZMIN
278
+#endif
279
+
280
+// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
281
+const bool X_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops.
282
+const bool Y_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops.
283
+const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops.
284
+
285
+// deltas never have min endstops
286
+#define DISABLE_MIN_ENDSTOPS
287
+
288
+// Disable max endstops for compatibility with endstop checking routine
289
+#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
290
+  #define DISABLE_MAX_ENDSTOPS
291
+#endif
292
+
293
+// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
294
+#define X_ENABLE_ON 0
295
+#define Y_ENABLE_ON 0
296
+#define Z_ENABLE_ON 0
297
+#define E_ENABLE_ON 0 // For all extruders
298
+
299
+// Disables axis when it's not being used.
300
+#define DISABLE_X false
301
+#define DISABLE_Y false
302
+#define DISABLE_Z false
303
+#define DISABLE_E false // For all extruders
304
+
305
+#define INVERT_X_DIR false // DELTA does not invert
306
+#define INVERT_Y_DIR false
307
+#define INVERT_Z_DIR false
308
+
309
+#define INVERT_E0_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
310
+#define INVERT_E1_DIR false    // for direct drive extruder v9 set to true, for geared extruder set to false
311
+#define INVERT_E2_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
312
+
313
+// ENDSTOP SETTINGS:
314
+// Sets direction of endstops when homing; 1=MAX, -1=MIN
315
+// deltas always home to max
316
+#define X_HOME_DIR 1
317
+#define Y_HOME_DIR 1
318
+#define Z_HOME_DIR 1
319
+
320
+#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
321
+#define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.
322
+
323
+// Travel limits after homing
324
+#define X_MAX_POS 90
325
+#define X_MIN_POS -90
326
+#define Y_MAX_POS 90
327
+#define Y_MIN_POS -90
328
+#define Z_MAX_POS MANUAL_Z_HOME_POS
329
+#define Z_MIN_POS 0
330
+
331
+#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
332
+#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
333
+#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
334
+
335
+// The position of the homing switches
336
+//#define MANUAL_HOME_POSITIONS  // If defined, MANUAL_*_HOME_POS below will be used
337
+//#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
338
+
339
+//Manual homing switch locations:
340
+
341
+#define MANUAL_HOME_POSITIONS  // MANUAL_*_HOME_POS below will be used
342
+// For deltabots this means top and center of the cartesian print volume.
343
+#define MANUAL_X_HOME_POS 0
344
+#define MANUAL_Y_HOME_POS 0
345
+#define MANUAL_Z_HOME_POS 250 // For delta: Distance between nozzle and print surface after homing.
346
+
347
+//// MOVEMENT SETTINGS
348
+#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
349
+
350
+// delta homing speeds must be the same on xyz
351
+#define HOMING_FEEDRATE {200*60, 200*60, 200*60, 0}  // set the homing speeds (mm/min)
352
+
353
+// default settings
354
+// delta speeds must be the same on xyz
355
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {80, 80, 80, 760*1.1}  // default steps per unit for Kossel (GT2, 20 tooth)
356
+#define DEFAULT_MAX_FEEDRATE          {500, 500, 500, 25}    // (mm/sec)
357
+#define DEFAULT_MAX_ACCELERATION      {9000,9000,9000,10000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
358
+
359
+#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
360
+#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
361
+
362
+// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
363
+// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
364
+// For the other hotends it is their distance from the extruder 0 hotend.
365
+// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
366
+// #define EXTRUDER_OFFSET_Y {0.0, 5.00}  // (in mm) for each extruder, offset of the hotend on the Y axis
367
+
368
+// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
369
+#define DEFAULT_XYJERK                20.0    // (mm/sec)
370
+#define DEFAULT_ZJERK                 20.0    // (mm/sec) Must be same as XY for delta
371
+#define DEFAULT_EJERK                 5.0    // (mm/sec)
372
+
373
+//===========================================================================
374
+//=============================Additional Features===========================
375
+//===========================================================================
376
+
377
+// EEPROM
378
+// the microcontroller can store settings in the EEPROM, e.g. max velocity...
379
+// M500 - stores paramters in EEPROM
380
+// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
381
+// M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
382
+//define this to enable eeprom support
383
+//#define EEPROM_SETTINGS
384
+//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
385
+// please keep turned on if you can.
386
+//#define EEPROM_CHITCHAT
387
+
388
+// Preheat Constants
389
+#define PLA_PREHEAT_HOTEND_TEMP 180 
390
+#define PLA_PREHEAT_HPB_TEMP 70
391
+#define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
392
+
393
+#define ABS_PREHEAT_HOTEND_TEMP 240
394
+#define ABS_PREHEAT_HPB_TEMP 100
395
+#define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
396
+
397
+//LCD and SD support
398
+//#define ULTRA_LCD  //general lcd support, also 16x2
399
+//#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
400
+//#define SDSUPPORT // Enable SD Card Support in Hardware Console
401
+//#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
402
+
403
+//#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
404
+//#define ULTIPANEL  //the ultipanel as on thingiverse
405
+
406
+// The MaKr3d Makr-Panel with graphic controller and SD support
407
+// http://reprap.org/wiki/MaKr3d_MaKrPanel
408
+//#define MAKRPANEL
409
+
410
+// The RepRapDiscount Smart Controller (white PCB)
411
+// http://reprap.org/wiki/RepRapDiscount_Smart_Controller
412
+//#define REPRAP_DISCOUNT_SMART_CONTROLLER
413
+
414
+// The GADGETS3D G3D LCD/SD Controller (blue PCB)
415
+// http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel
416
+//#define G3D_PANEL
417
+
418
+// The RepRapDiscount FULL GRAPHIC Smart Controller (quadratic white PCB)
419
+// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
420
+//
421
+// ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
422
+//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
423
+
424
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
425
+// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
426
+//#define REPRAPWORLD_KEYPAD
427
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
428
+
429
+// The Elefu RA Board Control Panel
430
+// http://www.elefu.com/index.php?route=product/product&product_id=53
431
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
432
+//#define RA_CONTROL_PANEL
433
+
434
+//automatic expansion
435
+#if defined (MAKRPANEL)
436
+ #define DOGLCD
437
+ #define SDSUPPORT
438
+ #define ULTIPANEL
439
+ #define NEWPANEL
440
+ #define DEFAULT_LCD_CONTRAST 17
441
+#endif
442
+
443
+#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
444
+ #define DOGLCD
445
+ #define U8GLIB_ST7920
446
+ #define REPRAP_DISCOUNT_SMART_CONTROLLER
447
+#endif
448
+
449
+#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
450
+ #define ULTIPANEL
451
+ #define NEWPANEL
452
+#endif
453
+
454
+#if defined(REPRAPWORLD_KEYPAD)
455
+  #define NEWPANEL
456
+  #define ULTIPANEL
457
+#endif
458
+#if defined(RA_CONTROL_PANEL)
459
+ #define ULTIPANEL
460
+ #define NEWPANEL
461
+ #define LCD_I2C_TYPE_PCA8574
462
+ #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
463
+#endif
464
+
465
+//I2C PANELS
466
+
467
+//#define LCD_I2C_SAINSMART_YWROBOT
468
+#ifdef LCD_I2C_SAINSMART_YWROBOT
469
+  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
470
+  // Make sure it is placed in the Arduino libraries directory.
471
+  #define LCD_I2C_TYPE_PCF8575
472
+  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
473
+  #define NEWPANEL
474
+  #define ULTIPANEL 
475
+#endif
476
+
477
+// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
478
+//#define LCD_I2C_PANELOLU2
479
+#ifdef LCD_I2C_PANELOLU2
480
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
481
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
482
+  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
483
+  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin 
484
+  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). 
485
+  #define LCD_I2C_TYPE_MCP23017
486
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
487
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
488
+  #define NEWPANEL
489
+  #define ULTIPANEL 
490
+#endif
491
+
492
+// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
493
+//#define LCD_I2C_VIKI
494
+#ifdef LCD_I2C_VIKI
495
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
496
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
497
+  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
498
+  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
499
+  #define LCD_I2C_TYPE_MCP23017 
500
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
501
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
502
+  #define NEWPANEL
503
+  #define ULTIPANEL 
504
+#endif
505
+
506
+#ifdef ULTIPANEL
507
+//  #define NEWPANEL  //enable this if you have a click-encoder panel
508
+  #define SDSUPPORT
509
+  #define ULTRA_LCD
510
+  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
511
+    #define LCD_WIDTH 20
512
+    #define LCD_HEIGHT 5
513
+  #else
514
+    #define LCD_WIDTH 20
515
+    #define LCD_HEIGHT 4
516
+  #endif
517
+#else //no panel but just lcd
518
+  #ifdef ULTRA_LCD
519
+  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
520
+    #define LCD_WIDTH 20
521
+    #define LCD_HEIGHT 5
522
+  #else
523
+    #define LCD_WIDTH 16
524
+    #define LCD_HEIGHT 2
525
+  #endif
526
+  #endif
527
+#endif
528
+
529
+// default LCD contrast for dogm-like LCD displays
530
+#ifdef DOGLCD
531
+# ifndef DEFAULT_LCD_CONTRAST
532
+#  define DEFAULT_LCD_CONTRAST 32
533
+# endif
534
+#endif
535
+
536
+// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
537
+//#define FAST_PWM_FAN
538
+
539
+// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
540
+// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
541
+// is too low, you should also increment SOFT_PWM_SCALE.
542
+//#define FAN_SOFT_PWM
543
+
544
+// Incrementing this by 1 will double the software PWM frequency,
545
+// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
546
+// However, control resolution will be halved for each increment;
547
+// at zero value, there are 128 effective control positions.
548
+#define SOFT_PWM_SCALE 0
549
+
550
+// M240  Triggers a camera by emulating a Canon RC-1 Remote
551
+// Data from: http://www.doc-diy.net/photo/rc-1_hacked/
552
+// #define PHOTOGRAPH_PIN     23
553
+
554
+// SF send wrong arc g-codes when using Arc Point as fillet procedure
555
+//#define SF_ARC_FIX
556
+
557
+// Support for the BariCUDA Paste Extruder.
558
+//#define BARICUDA
559
+
560
+/*********************************************************************\
561
+* R/C SERVO support
562
+* Sponsored by TrinityLabs, Reworked by codexmas
563
+**********************************************************************/
564
+
565
+// Number of servos
566
+//
567
+// If you select a configuration below, this will receive a default value and does not need to be set manually
568
+// set it manually if you have more servos than extruders and wish to manually control some
569
+// leaving it undefined or defining as 0 will disable the servo subsystem
570
+// If unsure, leave commented / disabled
571
+//
572
+//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
573
+
574
+// Servo Endstops
575
+// 
576
+// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
577
+// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
578
+// 
579
+//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
580
+//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
581
+
582
+#include "Configuration_adv.h"
583
+#include "thermistortables.h"
584
+
585
+#endif //__CONFIGURATION_H

+ 396
- 0
Marlin/example_configurations/delta/Configuration_adv.h Näytä tiedosto

@@ -0,0 +1,396 @@
1
+#ifndef CONFIGURATION_ADV_H
2
+#define CONFIGURATION_ADV_H
3
+
4
+//===========================================================================
5
+//=============================Thermal Settings  ============================
6
+//===========================================================================
7
+
8
+#ifdef BED_LIMIT_SWITCHING
9
+  #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
10
+#endif
11
+#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
12
+
13
+//// Heating sanity check:
14
+// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
15
+// If the temperature has not increased at the end of that period, the target temperature is set to zero. 
16
+// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
17
+//  differ by at least 2x WATCH_TEMP_INCREASE
18
+//#define WATCH_TEMP_PERIOD 40000 //40 seconds
19
+//#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20
+
21
+#ifdef PIDTEMP
22
+  // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
23
+  // if Kc is choosen well, the additional required power due to increased melting should be compensated.
24
+  #define PID_ADD_EXTRUSION_RATE  
25
+  #ifdef PID_ADD_EXTRUSION_RATE
26
+    #define  DEFAULT_Kc (1) //heatingpower=Kc*(e_speed)
27
+  #endif
28
+#endif
29
+
30
+
31
+//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
32
+//The maximum buffered steps/sec of the extruder motor are called "se".
33
+//You enter the autotemp mode by a M109 S<mintemp> T<maxtemp> F<factor>
34
+// the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
35
+// you exit the value by any M109 without F*
36
+// Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
37
+// on an ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
38
+#define AUTOTEMP
39
+#ifdef AUTOTEMP
40
+  #define AUTOTEMP_OLDWEIGHT 0.98
41
+#endif
42
+
43
+//  extruder run-out prevention. 
44
+//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
45
+//#define EXTRUDER_RUNOUT_PREVENT  
46
+#define EXTRUDER_RUNOUT_MINTEMP 190  
47
+#define EXTRUDER_RUNOUT_SECONDS 30.
48
+#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
49
+#define EXTRUDER_RUNOUT_SPEED 1500.  //extrusion speed
50
+#define EXTRUDER_RUNOUT_EXTRUDE 100
51
+
52
+//These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
53
+//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
54
+#define TEMP_SENSOR_AD595_OFFSET 0.0
55
+#define TEMP_SENSOR_AD595_GAIN   1.0
56
+
57
+//This is for controlling a fan to cool down the stepper drivers
58
+//it will turn on when any driver is enabled
59
+//and turn off after the set amount of seconds from last driver being disabled again
60
+#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
61
+#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
62
+#define CONTROLLERFAN_SPEED 255  // == full speed
63
+
64
+// When first starting the main fan, run it at full speed for the
65
+// given number of milliseconds.  This gets the fan spinning reliably
66
+// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
67
+//#define FAN_KICKSTART_TIME 100
68
+
69
+// Extruder cooling fans
70
+// Configure fan pin outputs to automatically turn on/off when the associated
71
+// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
72
+// Multiple extruders can be assigned to the same pin in which case 
73
+// the fan will turn on when any selected extruder is above the threshold.
74
+#define EXTRUDER_0_AUTO_FAN_PIN   -1
75
+#define EXTRUDER_1_AUTO_FAN_PIN   -1
76
+#define EXTRUDER_2_AUTO_FAN_PIN   -1
77
+#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
78
+#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
79
+
80
+
81
+//===========================================================================
82
+//=============================Mechanical Settings===========================
83
+//===========================================================================
84
+
85
+#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
86
+
87
+
88
+//// AUTOSET LOCATIONS OF LIMIT SWITCHES
89
+//// Added by ZetaPhoenix 09-15-2012
90
+#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
91
+  #define X_HOME_POS MANUAL_X_HOME_POS
92
+  #define Y_HOME_POS MANUAL_Y_HOME_POS
93
+  #define Z_HOME_POS MANUAL_Z_HOME_POS
94
+#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
95
+  //X axis
96
+  #if X_HOME_DIR == -1
97
+    #ifdef BED_CENTER_AT_0_0
98
+      #define X_HOME_POS X_MAX_LENGTH * -0.5
99
+    #else
100
+      #define X_HOME_POS X_MIN_POS
101
+    #endif //BED_CENTER_AT_0_0
102
+  #else    
103
+    #ifdef BED_CENTER_AT_0_0
104
+      #define X_HOME_POS X_MAX_LENGTH * 0.5
105
+    #else
106
+      #define X_HOME_POS X_MAX_POS
107
+    #endif //BED_CENTER_AT_0_0
108
+  #endif //X_HOME_DIR == -1
109
+  
110
+  //Y axis
111
+  #if Y_HOME_DIR == -1
112
+    #ifdef BED_CENTER_AT_0_0
113
+      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
114
+    #else
115
+      #define Y_HOME_POS Y_MIN_POS
116
+    #endif //BED_CENTER_AT_0_0
117
+  #else    
118
+    #ifdef BED_CENTER_AT_0_0
119
+      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
120
+    #else
121
+      #define Y_HOME_POS Y_MAX_POS
122
+    #endif //BED_CENTER_AT_0_0
123
+  #endif //Y_HOME_DIR == -1
124
+  
125
+  // Z axis
126
+  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
127
+    #define Z_HOME_POS Z_MIN_POS
128
+  #else    
129
+    #define Z_HOME_POS Z_MAX_POS
130
+  #endif //Z_HOME_DIR == -1
131
+#endif //End auto min/max positions
132
+//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
133
+
134
+
135
+//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
136
+
137
+// A single Z stepper driver is usually used to drive 2 stepper motors.
138
+// Uncomment this define to utilize a separate stepper driver for each Z axis motor.
139
+// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used
140
+// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards.
141
+// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
142
+//#define Z_DUAL_STEPPER_DRIVERS
143
+
144
+#ifdef Z_DUAL_STEPPER_DRIVERS
145
+  #undef EXTRUDERS
146
+  #define EXTRUDERS 1
147
+#endif
148
+
149
+// Enable this for dual x-carriage printers. 
150
+// A dual x-carriage design has the advantage that the inactive extruder can be parked which
151
+// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
152
+// allowing faster printing speeds.
153
+//#define DUAL_X_CARRIAGE
154
+#ifdef DUAL_X_CARRIAGE
155
+// Configuration for second X-carriage
156
+// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
157
+// the second x-carriage always homes to the maximum endstop.
158
+#define X2_MIN_POS 88     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
159
+#define X2_MAX_POS 350.45 // set maximum to the distance between toolheads when both heads are homed 
160
+#define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
161
+#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
162
+    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
163
+    // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
164
+    // without modifying the firmware (through the "M218 T1 X???" command).
165
+    // Remember: you should set the second extruder x-offset to 0 in your slicer.
166
+
167
+// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
168
+#define X2_ENABLE_PIN 29
169
+#define X2_STEP_PIN 25
170
+#define X2_DIR_PIN 23
171
+
172
+#endif // DUAL_X_CARRIAGE
173
+    
174
+//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
175
+#define X_HOME_RETRACT_MM 5 
176
+#define Y_HOME_RETRACT_MM 5
177
+#define Z_HOME_RETRACT_MM 5 // deltas need the same for all three axis
178
+
179
+
180
+//#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
181
+
182
+#define AXIS_RELATIVE_MODES {false, false, false, false}
183
+
184
+#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
185
+
186
+//By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
187
+#define INVERT_X_STEP_PIN false
188
+#define INVERT_Y_STEP_PIN false
189
+#define INVERT_Z_STEP_PIN false
190
+#define INVERT_E_STEP_PIN false
191
+
192
+//default stepper release if idle
193
+#define DEFAULT_STEPPER_DEACTIVE_TIME 60
194
+
195
+#define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
196
+#define DEFAULT_MINTRAVELFEEDRATE     0.0
197
+
198
+// minimum time in microseconds that a movement needs to take if the buffer is emptied.
199
+#define DEFAULT_MINSEGMENTTIME        20000
200
+
201
+// If defined the movements slow down when the look ahead buffer is only half full
202
+// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second)
203
+//#define SLOWDOWN
204
+
205
+// Frequency limit
206
+// See nophead's blog for more info
207
+// Not working O
208
+//#define XY_FREQUENCY_LIMIT  15
209
+
210
+// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
211
+// of the buffer and all stops. This should not be much greater than zero and should only be changed
212
+// if unwanted behavior is observed on a user's machine when running at very slow speeds.
213
+#define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
214
+
215
+// MS1 MS2 Stepper Driver Microstepping mode table
216
+#define MICROSTEP1 LOW,LOW
217
+#define MICROSTEP2 HIGH,LOW
218
+#define MICROSTEP4 LOW,HIGH
219
+#define MICROSTEP8 HIGH,HIGH
220
+#define MICROSTEP16 HIGH,HIGH
221
+
222
+// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
223
+#define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
224
+
225
+// Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
226
+#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
227
+
228
+
229
+//===========================================================================
230
+//=============================Additional Features===========================
231
+//===========================================================================
232
+
233
+#define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
234
+#define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
235
+
236
+// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
237
+//#define USE_WATCHDOG
238
+
239
+#ifdef USE_WATCHDOG
240
+// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
241
+// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
242
+//  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
243
+//#define WATCHDOG_RESET_MANUAL
244
+#endif
245
+
246
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
247
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
248
+
249
+// extruder advance constant (s2/mm3)
250
+//
251
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
252
+//
253
+// hooke's law says:		force = k * distance
254
+// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
255
+// so: v ^ 2 is proportional to number of steps we advance the extruder
256
+//#define ADVANCE
257
+
258
+#ifdef ADVANCE
259
+  #define EXTRUDER_ADVANCE_K .0
260
+
261
+  #define D_FILAMENT 2.85
262
+  #define STEPS_MM_E 836
263
+  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
264
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
265
+
266
+#endif // ADVANCE
267
+
268
+// Arc interpretation settings:
269
+#define MM_PER_ARC_SEGMENT 1
270
+#define N_ARC_CORRECTION 25
271
+
272
+const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
273
+
274
+// If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
275
+// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT 
276
+// in the pins.h file.  When using a push button pulling the pin to ground this will need inverted.  This setting should
277
+// be commented out otherwise
278
+#define SDCARDDETECTINVERTED 
279
+
280
+#ifdef ULTIPANEL
281
+ #undef SDCARDDETECTINVERTED
282
+#endif
283
+
284
+// Power Signal Control Definitions
285
+// By default use ATX definition
286
+#ifndef POWER_SUPPLY
287
+  #define POWER_SUPPLY 1
288
+#endif
289
+// 1 = ATX
290
+#if (POWER_SUPPLY == 1) 
291
+  #define PS_ON_AWAKE  LOW
292
+  #define PS_ON_ASLEEP HIGH
293
+#endif
294
+// 2 = X-Box 360 203W
295
+#if (POWER_SUPPLY == 2) 
296
+  #define PS_ON_AWAKE  HIGH
297
+  #define PS_ON_ASLEEP LOW
298
+#endif
299
+
300
+//===========================================================================
301
+//=============================Buffers           ============================
302
+//===========================================================================
303
+
304
+// The number of linear motions that can be in the plan at any give time.  
305
+// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ringbuffering.
306
+#if defined SDSUPPORT
307
+  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
308
+#else
309
+  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
310
+#endif
311
+
312
+
313
+//The ASCII buffer for recieving from the serial:
314
+#define MAX_CMD_SIZE 96
315
+#define BUFSIZE 4
316
+
317
+
318
+// Firmware based and LCD controled retract
319
+// M207 and M208 can be used to define parameters for the retraction. 
320
+// The retraction can be called by the slicer using G10 and G11
321
+// until then, intended retractions can be detected by moves that only extrude and the direction. 
322
+// the moves are than replaced by the firmware controlled ones.
323
+
324
+// #define FWRETRACT  //ONLY PARTIALLY TESTED
325
+#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
326
+
327
+
328
+//adds support for experimental filament exchange support M600; requires display
329
+#ifdef ULTIPANEL
330
+  //#define FILAMENTCHANGEENABLE
331
+  #ifdef FILAMENTCHANGEENABLE
332
+    #define FILAMENTCHANGE_XPOS 3
333
+    #define FILAMENTCHANGE_YPOS 3
334
+    #define FILAMENTCHANGE_ZADD 10
335
+    #define FILAMENTCHANGE_FIRSTRETRACT -2
336
+    #define FILAMENTCHANGE_FINALRETRACT -100
337
+  #endif
338
+#endif
339
+ 
340
+//===========================================================================
341
+//=============================  Define Defines  ============================
342
+//===========================================================================
343
+#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
344
+  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
345
+#endif
346
+
347
+#if TEMP_SENSOR_0 > 0
348
+  #define THERMISTORHEATER_0 TEMP_SENSOR_0
349
+  #define HEATER_0_USES_THERMISTOR
350
+#endif
351
+#if TEMP_SENSOR_1 > 0
352
+  #define THERMISTORHEATER_1 TEMP_SENSOR_1
353
+  #define HEATER_1_USES_THERMISTOR
354
+#endif
355
+#if TEMP_SENSOR_2 > 0
356
+  #define THERMISTORHEATER_2 TEMP_SENSOR_2
357
+  #define HEATER_2_USES_THERMISTOR
358
+#endif
359
+#if TEMP_SENSOR_BED > 0
360
+  #define THERMISTORBED TEMP_SENSOR_BED
361
+  #define BED_USES_THERMISTOR
362
+#endif
363
+#if TEMP_SENSOR_0 == -1
364
+  #define HEATER_0_USES_AD595
365
+#endif
366
+#if TEMP_SENSOR_1 == -1
367
+  #define HEATER_1_USES_AD595
368
+#endif
369
+#if TEMP_SENSOR_2 == -1
370
+  #define HEATER_2_USES_AD595
371
+#endif
372
+#if TEMP_SENSOR_BED == -1
373
+  #define BED_USES_AD595
374
+#endif
375
+#if TEMP_SENSOR_0 == -2
376
+  #define HEATER_0_USES_MAX6675
377
+#endif
378
+#if TEMP_SENSOR_0 == 0
379
+  #undef HEATER_0_MINTEMP
380
+  #undef HEATER_0_MAXTEMP
381
+#endif
382
+#if TEMP_SENSOR_1 == 0
383
+  #undef HEATER_1_MINTEMP
384
+  #undef HEATER_1_MAXTEMP
385
+#endif
386
+#if TEMP_SENSOR_2 == 0
387
+  #undef HEATER_2_MINTEMP
388
+  #undef HEATER_2_MAXTEMP
389
+#endif
390
+#if TEMP_SENSOR_BED == 0
391
+  #undef BED_MINTEMP
392
+  #undef BED_MAXTEMP
393
+#endif
394
+
395
+
396
+#endif //__CONFIGURATION_ADV_H

+ 695
- 1
Marlin/fastio.h Näytä tiedosto

@@ -2575,8 +2575,702 @@ pins
2575 2575
 #define PF7_DDR			DDRF
2576 2576
 #endif
2577 2577
 
2578
+
2579
+#if defined (__AVR_ATmega1281__) || defined (__AVR_ATmega2561__)
2580
+// UART
2581
+#define	RXD					DIO0
2582
+#define	TXD					DIO1
2583
+
2584
+// SPI
2585
+#define	SCK					DIO10
2586
+#define	MISO				DIO12
2587
+#define	MOSI				DIO11
2588
+#define	SS					DIO16
2589
+
2590
+// TWI (I2C)
2591
+#define	SCL					DIO17
2592
+#define	SDA					DIO18
2593
+
2594
+// timers and PWM
2595
+#define	OC0A				DIO9
2596
+#define	OC0B				DIO4
2597
+#define	OC1A				DIO7
2598
+#define	OC1B				DIO8
2599
+#define	OC2A				DIO6
2600
+#define	OC3A				DIO5
2601
+#define	OC3B				DIO2
2602
+#define	OC3C				DIO3
2603
+
2604
+
2605
+// change for your board
2606
+#define	DEBUG_LED		DIO46
2607
+
2608
+/*
2609
+pins
2610
+*/
2611
+#define	DIO0_PIN		PINE0
2612
+#define	DIO0_RPORT	PINE
2613
+#define	DIO0_WPORT	PORTE
2614
+#define	DIO0_DDR		DDRE
2615
+#define DIO0_PWM		NULL
2616
+
2617
+#define	DIO1_PIN		PINE1
2618
+#define	DIO1_RPORT	PINE
2619
+#define	DIO1_WPORT	PORTE
2620
+#define	DIO1_DDR		DDRE
2621
+#define DIO1_PWM		NULL
2622
+
2623
+#define	DIO2_PIN		PINE4
2624
+#define	DIO2_RPORT	PINE
2625
+#define	DIO2_WPORT	PORTE
2626
+#define	DIO2_DDR		DDRE
2627
+#define DIO2_PWM		&OCR3BL
2628
+
2629
+#define	DIO3_PIN		PINE5
2630
+#define	DIO3_RPORT	PINE
2631
+#define	DIO3_WPORT	PORTE
2632
+#define	DIO3_DDR		DDRE
2633
+#define DIO3_PWM		&OCR3CL
2634
+
2635
+#define	DIO4_PIN		PING5
2636
+#define	DIO4_RPORT	PING
2637
+#define	DIO4_WPORT	PORTG
2638
+#define	DIO4_DDR		DDRG
2639
+#define DIO4_PWM		&OCR0B
2640
+
2641
+#define	DIO5_PIN		PINE3
2642
+#define	DIO5_RPORT	PINE
2643
+#define	DIO5_WPORT	PORTE
2644
+#define	DIO5_DDR		DDRE
2645
+#define DIO5_PWM		&OCR3AL
2646
+
2647
+#define	DIO6_PIN		PINB4
2648
+#define	DIO6_RPORT	PINB
2649
+#define	DIO6_WPORT	PORTB
2650
+#define	DIO6_DDR		DDRB
2651
+#define DIO6_PWM		&OCR2AL
2652
+
2653
+#define	DIO7_PIN		PINB5
2654
+#define	DIO7_RPORT	PINB
2655
+#define	DIO7_WPORT	PORTB
2656
+#define	DIO7_DDR		DDRB
2657
+#define DIO7_PWM		&OCR1AL
2658
+
2659
+#define	DIO8_PIN		PINB6
2660
+#define	DIO8_RPORT	PINB
2661
+#define	DIO8_WPORT	PORTB
2662
+#define	DIO8_DDR		DDRB
2663
+#define DIO8_PWM		&OCR1BL
2664
+
2665
+#define	DIO9_PIN		PINB7
2666
+#define	DIO9_RPORT	PINB
2667
+#define	DIO9_WPORT	PORTB
2668
+#define	DIO9_DDR		DDRB
2669
+#define DIO9_PWM		&OCR0AL
2670
+
2671
+#define	DIO10_PIN		PINB1
2672
+#define	DIO10_RPORT	PINB
2673
+#define	DIO10_WPORT	PORTB
2674
+#define	DIO10_DDR		DDRB
2675
+#define DIO10_PWM		NULL
2676
+
2677
+#define	DIO11_PIN		PINB2
2678
+#define	DIO11_RPORT	PINB
2679
+#define	DIO11_WPORT	PORTB
2680
+#define	DIO11_DDR		DDRB
2681
+#define DIO11_PWM		NULL
2682
+
2683
+#define	DIO12_PIN		PINB3
2684
+#define	DIO12_RPORT	PINB
2685
+#define	DIO12_WPORT	PORTB
2686
+#define	DIO12_DDR		DDRB
2687
+#define DIO12_PWM		NULL
2688
+
2689
+#define	DIO13_PIN		PINE2
2690
+#define	DIO13_RPORT	PINE
2691
+#define	DIO13_WPORT	PORTE
2692
+#define	DIO13_DDR		DDRE
2693
+#define DIO13_PWM		NULL
2694
+
2695
+#define	DIO14_PIN		PINE6
2696
+#define	DIO14_RPORT	PINE
2697
+#define	DIO14_WPORT	PORTE
2698
+#define	DIO14_DDR		DDRE
2699
+#define DIO14_PWM		NULL
2700
+
2701
+#define	DIO15_PIN		PINE7
2702
+#define	DIO15_RPORT	PINE
2703
+#define	DIO15_WPORT	PORTE
2704
+#define	DIO15_DDR		DDRE
2705
+#define DIO15_PWM		NULL
2706
+
2707
+#define	DIO16_PIN		PINB0
2708
+#define	DIO16_RPORT	PINB
2709
+#define	DIO16_WPORT	PORTB
2710
+#define	DIO16_DDR		DDRB
2711
+#define DIO16_PWM		NULL
2712
+
2713
+#define	DIO17_PIN		PIND0
2714
+#define	DIO17_RPORT	PIND
2715
+#define	DIO17_WPORT	PORTD
2716
+#define	DIO17_DDR		DDRD
2717
+#define DIO17_PWM		NULL
2718
+
2719
+#define	DIO18_PIN		PIND1
2720
+#define	DIO18_RPORT	PIND
2721
+#define	DIO18_WPORT	PORTD
2722
+#define	DIO18_DDR		DDRD
2723
+#define DIO18_PWM		NULL
2724
+
2725
+#define	DIO19_PIN		PIND2
2726
+#define	DIO19_RPORT	PIND
2727
+#define	DIO19_WPORT	PORTD
2728
+#define	DIO19_DDR		DDRD
2729
+#define DIO19_PWM		NULL
2730
+
2731
+#define	DIO20_PIN		PIND3
2732
+#define	DIO20_RPORT	PIND
2733
+#define	DIO20_WPORT	PORTD
2734
+#define	DIO20_DDR		DDRD
2735
+#define DIO20_PWM		NULL
2736
+
2737
+#define	DIO21_PIN		PIND4
2738
+#define	DIO21_RPORT	PIND
2739
+#define	DIO21_WPORT	PORTD
2740
+#define	DIO21_DDR		DDRD
2741
+#define DIO21_PWM		NULL
2742
+
2743
+#define	DIO22_PIN		PIND5
2744
+#define	DIO22_RPORT	PIND
2745
+#define	DIO22_WPORT	PORTD
2746
+#define	DIO22_DDR		DDRD
2747
+#define DIO22_PWM		NULL
2748
+
2749
+#define	DIO23_PIN		PIND6
2750
+#define	DIO23_RPORT	PIND
2751
+#define	DIO23_WPORT	PORTD
2752
+#define	DIO23_DDR		DDRD
2753
+#define DIO23_PWM		NULL
2754
+
2755
+#define	DIO24_PIN		PIND7
2756
+#define	DIO24_RPORT	PIND
2757
+#define	DIO24_WPORT	PORTD
2758
+#define	DIO24_DDR		DDRD
2759
+#define DIO24_PWM		NULL
2760
+
2761
+#define	DIO25_PIN		PING0
2762
+#define	DIO25_RPORT	PING
2763
+#define	DIO25_WPORT	PORTG
2764
+#define	DIO25_DDR		DDRG
2765
+#define DIO25_PWM		NULL
2766
+
2767
+#define	DIO26_PIN		PING1
2768
+#define	DIO26_RPORT	PING
2769
+#define	DIO26_WPORT	PORTG
2770
+#define	DIO26_DDR		DDRG
2771
+#define DIO26_PWM		NULL
2772
+
2773
+#define	DIO27_PIN		PING2
2774
+#define	DIO27_RPORT	PING
2775
+#define	DIO27_WPORT	PORTG
2776
+#define	DIO27_DDR		DDRG
2777
+#define DIO27_PWM		NULL
2778
+
2779
+#define	DIO28_PIN		PING3
2780
+#define	DIO28_RPORT	PING
2781
+#define	DIO28_WPORT	PORTG
2782
+#define	DIO28_DDR		DDRG
2783
+#define DIO28_PWM		NULL
2784
+
2785
+#define	DIO29_PIN		PING4
2786
+#define	DIO29_RPORT	PING
2787
+#define	DIO29_WPORT	PORTG
2788
+#define	DIO29_DDR		DDRG
2789
+#define DIO29_PWM		NULL
2790
+
2791
+#define	DIO30_PIN		PINC0
2792
+#define	DIO30_RPORT	PINC
2793
+#define	DIO30_WPORT	PORTC
2794
+#define	DIO30_DDR		DDRC
2795
+#define DIO30_PWM		NULL
2796
+
2797
+#define	DIO31_PIN		PINC1
2798
+#define	DIO31_RPORT	PINC
2799
+#define	DIO31_WPORT	PORTC
2800
+#define	DIO31_DDR		DDRC
2801
+#define DIO31_PWM		NULL
2802
+
2803
+#define	DIO32_PIN		PINC2
2804
+#define	DIO32_RPORT	PINC
2805
+#define	DIO32_WPORT	PORTC
2806
+#define	DIO32_DDR		DDRC
2807
+#define DIO32_PWM		NULL
2808
+
2809
+#define	DIO33_PIN		PINC3
2810
+#define	DIO33_RPORT	PINC
2811
+#define	DIO33_WPORT	PORTC
2812
+#define	DIO33_DDR		DDRC
2813
+#define DIO33_PWM		NULL
2814
+
2815
+#define	DIO34_PIN		PINC4
2816
+#define	DIO34_RPORT	PINC
2817
+#define	DIO34_WPORT	PORTC
2818
+#define	DIO34_DDR		DDRC
2819
+#define DIO34_PWM		NULL
2820
+
2821
+#define	DIO35_PIN		PINC5
2822
+#define	DIO35_RPORT	PINC
2823
+#define	DIO35_WPORT	PORTC
2824
+#define	DIO35_DDR		DDRC
2825
+#define DIO35_PWM		NULL
2826
+
2827
+#define	DIO36_PIN		PINC6
2828
+#define	DIO36_RPORT	PINC
2829
+#define	DIO36_WPORT	PORTC
2830
+#define	DIO36_DDR		DDRC
2831
+#define DIO36_PWM		NULL
2832
+
2833
+#define	DIO37_PIN		PINC7
2834
+#define	DIO37_RPORT	PINC
2835
+#define	DIO37_WPORT	PORTC
2836
+#define	DIO37_DDR		DDRC
2837
+#define DIO37_PWM		NULL
2838
+
2839
+#define	DIO38_PIN		PINA0
2840
+#define	DIO38_RPORT	PINA
2841
+#define	DIO38_WPORT	PORTA
2842
+#define	DIO38_DDR		DDRA
2843
+#define DIO38_PWM		NULL
2844
+
2845
+#define	DIO39_PIN		PINA1
2846
+#define	DIO39_RPORT	PINA
2847
+#define	DIO39_WPORT	PORTA
2848
+#define	DIO39_DDR		DDRA
2849
+#define DIO39_PWM		NULL
2850
+
2851
+#define	DIO40_PIN		PINA2
2852
+#define	DIO40_RPORT	PINA
2853
+#define	DIO40_WPORT	PORTA
2854
+#define	DIO40_DDR		DDRA
2855
+#define DIO40_PWM		NULL
2856
+
2857
+#define	DIO41_PIN		PINA3
2858
+#define	DIO41_RPORT	PINA
2859
+#define	DIO41_WPORT	PORTA
2860
+#define	DIO41_DDR		DDRA
2861
+#define DIO41_PWM		NULL
2862
+
2863
+#define	DIO42_PIN		PINA4
2864
+#define	DIO42_RPORT	PINA
2865
+#define	DIO42_WPORT	PORTA
2866
+#define	DIO42_DDR		DDRA
2867
+#define DIO42_PWM		NULL
2868
+
2869
+#define	DIO43_PIN		PINA5
2870
+#define	DIO43_RPORT	PINA
2871
+#define	DIO43_WPORT	PORTA
2872
+#define	DIO43_DDR		DDRA
2873
+#define DIO43_PWM		NULL
2874
+
2875
+#define	DIO44_PIN		PINA6
2876
+#define	DIO44_RPORT	PINA
2877
+#define	DIO44_WPORT	PORTA
2878
+#define	DIO44_DDR		DDRA
2879
+#define DIO44_PWM		NULL
2880
+
2881
+#define	DIO45_PIN		PINA7
2882
+#define	DIO45_RPORT	PINA
2883
+#define	DIO45_WPORT	PORTA
2884
+#define	DIO45_DDR		DDRA
2885
+#define DIO45_PWM		NULL
2886
+
2887
+#define	DIO46_PIN		PINF0
2888
+#define	DIO46_RPORT	PINF
2889
+#define	DIO46_WPORT	PORTF
2890
+#define	DIO46_DDR		DDRF
2891
+#define DIO46_PWM		NULL
2892
+
2893
+#define	DIO47_PIN		PINF1
2894
+#define	DIO47_RPORT	PINF
2895
+#define	DIO47_WPORT	PORTF
2896
+#define	DIO47_DDR		DDRF
2897
+#define DIO47_PWM		NULL
2898
+
2899
+#define	DIO48_PIN		PINF2
2900
+#define	DIO48_RPORT	PINF
2901
+#define	DIO48_WPORT	PORTF
2902
+#define	DIO48_DDR		DDRF
2903
+#define DIO48_PWM		NULL
2904
+
2905
+#define	DIO49_PIN		PINF3
2906
+#define	DIO49_RPORT	PINF
2907
+#define	DIO49_WPORT	PORTF
2908
+#define	DIO49_DDR		DDRF
2909
+#define DIO49_PWM		NULL
2910
+
2911
+#define	DIO50_PIN		PINF4
2912
+#define	DIO50_RPORT	PINF
2913
+#define	DIO50_WPORT	PORTF
2914
+#define	DIO50_DDR		DDRF
2915
+#define DIO50_PWM		NULL
2916
+
2917
+#define	DIO51_PIN		PINF5
2918
+#define	DIO51_RPORT	PINF
2919
+#define	DIO51_WPORT	PORTF
2920
+#define	DIO51_DDR		DDRF
2921
+#define DIO51_PWM		NULL
2922
+
2923
+#define	DIO52_PIN		PINF6
2924
+#define	DIO52_RPORT	PINF
2925
+#define	DIO52_WPORT	PORTF
2926
+#define	DIO52_DDR		DDRF
2927
+#define DIO52_PWM		NULL
2928
+
2929
+#define	DIO53_PIN		PINF7
2930
+#define	DIO53_RPORT	PINF
2931
+#define	DIO53_WPORT	PORTF
2932
+#define	DIO53_DDR		DDRF
2933
+#define DIO53_PWM		NULL
2934
+
2935
+
2936
+
2937
+
2938
+#undef PA0
2939
+#define PA0_PIN			PINA0
2940
+#define PA0_RPORT		PINA
2941
+#define PA0_WPORT		PORTA
2942
+#define PA0_DDR			DDRA
2943
+#define PA0_PWM			NULL
2944
+#undef PA1
2945
+#define PA1_PIN			PINA1
2946
+#define PA1_RPORT		PINA
2947
+#define PA1_WPORT		PORTA
2948
+#define PA1_DDR			DDRA
2949
+#define PA1_PWM			NULL
2950
+#undef PA2
2951
+#define PA2_PIN			PINA2
2952
+#define PA2_RPORT		PINA
2953
+#define PA2_WPORT		PORTA
2954
+#define PA2_DDR			DDRA
2955
+#define PA2_PWM			NULL
2956
+#undef PA3
2957
+#define PA3_PIN			PINA3
2958
+#define PA3_RPORT		PINA
2959
+#define PA3_WPORT		PORTA
2960
+#define PA3_DDR			DDRA
2961
+#define PA3_PWM			NULL
2962
+#undef PA4
2963
+#define PA4_PIN			PINA4
2964
+#define PA4_RPORT		PINA
2965
+#define PA4_WPORT		PORTA
2966
+#define PA4_DDR			DDRA
2967
+#define PA4_PWM			NULL
2968
+#undef PA5
2969
+#define PA5_PIN			PINA5
2970
+#define PA5_RPORT		PINA
2971
+#define PA5_WPORT		PORTA
2972
+#define PA5_DDR			DDRA
2973
+#define PA5_PWM			NULL
2974
+#undef PA6
2975
+#define PA6_PIN			PINA6
2976
+#define PA6_RPORT		PINA
2977
+#define PA6_WPORT		PORTA
2978
+#define PA6_DDR			DDRA
2979
+#define PA6_PWM			NULL
2980
+#undef PA7
2981
+#define PA7_PIN			PINA7
2982
+#define PA7_RPORT		PINA
2983
+#define PA7_WPORT		PORTA
2984
+#define PA7_DDR			DDRA
2985
+#define PA7_PWM			NULL
2986
+
2987
+#undef PB0
2988
+#define PB0_PIN			PINB0
2989
+#define PB0_RPORT		PINB
2990
+#define PB0_WPORT		PORTB
2991
+#define PB0_DDR			DDRB
2992
+#define PB0_PWM			NULL
2993
+#undef PB1
2994
+#define PB1_PIN			PINB1
2995
+#define PB1_RPORT		PINB
2996
+#define PB1_WPORT		PORTB
2997
+#define PB1_DDR			DDRB
2998
+#define PB1_PWM			NULL
2999
+#undef PB2
3000
+#define PB2_PIN			PINB2
3001
+#define PB2_RPORT		PINB
3002
+#define PB2_WPORT		PORTB
3003
+#define PB2_DDR			DDRB
3004
+#define PB2_PWM			NULL
3005
+#undef PB3
3006
+#define PB3_PIN			PINB3
3007
+#define PB3_RPORT		PINB
3008
+#define PB3_WPORT		PORTB
3009
+#define PB3_DDR			DDRB
3010
+#define PB3_PWM			NULL
3011
+#undef PB4
3012
+#define PB4_PIN			PINB4
3013
+#define PB4_RPORT		PINB
3014
+#define PB4_WPORT		PORTB
3015
+#define PB4_DDR			DDRB
3016
+#define PB4_PWM			&OCR2A
3017
+#undef PB5
3018
+#define PB5_PIN			PINB5
3019
+#define PB5_RPORT		PINB
3020
+#define PB5_WPORT		PORTB
3021
+#define PB5_DDR			DDRB
3022
+#define PB5_PWM			NULL
3023
+#undef PB6
3024
+#define PB6_PIN			PINB6
3025
+#define PB6_RPORT		PINB
3026
+#define PB6_WPORT		PORTB
3027
+#define PB6_DDR			DDRB
3028
+#define PB6_PWM			NULL
3029
+#undef PB7
3030
+#define PB7_PIN			PINB7
3031
+#define PB7_RPORT		PINB
3032
+#define PB7_WPORT		PORTB
3033
+#define PB7_DDR			DDRB
3034
+#define PB7_PWM			&OCR0A
3035
+
3036
+#undef PC0
3037
+#define PC0_PIN			PINC0
3038
+#define PC0_RPORT		PINC
3039
+#define PC0_WPORT		PORTC
3040
+#define PC0_DDR			DDRC
3041
+#define PC0_PWM			NULL
3042
+#undef PC1
3043
+#define PC1_PIN			PINC1
3044
+#define PC1_RPORT		PINC
3045
+#define PC1_WPORT		PORTC
3046
+#define PC1_DDR			DDRC
3047
+#define PC1_PWM			NULL
3048
+#undef PC2
3049
+#define PC2_PIN			PINC2
3050
+#define PC2_RPORT		PINC
3051
+#define PC2_WPORT		PORTC
3052
+#define PC2_DDR			DDRC
3053
+#define PC2_PWM			NULL
3054
+#undef PC3
3055
+#define PC3_PIN			PINC3
3056
+#define PC3_RPORT		PINC
3057
+#define PC3_WPORT		PORTC
3058
+#define PC3_DDR			DDRC
3059
+#define PC3_PWM			NULL
3060
+#undef PC4
3061
+#define PC4_PIN			PINC4
3062
+#define PC4_RPORT		PINC
3063
+#define PC4_WPORT		PORTC
3064
+#define PC4_DDR			DDRC
3065
+#define PC4_PWM			NULL
3066
+#undef PC5
3067
+#define PC5_PIN			PINC5
3068
+#define PC5_RPORT		PINC
3069
+#define PC5_WPORT		PORTC
3070
+#define PC5_DDR			DDRC
3071
+#define PC5_PWM			NULL
3072
+#undef PC6
3073
+#define PC6_PIN			PINC6
3074
+#define PC6_RPORT		PINC
3075
+#define PC6_WPORT		PORTC
3076
+#define PC6_DDR			DDRC
3077
+#define PC6_PWM			NULL
3078
+#undef PC7
3079
+#define PC7_PIN			PINC7
3080
+#define PC7_RPORT		PINC
3081
+#define PC7_WPORT		PORTC
3082
+#define PC7_DDR			DDRC
3083
+#define PC7_PWM			NULL
3084
+
3085
+#undef PD0
3086
+#define PD0_PIN			PIND0
3087
+#define PD0_RPORT		PIND
3088
+#define PD0_WPORT		PORTD
3089
+#define PD0_DDR			DDRD
3090
+#define PD0_PWM			NULL
3091
+#undef PD1
3092
+#define PD1_PIN			PIND1
3093
+#define PD1_RPORT		PIND
3094
+#define PD1_WPORT		PORTD
3095
+#define PD1_DDR			DDRD
3096
+#define PD1_PWM			NULL
3097
+#undef PD2
3098
+#define PD2_PIN			PIND2
3099
+#define PD2_RPORT		PIND
3100
+#define PD2_WPORT		PORTD
3101
+#define PD2_DDR			DDRD
3102
+#define PD2_PWM			NULL
3103
+#undef PD3
3104
+#define PD3_PIN			PIND3
3105
+#define PD3_RPORT		PIND
3106
+#define PD3_WPORT		PORTD
3107
+#define PD3_DDR			DDRD
3108
+#define PD3_PWM			NULL
3109
+#undef PD4
3110
+#define PD4_PIN			PIND4
3111
+#define PD4_RPORT		PIND
3112
+#define PD4_WPORT		PORTD
3113
+#define PD4_DDR			DDRD
3114
+#define PD4_PWM			NULL
3115
+#undef PD5
3116
+#define PD5_PIN			PIND5
3117
+#define PD5_RPORT		PIND
3118
+#define PD5_WPORT		PORTD
3119
+#define PD5_DDR			DDRD
3120
+#define PD5_PWM			NULL
3121
+#undef PD6
3122
+#define PD6_PIN			PIND6
3123
+#define PD6_RPORT		PIND
3124
+#define PD6_WPORT		PORTD
3125
+#define PD6_DDR			DDRD
3126
+#define PD6_PWM			NULL
3127
+#undef PD7
3128
+#define PD7_PIN			PIND7
3129
+#define PD7_RPORT		PIND
3130
+#define PD7_WPORT		PORTD
3131
+#define PD7_DDR			DDRD
3132
+#define PD7_PWM			NULL
3133
+
3134
+#undef PE0
3135
+#define PE0_PIN			PINE0
3136
+#define PE0_RPORT		PINE
3137
+#define PE0_WPORT		PORTE
3138
+#define PE0_DDR			DDRE
3139
+#define PE0_PWM			NULL
3140
+#undef PE1
3141
+#define PE1_PIN			PINE1
3142
+#define PE1_RPORT		PINE
3143
+#define PE1_WPORT		PORTE
3144
+#define PE1_DDR			DDRE
3145
+#define PE1_PWM			NULL
3146
+#undef PE2
3147
+#define PE2_PIN			PINE2
3148
+#define PE2_RPORT		PINE
3149
+#define PE2_WPORT		PORTE
3150
+#define PE2_DDR			DDRE
3151
+#define PE2_PWM			NULL
3152
+#undef PE3
3153
+#define PE3_PIN			PINE3
3154
+#define PE3_RPORT		PINE
3155
+#define PE3_WPORT		PORTE
3156
+#define PE3_DDR			DDRE
3157
+#define PE3_PWM			&OCR3AL
3158
+#undef PE4
3159
+#define PE4_PIN			PINE4
3160
+#define PE4_RPORT		PINE
3161
+#define PE4_WPORT		PORTE
3162
+#define PE4_DDR			DDRE
3163
+#define PE4_PWM			&OCR3BL
3164
+#undef PE5
3165
+#define PE5_PIN			PINE5
3166
+#define PE5_RPORT		PINE
3167
+#define PE5_WPORT		PORTE
3168
+#define PE5_DDR			DDRE
3169
+#define PE5_PWM			&OCR3CL
3170
+#undef PE6
3171
+#define PE6_PIN			PINE6
3172
+#define PE6_RPORT		PINE
3173
+#define PE6_WPORT		PORTE
3174
+#define PE6_DDR			DDRE
3175
+#define PE6_PWM			NULL
3176
+#undef PE7
3177
+#define PE7_PIN			PINE7
3178
+#define PE7_RPORT		PINE
3179
+#define PE7_WPORT		PORTE
3180
+#define PE7_DDR			DDRE
3181
+#define PE7_PWM			NULL
3182
+
3183
+#undef PF0
3184
+#define PF0_PIN			PINF0
3185
+#define PF0_RPORT		PINF
3186
+#define PF0_WPORT		PORTF
3187
+#define PF0_DDR			DDRF
3188
+#define PF0_PWM			NULL
3189
+#undef PF1
3190
+#define PF1_PIN			PINF1
3191
+#define PF1_RPORT		PINF
3192
+#define PF1_WPORT		PORTF
3193
+#define PF1_DDR			DDRF
3194
+#define PF1_PWM			NULL
3195
+#undef PF2
3196
+#define PF2_PIN			PINF2
3197
+#define PF2_RPORT		PINF
3198
+#define PF2_WPORT		PORTF
3199
+#define PF2_DDR			DDRF
3200
+#define PF2_PWM			NULL
3201
+#undef PF3
3202
+#define PF3_PIN			PINF3
3203
+#define PF3_RPORT		PINF
3204
+#define PF3_WPORT		PORTF
3205
+#define PF3_DDR			DDRF
3206
+#define PF3_PWM			NULL
3207
+#undef PF4
3208
+#define PF4_PIN			PINF4
3209
+#define PF4_RPORT		PINF
3210
+#define PF4_WPORT		PORTF
3211
+#define PF4_DDR			DDRF
3212
+#define PF4_PWM			NULL
3213
+#undef PF5
3214
+#define PF5_PIN			PINF5
3215
+#define PF5_RPORT		PINF
3216
+#define PF5_WPORT		PORTF
3217
+#define PF5_DDR			DDRF
3218
+#define PF5_PWM			NULL
3219
+#undef PF6
3220
+#define PF6_PIN			PINF6
3221
+#define PF6_RPORT		PINF
3222
+#define PF6_WPORT		PORTF
3223
+#define PF6_DDR			DDRF
3224
+#define PF6_PWM			NULL
3225
+#undef PF7
3226
+#define PF7_PIN			PINF7
3227
+#define PF7_RPORT		PINF
3228
+#define PF7_WPORT		PORTF
3229
+#define PF7_DDR			DDRF
3230
+#define PF7_PWM			NULL
3231
+
3232
+#undef PG0
3233
+#define PG0_PIN			PING0
3234
+#define PG0_RPORT		PING
3235
+#define PG0_WPORT		PORTG
3236
+#define PG0_DDR			DDRG
3237
+#define PG0_PWM			NULL
3238
+#undef PG1
3239
+#define PG1_PIN			PING1
3240
+#define PG1_RPORT		PING
3241
+#define PG1_WPORT		PORTG
3242
+#define PG1_DDR			DDRG
3243
+#define PG1_PWM			NULL
3244
+#undef PG2
3245
+#define PG2_PIN			PING2
3246
+#define PG2_RPORT		PING
3247
+#define PG2_WPORT		PORTG
3248
+#define PG2_DDR			DDRG
3249
+#define PG2_PWM			NULL
3250
+#undef PG3
3251
+#define PG3_PIN			PING3
3252
+#define PG3_RPORT		PING
3253
+#define PG3_WPORT		PORTG
3254
+#define PG3_DDR			DDRG
3255
+#define PG3_PWM			NULL
3256
+#undef PG4
3257
+#define PG4_PIN			PING4
3258
+#define PG4_RPORT		PING
3259
+#define PG4_WPORT		PORTG
3260
+#define PG4_DDR			DDRG
3261
+#define PG4_PWM			NULL
3262
+#undef PG5
3263
+#define PG5_PIN			PING5
3264
+#define PG5_RPORT		PING
3265
+#define PG5_WPORT		PORTG
3266
+#define PG5_DDR			DDRG
3267
+#define PG5_PWM			&OCR0B
3268
+
3269
+
3270
+#endif
3271
+
2578 3272
 #ifndef	DIO0_PIN
2579 3273
 #error pins for this chip not defined in arduino.h! If you write an appropriate pin definition and have this firmware work on your chip, please submit a pull request
2580 3274
 #endif
2581 3275
 
2582
-#endif /* _FASTIO_ARDUINO_H */
3276
+#endif /* _FASTIO_ARDUINO_H */

+ 1524
- 1472
Marlin/language.h
File diff suppressed because it is too large
Näytä tiedosto


+ 742
- 292
Marlin/pins.h
File diff suppressed because it is too large
Näytä tiedosto


+ 76
- 28
Marlin/planner.cpp Näytä tiedosto

@@ -98,7 +98,7 @@ volatile unsigned char block_buffer_tail;           // Index of the block to pro
98 98
 //=============================private variables ============================
99 99
 //===========================================================================
100 100
 #ifdef PREVENT_DANGEROUS_EXTRUDE
101
-bool allow_cold_extrude=false;
101
+float extrude_min_temp=EXTRUDE_MINTEMP;
102 102
 #endif
103 103
 #ifdef XY_FREQUENCY_LIMIT
104 104
 #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
@@ -439,12 +439,20 @@ void check_axes_activity()
439 439
   unsigned char z_active = 0;
440 440
   unsigned char e_active = 0;
441 441
   unsigned char tail_fan_speed = fanSpeed;
442
+  #ifdef BARICUDA
443
+  unsigned char tail_valve_pressure = ValvePressure;
444
+  unsigned char tail_e_to_p_pressure = EtoPPressure;
445
+  #endif
442 446
   block_t *block;
443 447
 
444 448
   if(block_buffer_tail != block_buffer_head)
445 449
   {
446 450
     uint8_t block_index = block_buffer_tail;
447 451
     tail_fan_speed = block_buffer[block_index].fan_speed;
452
+    #ifdef BARICUDA
453
+    tail_valve_pressure = block_buffer[block_index].valve_pressure;
454
+    tail_e_to_p_pressure = block_buffer[block_index].e_to_p_pressure;
455
+    #endif
448 456
     while(block_index != block_buffer_head)
449 457
     {
450 458
       block = &block_buffer[block_index];
@@ -464,28 +472,40 @@ void check_axes_activity()
464 472
     disable_e1();
465 473
     disable_e2(); 
466 474
   }
467
-#if FAN_PIN > -1
468
-  #ifndef FAN_SOFT_PWM
469
-    #ifdef FAN_KICKSTART_TIME
470
-      static unsigned long fan_kick_end;
471
-      if (tail_fan_speed) {
472
-        if (fan_kick_end == 0) {
473
-          // Just starting up fan - run at full power.
474
-          fan_kick_end = millis() + FAN_KICKSTART_TIME;
475
-          tail_fan_speed = 255;
476
-        } else if (fan_kick_end > millis())
477
-          // Fan still spinning up.
478
-          tail_fan_speed = 255;
479
-      } else {
480
-        fan_kick_end = 0;
481
-      }
482
-    #endif//FAN_KICKSTART_TIME
483
-    analogWrite(FAN_PIN,tail_fan_speed);
475
+#if defined(FAN_PIN) && FAN_PIN > -1
476
+  #ifdef FAN_KICKSTART_TIME
477
+    static unsigned long fan_kick_end;
478
+    if (tail_fan_speed) {
479
+      if (fan_kick_end == 0) {
480
+        // Just starting up fan - run at full power.
481
+        fan_kick_end = millis() + FAN_KICKSTART_TIME;
482
+        tail_fan_speed = 255;
483
+      } else if (fan_kick_end > millis())
484
+        // Fan still spinning up.
485
+        tail_fan_speed = 255;
486
+    } else {
487
+      fan_kick_end = 0;
488
+    }
489
+  #endif//FAN_KICKSTART_TIME
490
+  #ifdef FAN_SOFT_PWM
491
+  fanSpeedSoftPwm = tail_fan_speed;
492
+  #else
493
+  analogWrite(FAN_PIN,tail_fan_speed);
484 494
   #endif//!FAN_SOFT_PWM
485 495
 #endif//FAN_PIN > -1
486 496
 #ifdef AUTOTEMP
487 497
   getHighESpeed();
488 498
 #endif
499
+
500
+#ifdef BARICUDA
501
+  #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1
502
+      analogWrite(HEATER_1_PIN,tail_valve_pressure);
503
+  #endif
504
+
505
+  #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1
506
+      analogWrite(HEATER_2_PIN,tail_e_to_p_pressure);
507
+  #endif
508
+#endif
489 509
 }
490 510
 
491 511
 
@@ -519,7 +539,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
519 539
   #ifdef PREVENT_DANGEROUS_EXTRUDE
520 540
   if(target[E_AXIS]!=position[E_AXIS])
521 541
   {
522
-    if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
542
+    if(degHotend(active_extruder)<extrude_min_temp)
523 543
     {
524 544
       position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
525 545
       SERIAL_ECHO_START;
@@ -544,8 +564,16 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
544 564
   block->busy = false;
545 565
 
546 566
   // Number of steps for each axis
547
-  block->steps_x = labs(target[X_AXIS]-position[X_AXIS]);
548
-  block->steps_y = labs(target[Y_AXIS]-position[Y_AXIS]);
567
+#ifndef COREXY
568
+// default non-h-bot planning
569
+block->steps_x = labs(target[X_AXIS]-position[X_AXIS]);
570
+block->steps_y = labs(target[Y_AXIS]-position[Y_AXIS]);
571
+#else
572
+// corexy planning
573
+// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
574
+block->steps_x = labs((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]));
575
+block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]));
576
+#endif
549 577
   block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
550 578
   block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
551 579
   block->steps_e *= extrudemultiply;
@@ -559,9 +587,14 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
559 587
   }
560 588
 
561 589
   block->fan_speed = fanSpeed;
590
+  #ifdef BARICUDA
591
+  block->valve_pressure = ValvePressure;
592
+  block->e_to_p_pressure = EtoPPressure;
593
+  #endif
562 594
 
563 595
   // Compute direction bits for this block 
564 596
   block->direction_bits = 0;
597
+#ifndef COREXY
565 598
   if (target[X_AXIS] < position[X_AXIS])
566 599
   {
567 600
     block->direction_bits |= (1<<X_AXIS); 
@@ -570,6 +603,16 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
570 603
   {
571 604
     block->direction_bits |= (1<<Y_AXIS); 
572 605
   }
606
+#else
607
+  if ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]) < 0)
608
+  {
609
+    block->direction_bits |= (1<<X_AXIS); 
610
+  }
611
+  if ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]) < 0)
612
+  {
613
+    block->direction_bits |= (1<<Y_AXIS); 
614
+  }
615
+#endif
573 616
   if (target[Z_AXIS] < position[Z_AXIS])
574 617
   {
575 618
     block->direction_bits |= (1<<Z_AXIS); 
@@ -614,8 +657,13 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
614 657
   } 
615 658
 
616 659
   float delta_mm[4];
617
-  delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
618
-  delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
660
+  #ifndef COREXY
661
+    delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
662
+    delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
663
+  #else
664
+    delta_mm[X_AXIS] = ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[X_AXIS];
665
+    delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS];
666
+  #endif
619 667
   delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
620 668
   delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0;
621 669
   if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments )
@@ -735,7 +783,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
735 783
       block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
736 784
   }
737 785
   block->acceleration = block->acceleration_st / steps_per_mm;
738
-  block->acceleration_rate = (long)((float)block->acceleration_st * 8.388608);
786
+  block->acceleration_rate = (long)((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0)));
739 787
 
740 788
 #if 0  // Use old jerk for now
741 789
   // Compute path unit vector
@@ -896,12 +944,12 @@ uint8_t movesplanned()
896 944
   return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
897 945
 }
898 946
 
899
-void allow_cold_extrudes(bool allow)
900
-{
901 947
 #ifdef PREVENT_DANGEROUS_EXTRUDE
902
-  allow_cold_extrude=allow;
903
-#endif
948
+void set_extrude_min_temp(float temp)
949
+{
950
+  extrude_min_temp=temp;
904 951
 }
952
+#endif
905 953
 
906 954
 // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
907 955
 void reset_acceleration_rates()

+ 7
- 1
Marlin/planner.h Näytä tiedosto

@@ -60,6 +60,10 @@ typedef struct {
60 60
   unsigned long final_rate;                          // The minimal rate at exit
61 61
   unsigned long acceleration_st;                     // acceleration steps/sec^2
62 62
   unsigned long fan_speed;
63
+  #ifdef BARICUDA
64
+  unsigned long valve_pressure;
65
+  unsigned long e_to_p_pressure;
66
+  #endif
63 67
   volatile char busy;
64 68
 } block_t;
65 69
 
@@ -135,7 +139,9 @@ FORCE_INLINE bool blocks_queued()
135 139
     return true;
136 140
 }
137 141
 
138
-void allow_cold_extrudes(bool allow);
142
+#ifdef PREVENT_DANGEROUS_EXTRUDE
143
+void set_extrude_min_temp(float temp);
144
+#endif
139 145
 
140 146
 void reset_acceleration_rates();
141 147
 #endif

+ 133
- 154
Marlin/stepper.cpp Näytä tiedosto

@@ -29,7 +29,7 @@
29 29
 #include "language.h"
30 30
 #include "cardreader.h"
31 31
 #include "speed_lookuptable.h"
32
-#if DIGIPOTSS_PIN > -1
32
+#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
33 33
 #include <SPI.h>
34 34
 #endif
35 35
 
@@ -69,9 +69,9 @@ volatile long endstops_stepsTotal,endstops_stepsDone;
69 69
 static volatile bool endstop_x_hit=false;
70 70
 static volatile bool endstop_y_hit=false;
71 71
 static volatile bool endstop_z_hit=false;
72
-#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
73
-bool abort_on_endstop_hit = false;
74
-#endif
72
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
73
+bool abort_on_endstop_hit = false;
74
+#endif
75 75
 
76 76
 static bool old_x_min_endstop=false;
77 77
 static bool old_x_max_endstop=false;
@@ -184,20 +184,20 @@ void checkHitEndstops()
184 184
      SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
185 185
      LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
186 186
    }
187
-   SERIAL_ECHOLN("");
187
+   SERIAL_ECHOLN("");
188 188
    endstop_x_hit=false;
189 189
    endstop_y_hit=false;
190
-   endstop_z_hit=false;
191
-#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
192
-   if (abort_on_endstop_hit)
193
-   {
190
+   endstop_z_hit=false;
191
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
192
+   if (abort_on_endstop_hit)
193
+   {
194 194
      card.sdprinting = false;
195 195
      card.closefile();
196
-     quickStop();
196
+     quickStop();
197 197
      setTargetHotend0(0);
198 198
      setTargetHotend1(0);
199 199
      setTargetHotend2(0);
200
-   }
200
+   }
201 201
 #endif
202 202
  }
203 203
 }
@@ -272,7 +272,7 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
272 272
     timer = (unsigned short)pgm_read_word_near(table_address);
273 273
     timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
274 274
   }
275
-  if(timer < 100) { timer = 100; MYSERIAL.print(MSG_STEPPER_TO_HIGH); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
275
+  if(timer < 100) { timer = 100; MYSERIAL.print(MSG_STEPPER_TOO_HIGH); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
276 276
   return timer;
277 277
 }
278 278
 
@@ -345,53 +345,89 @@ ISR(TIMER1_COMPA_vect)
345 345
     // Set directions TO DO This should be done once during init of trapezoid. Endstops -> interrupt
346 346
     out_bits = current_block->direction_bits;
347 347
 
348
-    // Set direction en check limit switches
349
-    if ((out_bits & (1<<X_AXIS)) != 0) {   // stepping along -X axis
350
-      #if !defined COREXY  //NOT COREXY
348
+
349
+    // Set the direction bits (X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY)
350
+    if((out_bits & (1<<X_AXIS))!=0){
351
+      #ifdef DUAL_X_CARRIAGE
352
+      if (active_extruder != 0)
353
+        WRITE(X2_DIR_PIN,INVERT_X_DIR);
354
+      else
355
+      #endif        
351 356
         WRITE(X_DIR_PIN, INVERT_X_DIR);
352
-      #endif
353 357
       count_direction[X_AXIS]=-1;
358
+    }
359
+    else{
360
+      #ifdef DUAL_X_CARRIAGE
361
+      if (active_extruder != 0)
362
+        WRITE(X2_DIR_PIN,!INVERT_X_DIR);
363
+      else
364
+      #endif        
365
+        WRITE(X_DIR_PIN, !INVERT_X_DIR);
366
+      count_direction[X_AXIS]=1;
367
+    }
368
+    if((out_bits & (1<<Y_AXIS))!=0){
369
+      WRITE(Y_DIR_PIN, INVERT_Y_DIR);
370
+      count_direction[Y_AXIS]=-1;
371
+    }
372
+    else{
373
+      WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
374
+      count_direction[Y_AXIS]=1;
375
+    }
376
+    
377
+    // Set direction en check limit switches
378
+    #ifndef COREXY
379
+    if ((out_bits & (1<<X_AXIS)) != 0) {   // stepping along -X axis
380
+    #else
381
+    if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) != 0)) {   //-X occurs for -A and -B
382
+    #endif
354 383
       CHECK_ENDSTOPS
355 384
       {
356
-        #if X_MIN_PIN > -1
357
-          bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
358
-          if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
359
-            endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
360
-            endstop_x_hit=true;
361
-            step_events_completed = current_block->step_event_count;
362
-          }
363
-          old_x_min_endstop = x_min_endstop;
364
-        #endif
385
+        #ifdef DUAL_X_CARRIAGE
386
+        // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
387
+        if ((active_extruder == 0 && X_HOME_DIR == -1) || (active_extruder != 0 && X2_HOME_DIR == -1))
388
+        #endif          
389
+        {
390
+          #if defined(X_MIN_PIN) && X_MIN_PIN > -1
391
+            bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
392
+            if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
393
+              endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
394
+              endstop_x_hit=true;
395
+              step_events_completed = current_block->step_event_count;
396
+            }
397
+            old_x_min_endstop = x_min_endstop;
398
+          #endif
399
+        }
365 400
       }
366 401
     }
367 402
     else { // +direction
368
-      #if !defined COREXY  //NOT COREXY
369
-        WRITE(X_DIR_PIN,!INVERT_X_DIR);
370
-      #endif
371
-      
372
-      count_direction[X_AXIS]=1;
373 403
       CHECK_ENDSTOPS 
374 404
       {
375
-        #if X_MAX_PIN > -1
376
-          bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
377
-          if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
378
-            endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
379
-            endstop_x_hit=true;
380
-            step_events_completed = current_block->step_event_count;
381
-          }
382
-          old_x_max_endstop = x_max_endstop;
383
-        #endif
405
+        #ifdef DUAL_X_CARRIAGE
406
+        // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
407
+        if ((active_extruder == 0 && X_HOME_DIR == 1) || (active_extruder != 0 && X2_HOME_DIR == 1))
408
+        #endif          
409
+        {
410
+          #if defined(X_MAX_PIN) && X_MAX_PIN > -1
411
+            bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
412
+            if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
413
+              endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
414
+              endstop_x_hit=true;
415
+              step_events_completed = current_block->step_event_count;
416
+            }
417
+            old_x_max_endstop = x_max_endstop;
418
+          #endif
419
+        }  
384 420
       }
385 421
     }
386 422
 
423
+    #ifndef COREXY
387 424
     if ((out_bits & (1<<Y_AXIS)) != 0) {   // -direction
388
-      #if !defined COREXY  //NOT COREXY
389
-        WRITE(Y_DIR_PIN,INVERT_Y_DIR);
390
-      #endif
391
-      count_direction[Y_AXIS]=-1;
425
+    #else
426
+    if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) == 0)) {   // -Y occurs for -A and +B
427
+    #endif
392 428
       CHECK_ENDSTOPS
393 429
       {
394
-        #if Y_MIN_PIN > -1
430
+        #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
395 431
           bool y_min_endstop=(READ(Y_MIN_PIN) != Y_ENDSTOPS_INVERTING);
396 432
           if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
397 433
             endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
@@ -403,13 +439,9 @@ ISR(TIMER1_COMPA_vect)
403 439
       }
404 440
     }
405 441
     else { // +direction
406
-      #if !defined COREXY  //NOT COREXY
407
-        WRITE(Y_DIR_PIN,!INVERT_Y_DIR);
408
-      #endif
409
-      count_direction[Y_AXIS]=1;
410 442
       CHECK_ENDSTOPS
411 443
       {
412
-        #if Y_MAX_PIN > -1
444
+        #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
413 445
           bool y_max_endstop=(READ(Y_MAX_PIN) != Y_ENDSTOPS_INVERTING);
414 446
           if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
415 447
             endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
@@ -420,28 +452,7 @@ ISR(TIMER1_COMPA_vect)
420 452
         #endif
421 453
       }
422 454
     }
423
-    
424
-    
425
-    #ifdef COREXY  //coreXY kinematics defined
426
-      if((current_block->steps_x >= current_block->steps_y)&&((out_bits & (1<<X_AXIS)) == 0)){  //+X is major axis
427
-        WRITE(X_DIR_PIN, !INVERT_X_DIR);
428
-        WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
429
-      }
430
-      if((current_block->steps_x >= current_block->steps_y)&&((out_bits & (1<<X_AXIS)) != 0)){  //-X is major axis
431
-        WRITE(X_DIR_PIN, INVERT_X_DIR);
432
-        WRITE(Y_DIR_PIN, INVERT_Y_DIR);
433
-      }      
434
-      if((current_block->steps_y > current_block->steps_x)&&((out_bits & (1<<Y_AXIS)) == 0)){  //+Y is major axis
435
-        WRITE(X_DIR_PIN, !INVERT_X_DIR);
436
-        WRITE(Y_DIR_PIN, INVERT_Y_DIR);
437
-      }        
438
-      if((current_block->steps_y > current_block->steps_x)&&((out_bits & (1<<Y_AXIS)) != 0)){  //-Y is major axis
439
-        WRITE(X_DIR_PIN, INVERT_X_DIR);
440
-        WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
441
-      }  
442
-    #endif //coreXY
443
-    
444
-    
455
+
445 456
     if ((out_bits & (1<<Z_AXIS)) != 0) {   // -direction
446 457
       WRITE(Z_DIR_PIN,INVERT_Z_DIR);
447 458
       
@@ -452,7 +463,7 @@ ISR(TIMER1_COMPA_vect)
452 463
       count_direction[Z_AXIS]=-1;
453 464
       CHECK_ENDSTOPS
454 465
       {
455
-        #if Z_MIN_PIN > -1
466
+        #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
456 467
           bool z_min_endstop=(READ(Z_MIN_PIN) != Z_ENDSTOPS_INVERTING);
457 468
           if(z_min_endstop && old_z_min_endstop && (current_block->steps_z > 0)) {
458 469
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
@@ -473,7 +484,7 @@ ISR(TIMER1_COMPA_vect)
473 484
       count_direction[Z_AXIS]=1;
474 485
       CHECK_ENDSTOPS
475 486
       {
476
-        #if Z_MAX_PIN > -1
487
+        #if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
477 488
           bool z_max_endstop=(READ(Z_MAX_PIN) != Z_ENDSTOPS_INVERTING);
478 489
           if(z_max_endstop && old_z_max_endstop && (current_block->steps_z > 0)) {
479 490
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
@@ -516,13 +527,22 @@ ISR(TIMER1_COMPA_vect)
516 527
       }    
517 528
       #endif //ADVANCE
518 529
 
519
-      #if !defined COREXY      
520 530
         counter_x += current_block->steps_x;
521 531
         if (counter_x > 0) {
522
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
532
+          #ifdef DUAL_X_CARRIAGE
533
+          if (active_extruder != 0)
534
+            WRITE(X2_STEP_PIN,!INVERT_X_STEP_PIN);
535
+          else
536
+          #endif        
537
+            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
523 538
           counter_x -= current_block->step_event_count;
524 539
           count_position[X_AXIS]+=count_direction[X_AXIS];   
525
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
540
+          #ifdef DUAL_X_CARRIAGE
541
+          if (active_extruder != 0)
542
+            WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
543
+          else
544
+          #endif        
545
+            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
526 546
         }
527 547
   
528 548
         counter_y += current_block->steps_y;
@@ -532,56 +552,7 @@ ISR(TIMER1_COMPA_vect)
532 552
           count_position[Y_AXIS]+=count_direction[Y_AXIS]; 
533 553
           WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
534 554
         }
535
-      #endif
536 555
   
537
-      #ifdef COREXY
538
-        counter_x += current_block->steps_x;        
539
-        counter_y += current_block->steps_y;
540
-        
541
-        if ((counter_x > 0)&&!(counter_y>0)){  //X step only
542
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
543
-          WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
544
-          counter_x -= current_block->step_event_count; 
545
-          count_position[X_AXIS]+=count_direction[X_AXIS];         
546
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
547
-          WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
548
-        }
549
-        
550
-        if (!(counter_x > 0)&&(counter_y>0)){  //Y step only
551
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
552
-          WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
553
-          counter_y -= current_block->step_event_count; 
554
-          count_position[Y_AXIS]+=count_direction[Y_AXIS];
555
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
556
-          WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
557
-        }        
558
-        
559
-        if ((counter_x > 0)&&(counter_y>0)){  //step in both axes
560
-          if (((out_bits & (1<<X_AXIS)) == 0)^((out_bits & (1<<Y_AXIS)) == 0)){  //X and Y in different directions
561
-            WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
562
-            counter_x -= current_block->step_event_count;             
563
-            WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
564
-            step_wait();
565
-            count_position[X_AXIS]+=count_direction[X_AXIS];
566
-            count_position[Y_AXIS]+=count_direction[Y_AXIS];
567
-            WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
568
-            counter_y -= current_block->step_event_count;
569
-            WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
570
-          }
571
-          else{  //X and Y in same direction
572
-            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
573
-            counter_x -= current_block->step_event_count;             
574
-            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN) ;
575
-            step_wait();
576
-            count_position[X_AXIS]+=count_direction[X_AXIS];
577
-            count_position[Y_AXIS]+=count_direction[Y_AXIS];
578
-            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); 
579
-            counter_y -= current_block->step_event_count;    
580
-            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);        
581
-          }
582
-        }
583
-      #endif //corexy
584
-      
585 556
       counter_z += current_block->steps_z;
586 557
       if (counter_z > 0) {
587 558
         WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
@@ -743,20 +714,23 @@ void st_init()
743 714
   microstep_init(); //Initialize Microstepping Pins
744 715
   
745 716
   //Initialize Dir Pins
746
-  #if X_DIR_PIN > -1
717
+  #if defined(X_DIR_PIN) && X_DIR_PIN > -1
747 718
     SET_OUTPUT(X_DIR_PIN);
748 719
   #endif
749
-  #if Y_DIR_PIN > -1 
720
+  #if defined(X2_DIR_PIN) && X2_DIR_PIN > -1
721
+    SET_OUTPUT(X2_DIR_PIN);
722
+  #endif
723
+  #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 
750 724
     SET_OUTPUT(Y_DIR_PIN);
751 725
   #endif
752
-  #if Z_DIR_PIN > -1 
726
+  #if defined(Z_DIR_PIN) && Z_DIR_PIN > -1 
753 727
     SET_OUTPUT(Z_DIR_PIN);
754 728
 
755
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_DIR_PIN > -1)
729
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && (Z2_DIR_PIN > -1)
756 730
       SET_OUTPUT(Z2_DIR_PIN);
757 731
     #endif
758 732
   #endif
759
-  #if E0_DIR_PIN > -1 
733
+  #if defined(E0_DIR_PIN) && E0_DIR_PIN > -1 
760 734
     SET_OUTPUT(E0_DIR_PIN);
761 735
   #endif
762 736
   #if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
@@ -768,24 +742,28 @@ void st_init()
768 742
 
769 743
   //Initialize Enable Pins - steppers default to disabled.
770 744
 
771
-  #if (X_ENABLE_PIN > -1)
745
+  #if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
772 746
     SET_OUTPUT(X_ENABLE_PIN);
773 747
     if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
774 748
   #endif
775
-  #if (Y_ENABLE_PIN > -1)
749
+  #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
750
+    SET_OUTPUT(X2_ENABLE_PIN);
751
+    if(!X_ENABLE_ON) WRITE(X2_ENABLE_PIN,HIGH);
752
+  #endif
753
+  #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
776 754
     SET_OUTPUT(Y_ENABLE_PIN);
777 755
     if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
778 756
   #endif
779
-  #if (Z_ENABLE_PIN > -1)
757
+  #if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
780 758
     SET_OUTPUT(Z_ENABLE_PIN);
781 759
     if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
782 760
     
783
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_ENABLE_PIN > -1)
761
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && (Z2_ENABLE_PIN > -1)
784 762
       SET_OUTPUT(Z2_ENABLE_PIN);
785 763
       if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
786 764
     #endif
787 765
   #endif
788
-  #if (E0_ENABLE_PIN > -1)
766
+  #if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
789 767
     SET_OUTPUT(E0_ENABLE_PIN);
790 768
     if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
791 769
   #endif
@@ -800,42 +778,42 @@ void st_init()
800 778
 
801 779
   //endstops and pullups
802 780
   
803
-  #if X_MIN_PIN > -1
781
+  #if defined(X_MIN_PIN) && X_MIN_PIN > -1
804 782
     SET_INPUT(X_MIN_PIN); 
805 783
     #ifdef ENDSTOPPULLUP_XMIN
806 784
       WRITE(X_MIN_PIN,HIGH);
807 785
     #endif
808 786
   #endif
809 787
       
810
-  #if Y_MIN_PIN > -1
788
+  #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
811 789
     SET_INPUT(Y_MIN_PIN); 
812 790
     #ifdef ENDSTOPPULLUP_YMIN
813 791
       WRITE(Y_MIN_PIN,HIGH);
814 792
     #endif
815 793
   #endif
816 794
   
817
-  #if Z_MIN_PIN > -1
795
+  #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
818 796
     SET_INPUT(Z_MIN_PIN); 
819 797
     #ifdef ENDSTOPPULLUP_ZMIN
820 798
       WRITE(Z_MIN_PIN,HIGH);
821 799
     #endif
822 800
   #endif
823 801
       
824
-  #if X_MAX_PIN > -1
802
+  #if defined(X_MAX_PIN) && X_MAX_PIN > -1
825 803
     SET_INPUT(X_MAX_PIN); 
826 804
     #ifdef ENDSTOPPULLUP_XMAX
827 805
       WRITE(X_MAX_PIN,HIGH);
828 806
     #endif
829 807
   #endif
830 808
       
831
-  #if Y_MAX_PIN > -1
809
+  #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
832 810
     SET_INPUT(Y_MAX_PIN); 
833 811
     #ifdef ENDSTOPPULLUP_YMAX
834 812
       WRITE(Y_MAX_PIN,HIGH);
835 813
     #endif
836 814
   #endif
837 815
   
838
-  #if Z_MAX_PIN > -1
816
+  #if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
839 817
     SET_INPUT(Z_MAX_PIN); 
840 818
     #ifdef ENDSTOPPULLUP_ZMAX
841 819
       WRITE(Z_MAX_PIN,HIGH);
@@ -844,26 +822,31 @@ void st_init()
844 822
  
845 823
 
846 824
   //Initialize Step Pins
847
-  #if (X_STEP_PIN > -1) 
825
+  #if defined(X_STEP_PIN) && (X_STEP_PIN > -1) 
848 826
     SET_OUTPUT(X_STEP_PIN);
849 827
     WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
850 828
     disable_x();
851 829
   #endif  
852
-  #if (Y_STEP_PIN > -1) 
830
+  #if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1) 
831
+    SET_OUTPUT(X2_STEP_PIN);
832
+    WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
833
+    disable_x();
834
+  #endif  
835
+  #if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1) 
853 836
     SET_OUTPUT(Y_STEP_PIN);
854 837
     WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
855 838
     disable_y();
856 839
   #endif  
857
-  #if (Z_STEP_PIN > -1) 
840
+  #if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1) 
858 841
     SET_OUTPUT(Z_STEP_PIN);
859 842
     WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
860
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_STEP_PIN > -1)
843
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
861 844
       SET_OUTPUT(Z2_STEP_PIN);
862 845
       WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
863 846
     #endif
864 847
     disable_z();
865 848
   #endif  
866
-  #if (E0_STEP_PIN > -1) 
849
+  #if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1) 
867 850
     SET_OUTPUT(E0_STEP_PIN);
868 851
     WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
869 852
     disable_e0();
@@ -879,10 +862,6 @@ void st_init()
879 862
     disable_e2();
880 863
   #endif  
881 864
 
882
-  #ifdef CONTROLLERFAN_PIN
883
-    SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
884
-  #endif
885
-  
886 865
   // waveform generation = 0100 = CTC
887 866
   TCCR1B &= ~(1<<WGM13);
888 867
   TCCR1B |=  (1<<WGM12);
@@ -978,7 +957,7 @@ void quickStop()
978 957
 
979 958
 void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl example
980 959
 {
981
-  #if DIGIPOTSS_PIN > -1
960
+  #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
982 961
     digitalWrite(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip
983 962
     SPI.transfer(address); //  send in the address and value via SPI:
984 963
     SPI.transfer(value);
@@ -989,7 +968,7 @@ void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl e
989 968
 
990 969
 void digipot_init() //Initialize Digipot Motor Current
991 970
 {
992
-  #if DIGIPOTSS_PIN > -1
971
+  #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
993 972
     const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
994 973
     
995 974
     SPI.begin(); 
@@ -1002,7 +981,7 @@ void digipot_init() //Initialize Digipot Motor Current
1002 981
 
1003 982
 void digipot_current(uint8_t driver, int current)
1004 983
 {
1005
-  #if DIGIPOTSS_PIN > -1
984
+  #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
1006 985
     const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
1007 986
     digitalPotWrite(digipot_ch[driver], current);
1008 987
   #endif
@@ -1010,7 +989,7 @@ void digipot_current(uint8_t driver, int current)
1010 989
 
1011 990
 void microstep_init()
1012 991
 {
1013
-  #if X_MS1_PIN > -1
992
+  #if defined(X_MS1_PIN) && X_MS1_PIN > -1
1014 993
   const uint8_t microstep_modes[] = MICROSTEP_MODES;
1015 994
   pinMode(X_MS2_PIN,OUTPUT);
1016 995
   pinMode(Y_MS2_PIN,OUTPUT);

+ 211
- 84
Marlin/temperature.cpp Näytä tiedosto

@@ -40,10 +40,13 @@
40 40
 int target_temperature[EXTRUDERS] = { 0 };
41 41
 int target_temperature_bed = 0;
42 42
 int current_temperature_raw[EXTRUDERS] = { 0 };
43
-float current_temperature[EXTRUDERS] = { 0 };
43
+float current_temperature[EXTRUDERS] = { 0.0 };
44 44
 int current_temperature_bed_raw = 0;
45
-float current_temperature_bed = 0;
46
-
45
+float current_temperature_bed = 0.0;
46
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
47
+  int redundant_temperature_raw = 0;
48
+  float redundant_temperature = 0.0;
49
+#endif
47 50
 #ifdef PIDTEMP
48 51
   float Kp=DEFAULT_Kp;
49 52
   float Ki=(DEFAULT_Ki*PID_dT);
@@ -59,6 +62,9 @@ float current_temperature_bed = 0;
59 62
   float bedKd=(DEFAULT_bedKd/PID_dT);
60 63
 #endif //PIDTEMPBED
61 64
   
65
+#ifdef FAN_SOFT_PWM
66
+  unsigned char fanSpeedSoftPwm;
67
+#endif
62 68
   
63 69
 //===========================================================================
64 70
 //=============================private variables============================
@@ -99,17 +105,20 @@ static volatile bool temp_meas_ready = false;
99 105
 #ifdef FAN_SOFT_PWM
100 106
   static unsigned char soft_pwm_fan;
101 107
 #endif
108
+#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
109
+    (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
110
+    (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
111
+  static unsigned long extruder_autofan_last_check;
112
+#endif  
102 113
 
103
-
104
-  
105 114
 #if EXTRUDERS > 3
106
-# error Unsupported number of extruders
115
+  # error Unsupported number of extruders
107 116
 #elif EXTRUDERS > 2
108
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
117
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
109 118
 #elif EXTRUDERS > 1
110
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
119
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
111 120
 #else
112
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
121
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
113 122
 #endif
114 123
 
115 124
 // Init min and max temp with extreme values to prevent false errors during startup
@@ -121,8 +130,14 @@ static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383 );
121 130
 #ifdef BED_MAXTEMP
122 131
 static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
123 132
 #endif
124
-static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
125
-static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
133
+
134
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
135
+  static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE };
136
+  static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
137
+#else
138
+  static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
139
+  static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
140
+#endif
126 141
 
127 142
 static float analog2temp(int raw, uint8_t e);
128 143
 static float analog2tempBed(int raw);
@@ -133,6 +148,10 @@ int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
133 148
 unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
134 149
 #endif //WATCH_TEMP_PERIOD
135 150
 
151
+#ifndef SOFT_PWM_SCALE
152
+#define SOFT_PWM_SCALE 0
153
+#endif
154
+
136 155
 //===========================================================================
137 156
 //=============================   functions      ============================
138 157
 //===========================================================================
@@ -154,28 +173,28 @@ void PID_autotune(float temp, int extruder, int ncycles)
154 173
   float Kp, Ki, Kd;
155 174
   float max = 0, min = 10000;
156 175
 
157
-	if ((extruder > EXTRUDERS)
176
+  if ((extruder > EXTRUDERS)
158 177
   #if (TEMP_BED_PIN <= -1)
159
-		||(extruder < 0)
160
-	#endif
161
-	){
162
-  	SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
163
-  	return;
164
-	}
178
+       ||(extruder < 0)
179
+  #endif
180
+       ){
181
+          SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
182
+          return;
183
+        }
165 184
 	
166 185
   SERIAL_ECHOLN("PID Autotune start");
167 186
   
168 187
   disable_heater(); // switch off all heaters.
169 188
 
170
-	if (extruder<0)
171
-	{
172
-	 	soft_pwm_bed = (MAX_BED_POWER)/2;
173
-		bias = d = (MAX_BED_POWER)/2;
174
-  }
175
-	else
176
-	{
177
-	  soft_pwm[extruder] = (PID_MAX)/2;
178
-		bias = d = (PID_MAX)/2;
189
+  if (extruder<0)
190
+  {
191
+     soft_pwm_bed = (MAX_BED_POWER)/2;
192
+     bias = d = (MAX_BED_POWER)/2;
193
+   }
194
+   else
195
+   {
196
+     soft_pwm[extruder] = (PID_MAX)/2;
197
+     bias = d = (PID_MAX)/2;
179 198
   }
180 199
 
181 200
 
@@ -193,10 +212,10 @@ void PID_autotune(float temp, int extruder, int ncycles)
193 212
       if(heating == true && input > temp) {
194 213
         if(millis() - t2 > 5000) { 
195 214
           heating=false;
196
-					if (extruder<0)
197
-						soft_pwm_bed = (bias - d) >> 1;
198
-					else
199
-						soft_pwm[extruder] = (bias - d) >> 1;
215
+          if (extruder<0)
216
+            soft_pwm_bed = (bias - d) >> 1;
217
+          else
218
+            soft_pwm[extruder] = (bias - d) >> 1;
200 219
           t1=millis();
201 220
           t_high=t1 - t2;
202 221
           max=temp;
@@ -247,28 +266,28 @@ void PID_autotune(float temp, int extruder, int ncycles)
247 266
               */
248 267
             }
249 268
           }
250
-					if (extruder<0)
251
-						soft_pwm_bed = (bias + d) >> 1;
252
-					else
253
-						soft_pwm[extruder] = (bias + d) >> 1;
269
+          if (extruder<0)
270
+            soft_pwm_bed = (bias + d) >> 1;
271
+          else
272
+            soft_pwm[extruder] = (bias + d) >> 1;
254 273
           cycles++;
255 274
           min=temp;
256 275
         }
257 276
       } 
258 277
     }
259 278
     if(input > (temp + 20)) {
260
-      SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature to high");
279
+      SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature too high");
261 280
       return;
262 281
     }
263 282
     if(millis() - temp_millis > 2000) {
264
-			int p;
265
-			if (extruder<0){
266
-	      p=soft_pwm_bed;       
267
-	      SERIAL_PROTOCOLPGM("ok B:");
268
-			}else{
269
-	      p=soft_pwm[extruder];       
270
-	      SERIAL_PROTOCOLPGM("ok T:");
271
-			}
283
+      int p;
284
+      if (extruder<0){
285
+        p=soft_pwm_bed;       
286
+        SERIAL_PROTOCOLPGM("ok B:");
287
+      }else{
288
+        p=soft_pwm[extruder];       
289
+        SERIAL_PROTOCOLPGM("ok T:");
290
+      }
272 291
 			
273 292
       SERIAL_PROTOCOL(input);   
274 293
       SERIAL_PROTOCOLPGM(" @:");
@@ -281,7 +300,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
281 300
       return;
282 301
     }
283 302
     if(cycles > ncycles) {
284
-      SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
303
+      SERIAL_PROTOCOLLNPGM("PID Autotune finished! Put the Kp, Ki and Kd constants into Configuration.h");
285 304
       return;
286 305
     }
287 306
     lcd_update();
@@ -306,6 +325,78 @@ int getHeaterPower(int heater) {
306 325
   return soft_pwm[heater];
307 326
 }
308 327
 
328
+#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
329
+    (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
330
+    (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
331
+
332
+  #if defined(FAN_PIN) && FAN_PIN > -1
333
+    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN 
334
+       #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
335
+    #endif
336
+    #if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN 
337
+       #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
338
+    #endif
339
+    #if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN 
340
+       #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
341
+    #endif
342
+  #endif 
343
+
344
+void setExtruderAutoFanState(int pin, bool state)
345
+{
346
+  unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
347
+  // this idiom allows both digital and PWM fan outputs (see M42 handling).
348
+  pinMode(pin, OUTPUT);
349
+  digitalWrite(pin, newFanSpeed);
350
+  analogWrite(pin, newFanSpeed);
351
+}
352
+
353
+void checkExtruderAutoFans()
354
+{
355
+  uint8_t fanState = 0;
356
+
357
+  // which fan pins need to be turned on?      
358
+  #if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
359
+    if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
360
+      fanState |= 1;
361
+  #endif
362
+  #if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
363
+    if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
364
+    {
365
+      if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
366
+        fanState |= 1;
367
+      else
368
+        fanState |= 2;
369
+    }
370
+  #endif
371
+  #if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
372
+    if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
373
+    {
374
+      if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
375
+        fanState |= 1;
376
+      else if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN) 
377
+        fanState |= 2;
378
+      else
379
+        fanState |= 4;
380
+    }
381
+  #endif
382
+  
383
+  // update extruder auto fan states
384
+  #if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
385
+    setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
386
+  #endif 
387
+  #if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
388
+    if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) 
389
+      setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
390
+  #endif 
391
+  #if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
392
+    if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN 
393
+        && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
394
+      setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
395
+  #endif 
396
+}
397
+
398
+#endif // any extruder auto fan pins set
399
+
309 400
 void manage_heater()
310 401
 {
311 402
   float pid_input;
@@ -396,10 +487,31 @@ void manage_heater()
396 487
         }
397 488
     }
398 489
     #endif
399
-
490
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
491
+      if(fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
492
+        disable_heater();
493
+        if(IsStopped() == false) {
494
+          SERIAL_ERROR_START;
495
+          SERIAL_ERRORLNPGM("Extruder switched off. Temperature difference between temp sensors is too high !");
496
+          LCD_ALERTMESSAGEPGM("Err: REDUNDANT TEMP ERROR");
497
+        }
498
+        #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
499
+          Stop();
500
+        #endif
501
+      }
502
+    #endif
400 503
   } // End extruder for loop
401
-  
402 504
 
505
+  #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
506
+      (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
507
+      (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
508
+  if(millis() - extruder_autofan_last_check > 2500)  // only need to check fan state very infrequently
509
+  {
510
+    checkExtruderAutoFans();
511
+    extruder_autofan_last_check = millis();
512
+  }  
513
+  #endif       
514
+  
403 515
   #ifndef PIDTEMPBED
404 516
   if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
405 517
     return;
@@ -481,7 +593,11 @@ void manage_heater()
481 593
 // Derived from RepRap FiveD extruder::getTemperature()
482 594
 // For hot end temperature measurement.
483 595
 static float analog2temp(int raw, uint8_t e) {
596
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
597
+  if(e > EXTRUDERS)
598
+#else
484 599
   if(e >= EXTRUDERS)
600
+#endif
485 601
   {
486 602
       SERIAL_ERROR_START;
487 603
       SERIAL_ERROR((int)e);
@@ -560,7 +676,9 @@ static void updateTemperaturesFromRawValues()
560 676
         current_temperature[e] = analog2temp(current_temperature_raw[e], e);
561 677
     }
562 678
     current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
563
-
679
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
680
+      redundant_temperature = analog2temp(redundant_temperature_raw, 1);
681
+    #endif
564 682
     //Reset the watchdog after we know we have a temperature measurement.
565 683
     watchdog_reset();
566 684
 
@@ -571,6 +689,12 @@ static void updateTemperaturesFromRawValues()
571 689
 
572 690
 void tp_init()
573 691
 {
692
+#if (MOTHERBOARD == 80) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
693
+  //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
694
+  MCUCR=(1<<JTD); 
695
+  MCUCR=(1<<JTD);
696
+#endif
697
+  
574 698
   // Finish init of mult extruder arrays 
575 699
   for(int e = 0; e < EXTRUDERS; e++) {
576 700
     // populate with the first value 
@@ -585,26 +709,26 @@ void tp_init()
585 709
 #endif //PIDTEMPBED
586 710
   }
587 711
 
588
-  #if (HEATER_0_PIN > -1) 
712
+  #if defined(HEATER_0_PIN) && (HEATER_0_PIN > -1) 
589 713
     SET_OUTPUT(HEATER_0_PIN);
590 714
   #endif  
591
-  #if (HEATER_1_PIN > -1) 
715
+  #if defined(HEATER_1_PIN) && (HEATER_1_PIN > -1) 
592 716
     SET_OUTPUT(HEATER_1_PIN);
593 717
   #endif  
594
-  #if (HEATER_2_PIN > -1) 
718
+  #if defined(HEATER_2_PIN) && (HEATER_2_PIN > -1) 
595 719
     SET_OUTPUT(HEATER_2_PIN);
596 720
   #endif  
597
-  #if (HEATER_BED_PIN > -1) 
721
+  #if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1) 
598 722
     SET_OUTPUT(HEATER_BED_PIN);
599 723
   #endif  
600
-  #if (FAN_PIN > -1) 
724
+  #if defined(FAN_PIN) && (FAN_PIN > -1) 
601 725
     SET_OUTPUT(FAN_PIN);
602 726
     #ifdef FAST_PWM_FAN
603 727
     setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
604 728
     #endif
605 729
     #ifdef FAN_SOFT_PWM
606
-	soft_pwm_fan=(unsigned char)fanSpeed;
607
-	#endif
730
+    soft_pwm_fan = fanSpeedSoftPwm / 2;
731
+    #endif
608 732
   #endif  
609 733
 
610 734
   #ifdef HEATER_0_USES_MAX6675
@@ -629,28 +753,28 @@ void tp_init()
629 753
   #ifdef DIDR2
630 754
     DIDR2 = 0;
631 755
   #endif
632
-  #if (TEMP_0_PIN > -1)
756
+  #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)
633 757
     #if TEMP_0_PIN < 8
634 758
        DIDR0 |= 1 << TEMP_0_PIN; 
635 759
     #else
636 760
        DIDR2 |= 1<<(TEMP_0_PIN - 8); 
637 761
     #endif
638 762
   #endif
639
-  #if (TEMP_1_PIN > -1)
763
+  #if defined(TEMP_1_PIN) && (TEMP_1_PIN > -1)
640 764
     #if TEMP_1_PIN < 8
641 765
        DIDR0 |= 1<<TEMP_1_PIN; 
642 766
     #else
643 767
        DIDR2 |= 1<<(TEMP_1_PIN - 8); 
644 768
     #endif
645 769
   #endif
646
-  #if (TEMP_2_PIN > -1)
770
+  #if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1)
647 771
     #if TEMP_2_PIN < 8
648 772
        DIDR0 |= 1 << TEMP_2_PIN; 
649 773
     #else
650
-       DIDR2 = 1<<(TEMP_2_PIN - 8); 
774
+       DIDR2 |= 1<<(TEMP_2_PIN - 8); 
651 775
     #endif
652 776
   #endif
653
-  #if (TEMP_BED_PIN > -1)
777
+  #if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
654 778
     #if TEMP_BED_PIN < 8
655 779
        DIDR0 |= 1<<TEMP_BED_PIN; 
656 780
     #else
@@ -689,7 +813,7 @@ void tp_init()
689 813
 
690 814
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
691 815
   minttemp[1] = HEATER_1_MINTEMP;
692
-  while(analog2temp(minttemp_raw[1], 1) > HEATER_1_MINTEMP) {
816
+  while(analog2temp(minttemp_raw[1], 1) < HEATER_1_MINTEMP) {
693 817
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
694 818
     minttemp_raw[1] += OVERSAMPLENR;
695 819
 #else
@@ -710,7 +834,7 @@ void tp_init()
710 834
 
711 835
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
712 836
   minttemp[2] = HEATER_2_MINTEMP;
713
-  while(analog2temp(minttemp_raw[2], 2) > HEATER_2_MINTEMP) {
837
+  while(analog2temp(minttemp_raw[2], 2) < HEATER_2_MINTEMP) {
714 838
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
715 839
     minttemp_raw[2] += OVERSAMPLENR;
716 840
 #else
@@ -771,34 +895,34 @@ void disable_heater()
771 895
   for(int i=0;i<EXTRUDERS;i++)
772 896
     setTargetHotend(0,i);
773 897
   setTargetBed(0);
774
-  #if TEMP_0_PIN > -1
898
+  #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
775 899
   target_temperature[0]=0;
776 900
   soft_pwm[0]=0;
777
-   #if HEATER_0_PIN > -1  
901
+   #if defined(HEATER_0_PIN) && HEATER_0_PIN > -1  
778 902
      WRITE(HEATER_0_PIN,LOW);
779 903
    #endif
780 904
   #endif
781 905
      
782
-  #if TEMP_1_PIN > -1
906
+  #if defined(TEMP_1_PIN) && TEMP_1_PIN > -1
783 907
     target_temperature[1]=0;
784 908
     soft_pwm[1]=0;
785
-    #if HEATER_1_PIN > -1 
909
+    #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1 
786 910
       WRITE(HEATER_1_PIN,LOW);
787 911
     #endif
788 912
   #endif
789 913
       
790
-  #if TEMP_2_PIN > -1
914
+  #if defined(TEMP_2_PIN) && TEMP_2_PIN > -1
791 915
     target_temperature[2]=0;
792 916
     soft_pwm[2]=0;
793
-    #if HEATER_2_PIN > -1  
917
+    #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1  
794 918
       WRITE(HEATER_2_PIN,LOW);
795 919
     #endif
796 920
   #endif 
797 921
 
798
-  #if TEMP_BED_PIN > -1
922
+  #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
799 923
     target_temperature_bed=0;
800 924
     soft_pwm_bed=0;
801
-    #if HEATER_BED_PIN > -1  
925
+    #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1  
802 926
       WRITE(HEATER_BED_PIN,LOW);
803 927
     #endif
804 928
   #endif 
@@ -904,14 +1028,14 @@ int read_max6675()
904 1028
 // Timer 0 is shared with millies
905 1029
 ISR(TIMER0_COMPB_vect)
906 1030
 {
907
-  //these variables are only accesible from the ISR, but static, so they don't loose their value
1031
+  //these variables are only accesible from the ISR, but static, so they don't lose their value
908 1032
   static unsigned char temp_count = 0;
909 1033
   static unsigned long raw_temp_0_value = 0;
910 1034
   static unsigned long raw_temp_1_value = 0;
911 1035
   static unsigned long raw_temp_2_value = 0;
912 1036
   static unsigned long raw_temp_bed_value = 0;
913 1037
   static unsigned char temp_state = 0;
914
-  static unsigned char pwm_count = 1;
1038
+  static unsigned char pwm_count = (1 << SOFT_PWM_SCALE);
915 1039
   static unsigned char soft_pwm_0;
916 1040
   #if EXTRUDERS > 1
917 1041
   static unsigned char soft_pwm_1;
@@ -934,12 +1058,12 @@ ISR(TIMER0_COMPB_vect)
934 1058
     soft_pwm_2 = soft_pwm[2];
935 1059
     if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
936 1060
     #endif
937
-    #if HEATER_BED_PIN > -1
1061
+    #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
938 1062
     soft_pwm_b = soft_pwm_bed;
939 1063
     if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
940 1064
     #endif
941 1065
     #ifdef FAN_SOFT_PWM
942
-    soft_pwm_fan =(unsigned char) fanSpeed;
1066
+    soft_pwm_fan = fanSpeedSoftPwm / 2;
943 1067
     if(soft_pwm_fan > 0) WRITE(FAN_PIN,1);
944 1068
     #endif
945 1069
   }
@@ -950,19 +1074,19 @@ ISR(TIMER0_COMPB_vect)
950 1074
   #if EXTRUDERS > 2
951 1075
   if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
952 1076
   #endif
953
-  #if HEATER_BED_PIN > -1
1077
+  #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
954 1078
   if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);
955 1079
   #endif
956 1080
   #ifdef FAN_SOFT_PWM
957 1081
   if(soft_pwm_fan <= pwm_count) WRITE(FAN_PIN,0);
958 1082
   #endif
959 1083
   
960
-  pwm_count++;
1084
+  pwm_count += (1 << SOFT_PWM_SCALE);
961 1085
   pwm_count &= 0x7f;
962 1086
   
963 1087
   switch(temp_state) {
964 1088
     case 0: // Prepare TEMP_0
965
-      #if (TEMP_0_PIN > -1)
1089
+      #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)
966 1090
         #if TEMP_0_PIN > 7
967 1091
           ADCSRB = 1<<MUX5;
968 1092
         #else
@@ -975,7 +1099,7 @@ ISR(TIMER0_COMPB_vect)
975 1099
       temp_state = 1;
976 1100
       break;
977 1101
     case 1: // Measure TEMP_0
978
-      #if (TEMP_0_PIN > -1)
1102
+      #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)
979 1103
         raw_temp_0_value += ADC;
980 1104
       #endif
981 1105
       #ifdef HEATER_0_USES_MAX6675 // TODO remove the blocking
@@ -984,7 +1108,7 @@ ISR(TIMER0_COMPB_vect)
984 1108
       temp_state = 2;
985 1109
       break;
986 1110
     case 2: // Prepare TEMP_BED
987
-      #if (TEMP_BED_PIN > -1)
1111
+      #if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
988 1112
         #if TEMP_BED_PIN > 7
989 1113
           ADCSRB = 1<<MUX5;
990 1114
         #else
@@ -997,13 +1121,13 @@ ISR(TIMER0_COMPB_vect)
997 1121
       temp_state = 3;
998 1122
       break;
999 1123
     case 3: // Measure TEMP_BED
1000
-      #if (TEMP_BED_PIN > -1)
1124
+      #if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
1001 1125
         raw_temp_bed_value += ADC;
1002 1126
       #endif
1003 1127
       temp_state = 4;
1004 1128
       break;
1005 1129
     case 4: // Prepare TEMP_1
1006
-      #if (TEMP_1_PIN > -1)
1130
+      #if defined(TEMP_1_PIN) && (TEMP_1_PIN > -1)
1007 1131
         #if TEMP_1_PIN > 7
1008 1132
           ADCSRB = 1<<MUX5;
1009 1133
         #else
@@ -1016,13 +1140,13 @@ ISR(TIMER0_COMPB_vect)
1016 1140
       temp_state = 5;
1017 1141
       break;
1018 1142
     case 5: // Measure TEMP_1
1019
-      #if (TEMP_1_PIN > -1)
1143
+      #if defined(TEMP_1_PIN) && (TEMP_1_PIN > -1)
1020 1144
         raw_temp_1_value += ADC;
1021 1145
       #endif
1022 1146
       temp_state = 6;
1023 1147
       break;
1024 1148
     case 6: // Prepare TEMP_2
1025
-      #if (TEMP_2_PIN > -1)
1149
+      #if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1)
1026 1150
         #if TEMP_2_PIN > 7
1027 1151
           ADCSRB = 1<<MUX5;
1028 1152
         #else
@@ -1035,7 +1159,7 @@ ISR(TIMER0_COMPB_vect)
1035 1159
       temp_state = 7;
1036 1160
       break;
1037 1161
     case 7: // Measure TEMP_2
1038
-      #if (TEMP_2_PIN > -1)
1162
+      #if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1)
1039 1163
         raw_temp_2_value += ADC;
1040 1164
       #endif
1041 1165
       temp_state = 0;
@@ -1055,6 +1179,9 @@ ISR(TIMER0_COMPB_vect)
1055 1179
 #if EXTRUDERS > 1
1056 1180
       current_temperature_raw[1] = raw_temp_1_value;
1057 1181
 #endif
1182
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
1183
+      redundant_temperature_raw = raw_temp_1_value;
1184
+#endif
1058 1185
 #if EXTRUDERS > 2
1059 1186
       current_temperature_raw[2] = raw_temp_2_value;
1060 1187
 #endif

+ 3
- 0
Marlin/temperature.h Näytä tiedosto

@@ -37,6 +37,9 @@ extern int target_temperature[EXTRUDERS];
37 37
 extern float current_temperature[EXTRUDERS];
38 38
 extern int target_temperature_bed;
39 39
 extern float current_temperature_bed;
40
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
41
+  extern float redundant_temperature;
42
+#endif
40 43
 
41 44
 #ifdef PIDTEMP
42 45
   extern float Kp,Ki,Kd,Kc;

+ 250
- 42
Marlin/ultralcd.cpp Näytä tiedosto

@@ -8,6 +8,8 @@
8 8
 #include "stepper.h"
9 9
 #include "ConfigurationStore.h"
10 10
 
11
+int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
12
+
11 13
 /* Configuration settings */
12 14
 int plaPreheatHotendTemp;
13 15
 int plaPreheatHPBTemp;
@@ -38,6 +40,7 @@ void copy_and_scalePID_d();
38 40
 /* Different menus */
39 41
 static void lcd_status_screen();
40 42
 #ifdef ULTIPANEL
43
+extern bool powersupply;
41 44
 static void lcd_main_menu();
42 45
 static void lcd_tune_menu();
43 46
 static void lcd_prepare_menu();
@@ -47,6 +50,9 @@ static void lcd_control_temperature_menu();
47 50
 static void lcd_control_temperature_preheat_pla_settings_menu();
48 51
 static void lcd_control_temperature_preheat_abs_settings_menu();
49 52
 static void lcd_control_motion_menu();
53
+#ifdef DOGLCD
54
+static void lcd_set_contrast();
55
+#endif
50 56
 static void lcd_control_retract_menu();
51 57
 static void lcd_sdcard_menu();
52 58
 
@@ -76,7 +82,14 @@ static void menu_action_setting_edit_callback_float51(const char* pstr, float* p
76 82
 static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
77 83
 static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
78 84
 
79
-#define ENCODER_STEPS_PER_MENU_ITEM 5
85
+#define ENCODER_FEEDRATE_DEADZONE 10
86
+
87
+#if !defined(LCD_I2C_VIKI)
88
+  #define ENCODER_STEPS_PER_MENU_ITEM 5
89
+#else
90
+  #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
91
+#endif
92
+
80 93
 
81 94
 /* Helper macros for menus */
82 95
 #define START_MENU() do { \
@@ -112,14 +125,16 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
112 125
     } } while(0)
113 126
 
114 127
 /** Used variables to keep track of the menu */
128
+#ifndef REPRAPWORLD_KEYPAD
115 129
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
116
-
130
+#else
131
+volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
132
+#endif
117 133
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
118 134
 uint32_t blocking_enc;
119 135
 uint8_t lastEncoderBits;
120
-int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
121 136
 uint32_t encoderPosition;
122
-#if (SDCARDDETECT > -1)
137
+#if (SDCARDDETECT > 0)
123 138
 bool lcd_oldcardstatus;
124 139
 #endif
125 140
 #endif//ULTIPANEL
@@ -157,10 +172,34 @@ static void lcd_status_screen()
157 172
     if (LCD_CLICKED)
158 173
     {
159 174
         currentMenu = lcd_main_menu;
175
+        encoderPosition = 0;
160 176
         lcd_quick_feedback();
161 177
     }
162
-    feedmultiply += int(encoderPosition);
163
-    encoderPosition = 0;
178
+
179
+    // Dead zone at 100% feedrate
180
+    if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
181
+            (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100))
182
+    {
183
+        encoderPosition = 0;
184
+        feedmultiply = 100;
185
+    }
186
+
187
+    if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
188
+    {
189
+        feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
190
+        encoderPosition = 0;
191
+    }
192
+    else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
193
+    {
194
+        feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
195
+        encoderPosition = 0;	
196
+    }
197
+    else if (feedmultiply != 100)
198
+    {
199
+        feedmultiply += int(encoderPosition);
200
+        encoderPosition = 0;
201
+    }
202
+
164 203
     if (feedmultiply < 10)
165 204
         feedmultiply = 10;
166 205
     if (feedmultiply > 999)
@@ -221,14 +260,14 @@ static void lcd_main_menu()
221 260
         }else{
222 261
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
223 262
 #if SDCARDDETECT < 1
224
-			MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));	// SD-card changed by user
225
-#endif			
263
+            MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
264
+#endif
226 265
         }
227 266
     }else{
228 267
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
229
-#if SDCARDDETECT < 1		
230
-		MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));	// Manually initialize the SD-card via user interface
231
-#endif		
268
+#if SDCARDDETECT < 1
269
+        MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
270
+#endif
232 271
     }
233 272
 #endif
234 273
     END_MENU();
@@ -251,6 +290,7 @@ void lcd_preheat_pla()
251 290
     setTargetBed(plaPreheatHPBTemp);
252 291
     fanSpeed = plaPreheatFanSpeed;
253 292
     lcd_return_to_status();
293
+    setWatch(); // heater sanity check timer
254 294
 }
255 295
 
256 296
 void lcd_preheat_abs()
@@ -261,6 +301,16 @@ void lcd_preheat_abs()
261 301
     setTargetBed(absPreheatHPBTemp);
262 302
     fanSpeed = absPreheatFanSpeed;
263 303
     lcd_return_to_status();
304
+    setWatch(); // heater sanity check timer
305
+}
306
+
307
+static void lcd_cooldown()
308
+{
309
+    setTargetHotend0(0);
310
+    setTargetHotend1(0);
311
+    setTargetHotend2(0);
312
+    setTargetBed(0);
313
+    lcd_return_to_status();
264 314
 }
265 315
 
266 316
 static void lcd_tune_menu()
@@ -298,7 +348,15 @@ static void lcd_prepare_menu()
298 348
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
299 349
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
300 350
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
301
-    MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
351
+    MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
352
+#if PS_ON_PIN > -1
353
+    if (powersupply)
354
+    {
355
+        MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
356
+    }else{
357
+        MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
358
+    }
359
+#endif
302 360
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
303 361
     END_MENU();
304 362
 }
@@ -311,9 +369,9 @@ static void lcd_move_x()
311 369
     if (encoderPosition != 0)
312 370
     {
313 371
         current_position[X_AXIS] += float((int)encoderPosition) * move_menu_scale;
314
-        if (current_position[X_AXIS] < X_MIN_POS)
372
+        if (min_software_endstops && current_position[X_AXIS] < X_MIN_POS)
315 373
             current_position[X_AXIS] = X_MIN_POS;
316
-        if (current_position[X_AXIS] > X_MAX_POS)
374
+        if (max_software_endstops && current_position[X_AXIS] > X_MAX_POS)
317 375
             current_position[X_AXIS] = X_MAX_POS;
318 376
         encoderPosition = 0;
319 377
         plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600, active_extruder);
@@ -335,9 +393,9 @@ static void lcd_move_y()
335 393
     if (encoderPosition != 0)
336 394
     {
337 395
         current_position[Y_AXIS] += float((int)encoderPosition) * move_menu_scale;
338
-        if (current_position[Y_AXIS] < Y_MIN_POS)
396
+        if (min_software_endstops && current_position[Y_AXIS] < Y_MIN_POS)
339 397
             current_position[Y_AXIS] = Y_MIN_POS;
340
-        if (current_position[Y_AXIS] > Y_MAX_POS)
398
+        if (max_software_endstops && current_position[Y_AXIS] > Y_MAX_POS)
341 399
             current_position[Y_AXIS] = Y_MAX_POS;
342 400
         encoderPosition = 0;
343 401
         plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600, active_extruder);
@@ -359,12 +417,12 @@ static void lcd_move_z()
359 417
     if (encoderPosition != 0)
360 418
     {
361 419
         current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale;
362
-        if (current_position[Z_AXIS] < Z_MIN_POS)
420
+        if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS)
363 421
             current_position[Z_AXIS] = Z_MIN_POS;
364
-        if (current_position[Z_AXIS] > Z_MAX_POS)
422
+        if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS)
365 423
             current_position[Z_AXIS] = Z_MAX_POS;
366 424
         encoderPosition = 0;
367
-        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 60, active_extruder);
425
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
368 426
         lcdDrawUpdate = 1;
369 427
     }
370 428
     if (lcdDrawUpdate)
@@ -446,6 +504,10 @@ static void lcd_control_menu()
446 504
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
447 505
     MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
448 506
     MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
507
+#ifdef DOGLCD
508
+//    MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
509
+    MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
510
+#endif
449 511
 #ifdef FWRETRACT
450 512
     MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
451 513
 #endif
@@ -459,10 +521,12 @@ static void lcd_control_menu()
459 521
 
460 522
 static void lcd_control_temperature_menu()
461 523
 {
462
-	// set up temp variables - undo the default scaling
463
-	raw_Ki = unscalePID_i(Ki);
464
-	raw_Kd = unscalePID_d(Kd);
465
-	
524
+#ifdef PIDTEMP
525
+    // set up temp variables - undo the default scaling
526
+    raw_Ki = unscalePID_i(Ki);
527
+    raw_Kd = unscalePID_d(Kd);
528
+#endif
529
+
466 530
     START_MENU();
467 531
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
468 532
     MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
@@ -484,7 +548,7 @@ static void lcd_control_temperature_menu()
484 548
 #endif
485 549
 #ifdef PIDTEMP
486 550
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
487
-	// i is typically a small value so allows values below 1
551
+    // i is typically a small value so allows values below 1
488 552
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
489 553
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
490 554
 # ifdef PID_ADD_EXTRUSION_RATE
@@ -555,6 +619,31 @@ static void lcd_control_motion_menu()
555 619
     END_MENU();
556 620
 }
557 621
 
622
+#ifdef DOGLCD
623
+static void lcd_set_contrast()
624
+{
625
+    if (encoderPosition != 0)
626
+    {
627
+        lcd_contrast -= encoderPosition;
628
+        if (lcd_contrast < 0) lcd_contrast = 0;
629
+        else if (lcd_contrast > 63) lcd_contrast = 63;
630
+        encoderPosition = 0;
631
+        lcdDrawUpdate = 1;
632
+        u8g.setContrast(lcd_contrast);
633
+    }
634
+    if (lcdDrawUpdate)
635
+    {
636
+        lcd_implementation_drawedit(PSTR("Contrast"), itostr2(lcd_contrast));
637
+    }
638
+    if (LCD_CLICKED)
639
+    {
640
+        lcd_quick_feedback();
641
+        currentMenu = lcd_control_menu;
642
+        encoderPosition = 0;
643
+    }
644
+}
645
+#endif
646
+
558 647
 #ifdef FWRETRACT
559 648
 static void lcd_control_retract_menu()
560 649
 {
@@ -687,6 +776,42 @@ menu_edit_type(float, float51, ftostr51, 10)
687 776
 menu_edit_type(float, float52, ftostr52, 100)
688 777
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
689 778
 
779
+#ifdef REPRAPWORLD_KEYPAD
780
+	static void reprapworld_keypad_move_z_up() {
781
+    encoderPosition = 1;
782
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
783
+		lcd_move_z();
784
+  }
785
+	static void reprapworld_keypad_move_z_down() {
786
+    encoderPosition = -1;
787
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
788
+		lcd_move_z();
789
+  }
790
+	static void reprapworld_keypad_move_x_left() {
791
+    encoderPosition = -1;
792
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
793
+		lcd_move_x();
794
+  }
795
+	static void reprapworld_keypad_move_x_right() {
796
+    encoderPosition = 1;
797
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
798
+		lcd_move_x();
799
+	}
800
+	static void reprapworld_keypad_move_y_down() {
801
+    encoderPosition = 1;
802
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
803
+		lcd_move_y();
804
+	}
805
+	static void reprapworld_keypad_move_y_up() {
806
+		encoderPosition = -1;
807
+		move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
808
+    lcd_move_y();
809
+	}
810
+	static void reprapworld_keypad_move_home() {
811
+		enquecommand_P((PSTR("G28"))); // move all axis home
812
+	}
813
+#endif
814
+
690 815
 /** End of menus **/
691 816
 
692 817
 static void lcd_quick_feedback()
@@ -745,11 +870,20 @@ void lcd_init()
745 870
 #ifdef NEWPANEL
746 871
     pinMode(BTN_EN1,INPUT);
747 872
     pinMode(BTN_EN2,INPUT); 
748
-    pinMode(BTN_ENC,INPUT); 
749 873
     pinMode(SDCARDDETECT,INPUT);
750 874
     WRITE(BTN_EN1,HIGH);
751 875
     WRITE(BTN_EN2,HIGH);
876
+  #if BTN_ENC > 0
877
+    pinMode(BTN_ENC,INPUT); 
752 878
     WRITE(BTN_ENC,HIGH);
879
+  #endif    
880
+  #ifdef REPRAPWORLD_KEYPAD
881
+    pinMode(SHIFT_CLK,OUTPUT);
882
+    pinMode(SHIFT_LD,OUTPUT);
883
+    pinMode(SHIFT_OUT,INPUT);
884
+    WRITE(SHIFT_OUT,HIGH);
885
+    WRITE(SHIFT_LD,HIGH);
886
+  #endif
753 887
 #else
754 888
     pinMode(SHIFT_CLK,OUTPUT);
755 889
     pinMode(SHIFT_LD,OUTPUT);
@@ -759,12 +893,14 @@ void lcd_init()
759 893
     WRITE(SHIFT_LD,HIGH); 
760 894
     WRITE(SHIFT_EN,LOW);
761 895
 #endif//!NEWPANEL
762
-#if (SDCARDDETECT > -1)
896
+#if (SDCARDDETECT > 0)
763 897
     WRITE(SDCARDDETECT, HIGH);
764 898
     lcd_oldcardstatus = IS_SD_INSERTED;
765
-#endif//(SDCARDDETECT > -1)
899
+#endif//(SDCARDDETECT > 0)
766 900
     lcd_buttons_update();
901
+#ifdef ULTIPANEL    
767 902
     encoderDiff = 0;
903
+#endif    
768 904
 }
769 905
 
770 906
 void lcd_update()
@@ -773,7 +909,11 @@ void lcd_update()
773 909
     
774 910
     lcd_buttons_update();
775 911
     
776
-    #if (SDCARDDETECT > -1)
912
+    #ifdef LCD_HAS_SLOW_BUTTONS
913
+    buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
914
+    #endif
915
+    
916
+    #if (SDCARDDETECT > 0)
777 917
     if((IS_SD_INSERTED != lcd_oldcardstatus))
778 918
     {
779 919
         lcdDrawUpdate = 2;
@@ -796,6 +936,29 @@ void lcd_update()
796 936
     if (lcd_next_update_millis < millis())
797 937
     {
798 938
 #ifdef ULTIPANEL
939
+		#ifdef REPRAPWORLD_KEYPAD
940
+        	if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) {
941
+        		reprapworld_keypad_move_z_up();
942
+        	}
943
+        	if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) {
944
+        		reprapworld_keypad_move_z_down();
945
+        	}
946
+        	if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) {
947
+        		reprapworld_keypad_move_x_left();
948
+        	}
949
+        	if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) {
950
+        		reprapworld_keypad_move_x_right();
951
+        	}
952
+        	if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
953
+        		reprapworld_keypad_move_y_down();
954
+        	}
955
+        	if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
956
+        		reprapworld_keypad_move_y_up();
957
+        	}
958
+        	if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
959
+        		reprapworld_keypad_move_home();
960
+        	}
961
+		#endif
799 962
         if (encoderDiff)
800 963
         {
801 964
             lcdDrawUpdate = 1;
@@ -808,21 +971,26 @@ void lcd_update()
808 971
 #endif//ULTIPANEL
809 972
 
810 973
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
811
-		blink++;	   // Variable for fan animation and alive dot
812
-		u8g.firstPage();
813
-		do {
814
-				u8g.setFont(u8g_font_6x10_marlin);
815
-				u8g.setPrintPos(125,0);
816
-				if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
817
-				u8g.drawPixel(127,63);	// draw alive dot
818
-				u8g.setColorIndex(1);	// black on white
819
-				(*currentMenu)();
820
-				if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
821
-		   } while( u8g.nextPage() );
974
+        blink++;     // Variable for fan animation and alive dot
975
+        u8g.firstPage();
976
+        do 
977
+        {
978
+            u8g.setFont(u8g_font_6x10_marlin);
979
+            u8g.setPrintPos(125,0);
980
+            if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
981
+            u8g.drawPixel(127,63); // draw alive dot
982
+            u8g.setColorIndex(1); // black on white
983
+            (*currentMenu)();
984
+            if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
985
+        } while( u8g.nextPage() );
822 986
 #else        
823 987
         (*currentMenu)();
824 988
 #endif
825 989
 
990
+#ifdef LCD_HAS_STATUS_INDICATORS
991
+        lcd_implementation_update_indicators();
992
+#endif
993
+
826 994
 #ifdef ULTIPANEL
827 995
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
828 996
         {
@@ -865,6 +1033,14 @@ void lcd_reset_alert_level()
865 1033
     lcd_status_message_level = 0;
866 1034
 }
867 1035
 
1036
+#ifdef DOGLCD
1037
+void lcd_setcontrast(uint8_t value)
1038
+{
1039
+    lcd_contrast = value & 63;
1040
+    u8g.setContrast(lcd_contrast);	
1041
+}
1042
+#endif
1043
+
868 1044
 #ifdef ULTIPANEL
869 1045
 /* Warning: This function is called from interrupt context */
870 1046
 void lcd_buttons_update()
@@ -873,9 +1049,25 @@ void lcd_buttons_update()
873 1049
     uint8_t newbutton=0;
874 1050
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
875 1051
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
1052
+  #if BTN_ENC > 0
876 1053
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
877 1054
         newbutton |= EN_C;
1055
+  #endif
878 1056
     buttons = newbutton;
1057
+    #ifdef REPRAPWORLD_KEYPAD
1058
+      // for the reprapworld_keypad
1059
+      uint8_t newbutton_reprapworld_keypad=0;
1060
+      WRITE(SHIFT_LD,LOW);
1061
+      WRITE(SHIFT_LD,HIGH);
1062
+      for(int8_t i=0;i<8;i++) {
1063
+          newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
1064
+          if(READ(SHIFT_OUT))
1065
+              newbutton_reprapworld_keypad|=(1<<7);
1066
+          WRITE(SHIFT_CLK,HIGH);
1067
+          WRITE(SHIFT_CLK,LOW);
1068
+      }
1069
+      buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
1070
+	#endif
879 1071
 #else   //read it from the shift register
880 1072
     uint8_t newbutton=0;
881 1073
     WRITE(SHIFT_LD,LOW);
@@ -930,6 +1122,18 @@ void lcd_buttons_update()
930 1122
     }
931 1123
     lastEncoderBits = enc;
932 1124
 }
1125
+
1126
+void lcd_buzz(long duration, uint16_t freq)
1127
+{ 
1128
+#ifdef LCD_USE_I2C_BUZZER
1129
+  lcd.buzz(duration,freq);
1130
+#endif   
1131
+}
1132
+
1133
+bool lcd_clicked() 
1134
+{ 
1135
+  return LCD_CLICKED;
1136
+}
933 1137
 #endif//ULTIPANEL
934 1138
 
935 1139
 /********************************/
@@ -1129,16 +1333,20 @@ char *ftostr52(const float &x)
1129 1333
 // grab the pid i value out of the temp variable; scale it; then update the PID driver
1130 1334
 void copy_and_scalePID_i()
1131 1335
 {
1336
+#ifdef PIDTEMP
1132 1337
   Ki = scalePID_i(raw_Ki);
1133 1338
   updatePID();
1134
-}	
1339
+#endif
1340
+}
1135 1341
 
1136 1342
 // Callback for after editing PID d value
1137 1343
 // grab the pid d value out of the temp variable; scale it; then update the PID driver
1138 1344
 void copy_and_scalePID_d()
1139 1345
 {
1346
+#ifdef PIDTEMP
1140 1347
   Kd = scalePID_d(raw_Kd);
1141 1348
   updatePID();
1142
-}	
1143
-	
1349
+#endif
1350
+}
1351
+
1144 1352
 #endif //ULTRA_LCD

+ 32
- 1
Marlin/ultralcd.h Näytä tiedosto

@@ -11,7 +11,12 @@
11 11
   void lcd_setstatuspgm(const char* message);
12 12
   void lcd_setalertstatuspgm(const char* message);
13 13
   void lcd_reset_alert_level();
14
-  
14
+
15
+#ifdef DOGLCD
16
+  extern int lcd_contrast;
17
+  void lcd_setcontrast(uint8_t value);
18
+#endif
19
+
15 20
   static unsigned char blink = 0;	// Variable for visualisation of fan rotation in GLCD
16 21
 
17 22
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
@@ -23,6 +28,9 @@
23 28
   #ifdef ULTIPANEL
24 29
   void lcd_buttons_update();
25 30
   extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
31
+  #ifdef REPRAPWORLD_KEYPAD
32
+    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shiftregister values
33
+  #endif
26 34
   #else
27 35
   FORCE_INLINE void lcd_buttons_update() {}
28 36
   #endif
@@ -35,12 +43,34 @@
35 43
   extern int absPreheatHPBTemp;
36 44
   extern int absPreheatFanSpeed;
37 45
     
46
+  void lcd_buzz(long duration,uint16_t freq);
47
+  bool lcd_clicked();
48
+
38 49
   #ifdef NEWPANEL
39 50
     #define EN_C (1<<BLEN_C)
40 51
     #define EN_B (1<<BLEN_B)
41 52
     #define EN_A (1<<BLEN_A)
42 53
 
43 54
     #define LCD_CLICKED (buttons&EN_C)
55
+    #ifdef REPRAPWORLD_KEYPAD
56
+  	  #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
57
+  	  #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
58
+  	  #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
59
+  	  #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
60
+  	  #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
61
+  	  #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
62
+  	  #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
63
+  	  #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
64
+
65
+  	  #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
66
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
67
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
68
+  	  #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
69
+  	  #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
70
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
71
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
72
+  	  #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
73
+    #endif //REPRAPWORLD_KEYPAD
44 74
   #else
45 75
     //atomatic, do not change
46 76
     #define B_LE (1<<BL_LE)
@@ -61,6 +91,7 @@
61 91
   FORCE_INLINE void lcd_setstatus(const char* message) {}
62 92
   FORCE_INLINE void lcd_buttons_update() {}
63 93
   FORCE_INLINE void lcd_reset_alert_level() {}
94
+  FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
64 95
 
65 96
   #define LCD_MESSAGEPGM(x) 
66 97
   #define LCD_ALERTMESSAGEPGM(x) 

+ 268
- 26
Marlin/ultralcd_implementation_hitachi_HD44780.h Näytä tiedosto

@@ -6,12 +6,196 @@
6 6
 * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
7 7
 **/
8 8
 
9
-#if LANGUAGE_CHOICE == 6
10
-#include "LiquidCrystalRus.h"
11
-#define LCD_CLASS LiquidCrystalRus
9
+#ifndef REPRAPWORLD_KEYPAD
10
+extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
12 11
 #else
13
-#include <LiquidCrystal.h>
14
-#define LCD_CLASS LiquidCrystal
12
+extern volatile uint16_t buttons;  //an extended version of the last checked buttons in a bit array.
13
+#endif
14
+
15
+////////////////////////////////////
16
+// Setup button and encode mappings for each panel (into 'buttons' variable
17
+//
18
+// This is just to map common functions (across different panels) onto the same 
19
+// macro name. The mapping is independent of whether the button is directly connected or 
20
+// via a shift/i2c register.
21
+
22
+#ifdef ULTIPANEL
23
+// All Ultipanels might have an encoder - so this is always be mapped onto first two bits
24
+#define BLEN_B 1
25
+#define BLEN_A 0
26
+
27
+#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
28
+#define EN_A (1<<BLEN_A)
29
+
30
+#if defined(BTN_ENC) && BTN_ENC > -1
31
+  // encoder click is directly connected
32
+  #define BLEN_C 2 
33
+  #define EN_C (1<<BLEN_C) 
34
+#endif 
35
+  
36
+//
37
+// Setup other button mappings of each panel
38
+//
39
+#if defined(LCD_I2C_VIKI)
40
+  #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
41
+  
42
+  // button and encoder bit positions within 'buttons'
43
+  #define B_LE (BUTTON_LEFT<<B_I2C_BTN_OFFSET)    // The remaining normalized buttons are all read via I2C
44
+  #define B_UP (BUTTON_UP<<B_I2C_BTN_OFFSET)
45
+  #define B_MI (BUTTON_SELECT<<B_I2C_BTN_OFFSET)
46
+  #define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
47
+  #define B_RI (BUTTON_RIGHT<<B_I2C_BTN_OFFSET)
48
+
49
+  #if defined(BTN_ENC) && BTN_ENC > -1 
50
+    // the pause/stop/restart button is connected to BTN_ENC when used
51
+    #define B_ST (EN_C)                            // Map the pause/stop/resume button into its normalized functional name 
52
+    #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
53
+  #else
54
+    #define LCD_CLICKED (buttons&(B_MI|B_RI))
55
+  #endif  
56
+
57
+  // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
58
+  #define LCD_HAS_SLOW_BUTTONS
59
+
60
+#elif defined(LCD_I2C_PANELOLU2)
61
+  // encoder click can be read through I2C if not directly connected
62
+  #if BTN_ENC <= 0 
63
+    #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
64
+  
65
+    #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
66
+
67
+    #define LCD_CLICKED (buttons&B_MI)
68
+
69
+    // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
70
+    #define LCD_HAS_SLOW_BUTTONS
71
+  #else
72
+    #define LCD_CLICKED (buttons&EN_C)  
73
+  #endif
74
+
75
+#elif defined(REPRAPWORLD_KEYPAD)
76
+    // define register bit values, don't change it
77
+    #define BLEN_REPRAPWORLD_KEYPAD_F3 0
78
+    #define BLEN_REPRAPWORLD_KEYPAD_F2 1
79
+    #define BLEN_REPRAPWORLD_KEYPAD_F1 2
80
+    #define BLEN_REPRAPWORLD_KEYPAD_UP 3
81
+    #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
82
+    #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
83
+    #define BLEN_REPRAPWORLD_KEYPAD_DOWN 6
84
+    #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
85
+    
86
+    #define REPRAPWORLD_BTN_OFFSET 3 // bit offset into buttons for shift register values
87
+
88
+    #define EN_REPRAPWORLD_KEYPAD_F3 (1<<(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
89
+    #define EN_REPRAPWORLD_KEYPAD_F2 (1<<(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
90
+    #define EN_REPRAPWORLD_KEYPAD_F1 (1<<(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
91
+    #define EN_REPRAPWORLD_KEYPAD_UP (1<<(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
92
+    #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
93
+    #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
94
+    #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
95
+    #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
96
+
97
+    #define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
98
+    #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
99
+    #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
100
+    #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
101
+
102
+#elif defined(NEWPANEL)
103
+  #define LCD_CLICKED (buttons&EN_C)
104
+  
105
+#else // old style ULTIPANEL
106
+  //bits in the shift register that carry the buttons for:
107
+  // left up center down right red(stop)
108
+  #define BL_LE 7
109
+  #define BL_UP 6
110
+  #define BL_MI 5
111
+  #define BL_DW 4
112
+  #define BL_RI 3
113
+  #define BL_ST 2
114
+
115
+  //automatic, do not change
116
+  #define B_LE (1<<BL_LE)
117
+  #define B_UP (1<<BL_UP)
118
+  #define B_MI (1<<BL_MI)
119
+  #define B_DW (1<<BL_DW)
120
+  #define B_RI (1<<BL_RI)
121
+  #define B_ST (1<<BL_ST)
122
+  
123
+  #define LCD_CLICKED (buttons&(B_MI|B_ST))
124
+#endif
125
+
126
+////////////////////////
127
+// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
128
+// These values are independent of which pins are used for EN_A and EN_B indications
129
+// The rotary encoder part is also independent to the chipset used for the LCD
130
+#if defined(EN_A) && defined(EN_B)
131
+  #ifndef ULTIMAKERCONTROLLER
132
+    #define encrot0 0
133
+    #define encrot1 2
134
+    #define encrot2 3
135
+    #define encrot3 1
136
+  #else
137
+    #define encrot0 0
138
+    #define encrot1 1
139
+    #define encrot2 3
140
+    #define encrot3 2
141
+  #endif
142
+#endif 
143
+
144
+#endif //ULTIPANEL
145
+
146
+////////////////////////////////////
147
+// Create LCD class instance and chipset-specific information
148
+#if defined(LCD_I2C_TYPE_PCF8575)
149
+  // note: these are register mapped pins on the PCF8575 controller not Arduino pins
150
+  #define LCD_I2C_PIN_BL  3
151
+  #define LCD_I2C_PIN_EN  2
152
+  #define LCD_I2C_PIN_RW  1
153
+  #define LCD_I2C_PIN_RS  0
154
+  #define LCD_I2C_PIN_D4  4
155
+  #define LCD_I2C_PIN_D5  5
156
+  #define LCD_I2C_PIN_D6  6
157
+  #define LCD_I2C_PIN_D7  7
158
+
159
+  #include <Wire.h>
160
+  #include <LCD.h>
161
+  #include <LiquidCrystal_I2C.h>
162
+  #define LCD_CLASS LiquidCrystal_I2C
163
+  LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
164
+  
165
+#elif defined(LCD_I2C_TYPE_MCP23017)
166
+  //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
167
+  #define LED_A 0x04 //100
168
+  #define LED_B 0x02 //010
169
+  #define LED_C 0x01 //001
170
+
171
+  #define LCD_HAS_STATUS_INDICATORS
172
+
173
+  #include <Wire.h>
174
+  #include <LiquidTWI2.h>
175
+  #define LCD_CLASS LiquidTWI2
176
+  LCD_CLASS lcd(LCD_I2C_ADDRESS);
177
+  
178
+#elif defined(LCD_I2C_TYPE_MCP23008)
179
+  #include <Wire.h>
180
+  #include <LiquidTWI2.h>
181
+  #define LCD_CLASS LiquidTWI2
182
+  LCD_CLASS lcd(LCD_I2C_ADDRESS);  
183
+
184
+#elif defined(LCD_I2C_TYPE_PCA8574)
185
+    #include <LiquidCrystal_I2C.h>
186
+    #define LCD_CLASS LiquidCrystal_I2C
187
+    LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
188
+  
189
+#else
190
+  // Standard directly connected LCD implementations
191
+  #if LANGUAGE_CHOICE == 6
192
+    #include "LiquidCrystalRus.h"
193
+    #define LCD_CLASS LiquidCrystalRus
194
+  #else 
195
+    #include <LiquidCrystal.h>
196
+    #define LCD_CLASS LiquidCrystal
197
+  #endif  
198
+  LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
15 199
 #endif
16 200
 
17 201
 /* Custom characters defined in the first 8 characters of the LCD */
@@ -25,7 +209,6 @@
25 209
 #define LCD_STR_CLOCK       "\x07"
26 210
 #define LCD_STR_ARROW_RIGHT "\x7E"  /* from the default character set */
27 211
 
28
-LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
29 212
 static void lcd_implementation_init()
30 213
 {
31 214
     byte bedTemp[8] =
@@ -111,7 +294,31 @@ static void lcd_implementation_init()
111 294
         B00000,
112 295
         B00000
113 296
     }; //thanks Sonny Mounicou
297
+
298
+#if defined(LCDI2C_TYPE_PCF8575)
299
+    lcd.begin(LCD_WIDTH, LCD_HEIGHT);
300
+  #ifdef LCD_I2C_PIN_BL
301
+    lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
302
+    lcd.setBacklight(HIGH);
303
+  #endif
304
+  
305
+#elif defined(LCD_I2C_TYPE_MCP23017)
306
+    lcd.setMCPType(LTI_TYPE_MCP23017);
307
+    lcd.begin(LCD_WIDTH, LCD_HEIGHT);
308
+    lcd.setBacklight(0); //set all the LEDs off to begin with
309
+    
310
+#elif defined(LCD_I2C_TYPE_MCP23008)
311
+    lcd.setMCPType(LTI_TYPE_MCP23008);
114 312
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
313
+
314
+#elif defined(LCD_I2C_TYPE_PCA8574)
315
+      lcd.init();
316
+      lcd.backlight();
317
+    
318
+#else
319
+    lcd.begin(LCD_WIDTH, LCD_HEIGHT);
320
+#endif
321
+
115 322
     lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
116 323
     lcd.createChar(LCD_STR_DEGREE[0], degree);
117 324
     lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
@@ -299,13 +506,13 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
299 506
     char c;
300 507
     //Use all characters in narrow LCDs
301 508
   #if LCD_WIDTH < 20
302
-    	uint8_t n = LCD_WIDTH - 1 - 1;
509
+      uint8_t n = LCD_WIDTH - 1 - 1;
303 510
     #else
304
-    	uint8_t n = LCD_WIDTH - 1 - 2;
511
+      uint8_t n = LCD_WIDTH - 1 - 2;
305 512
   #endif
306 513
     lcd.setCursor(0, row);
307 514
     lcd.print(pre_char);
308
-    while((c = pgm_read_byte(pstr)) != '\0')
515
+    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
309 516
     {
310 517
         lcd.print(c);
311 518
         pstr++;
@@ -321,13 +528,13 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
321 528
     char c;
322 529
     //Use all characters in narrow LCDs
323 530
   #if LCD_WIDTH < 20
324
-    	uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
531
+      uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
325 532
     #else
326
-    	uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
533
+      uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
327 534
   #endif
328 535
     lcd.setCursor(0, row);
329 536
     lcd.print(pre_char);
330
-    while((c = pgm_read_byte(pstr)) != '\0')
537
+    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
331 538
     {
332 539
         lcd.print(c);
333 540
         pstr++;
@@ -343,13 +550,13 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
343 550
     char c;
344 551
     //Use all characters in narrow LCDs
345 552
   #if LCD_WIDTH < 20
346
-    	uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
553
+      uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
347 554
     #else
348
-    	uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
555
+      uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
349 556
   #endif
350 557
     lcd.setCursor(0, row);
351 558
     lcd.print(pre_char);
352
-    while((c = pgm_read_byte(pstr)) != '\0')
559
+    while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) )
353 560
     {
354 561
         lcd.print(c);
355 562
         pstr++;
@@ -402,9 +609,9 @@ void lcd_implementation_drawedit(const char* pstr, char* value)
402 609
     lcd_printPGM(pstr);
403 610
     lcd.print(':');
404 611
    #if LCD_WIDTH < 20
405
-    	lcd.setCursor(LCD_WIDTH - strlen(value), 1);
612
+      lcd.setCursor(LCD_WIDTH - strlen(value), 1);
406 613
     #else
407
-    	lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
614
+      lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
408 615
    #endif
409 616
     lcd.print(value);
410 617
 }
@@ -419,7 +626,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
419 626
         filename = longFilename;
420 627
         longFilename[LCD_WIDTH-1] = '\0';
421 628
     }
422
-    while((c = *filename) != '\0')
629
+    while( ((c = *filename) != '\0') && (n>0) )
423 630
     {
424 631
         lcd.print(c);
425 632
         filename++;
@@ -439,7 +646,7 @@ static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, co
439 646
         filename = longFilename;
440 647
         longFilename[LCD_WIDTH-1] = '\0';
441 648
     }
442
-    while((c = *filename) != '\0')
649
+    while( ((c = *filename) != '\0') && (n>0) )
443 650
     {
444 651
         lcd.print(c);
445 652
         filename++;
@@ -460,7 +667,7 @@ static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const
460 667
         filename = longFilename;
461 668
         longFilename[LCD_WIDTH-2] = '\0';
462 669
     }
463
-    while((c = *filename) != '\0')
670
+    while( ((c = *filename) != '\0') && (n>0) )
464 671
     {
465 672
         lcd.print(c);
466 673
         filename++;
@@ -481,7 +688,7 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
481 688
         filename = longFilename;
482 689
         longFilename[LCD_WIDTH-2] = '\0';
483 690
     }
484
-    while((c = *filename) != '\0')
691
+    while( ((c = *filename) != '\0') && (n>0) )
485 692
     {
486 693
         lcd.print(c);
487 694
         filename++;
@@ -501,15 +708,50 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
501 708
 
502 709
 static void lcd_implementation_quick_feedback()
503 710
 {
504
-#if BEEPER > -1
711
+#ifdef LCD_USE_I2C_BUZZER
712
+    lcd.buzz(60,1000/6);
713
+#elif defined(BEEPER) && BEEPER > -1
505 714
     SET_OUTPUT(BEEPER);
506 715
     for(int8_t i=0;i<10;i++)
507 716
     {
508
-		WRITE(BEEPER,HIGH);
509
-		delay(3);
510
-		WRITE(BEEPER,LOW);
511
-		delay(3);
717
+      WRITE(BEEPER,HIGH);
718
+      delayMicroseconds(100);
719
+      WRITE(BEEPER,LOW);
720
+      delayMicroseconds(100);
512 721
     }
513 722
 #endif
514 723
 }
724
+
725
+#ifdef LCD_HAS_STATUS_INDICATORS
726
+static void lcd_implementation_update_indicators()
727
+{
728
+  #if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI)
729
+    //set the LEDS - referred to as backlights by the LiquidTWI2 library 
730
+    static uint8_t ledsprev = 0;
731
+    uint8_t leds = 0;
732
+    if (target_temperature_bed > 0) leds |= LED_A;
733
+    if (target_temperature[0] > 0) leds |= LED_B;
734
+    if (fanSpeed) leds |= LED_C;
735
+    #if EXTRUDERS > 1  
736
+      if (target_temperature[1] > 0) leds |= LED_C;
737
+    #endif
738
+    if (leds != ledsprev) {
739
+      lcd.setBacklight(leds);
740
+      ledsprev = leds;
741
+    }
742
+  #endif
743
+}
744
+#endif
745
+
746
+#ifdef LCD_HAS_SLOW_BUTTONS
747
+static uint8_t lcd_implementation_read_slow_buttons()
748
+{
749
+  #ifdef LCD_I2C_TYPE_MCP23017
750
+    // Reading these buttons this is likely to be too slow to call inside interrupt context
751
+    // so they are called during normal lcd_update
752
+    return lcd.readButtons() << B_I2C_BTN_OFFSET; 
753
+  #endif
754
+}
755
+#endif
756
+
515 757
 #endif//ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H

+ 131
- 0
Marlin/ultralcd_st7920_u8glib_rrd.h Näytä tiedosto

@@ -0,0 +1,131 @@
1
+#ifndef ULCDST7920_H
2
+#define ULCDST7920_H
3
+
4
+#include "Marlin.h"
5
+
6
+#ifdef U8GLIB_ST7920
7
+
8
+//set optimization so ARDUINO optimizes this file
9
+#pragma GCC optimize (3)
10
+
11
+#define ST7920_CLK_PIN  LCD_PINS_D4
12
+#define ST7920_DAT_PIN  LCD_PINS_ENABLE
13
+#define ST7920_CS_PIN   LCD_PINS_RS
14
+
15
+//#define PAGE_HEIGHT 8   //128 byte frambuffer
16
+//#define PAGE_HEIGHT 16  //256 byte frambuffer
17
+#define PAGE_HEIGHT 32  //512 byte framebuffer
18
+
19
+#define WIDTH 128
20
+#define HEIGHT 64
21
+
22
+#include <U8glib.h>
23
+
24
+static void ST7920_SWSPI_SND_8BIT(uint8_t val)
25
+{
26
+  uint8_t i;
27
+  for( i=0; i<8; i++ )
28
+  {
29
+    WRITE(ST7920_CLK_PIN,0);
30
+    WRITE(ST7920_DAT_PIN,val&0x80); 
31
+    val<<=1;
32
+    WRITE(ST7920_CLK_PIN,1);
33
+  }
34
+}
35
+
36
+#define ST7920_CS()              {WRITE(ST7920_CS_PIN,1);u8g_10MicroDelay();}
37
+#define ST7920_NCS()             {WRITE(ST7920_CS_PIN,0);}
38
+#define ST7920_SET_CMD()         {ST7920_SWSPI_SND_8BIT(0xf8);u8g_10MicroDelay();}
39
+#define ST7920_SET_DAT()         {ST7920_SWSPI_SND_8BIT(0xfa);u8g_10MicroDelay();}
40
+#define ST7920_WRITE_BYTE(a)     {ST7920_SWSPI_SND_8BIT((a)&0xf0);ST7920_SWSPI_SND_8BIT((a)<<4);u8g_10MicroDelay();}
41
+#define ST7920_WRITE_BYTES(p,l)  {uint8_t i;for(i=0;i<l;i++){ST7920_SWSPI_SND_8BIT(*p&0xf0);ST7920_SWSPI_SND_8BIT(*p<<4);p++;}u8g_10MicroDelay();}
42
+
43
+uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
44
+{
45
+  uint8_t i,y;
46
+  switch(msg)
47
+  {
48
+    case U8G_DEV_MSG_INIT:
49
+      {
50
+        SET_OUTPUT(ST7920_CS_PIN);
51
+        WRITE(ST7920_CS_PIN,0);
52
+        SET_OUTPUT(ST7920_DAT_PIN);
53
+        WRITE(ST7920_DAT_PIN,0);
54
+        SET_OUTPUT(ST7920_CLK_PIN);
55
+        WRITE(ST7920_CLK_PIN,1);
56
+
57
+        ST7920_CS();
58
+        u8g_Delay(90);                 //initial delay for boot up
59
+        ST7920_SET_CMD();
60
+        ST7920_WRITE_BYTE(0x08);       //display off, cursor+blink off
61
+        ST7920_WRITE_BYTE(0x01);       //clear CGRAM ram
62
+        u8g_Delay(10);                 //delay for cgram clear
63
+        ST7920_WRITE_BYTE(0x3E);       //extended mode + gdram active
64
+        for(y=0;y<HEIGHT/2;y++)        //clear GDRAM
65
+        {
66
+          ST7920_WRITE_BYTE(0x80|y);   //set y
67
+          ST7920_WRITE_BYTE(0x80);     //set x = 0
68
+          ST7920_SET_DAT();
69
+          for(i=0;i<2*WIDTH/8;i++)     //2x width clears both segments
70
+            ST7920_WRITE_BYTE(0);
71
+          ST7920_SET_CMD();
72
+        }
73
+        ST7920_WRITE_BYTE(0x0C); //display on, cursor+blink off
74
+        ST7920_NCS();
75
+      }
76
+      break;
77
+
78
+    case U8G_DEV_MSG_STOP:
79
+      break;
80
+    case U8G_DEV_MSG_PAGE_NEXT:
81
+      {
82
+        uint8_t *ptr;
83
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
84
+        y = pb->p.page_y0;
85
+        ptr = (uint8_t*)pb->buf;
86
+
87
+        ST7920_CS();
88
+        for( i = 0; i < PAGE_HEIGHT; i ++ )
89
+        {
90
+          ST7920_SET_CMD();
91
+          if ( y < 32 )
92
+          {
93
+            ST7920_WRITE_BYTE(0x80 | y);       //y
94
+            ST7920_WRITE_BYTE(0x80);           //x=0
95
+          }
96
+          else
97
+          {
98
+            ST7920_WRITE_BYTE(0x80 | (y-32));  //y
99
+            ST7920_WRITE_BYTE(0x80 | 8);       //x=64
100
+          }
101
+
102
+          ST7920_SET_DAT();
103
+          ST7920_WRITE_BYTES(ptr,WIDTH/8); //ptr is incremented inside of macro
104
+          y++;
105
+        }
106
+        ST7920_NCS();
107
+      }
108
+      break;
109
+  }
110
+#if PAGE_HEIGHT == 8
111
+  return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
112
+#elif PAGE_HEIGHT == 16
113
+  return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg);
114
+#else
115
+  return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg);
116
+#endif
117
+}
118
+
119
+uint8_t   u8g_dev_st7920_128x64_rrd_buf[WIDTH*(PAGE_HEIGHT/8)] U8G_NOCOMMON;
120
+u8g_pb_t  u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT,HEIGHT,0,0,0},WIDTH,u8g_dev_st7920_128x64_rrd_buf};
121
+u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn,&u8g_dev_st7920_128x64_rrd_pb,&u8g_com_null_fn};
122
+
123
+class U8GLIB_ST7920_128X64_RRD : public U8GLIB
124
+{
125
+  public:
126
+    U8GLIB_ST7920_128X64_RRD(uint8_t dummy) : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi) {}
127
+};
128
+
129
+
130
+#endif //U8GLIB_ST7920
131
+#endif //ULCDST7920_H

+ 109
- 80
README.md Näytä tiedosto

@@ -1,12 +1,8 @@
1
-WARNING: 
2
---------
3
-THIS IS RELEASE CANDIDATE 2 FOR MARLIN 1.0.0
1
+==========================
2
+Marlin 3D Printer Firmware
3
+==========================
4 4
 
5
-The configuration is now split in two files
6
-Configuration.h for the normal settings
7
-Configuration_adv.h for the advanced settings
8
-
9
-Gen7T is not supported.
5
+[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/ErikZalm/Marlin&title=Marlin&language=&tags=github&category=software)
10 6
 
11 7
 Quick Information
12 8
 ===================
@@ -26,14 +22,14 @@ Features:
26 22
 *   High steprate
27 23
 *   Look ahead (Keep the speed high when possible. High cornering speed)
28 24
 *   Interrupt based temperature protection
29
-*   preliminary support for Matthew Roberts advance algorithm 
25
+*   preliminary support for Matthew Roberts advance algorithm
30 26
     For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
31 27
 *   Full endstop support
32 28
 *   SD Card support
33 29
 *   SD Card folders (works in pronterface)
34 30
 *   SD Card autostart support
35
-*   LCD support (ideally 20x4) 
36
-*   LCD menu system for autonomous SD card printing, controlled by an click-encoder. 
31
+*   LCD support (ideally 20x4)
32
+*   LCD menu system for autonomous SD card printing, controlled by an click-encoder.
37 33
 *   EEPROM storage of e.g. max-velocity, max-acceleration, and similar variables
38 34
 *   many small but handy things originating from bkubicek's fork.
39 35
 *   Arc support
@@ -45,7 +41,11 @@ Features:
45 41
 *   Heater power reporting. Useful for PID monitoring.
46 42
 *   PID tuning
47 43
 *   CoreXY kinematics (www.corexy.com/theory.html)
44
+*   Delta kinematics
45
+*   Dual X-carriage support for multiple extruder systems
48 46
 *   Configurable serial port to support connection of wireless adaptors.
47
+*   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
48
+*   RC Servo Support, specify angle or duration for continuous rotation servos.
49 49
 
50 50
 The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
51 51
 
@@ -55,17 +55,17 @@ Differences and additions to the already good Sprinter firmware:
55 55
 
56 56
 *Look-ahead:*
57 57
 
58
-Marlin has look-ahead. While sprinter has to break and re-accelerate at each corner, 
59
-lookahead will only decelerate and accelerate to a velocity, 
58
+Marlin has look-ahead. While sprinter has to break and re-accelerate at each corner,
59
+lookahead will only decelerate and accelerate to a velocity,
60 60
 so that the change in vectorial velocity magnitude is less than the xy_jerk_velocity.
61
-This is only possible, if some future moves are already processed, hence the name. 
61
+This is only possible, if some future moves are already processed, hence the name.
62 62
 It leads to less over-deposition at corners, especially at flat angles.
63 63
 
64 64
 *Arc support:*
65 65
 
66 66
 Slic3r can find curves that, although broken into segments, were ment to describe an arc.
67 67
 Marlin is able to print those arcs. The advantage is the firmware can choose the resolution,
68
-and can perform the arc with nearly constant velocity, resulting in a nice finish. 
68
+and can perform the arc with nearly constant velocity, resulting in a nice finish.
69 69
 Also, less serial communication is needed.
70 70
 
71 71
 *Temperature Oversampling:*
@@ -94,7 +94,7 @@ After each reboot, it will magically load them from EEPROM, independent what you
94 94
 
95 95
 If your hardware supports it, you can build yourself a LCD-CardReader+Click+encoder combination. It will enable you to realtime tune temperatures,
96 96
 accelerations, velocities, flow rates, select and print files from the SD card, preheat, disable the steppers, and do other fancy stuff.
97
-One working hardware is documented here: http://www.thingiverse.com/thing:12663 
97
+One working hardware is documented here: http://www.thingiverse.com/thing:12663
98 98
 Also, with just a 20x4 or 16x2 display, useful data is shown.
99 99
 
100 100
 *SD card folders:*
@@ -129,57 +129,98 @@ necessary for backwards compatibility.
129 129
 An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
130 130
 This leads to less blocking in the heater management routine.
131 131
 
132
+Implemented G Codes:
133
+====================
134
+
135
+*  G0  -> G1
136
+*  G1  - Coordinated Movement X Y Z E
137
+*  G2  - CW ARC
138
+*  G3  - CCW ARC
139
+*  G4  - Dwell S<seconds> or P<milliseconds>
140
+*  G10 - retract filament according to settings of M207
141
+*  G11 - retract recover filament according to settings of M208
142
+*  G28 - Home all Axis
143
+*  G90 - Use Absolute Coordinates
144
+*  G91 - Use Relative Coordinates
145
+*  G92 - Set current position to cordinates given
146
+
147
+M Codes
148
+*  M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
149
+*  M1   - Same as M0
150
+*  M17  - Enable/Power all stepper motors
151
+*  M18  - Disable all stepper motors; same as M84
152
+*  M20  - List SD card
153
+*  M21  - Init SD card
154
+*  M22  - Release SD card
155
+*  M23  - Select SD file (M23 filename.g)
156
+*  M24  - Start/resume SD print
157
+*  M25  - Pause SD print
158
+*  M26  - Set SD position in bytes (M26 S12345)
159
+*  M27  - Report SD print status
160
+*  M28  - Start SD write (M28 filename.g)
161
+*  M29  - Stop SD write
162
+*  M30  - Delete file from SD (M30 filename.g)
163
+*  M31  - Output time since last M109 or SD card start to serial
164
+*  M32  - Select file and start SD print (Can be used when printing from SD card)
165
+*  M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
166
+*  M80  - Turn on Power Supply
167
+*  M81  - Turn off Power Supply
168
+*  M82  - Set E codes absolute (default)
169
+*  M83  - Set E codes relative while in Absolute Coordinates (G90) mode
170
+*  M84  - Disable steppers until next move, or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled.  S0 to disable the timeout.
171
+*  M85  - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
172
+*  M92  - Set axis_steps_per_unit - same syntax as G92
173
+*  M104 - Set extruder target temp
174
+*  M105 - Read current temp
175
+*  M106 - Fan on
176
+*  M107 - Fan off
177
+*  M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
178
+*         Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
179
+*  M114 - Output current position to serial port
180
+*  M115 - Capabilities string
181
+*  M117 - display message
182
+*  M119 - Output Endstop status to serial port
183
+*  M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
184
+*  M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
185
+*  M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
186
+*  M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
187
+*  M140 - Set bed target temp
188
+*  M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
189
+*         Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
190
+*  M200 - Set filament diameter
191
+*  M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
192
+*  M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
193
+*  M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
194
+*  M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
195
+*  M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk
196
+*  M206 - set additional homeing offset
197
+*  M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
198
+*  M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
199
+*  M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
200
+*  M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
201
+*  M220 S<factor in percent>- set speed factor override percentage
202
+*  M221 S<factor in percent>- set extrude factor override percentage
203
+*  M240 - Trigger a camera to take a photograph
204
+*  M280 - Position an RC Servo P<index> S<angle/microseconds>, ommit S to report back current angle
205
+*  M300 - Play beepsound S<frequency Hz> P<duration ms>
206
+*  M301 - Set PID parameters P I and D
207
+*  M302 - Allow cold extrudes
208
+*  M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
209
+*  M304 - Set bed PID parameters P I and D
210
+*  M400 - Finish all moves
211
+*  M500 - stores paramters in EEPROM
212
+*  M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
213
+*  M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
214
+*  M503 - print the current settings (from memory not from eeprom)
215
+*  M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
216
+*  M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
217
+*  M907 - Set digital trimpot motor current using axis codes.
218
+*  M908 - Control digital trimpot directly.
219
+*  M350 - Set microstepping mode.
220
+*  M351 - Toggle MS1 MS2 pins directly.
221
+*  M928 - Start SD logging (M928 filename.g) - ended by M29
222
+*  M999 - Restart after being stopped by error
132 223
 
133
-Non-standard M-Codes, different to an old version of sprinter:
134
-==============================================================
135
-Movement:
136
-
137
-*   G2  - CW ARC
138
-*   G3  - CCW ARC
139
-
140
-General:
141
-
142
-*   M17  - Enable/Power all stepper motors. Compatibility to ReplicatorG.
143
-*   M18  - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
144
-*   M30  - Print time since last M109 or SD card start to serial
145
-*   M42  - Change pin status via gcode
146
-*   M80  - Turn on Power Supply
147
-*   M81  - Turn off Power Supply
148
-*   M114 - Output current position to serial port 
149
-*   M119 - Output Endstop status to serial port
150
-
151
-Movement variables:
152
-
153
-*   M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
154
-*   M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
155
-*   M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
156
-*   M206 - set home offsets.  This sets the X,Y,Z coordinates of the endstops (and is added to the {X,Y,Z}_HOME_POS configuration options (and is also added to the coordinates, if any, provided to G82, as with earlier firmware)
157
-*   M220 - set build speed mulitplying S:factor in percent ; aka "realtime tuneing in the gcode". So you can slow down if you have islands in one height-range, and speed up otherwise.
158
-*   M221 - set the extrude multiplying S:factor in percent
159
-*   M400 - Finish all buffered moves.
160
-
161
-Temperature variables:
162
-*   M301 - Set PID parameters P I and D
163
-*   M302 - Allow cold extrudes
164
-*   M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
165
-
166
-Advance:
167
-
168
-*   M200 - Set filament diameter for advance
169
-*   M205 - advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
170
-
171
-EEPROM:
172
-
173
-*   M500 - stores paramters in EEPROM. This parameters are stored:  axis_steps_per_unit,  max_feedrate, max_acceleration  ,acceleration,retract_acceleration,
174
-  minimumfeedrate,mintravelfeedrate,minsegmenttime,  jerk velocities, PID
175
-*   M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
176
-*   M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
177
-*   M503 - print the current settings (from memory not from eeprom)
178
-
179
-MISC:
180
-
181
-*   M240 - Trigger a camera to take a photograph
182
-*   M999 - Restart after being stopped by error
183 224
 
184 225
 Configuring and compilation:
185 226
 ============================
@@ -190,12 +231,7 @@ Install the arduino software IDE/toolset v23 (Some configurations also work with
190 231
 For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
191 232
   copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
192 233
 
193
-Install Ultimaker's RepG 25 build
194
-    http://software.ultimaker.com
195
-For SD handling and as better substitute (apart from stl manipulation) download
196
-the very nice Kliment's printrun/pronterface  https://github.com/kliment/Printrun
197
-
198
-Copy the Ultimaker Marlin firmware
234
+Copy the Marlin firmware
199 235
    https://github.com/ErikZalm/Marlin/tree/Marlin_v1
200 236
    (Use the download button)
201 237
 
@@ -209,15 +245,8 @@ Click the Verify/Compile button
209 245
 Click the Upload button
210 246
 If all goes well the firmware is uploading
211 247
 
212
-Start Ultimaker's Custom RepG 25
213
-Make sure Show Experimental Profiles is enabled in Preferences
214
-Select Sprinter as the Driver
215
-
216
-Press the Connect button.
217
-
218
-KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
219
-
220 248
 That's ok.  Enjoy Silky Smooth Printing.
221 249
 
222 250
 
223 251
 
252
+

Loading…
Peruuta
Tallenna