浏览代码

Merge remote-tracking branch 'upstream/Marlin_v1' into Marlin_v1

Robert F-C 12 年前
父节点
当前提交
dfa549f268
共有 13 个文件被更改,包括 1208 次插入413 次删除
  1. 70
    40
      Marlin/Configuration.h
  2. 10
    10
      Marlin/Makefile
  3. 4
    0
      Marlin/Marlin.h
  4. 356
    257
      Marlin/Marlin_main.cpp
  5. 337
    0
      Marlin/Servo.cpp
  6. 132
    0
      Marlin/Servo.h
  7. 138
    80
      Marlin/pins.h
  8. 30
    0
      Marlin/planner.cpp
  9. 4
    0
      Marlin/planner.h
  10. 9
    3
      Marlin/temperature.cpp
  11. 85
    20
      Marlin/ultralcd.cpp
  12. 0
    1
      Marlin/ultralcd.h
  13. 33
    2
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 70
- 40
Marlin/Configuration.h 查看文件

2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 // This configurtion file contains the basic settings.
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
 // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
6
 // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
7
 
7
 
8
 //User specified version info of this build to display in [Pronterface, etc] terminal window during startup.
8
 //User specified version info of this build to display in [Pronterface, etc] terminal window during startup.
78
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
78
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
79
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
79
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
80
 //
80
 //
81
-//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k 
81
+//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
82
 //                          (but gives greater accuracy and more stable PID)
82
 //                          (but gives greater accuracy and more stable PID)
83
 // 51 is 100k thermistor - EPCOS (1k pullup)
83
 // 51 is 100k thermistor - EPCOS (1k pullup)
84
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
84
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
90
 #define TEMP_SENSOR_BED 0
90
 #define TEMP_SENSOR_BED 0
91
 
91
 
92
 // Actual temperature must be close to target for this long before M109 returns success
92
 // Actual temperature must be close to target for this long before M109 returns success
93
-#define TEMP_RESIDENCY_TIME 10	// (seconds)
93
+#define TEMP_RESIDENCY_TIME 10  // (seconds)
94
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
94
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
95
 #define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
95
 #define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
96
 
96
 
97
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
97
 // 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. 
98
+// to check that the wiring to the thermistor is not broken.
99
 // Otherwise this would lead to the heater being powered on all the time.
99
 // Otherwise this would lead to the heater being powered on all the time.
100
 #define HEATER_0_MINTEMP 5
100
 #define HEATER_0_MINTEMP 5
101
 #define HEATER_1_MINTEMP 5
101
 #define HEATER_1_MINTEMP 5
121
 #define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
121
 #define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
122
 #define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
122
 #define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
123
 #ifdef PIDTEMP
123
 #ifdef PIDTEMP
124
-  //#define PID_DEBUG // Sends debug data to the serial port. 
124
+  //#define PID_DEBUG // Sends debug data to the serial port.
125
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
125
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
126
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
126
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
127
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
127
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
132
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
132
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
133
 // Ultimaker
133
 // Ultimaker
134
     #define  DEFAULT_Kp 22.2
134
     #define  DEFAULT_Kp 22.2
135
-    #define  DEFAULT_Ki 1.08  
136
-    #define  DEFAULT_Kd 114  
135
+    #define  DEFAULT_Ki 1.08
136
+    #define  DEFAULT_Kd 114
137
 
137
 
138
 // Makergear
138
 // Makergear
139
 //    #define  DEFAULT_Kp 7.0
139
 //    #define  DEFAULT_Kp 7.0
140
-//    #define  DEFAULT_Ki 0.1  
141
-//    #define  DEFAULT_Kd 12  
140
+//    #define  DEFAULT_Ki 0.1
141
+//    #define  DEFAULT_Kd 12
142
 
142
 
143
-// Mendel Parts V9 on 12V    
143
+// Mendel Parts V9 on 12V
144
 //    #define  DEFAULT_Kp 63.0
144
 //    #define  DEFAULT_Kp 63.0
145
 //    #define  DEFAULT_Ki 2.25
145
 //    #define  DEFAULT_Ki 2.25
146
 //    #define  DEFAULT_Kd 440
146
 //    #define  DEFAULT_Kd 440
149
 // Bed Temperature Control
149
 // Bed Temperature Control
150
 // Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
150
 // Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
151
 //
151
 //
152
-// uncomment this to enable PID on the bed.   It uses the same ferquency PWM as the extruder. 
152
+// uncomment this to enable PID on the bed.   It uses the same ferquency PWM as the extruder.
153
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
153
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
154
 // which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
154
 // 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 
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
157
 // shouldn't use bed PID until someone else verifies your hardware works.
157
 // shouldn't use bed PID until someone else verifies your hardware works.
158
 // If this is enabled, find your own PID constants below.
158
 // If this is enabled, find your own PID constants below.
159
 //#define PIDTEMPBED
159
 //#define PIDTEMPBED
223
 #endif
223
 #endif
224
 
224
 
225
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
225
 // 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. 
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
 //#define DISABLE_MAX_ENDSTOPS
229
 //#define DISABLE_MAX_ENDSTOPS
230
 
230
 
231
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
231
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
280
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
280
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
281
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
281
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
282
 
282
 
283
-// default settings 
283
+// default settings
284
 
284
 
285
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200*8/3,760*1.1}  // default steps per unit for ultimaker 
286
-#define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)    
285
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for ultimaker
286
+#define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
287
 #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.
287
 #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
 
288
 
289
-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
289
+#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
290
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
290
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
291
 
291
 
292
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
292
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
307
 // EEPROM
307
 // EEPROM
308
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
308
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
309
 // M500 - stores paramters in EEPROM
309
 // M500 - stores paramters in EEPROM
310
-// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
310
+// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
311
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
311
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
312
 //define this to enable eeprom support
312
 //define this to enable eeprom support
313
 //#define EEPROM_SETTINGS
313
 //#define EEPROM_SETTINGS
318
 // Preheat Constants
318
 // Preheat Constants
319
 #define PLA_PREHEAT_HOTEND_TEMP 180 
319
 #define PLA_PREHEAT_HOTEND_TEMP 180 
320
 #define PLA_PREHEAT_HPB_TEMP 70
320
 #define PLA_PREHEAT_HPB_TEMP 70
321
-#define PLA_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
321
+#define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
322
 
322
 
323
 #define ABS_PREHEAT_HOTEND_TEMP 240
323
 #define ABS_PREHEAT_HOTEND_TEMP 240
324
 #define ABS_PREHEAT_HPB_TEMP 100
324
 #define ABS_PREHEAT_HPB_TEMP 100
325
-#define ABS_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
325
+#define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
326
 
326
 
327
 //LCD and SD support
327
 //LCD and SD support
328
 //#define ULTRA_LCD  //general lcd support, also 16x2
328
 //#define ULTRA_LCD  //general lcd support, also 16x2
329
-//#define DOGLCD	// Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
329
+//#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
330
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
330
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
331
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
331
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
332
 
332
 
347
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
347
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
348
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
348
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
349
 
349
 
350
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
351
+// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
352
+//#define REPRAPWORLD_KEYPAD
353
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
354
+
350
 //automatic expansion
355
 //automatic expansion
351
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
356
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
352
  #define DOGLCD
357
  #define DOGLCD
357
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
362
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
358
  #define ULTIPANEL
363
  #define ULTIPANEL
359
  #define NEWPANEL
364
  #define NEWPANEL
360
-#endif 
365
+#endif
366
+
367
+#if defined(REPRAPWORLD_KEYPAD)
368
+  #define NEWPANEL
369
+  #define ULTIPANEL
370
+#endif
361
 
371
 
362
 //I2C PANELS
372
 //I2C PANELS
363
 
373
 
404
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
414
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
405
   #define SDSUPPORT
415
   #define SDSUPPORT
406
   #define ULTRA_LCD
416
   #define ULTRA_LCD
407
-	#ifdef DOGLCD	// Change number of lines to match the DOG graphic display
408
-		#define LCD_WIDTH 20
409
-		#define LCD_HEIGHT 5
410
-	#else
411
-		#define LCD_WIDTH 20
412
-		#define LCD_HEIGHT 4
413
-	#endif
414
-#else //no panel but just lcd 
417
+  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
418
+    #define LCD_WIDTH 20
419
+    #define LCD_HEIGHT 5
420
+  #else
421
+    #define LCD_WIDTH 20
422
+    #define LCD_HEIGHT 4
423
+  #endif
424
+#else //no panel but just lcd
415
   #ifdef ULTRA_LCD
425
   #ifdef ULTRA_LCD
416
-	#ifdef DOGLCD	// Change number of lines to match the 128x64 graphics display
417
-		#define LCD_WIDTH 20
418
-		#define LCD_HEIGHT 5
419
-	#else
420
-		#define LCD_WIDTH 16
421
-		#define LCD_HEIGHT 2
422
-	#endif    
426
+  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
427
+    #define LCD_WIDTH 20
428
+    #define LCD_HEIGHT 5
429
+  #else
430
+    #define LCD_WIDTH 16
431
+    #define LCD_HEIGHT 2
432
+  #endif
423
   #endif
433
   #endif
424
 #endif
434
 #endif
425
 
435
 
433
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
443
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
434
 //#define SF_ARC_FIX
444
 //#define SF_ARC_FIX
435
 
445
 
446
+// Support for the BariCUDA Paste Extruder.
447
+//#define BARICUDA
448
+
449
+/*********************************************************************\
450
+*
451
+* R/C SERVO support
452
+*
453
+* Sponsored by TrinityLabs, Reworked by codexmas
454
+*
455
+**********************************************************************/
456
+
457
+// Number of servos
458
+//
459
+// If you select a configuration below, this will receive a default value and does not need to be set manually
460
+// set it manually if you have more servos than extruders and wish to manually control some
461
+// leaving it undefined or defining as 0 will disable the servo subsystem
462
+// If unsure, leave commented / disabled
463
+//
464
+// #define NUM_SERVOS 3
465
+
436
 #include "Configuration_adv.h"
466
 #include "Configuration_adv.h"
437
 #include "thermistortables.h"
467
 #include "thermistortables.h"
438
 
468
 

+ 10
- 10
Marlin/Makefile 查看文件

1
 # Sprinter Arduino Project Makefile
1
 # Sprinter Arduino Project Makefile
2
-# 
2
+#
3
 # Makefile Based on:
3
 # Makefile Based on:
4
 # Arduino 0011 Makefile
4
 # Arduino 0011 Makefile
5
 # Arduino adaptation by mellis, eighthave, oli.keller
5
 # Arduino adaptation by mellis, eighthave, oli.keller
6
 # Marlin adaption by Daid
6
 # Marlin adaption by Daid
7
 #
7
 #
8
 # This has been tested with Arduino 0022.
8
 # This has been tested with Arduino 0022.
9
-# 
9
+#
10
 # This makefile allows you to build sketches from the command line
10
 # This makefile allows you to build sketches from the command line
11
 # without the Arduino environment (or Java).
11
 # without the Arduino environment (or Java).
12
 #
12
 #
21
 #     (e.g. UPLOAD_PORT = /dev/tty.USB0).  If the exact name of this file
21
 #     (e.g. UPLOAD_PORT = /dev/tty.USB0).  If the exact name of this file
22
 #     changes, you can use * as a wildcard (e.g. UPLOAD_PORT = /dev/tty.usb*).
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
 #     Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
25
 #     Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
26
 #     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
26
 #     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
27
 #     change F_CPU to 8000000. If you are using Gen7 electronics, you
27
 #     change F_CPU to 8000000. If you are using Gen7 electronics, you
44
 ARDUINO_VERSION      ?= 22
44
 ARDUINO_VERSION      ?= 22
45
 
45
 
46
 # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
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
 #Programmer configuration
49
 #Programmer configuration
50
 UPLOAD_RATE        ?= 115200
50
 UPLOAD_RATE        ?= 115200
213
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
213
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
214
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
214
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
215
 	watchdog.cpp
215
 	watchdog.cpp
216
-CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp
216
+CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp Servo.cpp
217
 
217
 
218
 #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
218
 #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
219
 ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
219
 ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
317
 # Default target.
317
 # Default target.
318
 all: sizeafter
318
 all: sizeafter
319
 
319
 
320
-build: $(BUILD_DIR) elf hex 
320
+build: $(BUILD_DIR) elf hex
321
 
321
 
322
 # Creates the object directory
322
 # Creates the object directory
323
-$(BUILD_DIR): 
323
+$(BUILD_DIR):
324
 	$P mkdir -p $(BUILD_DIR)
324
 	$P mkdir -p $(BUILD_DIR)
325
 
325
 
326
 elf: $(BUILD_DIR)/$(TARGET).elf
326
 elf: $(BUILD_DIR)/$(TARGET).elf
327
 hex: $(BUILD_DIR)/$(TARGET).hex
327
 hex: $(BUILD_DIR)/$(TARGET).hex
328
 eep: $(BUILD_DIR)/$(TARGET).eep
328
 eep: $(BUILD_DIR)/$(TARGET).eep
329
-lss: $(BUILD_DIR)/$(TARGET).lss 
329
+lss: $(BUILD_DIR)/$(TARGET).lss
330
 sym: $(BUILD_DIR)/$(TARGET).sym
330
 sym: $(BUILD_DIR)/$(TARGET).sym
331
 
331
 
332
-# Program the device.  
332
+# Program the device.
333
 # Do not try to reset an arduino if it's not one
333
 # Do not try to reset an arduino if it's not one
334
 upload: $(BUILD_DIR)/$(TARGET).hex
334
 upload: $(BUILD_DIR)/$(TARGET).hex
335
 ifeq (${AVRDUDE_PROGRAMMER}, arduino)
335
 ifeq (${AVRDUDE_PROGRAMMER}, arduino)
356
 	--change-section-address .data-0x800000 \
356
 	--change-section-address .data-0x800000 \
357
 	--change-section-address .bss-0x800000 \
357
 	--change-section-address .bss-0x800000 \
358
 	--change-section-address .noinit-0x800000 \
358
 	--change-section-address .noinit-0x800000 \
359
-	--change-section-address .eeprom-0x810000 
359
+	--change-section-address .eeprom-0x810000
360
 
360
 
361
 
361
 
362
 coff: $(BUILD_DIR)/$(TARGET).elf
362
 coff: $(BUILD_DIR)/$(TARGET).elf

+ 4
- 0
Marlin/Marlin.h 查看文件

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

+ 356
- 257
Marlin/Marlin_main.cpp
文件差异内容过多而无法显示
查看文件


+ 337
- 0
Marlin/Servo.cpp 查看文件

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
+
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
+}

+ 132
- 0
Marlin/Servo.h 查看文件

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

+ 138
- 80
Marlin/pins.h 查看文件

248
     #define E0_STEP_PIN      28
248
     #define E0_STEP_PIN      28
249
     #define E0_DIR_PIN       27
249
     #define E0_DIR_PIN       27
250
     #define E0_ENABLE_PIN    24
250
     #define E0_ENABLE_PIN    24
251
-    
251
+
252
     #define TEMP_0_PIN      2
252
     #define TEMP_0_PIN      2
253
     #define TEMP_1_PIN      -1
253
     #define TEMP_1_PIN      -1
254
     #define TEMP_2_PIN      -1
254
     #define TEMP_2_PIN      -1
255
     #define TEMP_BED_PIN        1   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
255
     #define TEMP_BED_PIN        1   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
256
-     
256
+
257
     #define HEATER_0_PIN    4
257
     #define HEATER_0_PIN    4
258
-    #define HEATER_1_PIN    -1   
258
+    #define HEATER_1_PIN    -1
259
     #define HEATER_2_PIN    -1
259
     #define HEATER_2_PIN    -1
260
     #define HEATER_BED_PIN      3  // (bed)
260
     #define HEATER_BED_PIN      3  // (bed)
261
 
261
 
272
     //our RS485 pins
272
     //our RS485 pins
273
     //#define TX_ENABLE_PIN       12
273
     //#define TX_ENABLE_PIN       12
274
     //#define RX_ENABLE_PIN       13
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
     #define KILL_PIN -1
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
     #define LCD_PINS_ENABLE 17
283
     #define LCD_PINS_ENABLE 17
284
     #define LCD_PINS_D4 16
284
     #define LCD_PINS_D4 16
285
-    #define LCD_PINS_D5 15 
285
+    #define LCD_PINS_D5 15
286
     #define LCD_PINS_D6 13
286
     #define LCD_PINS_D6 13
287
     #define LCD_PINS_D7 14
287
     #define LCD_PINS_D7 14
288
-    
288
+
289
      //buttons are directly attached
289
      //buttons are directly attached
290
     #define BTN_EN1 11
290
     #define BTN_EN1 11
291
     #define BTN_EN2 10
291
     #define BTN_EN2 10
292
     #define BTN_ENC 12  //the click
292
     #define BTN_ENC 12  //the click
293
+
293
 #endif
294
 #endif
294
 
295
 
295
 /****************************************************************************************
296
 /****************************************************************************************
367
 #else
368
 #else
368
 #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
369
 #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
369
 #endif
370
 #endif
370
-#define HEATER_2_PIN       -1   
371
+#define HEATER_2_PIN       -1
371
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
372
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
372
 #define TEMP_1_PIN         15   // ANALOG NUMBERING
373
 #define TEMP_1_PIN         15   // ANALOG NUMBERING
373
 #define TEMP_2_PIN         -1   // ANALOG NUMBERING
374
 #define TEMP_2_PIN         -1   // ANALOG NUMBERING
374
 #define HEATER_BED_PIN     8    // BED
375
 #define HEATER_BED_PIN     8    // BED
375
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
376
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
376
 
377
 
378
+#define SERVO0_PIN         11
379
+#define SERVO1_PIN         6
380
+#define SERVO2_PIN         5
381
+#define SERVO3_PIN         4
382
+
377
 #ifdef ULTRA_LCD
383
 #ifdef ULTRA_LCD
378
 
384
 
379
   #ifdef NEWPANEL
385
   #ifdef NEWPANEL
380
     #define LCD_PINS_RS 16 
386
     #define LCD_PINS_RS 16 
381
     #define LCD_PINS_ENABLE 17
387
     #define LCD_PINS_ENABLE 17
382
     #define LCD_PINS_D4 23
388
     #define LCD_PINS_D4 23
383
-    #define LCD_PINS_D5 25 
389
+    #define LCD_PINS_D5 25
384
     #define LCD_PINS_D6 27
390
     #define LCD_PINS_D6 27
385
     #define LCD_PINS_D7 29
391
     #define LCD_PINS_D7 29
386
-    
392
+
387
     #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
393
     #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
388
       #define BEEPER 37
394
       #define BEEPER 37
389
 
395
 
397
       #define BEEPER 33  // Beeper on AUX-4
403
       #define BEEPER 33  // Beeper on AUX-4
398
 
404
 
399
       //buttons are directly attached using AUX-2
405
       //buttons are directly attached using AUX-2
400
-      #define BTN_EN1 37
401
-      #define BTN_EN2 35
402
-      #define BTN_ENC 31  //the click
406
+      #ifdef REPRAPWORLD_KEYPAD
407
+        #define BTN_EN1 64 // encoder
408
+        #define BTN_EN2 59 // encoder
409
+        #define BTN_ENC 63 // enter button
410
+        #define SHIFT_OUT 40 // shift register
411
+        #define SHIFT_CLK 44 // shift register
412
+        #define SHIFT_LD 42 // shift register
413
+      #else
414
+        #define BTN_EN1 37
415
+        #define BTN_EN2 35
416
+        #define BTN_ENC 31  //the click
417
+      #endif
403
 
418
 
404
       #ifdef G3D_PANEL
419
       #ifdef G3D_PANEL
405
         #define SDCARDDETECT 49
420
         #define SDCARDDETECT 49
418
     //#define SHIFT_LD 42
433
     //#define SHIFT_LD 42
419
     //#define SHIFT_OUT 40
434
     //#define SHIFT_OUT 40
420
     //#define SHIFT_EN 17
435
     //#define SHIFT_EN 17
421
-    
422
-    #define LCD_PINS_RS 16 
436
+
437
+    #define LCD_PINS_RS 16
423
     #define LCD_PINS_ENABLE 17
438
     #define LCD_PINS_ENABLE 17
424
     #define LCD_PINS_D4 23
439
     #define LCD_PINS_D4 23
425
-    #define LCD_PINS_D5 25 
440
+    #define LCD_PINS_D5 25
426
     #define LCD_PINS_D6 27
441
     #define LCD_PINS_D6 27
427
     #define LCD_PINS_D7 29
442
     #define LCD_PINS_D7 29
428
   #endif 
443
   #endif 
470
 #define HEATER_1_PIN        -1
485
 #define HEATER_1_PIN        -1
471
 #define HEATER_2_PIN        -1
486
 #define HEATER_2_PIN        -1
472
 #define TEMP_0_PIN          2    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
487
 #define TEMP_0_PIN          2    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
473
-#define TEMP_1_PIN          -1   
474
-#define TEMP_2_PIN          -1   
488
+#define TEMP_1_PIN          -1
489
+#define TEMP_2_PIN          -1
475
 #define TEMP_BED_PIN        1    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
490
 #define TEMP_BED_PIN        1    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
476
 #endif// MOTHERBOARD == 33 || MOTHERBOARD == 34
491
 #endif// MOTHERBOARD == 33 || MOTHERBOARD == 34
477
 
492
 
478
-// SPI for Max6675 Thermocouple 
493
+// SPI for Max6675 Thermocouple
479
 
494
 
480
 #ifndef SDSUPPORT
495
 #ifndef SDSUPPORT
481
-// 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
482
   #define MAX_SCK_PIN          52
497
   #define MAX_SCK_PIN          52
483
   #define MAX_MISO_PIN         50
498
   #define MAX_MISO_PIN         50
484
   #define MAX_MOSI_PIN         51
499
   #define MAX_MOSI_PIN         51
530
 #define HEATER_1_PIN        -1
545
 #define HEATER_1_PIN        -1
531
 #define HEATER_2_PIN        -1
546
 #define HEATER_2_PIN        -1
532
 #define TEMP_0_PIN          0    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
547
 #define TEMP_0_PIN          0    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
533
-#define TEMP_1_PIN          -1    
534
-#define TEMP_2_PIN          -1    
548
+#define TEMP_1_PIN          -1
549
+#define TEMP_2_PIN          -1
535
 #define HEATER_BED_PIN      -1
550
 #define HEATER_BED_PIN      -1
536
 #define TEMP_BED_PIN        -1
551
 #define TEMP_BED_PIN        -1
537
 
552
 
594
     #define PS_ON_PIN       -1    //changed @ rkoeppl 20110410
609
     #define PS_ON_PIN       -1    //changed @ rkoeppl 20110410
595
     #define KILL_PIN        -1    //changed @ drakelive 20120830
610
     #define KILL_PIN        -1    //changed @ drakelive 20120830
596
     //our pin for debugging.
611
     //our pin for debugging.
597
-    
612
+
598
     #define DEBUG_PIN        0
613
     #define DEBUG_PIN        0
599
-    
614
+
600
     //our RS485 pins
615
     //our RS485 pins
601
     #define TX_ENABLE_PIN 12
616
     #define TX_ENABLE_PIN 12
602
     #define RX_ENABLE_PIN 13
617
     #define RX_ENABLE_PIN 13
603
 
618
 
604
-    
619
+
605
 #endif
620
 #endif
606
 
621
 
607
 /****************************************************************************************
622
 /****************************************************************************************
617
 #if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64
632
 #if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64
618
 #undef MOTHERBOARD
633
 #undef MOTHERBOARD
619
 #define MOTHERBOARD 6
634
 #define MOTHERBOARD 6
620
-#define SANGUINOLOLU_V_1_2 
635
+#define SANGUINOLOLU_V_1_2
621
 #endif
636
 #endif
622
 #if MOTHERBOARD == 6
637
 #if MOTHERBOARD == 6
623
 #define KNOWN_BOARD 1
638
 #define KNOWN_BOARD 1
644
 
659
 
645
 #define LED_PIN            -1
660
 #define LED_PIN            -1
646
 
661
 
647
-#define FAN_PIN            -1 
662
+#define FAN_PIN            -1
648
 #if FAN_PIN == 12 || FAN_PIN ==13
663
 #if FAN_PIN == 12 || FAN_PIN ==13
649
 #define FAN_SOFT_PWM
664
 #define FAN_SOFT_PWM
650
 #endif
665
 #endif
726
     
741
     
727
    #endif //Newpanel
742
    #endif //Newpanel
728
  #endif //Ultipanel
743
  #endif //Ultipanel
729
- 
744
+
730
 #endif
745
 #endif
731
 
746
 
732
 
747
 
756
 #define Y_MAX_PIN 28
771
 #define Y_MAX_PIN 28
757
 #define Y_ENABLE_PIN 29
772
 #define Y_ENABLE_PIN 29
758
 
773
 
759
-#define Z_STEP_PIN 37 
774
+#define Z_STEP_PIN 37
760
 #define Z_DIR_PIN 39
775
 #define Z_DIR_PIN 39
761
 #define Z_MIN_PIN 30
776
 #define Z_MIN_PIN 30
762
 #define Z_MAX_PIN 32
777
 #define Z_MAX_PIN 32
763
 #define Z_ENABLE_PIN 35
778
 #define Z_ENABLE_PIN 35
764
 
779
 
765
-#define HEATER_BED_PIN 4 
766
-#define TEMP_BED_PIN 10  
780
+#define HEATER_BED_PIN 4
781
+#define TEMP_BED_PIN 10
767
 
782
 
768
 #define HEATER_0_PIN  2
783
 #define HEATER_0_PIN  2
769
-#define TEMP_0_PIN 8   
784
+#define TEMP_0_PIN 8
770
 
785
 
771
 #define HEATER_1_PIN 3
786
 #define HEATER_1_PIN 3
772
 #define TEMP_1_PIN 9
787
 #define TEMP_1_PIN 9
796
   //arduino pin witch triggers an piezzo beeper
811
   //arduino pin witch triggers an piezzo beeper
797
     #define BEEPER 18
812
     #define BEEPER 18
798
 
813
 
799
-    #define LCD_PINS_RS 20 
814
+    #define LCD_PINS_RS 20
800
     #define LCD_PINS_ENABLE 17
815
     #define LCD_PINS_ENABLE 17
801
     #define LCD_PINS_D4 16
816
     #define LCD_PINS_D4 16
802
-    #define LCD_PINS_D5 21 
817
+    #define LCD_PINS_D5 21
803
     #define LCD_PINS_D6 5
818
     #define LCD_PINS_D6 5
804
     #define LCD_PINS_D7 6
819
     #define LCD_PINS_D7 6
805
-    
820
+
806
     //buttons are directly attached
821
     //buttons are directly attached
807
     #define BTN_EN1 40
822
     #define BTN_EN1 40
808
     #define BTN_EN2 42
823
     #define BTN_EN2 42
819
     #define SHIFT_LD 42
834
     #define SHIFT_LD 42
820
     #define SHIFT_OUT 40
835
     #define SHIFT_OUT 40
821
     #define SHIFT_EN 17
836
     #define SHIFT_EN 17
822
-    
823
-    #define LCD_PINS_RS 16 
837
+
838
+    #define LCD_PINS_RS 16
824
     #define LCD_PINS_ENABLE 5
839
     #define LCD_PINS_ENABLE 5
825
     #define LCD_PINS_D4 6
840
     #define LCD_PINS_D4 6
826
-    #define LCD_PINS_D5 21 
841
+    #define LCD_PINS_D5 21
827
     #define LCD_PINS_D6 20
842
     #define LCD_PINS_D6 20
828
     #define LCD_PINS_D7 19
843
     #define LCD_PINS_D7 19
829
   
844
   
859
 #define Y_MAX_PIN 16
874
 #define Y_MAX_PIN 16
860
 #define Y_ENABLE_PIN 29
875
 #define Y_ENABLE_PIN 29
861
 
876
 
862
-#define Z_STEP_PIN 37 
877
+#define Z_STEP_PIN 37
863
 #define Z_DIR_PIN 39
878
 #define Z_DIR_PIN 39
864
 #define Z_MIN_PIN 19
879
 #define Z_MIN_PIN 19
865
 #define Z_MAX_PIN 18
880
 #define Z_MAX_PIN 18
866
 #define Z_ENABLE_PIN 35
881
 #define Z_ENABLE_PIN 35
867
 
882
 
868
-#define HEATER_BED_PIN -1 
869
-#define TEMP_BED_PIN -1  
883
+#define HEATER_BED_PIN -1
884
+#define TEMP_BED_PIN -1
870
 
885
 
871
 #define HEATER_0_PIN  2
886
 #define HEATER_0_PIN  2
872
-#define TEMP_0_PIN 8   
887
+#define TEMP_0_PIN 8
873
 
888
 
874
 #define HEATER_1_PIN 1
889
 #define HEATER_1_PIN 1
875
 #define TEMP_1_PIN 1
890
 #define TEMP_1_PIN 1
893
 #define KILL_PIN           -1
908
 #define KILL_PIN           -1
894
 #define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
909
 #define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
895
 
910
 
896
-#define LCD_PINS_RS 24 
911
+#define LCD_PINS_RS 24
897
 #define LCD_PINS_ENABLE 22
912
 #define LCD_PINS_ENABLE 22
898
 #define LCD_PINS_D4 36
913
 #define LCD_PINS_D4 36
899
-#define LCD_PINS_D5 34 
914
+#define LCD_PINS_D5 34
900
 #define LCD_PINS_D6 32
915
 #define LCD_PINS_D6 32
901
 #define LCD_PINS_D7 30
916
 #define LCD_PINS_D7 30
902
 
917
 
918
 #define X_DIR_PIN          16
933
 #define X_DIR_PIN          16
919
 #define X_ENABLE_PIN       48
934
 #define X_ENABLE_PIN       48
920
 #define X_MIN_PIN          37
935
 #define X_MIN_PIN          37
921
-#define X_MAX_PIN          36 
936
+#define X_MAX_PIN          36
922
 
937
 
923
 #define Y_STEP_PIN         54
938
 #define Y_STEP_PIN         54
924
-#define Y_DIR_PIN          47 
939
+#define Y_DIR_PIN          47
925
 #define Y_ENABLE_PIN       55
940
 #define Y_ENABLE_PIN       55
926
 #define Y_MIN_PIN          35
941
 #define Y_MIN_PIN          35
927
-#define Y_MAX_PIN          34 
942
+#define Y_MAX_PIN          34
928
 
943
 
929
-#define Z_STEP_PIN         57 
944
+#define Z_STEP_PIN         57
930
 #define Z_DIR_PIN          56
945
 #define Z_DIR_PIN          56
931
-#define Z_ENABLE_PIN       62 
946
+#define Z_ENABLE_PIN       62
932
 #define Z_MIN_PIN          33
947
 #define Z_MIN_PIN          33
933
 #define Z_MAX_PIN          32
948
 #define Z_MAX_PIN          32
934
 
949
 
946
 
961
 
947
 #define LED_PIN            13
962
 #define LED_PIN            13
948
 
963
 
949
-#define FAN_PIN            7 
964
+#define FAN_PIN            7
950
 //additional FAN1 PIN (e.g. useful for electronics fan or light on/off) on PIN 8
965
 //additional FAN1 PIN (e.g. useful for electronics fan or light on/off) on PIN 8
951
 
966
 
952
 #define PS_ON_PIN          45
967
 #define PS_ON_PIN          45
953
 #define KILL_PIN           46
968
 #define KILL_PIN           46
954
 
969
 
955
-#define HEATER_0_PIN       2    // EXTRUDER 1
956
-#define HEATER_1_PIN       3    // EXTRUDER 2
957
-#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
958
 //optional FAN1 can be used as 4th heater output: #define HEATER_3_PIN       8    // EXTRUDER 4
1007
 //optional FAN1 can be used as 4th heater output: #define HEATER_3_PIN       8    // EXTRUDER 4
959
-#define HEATER_BED_PIN     9    // BED
960
 
1008
 
961
-#define TEMP_0_PIN         15   // ANALOG NUMBERING
962
-#define TEMP_1_PIN         14   // ANALOG NUMBERING
963
-#define TEMP_2_PIN         13   // ANALOG NUMBERING
964
-//optional for extruder 4 or chamber: #define TEMP_2_PIN         12   // ANALOG NUMBERING
965
-#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
966
 
1020
 
967
 #define SDPOWER            -1
1021
 #define SDPOWER            -1
968
 #define SDSS               53
1022
 #define SDSS               53
969
 #define SDCARDDETECT       49
1023
 #define SDCARDDETECT       49
970
 #define BEEPER             44
1024
 #define BEEPER             44
971
-#define LCD_PINS_RS        19 
1025
+#define LCD_PINS_RS        19
972
 #define LCD_PINS_ENABLE    42
1026
 #define LCD_PINS_ENABLE    42
973
 #define LCD_PINS_D4        18
1027
 #define LCD_PINS_D4        18
974
-#define LCD_PINS_D5        38 
1028
+#define LCD_PINS_D5        38
975
 #define LCD_PINS_D6        41
1029
 #define LCD_PINS_D6        41
976
 #define LCD_PINS_D7        40
1030
 #define LCD_PINS_D7        40
977
 #define BTN_EN1            11
1031
 #define BTN_EN1            11
1147
 
1201
 
1148
 #define LED_PIN            -1
1202
 #define LED_PIN            -1
1149
 
1203
 
1150
-#define FAN_PIN            -1 
1204
+#define FAN_PIN            -1
1151
 
1205
 
1152
 #define PS_ON_PIN         14
1206
 #define PS_ON_PIN         14
1153
 #define KILL_PIN           -1
1207
 #define KILL_PIN           -1
1186
 *       MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
1240
 *       MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
1187
 *        SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
1241
 *        SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
1188
 *                  RST  9|        |32  AREF
1242
 *                  RST  9|        |32  AREF
1189
-*                  VCC 10|        |31  GND 
1243
+*                  VCC 10|        |31  GND
1190
 *                  GND 11|        |30  AVCC
1244
 *                  GND 11|        |30  AVCC
1191
 *                XTAL2 12|        |29  PC7 (D 23)
1245
 *                XTAL2 12|        |29  PC7 (D 23)
1192
 *                XTAL1 13|        |28  PC6 (D 22)
1246
 *                XTAL1 13|        |28  PC6 (D 22)
1243
 #define KILL_PIN           -1
1297
 #define KILL_PIN           -1
1244
 
1298
 
1245
 #define HEATER_0_PIN       4
1299
 #define HEATER_0_PIN       4
1246
-#define HEATER_1_PIN       -1 // 12 
1300
+#define HEATER_1_PIN       -1 // 12
1247
 #define HEATER_2_PIN       -1 // 13
1301
 #define HEATER_2_PIN       -1 // 13
1248
 #define TEMP_0_PIN          0 //D27   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
1302
 #define TEMP_0_PIN          0 //D27   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
1249
 #define TEMP_1_PIN         -1 // 1
1303
 #define TEMP_1_PIN         -1 // 1
1305
 #define KILL_PIN           -1
1359
 #define KILL_PIN           -1
1306
 
1360
 
1307
 #define HEATER_0_PIN        3 /*DONE PWM on RIGHT connector */
1361
 #define HEATER_0_PIN        3 /*DONE PWM on RIGHT connector */
1308
-#define HEATER_1_PIN       -1 
1362
+#define HEATER_1_PIN       -1
1309
 #define HEATER_2_PIN       -1
1363
 #define HEATER_2_PIN       -1
1310
-#define HEATER_1_PIN       -1 
1364
+#define HEATER_1_PIN       -1
1311
 #define HEATER_2_PIN       -1
1365
 #define HEATER_2_PIN       -1
1312
-#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING 
1366
+#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING
1313
 #define TEMP_1_PIN          1 // ANALOG
1367
 #define TEMP_1_PIN          1 // ANALOG
1314
 #define TEMP_2_PIN         -1 // 2
1368
 #define TEMP_2_PIN         -1 // 2
1315
 #define HEATER_BED_PIN      4
1369
 #define HEATER_BED_PIN      4
1357
 #define Z_MS2_PIN 67
1411
 #define Z_MS2_PIN 67
1358
 
1412
 
1359
 #define HEATER_BED_PIN 3
1413
 #define HEATER_BED_PIN 3
1360
-#define TEMP_BED_PIN 2 
1414
+#define TEMP_BED_PIN 2
1361
 
1415
 
1362
 #define HEATER_0_PIN  9
1416
 #define HEATER_0_PIN  9
1363
 #define TEMP_0_PIN 0
1417
 #define TEMP_0_PIN 0
1365
 #define HEATER_1_PIN 7
1419
 #define HEATER_1_PIN 7
1366
 #define TEMP_1_PIN 1
1420
 #define TEMP_1_PIN 1
1367
 
1421
 
1422
+#ifdef BARICUDA
1423
+#define HEATER_2_PIN 6
1424
+#else
1368
 #define HEATER_2_PIN -1
1425
 #define HEATER_2_PIN -1
1426
+#endif
1369
 #define TEMP_2_PIN -1
1427
 #define TEMP_2_PIN -1
1370
 
1428
 
1371
 #define E0_STEP_PIN         34
1429
 #define E0_STEP_PIN         34
1446
 
1504
 
1447
 #define HEATER_0_PIN       9    // EXTRUDER 1
1505
 #define HEATER_0_PIN       9    // EXTRUDER 1
1448
 #define HEATER_1_PIN       8    // EXTRUDER 2 (FAN On Sprinter)
1506
 #define HEATER_1_PIN       8    // EXTRUDER 2 (FAN On Sprinter)
1449
-#define HEATER_2_PIN       -1  
1507
+#define HEATER_2_PIN       -1
1450
 
1508
 
1451
-#if TEMP_SENSOR_0 == -1 
1509
+#if TEMP_SENSOR_0 == -1
1452
 #define TEMP_0_PIN         8   // ANALOG NUMBERING
1510
 #define TEMP_0_PIN         8   // ANALOG NUMBERING
1453
 #else
1511
 #else
1454
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
1512
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
1467
 
1525
 
1468
   #ifdef NEWPANEL
1526
   #ifdef NEWPANEL
1469
   //arduino pin which triggers an piezzo beeper
1527
   //arduino pin which triggers an piezzo beeper
1470
-    
1471
-    #define LCD_PINS_RS 16 
1528
+
1529
+    #define LCD_PINS_RS 16
1472
     #define LCD_PINS_ENABLE 17
1530
     #define LCD_PINS_ENABLE 17
1473
     #define LCD_PINS_D4 23
1531
     #define LCD_PINS_D4 23
1474
-    #define LCD_PINS_D5 25 
1532
+    #define LCD_PINS_D5 25
1475
     #define LCD_PINS_D6 27
1533
     #define LCD_PINS_D6 27
1476
     #define LCD_PINS_D7 29
1534
     #define LCD_PINS_D7 29
1477
-    
1535
+
1478
     //buttons are directly attached using AUX-2
1536
     //buttons are directly attached using AUX-2
1479
     #define BTN_EN1 59
1537
     #define BTN_EN1 59
1480
     #define BTN_EN2 64
1538
     #define BTN_EN2 64
1491
 #endif
1549
 #endif
1492
 
1550
 
1493
 //List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
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!
1494
-#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,
1495
 #if EXTRUDERS > 1
1553
 #if EXTRUDERS > 1
1496
   #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN,
1554
   #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN,
1497
 #else
1555
 #else

+ 30
- 0
Marlin/planner.cpp 查看文件

439
   unsigned char z_active = 0;
439
   unsigned char z_active = 0;
440
   unsigned char e_active = 0;
440
   unsigned char e_active = 0;
441
   unsigned char tail_fan_speed = fanSpeed;
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
   block_t *block;
446
   block_t *block;
443
 
447
 
444
   if(block_buffer_tail != block_buffer_head)
448
   if(block_buffer_tail != block_buffer_head)
445
   {
449
   {
446
     uint8_t block_index = block_buffer_tail;
450
     uint8_t block_index = block_buffer_tail;
447
     tail_fan_speed = block_buffer[block_index].fan_speed;
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
     while(block_index != block_buffer_head)
456
     while(block_index != block_buffer_head)
449
     {
457
     {
450
       block = &block_buffer[block_index];
458
       block = &block_buffer[block_index];
486
 #ifdef AUTOTEMP
494
 #ifdef AUTOTEMP
487
   getHighESpeed();
495
   getHighESpeed();
488
 #endif
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
   }
577
   }
560
 
578
 
561
   block->fan_speed = fanSpeed;
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
   // Compute direction bits for this block 
585
   // Compute direction bits for this block 
564
   block->direction_bits = 0;
586
   block->direction_bits = 0;
582
   block->active_extruder = extruder;
604
   block->active_extruder = extruder;
583
 
605
 
584
   //enable active axes
606
   //enable active axes
607
+  #ifdef COREXY
608
+  if((block->steps_x != 0) || (block->steps_y != 0))
609
+  {
610
+    enable_x();
611
+    enable_y();
612
+  }
613
+  #else
585
   if(block->steps_x != 0) enable_x();
614
   if(block->steps_x != 0) enable_x();
586
   if(block->steps_y != 0) enable_y();
615
   if(block->steps_y != 0) enable_y();
616
+  #endif
587
 #ifndef Z_LATE_ENABLE
617
 #ifndef Z_LATE_ENABLE
588
   if(block->steps_z != 0) enable_z();
618
   if(block->steps_z != 0) enable_z();
589
 #endif
619
 #endif

+ 4
- 0
Marlin/planner.h 查看文件

60
   unsigned long final_rate;                          // The minimal rate at exit
60
   unsigned long final_rate;                          // The minimal rate at exit
61
   unsigned long acceleration_st;                     // acceleration steps/sec^2
61
   unsigned long acceleration_st;                     // acceleration steps/sec^2
62
   unsigned long fan_speed;
62
   unsigned long fan_speed;
63
+  #ifdef BARICUDA
64
+  unsigned long valve_pressure;
65
+  unsigned long e_to_p_pressure;
66
+  #endif
63
   volatile char busy;
67
   volatile char busy;
64
 } block_t;
68
 } block_t;
65
 
69
 

+ 9
- 3
Marlin/temperature.cpp 查看文件

571
 
571
 
572
 void tp_init()
572
 void tp_init()
573
 {
573
 {
574
+#if (MOTHERBOARD == 80) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
575
+  //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
576
+  MCUCR=(1<<JTD); 
577
+  MCUCR=(1<<JTD);
578
+#endif
579
+  
574
   // Finish init of mult extruder arrays 
580
   // Finish init of mult extruder arrays 
575
   for(int e = 0; e < EXTRUDERS; e++) {
581
   for(int e = 0; e < EXTRUDERS; e++) {
576
     // populate with the first value 
582
     // populate with the first value 
647
     #if TEMP_2_PIN < 8
653
     #if TEMP_2_PIN < 8
648
        DIDR0 |= 1 << TEMP_2_PIN; 
654
        DIDR0 |= 1 << TEMP_2_PIN; 
649
     #else
655
     #else
650
-       DIDR2 = 1<<(TEMP_2_PIN - 8); 
656
+       DIDR2 |= 1<<(TEMP_2_PIN - 8); 
651
     #endif
657
     #endif
652
   #endif
658
   #endif
653
   #if (TEMP_BED_PIN > -1)
659
   #if (TEMP_BED_PIN > -1)
689
 
695
 
690
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
696
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
691
   minttemp[1] = HEATER_1_MINTEMP;
697
   minttemp[1] = HEATER_1_MINTEMP;
692
-  while(analog2temp(minttemp_raw[1], 1) > HEATER_1_MINTEMP) {
698
+  while(analog2temp(minttemp_raw[1], 1) < HEATER_1_MINTEMP) {
693
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
699
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
694
     minttemp_raw[1] += OVERSAMPLENR;
700
     minttemp_raw[1] += OVERSAMPLENR;
695
 #else
701
 #else
710
 
716
 
711
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
717
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
712
   minttemp[2] = HEATER_2_MINTEMP;
718
   minttemp[2] = HEATER_2_MINTEMP;
713
-  while(analog2temp(minttemp_raw[2], 2) > HEATER_2_MINTEMP) {
719
+  while(analog2temp(minttemp_raw[2], 2) < HEATER_2_MINTEMP) {
714
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
720
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
715
     minttemp_raw[2] += OVERSAMPLENR;
721
     minttemp_raw[2] += OVERSAMPLENR;
716
 #else
722
 #else

+ 85
- 20
Marlin/ultralcd.cpp 查看文件

116
     } } while(0)
116
     } } while(0)
117
 
117
 
118
 /** Used variables to keep track of the menu */
118
 /** Used variables to keep track of the menu */
119
+#ifndef REPRAPWORLD_KEYPAD
119
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
120
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
121
+#else
122
+volatile uint16_t buttons;//Contains the bits of the currently pressed buttons (extended).
123
+#endif
120
 
124
 
121
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
125
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
122
 uint32_t blocking_enc;
126
 uint32_t blocking_enc;
123
 uint8_t lastEncoderBits;
127
 uint8_t lastEncoderBits;
124
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
128
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
125
 uint32_t encoderPosition;
129
 uint32_t encoderPosition;
126
-#if (SDCARDDETECT > -1)
130
+#if (SDCARDDETECT > 0)
127
 bool lcd_oldcardstatus;
131
 bool lcd_oldcardstatus;
128
 #endif
132
 #endif
129
 #endif//ULTIPANEL
133
 #endif//ULTIPANEL
225
         }else{
229
         }else{
226
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
230
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
227
 #if SDCARDDETECT < 1
231
 #if SDCARDDETECT < 1
228
-			MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));	// SD-card changed by user
229
-#endif			
232
+            MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
233
+#endif
230
         }
234
         }
231
     }else{
235
     }else{
232
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
236
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
233
-#if SDCARDDETECT < 1		
234
-		MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));	// Manually initialize the SD-card via user interface
235
-#endif		
237
+#if SDCARDDETECT < 1
238
+        MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
239
+#endif
236
     }
240
     }
237
 #endif
241
 #endif
238
     END_MENU();
242
     END_MENU();
255
     setTargetBed(plaPreheatHPBTemp);
259
     setTargetBed(plaPreheatHPBTemp);
256
     fanSpeed = plaPreheatFanSpeed;
260
     fanSpeed = plaPreheatFanSpeed;
257
     lcd_return_to_status();
261
     lcd_return_to_status();
262
+    setWatch(); // heater sanity check timer
258
 }
263
 }
259
 
264
 
260
 void lcd_preheat_abs()
265
 void lcd_preheat_abs()
265
     setTargetBed(absPreheatHPBTemp);
270
     setTargetBed(absPreheatHPBTemp);
266
     fanSpeed = absPreheatFanSpeed;
271
     fanSpeed = absPreheatFanSpeed;
267
     lcd_return_to_status();
272
     lcd_return_to_status();
273
+    setWatch(); // heater sanity check timer
274
+}
275
+
276
+static void lcd_cooldown()
277
+{
278
+    setTargetHotend0(0);
279
+    setTargetHotend1(0);
280
+    setTargetHotend2(0);
281
+    setTargetBed(0);
282
+    lcd_return_to_status();
268
 }
283
 }
269
 
284
 
270
 static void lcd_tune_menu()
285
 static void lcd_tune_menu()
302
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
317
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
303
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
318
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
304
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
319
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
305
-    MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
320
+    MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
306
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
321
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
307
     END_MENU();
322
     END_MENU();
308
 }
323
 }
463
 
478
 
464
 static void lcd_control_temperature_menu()
479
 static void lcd_control_temperature_menu()
465
 {
480
 {
466
-	// set up temp variables - undo the default scaling
467
-	raw_Ki = unscalePID_i(Ki);
468
-	raw_Kd = unscalePID_d(Kd);
469
-	
481
+    // set up temp variables - undo the default scaling
482
+    raw_Ki = unscalePID_i(Ki);
483
+    raw_Kd = unscalePID_d(Kd);
484
+
470
     START_MENU();
485
     START_MENU();
471
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
486
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
472
     MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
487
     MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
488
 #endif
503
 #endif
489
 #ifdef PIDTEMP
504
 #ifdef PIDTEMP
490
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
505
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
491
-	// i is typically a small value so allows values below 1
506
+    // i is typically a small value so allows values below 1
492
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
507
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
493
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
508
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
494
 # ifdef PID_ADD_EXTRUSION_RATE
509
 # ifdef PID_ADD_EXTRUSION_RATE
691
 menu_edit_type(float, float52, ftostr52, 100)
706
 menu_edit_type(float, float52, ftostr52, 100)
692
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
707
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
693
 
708
 
709
+#ifdef REPRAPWORLD_KEYPAD
710
+    static void reprapworld_keypad_move_y_down() {
711
+        encoderPosition = 1;
712
+        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
713
+        lcd_move_y();
714
+    }
715
+    static void reprapworld_keypad_move_y_up() {
716
+        encoderPosition = -1;
717
+        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
718
+        lcd_move_y();
719
+    }
720
+    static void reprapworld_keypad_move_home() {
721
+        //enquecommand_P((PSTR("G28"))); // move all axis home
722
+        // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
723
+        enquecommand_P((PSTR("G28 Y")));
724
+    }
725
+#endif
726
+
694
 /** End of menus **/
727
 /** End of menus **/
695
 
728
 
696
 static void lcd_quick_feedback()
729
 static void lcd_quick_feedback()
752
     pinMode(SDCARDDETECT,INPUT);
785
     pinMode(SDCARDDETECT,INPUT);
753
     WRITE(BTN_EN1,HIGH);
786
     WRITE(BTN_EN1,HIGH);
754
     WRITE(BTN_EN2,HIGH);
787
     WRITE(BTN_EN2,HIGH);
755
-  #if defined(BTN_ENC) && BTN_ENC > -1
788
+  #if BTN_ENC > 0
756
     pinMode(BTN_ENC,INPUT); 
789
     pinMode(BTN_ENC,INPUT); 
757
     WRITE(BTN_ENC,HIGH);
790
     WRITE(BTN_ENC,HIGH);
758
   #endif    
791
   #endif    
792
+  #ifdef REPRAPWORLD_KEYPAD
793
+    pinMode(SHIFT_CLK,OUTPUT);
794
+    pinMode(SHIFT_LD,OUTPUT);
795
+    pinMode(SHIFT_OUT,INPUT);
796
+    WRITE(SHIFT_OUT,HIGH);
797
+    WRITE(SHIFT_LD,HIGH);
798
+  #endif
759
 #else
799
 #else
760
     pinMode(SHIFT_CLK,OUTPUT);
800
     pinMode(SHIFT_CLK,OUTPUT);
761
     pinMode(SHIFT_LD,OUTPUT);
801
     pinMode(SHIFT_LD,OUTPUT);
765
     WRITE(SHIFT_LD,HIGH); 
805
     WRITE(SHIFT_LD,HIGH); 
766
     WRITE(SHIFT_EN,LOW);
806
     WRITE(SHIFT_EN,LOW);
767
 #endif//!NEWPANEL
807
 #endif//!NEWPANEL
768
-#if (SDCARDDETECT > -1)
808
+#if (SDCARDDETECT > 0)
769
     WRITE(SDCARDDETECT, HIGH);
809
     WRITE(SDCARDDETECT, HIGH);
770
     lcd_oldcardstatus = IS_SD_INSERTED;
810
     lcd_oldcardstatus = IS_SD_INSERTED;
771
-#endif//(SDCARDDETECT > -1)
811
+#endif//(SDCARDDETECT > 0)
772
     lcd_buttons_update();
812
     lcd_buttons_update();
773
 #ifdef ULTIPANEL    
813
 #ifdef ULTIPANEL    
774
     encoderDiff = 0;
814
     encoderDiff = 0;
785
     buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
825
     buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
786
     #endif
826
     #endif
787
     
827
     
788
-    #if (SDCARDDETECT > -1)
828
+    #if (SDCARDDETECT > 0)
789
     if((IS_SD_INSERTED != lcd_oldcardstatus))
829
     if((IS_SD_INSERTED != lcd_oldcardstatus))
790
     {
830
     {
791
         lcdDrawUpdate = 2;
831
         lcdDrawUpdate = 2;
808
     if (lcd_next_update_millis < millis())
848
     if (lcd_next_update_millis < millis())
809
     {
849
     {
810
 #ifdef ULTIPANEL
850
 #ifdef ULTIPANEL
851
+        #ifdef REPRAPWORLD_KEYPAD
852
+        if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
853
+            reprapworld_keypad_move_y_down();
854
+        }
855
+        if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
856
+            reprapworld_keypad_move_y_up();
857
+        }
858
+        if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
859
+            reprapworld_keypad_move_home();
860
+        }
861
+        #endif
811
         if (encoderDiff)
862
         if (encoderDiff)
812
         {
863
         {
813
             lcdDrawUpdate = 1;
864
             lcdDrawUpdate = 1;
890
     uint8_t newbutton=0;
941
     uint8_t newbutton=0;
891
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
942
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
892
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
943
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
893
-  #if defined(BTN_ENC) && BTN_ENC > -1
944
+  #if BTN_ENC > 0
894
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
945
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
895
         newbutton |= EN_C;
946
         newbutton |= EN_C;
896
   #endif      
947
   #endif      
948
+  #ifdef REPRAPWORLD_KEYPAD
949
+    // for the reprapworld_keypad
950
+    uint8_t newbutton_reprapworld_keypad=0;
951
+    WRITE(SHIFT_LD,LOW);
952
+    WRITE(SHIFT_LD,HIGH);
953
+    for(int8_t i=0;i<8;i++) {
954
+        newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
955
+        if(READ(SHIFT_OUT))
956
+            newbutton_reprapworld_keypad|=(1<<7);
957
+        WRITE(SHIFT_CLK,HIGH);
958
+        WRITE(SHIFT_CLK,LOW);
959
+    }
960
+    newbutton |= ((~newbutton_reprapworld_keypad) << REPRAPWORLD_BTN_OFFSET); //invert it, because a pressed switch produces a logical 0
961
+  #endif
897
     buttons = newbutton;
962
     buttons = newbutton;
898
 #else   //read it from the shift register
963
 #else   //read it from the shift register
899
     uint8_t newbutton=0;
964
     uint8_t newbutton=0;
1162
 {
1227
 {
1163
   Ki = scalePID_i(raw_Ki);
1228
   Ki = scalePID_i(raw_Ki);
1164
   updatePID();
1229
   updatePID();
1165
-}	
1230
+}
1166
 
1231
 
1167
 // Callback for after editing PID d value
1232
 // Callback for after editing PID d value
1168
 // grab the pid d value out of the temp variable; scale it; then update the PID driver
1233
 // grab the pid d value out of the temp variable; scale it; then update the PID driver
1170
 {
1235
 {
1171
   Kd = scalePID_d(raw_Kd);
1236
   Kd = scalePID_d(raw_Kd);
1172
   updatePID();
1237
   updatePID();
1173
-}	
1174
-	
1238
+}
1239
+
1175
 #endif //ULTRA_LCD
1240
 #endif //ULTRA_LCD

+ 0
- 1
Marlin/ultralcd.h 查看文件

35
   extern int absPreheatFanSpeed;
35
   extern int absPreheatFanSpeed;
36
     
36
     
37
   void lcd_buzz(long duration,uint16_t freq);
37
   void lcd_buzz(long duration,uint16_t freq);
38
-
39
   bool lcd_clicked();
38
   bool lcd_clicked();
40
 
39
 
41
 #else //no lcd
40
 #else //no lcd

+ 33
- 2
Marlin/ultralcd_implementation_hitachi_HD44780.h 查看文件

6
 * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
6
 * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
7
 **/
7
 **/
8
 
8
 
9
+#ifndef REPRAPWORLD_KEYPAD
9
 extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
10
 extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
11
+#else
12
+extern volatile uint16_t buttons;  //an extended version of the last checked buttons in a bit array.
13
+#endif
10
 
14
 
11
 ////////////////////////////////////
15
 ////////////////////////////////////
12
 // Setup button and encode mappings for each panel (into 'buttons' variable)
16
 // Setup button and encode mappings for each panel (into 'buttons' variable)
55
 
59
 
56
 #elif defined(LCD_I2C_PANELOLU2)
60
 #elif defined(LCD_I2C_PANELOLU2)
57
   // encoder click can be read through I2C if not directly connected
61
   // encoder click can be read through I2C if not directly connected
58
-  #if !defined(BTN_ENC) || BTN_ENC == -1 
62
+  #if BTN_ENC <= 0 
59
     #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
63
     #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
60
   
64
   
61
     #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
65
     #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
68
     #define LCD_CLICKED (buttons&EN_C)  
72
     #define LCD_CLICKED (buttons&EN_C)  
69
   #endif
73
   #endif
70
 
74
 
75
+#elif defined(REPRAPWORLD_KEYPAD)
76
+    // define register bit values, don't change it
77
+    #define BLEN_REPRAPWORLD_KEYPAD_F3 0
78
+    #define BLEN_REPRAPWORLD_KEYPAD_F2 1
79
+    #define BLEN_REPRAPWORLD_KEYPAD_F1 2
80
+    #define BLEN_REPRAPWORLD_KEYPAD_UP 3
81
+    #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
82
+    #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
83
+    #define BLEN_REPRAPWORLD_KEYPAD_DOWN 6
84
+    #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
85
+    
86
+    #define REPRAPWORLD_BTN_OFFSET 3 // bit offset into buttons for shift register values
87
+
88
+    #define EN_REPRAPWORLD_KEYPAD_F3 (1<<(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
89
+    #define EN_REPRAPWORLD_KEYPAD_F2 (1<<(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
90
+    #define EN_REPRAPWORLD_KEYPAD_F1 (1<<(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
91
+    #define EN_REPRAPWORLD_KEYPAD_UP (1<<(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
92
+    #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
93
+    #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
94
+    #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
95
+    #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
96
+
97
+    #define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
98
+    #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
99
+    #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
100
+    #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
101
+
71
 #elif defined(NEWPANEL)
102
 #elif defined(NEWPANEL)
72
   #define LCD_CLICKED (buttons&EN_C)
103
   #define LCD_CLICKED (buttons&EN_C)
73
   
104
   
90
   #define B_ST (1<<BL_ST)
121
   #define B_ST (1<<BL_ST)
91
   
122
   
92
   #define LCD_CLICKED (buttons&(B_MI|B_ST))
123
   #define LCD_CLICKED (buttons&(B_MI|B_ST))
93
-#endif//else NEWPANEL
124
+#endif
94
 
125
 
95
 ////////////////////////
126
 ////////////////////////
96
 // Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
127
 // Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)

正在加载...
取消
保存