Переглянути джерело

Add Azteeg X3 Pro as motherboard 68

Add digipot i2c control for MCP4451
Allow M907 to set i2c digipot currents in amps
Fix Makefile to allow Azteeg motherboards
Fix Makefile to allow Wire libraries only
Add beeper pin for Azteeg X3 Pro
Jim Morris 10 роки тому
джерело
коміт
b819fc53ca

+ 11
- 10
Marlin/Configuration.h Переглянути файл

@@ -52,6 +52,7 @@
52 52
 // 65 = Azteeg X1
53 53
 // 66 = Melzi with ATmega1284 (MaKr3d version)
54 54
 // 67 = Azteeg X3
55
+// 68 = Azteeg X3 Pro
55 56
 // 7  = Ultimaker
56 57
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
57 58
 // 77 = 3Drag Controller
@@ -156,8 +157,8 @@
156 157
 // HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
157 158
 //#define HEATER_BED_DUTY_CYCLE_DIVIDER 4
158 159
 
159
-// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS 
160
-//#define EXTRUDER_WATTS (12.0*12.0/6.7) //  P=I^2/R 
160
+// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
161
+//#define EXTRUDER_WATTS (12.0*12.0/6.7) //  P=I^2/R
161 162
 //#define BED_WATTS (12.0*12.0/1.1)      // P=I^2/R
162 163
 
163 164
 // PID settings:
@@ -374,12 +375,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
374 375
   // with accurate bed leveling, the bed is sampled in a ACCURATE_BED_LEVELING_POINTSxACCURATE_BED_LEVELING_POINTS grid and least squares solution is calculated
375 376
   // Note: this feature occupies 10'206 byte
376 377
   #define ACCURATE_BED_LEVELING
377
-  
378
+
378 379
   #ifdef ACCURATE_BED_LEVELING
379 380
      // I wouldn't see a reason to go above 3 (=9 probing points on the bed)
380 381
     #define ACCURATE_BED_LEVELING_POINTS 2
381 382
   #endif
382
-  
383
+
383 384
 #endif
384 385
 
385 386
 
@@ -538,21 +539,21 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
538 539
   #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
539 540
   #define NEWPANEL
540 541
   #define ULTIPANEL
541
-  
542
+
542 543
   #ifndef ENCODER_PULSES_PER_STEP
543 544
 	#define ENCODER_PULSES_PER_STEP 4
544
-  #endif 
545
+  #endif
545 546
 
546 547
   #ifndef ENCODER_STEPS_PER_MENU_ITEM
547 548
 	#define ENCODER_STEPS_PER_MENU_ITEM 1
548
-  #endif 
549
-  
550
-  
549
+  #endif
550
+
551
+
551 552
   #ifdef LCD_USE_I2C_BUZZER
552 553
 	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
553 554
 	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
554 555
   #endif
555
-  
556
+
556 557
 #endif
557 558
 
558 559
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs

+ 40
- 34
Marlin/Configuration_adv.h Переглянути файл

@@ -12,7 +12,7 @@
12 12
 
13 13
 //// Heating sanity check:
14 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. 
15
+// If the temperature has not increased at the end of that period, the target temperature is set to zero.
16 16
 // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
17 17
 //  differ by at least 2x WATCH_TEMP_INCREASE
18 18
 //#define WATCH_TEMP_PERIOD 40000 //40 seconds
@@ -21,7 +21,7 @@
21 21
 #ifdef PIDTEMP
22 22
   // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
23 23
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
24
-  #define PID_ADD_EXTRUSION_RATE  
24
+  #define PID_ADD_EXTRUSION_RATE
25 25
   #ifdef PID_ADD_EXTRUSION_RATE
26 26
     #define  DEFAULT_Kc (1) //heatingpower=Kc*(e_speed)
27 27
   #endif
@@ -44,10 +44,10 @@
44 44
 //The M105 command return, besides traditional information, the ADC value read from temperature sensors.
45 45
 //#define SHOW_TEMP_ADC_VALUES
46 46
 
47
-//  extruder run-out prevention. 
47
+//  extruder run-out prevention.
48 48
 //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
49
-//#define EXTRUDER_RUNOUT_PREVENT  
50
-#define EXTRUDER_RUNOUT_MINTEMP 190  
49
+//#define EXTRUDER_RUNOUT_PREVENT
50
+#define EXTRUDER_RUNOUT_MINTEMP 190
51 51
 #define EXTRUDER_RUNOUT_SECONDS 30.
52 52
 #define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
53 53
 #define EXTRUDER_RUNOUT_SPEED 1500.  //extrusion speed
@@ -73,7 +73,7 @@
73 73
 // Extruder cooling fans
74 74
 // Configure fan pin outputs to automatically turn on/off when the associated
75 75
 // extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
76
-// Multiple extruders can be assigned to the same pin in which case 
76
+// Multiple extruders can be assigned to the same pin in which case
77 77
 // the fan will turn on when any selected extruder is above the threshold.
78 78
 #define EXTRUDER_0_AUTO_FAN_PIN   -1
79 79
 #define EXTRUDER_1_AUTO_FAN_PIN   -1
@@ -103,14 +103,14 @@
103 103
     #else
104 104
       #define X_HOME_POS X_MIN_POS
105 105
     #endif //BED_CENTER_AT_0_0
106
-  #else    
106
+  #else
107 107
     #ifdef BED_CENTER_AT_0_0
108 108
       #define X_HOME_POS X_MAX_LENGTH * 0.5
109 109
     #else
110 110
       #define X_HOME_POS X_MAX_POS
111 111
     #endif //BED_CENTER_AT_0_0
112 112
   #endif //X_HOME_DIR == -1
113
-  
113
+
114 114
   //Y axis
115 115
   #if Y_HOME_DIR == -1
116 116
     #ifdef BED_CENTER_AT_0_0
@@ -118,18 +118,18 @@
118 118
     #else
119 119
       #define Y_HOME_POS Y_MIN_POS
120 120
     #endif //BED_CENTER_AT_0_0
121
-  #else    
121
+  #else
122 122
     #ifdef BED_CENTER_AT_0_0
123 123
       #define Y_HOME_POS Y_MAX_LENGTH * 0.5
124 124
     #else
125 125
       #define Y_HOME_POS Y_MAX_POS
126 126
     #endif //BED_CENTER_AT_0_0
127 127
   #endif //Y_HOME_DIR == -1
128
-  
128
+
129 129
   // Z axis
130 130
   #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
131 131
     #define Z_HOME_POS Z_MIN_POS
132
-  #else    
132
+  #else
133 133
     #define Z_HOME_POS Z_MAX_POS
134 134
   #endif //Z_HOME_DIR == -1
135 135
 #endif //End auto min/max positions
@@ -165,7 +165,7 @@
165 165
   #error "You cannot have dual drivers for both Y and Z"
166 166
 #endif
167 167
 
168
-// Enable this for dual x-carriage printers. 
168
+// Enable this for dual x-carriage printers.
169 169
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
170 170
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
171 171
 // allowing faster printing speeds.
@@ -175,10 +175,10 @@
175 175
 // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
176 176
 // the second x-carriage always homes to the maximum endstop.
177 177
 #define X2_MIN_POS 80     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
178
-#define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed 
178
+#define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed
179 179
 #define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
180
-#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
181
-    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
180
+#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
181
+    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
182 182
     // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
183 183
     // without modifying the firmware (through the "M218 T1 X???" command).
184 184
     // Remember: you should set the second extruder x-offset to 0 in your slicer.
@@ -193,17 +193,17 @@
193 193
 //                           as long as it supports dual x-carriages. (M605 S0)
194 194
 //    Mode 1: Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so
195 195
 //                           that additional slicer support is not required. (M605 S1)
196
-//    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all  
196
+//    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all
197 197
 //                           actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
198 198
 //                           once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
199 199
 
200
-// This is the default power-up mode which can be later using M605. 
201
-#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 
200
+// This is the default power-up mode which can be later using M605.
201
+#define DEFAULT_DUAL_X_CARRIAGE_MODE 0
202 202
 
203 203
 // As the x-carriages are independent we can now account for any relative Z offset
204 204
 #define EXTRUDER1_Z_OFFSET 0.0           // z offset relative to extruder 0
205 205
 
206
-// Default settings in "Auto-park Mode" 
206
+// Default settings in "Auto-park Mode"
207 207
 #define TOOLCHANGE_PARK_ZLIFT   0.2      // the distance to raise Z axis when parking an extruder
208 208
 #define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
209 209
 
@@ -211,11 +211,11 @@
211 211
 #define DEFAULT_DUPLICATION_X_OFFSET 100
212 212
 
213 213
 #endif //DUAL_X_CARRIAGE
214
-    
214
+
215 215
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
216
-#define X_HOME_RETRACT_MM 5 
217
-#define Y_HOME_RETRACT_MM 5 
218
-#define Z_HOME_RETRACT_MM 1 
216
+#define X_HOME_RETRACT_MM 5
217
+#define Y_HOME_RETRACT_MM 5
218
+#define Z_HOME_RETRACT_MM 1
219 219
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
220 220
 
221 221
 #define AXIS_RELATIVE_MODES {false, false, false, false}
@@ -268,6 +268,12 @@
268 268
 // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
269 269
 #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
270 270
 
271
+// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
272
+#define DIGIPOT_I2C
273
+// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
274
+#define DIGIPOT_I2C_NUM_CHANNELS 8
275
+// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
276
+#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
271 277
 
272 278
 //===========================================================================
273 279
 //=============================Additional Features===========================
@@ -276,7 +282,7 @@
276 282
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
277 283
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
278 284
 
279
-#define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the filesystem block order. 
285
+#define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the filesystem block order.
280 286
 // if a file is deleted, it frees a block. hence, the order is not purely cronological. To still have auto0.g accessible, there is again the option to do that.
281 287
 // using:
282 288
 //#define MENU_ADDAUTOSTART
@@ -302,7 +308,7 @@
302 308
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
303 309
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
304 310
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
305
-  
311
+
306 312
   #ifdef COREXY
307 313
     #error BABYSTEPPING not implemented for COREXY yet.
308 314
   #endif
@@ -340,10 +346,10 @@
340 346
 const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
341 347
 
342 348
 // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
343
-// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT 
349
+// You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT
344 350
 // in the pins.h file.  When using a push button pulling the pin to ground this will need inverted.  This setting should
345 351
 // be commented out otherwise
346
-#define SDCARDDETECTINVERTED 
352
+#define SDCARDDETECTINVERTED
347 353
 
348 354
 #ifdef ULTIPANEL
349 355
  #undef SDCARDDETECTINVERTED
@@ -355,12 +361,12 @@ const unsigned int dropsegments=5; //everything with less than this number of st
355 361
   #define POWER_SUPPLY 1
356 362
 #endif
357 363
 // 1 = ATX
358
-#if (POWER_SUPPLY == 1) 
364
+#if (POWER_SUPPLY == 1)
359 365
   #define PS_ON_AWAKE  LOW
360 366
   #define PS_ON_ASLEEP HIGH
361 367
 #endif
362 368
 // 2 = X-Box 360 203W
363
-#if (POWER_SUPPLY == 2) 
369
+#if (POWER_SUPPLY == 2)
364 370
   #define PS_ON_AWAKE  HIGH
365 371
   #define PS_ON_ASLEEP LOW
366 372
 #endif
@@ -372,7 +378,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
372 378
 //=============================Buffers           ============================
373 379
 //===========================================================================
374 380
 
375
-// The number of linear motions that can be in the plan at any give time.  
381
+// The number of linear motions that can be in the plan at any give time.
376 382
 // 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.
377 383
 #if defined SDSUPPORT
378 384
   #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
@@ -387,9 +393,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
387 393
 
388 394
 
389 395
 // Firmware based and LCD controled retract
390
-// M207 and M208 can be used to define parameters for the retraction. 
396
+// M207 and M208 can be used to define parameters for the retraction.
391 397
 // The retraction can be called by the slicer using G10 and G11
392
-// until then, intended retractions can be detected by moves that only extrude and the direction. 
398
+// until then, intended retractions can be detected by moves that only extrude and the direction.
393 399
 // the moves are than replaced by the firmware controlled ones.
394 400
 
395 401
 // #define FWRETRACT  //ONLY PARTIALLY TESTED
@@ -411,9 +417,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
411 417
 #ifdef FILAMENTCHANGEENABLE
412 418
   #ifdef EXTRUDER_RUNOUT_PREVENT
413 419
     #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
414
-  #endif 
420
+  #endif
415 421
 #endif
416
- 
422
+
417 423
 //===========================================================================
418 424
 //=============================  Define Defines  ============================
419 425
 //===========================================================================

+ 26
- 2
Marlin/Makefile Переглянути файл

@@ -55,7 +55,10 @@ UPLOAD_PORT        ?= /dev/arduino
55 55
 BUILD_DIR          ?= applet
56 56
 
57 57
 # This defines whether Liquid_TWI2 support will be built
58
-LIQUID_TWI2 ?= 0
58
+LIQUID_TWI2        ?= 0
59
+
60
+# this defines if Wire is needed
61
+WIRE               ?= 0
59 62
 
60 63
 ############################################################################
61 64
 # Below here nothing should be changed...
@@ -174,6 +177,14 @@ else ifeq  ($(HARDWARE_MOTHERBOARD),301)
174 177
 HARDWARE_VARIANT ?= arduino
175 178
 MCU              ?= atmega2560
176 179
 
180
+# Azteeg
181
+else ifeq  ($(HARDWARE_MOTHERBOARD),67)
182
+HARDWARE_VARIANT ?= arduino
183
+MCU              ?= atmega2560
184
+else ifeq  ($(HARDWARE_MOTHERBOARD),68)
185
+HARDWARE_VARIANT ?= arduino
186
+MCU              ?= atmega2560
187
+
177 188
 endif
178 189
 
179 190
 # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
@@ -213,6 +224,10 @@ VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
213 224
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
214 225
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
215 226
 endif
227
+ifeq ($(WIRE), 1)
228
+VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
229
+VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
230
+endif
216 231
 else
217 232
 VPATH += $(HARDWARE_DIR)/libraries/LiquidCrystal
218 233
 VPATH += $(HARDWARE_DIR)/libraries/SPI
@@ -221,6 +236,10 @@ VPATH += $(HARDWARE_DIR)/libraries/Wire
221 236
 VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
222 237
 VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2
223 238
 endif
239
+ifeq ($(WIRE, 1)
240
+VPATH += $(HARDWARE_DIR)/libraries/Wire
241
+VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
242
+endif
224 243
 endif
225 244
 ifeq ($(HARDWARE_VARIANT), arduino)
226 245
 HARDWARE_SUB_VARIANT ?= mega
@@ -241,7 +260,7 @@ CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
241 260
 	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp	\
242 261
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
243 262
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
244
-	watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp
263
+	watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp
245 264
 ifeq ($(LIQUID_TWI2), 0)
246 265
 CXXSRC += LiquidCrystal.cpp
247 266
 else
@@ -249,6 +268,11 @@ SRC += twi.c
249 268
 CXXSRC += Wire.cpp LiquidTWI2.cpp
250 269
 endif
251 270
 
271
+ifeq ($(WIRE), 1)
272
+SRC += twi.c
273
+CXXSRC += Wire.cpp
274
+endif
275
+
252 276
 #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
253 277
 ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
254 278
 CXXSRC += main.cpp

+ 5
- 0
Marlin/Marlin.h Переглянути файл

@@ -235,4 +235,9 @@ extern unsigned long stoptime;
235 235
 // Handling multiple extruders pins
236 236
 extern uint8_t active_extruder;
237 237
 
238
+#ifdef DIGIPOT_I2C
239
+extern void digipot_i2c_set_current( int channel, float current );
240
+extern void digipot_i2c_init();
241
+#endif
242
+
238 243
 #endif

+ 9
- 5
Marlin/Marlin.ino Переглянути файл

@@ -3,17 +3,17 @@
3 3
 /*
4 4
     Reprap firmware based on Sprinter and grbl.
5 5
  Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
6
- 
6
+
7 7
  This program is free software: you can redistribute it and/or modify
8 8
  it under the terms of the GNU General Public License as published by
9 9
  the Free Software Foundation, either version 3 of the License, or
10 10
  (at your option) any later version.
11
- 
11
+
12 12
  This program is distributed in the hope that it will be useful,
13 13
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 15
  GNU General Public License for more details.
16
- 
16
+
17 17
  You should have received a copy of the GNU General Public License
18 18
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 19
  */
@@ -22,8 +22,8 @@
22 22
  This firmware is a mashup between Sprinter and grbl.
23 23
   (https://github.com/kliment/Sprinter)
24 24
   (https://github.com/simen/grbl/tree)
25
- 
26
- It has preliminary support for Matthew Roberts advance algorithm 
25
+
26
+ It has preliminary support for Matthew Roberts advance algorithm
27 27
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
28 28
  */
29 29
 
@@ -50,3 +50,7 @@
50 50
 #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
51 51
 #include <SPI.h>
52 52
 #endif
53
+
54
+#if defined(DIGIPOT_I2C)
55
+  #include <Wire.h>
56
+#endif

+ 9
- 5
Marlin/Marlin.pde Переглянути файл

@@ -3,17 +3,17 @@
3 3
 /*
4 4
     Reprap firmware based on Sprinter and grbl.
5 5
  Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
6
- 
6
+
7 7
  This program is free software: you can redistribute it and/or modify
8 8
  it under the terms of the GNU General Public License as published by
9 9
  the Free Software Foundation, either version 3 of the License, or
10 10
  (at your option) any later version.
11
- 
11
+
12 12
  This program is distributed in the hope that it will be useful,
13 13
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 15
  GNU General Public License for more details.
16
- 
16
+
17 17
  You should have received a copy of the GNU General Public License
18 18
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 19
  */
@@ -22,8 +22,8 @@
22 22
  This firmware is a mashup between Sprinter and grbl.
23 23
   (https://github.com/kliment/Sprinter)
24 24
   (https://github.com/simen/grbl/tree)
25
- 
26
- It has preliminary support for Matthew Roberts advance algorithm 
25
+
26
+ It has preliminary support for Matthew Roberts advance algorithm
27 27
     http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
28 28
  */
29 29
 
@@ -50,3 +50,7 @@
50 50
 #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
51 51
 #include <SPI.h>
52 52
 #endif
53
+
54
+#if defined(DIGIPOT_I2C)
55
+  #include <Wire.h>
56
+#endif

+ 113
- 103
Marlin/Marlin_main.cpp Переглянути файл

@@ -249,7 +249,7 @@ int EtoPPressure=0;
249 249
 float delta[3] = {0.0, 0.0, 0.0};
250 250
 #endif
251 251
 
252
-  
252
+
253 253
 //===========================================================================
254 254
 //=============================private variables=============================
255 255
 //===========================================================================
@@ -492,6 +492,10 @@ void setup()
492 492
   #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
493 493
     SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
494 494
   #endif
495
+
496
+  #ifdef DIGIPOT_I2C
497
+    digipot_i2c_init();
498
+  #endif
495 499
 }
496 500
 
497 501
 
@@ -789,7 +793,7 @@ static unsigned long delayed_move_time = 0; // used in mode 1
789 793
 static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
790 794
 static float duplicate_extruder_temp_offset = 0; // used in mode 2
791 795
 bool extruder_duplication_enabled = false; // used in mode 2
792
-#endif //DUAL_X_CARRIAGE    
796
+#endif //DUAL_X_CARRIAGE
793 797
 
794 798
 static void axis_is_at_home(int axis) {
795 799
 #ifdef DUAL_X_CARRIAGE
@@ -802,8 +806,8 @@ static void axis_is_at_home(int axis) {
802 806
     }
803 807
     else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
804 808
       current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homeing[X_AXIS];
805
-      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + add_homeing[X_AXIS]; 
806
-      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + add_homeing[X_AXIS], 
809
+      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + add_homeing[X_AXIS];
810
+      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + add_homeing[X_AXIS],
807 811
                                   max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
808 812
       return;
809 813
     }
@@ -895,7 +899,7 @@ static void run_z_probe() {
895 899
     st_synchronize();
896 900
 
897 901
     // move back down slowly to find bed
898
-    feedrate = homing_feedrate[Z_AXIS]/4; 
902
+    feedrate = homing_feedrate[Z_AXIS]/4;
899 903
     zPosition -= home_retract_mm(Z_AXIS) * 2;
900 904
     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
901 905
     st_synchronize();
@@ -992,7 +996,7 @@ static void homeaxis(int axis) {
992 996
 
993 997
     current_position[axis] = 0;
994 998
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
995
-	
999
+
996 1000
 
997 1001
     // Engage Servo endstop if enabled
998 1002
     #ifdef SERVO_ENDSTOPS
@@ -1050,7 +1054,7 @@ static void homeaxis(int axis) {
1050 1054
 #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
1051 1055
     if (axis==Z_AXIS) retract_z_probe();
1052 1056
 #endif
1053
-    
1057
+
1054 1058
   }
1055 1059
 }
1056 1060
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
@@ -1124,7 +1128,7 @@ void process_commands()
1124 1128
         destination[Y_AXIS]=current_position[Y_AXIS];
1125 1129
         destination[Z_AXIS]=current_position[Z_AXIS];
1126 1130
         current_position[Z_AXIS]+=retract_zlift;
1127
-        destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length; 
1131
+        destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length;
1128 1132
         feedrate=retract_recover_feedrate;
1129 1133
         retracted=false;
1130 1134
         prepare_move();
@@ -1238,10 +1242,10 @@ void process_commands()
1238 1242
         // reset state used by the different modes
1239 1243
         memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
1240 1244
         delayed_move_time = 0;
1241
-        active_extruder_parked = true; 
1242
-      #else      
1245
+        active_extruder_parked = true;
1246
+      #else
1243 1247
         HOMEAXIS(X);
1244
-      #endif         
1248
+      #endif
1245 1249
       }
1246 1250
 
1247 1251
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
@@ -1260,7 +1264,7 @@ void process_commands()
1260 1264
           current_position[Y_AXIS]=code_value()+add_homeing[1];
1261 1265
         }
1262 1266
       }
1263
-      
1267
+
1264 1268
       #if Z_HOME_DIR < 0                      // If homing towards BED do Z last
1265 1269
         #ifndef Z_SAFE_HOMING
1266 1270
           if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
@@ -1272,14 +1276,14 @@ void process_commands()
1272 1276
             #endif
1273 1277
             HOMEAXIS(Z);
1274 1278
           }
1275
-        #else                      // Z Safe mode activated. 
1279
+        #else                      // Z Safe mode activated.
1276 1280
           if(home_all_axis) {
1277 1281
             destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER);
1278 1282
             destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
1279 1283
             destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed
1280 1284
             feedrate = XY_TRAVEL_SPEED;
1281 1285
             current_position[Z_AXIS] = 0;
1282
-			
1286
+
1283 1287
             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1284 1288
             plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
1285 1289
             st_synchronize();
@@ -1297,7 +1301,7 @@ void process_commands()
1297 1301
               && (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) {
1298 1302
 
1299 1303
               current_position[Z_AXIS] = 0;
1300
-              plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);			  
1304
+              plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1301 1305
               destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed
1302 1306
               feedrate = max_feedrate[Z_AXIS];
1303 1307
               plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
@@ -1317,8 +1321,8 @@ void process_commands()
1317 1321
         #endif
1318 1322
       #endif
1319 1323
 
1320
-      
1321
-     
1324
+
1325
+
1322 1326
       if(code_seen(axis_codes[Z_AXIS])) {
1323 1327
         if(code_value_long() != 0) {
1324 1328
           current_position[Z_AXIS]=code_value()+add_homeing[2];
@@ -1364,26 +1368,26 @@ void process_commands()
1364 1368
 
1365 1369
             feedrate = homing_feedrate[Z_AXIS];
1366 1370
 #ifdef ACCURATE_BED_LEVELING
1367
-            
1371
+
1368 1372
             int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (ACCURATE_BED_LEVELING_POINTS-1);
1369 1373
             int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION) / (ACCURATE_BED_LEVELING_POINTS-1);
1370
-            
1371
-            
1374
+
1375
+
1372 1376
             // solve the plane equation ax + by + d = z
1373 1377
             // A is the matrix with rows [x y 1] for all the probed points
1374 1378
             // B is the vector of the Z positions
1375 1379
             // the normal vector to the plane is formed by the coefficients of the plane equation in the standard form, which is Vx*x+Vy*y+Vz*z+d = 0
1376 1380
             // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
1377
-            
1381
+
1378 1382
             // "A" matrix of the linear system of equations
1379 1383
             double eqnAMatrix[ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS*3];
1380 1384
             // "B" vector of Z points
1381 1385
             double eqnBVector[ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS];
1382
-            
1383
-            
1386
+
1387
+
1384 1388
             int probePointCounter = 0;
1385 1389
             bool zig = true;
1386
-            
1390
+
1387 1391
             for (int yProbe=FRONT_PROBE_BED_POSITION; yProbe <= BACK_PROBE_BED_POSITION; yProbe += yGridSpacing)
1388 1392
             {
1389 1393
               int xProbe, xInc;
@@ -1400,7 +1404,7 @@ void process_commands()
1400 1404
                 xInc = -xGridSpacing;
1401 1405
                 zig = true;
1402 1406
               }
1403
-              
1407
+
1404 1408
               for (int xCount=0; xCount < ACCURATE_BED_LEVELING_POINTS; xCount++)
1405 1409
               {
1406 1410
                 if (probePointCounter == 0)
@@ -1408,19 +1412,19 @@ void process_commands()
1408 1412
                   // raise before probing
1409 1413
                   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING);
1410 1414
                 } else
1411
-                {               
1415
+                {
1412 1416
                   // raise extruder
1413 1417
                   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1414 1418
                 }
1415
-                
1416
-                
1419
+
1420
+
1417 1421
                 do_blocking_move_to(xProbe - X_PROBE_OFFSET_FROM_EXTRUDER, yProbe - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1418
-    
1422
+
1419 1423
                 engage_z_probe();   // Engage Z Servo endstop if available
1420 1424
                 run_z_probe();
1421 1425
                 eqnBVector[probePointCounter] = current_position[Z_AXIS];
1422 1426
                 retract_z_probe();
1423
-    
1427
+
1424 1428
                 SERIAL_PROTOCOLPGM("Bed x: ");
1425 1429
                 SERIAL_PROTOCOL(xProbe);
1426 1430
                 SERIAL_PROTOCOLPGM(" y: ");
@@ -1428,7 +1432,7 @@ void process_commands()
1428 1432
                 SERIAL_PROTOCOLPGM(" z: ");
1429 1433
                 SERIAL_PROTOCOL(current_position[Z_AXIS]);
1430 1434
                 SERIAL_PROTOCOLPGM("\n");
1431
-                
1435
+
1432 1436
                 eqnAMatrix[probePointCounter + 0*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = xProbe;
1433 1437
                 eqnAMatrix[probePointCounter + 1*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = yProbe;
1434 1438
                 eqnAMatrix[probePointCounter + 2*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = 1;
@@ -1437,25 +1441,25 @@ void process_commands()
1437 1441
               }
1438 1442
             }
1439 1443
             clean_up_after_endstop_move();
1440
-            
1444
+
1441 1445
             // solve lsq problem
1442 1446
             double *plane_equation_coefficients = qr_solve(ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS, 3, eqnAMatrix, eqnBVector);
1443
-            
1447
+
1444 1448
             SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
1445 1449
             SERIAL_PROTOCOL(plane_equation_coefficients[0]);
1446 1450
             SERIAL_PROTOCOLPGM(" b: ");
1447 1451
             SERIAL_PROTOCOL(plane_equation_coefficients[1]);
1448 1452
             SERIAL_PROTOCOLPGM(" d: ");
1449 1453
             SERIAL_PROTOCOLLN(plane_equation_coefficients[2]);
1450
-            
1451
-            
1454
+
1455
+
1452 1456
             set_bed_level_equation_lsq(plane_equation_coefficients);
1453
-            
1457
+
1454 1458
             free(plane_equation_coefficients);
1455
-            
1459
+
1456 1460
 #else // ACCURATE_BED_LEVELING not defined
1457
-            
1458
-            
1461
+
1462
+
1459 1463
             // prob 1
1460 1464
             do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING);
1461 1465
             do_blocking_move_to(LEFT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, BACK_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
@@ -1481,7 +1485,7 @@ void process_commands()
1481 1485
             run_z_probe();
1482 1486
             float z_at_xLeft_yFront = current_position[Z_AXIS];
1483 1487
             retract_z_probe();
1484
-            
1488
+
1485 1489
             SERIAL_PROTOCOLPGM("Bed x: ");
1486 1490
             SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1487 1491
             SERIAL_PROTOCOLPGM(" y: ");
@@ -1499,7 +1503,7 @@ void process_commands()
1499 1503
             run_z_probe();
1500 1504
             float z_at_xRight_yFront = current_position[Z_AXIS];
1501 1505
             retract_z_probe(); // Retract Z Servo endstop if available
1502
-            
1506
+
1503 1507
             SERIAL_PROTOCOLPGM("Bed x: ");
1504 1508
             SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION);
1505 1509
             SERIAL_PROTOCOLPGM(" y: ");
@@ -1511,13 +1515,13 @@ void process_commands()
1511 1515
             clean_up_after_endstop_move();
1512 1516
 
1513 1517
             set_bed_level_equation(z_at_xLeft_yFront, z_at_xRight_yFront, z_at_xLeft_yBack);
1514
-         
1515
-            
1518
+
1519
+
1516 1520
 #endif // ACCURATE_BED_LEVELING
1517
-            st_synchronize();            
1521
+            st_synchronize();
1518 1522
 
1519 1523
             // The following code correct the Z height difference from z-probe position and hotend tip position.
1520
-            // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend. 
1524
+            // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
1521 1525
             // When the bed is uneven, this height must be corrected.
1522 1526
             real_z = float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS];  //get the real Z (since the auto bed leveling is already correcting the plane)
1523 1527
             x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
@@ -1529,11 +1533,11 @@ void process_commands()
1529 1533
             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1530 1534
         }
1531 1535
         break;
1532
-        
1536
+
1533 1537
     case 30: // G30 Single Z Probe
1534 1538
         {
1535 1539
             engage_z_probe(); // Engage Z Servo endstop if available
1536
-            
1540
+
1537 1541
             st_synchronize();
1538 1542
             // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
1539 1543
             setup_for_endstop_move();
@@ -1684,14 +1688,14 @@ void process_commands()
1684 1688
         card.removeFile(strchr_pointer + 4);
1685 1689
       }
1686 1690
       break;
1687
-    case 32: //M32 - Select file and start SD print 
1691
+    case 32: //M32 - Select file and start SD print
1688 1692
     {
1689 1693
       if(card.sdprinting) {
1690 1694
         st_synchronize();
1691 1695
 
1692 1696
       }
1693
-      starpos = (strchr(strchr_pointer + 4,'*')); 
1694
-      
1697
+      starpos = (strchr(strchr_pointer + 4,'*'));
1698
+
1695 1699
       char* namestartpos = (strchr(strchr_pointer + 4,'!'));   //find ! to indicate filename string start.
1696 1700
       if(namestartpos==NULL)
1697 1701
       {
@@ -1699,16 +1703,16 @@ void process_commands()
1699 1703
       }
1700 1704
       else
1701 1705
         namestartpos++; //to skip the '!'
1702
-        
1706
+
1703 1707
       if(starpos!=NULL)
1704 1708
         *(starpos-1)='\0';
1705
-            
1709
+
1706 1710
       bool call_procedure=(code_seen('P'));
1707
-      
1708
-      if(strchr_pointer>namestartpos) 
1711
+
1712
+      if(strchr_pointer>namestartpos)
1709 1713
         call_procedure=false;  //false alert, 'P' found within filename
1710
-      
1711
-      if( card.cardOK ) 
1714
+
1715
+      if( card.cardOK )
1712 1716
       {
1713 1717
         card.openFile(namestartpos,true,!call_procedure);
1714 1718
         if(code_seen('S'))
@@ -1781,7 +1785,7 @@ void process_commands()
1781 1785
 #ifdef DUAL_X_CARRIAGE
1782 1786
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1783 1787
         setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1784
-#endif          
1788
+#endif
1785 1789
       setWatch();
1786 1790
       break;
1787 1791
     case 140: // M140 set bed temp
@@ -1847,7 +1851,7 @@ void process_commands()
1847 1851
             SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
1848 1852
           }
1849 1853
         #endif
1850
-		
1854
+
1851 1855
         SERIAL_PROTOCOLLN("");
1852 1856
       return;
1853 1857
       break;
@@ -1865,14 +1869,14 @@ void process_commands()
1865 1869
 #ifdef DUAL_X_CARRIAGE
1866 1870
         if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1867 1871
           setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1868
-#endif          
1872
+#endif
1869 1873
         CooldownNoWait = true;
1870 1874
       } else if (code_seen('R')) {
1871 1875
         setTargetHotend(code_value(), tmp_extruder);
1872 1876
 #ifdef DUAL_X_CARRIAGE
1873 1877
         if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1874 1878
           setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1875
-#endif          
1879
+#endif
1876 1880
         CooldownNoWait = false;
1877 1881
       }
1878 1882
       #ifdef AUTOTEMP
@@ -2036,7 +2040,7 @@ void process_commands()
2036 2040
             SET_OUTPUT(SUICIDE_PIN);
2037 2041
             WRITE(SUICIDE_PIN, HIGH);
2038 2042
         #endif
2039
-        
2043
+
2040 2044
         #ifdef ULTIPANEL
2041 2045
           powersupply = true;
2042 2046
           LCD_MESSAGEPGM(WELCOME_MSG);
@@ -2193,18 +2197,18 @@ void process_commands()
2193 2197
       #endif
2194 2198
       break;
2195 2199
       //TODO: update for all axis, use for loop
2196
-    #ifdef BLINKM  
2200
+    #ifdef BLINKM
2197 2201
     case 150: // M150
2198 2202
       {
2199 2203
         byte red;
2200 2204
         byte grn;
2201 2205
         byte blu;
2202
-        
2206
+
2203 2207
         if(code_seen('R')) red = code_value();
2204 2208
         if(code_seen('U')) grn = code_value();
2205 2209
         if(code_seen('B')) blu = code_value();
2206
-        
2207
-        SendColors(red,grn,blu);        
2210
+
2211
+        SendColors(red,grn,blu);
2208 2212
       }
2209 2213
       break;
2210 2214
     #endif //BLINKM
@@ -2354,7 +2358,7 @@ void process_commands()
2354 2358
       {
2355 2359
         extruder_offset[Z_AXIS][tmp_extruder] = code_value();
2356 2360
       }
2357
-      #endif       
2361
+      #endif
2358 2362
       SERIAL_ECHO_START;
2359 2363
       SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
2360 2364
       for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
@@ -2387,17 +2391,17 @@ void process_commands()
2387 2391
       }
2388 2392
     }
2389 2393
     break;
2390
-	
2394
+
2391 2395
 	case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
2392 2396
 	{
2393 2397
       if(code_seen('P')){
2394 2398
         int pin_number = code_value(); // pin number
2395 2399
         int pin_state = -1; // required pin state - default is inverted
2396
-        
2400
+
2397 2401
         if(code_seen('S')) pin_state = code_value(); // required pin state
2398
-      
2402
+
2399 2403
         if(pin_state >= -1 && pin_state <= 1){
2400
-        
2404
+
2401 2405
           for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
2402 2406
           {
2403 2407
             if (sensitive_pins[i] == pin_number)
@@ -2406,28 +2410,28 @@ void process_commands()
2406 2410
               break;
2407 2411
             }
2408 2412
           }
2409
-        
2413
+
2410 2414
           if (pin_number > -1)
2411 2415
           {
2412 2416
             st_synchronize();
2413
-            
2417
+
2414 2418
             pinMode(pin_number, INPUT);
2415
-            
2419
+
2416 2420
             int target;
2417 2421
             switch(pin_state){
2418 2422
             case 1:
2419 2423
               target = HIGH;
2420 2424
               break;
2421
-            
2425
+
2422 2426
             case 0:
2423 2427
               target = LOW;
2424 2428
               break;
2425
-            
2429
+
2426 2430
             case -1:
2427 2431
               target = !digitalRead(pin_number);
2428 2432
               break;
2429 2433
             }
2430
-            
2434
+
2431 2435
             while(digitalRead(pin_number) != target){
2432 2436
               manage_heater();
2433 2437
               manage_inactivity();
@@ -2437,7 +2441,7 @@ void process_commands()
2437 2441
         }
2438 2442
       }
2439 2443
     }
2440
-    break;	
2444
+    break;
2441 2445
 
2442 2446
     #if NUM_SERVOS > 0
2443 2447
     case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
@@ -2615,13 +2619,13 @@ void process_commands()
2615 2619
         engage_z_probe();    // Engage Z Servo endstop if available
2616 2620
     }
2617 2621
     break;
2618
-    
2622
+
2619 2623
     case 402:
2620 2624
     {
2621 2625
         retract_z_probe();    // Retract Z Servo endstop if enabled
2622 2626
     }
2623 2627
     break;
2624
-#endif    
2628
+#endif
2625 2629
     case 500: // M500 Store settings in EEPROM
2626 2630
     {
2627 2631
         Config_StoreSettings();
@@ -2783,14 +2787,14 @@ void process_commands()
2783 2787
               //    M605 S0: Full control mode. The slicer has full control over x-carriage movement
2784 2788
               //    M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
2785 2789
               //    M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
2786
-              //                         millimeters x-offset and an optional differential hotend temperature of 
2790
+              //                         millimeters x-offset and an optional differential hotend temperature of
2787 2791
               //                         mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
2788 2792
               //                         the first with a spacing of 100mm in the x direction and 2 degrees hotter.
2789 2793
               //
2790 2794
               //    Note: the X axis should be homed after changing dual x-carriage mode.
2791 2795
     {
2792 2796
         st_synchronize();
2793
-        
2797
+
2794 2798
         if (code_seen('S'))
2795 2799
           dual_x_carriage_mode = code_value();
2796 2800
 
@@ -2801,7 +2805,7 @@ void process_commands()
2801 2805
 
2802 2806
           if (code_seen('R'))
2803 2807
             duplicate_extruder_temp_offset = code_value();
2804
-            
2808
+
2805 2809
           SERIAL_ECHO_START;
2806 2810
           SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
2807 2811
           SERIAL_ECHO(" ");
@@ -2817,13 +2821,13 @@ void process_commands()
2817 2821
         {
2818 2822
           dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
2819 2823
         }
2820
-        
2824
+
2821 2825
         active_extruder_parked = false;
2822 2826
         extruder_duplication_enabled = false;
2823 2827
         delayed_move_time = 0;
2824 2828
     }
2825 2829
     break;
2826
-    #endif //DUAL_X_CARRIAGE         
2830
+    #endif //DUAL_X_CARRIAGE
2827 2831
 
2828 2832
     case 907: // M907 Set digital trimpot motor current using axis codes.
2829 2833
     {
@@ -2841,6 +2845,12 @@ void process_commands()
2841 2845
       #ifdef MOTOR_CURRENT_PWM_E_PIN
2842 2846
         if(code_seen('E')) digipot_current(2, code_value());
2843 2847
       #endif
2848
+      #ifdef DIGIPOT_I2C
2849
+        // this one uses actual amps in floating point
2850
+        for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) digipot_i2c_set_current(i, code_value());
2851
+        // for each additional extruder (named B,C,D,E..., channels 4,5,6,7...)
2852
+        for(int i=NUM_AXIS;i<DIGIPOT_I2C_NUM_CHANNELS;i++) if(code_seen('B'+i-NUM_AXIS)) digipot_i2c_set_current(i, code_value());
2853
+      #endif
2844 2854
     }
2845 2855
     break;
2846 2856
     case 908: // M908 Control digital trimpot directly.
@@ -2913,19 +2923,19 @@ void process_commands()
2913 2923
         // Save current position to return to after applying extruder offset
2914 2924
         memcpy(destination, current_position, sizeof(destination));
2915 2925
       #ifdef DUAL_X_CARRIAGE
2916
-        if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false && 
2926
+        if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false &&
2917 2927
             (delayed_move_time != 0 || current_position[X_AXIS] != x_home_pos(active_extruder)))
2918 2928
         {
2919 2929
           // Park old head: 1) raise 2) move to park position 3) lower
2920
-          plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, 
2930
+          plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
2921 2931
                 current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2922
-          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, 
2932
+          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
2923 2933
                 current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
2924
-          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS], 
2934
+          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
2925 2935
                 current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2926 2936
           st_synchronize();
2927 2937
         }
2928
-        
2938
+
2929 2939
         // apply Y & Z extruder offset (x offset is already used in determining home pos)
2930 2940
         current_position[Y_AXIS] = current_position[Y_AXIS] -
2931 2941
                      extruder_offset[Y_AXIS][active_extruder] +
@@ -2933,7 +2943,7 @@ void process_commands()
2933 2943
         current_position[Z_AXIS] = current_position[Z_AXIS] -
2934 2944
                      extruder_offset[Z_AXIS][active_extruder] +
2935 2945
                      extruder_offset[Z_AXIS][tmp_extruder];
2936
-                     
2946
+
2937 2947
         active_extruder = tmp_extruder;
2938 2948
 
2939 2949
         // This function resets the max/min values - the current position may be overwritten below.
@@ -2941,18 +2951,18 @@ void process_commands()
2941 2951
 
2942 2952
         if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE)
2943 2953
         {
2944
-          current_position[X_AXIS] = inactive_extruder_x_pos; 
2954
+          current_position[X_AXIS] = inactive_extruder_x_pos;
2945 2955
           inactive_extruder_x_pos = destination[X_AXIS];
2946 2956
         }
2947 2957
         else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE)
2948 2958
         {
2949 2959
           active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
2950 2960
           if (active_extruder == 0 || active_extruder_parked)
2951
-            current_position[X_AXIS] = inactive_extruder_x_pos; 
2961
+            current_position[X_AXIS] = inactive_extruder_x_pos;
2952 2962
           else
2953
-            current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset; 
2963
+            current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
2954 2964
           inactive_extruder_x_pos = destination[X_AXIS];
2955
-          extruder_duplication_enabled = false; 
2965
+          extruder_duplication_enabled = false;
2956 2966
         }
2957 2967
         else
2958 2968
         {
@@ -2962,7 +2972,7 @@ void process_commands()
2962 2972
           active_extruder_parked = true;
2963 2973
           delayed_move_time = 0;
2964 2974
         }
2965
-      #else    
2975
+      #else
2966 2976
         // Offset extruder (only by XY)
2967 2977
         int i;
2968 2978
         for(i = 0; i < 2; i++) {
@@ -3175,13 +3185,13 @@ void prepare_move()
3175 3185
     {
3176 3186
       // move duplicate extruder into correct duplication position.
3177 3187
       plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
3178
-      plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], 
3188
+      plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
3179 3189
           current_position[E_AXIS], max_feedrate[X_AXIS], 1);
3180 3190
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
3181 3191
       st_synchronize();
3182 3192
       extruder_duplication_enabled = true;
3183 3193
       active_extruder_parked = false;
3184
-    }  
3194
+    }
3185 3195
     else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) // handle unparking of head
3186 3196
     {
3187 3197
       if (current_position[E_AXIS] == destination[E_AXIS])
@@ -3190,7 +3200,7 @@ void prepare_move()
3190 3200
         // be used as start of first non-travel move)
3191 3201
         if (delayed_move_time != 0xFFFFFFFFUL)
3192 3202
         {
3193
-          memcpy(current_position, destination, sizeof(current_position)); 
3203
+          memcpy(current_position, destination, sizeof(current_position));
3194 3204
           if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
3195 3205
             raised_parked_position[Z_AXIS] = destination[Z_AXIS];
3196 3206
           delayed_move_time = millis();
@@ -3200,9 +3210,9 @@ void prepare_move()
3200 3210
       delayed_move_time = 0;
3201 3211
       // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
3202 3212
       plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS],    current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
3203
-      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], 
3213
+      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
3204 3214
           current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
3205
-      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
3215
+      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
3206 3216
           current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
3207 3217
       active_extruder_parked = false;
3208 3218
     }
@@ -3350,8 +3360,8 @@ void manage_inactivity()
3350 3360
      enable_e0();
3351 3361
      float oldepos=current_position[E_AXIS];
3352 3362
      float oldedes=destination[E_AXIS];
3353
-     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 
3354
-                      destination[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], 
3363
+     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
3364
+                      destination[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS],
3355 3365
                       EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
3356 3366
      current_position[E_AXIS]=oldepos;
3357 3367
      destination[E_AXIS]=oldedes;
@@ -3368,7 +3378,7 @@ void manage_inactivity()
3368 3378
       // travel moves have been received so enact them
3369 3379
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
3370 3380
       memcpy(destination,current_position,sizeof(destination));
3371
-      prepare_move(); 
3381
+      prepare_move();
3372 3382
     }
3373 3383
   #endif
3374 3384
   #ifdef TEMP_STAT_LEDS

+ 54
- 0
Marlin/digipot_mcp4451.cpp Переглянути файл

@@ -0,0 +1,54 @@
1
+#include "Configuration.h"
2
+
3
+#ifdef DIGIPOT_I2C
4
+#include "Stream.h"
5
+#include "utility/twi.h"
6
+#include "Wire.h"
7
+
8
+// Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro
9
+#define DIGIPOT_I2C_FACTOR 106.7
10
+#define DIGIPOT_I2C_MAX_CURRENT 2.5
11
+
12
+static byte current_to_wiper( float current ){
13
+    return byte(ceil(float((DIGIPOT_I2C_FACTOR*current))));
14
+}
15
+
16
+static void i2c_send(byte addr, byte a, byte b)
17
+{
18
+	Wire.beginTransmission(addr);
19
+    Wire.write(a);
20
+    Wire.write(b);
21
+    Wire.endTransmission();
22
+}
23
+
24
+// This is for the MCP4451 I2C based digipot
25
+void digipot_i2c_set_current( int channel, float current )
26
+{
27
+    current = min( (float) max( current, 0.0f ), DIGIPOT_I2C_MAX_CURRENT);
28
+    // these addresses are specific to Azteeg X3 Pro, can be set to others,
29
+    // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
30
+    byte addr= 0x2C; // channel 0-3
31
+    if(channel >= 4) {
32
+    	addr= 0x2E; // channel 4-7
33
+    	channel-= 4;
34
+    }
35
+
36
+    // Initial setup
37
+    i2c_send( addr, 0x40, 0xff );
38
+    i2c_send( addr, 0xA0, 0xff );
39
+
40
+    // Set actual wiper value
41
+    byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 };
42
+    i2c_send( addr, addresses[channel], current_to_wiper(current) );
43
+}
44
+
45
+void digipot_i2c_init()
46
+{
47
+    const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS;
48
+    Wire.begin();
49
+    // setup initial currents as defined in Configuration_adv.h
50
+    for(int i=0;i<=sizeof(digipot_motor_current)/sizeof(float);i++) {
51
+        digipot_i2c_set_current(i, digipot_motor_current[i]);
52
+    }
53
+}
54
+#endif

+ 120
- 118
Marlin/pins.h Переглянути файл

@@ -375,7 +375,7 @@
375 375
 * Arduino Mega pin assignment
376 376
 *
377 377
 ****************************************************************************************/
378
-#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67
378
+#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 || MOTHERBOARD == 68
379 379
 #define KNOWN_BOARD 1
380 380
 
381 381
 //////////////////FIX THIS//////////////
@@ -391,10 +391,10 @@
391 391
 // #define RAMPS_V_1_0
392 392
 
393 393
 
394
-#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67
394
+#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 || MOTHERBOARD == 68
395 395
 
396 396
   #define LARGE_FLASH true
397
-  
397
+
398 398
   #if MOTHERBOARD == 77
399 399
     #define X_STEP_PIN         54
400 400
     #define X_DIR_PIN          55
@@ -434,7 +434,7 @@
434 434
     #define SDSS               25//53
435 435
     #define LED_PIN            13
436 436
 
437
-    #define BEEPER             33    
437
+    #define BEEPER             33
438 438
 
439 439
   #else
440 440
 
@@ -477,16 +477,16 @@
477 477
     #define LED_PIN            13
478 478
   #endif
479 479
 
480
-  #if MOTHERBOARD == 33 || MOTHERBOARD == 35 || MOTHERBOARD == 67
480
+  #if MOTHERBOARD == 33 || MOTHERBOARD == 35 || MOTHERBOARD == 67 || MOTHERBOARD == 68
481 481
     #define FAN_PIN            9 // (Sprinter config)
482 482
   #else
483 483
     #define FAN_PIN            4 // IO pin. Buffer needed
484 484
   #endif
485 485
 
486 486
   #if MOTHERBOARD == 77
487
-    #define FAN_PIN            8 
487
+    #define FAN_PIN            8
488 488
   #endif
489
-  
489
+
490 490
   #if MOTHERBOARD == 35
491 491
     #define CONTROLLERFAN_PIN  10 //Pin used for the fan to cool controller
492 492
   #endif
@@ -511,12 +511,12 @@
511 511
     #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
512 512
   #endif
513 513
 
514
-  #define HEATER_2_PIN       -1 
514
+  #define HEATER_2_PIN       -1
515 515
 
516 516
   #if MOTHERBOARD == 77
517
-    #define HEATER_0_PIN       10   
518
-    #define HEATER_1_PIN       12 
519
-    #define HEATER_2_PIN       6   
517
+    #define HEATER_0_PIN       10
518
+    #define HEATER_1_PIN       12
519
+    #define HEATER_2_PIN       6
520 520
   #endif
521 521
 
522 522
   #define TEMP_0_PIN         13   // ANALOG NUMBERING
@@ -534,8 +534,6 @@
534 534
   #endif
535 535
   #define TEMP_BED_PIN       14   // ANALOG NUMBERING
536 536
 
537
-
538
-
539 537
   #ifdef NUM_SERVOS
540 538
     #define SERVO0_PIN         11
541 539
 
@@ -552,20 +550,24 @@
552 550
     #endif
553 551
   #endif
554 552
 
553
+  #if MOTHERBOARD == 68
554
+    #define BEEPER 33
555
+  #endif
556
+
555 557
   #ifdef TEMP_STAT_LEDS
556 558
     #if MOTHERBOARD == 67
557 559
       #define STAT_LED_RED       6
558 560
       #define STAT_LED_BLUE     11
559 561
     #endif
560 562
   #endif
561
-  
563
+
562 564
   #ifdef ULTRA_LCD
563 565
 
564 566
     #ifdef NEWPANEL
565
-      #define LCD_PINS_RS 16 
567
+      #define LCD_PINS_RS 16
566 568
       #define LCD_PINS_ENABLE 17
567 569
       #define LCD_PINS_D4 23
568
-      #define LCD_PINS_D5 25 
570
+      #define LCD_PINS_D5 25
569 571
       #define LCD_PINS_D6 27
570 572
       #define LCD_PINS_D7 29
571 573
 
@@ -613,25 +615,25 @@
613 615
         #else
614 616
           #define SDCARDDETECT -1  // Ramps does not use this port
615 617
         #endif
616
-    
618
+
617 619
       #endif
618
-    
619
-      #if MOTHERBOARD == 77 
620
-        #define BEEPER -1 
621
-
622
-        #define LCD_PINS_RS 27 
623
-        #define LCD_PINS_ENABLE 29 
624
-        #define LCD_PINS_D4 37 
625
-        #define LCD_PINS_D5 35 
626
-        #define LCD_PINS_D6 33 
627
-        #define LCD_PINS_D7 31 
628
-
629
-       //buttons 
630
-       #define BTN_EN1 16 
631
-       #define BTN_EN2 17 
632
-       #define BTN_ENC 23 //the click 
633
-
634
-    #endif 
620
+
621
+      #if MOTHERBOARD == 77
622
+        #define BEEPER -1
623
+
624
+        #define LCD_PINS_RS 27
625
+        #define LCD_PINS_ENABLE 29
626
+        #define LCD_PINS_D4 37
627
+        #define LCD_PINS_D5 35
628
+        #define LCD_PINS_D6 33
629
+        #define LCD_PINS_D7 31
630
+
631
+       //buttons
632
+       #define BTN_EN1 16
633
+       #define BTN_EN2 17
634
+       #define BTN_ENC 23 //the click
635
+
636
+    #endif
635 637
     #else //old style panel with shift register
636 638
       //arduino pin witch triggers an piezzo beeper
637 639
       #define BEEPER 33		//No Beeper added
@@ -642,14 +644,14 @@
642 644
       //#define SHIFT_LD 42
643 645
       //#define SHIFT_OUT 40
644 646
       //#define SHIFT_EN 17
645
-    
646
-      #define LCD_PINS_RS 16 
647
+
648
+      #define LCD_PINS_RS 16
647 649
       #define LCD_PINS_ENABLE 17
648 650
       #define LCD_PINS_D4 23
649
-      #define LCD_PINS_D5 25 
651
+      #define LCD_PINS_D5 25
650 652
       #define LCD_PINS_D6 27
651 653
       #define LCD_PINS_D7 29
652
-    #endif 
654
+    #endif
653 655
   #endif //ULTRA_LCD
654 656
 
655 657
 #else // RAMPS_V_1_1 or RAMPS_V_1_2 as default (MOTHERBOARD == 3)
@@ -694,16 +696,16 @@
694 696
 #define HEATER_1_PIN        -1
695 697
 #define HEATER_2_PIN        -1
696 698
 #define TEMP_0_PIN          2    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
697
-#define TEMP_1_PIN          -1   
698
-#define TEMP_2_PIN          -1   
699
+#define TEMP_1_PIN          -1
700
+#define TEMP_2_PIN          -1
699 701
 #define TEMP_BED_PIN        1    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
700 702
 
701 703
 #endif // MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77
702 704
 
703
-// SPI for Max6675 Thermocouple 
705
+// SPI for Max6675 Thermocouple
704 706
 
705 707
 #ifndef SDSUPPORT
706
-// these pins are defined in the SD library if building with SD support  
708
+// these pins are defined in the SD library if building with SD support
707 709
   #define MAX_SCK_PIN          52
708 710
   #define MAX_MISO_PIN         50
709 711
   #define MAX_MOSI_PIN         51
@@ -837,17 +839,17 @@
837 839
   #define BTN_EN1          14
838 840
   #define BTN_EN2          39
839 841
   #define BTN_ENC          15  //the click
840
-    
842
+
841 843
   #define BLEN_C           2
842 844
   #define BLEN_B           1
843 845
   #define BLEN_A           0
844
-    
846
+
845 847
   //encoder rotation values
846 848
   #define encrot0          0
847 849
   #define encrot1          2
848 850
   #define encrot2          3
849 851
   #define encrot3          1
850
-  
852
+
851 853
 #endif //RA_CONTROL_PANEL
852 854
 
853 855
 #ifdef RA_DISCO
@@ -861,7 +863,7 @@
861 863
   //This currently only works with the RA Board.
862 864
   #define TLC_CLOCK_BIT 3 //bit 3 on port A
863 865
   #define TLC_CLOCK_PORT &PORTA //bit 3 on port A
864
-  
866
+
865 867
   #define TLC_BLANK_BIT 1 //bit 1 on port A
866 868
   #define TLC_BLANK_PORT &PORTA //bit 1 on port A
867 869
 
@@ -871,12 +873,12 @@
871 873
   #define TLC_XLAT_BIT 0 //bit 0 on port A
872 874
   #define TLC_XLAT_PORT &PORTA //bit 0 on port A
873 875
 
874
-  //change this to match your situation. Lots of TLCs takes up the arduino SRAM very quickly, so be careful 
876
+  //change this to match your situation. Lots of TLCs takes up the arduino SRAM very quickly, so be careful
875 877
   //Leave it at at least 1 if you have enabled RA_LIGHTING
876 878
   //The number of TLC5947 boards chained together for use with the animation, additional ones will repeat the animation on them, but are not individually addressable and mimic those before them. You can leave the default at 2 even if you only have 1 TLC5947 module.
877
-  #define NUM_TLCS 2 
879
+  #define NUM_TLCS 2
878 880
 
879
-  //These TRANS_ARRAY values let you change the order the LEDs on the lighting modules will animate for chase functions. 
881
+  //These TRANS_ARRAY values let you change the order the LEDs on the lighting modules will animate for chase functions.
880 882
   //Modify them according to your specific situation.
881 883
   //NOTE: the array should be 8 long for every TLC you have. These defaults assume (2) TLCs.
882 884
   #define TRANS_ARRAY {0, 1, 2, 3, 4, 5, 6, 7, 15, 14, 13, 12, 11, 10, 9, 8} //forwards
@@ -1085,8 +1087,8 @@
1085 1087
        #define LCD_PINS_D7        27
1086 1088
      #endif
1087 1089
      //The encoder and click button
1088
-     #define BTN_EN1 11  
1089
-     #define BTN_EN2 10 
1090
+     #define BTN_EN1 11
1091
+     #define BTN_EN2 10
1090 1092
      #ifdef LCD_I2C_PANELOLU2
1091 1093
        #ifdef MELZI
1092 1094
          #define BTN_ENC 29 //the click switch
@@ -1098,8 +1100,8 @@
1098 1100
        #define BTN_ENC 16  //the click switch
1099 1101
      #endif //Panelolu2
1100 1102
      //not connected to a pin
1101
-     #define SDCARDDETECT -1    
1102
-    
1103
+     #define SDCARDDETECT -1
1104
+
1103 1105
    #endif //Newpanel
1104 1106
  #endif //Ultipanel
1105 1107
 
@@ -1121,7 +1123,7 @@
1121 1123
      #define BTN_EN2 10
1122 1124
      #define BTN_ENC 16  //the click switch
1123 1125
      //not connected to a pin
1124
-     #define SDCARDDETECT -1    
1126
+     #define SDCARDDETECT -1
1125 1127
  #endif //Makrpanel
1126 1128
 
1127 1129
 #endif
@@ -1204,9 +1206,9 @@
1204 1206
     #define BTN_EN1 40
1205 1207
     #define BTN_EN2 42
1206 1208
     #define BTN_ENC 19  //the click
1207
-    
1209
+
1208 1210
     #define SDCARDDETECT 38
1209
-    
1211
+
1210 1212
   #else //old style panel with shift register
1211 1213
     //arduino pin witch triggers an piezzo beeper
1212 1214
     #define BEEPER 18
@@ -1223,9 +1225,9 @@
1223 1225
     #define LCD_PINS_D5 21
1224 1226
     #define LCD_PINS_D6 20
1225 1227
     #define LCD_PINS_D7 19
1226
-  
1228
+
1227 1229
     #define SDCARDDETECT -1
1228
-  #endif 
1230
+  #endif
1229 1231
 #endif //ULTRA_LCD
1230 1232
 
1231 1233
 #endif
@@ -1358,7 +1360,7 @@
1358 1360
 #define MOTOR_CURRENT_PWM_Z_PIN 45
1359 1361
 #define MOTOR_CURRENT_PWM_E_PIN 46
1360 1362
 //Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
1361
-#define MOTOR_CURRENT_PWM_RANGE 2000
1363
+#define MOTOR_CURRENT_PWM_RANGE 2000
1362 1364
 #define DEFAULT_PWM_MOTOR_CURRENT  {1300, 1300, 1250}
1363 1365
 
1364 1366
 //arduino pin witch triggers an piezzo beeper
@@ -1443,7 +1445,7 @@
1443 1445
  #else
1444 1446
   #define TEMP_0_PIN         15   // ANALOG NUMBERING - default connector for thermistor *T0* on rumba board is used
1445 1447
  #endif
1446
-#endif 
1448
+#endif
1447 1449
 
1448 1450
 #if (TEMP_SENSOR_1==0)
1449 1451
  #define TEMP_1_PIN         -1
@@ -2153,13 +2155,13 @@
2153 2155
     #define BTN_EN1 59
2154 2156
     #define BTN_EN2 64
2155 2157
     #define BTN_ENC 43  //the click
2156
-    
2158
+
2157 2159
     #define BLEN_C 2
2158 2160
     #define BLEN_B 1
2159 2161
     #define BLEN_A 0
2160
-    
2162
+
2161 2163
     #define SDCARDDETECT -1		// Ramps does not use this port
2162
-    
2164
+
2163 2165
       //encoder rotation values
2164 2166
     #define encrot0 0
2165 2167
     #define encrot1 2
@@ -2176,102 +2178,102 @@
2176 2178
 ****************************************************************************************/
2177 2179
 #if MOTHERBOARD == 701
2178 2180
  #define KNOWN_BOARD 1
2179
- 
2180
- 
2181
+
2182
+
2181 2183
  #ifndef __AVR_ATmega2560__
2182 2184
  #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
2183 2185
  #endif
2184
- 
2186
+
2185 2187
  #define LARGE_FLASH        true
2186
- 
2188
+
2187 2189
  #define X_STEP_PIN 26
2188 2190
  #define X_DIR_PIN 27
2189 2191
  #define X_ENABLE_PIN 25
2190 2192
  #define X_MIN_PIN 37
2191 2193
  #define X_MAX_PIN 40 //2 //Max endstops default to disabled "-1", set to commented value to enable.
2192
- 
2194
+
2193 2195
  #define Y_STEP_PIN 4 // A6
2194 2196
  #define Y_DIR_PIN 54 // A0
2195 2197
  #define Y_ENABLE_PIN 5
2196 2198
  #define Y_MIN_PIN 41
2197 2199
  #define Y_MAX_PIN 38 //15
2198
- 
2200
+
2199 2201
  #define Z_STEP_PIN 56 // A2
2200 2202
  #define Z_DIR_PIN 60 // A6
2201 2203
  #define Z_ENABLE_PIN 55 // A1
2202 2204
  #define Z_MIN_PIN 18
2203 2205
  #define Z_MAX_PIN 19
2204
- 
2206
+
2205 2207
  #define E0_STEP_PIN 35
2206 2208
  #define E0_DIR_PIN 36
2207 2209
  #define E0_ENABLE_PIN 34
2208
- 
2210
+
2209 2211
  #define E1_STEP_PIN 29
2210 2212
  #define E1_DIR_PIN 39
2211 2213
  #define E1_ENABLE_PIN 28
2212
- 
2214
+
2213 2215
  #define E2_STEP_PIN 23
2214 2216
  #define E2_DIR_PIN 24
2215 2217
  #define E2_ENABLE_PIN 22
2216
- 
2218
+
2217 2219
  #define SDPOWER -1
2218 2220
  #define SDSS 53
2219 2221
  #define LED_PIN 13
2220
- 
2222
+
2221 2223
  #define FAN_PIN 7
2222 2224
  #define FAN2_PIN 6
2223 2225
  #define PS_ON_PIN 12
2224 2226
  #define KILL_PIN -1
2225
- 
2227
+
2226 2228
  #define HEATER_0_PIN 9 // EXTRUDER 1
2227 2229
  #define HEATER_1_PIN 8 // EXTRUDER 2
2228 2230
  #define HEATER_2_PIN -1
2229
- 
2231
+
2230 2232
  #if TEMP_SENSOR_0 == -1
2231 2233
    #define TEMP_0_PIN 4 // ANALOG NUMBERING
2232 2234
  #else
2233 2235
    #define TEMP_0_PIN 13 // ANALOG NUMBERING
2234 2236
  #endif
2235
- 
2236
- 
2237
+
2238
+
2237 2239
  #if TEMP_SENSOR_1 == -1
2238 2240
    #define TEMP_1_PIN 8 // ANALOG NUMBERING
2239 2241
  #else
2240 2242
    #define TEMP_1_PIN 15 // ANALOG NUMBERING
2241 2243
  #endif
2242
- 
2244
+
2243 2245
  #define TEMP_2_PIN -1 // ANALOG NUMBERING
2244
- 
2246
+
2245 2247
  #define HEATER_BED_PIN 10 // BED
2246
- 
2248
+
2247 2249
  #if TEMP_SENSOR_BED == -1
2248 2250
    #define TEMP_BED_PIN 8 // ANALOG NUMBERING
2249
- #else 
2251
+ #else
2250 2252
    #define TEMP_BED_PIN 14 // ANALOG NUMBERING
2251 2253
  #endif
2252
- 
2253
- #define BEEPER 64	
2254
- 
2255
- 
2254
+
2255
+ #define BEEPER 64
2256
+
2257
+
2256 2258
  #define LCD_PINS_RS 14
2257 2259
  #define LCD_PINS_ENABLE 15
2258 2260
  #define LCD_PINS_D4 30
2259 2261
  #define LCD_PINS_D5 31
2260 2262
  #define LCD_PINS_D6 32
2261 2263
  #define LCD_PINS_D7 33
2262
- 
2263
- 
2264
+
2265
+
2264 2266
  //buttons are directly attached using keypad
2265 2267
  #define BTN_EN1 61
2266 2268
  #define BTN_EN2 59
2267 2269
  #define BTN_ENC 43 //the click
2268
- 
2270
+
2269 2271
  #define BLEN_C 2
2270 2272
  #define BLEN_B 1
2271 2273
  #define BLEN_A 0
2272
- 
2274
+
2273 2275
  #define SDCARDDETECT -1	// Megatronics does not use this port
2274
- 
2276
+
2275 2277
    //encoder rotation values
2276 2278
  #define encrot0 0
2277 2279
  #define encrot1 2
@@ -2287,87 +2289,87 @@
2287 2289
 ****************************************************************************************/
2288 2290
 #if MOTHERBOARD == 702
2289 2291
  #define KNOWN_BOARD 1
2290
- 
2291
- 
2292
+
2293
+
2292 2294
  #ifndef __AVR_ATmega1281__
2293 2295
  #error Oops! Make sure you have 'Minitronics ' selected from the 'Tools -> Boards' menu.
2294 2296
  #endif
2295
- 
2297
+
2296 2298
  #define LARGE_FLASH        true
2297
- 
2299
+
2298 2300
  #define X_STEP_PIN 48
2299 2301
  #define X_DIR_PIN 47
2300 2302
  #define X_ENABLE_PIN 49
2301 2303
  #define X_MIN_PIN 5
2302 2304
  #define X_MAX_PIN -1 //2 //Max endstops default to disabled "-1", set to commented value to enable.
2303
- 
2305
+
2304 2306
  #define Y_STEP_PIN 39 // A6
2305 2307
  #define Y_DIR_PIN 40 // A0
2306 2308
  #define Y_ENABLE_PIN 38
2307 2309
  #define Y_MIN_PIN 2
2308 2310
  #define Y_MAX_PIN -1 //15
2309
- 
2311
+
2310 2312
  #define Z_STEP_PIN 42 // A2
2311 2313
  #define Z_DIR_PIN 43 // A6
2312 2314
  #define Z_ENABLE_PIN 41 // A1
2313 2315
  #define Z_MIN_PIN 6
2314 2316
  #define Z_MAX_PIN -1
2315
- 
2317
+
2316 2318
  #define E0_STEP_PIN 45
2317 2319
  #define E0_DIR_PIN 44
2318 2320
  #define E0_ENABLE_PIN 27
2319
- 
2321
+
2320 2322
  #define E1_STEP_PIN 36
2321 2323
  #define E1_DIR_PIN 35
2322 2324
  #define E1_ENABLE_PIN 37
2323
- 
2325
+
2324 2326
  #define E2_STEP_PIN -1
2325 2327
  #define E2_DIR_PIN -1
2326 2328
  #define E2_ENABLE_PIN -1
2327
- 
2329
+
2328 2330
  #define SDPOWER -1
2329 2331
  #define SDSS 16
2330 2332
  #define LED_PIN 46
2331
- 
2333
+
2332 2334
  #define FAN_PIN 9
2333 2335
  #define FAN2_PIN -1
2334 2336
  #define PS_ON_PIN -1
2335 2337
  #define KILL_PIN -1
2336
- 
2338
+
2337 2339
  #define HEATER_0_PIN 7 // EXTRUDER 1
2338 2340
  #define HEATER_1_PIN 8 // EXTRUDER 2
2339 2341
  #define HEATER_2_PIN -1
2340
- 
2342
+
2341 2343
 
2342 2344
  #define TEMP_0_PIN 7 // ANALOG NUMBERING
2343 2345
  #define TEMP_1_PIN 6 // ANALOG NUMBERING
2344 2346
  #define TEMP_2_PIN -1 // ANALOG NUMBERING
2345
- 
2347
+
2346 2348
  #define HEATER_BED_PIN 3 // BED
2347 2349
  #define TEMP_BED_PIN 6 // ANALOG NUMBERING
2348
- 
2349
- #define BEEPER -1	
2350
- 
2351
- 
2350
+
2351
+ #define BEEPER -1
2352
+
2353
+
2352 2354
  #define LCD_PINS_RS -1
2353 2355
  #define LCD_PINS_ENABLE -1
2354 2356
  #define LCD_PINS_D4 -1
2355 2357
  #define LCD_PINS_D5 -1
2356 2358
  #define LCD_PINS_D6 -1
2357 2359
  #define LCD_PINS_D7 -1
2358
- 
2359
- 
2360
+
2361
+
2360 2362
  //buttons are directly attached using keypad
2361 2363
  #define BTN_EN1 -1
2362 2364
  #define BTN_EN2 -1
2363 2365
  #define BTN_ENC -1 //the click
2364
- 
2366
+
2365 2367
  #define BLEN_C 2
2366 2368
  #define BLEN_B 1
2367 2369
  #define BLEN_A 0
2368
- 
2370
+
2369 2371
  #define SDCARDDETECT -1	// Megatronics does not use this port
2370
- 
2372
+
2371 2373
    //encoder rotation values
2372 2374
  #define encrot0 0
2373 2375
  #define encrot1 2
@@ -2393,7 +2395,7 @@
2393 2395
  #define X_STEP_PIN 14
2394 2396
  #define X_DIR_PIN 15
2395 2397
  #define X_ENABLE_PIN 24
2396
- 
2398
+
2397 2399
  //X endstop
2398 2400
  #define X_MIN_PIN 3
2399 2401
  #define X_MAX_PIN -1
@@ -2406,7 +2408,7 @@
2406 2408
  //Y endstop
2407 2409
  #define Y_MIN_PIN 2
2408 2410
  #define Y_MAX_PIN -1
2409
- 
2411
+
2410 2412
  //Z motor stepper
2411 2413
  #define Z_STEP_PIN 40
2412 2414
  #define Z_DIR_PIN 41
@@ -2415,7 +2417,7 @@
2415 2417
  //Z endstop
2416 2418
  #define Z_MIN_PIN 5
2417 2419
  #define Z_MAX_PIN -1
2418
- 
2420
+
2419 2421
  //Extruder 0 stepper
2420 2422
  #define E0_STEP_PIN 26
2421 2423
  #define E0_DIR_PIN 28
@@ -2442,7 +2444,7 @@
2442 2444
  #define HEATER_BED_PIN 22
2443 2445
  //Cheaptronic v1.0 hasent EXTRUDER 3
2444 2446
  #define HEATER_2_PIN -1
2445
- 
2447
+
2446 2448
  //Temperature sensors
2447 2449
  #define TEMP_0_PIN 15
2448 2450
  #define TEMP_1_PIN 14

Завантаження…
Відмінити
Зберегти