Преглед изворни кода

Merged from Upstream Master

xifle пре 12 година
родитељ
комит
9eeb711c96

+ 106
- 43
Marlin/Configuration.h Прегледај датотеку

@@ -2,7 +2,7 @@
2 2
 #define CONFIGURATION_H
3 3
 
4 4
 // This configurtion file contains the basic settings.
5
-// Advanced settings can be found in Configuration_adv.h 
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 8
 //User specified version info of this build to display in [Pronterface, etc] terminal window during startup.
@@ -51,6 +51,9 @@
51 51
 #define MOTHERBOARD 7
52 52
 #endif
53 53
 
54
+// This defines the number of extruders
55
+#define EXTRUDERS 1
56
+
54 57
 //// The following define selects which power supply you have. Please choose the one that matches your setup
55 58
 // 1 = ATX
56 59
 // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
@@ -78,7 +81,7 @@
78 81
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
79 82
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
80 83
 //
81
-//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k 
84
+//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
82 85
 //                          (but gives greater accuracy and more stable PID)
83 86
 // 51 is 100k thermistor - EPCOS (1k pullup)
84 87
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
@@ -90,12 +93,12 @@
90 93
 #define TEMP_SENSOR_BED 0
91 94
 
92 95
 // Actual temperature must be close to target for this long before M109 returns success
93
-#define TEMP_RESIDENCY_TIME 10	// (seconds)
96
+#define TEMP_RESIDENCY_TIME 10  // (seconds)
94 97
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
95 98
 #define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
96 99
 
97 100
 // 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. 
101
+// to check that the wiring to the thermistor is not broken.
99 102
 // Otherwise this would lead to the heater being powered on all the time.
100 103
 #define HEATER_0_MINTEMP 5
101 104
 #define HEATER_1_MINTEMP 5
@@ -121,7 +124,7 @@
121 124
 #define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
122 125
 #define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
123 126
 #ifdef PIDTEMP
124
-  //#define PID_DEBUG // Sends debug data to the serial port. 
127
+  //#define PID_DEBUG // Sends debug data to the serial port.
125 128
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
126 129
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
127 130
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
@@ -132,15 +135,15 @@
132 135
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
133 136
 // Ultimaker
134 137
     #define  DEFAULT_Kp 22.2
135
-    #define  DEFAULT_Ki 1.08  
136
-    #define  DEFAULT_Kd 114  
138
+    #define  DEFAULT_Ki 1.08
139
+    #define  DEFAULT_Kd 114
137 140
 
138 141
 // Makergear
139 142
 //    #define  DEFAULT_Kp 7.0
140
-//    #define  DEFAULT_Ki 0.1  
141
-//    #define  DEFAULT_Kd 12  
143
+//    #define  DEFAULT_Ki 0.1
144
+//    #define  DEFAULT_Kd 12
142 145
 
143
-// Mendel Parts V9 on 12V    
146
+// Mendel Parts V9 on 12V
144 147
 //    #define  DEFAULT_Kp 63.0
145 148
 //    #define  DEFAULT_Ki 2.25
146 149
 //    #define  DEFAULT_Kd 440
@@ -149,11 +152,11 @@
149 152
 // Bed Temperature Control
150 153
 // Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
151 154
 //
152
-// uncomment this to enable PID on the bed.   It uses the same ferquency PWM as the extruder. 
155
+// uncomment this to enable PID on the bed.   It uses the same ferquency PWM as the extruder.
153 156
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
154 157
 // 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 
158
+// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
159
+// If your configuration is significantly different than this and you don't understand the issues involved, you proabaly
157 160
 // shouldn't use bed PID until someone else verifies your hardware works.
158 161
 // If this is enabled, find your own PID constants below.
159 162
 //#define PIDTEMPBED
@@ -223,9 +226,9 @@
223 226
 #endif
224 227
 
225 228
 // 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. 
229
+const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
230
+const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
231
+const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
229 232
 //#define DISABLE_MAX_ENDSTOPS
230 233
 
231 234
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
@@ -280,13 +283,13 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
280 283
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
281 284
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
282 285
 
283
-// default settings 
286
+// default settings
284 287
 
285 288
 #define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for ultimaker
286 289
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
287 290
 #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 291
 
289
-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
292
+#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
290 293
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
291 294
 
292 295
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
@@ -307,7 +310,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
307 310
 // EEPROM
308 311
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
309 312
 // M500 - stores paramters in EEPROM
310
-// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
313
+// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
311 314
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
312 315
 //define this to enable eeprom support
313 316
 //#define EEPROM_SETTINGS
@@ -315,9 +318,18 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
315 318
 // please keep turned on if you can.
316 319
 //#define EEPROM_CHITCHAT
317 320
 
321
+// Preheat Constants
322
+#define PLA_PREHEAT_HOTEND_TEMP 180 
323
+#define PLA_PREHEAT_HPB_TEMP 70
324
+#define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
325
+
326
+#define ABS_PREHEAT_HOTEND_TEMP 240
327
+#define ABS_PREHEAT_HPB_TEMP 100
328
+#define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
329
+
318 330
 //LCD and SD support
319 331
 //#define ULTRA_LCD  //general lcd support, also 16x2
320
-//#define DOGLCD	// Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
332
+//#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
321 333
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
322 334
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
323 335
 
@@ -353,43 +365,74 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
353 365
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
354 366
  #define ULTIPANEL
355 367
  #define NEWPANEL
356
-#endif 
368
+#endif
357 369
 
358 370
 #if defined(REPRAPWORLD_KEYPAD)
359 371
   #define NEWPANEL
360 372
   #define ULTIPANEL
361 373
 #endif
362 374
 
363
-// Preheat Constants
364
-#define PLA_PREHEAT_HOTEND_TEMP 180 
365
-#define PLA_PREHEAT_HPB_TEMP 70
366
-#define PLA_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
375
+//I2C PANELS
367 376
 
368
-#define ABS_PREHEAT_HOTEND_TEMP 240
369
-#define ABS_PREHEAT_HPB_TEMP 100
370
-#define ABS_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
377
+//#define LCD_I2C_SAINSMART_YWROBOT
378
+#ifdef LCD_I2C_SAINSMART_YWROBOT
379
+  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
380
+  // Make sure it is placed in the Arduino libraries directory.
381
+  #define LCD_I2C_TYPE_PCF8575
382
+  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
383
+  #define NEWPANEL
384
+  #define ULTIPANEL 
385
+#endif
371 386
 
387
+// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
388
+//#define LCD_I2C_PANELOLU2
389
+#ifdef LCD_I2C_PANELOLU2
390
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
391
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
392
+  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
393
+  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin 
394
+  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). 
395
+  #define LCD_I2C_TYPE_MCP23017
396
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
397
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
398
+  #define NEWPANEL
399
+  #define ULTIPANEL 
400
+#endif
401
+
402
+// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
403
+//#define LCD_I2C_VIKI
404
+#ifdef LCD_I2C_VIKI
405
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
406
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
407
+  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
408
+  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
409
+  #define LCD_I2C_TYPE_MCP23017 
410
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
411
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
412
+  #define NEWPANEL
413
+  #define ULTIPANEL 
414
+#endif
372 415
 
373 416
 #ifdef ULTIPANEL
374 417
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
375 418
   #define SDSUPPORT
376 419
   #define ULTRA_LCD
377
-	#ifdef DOGLCD	// Change number of lines to match the DOG graphic display
378
-		#define LCD_WIDTH 20
379
-		#define LCD_HEIGHT 5
380
-	#else
381
-		#define LCD_WIDTH 20
382
-		#define LCD_HEIGHT 4
383
-	#endif
384
-#else //no panel but just lcd 
420
+  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
421
+    #define LCD_WIDTH 20
422
+    #define LCD_HEIGHT 5
423
+  #else
424
+    #define LCD_WIDTH 20
425
+    #define LCD_HEIGHT 4
426
+  #endif
427
+#else //no panel but just lcd
385 428
   #ifdef ULTRA_LCD
386
-	#ifdef DOGLCD	// Change number of lines to match the 128x64 graphics display
387
-		#define LCD_WIDTH 20
388
-		#define LCD_HEIGHT 5
389
-	#else
390
-		#define LCD_WIDTH 16
391
-		#define LCD_HEIGHT 2
392
-	#endif    
429
+  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
430
+    #define LCD_WIDTH 20
431
+    #define LCD_HEIGHT 5
432
+  #else
433
+    #define LCD_WIDTH 16
434
+    #define LCD_HEIGHT 2
435
+  #endif
393 436
   #endif
394 437
 #endif
395 438
 
@@ -403,6 +446,26 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
403 446
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
404 447
 //#define SF_ARC_FIX
405 448
 
449
+// Support for the BariCUDA Paste Extruder.
450
+//#define BARICUDA
451
+
452
+/*********************************************************************\
453
+*
454
+* R/C SERVO support
455
+*
456
+* Sponsored by TrinityLabs, Reworked by codexmas
457
+*
458
+**********************************************************************/
459
+
460
+// Number of servos
461
+//
462
+// If you select a configuration below, this will receive a default value and does not need to be set manually
463
+// set it manually if you have more servos than extruders and wish to manually control some
464
+// leaving it undefined or defining as 0 will disable the servo subsystem
465
+// If unsure, leave commented / disabled
466
+//
467
+// #define NUM_SERVOS 3
468
+
406 469
 #include "Configuration_adv.h"
407 470
 #include "thermistortables.h"
408 471
 

+ 19
- 9
Marlin/Configuration_adv.h Прегледај датотеку

@@ -63,21 +63,31 @@
63 63
 //This is for controlling a fan to cool down the stepper drivers
64 64
 //it will turn on when any driver is enabled
65 65
 //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
66
+#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
67
+#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
68
+#define CONTROLLERFAN_SPEED 255  // == full speed
68 69
 
69 70
 // When first starting the main fan, run it at full speed for the
70 71
 // given number of milliseconds.  This gets the fan spinning reliably
71 72
 // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
72 73
 //#define FAN_KICKSTART_TIME 100
73 74
 
75
+// Extruder cooling fans
76
+// Configure fan pin outputs to automatically turn on/off when the associated
77
+// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
78
+// Multiple extruders can be assigned to the same pin in which case 
79
+// the fan will turn on when any selected extruder is above the threshold.
80
+#define EXTRUDER_0_AUTO_FAN_PIN   -1
81
+#define EXTRUDER_1_AUTO_FAN_PIN   -1
82
+#define EXTRUDER_2_AUTO_FAN_PIN   -1
83
+#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
84
+#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
85
+
86
+
74 87
 //===========================================================================
75 88
 //=============================Mechanical Settings===========================
76 89
 //===========================================================================
77 90
 
78
-// This defines the number of extruders
79
-#define EXTRUDERS 1
80
-
81 91
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
82 92
 
83 93
 
@@ -210,9 +220,9 @@
210 220
 //  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 221
 //#define WATCHDOG_RESET_MANUAL
212 222
 #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
223
+
224
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
225
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
216 226
 
217 227
 // extruder advance constant (s2/mm3)
218 228
 //
@@ -276,7 +286,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
276 286
 #else
277 287
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
278 288
 #endif
279
-
289
+
280 290
 
281 291
 //The ASCII buffer for recieving from the serial:
282 292
 #define MAX_CMD_SIZE 96

+ 10
- 10
Marlin/Makefile Прегледај датотеку

@@ -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
@@ -213,7 +213,7 @@ CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
213 213
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
214 214
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
215 215
 	watchdog.cpp
216
-CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp
216
+CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp Servo.cpp
217 217
 
218 218
 #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
219 219
 ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
@@ -317,19 +317,19 @@ endif
317 317
 # Default target.
318 318
 all: sizeafter
319 319
 
320
-build: $(BUILD_DIR) elf hex 
320
+build: $(BUILD_DIR) elf hex
321 321
 
322 322
 # Creates the object directory
323
-$(BUILD_DIR): 
323
+$(BUILD_DIR):
324 324
 	$P mkdir -p $(BUILD_DIR)
325 325
 
326 326
 elf: $(BUILD_DIR)/$(TARGET).elf
327 327
 hex: $(BUILD_DIR)/$(TARGET).hex
328 328
 eep: $(BUILD_DIR)/$(TARGET).eep
329
-lss: $(BUILD_DIR)/$(TARGET).lss 
329
+lss: $(BUILD_DIR)/$(TARGET).lss
330 330
 sym: $(BUILD_DIR)/$(TARGET).sym
331 331
 
332
-# Program the device.  
332
+# Program the device.
333 333
 # Do not try to reset an arduino if it's not one
334 334
 upload: $(BUILD_DIR)/$(TARGET).hex
335 335
 ifeq (${AVRDUDE_PROGRAMMER}, arduino)
@@ -356,7 +356,7 @@ COFFCONVERT=$(OBJCOPY) --debugging \
356 356
 	--change-section-address .data-0x800000 \
357 357
 	--change-section-address .bss-0x800000 \
358 358
 	--change-section-address .noinit-0x800000 \
359
-	--change-section-address .eeprom-0x810000 
359
+	--change-section-address .eeprom-0x810000
360 360
 
361 361
 
362 362
 coff: $(BUILD_DIR)/$(TARGET).elf

+ 4
- 0
Marlin/Marlin.h Прегледај датотеку

@@ -186,6 +186,10 @@ extern float add_homeing[3];
186 186
 extern float min_pos[3];
187 187
 extern float max_pos[3];
188 188
 extern int fanSpeed;
189
+#ifdef BARICUDA
190
+extern int ValvePressure;
191
+extern int EtoPPressure;
192
+#endif
189 193
 
190 194
 #ifdef FWRETRACT
191 195
 extern bool autoretract_enabled;

+ 11
- 5
Marlin/Marlin.pde Прегледај датотеку

@@ -34,11 +34,17 @@
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 50
 #if DIGIPOTSS_PIN > -1

+ 378
- 287
Marlin/Marlin_main.cpp
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 339
- 0
Marlin/Servo.cpp Прегледај датотеку

@@ -0,0 +1,339 @@
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
+#ifdef NUM_SERVOS
45
+#include <avr/interrupt.h>
46
+#include <Arduino.h>
47
+
48
+#include "Servo.h"
49
+
50
+#define usToTicks(_us)    (( clockCyclesPerMicrosecond()* _us) / 8)     // converts microseconds to tick (assumes prescale of 8)  // 12 Aug 2009
51
+#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
52
+
53
+
54
+#define TRIM_DURATION       2                               // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
55
+
56
+//#define NBR_TIMERS        (MAX_SERVOS / SERVOS_PER_TIMER)
57
+
58
+static servo_t servos[MAX_SERVOS];                          // static array of servo structures
59
+static volatile int8_t Channel[_Nbr_16timers ];             // counter for the servo being pulsed for each timer (or -1 if refresh interval)
60
+
61
+uint8_t ServoCount = 0;                                     // the total number of attached servos
62
+
63
+
64
+// convenience macros
65
+#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo
66
+#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER)       // returns the index of the servo on this timer
67
+#define SERVO_INDEX(_timer,_channel)  ((_timer*SERVOS_PER_TIMER) + _channel)     // macro to access servo index by timer and channel
68
+#define SERVO(_timer,_channel)  (servos[SERVO_INDEX(_timer,_channel)])            // macro to access servo class by timer and channel
69
+
70
+#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4)  // minimum value in uS for this servo
71
+#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4)  // maximum value in uS for this servo
72
+
73
+/************ static functions common to all instances ***********************/
74
+
75
+static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn, volatile uint16_t* OCRnA)
76
+{
77
+  if( Channel[timer] < 0 )
78
+    *TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
79
+  else{
80
+    if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive == true )
81
+      digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,LOW); // pulse this channel low if activated
82
+  }
83
+
84
+  Channel[timer]++;    // increment to the next channel
85
+  if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
86
+    *OCRnA = *TCNTn + SERVO(timer,Channel[timer]).ticks;
87
+    if(SERVO(timer,Channel[timer]).Pin.isActive == true)     // check if activated
88
+      digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high
89
+  }
90
+  else {
91
+    // finished all channels so wait for the refresh period to expire before starting over
92
+    if( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) )  // allow a few ticks to ensure the next OCR1A not missed
93
+      *OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
94
+    else
95
+      *OCRnA = *TCNTn + 4;  // at least REFRESH_INTERVAL has elapsed
96
+    Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
97
+  }
98
+}
99
+
100
+#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
101
+// Interrupt handlers for Arduino
102
+#if defined(_useTimer1)
103
+SIGNAL (TIMER1_COMPA_vect)
104
+{
105
+  handle_interrupts(_timer1, &TCNT1, &OCR1A);
106
+}
107
+#endif
108
+
109
+#if defined(_useTimer3)
110
+SIGNAL (TIMER3_COMPA_vect)
111
+{
112
+  handle_interrupts(_timer3, &TCNT3, &OCR3A);
113
+}
114
+#endif
115
+
116
+#if defined(_useTimer4)
117
+SIGNAL (TIMER4_COMPA_vect)
118
+{
119
+  handle_interrupts(_timer4, &TCNT4, &OCR4A);
120
+}
121
+#endif
122
+
123
+#if defined(_useTimer5)
124
+SIGNAL (TIMER5_COMPA_vect)
125
+{
126
+  handle_interrupts(_timer5, &TCNT5, &OCR5A);
127
+}
128
+#endif
129
+
130
+#elif defined WIRING
131
+// Interrupt handlers for Wiring
132
+#if defined(_useTimer1)
133
+void Timer1Service()
134
+{
135
+  handle_interrupts(_timer1, &TCNT1, &OCR1A);
136
+}
137
+#endif
138
+#if defined(_useTimer3)
139
+void Timer3Service()
140
+{
141
+  handle_interrupts(_timer3, &TCNT3, &OCR3A);
142
+}
143
+#endif
144
+#endif
145
+
146
+
147
+static void initISR(timer16_Sequence_t timer)
148
+{
149
+#if defined (_useTimer1)
150
+  if(timer == _timer1) {
151
+    TCCR1A = 0;             // normal counting mode
152
+    TCCR1B = _BV(CS11);     // set prescaler of 8
153
+    TCNT1 = 0;              // clear the timer count
154
+#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
155
+    TIFR |= _BV(OCF1A);      // clear any pending interrupts;
156
+    TIMSK |=  _BV(OCIE1A) ;  // enable the output compare interrupt
157
+#else
158
+    // here if not ATmega8 or ATmega128
159
+    TIFR1 |= _BV(OCF1A);     // clear any pending interrupts;
160
+    TIMSK1 |=  _BV(OCIE1A) ; // enable the output compare interrupt
161
+#endif
162
+#if defined(WIRING)
163
+    timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
164
+#endif
165
+  }
166
+#endif
167
+
168
+#if defined (_useTimer3)
169
+  if(timer == _timer3) {
170
+    TCCR3A = 0;             // normal counting mode
171
+    TCCR3B = _BV(CS31);     // set prescaler of 8
172
+    TCNT3 = 0;              // clear the timer count
173
+#if defined(__AVR_ATmega128__)
174
+    TIFR |= _BV(OCF3A);     // clear any pending interrupts;
175
+	ETIMSK |= _BV(OCIE3A);  // enable the output compare interrupt
176
+#else
177
+    TIFR3 = _BV(OCF3A);     // clear any pending interrupts;
178
+    TIMSK3 =  _BV(OCIE3A) ; // enable the output compare interrupt
179
+#endif
180
+#if defined(WIRING)
181
+    timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service);  // for Wiring platform only
182
+#endif
183
+  }
184
+#endif
185
+
186
+#if defined (_useTimer4)
187
+  if(timer == _timer4) {
188
+    TCCR4A = 0;             // normal counting mode
189
+    TCCR4B = _BV(CS41);     // set prescaler of 8
190
+    TCNT4 = 0;              // clear the timer count
191
+    TIFR4 = _BV(OCF4A);     // clear any pending interrupts;
192
+    TIMSK4 =  _BV(OCIE4A) ; // enable the output compare interrupt
193
+  }
194
+#endif
195
+
196
+#if defined (_useTimer5)
197
+  if(timer == _timer5) {
198
+    TCCR5A = 0;             // normal counting mode
199
+    TCCR5B = _BV(CS51);     // set prescaler of 8
200
+    TCNT5 = 0;              // clear the timer count
201
+    TIFR5 = _BV(OCF5A);     // clear any pending interrupts;
202
+    TIMSK5 =  _BV(OCIE5A) ; // enable the output compare interrupt
203
+  }
204
+#endif
205
+}
206
+
207
+static void finISR(timer16_Sequence_t timer)
208
+{
209
+    //disable use of the given timer
210
+#if defined WIRING   // Wiring
211
+  if(timer == _timer1) {
212
+    #if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
213
+    TIMSK1 &=  ~_BV(OCIE1A) ;  // disable timer 1 output compare interrupt
214
+    #else
215
+    TIMSK &=  ~_BV(OCIE1A) ;  // disable timer 1 output compare interrupt
216
+    #endif
217
+    timerDetach(TIMER1OUTCOMPAREA_INT);
218
+  }
219
+  else if(timer == _timer3) {
220
+    #if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
221
+    TIMSK3 &= ~_BV(OCIE3A);    // disable the timer3 output compare A interrupt
222
+    #else
223
+    ETIMSK &= ~_BV(OCIE3A);    // disable the timer3 output compare A interrupt
224
+    #endif
225
+    timerDetach(TIMER3OUTCOMPAREA_INT);
226
+  }
227
+#else
228
+    //For arduino - in future: call here to a currently undefined function to reset the timer
229
+#endif
230
+}
231
+
232
+static boolean isTimerActive(timer16_Sequence_t timer)
233
+{
234
+  // returns true if any servo is active on this timer
235
+  for(uint8_t channel=0; channel < SERVOS_PER_TIMER; channel++) {
236
+    if(SERVO(timer,channel).Pin.isActive == true)
237
+      return true;
238
+  }
239
+  return false;
240
+}
241
+
242
+
243
+/****************** end of static functions ******************************/
244
+
245
+Servo::Servo()
246
+{
247
+  if( ServoCount < MAX_SERVOS) {
248
+    this->servoIndex = ServoCount++;                    // assign a servo index to this instance
249
+	servos[this->servoIndex].ticks = usToTicks(DEFAULT_PULSE_WIDTH);   // store default values  - 12 Aug 2009
250
+  }
251
+  else
252
+    this->servoIndex = INVALID_SERVO ;  // too many servos
253
+}
254
+
255
+uint8_t Servo::attach(int pin)
256
+{
257
+  return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
258
+}
259
+
260
+uint8_t Servo::attach(int pin, int min, int max)
261
+{
262
+  if(this->servoIndex < MAX_SERVOS ) {
263
+    pinMode( pin, OUTPUT) ;                                   // set servo pin to output
264
+    servos[this->servoIndex].Pin.nbr = pin;
265
+    // todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
266
+    this->min  = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
267
+    this->max  = (MAX_PULSE_WIDTH - max)/4;
268
+    // initialize the timer if it has not already been initialized
269
+    timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
270
+    if(isTimerActive(timer) == false)
271
+      initISR(timer);
272
+    servos[this->servoIndex].Pin.isActive = true;  // this must be set after the check for isTimerActive
273
+  }
274
+  return this->servoIndex ;
275
+}
276
+
277
+void Servo::detach()
278
+{
279
+  servos[this->servoIndex].Pin.isActive = false;
280
+  timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
281
+  if(isTimerActive(timer) == false) {
282
+    finISR(timer);
283
+  }
284
+}
285
+
286
+void Servo::write(int value)
287
+{
288
+  if(value < MIN_PULSE_WIDTH)
289
+  {  // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
290
+    if(value < 0) value = 0;
291
+    if(value > 180) value = 180;
292
+    value = map(value, 0, 180, SERVO_MIN(),  SERVO_MAX());
293
+  }
294
+  this->writeMicroseconds(value);
295
+}
296
+
297
+void Servo::writeMicroseconds(int value)
298
+{
299
+  // calculate and store the values for the given channel
300
+  byte channel = this->servoIndex;
301
+  if( (channel < MAX_SERVOS) )   // ensure channel is valid
302
+  {
303
+    if( value < SERVO_MIN() )          // ensure pulse width is valid
304
+      value = SERVO_MIN();
305
+    else if( value > SERVO_MAX() )
306
+      value = SERVO_MAX();
307
+
308
+  	value = value - TRIM_DURATION;
309
+    value = usToTicks(value);  // convert to ticks after compensating for interrupt overhead - 12 Aug 2009
310
+
311
+    uint8_t oldSREG = SREG;
312
+    cli();
313
+    servos[channel].ticks = value;
314
+    SREG = oldSREG;
315
+  }
316
+}
317
+
318
+int Servo::read() // return the value as degrees
319
+{
320
+  return  map( this->readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180);
321
+}
322
+
323
+int Servo::readMicroseconds()
324
+{
325
+  unsigned int pulsewidth;
326
+  if( this->servoIndex != INVALID_SERVO )
327
+    pulsewidth = ticksToUs(servos[this->servoIndex].ticks)  + TRIM_DURATION ;   // 12 aug 2009
328
+  else
329
+    pulsewidth  = 0;
330
+
331
+  return pulsewidth;
332
+}
333
+
334
+bool Servo::attached()
335
+{
336
+  return servos[this->servoIndex].Pin.isActive ;
337
+}
338
+
339
+#endif

+ 132
- 0
Marlin/Servo.h Прегледај датотеку

@@ -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

+ 166
- 227
Marlin/pins.h Прегледај датотеку

@@ -14,7 +14,7 @@
14 14
 #define DIGIPOTSS_PIN -1
15 15
 
16 16
 #if MOTHERBOARD == 99
17
-#define	KNOWN_BOARD 1
17
+#define KNOWN_BOARD 1
18 18
 
19 19
 #define X_STEP_PIN          2
20 20
 #define X_DIR_PIN           3
@@ -228,7 +228,7 @@
228 228
 
229 229
 //x axis pins
230 230
     #define X_STEP_PIN      21                  //different from stanard GEN7
231
-    #define X_DIR_PIN       20				    //different from stanard GEN7
231
+    #define X_DIR_PIN       20            //different from stanard GEN7
232 232
     #define X_ENABLE_PIN    24
233 233
     #define X_STOP_PIN      0
234 234
 
@@ -248,14 +248,14 @@
248 248
     #define E0_STEP_PIN      28
249 249
     #define E0_DIR_PIN       27
250 250
     #define E0_ENABLE_PIN    24
251
-    
251
+
252 252
     #define TEMP_0_PIN      2
253 253
     #define TEMP_1_PIN      -1
254 254
     #define TEMP_2_PIN      -1
255 255
     #define TEMP_BED_PIN        1   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
256
-     
256
+
257 257
     #define HEATER_0_PIN    4
258
-    #define HEATER_1_PIN    -1   
258
+    #define HEATER_1_PIN    -1
259 259
     #define HEATER_2_PIN    -1
260 260
     #define HEATER_BED_PIN      3  // (bed)
261 261
 
@@ -272,33 +272,25 @@
272 272
     //our RS485 pins
273 273
     //#define TX_ENABLE_PIN       12
274 274
     //#define RX_ENABLE_PIN       13
275
-    
276
-    #define BEEPER -1	
277
-	#define SDCARDDETECT -1 		
278
-    #define SUICIDE_PIN -1						//has to be defined; otherwise Power_off doesn't work
279
-	
275
+
276
+    #define BEEPER -1
277
+    #define SDCARDDETECT -1
278
+    #define SUICIDE_PIN -1    //has to be defined; otherwise Power_off doesn't work
279
+
280 280
     #define KILL_PIN -1
281
-	//Pins for 4bit LCD Support 
282
-    #define LCD_PINS_RS 18 
281
+    //Pins for 4bit LCD Support
282
+    #define LCD_PINS_RS 18
283 283
     #define LCD_PINS_ENABLE 17
284 284
     #define LCD_PINS_D4 16
285
-    #define LCD_PINS_D5 15 
285
+    #define LCD_PINS_D5 15
286 286
     #define LCD_PINS_D6 13
287 287
     #define LCD_PINS_D7 14
288
-    
288
+
289 289
      //buttons are directly attached
290 290
     #define BTN_EN1 11
291 291
     #define BTN_EN2 10
292 292
     #define BTN_ENC 12  //the click
293
-    
294
-    #define BLEN_C 2
295
-    #define BLEN_B 1
296
-    #define BLEN_A 0
297 293
 
298
-    #define encrot0 0
299
-    #define encrot1 2
300
-    #define encrot2 3
301
-    #define encrot3 1
302 294
 #endif
303 295
 
304 296
 /****************************************************************************************
@@ -376,33 +368,28 @@
376 368
 #else
377 369
 #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
378 370
 #endif
379
-#define HEATER_2_PIN       -1   
371
+#define HEATER_2_PIN       -1
380 372
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
381 373
 #define TEMP_1_PIN         15   // ANALOG NUMBERING
382 374
 #define TEMP_2_PIN         -1   // ANALOG NUMBERING
383 375
 #define HEATER_BED_PIN     8    // BED
384 376
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
385 377
 
378
+#define SERVO0_PIN         11
379
+#define SERVO1_PIN         6
380
+#define SERVO2_PIN         5
381
+#define SERVO3_PIN         4
382
+
386 383
 #ifdef ULTRA_LCD
387 384
 
388 385
   #ifdef NEWPANEL
389
-     //encoder rotation values
390
-    #define encrot0 0
391
-    #define encrot1 2
392
-    #define encrot2 3
393
-    #define encrot3 1
394
-
395
-    #define BLEN_A 0
396
-    #define BLEN_B 1
397
-    #define BLEN_C 2
398
-
399 386
     #define LCD_PINS_RS 16 
400 387
     #define LCD_PINS_ENABLE 17
401 388
     #define LCD_PINS_D4 23
402
-    #define LCD_PINS_D5 25 
389
+    #define LCD_PINS_D5 25
403 390
     #define LCD_PINS_D6 27
404 391
     #define LCD_PINS_D7 29
405
-    
392
+
406 393
     #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
407 394
       #define BEEPER 37
408 395
 
@@ -413,7 +400,7 @@
413 400
       #define SDCARDDETECT 49
414 401
     #else
415 402
       //arduino pin which triggers an piezzo beeper
416
-      #define BEEPER 33	 // Beeper on AUX-4
403
+      #define BEEPER 33  // Beeper on AUX-4
417 404
 
418 405
       //buttons are directly attached using AUX-2
419 406
       #ifdef REPRAPWORLD_KEYPAD
@@ -423,16 +410,7 @@
423 410
         #define SHIFT_OUT 40 // shift register
424 411
         #define SHIFT_CLK 44 // shift register
425 412
         #define SHIFT_LD 42 // shift register
426
-        // define register bit values, don't change it
427
-        #define BLEN_REPRAPWORLD_KEYPAD_F3 0
428
-        #define BLEN_REPRAPWORLD_KEYPAD_F2 1
429
-        #define BLEN_REPRAPWORLD_KEYPAD_F1 2
430
-        #define BLEN_REPRAPWORLD_KEYPAD_UP 3
431
-        #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
432
-        #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
433
-        #define BLEN_REPRAPWORLD_KEYPAD_DOWN 6
434
-        #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
435
-	  #else
413
+      #else
436 414
         #define BTN_EN1 37
437 415
         #define BTN_EN2 35
438 416
         #define BTN_ENC 31  //the click
@@ -447,40 +425,21 @@
447 425
 
448 426
   #else //old style panel with shift register
449 427
     //arduino pin witch triggers an piezzo beeper
450
-    #define BEEPER 33		No Beeper added
428
+    #define BEEPER 33   // No Beeper added 
451 429
 
452 430
     //buttons are attached to a shift register
453
-	// Not wired this yet
431
+  // Not wired this yet
454 432
     //#define SHIFT_CLK 38
455 433
     //#define SHIFT_LD 42
456 434
     //#define SHIFT_OUT 40
457 435
     //#define SHIFT_EN 17
458
-    
459
-    #define LCD_PINS_RS 16 
436
+
437
+    #define LCD_PINS_RS 16
460 438
     #define LCD_PINS_ENABLE 17
461 439
     #define LCD_PINS_D4 23
462
-    #define LCD_PINS_D5 25 
440
+    #define LCD_PINS_D5 25
463 441
     #define LCD_PINS_D6 27
464 442
     #define LCD_PINS_D7 29
465
-    
466
-    //encoder rotation values
467
-    #define encrot0 0
468
-    #define encrot1 2
469
-    #define encrot2 3
470
-    #define encrot3 1
471
-
472
-    
473
-    //bits in the shift register that carry the buttons for:
474
-    // left up center down right red
475
-    #define BL_LE 7
476
-    #define BL_UP 6
477
-    #define BL_MI 5
478
-    #define BL_DW 4
479
-    #define BL_RI 3
480
-    #define BL_ST 2
481
-
482
-    #define BLEN_B 1
483
-    #define BLEN_A 0
484 443
   #endif 
485 444
 #endif //ULTRA_LCD
486 445
 
@@ -526,15 +485,15 @@
526 485
 #define HEATER_1_PIN        -1
527 486
 #define HEATER_2_PIN        -1
528 487
 #define TEMP_0_PIN          2    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
529
-#define TEMP_1_PIN          -1   
530
-#define TEMP_2_PIN          -1   
488
+#define TEMP_1_PIN          -1
489
+#define TEMP_2_PIN          -1
531 490
 #define TEMP_BED_PIN        1    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
532 491
 #endif// MOTHERBOARD == 33 || MOTHERBOARD == 34
533 492
 
534
-// SPI for Max6675 Thermocouple 
493
+// SPI for Max6675 Thermocouple
535 494
 
536 495
 #ifndef SDSUPPORT
537
-// these pins are defined in the SD library if building with SD support  
496
+// these pins are defined in the SD library if building with SD support
538 497
   #define MAX_SCK_PIN          52
539 498
   #define MAX_MISO_PIN         50
540 499
   #define MAX_MOSI_PIN         51
@@ -586,8 +545,8 @@
586 545
 #define HEATER_1_PIN        -1
587 546
 #define HEATER_2_PIN        -1
588 547
 #define TEMP_0_PIN          0    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
589
-#define TEMP_1_PIN          -1    
590
-#define TEMP_2_PIN          -1    
548
+#define TEMP_1_PIN          -1
549
+#define TEMP_2_PIN          -1
591 550
 #define HEATER_BED_PIN      -1
592 551
 #define TEMP_BED_PIN        -1
593 552
 
@@ -650,14 +609,14 @@
650 609
     #define PS_ON_PIN       -1    //changed @ rkoeppl 20110410
651 610
     #define KILL_PIN        -1    //changed @ drakelive 20120830
652 611
     //our pin for debugging.
653
-    
612
+
654 613
     #define DEBUG_PIN        0
655
-    
614
+
656 615
     //our RS485 pins
657
-    #define TX_ENABLE_PIN	12
658
-    #define RX_ENABLE_PIN	13
616
+    #define TX_ENABLE_PIN 12
617
+    #define RX_ENABLE_PIN 13
618
+
659 619
 
660
-    
661 620
 #endif
662 621
 
663 622
 /****************************************************************************************
@@ -673,7 +632,7 @@
673 632
 #if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64
674 633
 #undef MOTHERBOARD
675 634
 #define MOTHERBOARD 6
676
-#define SANGUINOLOLU_V_1_2 
635
+#define SANGUINOLOLU_V_1_2
677 636
 #endif
678 637
 #if MOTHERBOARD == 6
679 638
 #define KNOWN_BOARD 1
@@ -700,7 +659,7 @@
700 659
 
701 660
 #define LED_PIN            -1
702 661
 
703
-#define FAN_PIN            -1 
662
+#define FAN_PIN            -1
704 663
 #if FAN_PIN == 12 || FAN_PIN ==13
705 664
 #define FAN_SOFT_PWM
706 665
 #endif
@@ -754,46 +713,35 @@
754 713
      //we have no buzzer installed
755 714
      #define BEEPER -1
756 715
      //LCD Pins
757
-	 	 #ifdef DOGLCD
758
-			 // Pins for DOGM SPI LCD Support
759
-			 #define DOGLCD_A0	30
760
-			 #define DOGLCD_CS	29
761
-			 // GLCD features
762
-			 #define LCD_CONTRAST 1
763
-			 // Uncomment screen orientation
764
-		     // #define LCD_SCREEN_ROT_0
765
-		     // #define LCD_SCREEN_ROT_90
766
-			 #define LCD_SCREEN_ROT_180
767
-		     // #define LCD_SCREEN_ROT_270
768
-			 #else // standard Hitachi LCD controller
769
-			 #define LCD_PINS_RS        4
770
-			 #define LCD_PINS_ENABLE    17
771
-			 #define LCD_PINS_D4        30
772
-			 #define LCD_PINS_D5        29
773
-			 #define LCD_PINS_D6        28
774
-			 #define LCD_PINS_D7        27
775
-         #endif
716
+     #ifdef DOGLCD
717
+       // Pins for DOGM SPI LCD Support
718
+       #define DOGLCD_A0  30
719
+       #define DOGLCD_CS  29
720
+       // GLCD features
721
+       #define LCD_CONTRAST 1
722
+       // Uncomment screen orientation
723
+         // #define LCD_SCREEN_ROT_0
724
+         // #define LCD_SCREEN_ROT_90
725
+       #define LCD_SCREEN_ROT_180
726
+         // #define LCD_SCREEN_ROT_270
727
+       #else // standard Hitachi LCD controller
728
+       #define LCD_PINS_RS        4
729
+       #define LCD_PINS_ENABLE    17
730
+       #define LCD_PINS_D4        30
731
+       #define LCD_PINS_D5        29
732
+       #define LCD_PINS_D6        28
733
+       #define LCD_PINS_D7        27
734
+     #endif
776 735
      //The encoder and click button
777
-     #define BTN_EN1 11  //must be a hardware interrupt pin
778
-     #define BTN_EN2 10 //must be hardware interrupt pin
736
+     #define BTN_EN1 11  
737
+     #define BTN_EN2 10 
779 738
      #define BTN_ENC 16  //the switch
780 739
      //not connected to a pin
781
-     #define SDCARDDETECT -1
782
-     
783
-     //from the same bit in the RAMPS Newpanel define
784
-     //encoder rotation values
785
-     #define encrot0 0
786
-     #define encrot1 2
787
-     #define encrot2 3
788
-     #define encrot3 1
789
-     
790
-     #define BLEN_C 2
791
-     #define BLEN_B 1
792
-     #define BLEN_A 0
793
-     
740
+     #define SDCARDDETECT -1    
741
+    
794 742
    #endif //Newpanel
795 743
  #endif //Ultipanel
796
- 
744
+
797 745
 #endif
798 746
 
799 747
 
@@ -823,17 +771,17 @@
823 771
 #define Y_MAX_PIN 28
824 772
 #define Y_ENABLE_PIN 29
825 773
 
826
-#define Z_STEP_PIN 37 
774
+#define Z_STEP_PIN 37
827 775
 #define Z_DIR_PIN 39
828 776
 #define Z_MIN_PIN 30
829 777
 #define Z_MAX_PIN 32
830 778
 #define Z_ENABLE_PIN 35
831 779
 
832
-#define HEATER_BED_PIN 4 
833
-#define TEMP_BED_PIN 10  
780
+#define HEATER_BED_PIN 4
781
+#define TEMP_BED_PIN 10
834 782
 
835 783
 #define HEATER_0_PIN  2
836
-#define TEMP_0_PIN 8   
784
+#define TEMP_0_PIN 8
837 785
 
838 786
 #define HEATER_1_PIN 3
839 787
 #define TEMP_1_PIN 9
@@ -863,29 +811,20 @@
863 811
   //arduino pin witch triggers an piezzo beeper
864 812
     #define BEEPER 18
865 813
 
866
-    #define LCD_PINS_RS 20 
814
+    #define LCD_PINS_RS 20
867 815
     #define LCD_PINS_ENABLE 17
868 816
     #define LCD_PINS_D4 16
869
-    #define LCD_PINS_D5 21 
817
+    #define LCD_PINS_D5 21
870 818
     #define LCD_PINS_D6 5
871 819
     #define LCD_PINS_D7 6
872
-    
820
+
873 821
     //buttons are directly attached
874 822
     #define BTN_EN1 40
875 823
     #define BTN_EN2 42
876 824
     #define BTN_ENC 19  //the click
877 825
     
878
-    #define BLEN_C 2
879
-    #define BLEN_B 1
880
-    #define BLEN_A 0
881
-    
882 826
     #define SDCARDDETECT 38
883 827
     
884
-      //encoder rotation values
885
-    #define encrot0 0
886
-    #define encrot1 2
887
-    #define encrot2 3
888
-    #define encrot3 1
889 828
   #else //old style panel with shift register
890 829
     //arduino pin witch triggers an piezzo beeper
891 830
     #define BEEPER 18
@@ -895,40 +834,15 @@
895 834
     #define SHIFT_LD 42
896 835
     #define SHIFT_OUT 40
897 836
     #define SHIFT_EN 17
898
-    
899
-    #define LCD_PINS_RS 16 
837
+
838
+    #define LCD_PINS_RS 16
900 839
     #define LCD_PINS_ENABLE 5
901 840
     #define LCD_PINS_D4 6
902
-    #define LCD_PINS_D5 21 
841
+    #define LCD_PINS_D5 21
903 842
     #define LCD_PINS_D6 20
904 843
     #define LCD_PINS_D7 19
905
-    
906
-    //encoder rotation values
907
-    #ifndef ULTIMAKERCONTROLLER
908
-     #define encrot0 0
909
-     #define encrot1 2
910
-     #define encrot2 3
911
-     #define encrot3 1
912
-    #else
913
-     #define encrot0 0
914
-     #define encrot1 1
915
-     #define encrot2 3
916
-     #define encrot3 2
917
-
918
-    #endif
919
-
844
+  
920 845
     #define SDCARDDETECT -1
921
-    //bits in the shift register that carry the buttons for:
922
-    // left up center down right red
923
-    #define BL_LE 7
924
-    #define BL_UP 6
925
-    #define BL_MI 5
926
-    #define BL_DW 4
927
-    #define BL_RI 3
928
-    #define BL_ST 2
929
-
930
-    #define BLEN_B 1
931
-    #define BLEN_A 0
932 846
   #endif 
933 847
 #endif //ULTRA_LCD
934 848
 
@@ -960,17 +874,17 @@
960 874
 #define Y_MAX_PIN 16
961 875
 #define Y_ENABLE_PIN 29
962 876
 
963
-#define Z_STEP_PIN 37 
877
+#define Z_STEP_PIN 37
964 878
 #define Z_DIR_PIN 39
965 879
 #define Z_MIN_PIN 19
966 880
 #define Z_MAX_PIN 18
967 881
 #define Z_ENABLE_PIN 35
968 882
 
969
-#define HEATER_BED_PIN -1 
970
-#define TEMP_BED_PIN -1  
883
+#define HEATER_BED_PIN -1
884
+#define TEMP_BED_PIN -1
971 885
 
972 886
 #define HEATER_0_PIN  2
973
-#define TEMP_0_PIN 8   
887
+#define TEMP_0_PIN 8
974 888
 
975 889
 #define HEATER_1_PIN 1
976 890
 #define TEMP_1_PIN 1
@@ -994,10 +908,10 @@
994 908
 #define KILL_PIN           -1
995 909
 #define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
996 910
 
997
-#define LCD_PINS_RS 24 
911
+#define LCD_PINS_RS 24
998 912
 #define LCD_PINS_ENABLE 22
999 913
 #define LCD_PINS_D4 36
1000
-#define LCD_PINS_D5 34 
914
+#define LCD_PINS_D5 34
1001 915
 #define LCD_PINS_D6 32
1002 916
 #define LCD_PINS_D7 30
1003 917
 
@@ -1019,17 +933,17 @@
1019 933
 #define X_DIR_PIN          16
1020 934
 #define X_ENABLE_PIN       48
1021 935
 #define X_MIN_PIN          37
1022
-#define X_MAX_PIN          36 
936
+#define X_MAX_PIN          36
1023 937
 
1024 938
 #define Y_STEP_PIN         54
1025
-#define Y_DIR_PIN          47 
939
+#define Y_DIR_PIN          47
1026 940
 #define Y_ENABLE_PIN       55
1027 941
 #define Y_MIN_PIN          35
1028
-#define Y_MAX_PIN          34 
942
+#define Y_MAX_PIN          34
1029 943
 
1030
-#define Z_STEP_PIN         57 
944
+#define Z_STEP_PIN         57
1031 945
 #define Z_DIR_PIN          56
1032
-#define Z_ENABLE_PIN       62 
946
+#define Z_ENABLE_PIN       62
1033 947
 #define Z_MIN_PIN          33
1034 948
 #define Z_MAX_PIN          32
1035 949
 
@@ -1047,45 +961,76 @@
1047 961
 
1048 962
 #define LED_PIN            13
1049 963
 
1050
-#define FAN_PIN            7 
964
+#define FAN_PIN            7
1051 965
 //additional FAN1 PIN (e.g. useful for electronics fan or light on/off) on PIN 8
1052 966
 
1053 967
 #define PS_ON_PIN          45
1054 968
 #define KILL_PIN           46
1055 969
 
1056
-#define HEATER_0_PIN       2    // EXTRUDER 1
1057
-#define HEATER_1_PIN       3    // EXTRUDER 2
1058
-#define HEATER_2_PIN       6    // EXTRUDER 3
970
+#if (TEMP_SENSOR_0==0)
971
+ #define TEMP_0_PIN         -1
972
+ #define HEATER_0_PIN       -1
973
+#else
974
+ #define HEATER_0_PIN        2    // EXTRUDER 1
975
+ #if (TEMP_SENSOR_0==-1)
976
+  #define TEMP_0_PIN         6    // ANALOG NUMBERING - connector *K1* on RUMBA thermocouple ADD ON is used
977
+ #else
978
+  #define TEMP_0_PIN         15   // ANALOG NUMBERING - default connector for thermistor *T0* on rumba board is used
979
+ #endif
980
+#endif 
981
+
982
+#if (TEMP_SENSOR_1==0)
983
+ #define TEMP_1_PIN         -1
984
+ #define HEATER_1_PIN       -1
985
+#else
986
+ #define HEATER_1_PIN        3    // EXTRUDER 2
987
+ #if (TEMP_SENSOR_1==-1)
988
+  #define TEMP_1_PIN         5    // ANALOG NUMBERING - connector *K2* on RUMBA thermocouple ADD ON is used
989
+ #else
990
+  #define TEMP_1_PIN         14   // ANALOG NUMBERING - default connector for thermistor *T1* on rumba board is used
991
+ #endif
992
+#endif
993
+
994
+#if (TEMP_SENSOR_2==0)
995
+ #define TEMP_2_PIN         -1
996
+ #define HEATER_2_PIN       -1
997
+#else
998
+ #define HEATER_2_PIN        6    // EXTRUDER 3
999
+ #if (TEMP_SENSOR_2==-1)
1000
+  #define TEMP_2_PIN         7    // ANALOG NUMBERING - connector *K3* on RUMBA thermocouple ADD ON is used <-- this can not be used when TEMP_SENSOR_BED is defined as thermocouple
1001
+ #else
1002
+  #define TEMP_2_PIN         13   // ANALOG NUMBERING - default connector for thermistor *T2* on rumba board is used
1003
+ #endif
1004
+#endif
1005
+
1006
+//optional for extruder 4 or chamber: #define TEMP_X_PIN         12   // ANALOG NUMBERING - default connector for thermistor *T3* on rumba board is used
1059 1007
 //optional FAN1 can be used as 4th heater output: #define HEATER_3_PIN       8    // EXTRUDER 4
1060
-#define HEATER_BED_PIN     9    // BED
1061 1008
 
1062
-#define TEMP_0_PIN         15   // ANALOG NUMBERING
1063
-#define TEMP_1_PIN         14   // ANALOG NUMBERING
1064
-#define TEMP_2_PIN         13   // ANALOG NUMBERING
1065
-//optional for extruder 4 or chamber: #define TEMP_2_PIN         12   // ANALOG NUMBERING
1066
-#define TEMP_BED_PIN       11   // ANALOG NUMBERING
1009
+#if (TEMP_SENSOR_BED==0)
1010
+ #define TEMP_BED_PIN       -1
1011
+ #define HEATER_BED_PIN     -1
1012
+#else
1013
+ #define HEATER_BED_PIN      9    // BED
1014
+ #if (TEMP_SENSOR_BED==-1)
1015
+  #define TEMP_BED_PIN       7    // ANALOG NUMBERING - connector *K3* on RUMBA thermocouple ADD ON is used <-- this can not be used when TEMP_SENSOR_2 is defined as thermocouple
1016
+ #else
1017
+  #define TEMP_BED_PIN       11   // ANALOG NUMBERING - default connector for thermistor *THB* on rumba board is used
1018
+ #endif
1019
+#endif
1067 1020
 
1068 1021
 #define SDPOWER            -1
1069 1022
 #define SDSS               53
1070 1023
 #define SDCARDDETECT       49
1071 1024
 #define BEEPER             44
1072
-#define LCD_PINS_RS        19 
1025
+#define LCD_PINS_RS        19
1073 1026
 #define LCD_PINS_ENABLE    42
1074 1027
 #define LCD_PINS_D4        18
1075
-#define LCD_PINS_D5        38 
1028
+#define LCD_PINS_D5        38
1076 1029
 #define LCD_PINS_D6        41
1077 1030
 #define LCD_PINS_D7        40
1078 1031
 #define BTN_EN1            11
1079 1032
 #define BTN_EN2            12
1080 1033
 #define BTN_ENC            43
1081
-//encoder rotation values
1082
-#define BLEN_C 2
1083
-#define BLEN_B 1
1084
-#define BLEN_A 0
1085
-#define encrot0 0
1086
-#define encrot1 2
1087
-#define encrot2 3
1088
-#define encrot3 1
1089 1034
 
1090 1035
 #endif //MOTHERBOARD==80
1091 1036
 
@@ -1256,7 +1201,7 @@
1256 1201
 
1257 1202
 #define LED_PIN            -1
1258 1203
 
1259
-#define FAN_PIN            -1 
1204
+#define FAN_PIN            -1
1260 1205
 
1261 1206
 #define PS_ON_PIN         14
1262 1207
 #define KILL_PIN           -1
@@ -1295,7 +1240,7 @@
1295 1240
 *       MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
1296 1241
 *        SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
1297 1242
 *                  RST  9|        |32  AREF
1298
-*                  VCC 10|        |31  GND 
1243
+*                  VCC 10|        |31  GND
1299 1244
 *                  GND 11|        |30  AVCC
1300 1245
 *                XTAL2 12|        |29  PC7 (D 23)
1301 1246
 *                XTAL1 13|        |28  PC6 (D 22)
@@ -1352,7 +1297,7 @@
1352 1297
 #define KILL_PIN           -1
1353 1298
 
1354 1299
 #define HEATER_0_PIN       4
1355
-#define HEATER_1_PIN       -1 // 12 
1300
+#define HEATER_1_PIN       -1 // 12
1356 1301
 #define HEATER_2_PIN       -1 // 13
1357 1302
 #define TEMP_0_PIN          0 //D27   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
1358 1303
 #define TEMP_1_PIN         -1 // 1
@@ -1390,12 +1335,12 @@
1390 1335
 #define E0_ENABLE_PIN       10
1391 1336
 
1392 1337
 /* future proofing */
1393
-#define __FS	20
1394
-#define __FD	19
1395
-#define __GS	18
1396
-#define __GD	13
1338
+#define __FS  20
1339
+#define __FD  19
1340
+#define __GS  18
1341
+#define __GD  13
1397 1342
 
1398
-#define UNUSED_PWM           14	/* PWM on LEFT connector */
1343
+#define UNUSED_PWM           14 /* PWM on LEFT connector */
1399 1344
 
1400 1345
 #define E1_STEP_PIN         -1 // 21
1401 1346
 #define E1_DIR_PIN          -1 // 20
@@ -1414,18 +1359,18 @@
1414 1359
 #define KILL_PIN           -1
1415 1360
 
1416 1361
 #define HEATER_0_PIN        3 /*DONE PWM on RIGHT connector */
1417
-#define HEATER_1_PIN       -1 
1362
+#define HEATER_1_PIN       -1
1418 1363
 #define HEATER_2_PIN       -1
1419
-#define HEATER_1_PIN       -1 
1364
+#define HEATER_1_PIN       -1
1420 1365
 #define HEATER_2_PIN       -1
1421
-#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING 
1366
+#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING
1422 1367
 #define TEMP_1_PIN          1 // ANALOG
1423 1368
 #define TEMP_2_PIN         -1 // 2
1424 1369
 #define HEATER_BED_PIN      4
1425 1370
 #define TEMP_BED_PIN        2 // 1,2 or I2C
1426 1371
 
1427
-#define I2C_SCL				16
1428
-#define I2C_SDA				17
1372
+#define I2C_SCL       16
1373
+#define I2C_SDA       17
1429 1374
 
1430 1375
 #endif
1431 1376
 
@@ -1466,7 +1411,7 @@
1466 1411
 #define Z_MS2_PIN 67
1467 1412
 
1468 1413
 #define HEATER_BED_PIN 3
1469
-#define TEMP_BED_PIN 2 
1414
+#define TEMP_BED_PIN 2
1470 1415
 
1471 1416
 #define HEATER_0_PIN  9
1472 1417
 #define TEMP_0_PIN 0
@@ -1474,7 +1419,11 @@
1474 1419
 #define HEATER_1_PIN 7
1475 1420
 #define TEMP_1_PIN 1
1476 1421
 
1422
+#ifdef BARICUDA
1423
+#define HEATER_2_PIN 6
1424
+#else
1477 1425
 #define HEATER_2_PIN -1
1426
+#endif
1478 1427
 #define TEMP_2_PIN -1
1479 1428
 
1480 1429
 #define E0_STEP_PIN         34
@@ -1555,9 +1504,9 @@
1555 1504
 
1556 1505
 #define HEATER_0_PIN       9    // EXTRUDER 1
1557 1506
 #define HEATER_1_PIN       8    // EXTRUDER 2 (FAN On Sprinter)
1558
-#define HEATER_2_PIN       -1  
1507
+#define HEATER_2_PIN       -1
1559 1508
 
1560
-#if TEMP_SENSOR_0 == -1 
1509
+#if TEMP_SENSOR_0 == -1
1561 1510
 #define TEMP_0_PIN         8   // ANALOG NUMBERING
1562 1511
 #else
1563 1512
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
@@ -1569,37 +1518,27 @@
1569 1518
 #define HEATER_BED_PIN     10   // BED
1570 1519
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
1571 1520
 
1572
-#define BEEPER 33			// Beeper on AUX-4
1521
+#define BEEPER 33     // Beeper on AUX-4
1573 1522
 
1574 1523
 
1575 1524
 #ifdef ULTRA_LCD
1576 1525
 
1577 1526
   #ifdef NEWPANEL
1578 1527
   //arduino pin which triggers an piezzo beeper
1579
-    
1580
-    #define LCD_PINS_RS 16 
1528
+
1529
+    #define LCD_PINS_RS 16
1581 1530
     #define LCD_PINS_ENABLE 17
1582 1531
     #define LCD_PINS_D4 23
1583
-    #define LCD_PINS_D5 25 
1532
+    #define LCD_PINS_D5 25
1584 1533
     #define LCD_PINS_D6 27
1585 1534
     #define LCD_PINS_D7 29
1586
-    
1535
+
1587 1536
     //buttons are directly attached using AUX-2
1588 1537
     #define BTN_EN1 59
1589 1538
     #define BTN_EN2 64
1590 1539
     #define BTN_ENC 43  //the click
1591 1540
     
1592
-    #define BLEN_C 2
1593
-    #define BLEN_B 1
1594
-    #define BLEN_A 0
1595
-    
1596
-    #define SDCARDDETECT -1		// Ramps does not use this port
1597
-    
1598
-      //encoder rotation values
1599
-    #define encrot0 0
1600
-    #define encrot1 2
1601
-    #define encrot2 3
1602
-    #define encrot3 1
1541
+    #define SDCARDDETECT -1   // Ramps does not use this port
1603 1542
 #endif
1604 1543
 #endif //ULTRA_LCD
1605 1544
 
@@ -1610,7 +1549,7 @@
1610 1549
 #endif
1611 1550
 
1612 1551
 //List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
1613
-#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, 
1552
+#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN,
1614 1553
 #if EXTRUDERS > 1
1615 1554
   #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN,
1616 1555
 #else

+ 22
- 0
Marlin/planner.cpp Прегледај датотеку

@@ -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];
@@ -486,6 +494,16 @@ void check_axes_activity()
486 494
 #ifdef AUTOTEMP
487 495
   getHighESpeed();
488 496
 #endif
497
+
498
+#ifdef BARICUDA
499
+  #if HEATER_1_PIN > -1
500
+      analogWrite(HEATER_1_PIN,tail_valve_pressure);
501
+  #endif
502
+
503
+  #if HEATER_2_PIN > -1
504
+      analogWrite(HEATER_2_PIN,tail_e_to_p_pressure);
505
+  #endif
506
+#endif
489 507
 }
490 508
 
491 509
 
@@ -559,6 +577,10 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
559 577
   }
560 578
 
561 579
   block->fan_speed = fanSpeed;
580
+  #ifdef BARICUDA
581
+  block->valve_pressure = ValvePressure;
582
+  block->e_to_p_pressure = EtoPPressure;
583
+  #endif
562 584
 
563 585
   // Compute direction bits for this block 
564 586
   block->direction_bits = 0;

+ 4
- 0
Marlin/planner.h Прегледај датотеку

@@ -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
 

+ 10
- 14
Marlin/stepper.cpp Прегледај датотеку

@@ -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
 }
@@ -879,10 +879,6 @@ void st_init()
879 879
     disable_e2();
880 880
   #endif  
881 881
 
882
-  #ifdef CONTROLLERFAN_PIN
883
-    SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
884
-  #endif
885
-  
886 882
   // waveform generation = 0100 = CTC
887 883
   TCCR1B &= ~(1<<WGM13);
888 884
   TCCR1B |=  (1<<WGM12);

+ 90
- 6
Marlin/temperature.cpp Прегледај датотеку

@@ -99,8 +99,9 @@ static volatile bool temp_meas_ready = false;
99 99
 #ifdef FAN_SOFT_PWM
100 100
   static unsigned char soft_pwm_fan;
101 101
 #endif
102
-
103
-
102
+#if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
103
+  static unsigned long extruder_autofan_last_check;
104
+#endif  
104 105
   
105 106
 #if EXTRUDERS > 3
106 107
 # error Unsupported number of extruders
@@ -306,6 +307,76 @@ int getHeaterPower(int heater) {
306 307
   return soft_pwm[heater];
307 308
 }
308 309
 
310
+#if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
311
+
312
+  #if FAN_PIN > 0
313
+    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN 
314
+       #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
315
+    #endif
316
+    #if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN 
317
+       #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
318
+    #endif
319
+    #if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN 
320
+       #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
321
+    #endif
322
+  #endif 
323
+
324
+void setExtruderAutoFanState(int pin, bool state)
325
+{
326
+  unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
327
+  // this idiom allows both digital and PWM fan outputs (see M42 handling).
328
+  pinMode(pin, OUTPUT);
329
+  digitalWrite(pin, newFanSpeed);
330
+  analogWrite(pin, newFanSpeed);
331
+}
332
+
333
+void checkExtruderAutoFans()
334
+{
335
+  uint8_t fanState = 0;
336
+
337
+  // which fan pins need to be turned on?      
338
+  #if EXTRUDER_0_AUTO_FAN_PIN > 0
339
+    if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
340
+      fanState |= 1;
341
+  #endif
342
+  #if EXTRUDER_1_AUTO_FAN_PIN > 0
343
+    if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
344
+    {
345
+      if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
346
+        fanState |= 1;
347
+      else
348
+        fanState |= 2;
349
+    }
350
+  #endif
351
+  #if EXTRUDER_2_AUTO_FAN_PIN > 0
352
+    if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
353
+    {
354
+      if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
355
+        fanState |= 1;
356
+      else if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN) 
357
+        fanState |= 2;
358
+      else
359
+        fanState |= 4;
360
+    }
361
+  #endif
362
+  
363
+  // update extruder auto fan states
364
+  #if EXTRUDER_0_AUTO_FAN_PIN > 0
365
+    setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
366
+  #endif 
367
+  #if EXTRUDER_1_AUTO_FAN_PIN > 0
368
+    if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) 
369
+      setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
370
+  #endif 
371
+  #if EXTRUDER_2_AUTO_FAN_PIN > 0
372
+    if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN 
373
+        && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
374
+      setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
375
+  #endif 
376
+}
377
+
378
+#endif // any extruder auto fan pins set
379
+
309 380
 void manage_heater()
310 381
 {
311 382
   float pid_input;
@@ -398,8 +469,15 @@ void manage_heater()
398 469
     #endif
399 470
 
400 471
   } // End extruder for loop
401
-  
402 472
 
473
+  #if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
474
+  if(millis() - extruder_autofan_last_check > 2500)  // only need to check fan state very infrequently
475
+  {
476
+    checkExtruderAutoFans();
477
+    extruder_autofan_last_check = millis();
478
+  }  
479
+  #endif       
480
+  
403 481
   #ifndef PIDTEMPBED
404 482
   if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
405 483
     return;
@@ -571,6 +649,12 @@ static void updateTemperaturesFromRawValues()
571 649
 
572 650
 void tp_init()
573 651
 {
652
+#if (MOTHERBOARD == 80) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
653
+  //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
654
+  MCUCR=(1<<JTD); 
655
+  MCUCR=(1<<JTD);
656
+#endif
657
+  
574 658
   // Finish init of mult extruder arrays 
575 659
   for(int e = 0; e < EXTRUDERS; e++) {
576 660
     // populate with the first value 
@@ -647,7 +731,7 @@ void tp_init()
647 731
     #if TEMP_2_PIN < 8
648 732
        DIDR0 |= 1 << TEMP_2_PIN; 
649 733
     #else
650
-       DIDR2 = 1<<(TEMP_2_PIN - 8); 
734
+       DIDR2 |= 1<<(TEMP_2_PIN - 8); 
651 735
     #endif
652 736
   #endif
653 737
   #if (TEMP_BED_PIN > -1)
@@ -689,7 +773,7 @@ void tp_init()
689 773
 
690 774
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
691 775
   minttemp[1] = HEATER_1_MINTEMP;
692
-  while(analog2temp(minttemp_raw[1], 1) > HEATER_1_MINTEMP) {
776
+  while(analog2temp(minttemp_raw[1], 1) < HEATER_1_MINTEMP) {
693 777
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
694 778
     minttemp_raw[1] += OVERSAMPLENR;
695 779
 #else
@@ -710,7 +794,7 @@ void tp_init()
710 794
 
711 795
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
712 796
   minttemp[2] = HEATER_2_MINTEMP;
713
-  while(analog2temp(minttemp_raw[2], 2) > HEATER_2_MINTEMP) {
797
+  while(analog2temp(minttemp_raw[2], 2) < HEATER_2_MINTEMP) {
714 798
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
715 799
     minttemp_raw[2] += OVERSAMPLENR;
716 800
 #else

+ 141
- 104
Marlin/ultralcd.cpp Прегледај датотеку

@@ -79,6 +79,13 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
79 79
 #define ENCODER_STEPS_PER_MENU_ITEM 5
80 80
 #define ENCODER_FEEDRATE_DEADZONE 10
81 81
 
82
+#if !defined(LCD_I2C_VIKI)
83
+  #define ENCODER_STEPS_PER_MENU_ITEM 5
84
+#else
85
+  #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
86
+#endif
87
+
88
+
82 89
 /* Helper macros for menus */
83 90
 #define START_MENU() do { \
84 91
     if (encoderPosition > 0x8000) encoderPosition = 0; \
@@ -113,15 +120,18 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
113 120
     } } while(0)
114 121
 
115 122
 /** Used variables to keep track of the menu */
123
+#ifndef REPRAPWORLD_KEYPAD
116 124
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
117
-volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
125
+#else
126
+volatile uint16_t buttons;//Contains the bits of the currently pressed buttons (extended).
127
+#endif
118 128
 
119 129
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
120 130
 uint32_t blocking_enc;
121 131
 uint8_t lastEncoderBits;
122 132
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
123 133
 uint32_t encoderPosition;
124
-#if (SDCARDDETECT > -1)
134
+#if (SDCARDDETECT > 0)
125 135
 bool lcd_oldcardstatus;
126 136
 #endif
127 137
 #endif//ULTIPANEL
@@ -163,28 +173,28 @@ static void lcd_status_screen()
163 173
         lcd_quick_feedback();
164 174
     }
165 175
 
166
-	// Dead zone at 100% feedrate
167
-	if (feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100 ||
168
-			feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)
169
-	{
170
-		encoderPosition = 0;
171
-		feedmultiply = 100;
172
-	}
173
-	
174
-	if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
175
-	{
176
-		feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
177
-		encoderPosition = 0;
178
-	}
179
-	else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
180
-	{
181
-		feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
182
-		encoderPosition = 0;	
183
-	}
184
-	else if (feedmultiply != 100)
185
-	{
186
-    	feedmultiply += int(encoderPosition);
187
-		encoderPosition = 0;
176
+    // Dead zone at 100% feedrate
177
+    if (feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100 ||
178
+            feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)
179
+    {
180
+        encoderPosition = 0;
181
+        feedmultiply = 100;
182
+    }
183
+
184
+    if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
185
+    {
186
+        feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
187
+        encoderPosition = 0;
188
+    }
189
+    else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
190
+    {
191
+        feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
192
+        encoderPosition = 0;	
193
+    }
194
+    else if (feedmultiply != 100)
195
+    {
196
+        feedmultiply += int(encoderPosition);
197
+        encoderPosition = 0;
188 198
     }
189 199
 
190 200
     if (feedmultiply < 10)
@@ -247,14 +257,14 @@ static void lcd_main_menu()
247 257
         }else{
248 258
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
249 259
 #if SDCARDDETECT < 1
250
-			MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));	// SD-card changed by user
251
-#endif			
260
+            MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
261
+#endif
252 262
         }
253 263
     }else{
254 264
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
255
-#if SDCARDDETECT < 1		
256
-		MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));	// Manually initialize the SD-card via user interface
257
-#endif		
265
+#if SDCARDDETECT < 1
266
+        MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
267
+#endif
258 268
     }
259 269
 #endif
260 270
     END_MENU();
@@ -277,7 +287,7 @@ void lcd_preheat_pla()
277 287
     setTargetBed(plaPreheatHPBTemp);
278 288
     fanSpeed = plaPreheatFanSpeed;
279 289
     lcd_return_to_status();
280
-	setWatch();	// heater sanity check timer
290
+    setWatch(); // heater sanity check timer
281 291
 }
282 292
 
283 293
 void lcd_preheat_abs()
@@ -288,16 +298,16 @@ void lcd_preheat_abs()
288 298
     setTargetBed(absPreheatHPBTemp);
289 299
     fanSpeed = absPreheatFanSpeed;
290 300
     lcd_return_to_status();
291
-	setWatch();	// heater sanity check timer
301
+    setWatch(); // heater sanity check timer
292 302
 }
293 303
 
294 304
 static void lcd_cooldown()
295 305
 {
296
-	setTargetHotend0(0);
297
-	setTargetHotend1(0);
298
-	setTargetHotend2(0);
299
-	setTargetBed(0);
300
-	lcd_return_to_status();
306
+    setTargetHotend0(0);
307
+    setTargetHotend1(0);
308
+    setTargetHotend2(0);
309
+    setTargetBed(0);
310
+    lcd_return_to_status();
301 311
 }
302 312
 
303 313
 static void lcd_tune_menu()
@@ -496,10 +506,10 @@ static void lcd_control_menu()
496 506
 
497 507
 static void lcd_control_temperature_menu()
498 508
 {
499
-	// set up temp variables - undo the default scaling
500
-	raw_Ki = unscalePID_i(Ki);
501
-	raw_Kd = unscalePID_d(Kd);
502
-	
509
+    // set up temp variables - undo the default scaling
510
+    raw_Ki = unscalePID_i(Ki);
511
+    raw_Kd = unscalePID_d(Kd);
512
+
503 513
     START_MENU();
504 514
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
505 515
     MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
@@ -521,7 +531,7 @@ static void lcd_control_temperature_menu()
521 531
 #endif
522 532
 #ifdef PIDTEMP
523 533
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
524
-	// i is typically a small value so allows values below 1
534
+    // i is typically a small value so allows values below 1
525 535
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
526 536
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
527 537
 # ifdef PID_ADD_EXTRUSION_RATE
@@ -725,21 +735,21 @@ menu_edit_type(float, float52, ftostr52, 100)
725 735
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
726 736
 
727 737
 #ifdef REPRAPWORLD_KEYPAD
728
-	static void reprapworld_keypad_move_y_down() {
738
+    static void reprapworld_keypad_move_y_down() {
729 739
         encoderPosition = 1;
730 740
         move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
731
-		lcd_move_y();
732
-	}
733
-	static void reprapworld_keypad_move_y_up() {
734
-		encoderPosition = -1;
735
-		move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
736
-    	lcd_move_y();
737
-	}
738
-	static void reprapworld_keypad_move_home() {
739
-		//enquecommand_P((PSTR("G28"))); // move all axis home
740
-		// TODO gregor: move all axis home, i have currently only one axis on my prusa i3
741
-		enquecommand_P((PSTR("G28 Y")));
742
-	}
741
+        lcd_move_y();
742
+    }
743
+    static void reprapworld_keypad_move_y_up() {
744
+        encoderPosition = -1;
745
+        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
746
+        lcd_move_y();
747
+    }
748
+    static void reprapworld_keypad_move_home() {
749
+        //enquecommand_P((PSTR("G28"))); // move all axis home
750
+        // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
751
+        enquecommand_P((PSTR("G28 Y")));
752
+    }
743 753
 #endif
744 754
 
745 755
 /** End of menus **/
@@ -800,18 +810,20 @@ void lcd_init()
800 810
 #ifdef NEWPANEL
801 811
     pinMode(BTN_EN1,INPUT);
802 812
     pinMode(BTN_EN2,INPUT); 
803
-    pinMode(BTN_ENC,INPUT); 
804 813
     pinMode(SDCARDDETECT,INPUT);
805 814
     WRITE(BTN_EN1,HIGH);
806 815
     WRITE(BTN_EN2,HIGH);
816
+  #if BTN_ENC > 0
817
+    pinMode(BTN_ENC,INPUT); 
807 818
     WRITE(BTN_ENC,HIGH);
808
-    #ifdef REPRAPWORLD_KEYPAD
809
-      pinMode(SHIFT_CLK,OUTPUT);
810
-      pinMode(SHIFT_LD,OUTPUT);
811
-      pinMode(SHIFT_OUT,INPUT);
812
-      WRITE(SHIFT_OUT,HIGH);
813
-      WRITE(SHIFT_LD,HIGH);
814
-    #endif
819
+  #endif    
820
+  #ifdef REPRAPWORLD_KEYPAD
821
+    pinMode(SHIFT_CLK,OUTPUT);
822
+    pinMode(SHIFT_LD,OUTPUT);
823
+    pinMode(SHIFT_OUT,INPUT);
824
+    WRITE(SHIFT_OUT,HIGH);
825
+    WRITE(SHIFT_LD,HIGH);
826
+  #endif
815 827
 #else
816 828
     pinMode(SHIFT_CLK,OUTPUT);
817 829
     pinMode(SHIFT_LD,OUTPUT);
@@ -821,12 +833,14 @@ void lcd_init()
821 833
     WRITE(SHIFT_LD,HIGH); 
822 834
     WRITE(SHIFT_EN,LOW);
823 835
 #endif//!NEWPANEL
824
-#if (SDCARDDETECT > -1)
836
+#if (SDCARDDETECT > 0)
825 837
     WRITE(SDCARDDETECT, HIGH);
826 838
     lcd_oldcardstatus = IS_SD_INSERTED;
827
-#endif//(SDCARDDETECT > -1)
839
+#endif//(SDCARDDETECT > 0)
828 840
     lcd_buttons_update();
841
+#ifdef ULTIPANEL    
829 842
     encoderDiff = 0;
843
+#endif    
830 844
 }
831 845
 
832 846
 void lcd_update()
@@ -835,7 +849,11 @@ void lcd_update()
835 849
     
836 850
     lcd_buttons_update();
837 851
     
838
-    #if (SDCARDDETECT > -1)
852
+    #ifdef LCD_HAS_SLOW_BUTTONS
853
+    buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
854
+    #endif
855
+    
856
+    #if (SDCARDDETECT > 0)
839 857
     if((IS_SD_INSERTED != lcd_oldcardstatus))
840 858
     {
841 859
         lcdDrawUpdate = 2;
@@ -858,17 +876,17 @@ void lcd_update()
858 876
     if (lcd_next_update_millis < millis())
859 877
     {
860 878
 #ifdef ULTIPANEL
861
-		#ifdef REPRAPWORLD_KEYPAD
862
-        	if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
863
-        		reprapworld_keypad_move_y_down();
864
-        	}
865
-        	if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
866
-        		reprapworld_keypad_move_y_up();
867
-        	}
868
-        	if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
869
-        		reprapworld_keypad_move_home();
870
-        	}
871
-		#endif
879
+        #ifdef REPRAPWORLD_KEYPAD
880
+        if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
881
+            reprapworld_keypad_move_y_down();
882
+        }
883
+        if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
884
+            reprapworld_keypad_move_y_up();
885
+        }
886
+        if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
887
+            reprapworld_keypad_move_home();
888
+        }
889
+        #endif
872 890
         if (encoderDiff)
873 891
         {
874 892
             lcdDrawUpdate = 1;
@@ -881,21 +899,26 @@ void lcd_update()
881 899
 #endif//ULTIPANEL
882 900
 
883 901
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
884
-		blink++;	   // Variable for fan animation and alive dot
885
-		u8g.firstPage();
886
-		do {
887
-				u8g.setFont(u8g_font_6x10_marlin);
888
-				u8g.setPrintPos(125,0);
889
-				if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
890
-				u8g.drawPixel(127,63);	// draw alive dot
891
-				u8g.setColorIndex(1);	// black on white
892
-				(*currentMenu)();
893
-				if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
894
-		   } while( u8g.nextPage() );
902
+        blink++;     // Variable for fan animation and alive dot
903
+        u8g.firstPage();
904
+        do 
905
+        {
906
+            u8g.setFont(u8g_font_6x10_marlin);
907
+            u8g.setPrintPos(125,0);
908
+            if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
909
+            u8g.drawPixel(127,63); // draw alive dot
910
+            u8g.setColorIndex(1); // black on white
911
+            (*currentMenu)();
912
+            if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
913
+        } while( u8g.nextPage() );
895 914
 #else        
896 915
         (*currentMenu)();
897 916
 #endif
898 917
 
918
+#ifdef LCD_HAS_STATUS_INDICATORS
919
+        lcd_implementation_update_indicators();
920
+#endif
921
+
899 922
 #ifdef ULTIPANEL
900 923
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
901 924
         {
@@ -946,23 +969,25 @@ void lcd_buttons_update()
946 969
     uint8_t newbutton=0;
947 970
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
948 971
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
972
+  #if BTN_ENC > 0
949 973
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
950 974
         newbutton |= EN_C;
975
+  #endif      
976
+  #ifdef REPRAPWORLD_KEYPAD
977
+    // for the reprapworld_keypad
978
+    uint8_t newbutton_reprapworld_keypad=0;
979
+    WRITE(SHIFT_LD,LOW);
980
+    WRITE(SHIFT_LD,HIGH);
981
+    for(int8_t i=0;i<8;i++) {
982
+        newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
983
+        if(READ(SHIFT_OUT))
984
+            newbutton_reprapworld_keypad|=(1<<7);
985
+        WRITE(SHIFT_CLK,HIGH);
986
+        WRITE(SHIFT_CLK,LOW);
987
+    }
988
+    newbutton |= ((~newbutton_reprapworld_keypad) << REPRAPWORLD_BTN_OFFSET); //invert it, because a pressed switch produces a logical 0
989
+  #endif
951 990
     buttons = newbutton;
952
-    #ifdef REPRAPWORLD_KEYPAD
953
-      // for the reprapworld_keypad
954
-      uint8_t newbutton_reprapworld_keypad=0;
955
-      WRITE(SHIFT_LD,LOW);
956
-      WRITE(SHIFT_LD,HIGH);
957
-      for(int8_t i=0;i<8;i++) {
958
-          newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
959
-          if(READ(SHIFT_OUT))
960
-              newbutton_reprapworld_keypad|=(1<<7);
961
-          WRITE(SHIFT_CLK,HIGH);
962
-          WRITE(SHIFT_CLK,LOW);
963
-      }
964
-      buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
965
-	#endif
966 991
 #else   //read it from the shift register
967 992
     uint8_t newbutton=0;
968 993
     WRITE(SHIFT_LD,LOW);
@@ -1017,6 +1042,18 @@ void lcd_buttons_update()
1017 1042
     }
1018 1043
     lastEncoderBits = enc;
1019 1044
 }
1045
+
1046
+void lcd_buzz(long duration, uint16_t freq)
1047
+{ 
1048
+#ifdef LCD_USE_I2C_BUZZER
1049
+  lcd.buzz(duration,freq);
1050
+#endif   
1051
+}
1052
+
1053
+bool lcd_clicked() 
1054
+{ 
1055
+  return LCD_CLICKED;
1056
+}
1020 1057
 #endif//ULTIPANEL
1021 1058
 
1022 1059
 /********************************/
@@ -1218,7 +1255,7 @@ void copy_and_scalePID_i()
1218 1255
 {
1219 1256
   Ki = scalePID_i(raw_Ki);
1220 1257
   updatePID();
1221
-}	
1258
+}
1222 1259
 
1223 1260
 // Callback for after editing PID d value
1224 1261
 // grab the pid d value out of the temp variable; scale it; then update the PID driver
@@ -1226,6 +1263,6 @@ void copy_and_scalePID_d()
1226 1263
 {
1227 1264
   Kd = scalePID_d(raw_Kd);
1228 1265
   updatePID();
1229
-}	
1230
-	
1266
+}
1267
+
1231 1268
 #endif //ULTRA_LCD

+ 3
- 38
Marlin/ultralcd.h Прегледај датотеку

@@ -22,10 +22,6 @@
22 22
 
23 23
   #ifdef ULTIPANEL
24 24
   void lcd_buttons_update();
25
-  extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
26
-  #ifdef REPRAPWORLD_KEYPAD
27
-    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shiftregister values
28
-  #endif
29 25
   #else
30 26
   FORCE_INLINE void lcd_buttons_update() {}
31 27
   #endif
@@ -38,40 +34,8 @@
38 34
   extern int absPreheatHPBTemp;
39 35
   extern int absPreheatFanSpeed;
40 36
     
41
-  #ifdef NEWPANEL
42
-    #define EN_C (1<<BLEN_C)
43
-    #define EN_B (1<<BLEN_B)
44
-    #define EN_A (1<<BLEN_A)
45
-
46
-    #define LCD_CLICKED (buttons&EN_C)
47
-    #ifdef REPRAPWORLD_KEYPAD
48
-  	  #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
49
-  	  #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
50
-  	  #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
51
-  	  #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
52
-  	  #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
53
-  	  #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
54
-  	  #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
55
-  	  #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
56
-
57
-  	  #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
58
-  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
59
-  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
60
-  	  #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
61
-    #endif //REPRAPWORLD_KEYPAD
62
-  #else
63
-    //atomatic, do not change
64
-    #define B_LE (1<<BL_LE)
65
-    #define B_UP (1<<BL_UP)
66
-    #define B_MI (1<<BL_MI)
67
-    #define B_DW (1<<BL_DW)
68
-    #define B_RI (1<<BL_RI)
69
-    #define B_ST (1<<BL_ST)
70
-    #define EN_B (1<<BLEN_B)
71
-    #define EN_A (1<<BLEN_A)
72
-    
73
-    #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
74
-  #endif//NEWPANEL
37
+  void lcd_buzz(long duration,uint16_t freq);
38
+  bool lcd_clicked();
75 39
 
76 40
 #else //no lcd
77 41
   FORCE_INLINE void lcd_update() {}
@@ -79,6 +43,7 @@
79 43
   FORCE_INLINE void lcd_setstatus(const char* message) {}
80 44
   FORCE_INLINE void lcd_buttons_update() {}
81 45
   FORCE_INLINE void lcd_reset_alert_level() {}
46
+  FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
82 47
 
83 48
   #define LCD_MESSAGEPGM(x) 
84 49
   #define LCD_ALERTMESSAGEPGM(x) 

+ 748
- 515
Marlin/ultralcd_implementation_hitachi_HD44780.h
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 227
- 223
README.md Прегледај датотеку

@@ -1,223 +1,227 @@
1
-WARNING: 
2
---------
3
-THIS IS RELEASE CANDIDATE 2 FOR MARLIN 1.0.0
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.
10
-
11
-Quick Information
12
-===================
13
-This RepRap firmware is a mashup between <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/simen/grbl/tree">grbl</a> and many original parts.
14
-
15
-Derived from Sprinter and Grbl by Erik van der Zalm.
16
-Sprinters lead developers are Kliment and caru.
17
-Grbls lead developer is Simen Svale Skogsrud. Sonney Jeon (Chamnit) improved some parts of grbl
18
-A fork by bkubicek for the Ultimaker was merged, and further development was aided by him.
19
-Some features have been added by:
20
-Lampmaker, Bradley Feldman, and others...
21
-
22
-
23
-Features:
24
-
25
-*   Interrupt based movement with real linear acceleration
26
-*   High steprate
27
-*   Look ahead (Keep the speed high when possible. High cornering speed)
28
-*   Interrupt based temperature protection
29
-*   preliminary support for Matthew Roberts advance algorithm 
30
-    For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
31
-*   Full endstop support
32
-*   SD Card support
33
-*   SD Card folders (works in pronterface)
34
-*   SD Card autostart support
35
-*   LCD support (ideally 20x4) 
36
-*   LCD menu system for autonomous SD card printing, controlled by an click-encoder. 
37
-*   EEPROM storage of e.g. max-velocity, max-acceleration, and similar variables
38
-*   many small but handy things originating from bkubicek's fork.
39
-*   Arc support
40
-*   Temperature oversampling
41
-*   Dynamic Temperature setpointing aka "AutoTemp"
42
-*   Support for QTMarlin, a very beta GUI for PID-tuning and velocity-acceleration testing. https://github.com/bkubicek/QTMarlin
43
-*   Endstop trigger reporting to the host software.
44
-*   Updated sdcardlib
45
-*   Heater power reporting. Useful for PID monitoring.
46
-*   PID tuning
47
-*   CoreXY kinematics (www.corexy.com/theory.html)
48
-*   Configurable serial port to support connection of wireless adaptors.
49
-
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
-
52
-
53
-Differences and additions to the already good Sprinter firmware:
54
-================================================================
55
-
56
-*Look-ahead:*
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, 
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. 
62
-It leads to less over-deposition at corners, especially at flat angles.
63
-
64
-*Arc support:*
65
-
66
-Slic3r can find curves that, although broken into segments, were ment to describe an arc.
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. 
69
-Also, less serial communication is needed.
70
-
71
-*Temperature Oversampling:*
72
-
73
-To reduce noise and make the PID-differential term more useful, 16 ADC conversion results are averaged.
74
-
75
-*AutoTemp:*
76
-
77
-If your gcode contains a wide spread of extruder velocities, or you realtime change the building speed, the temperature should be changed accordingly.
78
-Usually, higher speed requires higher temperature.
79
-This can now be performed by the AutoTemp function
80
-By calling M109 S<mintemp> T<maxtemp> F<factor> you enter the autotemp mode.
81
-
82
-You can leave it by calling M109 without any F.
83
-If active, the maximal extruder stepper rate of all buffered moves will be calculated, and named "maxerate" [steps/sec].
84
-The wanted temperature then will be set to t=tempmin+factor*maxerate, while being limited between tempmin and tempmax.
85
-If the target temperature is set manually or by gcode to a value less then tempmin, it will be kept without change.
86
-Ideally, your gcode can be completely free of temperature controls, apart from a M109 S T F in the start.gcode, and a M109 S0 in the end.gcode.
87
-
88
-*EEPROM:*
89
-
90
-If you know your PID values, the acceleration and max-velocities of your unique machine, you can set them, and finally store them in the EEPROM.
91
-After each reboot, it will magically load them from EEPROM, independent what your Configuration.h says.
92
-
93
-*LCD Menu:*
94
-
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
-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 
98
-Also, with just a 20x4 or 16x2 display, useful data is shown.
99
-
100
-*SD card folders:*
101
-
102
-If you have an SD card reader attached to your controller, also folders work now. Listing the files in pronterface will show "/path/subpath/file.g".
103
-You can write to file in a subfolder by specifying a similar text using small letters in the path.
104
-Also, backup copies of various operating systems are hidden, as well as files not ending with ".g".
105
-
106
-*SD card folders:*
107
-
108
-If you place a file auto[0-9].g into the root of the sd card, it will be automatically executed if you boot the printer. The same file will be executed by selecting "Autostart" from the menu.
109
-First *0 will be performed, than *1 and so on. That way, you can heat up or even print automatically without user interaction.
110
-
111
-*Endstop trigger reporting:*
112
-
113
-If an endstop is hit while moving towards the endstop, the location at which the firmware thinks that the endstop was triggered is outputed on the serial port.
114
-This is useful, because the user gets a warning message.
115
-However, also tools like QTMarlin can use this for finding acceptable combinations of velocity+acceleration.
116
-
117
-*Coding paradigm:*
118
-
119
-Not relevant from a user side, but Marlin was split into thematic junks, and has tried to partially enforced private variables.
120
-This is intended to make it clearer, what interacts which what, and leads to a higher level of modularization.
121
-We think that this is a useful prestep for porting this firmware to e.g. an ARM platform in the future.
122
-A lot of RAM (with enabled LCD ~2200 bytes) was saved by storing char []="some message" in Program memory.
123
-In the serial communication, a #define based level of abstraction was enforced, so that it is clear that
124
-some transfer is information (usually beginning with "echo:"), an error "error:", or just normal protocol,
125
-necessary for backwards compatibility.
126
-
127
-*Interrupt based temperature measurements:*
128
-
129
-An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
130
-This leads to less blocking in the heater management routine.
131
-
132
-
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
-
184
-Configuring and compilation:
185
-============================
186
-
187
-Install the arduino software IDE/toolset v23 (Some configurations also work with 1.x.x)
188
-   http://www.arduino.cc/en/Main/Software
189
-
190
-For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
191
-  copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
192
-
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
199
-   https://github.com/ErikZalm/Marlin/tree/Marlin_v1
200
-   (Use the download button)
201
-
202
-Start the arduino IDE.
203
-Select Tools -> Board -> Arduino Mega 2560    or your microcontroller
204
-Select the correct serial port in Tools ->Serial Port
205
-Open Marlin.pde
206
-
207
-Click the Verify/Compile button
208
-
209
-Click the Upload button
210
-If all goes well the firmware is uploading
211
-
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
-That's ok.  Enjoy Silky Smooth Printing.
221
-
222
-
223
-
1
+==========================
2
+Marlin 3D Printer Firmware
3
+==========================
4
+
5
+Notes: 
6
+-----
7
+
8
+The configuration is now split in two files:
9
+  Configuration.h for the normal settings
10
+  Configuration_adv.h for the advanced settings
11
+
12
+Gen7T is not supported.
13
+
14
+Quick Information
15
+===================
16
+This RepRap firmware is a mashup between <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/simen/grbl/tree">grbl</a> and many original parts.
17
+
18
+Derived from Sprinter and Grbl by Erik van der Zalm.
19
+Sprinters lead developers are Kliment and caru.
20
+Grbls lead developer is Simen Svale Skogsrud. Sonney Jeon (Chamnit) improved some parts of grbl
21
+A fork by bkubicek for the Ultimaker was merged, and further development was aided by him.
22
+Some features have been added by:
23
+Lampmaker, Bradley Feldman, and others...
24
+
25
+
26
+Features:
27
+
28
+*   Interrupt based movement with real linear acceleration
29
+*   High steprate
30
+*   Look ahead (Keep the speed high when possible. High cornering speed)
31
+*   Interrupt based temperature protection
32
+*   preliminary support for Matthew Roberts advance algorithm 
33
+    For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
34
+*   Full endstop support
35
+*   SD Card support
36
+*   SD Card folders (works in pronterface)
37
+*   SD Card autostart support
38
+*   LCD support (ideally 20x4) 
39
+*   LCD menu system for autonomous SD card printing, controlled by an click-encoder. 
40
+*   EEPROM storage of e.g. max-velocity, max-acceleration, and similar variables
41
+*   many small but handy things originating from bkubicek's fork.
42
+*   Arc support
43
+*   Temperature oversampling
44
+*   Dynamic Temperature setpointing aka "AutoTemp"
45
+*   Support for QTMarlin, a very beta GUI for PID-tuning and velocity-acceleration testing. https://github.com/bkubicek/QTMarlin
46
+*   Endstop trigger reporting to the host software.
47
+*   Updated sdcardlib
48
+*   Heater power reporting. Useful for PID monitoring.
49
+*   PID tuning
50
+*   CoreXY kinematics (www.corexy.com/theory.html)
51
+*   Configurable serial port to support connection of wireless adaptors.
52
+*   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
53
+
54
+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.
55
+
56
+
57
+Differences and additions to the already good Sprinter firmware:
58
+================================================================
59
+
60
+*Look-ahead:*
61
+
62
+Marlin has look-ahead. While sprinter has to break and re-accelerate at each corner, 
63
+lookahead will only decelerate and accelerate to a velocity, 
64
+so that the change in vectorial velocity magnitude is less than the xy_jerk_velocity.
65
+This is only possible, if some future moves are already processed, hence the name. 
66
+It leads to less over-deposition at corners, especially at flat angles.
67
+
68
+*Arc support:*
69
+
70
+Slic3r can find curves that, although broken into segments, were ment to describe an arc.
71
+Marlin is able to print those arcs. The advantage is the firmware can choose the resolution,
72
+and can perform the arc with nearly constant velocity, resulting in a nice finish. 
73
+Also, less serial communication is needed.
74
+
75
+*Temperature Oversampling:*
76
+
77
+To reduce noise and make the PID-differential term more useful, 16 ADC conversion results are averaged.
78
+
79
+*AutoTemp:*
80
+
81
+If your gcode contains a wide spread of extruder velocities, or you realtime change the building speed, the temperature should be changed accordingly.
82
+Usually, higher speed requires higher temperature.
83
+This can now be performed by the AutoTemp function
84
+By calling M109 S<mintemp> T<maxtemp> F<factor> you enter the autotemp mode.
85
+
86
+You can leave it by calling M109 without any F.
87
+If active, the maximal extruder stepper rate of all buffered moves will be calculated, and named "maxerate" [steps/sec].
88
+The wanted temperature then will be set to t=tempmin+factor*maxerate, while being limited between tempmin and tempmax.
89
+If the target temperature is set manually or by gcode to a value less then tempmin, it will be kept without change.
90
+Ideally, your gcode can be completely free of temperature controls, apart from a M109 S T F in the start.gcode, and a M109 S0 in the end.gcode.
91
+
92
+*EEPROM:*
93
+
94
+If you know your PID values, the acceleration and max-velocities of your unique machine, you can set them, and finally store them in the EEPROM.
95
+After each reboot, it will magically load them from EEPROM, independent what your Configuration.h says.
96
+
97
+*LCD Menu:*
98
+
99
+If your hardware supports it, you can build yourself a LCD-CardReader+Click+encoder combination. It will enable you to realtime tune temperatures,
100
+accelerations, velocities, flow rates, select and print files from the SD card, preheat, disable the steppers, and do other fancy stuff.
101
+One working hardware is documented here: http://www.thingiverse.com/thing:12663 
102
+Also, with just a 20x4 or 16x2 display, useful data is shown.
103
+
104
+*SD card folders:*
105
+
106
+If you have an SD card reader attached to your controller, also folders work now. Listing the files in pronterface will show "/path/subpath/file.g".
107
+You can write to file in a subfolder by specifying a similar text using small letters in the path.
108
+Also, backup copies of various operating systems are hidden, as well as files not ending with ".g".
109
+
110
+*SD card folders:*
111
+
112
+If you place a file auto[0-9].g into the root of the sd card, it will be automatically executed if you boot the printer. The same file will be executed by selecting "Autostart" from the menu.
113
+First *0 will be performed, than *1 and so on. That way, you can heat up or even print automatically without user interaction.
114
+
115
+*Endstop trigger reporting:*
116
+
117
+If an endstop is hit while moving towards the endstop, the location at which the firmware thinks that the endstop was triggered is outputed on the serial port.
118
+This is useful, because the user gets a warning message.
119
+However, also tools like QTMarlin can use this for finding acceptable combinations of velocity+acceleration.
120
+
121
+*Coding paradigm:*
122
+
123
+Not relevant from a user side, but Marlin was split into thematic junks, and has tried to partially enforced private variables.
124
+This is intended to make it clearer, what interacts which what, and leads to a higher level of modularization.
125
+We think that this is a useful prestep for porting this firmware to e.g. an ARM platform in the future.
126
+A lot of RAM (with enabled LCD ~2200 bytes) was saved by storing char []="some message" in Program memory.
127
+In the serial communication, a #define based level of abstraction was enforced, so that it is clear that
128
+some transfer is information (usually beginning with "echo:"), an error "error:", or just normal protocol,
129
+necessary for backwards compatibility.
130
+
131
+*Interrupt based temperature measurements:*
132
+
133
+An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
134
+This leads to less blocking in the heater management routine.
135
+
136
+
137
+Non-standard M-Codes, different to an old version of sprinter:
138
+==============================================================
139
+Movement:
140
+
141
+*   G2  - CW ARC
142
+*   G3  - CCW ARC
143
+
144
+General:
145
+
146
+*   M17  - Enable/Power all stepper motors. Compatibility to ReplicatorG.
147
+*   M18  - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
148
+*   M30  - Print time since last M109 or SD card start to serial
149
+*   M42  - Change pin status via gcode
150
+*   M80  - Turn on Power Supply
151
+*   M81  - Turn off Power Supply
152
+*   M114 - Output current position to serial port 
153
+*   M119 - Output Endstop status to serial port
154
+
155
+Movement variables:
156
+
157
+*   M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
158
+*   M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
159
+*   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
160
+*   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)
161
+*   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.
162
+*   M221 - set the extrude multiplying S:factor in percent
163
+*   M400 - Finish all buffered moves.
164
+
165
+Temperature variables:
166
+*   M301 - Set PID parameters P I and D
167
+*   M302 - Allow cold extrudes
168
+*   M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
169
+
170
+Advance:
171
+
172
+*   M200 - Set filament diameter for advance
173
+*   M205 - advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
174
+
175
+EEPROM:
176
+
177
+*   M500 - stores paramters in EEPROM. This parameters are stored:  axis_steps_per_unit,  max_feedrate, max_acceleration  ,acceleration,retract_acceleration,
178
+  minimumfeedrate,mintravelfeedrate,minsegmenttime,  jerk velocities, PID
179
+*   M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
180
+*   M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
181
+*   M503 - print the current settings (from memory not from eeprom)
182
+
183
+MISC:
184
+
185
+*   M240 - Trigger a camera to take a photograph
186
+*   M999 - Restart after being stopped by error
187
+
188
+Configuring and compilation:
189
+============================
190
+
191
+Install the arduino software IDE/toolset v23 (Some configurations also work with 1.x.x)
192
+   http://www.arduino.cc/en/Main/Software
193
+
194
+For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
195
+  copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
196
+
197
+Install Ultimaker's RepG 25 build
198
+    http://software.ultimaker.com
199
+For SD handling and as better substitute (apart from stl manipulation) download
200
+the very nice Kliment's printrun/pronterface  https://github.com/kliment/Printrun
201
+
202
+Copy the Ultimaker Marlin firmware
203
+   https://github.com/ErikZalm/Marlin/tree/Marlin_v1
204
+   (Use the download button)
205
+
206
+Start the arduino IDE.
207
+Select Tools -> Board -> Arduino Mega 2560    or your microcontroller
208
+Select the correct serial port in Tools ->Serial Port
209
+Open Marlin.pde
210
+
211
+Click the Verify/Compile button
212
+
213
+Click the Upload button
214
+If all goes well the firmware is uploading
215
+
216
+Start Ultimaker's Custom RepG 25
217
+Make sure Show Experimental Profiles is enabled in Preferences
218
+Select Sprinter as the Driver
219
+
220
+Press the Connect button.
221
+
222
+KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
223
+
224
+That's ok.  Enjoy Silky Smooth Printing.
225
+
226
+
227
+

Loading…
Откажи
Сачувај