Pārlūkot izejas kodu

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

Robert F-C 12 gadus atpakaļ
vecāks
revīzija
0d4a9444c4

+ 115
- 45
Marlin/Configuration.h Parādīt failu

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.
81
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
81
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
82
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
82
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
83
 //
83
 //
84
-//    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
85
 //                          (but gives greater accuracy and more stable PID)
85
 //                          (but gives greater accuracy and more stable PID)
86
 // 51 is 100k thermistor - EPCOS (1k pullup)
86
 // 51 is 100k thermistor - EPCOS (1k pullup)
87
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
87
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
93
 #define TEMP_SENSOR_BED 0
93
 #define TEMP_SENSOR_BED 0
94
 
94
 
95
 // Actual temperature must be close to target for this long before M109 returns success
95
 // Actual temperature must be close to target for this long before M109 returns success
96
-#define TEMP_RESIDENCY_TIME 10	// (seconds)
96
+#define TEMP_RESIDENCY_TIME 10  // (seconds)
97
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
97
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
98
 #define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
98
 #define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
99
 
99
 
100
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
100
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
101
-// to check that the wiring to the thermistor is not broken. 
101
+// to check that the wiring to the thermistor is not broken.
102
 // Otherwise this would lead to the heater being powered on all the time.
102
 // Otherwise this would lead to the heater being powered on all the time.
103
 #define HEATER_0_MINTEMP 5
103
 #define HEATER_0_MINTEMP 5
104
 #define HEATER_1_MINTEMP 5
104
 #define HEATER_1_MINTEMP 5
124
 #define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
124
 #define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
125
 #define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
125
 #define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
126
 #ifdef PIDTEMP
126
 #ifdef PIDTEMP
127
-  //#define PID_DEBUG // Sends debug data to the serial port. 
127
+  //#define PID_DEBUG // Sends debug data to the serial port.
128
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
128
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
129
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
129
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
130
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
130
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
135
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
135
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
136
 // Ultimaker
136
 // Ultimaker
137
     #define  DEFAULT_Kp 22.2
137
     #define  DEFAULT_Kp 22.2
138
-    #define  DEFAULT_Ki 1.08  
139
-    #define  DEFAULT_Kd 114  
138
+    #define  DEFAULT_Ki 1.08
139
+    #define  DEFAULT_Kd 114
140
 
140
 
141
 // Makergear
141
 // Makergear
142
 //    #define  DEFAULT_Kp 7.0
142
 //    #define  DEFAULT_Kp 7.0
143
-//    #define  DEFAULT_Ki 0.1  
144
-//    #define  DEFAULT_Kd 12  
143
+//    #define  DEFAULT_Ki 0.1
144
+//    #define  DEFAULT_Kd 12
145
 
145
 
146
-// Mendel Parts V9 on 12V    
146
+// Mendel Parts V9 on 12V
147
 //    #define  DEFAULT_Kp 63.0
147
 //    #define  DEFAULT_Kp 63.0
148
 //    #define  DEFAULT_Ki 2.25
148
 //    #define  DEFAULT_Ki 2.25
149
 //    #define  DEFAULT_Kd 440
149
 //    #define  DEFAULT_Kd 440
152
 // Bed Temperature Control
152
 // Bed Temperature Control
153
 // Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
153
 // Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
154
 //
154
 //
155
-// 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.
156
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
156
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
157
 // which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
157
 // which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
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 
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
160
 // shouldn't use bed PID until someone else verifies your hardware works.
160
 // shouldn't use bed PID until someone else verifies your hardware works.
161
 // If this is enabled, find your own PID constants below.
161
 // If this is enabled, find your own PID constants below.
162
 //#define PIDTEMPBED
162
 //#define PIDTEMPBED
226
 #endif
226
 #endif
227
 
227
 
228
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
228
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
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
+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.
232
 //#define DISABLE_MAX_ENDSTOPS
232
 //#define DISABLE_MAX_ENDSTOPS
233
 
233
 
234
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
234
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
283
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
283
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
284
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
284
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
285
 
285
 
286
-// default settings 
286
+// default settings
287
 
287
 
288
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200*8/3,760*1.1}  // default steps per unit for ultimaker 
289
-#define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)    
288
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for ultimaker
289
+#define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
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.
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.
291
 
291
 
292
-#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
293
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
293
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
294
 
294
 
295
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
295
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
310
 // EEPROM
310
 // EEPROM
311
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
311
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
312
 // M500 - stores paramters in EEPROM
312
 // M500 - stores paramters in EEPROM
313
-// 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).
314
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
314
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
315
 //define this to enable eeprom support
315
 //define this to enable eeprom support
316
 //#define EEPROM_SETTINGS
316
 //#define EEPROM_SETTINGS
318
 // please keep turned on if you can.
318
 // please keep turned on if you can.
319
 //#define EEPROM_CHITCHAT
319
 //#define EEPROM_CHITCHAT
320
 
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
+
321
 //LCD and SD support
330
 //LCD and SD support
322
 //#define ULTRA_LCD  //general lcd support, also 16x2
331
 //#define ULTRA_LCD  //general lcd support, also 16x2
323
-//#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)
324
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
333
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
325
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
334
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
326
 
335
 
341
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
350
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
342
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
351
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
343
 
352
 
353
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
354
+// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
355
+//#define REPRAPWORLD_KEYPAD
356
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
357
+
344
 //automatic expansion
358
 //automatic expansion
345
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
359
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
346
  #define DOGLCD
360
  #define DOGLCD
351
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
365
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
352
  #define ULTIPANEL
366
  #define ULTIPANEL
353
  #define NEWPANEL
367
  #define NEWPANEL
354
-#endif 
368
+#endif
355
 
369
 
356
-// Preheat Constants
357
-#define PLA_PREHEAT_HOTEND_TEMP 180 
358
-#define PLA_PREHEAT_HPB_TEMP 70
359
-#define PLA_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
370
+#if defined(REPRAPWORLD_KEYPAD)
371
+  #define NEWPANEL
372
+  #define ULTIPANEL
373
+#endif
360
 
374
 
361
-#define ABS_PREHEAT_HOTEND_TEMP 240
362
-#define ABS_PREHEAT_HPB_TEMP 100
363
-#define ABS_PREHEAT_FAN_SPEED 255		// Insert Value between 0 and 255
375
+//I2C PANELS
376
+
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
364
 
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
365
 
415
 
366
 #ifdef ULTIPANEL
416
 #ifdef ULTIPANEL
367
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
417
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
368
   #define SDSUPPORT
418
   #define SDSUPPORT
369
   #define ULTRA_LCD
419
   #define ULTRA_LCD
370
-	#ifdef DOGLCD	// Change number of lines to match the DOG graphic display
371
-		#define LCD_WIDTH 20
372
-		#define LCD_HEIGHT 5
373
-	#else
374
-		#define LCD_WIDTH 20
375
-		#define LCD_HEIGHT 4
376
-	#endif
377
-#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
378
   #ifdef ULTRA_LCD
428
   #ifdef ULTRA_LCD
379
-	#ifdef DOGLCD	// Change number of lines to match the 128x64 graphics display
380
-		#define LCD_WIDTH 20
381
-		#define LCD_HEIGHT 5
382
-	#else
383
-		#define LCD_WIDTH 16
384
-		#define LCD_HEIGHT 2
385
-	#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
386
   #endif
436
   #endif
387
 #endif
437
 #endif
388
 
438
 
396
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
446
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
397
 //#define SF_ARC_FIX
447
 //#define SF_ARC_FIX
398
 
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
+
399
 #include "Configuration_adv.h"
469
 #include "Configuration_adv.h"
400
 #include "thermistortables.h"
470
 #include "thermistortables.h"
401
 
471
 

+ 10
- 10
Marlin/Makefile Parādīt failu

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 Parādīt failu

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;

+ 11
- 5
Marlin/Marlin.pde Parādīt failu

34
 #include "pins.h"
34
 #include "pins.h"
35
 
35
 
36
 #ifdef ULTRA_LCD
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
 #endif
48
 #endif
43
 
49
 
44
 #if DIGIPOTSS_PIN > -1
50
 #if DIGIPOTSS_PIN > -1

+ 366
- 261
Marlin/Marlin_main.cpp
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 339
- 0
Marlin/Servo.cpp Parādīt failu

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 Parādīt failu

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

+ 177
- 220
Marlin/pins.h Parādīt failu

14
 #define DIGIPOTSS_PIN -1
14
 #define DIGIPOTSS_PIN -1
15
 
15
 
16
 #if MOTHERBOARD == 99
16
 #if MOTHERBOARD == 99
17
-#define	KNOWN_BOARD 1
17
+#define KNOWN_BOARD 1
18
 
18
 
19
 #define X_STEP_PIN          2
19
 #define X_STEP_PIN          2
20
 #define X_DIR_PIN           3
20
 #define X_DIR_PIN           3
228
 
228
 
229
 //x axis pins
229
 //x axis pins
230
     #define X_STEP_PIN      21                  //different from stanard GEN7
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
     #define X_ENABLE_PIN    24
232
     #define X_ENABLE_PIN    24
233
     #define X_STOP_PIN      0
233
     #define X_STOP_PIN      0
234
 
234
 
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
-    
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
 #endif
294
 #endif
303
 
295
 
304
 /****************************************************************************************
296
 /****************************************************************************************
376
 #else
368
 #else
377
 #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
369
 #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
378
 #endif
370
 #endif
379
-#define HEATER_2_PIN       -1   
371
+#define HEATER_2_PIN       -1
380
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
372
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
381
 #define TEMP_1_PIN         15   // ANALOG NUMBERING
373
 #define TEMP_1_PIN         15   // ANALOG NUMBERING
382
 #define TEMP_2_PIN         -1   // ANALOG NUMBERING
374
 #define TEMP_2_PIN         -1   // ANALOG NUMBERING
383
 #define HEATER_BED_PIN     8    // BED
375
 #define HEATER_BED_PIN     8    // BED
384
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
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
 #ifdef ULTRA_LCD
383
 #ifdef ULTRA_LCD
387
 
384
 
388
   #ifdef NEWPANEL
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
     #define LCD_PINS_RS 16 
386
     #define LCD_PINS_RS 16 
400
     #define LCD_PINS_ENABLE 17
387
     #define LCD_PINS_ENABLE 17
401
     #define LCD_PINS_D4 23
388
     #define LCD_PINS_D4 23
402
-    #define LCD_PINS_D5 25 
389
+    #define LCD_PINS_D5 25
403
     #define LCD_PINS_D6 27
390
     #define LCD_PINS_D6 27
404
     #define LCD_PINS_D7 29
391
     #define LCD_PINS_D7 29
405
-    
392
+
406
     #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
393
     #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
407
       #define BEEPER 37
394
       #define BEEPER 37
408
 
395
 
413
       #define SDCARDDETECT 49
400
       #define SDCARDDETECT 49
414
     #else
401
     #else
415
       //arduino pin which triggers an piezzo beeper
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
       //buttons are directly attached using AUX-2
405
       //buttons are directly attached using AUX-2
419
-      #define BTN_EN1 37
420
-      #define BTN_EN2 35
421
-      #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
422
 
418
 
423
       #ifdef G3D_PANEL
419
       #ifdef G3D_PANEL
424
         #define SDCARDDETECT 49
420
         #define SDCARDDETECT 49
429
 
425
 
430
   #else //old style panel with shift register
426
   #else //old style panel with shift register
431
     //arduino pin witch triggers an piezzo beeper
427
     //arduino pin witch triggers an piezzo beeper
432
-    #define BEEPER 33		No Beeper added
428
+    #define BEEPER 33   // No Beeper added 
433
 
429
 
434
     //buttons are attached to a shift register
430
     //buttons are attached to a shift register
435
-	// Not wired this yet
431
+  // Not wired this yet
436
     //#define SHIFT_CLK 38
432
     //#define SHIFT_CLK 38
437
     //#define SHIFT_LD 42
433
     //#define SHIFT_LD 42
438
     //#define SHIFT_OUT 40
434
     //#define SHIFT_OUT 40
439
     //#define SHIFT_EN 17
435
     //#define SHIFT_EN 17
440
-    
441
-    #define LCD_PINS_RS 16 
436
+
437
+    #define LCD_PINS_RS 16
442
     #define LCD_PINS_ENABLE 17
438
     #define LCD_PINS_ENABLE 17
443
     #define LCD_PINS_D4 23
439
     #define LCD_PINS_D4 23
444
-    #define LCD_PINS_D5 25 
440
+    #define LCD_PINS_D5 25
445
     #define LCD_PINS_D6 27
441
     #define LCD_PINS_D6 27
446
     #define LCD_PINS_D7 29
442
     #define LCD_PINS_D7 29
447
-    
448
-    //encoder rotation values
449
-    #define encrot0 0
450
-    #define encrot1 2
451
-    #define encrot2 3
452
-    #define encrot3 1
453
-
454
-    
455
-    //bits in the shift register that carry the buttons for:
456
-    // left up center down right red
457
-    #define BL_LE 7
458
-    #define BL_UP 6
459
-    #define BL_MI 5
460
-    #define BL_DW 4
461
-    #define BL_RI 3
462
-    #define BL_ST 2
463
-
464
-    #define BLEN_B 1
465
-    #define BLEN_A 0
466
   #endif 
443
   #endif 
467
 #endif //ULTRA_LCD
444
 #endif //ULTRA_LCD
468
 
445
 
508
 #define HEATER_1_PIN        -1
485
 #define HEATER_1_PIN        -1
509
 #define HEATER_2_PIN        -1
486
 #define HEATER_2_PIN        -1
510
 #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!!!!!!!!!
511
-#define TEMP_1_PIN          -1   
512
-#define TEMP_2_PIN          -1   
488
+#define TEMP_1_PIN          -1
489
+#define TEMP_2_PIN          -1
513
 #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!!!!!!!!!
514
 #endif// MOTHERBOARD == 33 || MOTHERBOARD == 34
491
 #endif// MOTHERBOARD == 33 || MOTHERBOARD == 34
515
 
492
 
516
-// SPI for Max6675 Thermocouple 
493
+// SPI for Max6675 Thermocouple
517
 
494
 
518
 #ifndef SDSUPPORT
495
 #ifndef SDSUPPORT
519
-// 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
520
   #define MAX_SCK_PIN          52
497
   #define MAX_SCK_PIN          52
521
   #define MAX_MISO_PIN         50
498
   #define MAX_MISO_PIN         50
522
   #define MAX_MOSI_PIN         51
499
   #define MAX_MOSI_PIN         51
568
 #define HEATER_1_PIN        -1
545
 #define HEATER_1_PIN        -1
569
 #define HEATER_2_PIN        -1
546
 #define HEATER_2_PIN        -1
570
 #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!!!!!!!!!
571
-#define TEMP_1_PIN          -1    
572
-#define TEMP_2_PIN          -1    
548
+#define TEMP_1_PIN          -1
549
+#define TEMP_2_PIN          -1
573
 #define HEATER_BED_PIN      -1
550
 #define HEATER_BED_PIN      -1
574
 #define TEMP_BED_PIN        -1
551
 #define TEMP_BED_PIN        -1
575
 
552
 
632
     #define PS_ON_PIN       -1    //changed @ rkoeppl 20110410
609
     #define PS_ON_PIN       -1    //changed @ rkoeppl 20110410
633
     #define KILL_PIN        -1    //changed @ drakelive 20120830
610
     #define KILL_PIN        -1    //changed @ drakelive 20120830
634
     //our pin for debugging.
611
     //our pin for debugging.
635
-    
612
+
636
     #define DEBUG_PIN        0
613
     #define DEBUG_PIN        0
637
-    
614
+
638
     //our RS485 pins
615
     //our RS485 pins
639
-    #define TX_ENABLE_PIN	12
640
-    #define RX_ENABLE_PIN	13
616
+    #define TX_ENABLE_PIN 12
617
+    #define RX_ENABLE_PIN 13
618
+
641
 
619
 
642
-    
643
 #endif
620
 #endif
644
 
621
 
645
 /****************************************************************************************
622
 /****************************************************************************************
655
 #if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64
632
 #if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64
656
 #undef MOTHERBOARD
633
 #undef MOTHERBOARD
657
 #define MOTHERBOARD 6
634
 #define MOTHERBOARD 6
658
-#define SANGUINOLOLU_V_1_2 
635
+#define SANGUINOLOLU_V_1_2
659
 #endif
636
 #endif
660
 #if MOTHERBOARD == 6
637
 #if MOTHERBOARD == 6
661
 #define KNOWN_BOARD 1
638
 #define KNOWN_BOARD 1
682
 
659
 
683
 #define LED_PIN            -1
660
 #define LED_PIN            -1
684
 
661
 
685
-#define FAN_PIN            -1 
662
+#define FAN_PIN            -1
686
 #if FAN_PIN == 12 || FAN_PIN ==13
663
 #if FAN_PIN == 12 || FAN_PIN ==13
687
 #define FAN_SOFT_PWM
664
 #define FAN_SOFT_PWM
688
 #endif
665
 #endif
736
      //we have no buzzer installed
713
      //we have no buzzer installed
737
      #define BEEPER -1
714
      #define BEEPER -1
738
      //LCD Pins
715
      //LCD Pins
739
-	 	 #ifdef DOGLCD
740
-			 // Pins for DOGM SPI LCD Support
741
-			 #define DOGLCD_A0	30
742
-			 #define DOGLCD_CS	29
743
-			 // GLCD features
744
-			 #define LCD_CONTRAST 1
745
-			 // Uncomment screen orientation
746
-		     // #define LCD_SCREEN_ROT_0
747
-		     // #define LCD_SCREEN_ROT_90
748
-			 #define LCD_SCREEN_ROT_180
749
-		     // #define LCD_SCREEN_ROT_270
750
-			 #else // standard Hitachi LCD controller
751
-			 #define LCD_PINS_RS        4
752
-			 #define LCD_PINS_ENABLE    17
753
-			 #define LCD_PINS_D4        30
754
-			 #define LCD_PINS_D5        29
755
-			 #define LCD_PINS_D6        28
756
-			 #define LCD_PINS_D7        27
757
-         #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
758
      //The encoder and click button
735
      //The encoder and click button
759
-     #define BTN_EN1 11  //must be a hardware interrupt pin
760
-     #define BTN_EN2 10 //must be hardware interrupt pin
736
+     #define BTN_EN1 11  
737
+     #define BTN_EN2 10 
761
      #define BTN_ENC 16  //the switch
738
      #define BTN_ENC 16  //the switch
762
      //not connected to a pin
739
      //not connected to a pin
763
-     #define SDCARDDETECT -1
764
-     
765
-     //from the same bit in the RAMPS Newpanel define
766
-     //encoder rotation values
767
-     #define encrot0 0
768
-     #define encrot1 2
769
-     #define encrot2 3
770
-     #define encrot3 1
771
-     
772
-     #define BLEN_C 2
773
-     #define BLEN_B 1
774
-     #define BLEN_A 0
775
-     
740
+     #define SDCARDDETECT -1    
741
+    
776
    #endif //Newpanel
742
    #endif //Newpanel
777
  #endif //Ultipanel
743
  #endif //Ultipanel
778
- 
744
+
779
 #endif
745
 #endif
780
 
746
 
781
 
747
 
805
 #define Y_MAX_PIN 28
771
 #define Y_MAX_PIN 28
806
 #define Y_ENABLE_PIN 29
772
 #define Y_ENABLE_PIN 29
807
 
773
 
808
-#define Z_STEP_PIN 37 
774
+#define Z_STEP_PIN 37
809
 #define Z_DIR_PIN 39
775
 #define Z_DIR_PIN 39
810
 #define Z_MIN_PIN 30
776
 #define Z_MIN_PIN 30
811
 #define Z_MAX_PIN 32
777
 #define Z_MAX_PIN 32
812
 #define Z_ENABLE_PIN 35
778
 #define Z_ENABLE_PIN 35
813
 
779
 
814
-#define HEATER_BED_PIN 4 
815
-#define TEMP_BED_PIN 10  
780
+#define HEATER_BED_PIN 4
781
+#define TEMP_BED_PIN 10
816
 
782
 
817
 #define HEATER_0_PIN  2
783
 #define HEATER_0_PIN  2
818
-#define TEMP_0_PIN 8   
784
+#define TEMP_0_PIN 8
819
 
785
 
820
 #define HEATER_1_PIN 3
786
 #define HEATER_1_PIN 3
821
 #define TEMP_1_PIN 9
787
 #define TEMP_1_PIN 9
845
   //arduino pin witch triggers an piezzo beeper
811
   //arduino pin witch triggers an piezzo beeper
846
     #define BEEPER 18
812
     #define BEEPER 18
847
 
813
 
848
-    #define LCD_PINS_RS 20 
814
+    #define LCD_PINS_RS 20
849
     #define LCD_PINS_ENABLE 17
815
     #define LCD_PINS_ENABLE 17
850
     #define LCD_PINS_D4 16
816
     #define LCD_PINS_D4 16
851
-    #define LCD_PINS_D5 21 
817
+    #define LCD_PINS_D5 21
852
     #define LCD_PINS_D6 5
818
     #define LCD_PINS_D6 5
853
     #define LCD_PINS_D7 6
819
     #define LCD_PINS_D7 6
854
-    
820
+
855
     //buttons are directly attached
821
     //buttons are directly attached
856
     #define BTN_EN1 40
822
     #define BTN_EN1 40
857
     #define BTN_EN2 42
823
     #define BTN_EN2 42
858
     #define BTN_ENC 19  //the click
824
     #define BTN_ENC 19  //the click
859
     
825
     
860
-    #define BLEN_C 2
861
-    #define BLEN_B 1
862
-    #define BLEN_A 0
863
-    
864
     #define SDCARDDETECT 38
826
     #define SDCARDDETECT 38
865
     
827
     
866
-      //encoder rotation values
867
-    #define encrot0 0
868
-    #define encrot1 2
869
-    #define encrot2 3
870
-    #define encrot3 1
871
   #else //old style panel with shift register
828
   #else //old style panel with shift register
872
     //arduino pin witch triggers an piezzo beeper
829
     //arduino pin witch triggers an piezzo beeper
873
     #define BEEPER 18
830
     #define BEEPER 18
877
     #define SHIFT_LD 42
834
     #define SHIFT_LD 42
878
     #define SHIFT_OUT 40
835
     #define SHIFT_OUT 40
879
     #define SHIFT_EN 17
836
     #define SHIFT_EN 17
880
-    
881
-    #define LCD_PINS_RS 16 
837
+
838
+    #define LCD_PINS_RS 16
882
     #define LCD_PINS_ENABLE 5
839
     #define LCD_PINS_ENABLE 5
883
     #define LCD_PINS_D4 6
840
     #define LCD_PINS_D4 6
884
-    #define LCD_PINS_D5 21 
841
+    #define LCD_PINS_D5 21
885
     #define LCD_PINS_D6 20
842
     #define LCD_PINS_D6 20
886
     #define LCD_PINS_D7 19
843
     #define LCD_PINS_D7 19
887
-    
888
-    //encoder rotation values
889
-    #ifndef ULTIMAKERCONTROLLER
890
-     #define encrot0 0
891
-     #define encrot1 2
892
-     #define encrot2 3
893
-     #define encrot3 1
894
-    #else
895
-     #define encrot0 0
896
-     #define encrot1 1
897
-     #define encrot2 3
898
-     #define encrot3 2
899
-
900
-    #endif
901
-
844
+  
902
     #define SDCARDDETECT -1
845
     #define SDCARDDETECT -1
903
-    //bits in the shift register that carry the buttons for:
904
-    // left up center down right red
905
-    #define BL_LE 7
906
-    #define BL_UP 6
907
-    #define BL_MI 5
908
-    #define BL_DW 4
909
-    #define BL_RI 3
910
-    #define BL_ST 2
911
-
912
-    #define BLEN_B 1
913
-    #define BLEN_A 0
914
   #endif 
846
   #endif 
915
 #endif //ULTRA_LCD
847
 #endif //ULTRA_LCD
916
 
848
 
942
 #define Y_MAX_PIN 16
874
 #define Y_MAX_PIN 16
943
 #define Y_ENABLE_PIN 29
875
 #define Y_ENABLE_PIN 29
944
 
876
 
945
-#define Z_STEP_PIN 37 
877
+#define Z_STEP_PIN 37
946
 #define Z_DIR_PIN 39
878
 #define Z_DIR_PIN 39
947
 #define Z_MIN_PIN 19
879
 #define Z_MIN_PIN 19
948
 #define Z_MAX_PIN 18
880
 #define Z_MAX_PIN 18
949
 #define Z_ENABLE_PIN 35
881
 #define Z_ENABLE_PIN 35
950
 
882
 
951
-#define HEATER_BED_PIN -1 
952
-#define TEMP_BED_PIN -1  
883
+#define HEATER_BED_PIN -1
884
+#define TEMP_BED_PIN -1
953
 
885
 
954
 #define HEATER_0_PIN  2
886
 #define HEATER_0_PIN  2
955
-#define TEMP_0_PIN 8   
887
+#define TEMP_0_PIN 8
956
 
888
 
957
 #define HEATER_1_PIN 1
889
 #define HEATER_1_PIN 1
958
 #define TEMP_1_PIN 1
890
 #define TEMP_1_PIN 1
976
 #define KILL_PIN           -1
908
 #define KILL_PIN           -1
977
 #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.
978
 
910
 
979
-#define LCD_PINS_RS 24 
911
+#define LCD_PINS_RS 24
980
 #define LCD_PINS_ENABLE 22
912
 #define LCD_PINS_ENABLE 22
981
 #define LCD_PINS_D4 36
913
 #define LCD_PINS_D4 36
982
-#define LCD_PINS_D5 34 
914
+#define LCD_PINS_D5 34
983
 #define LCD_PINS_D6 32
915
 #define LCD_PINS_D6 32
984
 #define LCD_PINS_D7 30
916
 #define LCD_PINS_D7 30
985
 
917
 
1001
 #define X_DIR_PIN          16
933
 #define X_DIR_PIN          16
1002
 #define X_ENABLE_PIN       48
934
 #define X_ENABLE_PIN       48
1003
 #define X_MIN_PIN          37
935
 #define X_MIN_PIN          37
1004
-#define X_MAX_PIN          36 
936
+#define X_MAX_PIN          36
1005
 
937
 
1006
 #define Y_STEP_PIN         54
938
 #define Y_STEP_PIN         54
1007
-#define Y_DIR_PIN          47 
939
+#define Y_DIR_PIN          47
1008
 #define Y_ENABLE_PIN       55
940
 #define Y_ENABLE_PIN       55
1009
 #define Y_MIN_PIN          35
941
 #define Y_MIN_PIN          35
1010
-#define Y_MAX_PIN          34 
942
+#define Y_MAX_PIN          34
1011
 
943
 
1012
-#define Z_STEP_PIN         57 
944
+#define Z_STEP_PIN         57
1013
 #define Z_DIR_PIN          56
945
 #define Z_DIR_PIN          56
1014
-#define Z_ENABLE_PIN       62 
946
+#define Z_ENABLE_PIN       62
1015
 #define Z_MIN_PIN          33
947
 #define Z_MIN_PIN          33
1016
 #define Z_MAX_PIN          32
948
 #define Z_MAX_PIN          32
1017
 
949
 
1029
 
961
 
1030
 #define LED_PIN            13
962
 #define LED_PIN            13
1031
 
963
 
1032
-#define FAN_PIN            7 
964
+#define FAN_PIN            7
1033
 //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
1034
 
966
 
1035
 #define PS_ON_PIN          45
967
 #define PS_ON_PIN          45
1036
 #define KILL_PIN           46
968
 #define KILL_PIN           46
1037
 
969
 
1038
-#define HEATER_0_PIN       2    // EXTRUDER 1
1039
-#define HEATER_1_PIN       3    // EXTRUDER 2
1040
-#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
1041
 //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
1042
-#define HEATER_BED_PIN     9    // BED
1043
 
1008
 
1044
-#define TEMP_0_PIN         15   // ANALOG NUMBERING
1045
-#define TEMP_1_PIN         14   // ANALOG NUMBERING
1046
-#define TEMP_2_PIN         13   // ANALOG NUMBERING
1047
-//optional for extruder 4 or chamber: #define TEMP_2_PIN         12   // ANALOG NUMBERING
1048
-#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
1049
 
1020
 
1050
 #define SDPOWER            -1
1021
 #define SDPOWER            -1
1051
 #define SDSS               53
1022
 #define SDSS               53
1052
 #define SDCARDDETECT       49
1023
 #define SDCARDDETECT       49
1053
 #define BEEPER             44
1024
 #define BEEPER             44
1054
-#define LCD_PINS_RS        19 
1025
+#define LCD_PINS_RS        19
1055
 #define LCD_PINS_ENABLE    42
1026
 #define LCD_PINS_ENABLE    42
1056
 #define LCD_PINS_D4        18
1027
 #define LCD_PINS_D4        18
1057
-#define LCD_PINS_D5        38 
1028
+#define LCD_PINS_D5        38
1058
 #define LCD_PINS_D6        41
1029
 #define LCD_PINS_D6        41
1059
 #define LCD_PINS_D7        40
1030
 #define LCD_PINS_D7        40
1060
 #define BTN_EN1            11
1031
 #define BTN_EN1            11
1061
 #define BTN_EN2            12
1032
 #define BTN_EN2            12
1062
 #define BTN_ENC            43
1033
 #define BTN_ENC            43
1063
-//encoder rotation values
1064
-#define BLEN_C 2
1065
-#define BLEN_B 1
1066
-#define BLEN_A 0
1067
-#define encrot0 0
1068
-#define encrot1 2
1069
-#define encrot2 3
1070
-#define encrot3 1
1071
 
1034
 
1072
 #endif //MOTHERBOARD==80
1035
 #endif //MOTHERBOARD==80
1073
 
1036
 
1238
 
1201
 
1239
 #define LED_PIN            -1
1202
 #define LED_PIN            -1
1240
 
1203
 
1241
-#define FAN_PIN            -1 
1204
+#define FAN_PIN            -1
1242
 
1205
 
1243
 #define PS_ON_PIN         14
1206
 #define PS_ON_PIN         14
1244
 #define KILL_PIN           -1
1207
 #define KILL_PIN           -1
1277
 *       MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
1240
 *       MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
1278
 *        SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
1241
 *        SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
1279
 *                  RST  9|        |32  AREF
1242
 *                  RST  9|        |32  AREF
1280
-*                  VCC 10|        |31  GND 
1243
+*                  VCC 10|        |31  GND
1281
 *                  GND 11|        |30  AVCC
1244
 *                  GND 11|        |30  AVCC
1282
 *                XTAL2 12|        |29  PC7 (D 23)
1245
 *                XTAL2 12|        |29  PC7 (D 23)
1283
 *                XTAL1 13|        |28  PC6 (D 22)
1246
 *                XTAL1 13|        |28  PC6 (D 22)
1334
 #define KILL_PIN           -1
1297
 #define KILL_PIN           -1
1335
 
1298
 
1336
 #define HEATER_0_PIN       4
1299
 #define HEATER_0_PIN       4
1337
-#define HEATER_1_PIN       -1 // 12 
1300
+#define HEATER_1_PIN       -1 // 12
1338
 #define HEATER_2_PIN       -1 // 13
1301
 #define HEATER_2_PIN       -1 // 13
1339
 #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!!!!!!!!!
1340
 #define TEMP_1_PIN         -1 // 1
1303
 #define TEMP_1_PIN         -1 // 1
1372
 #define E0_ENABLE_PIN       10
1335
 #define E0_ENABLE_PIN       10
1373
 
1336
 
1374
 /* future proofing */
1337
 /* future proofing */
1375
-#define __FS	20
1376
-#define __FD	19
1377
-#define __GS	18
1378
-#define __GD	13
1338
+#define __FS  20
1339
+#define __FD  19
1340
+#define __GS  18
1341
+#define __GD  13
1379
 
1342
 
1380
-#define UNUSED_PWM           14	/* PWM on LEFT connector */
1343
+#define UNUSED_PWM           14 /* PWM on LEFT connector */
1381
 
1344
 
1382
 #define E1_STEP_PIN         -1 // 21
1345
 #define E1_STEP_PIN         -1 // 21
1383
 #define E1_DIR_PIN          -1 // 20
1346
 #define E1_DIR_PIN          -1 // 20
1396
 #define KILL_PIN           -1
1359
 #define KILL_PIN           -1
1397
 
1360
 
1398
 #define HEATER_0_PIN        3 /*DONE PWM on RIGHT connector */
1361
 #define HEATER_0_PIN        3 /*DONE PWM on RIGHT connector */
1399
-#define HEATER_1_PIN       -1 
1362
+#define HEATER_1_PIN       -1
1400
 #define HEATER_2_PIN       -1
1363
 #define HEATER_2_PIN       -1
1401
-#define HEATER_1_PIN       -1 
1364
+#define HEATER_1_PIN       -1
1402
 #define HEATER_2_PIN       -1
1365
 #define HEATER_2_PIN       -1
1403
-#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING 
1366
+#define TEMP_0_PIN          0 // ANALOG INPUT NUMBERING
1404
 #define TEMP_1_PIN          1 // ANALOG
1367
 #define TEMP_1_PIN          1 // ANALOG
1405
 #define TEMP_2_PIN         -1 // 2
1368
 #define TEMP_2_PIN         -1 // 2
1406
 #define HEATER_BED_PIN      4
1369
 #define HEATER_BED_PIN      4
1407
 #define TEMP_BED_PIN        2 // 1,2 or I2C
1370
 #define TEMP_BED_PIN        2 // 1,2 or I2C
1408
 
1371
 
1409
-#define I2C_SCL				16
1410
-#define I2C_SDA				17
1372
+#define I2C_SCL       16
1373
+#define I2C_SDA       17
1411
 
1374
 
1412
 #endif
1375
 #endif
1413
 
1376
 
1448
 #define Z_MS2_PIN 67
1411
 #define Z_MS2_PIN 67
1449
 
1412
 
1450
 #define HEATER_BED_PIN 3
1413
 #define HEATER_BED_PIN 3
1451
-#define TEMP_BED_PIN 2 
1414
+#define TEMP_BED_PIN 2
1452
 
1415
 
1453
 #define HEATER_0_PIN  9
1416
 #define HEATER_0_PIN  9
1454
 #define TEMP_0_PIN 0
1417
 #define TEMP_0_PIN 0
1456
 #define HEATER_1_PIN 7
1419
 #define HEATER_1_PIN 7
1457
 #define TEMP_1_PIN 1
1420
 #define TEMP_1_PIN 1
1458
 
1421
 
1422
+#ifdef BARICUDA
1423
+#define HEATER_2_PIN 6
1424
+#else
1459
 #define HEATER_2_PIN -1
1425
 #define HEATER_2_PIN -1
1426
+#endif
1460
 #define TEMP_2_PIN -1
1427
 #define TEMP_2_PIN -1
1461
 
1428
 
1462
 #define E0_STEP_PIN         34
1429
 #define E0_STEP_PIN         34
1537
 
1504
 
1538
 #define HEATER_0_PIN       9    // EXTRUDER 1
1505
 #define HEATER_0_PIN       9    // EXTRUDER 1
1539
 #define HEATER_1_PIN       8    // EXTRUDER 2 (FAN On Sprinter)
1506
 #define HEATER_1_PIN       8    // EXTRUDER 2 (FAN On Sprinter)
1540
-#define HEATER_2_PIN       -1  
1507
+#define HEATER_2_PIN       -1
1541
 
1508
 
1542
-#if TEMP_SENSOR_0 == -1 
1509
+#if TEMP_SENSOR_0 == -1
1543
 #define TEMP_0_PIN         8   // ANALOG NUMBERING
1510
 #define TEMP_0_PIN         8   // ANALOG NUMBERING
1544
 #else
1511
 #else
1545
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
1512
 #define TEMP_0_PIN         13   // ANALOG NUMBERING
1551
 #define HEATER_BED_PIN     10   // BED
1518
 #define HEATER_BED_PIN     10   // BED
1552
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
1519
 #define TEMP_BED_PIN       14   // ANALOG NUMBERING
1553
 
1520
 
1554
-#define BEEPER 33			// Beeper on AUX-4
1521
+#define BEEPER 33     // Beeper on AUX-4
1555
 
1522
 
1556
 
1523
 
1557
 #ifdef ULTRA_LCD
1524
 #ifdef ULTRA_LCD
1558
 
1525
 
1559
   #ifdef NEWPANEL
1526
   #ifdef NEWPANEL
1560
   //arduino pin which triggers an piezzo beeper
1527
   //arduino pin which triggers an piezzo beeper
1561
-    
1562
-    #define LCD_PINS_RS 16 
1528
+
1529
+    #define LCD_PINS_RS 16
1563
     #define LCD_PINS_ENABLE 17
1530
     #define LCD_PINS_ENABLE 17
1564
     #define LCD_PINS_D4 23
1531
     #define LCD_PINS_D4 23
1565
-    #define LCD_PINS_D5 25 
1532
+    #define LCD_PINS_D5 25
1566
     #define LCD_PINS_D6 27
1533
     #define LCD_PINS_D6 27
1567
     #define LCD_PINS_D7 29
1534
     #define LCD_PINS_D7 29
1568
-    
1535
+
1569
     //buttons are directly attached using AUX-2
1536
     //buttons are directly attached using AUX-2
1570
     #define BTN_EN1 59
1537
     #define BTN_EN1 59
1571
     #define BTN_EN2 64
1538
     #define BTN_EN2 64
1572
     #define BTN_ENC 43  //the click
1539
     #define BTN_ENC 43  //the click
1573
     
1540
     
1574
-    #define BLEN_C 2
1575
-    #define BLEN_B 1
1576
-    #define BLEN_A 0
1577
-    
1578
-    #define SDCARDDETECT -1		// Ramps does not use this port
1579
-    
1580
-      //encoder rotation values
1581
-    #define encrot0 0
1582
-    #define encrot1 2
1583
-    #define encrot2 3
1584
-    #define encrot3 1
1541
+    #define SDCARDDETECT -1   // Ramps does not use this port
1585
 #endif
1542
 #endif
1586
 #endif //ULTRA_LCD
1543
 #endif //ULTRA_LCD
1587
 
1544
 
1592
 #endif
1549
 #endif
1593
 
1550
 
1594
 //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!
1595
-#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,
1596
 #if EXTRUDERS > 1
1553
 #if EXTRUDERS > 1
1597
   #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,
1598
 #else
1555
 #else

+ 30
- 0
Marlin/planner.cpp Parādīt failu

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 Parādīt failu

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
 

+ 21
- 12
Marlin/temperature.cpp Parādīt failu

309
 
309
 
310
 #if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
310
 #if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
311
 
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
+
312
 void setExtruderAutoFanState(int pin, bool state)
324
 void setExtruderAutoFanState(int pin, bool state)
313
 {
325
 {
314
   unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
326
   unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
324
 
336
 
325
   // which fan pins need to be turned on?      
337
   // which fan pins need to be turned on?      
326
   #if EXTRUDER_0_AUTO_FAN_PIN > 0
338
   #if EXTRUDER_0_AUTO_FAN_PIN > 0
327
-    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN 
328
-       #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
329
-    #endif
330
     if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
339
     if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
331
       fanState |= 1;
340
       fanState |= 1;
332
   #endif
341
   #endif
333
   #if EXTRUDER_1_AUTO_FAN_PIN > 0
342
   #if EXTRUDER_1_AUTO_FAN_PIN > 0
334
-    #if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN 
335
-       #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
336
-    #endif
337
     if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
343
     if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
338
     {
344
     {
339
       if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
345
       if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
343
     }
349
     }
344
   #endif
350
   #endif
345
   #if EXTRUDER_2_AUTO_FAN_PIN > 0
351
   #if EXTRUDER_2_AUTO_FAN_PIN > 0
346
-    #if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN 
347
-       #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
348
-    #endif
349
     if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
352
     if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
350
     {
353
     {
351
       if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
354
       if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
646
 
649
 
647
 void tp_init()
650
 void tp_init()
648
 {
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
+  
649
   // Finish init of mult extruder arrays 
658
   // Finish init of mult extruder arrays 
650
   for(int e = 0; e < EXTRUDERS; e++) {
659
   for(int e = 0; e < EXTRUDERS; e++) {
651
     // populate with the first value 
660
     // populate with the first value 
722
     #if TEMP_2_PIN < 8
731
     #if TEMP_2_PIN < 8
723
        DIDR0 |= 1 << TEMP_2_PIN; 
732
        DIDR0 |= 1 << TEMP_2_PIN; 
724
     #else
733
     #else
725
-       DIDR2 = 1<<(TEMP_2_PIN - 8); 
734
+       DIDR2 |= 1<<(TEMP_2_PIN - 8); 
726
     #endif
735
     #endif
727
   #endif
736
   #endif
728
   #if (TEMP_BED_PIN > -1)
737
   #if (TEMP_BED_PIN > -1)
764
 
773
 
765
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
774
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
766
   minttemp[1] = HEATER_1_MINTEMP;
775
   minttemp[1] = HEATER_1_MINTEMP;
767
-  while(analog2temp(minttemp_raw[1], 1) > HEATER_1_MINTEMP) {
776
+  while(analog2temp(minttemp_raw[1], 1) < HEATER_1_MINTEMP) {
768
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
777
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
769
     minttemp_raw[1] += OVERSAMPLENR;
778
     minttemp_raw[1] += OVERSAMPLENR;
770
 #else
779
 #else
785
 
794
 
786
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
795
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
787
   minttemp[2] = HEATER_2_MINTEMP;
796
   minttemp[2] = HEATER_2_MINTEMP;
788
-  while(analog2temp(minttemp_raw[2], 2) > HEATER_2_MINTEMP) {
797
+  while(analog2temp(minttemp_raw[2], 2) < HEATER_2_MINTEMP) {
789
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
798
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
790
     minttemp_raw[2] += OVERSAMPLENR;
799
     minttemp_raw[2] += OVERSAMPLENR;
791
 #else
800
 #else

+ 127
- 31
Marlin/ultralcd.cpp Parādīt failu

76
 static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
76
 static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
77
 static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
77
 static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
78
 
78
 
79
-#define ENCODER_STEPS_PER_MENU_ITEM 5
79
+#if !defined(LCD_I2C_VIKI)
80
+  #define ENCODER_STEPS_PER_MENU_ITEM 5
81
+#else
82
+  #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
83
+#endif
80
 
84
 
81
 /* Helper macros for menus */
85
 /* Helper macros for menus */
82
 #define START_MENU() do { \
86
 #define START_MENU() do { \
112
     } } while(0)
116
     } } while(0)
113
 
117
 
114
 /** Used variables to keep track of the menu */
118
 /** Used variables to keep track of the menu */
119
+#ifndef REPRAPWORLD_KEYPAD
115
 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
116
 
124
 
117
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
125
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
118
 uint32_t blocking_enc;
126
 uint32_t blocking_enc;
119
 uint8_t lastEncoderBits;
127
 uint8_t lastEncoderBits;
120
 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 */
121
 uint32_t encoderPosition;
129
 uint32_t encoderPosition;
122
-#if (SDCARDDETECT > -1)
130
+#if (SDCARDDETECT > 0)
123
 bool lcd_oldcardstatus;
131
 bool lcd_oldcardstatus;
124
 #endif
132
 #endif
125
 #endif//ULTIPANEL
133
 #endif//ULTIPANEL
221
         }else{
229
         }else{
222
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
230
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
223
 #if SDCARDDETECT < 1
231
 #if SDCARDDETECT < 1
224
-			MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));	// SD-card changed by user
225
-#endif			
232
+            MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
233
+#endif
226
         }
234
         }
227
     }else{
235
     }else{
228
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
236
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
229
-#if SDCARDDETECT < 1		
230
-		MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21"));	// Manually initialize the SD-card via user interface
231
-#endif		
237
+#if SDCARDDETECT < 1
238
+        MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
239
+#endif
232
     }
240
     }
233
 #endif
241
 #endif
234
     END_MENU();
242
     END_MENU();
251
     setTargetBed(plaPreheatHPBTemp);
259
     setTargetBed(plaPreheatHPBTemp);
252
     fanSpeed = plaPreheatFanSpeed;
260
     fanSpeed = plaPreheatFanSpeed;
253
     lcd_return_to_status();
261
     lcd_return_to_status();
262
+    setWatch(); // heater sanity check timer
254
 }
263
 }
255
 
264
 
256
 void lcd_preheat_abs()
265
 void lcd_preheat_abs()
261
     setTargetBed(absPreheatHPBTemp);
270
     setTargetBed(absPreheatHPBTemp);
262
     fanSpeed = absPreheatFanSpeed;
271
     fanSpeed = absPreheatFanSpeed;
263
     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();
264
 }
283
 }
265
 
284
 
266
 static void lcd_tune_menu()
285
 static void lcd_tune_menu()
298
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
317
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
299
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
318
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
300
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
319
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
301
-    MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
320
+    MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
302
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
321
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
303
     END_MENU();
322
     END_MENU();
304
 }
323
 }
459
 
478
 
460
 static void lcd_control_temperature_menu()
479
 static void lcd_control_temperature_menu()
461
 {
480
 {
462
-	// set up temp variables - undo the default scaling
463
-	raw_Ki = unscalePID_i(Ki);
464
-	raw_Kd = unscalePID_d(Kd);
465
-	
481
+    // set up temp variables - undo the default scaling
482
+    raw_Ki = unscalePID_i(Ki);
483
+    raw_Kd = unscalePID_d(Kd);
484
+
466
     START_MENU();
485
     START_MENU();
467
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
486
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
468
     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);
484
 #endif
503
 #endif
485
 #ifdef PIDTEMP
504
 #ifdef PIDTEMP
486
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
505
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
487
-	// i is typically a small value so allows values below 1
506
+    // i is typically a small value so allows values below 1
488
     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);
489
     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);
490
 # ifdef PID_ADD_EXTRUSION_RATE
509
 # ifdef PID_ADD_EXTRUSION_RATE
687
 menu_edit_type(float, float52, ftostr52, 100)
706
 menu_edit_type(float, float52, ftostr52, 100)
688
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
707
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
689
 
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
+
690
 /** End of menus **/
727
 /** End of menus **/
691
 
728
 
692
 static void lcd_quick_feedback()
729
 static void lcd_quick_feedback()
745
 #ifdef NEWPANEL
782
 #ifdef NEWPANEL
746
     pinMode(BTN_EN1,INPUT);
783
     pinMode(BTN_EN1,INPUT);
747
     pinMode(BTN_EN2,INPUT); 
784
     pinMode(BTN_EN2,INPUT); 
748
-    pinMode(BTN_ENC,INPUT); 
749
     pinMode(SDCARDDETECT,INPUT);
785
     pinMode(SDCARDDETECT,INPUT);
750
     WRITE(BTN_EN1,HIGH);
786
     WRITE(BTN_EN1,HIGH);
751
     WRITE(BTN_EN2,HIGH);
787
     WRITE(BTN_EN2,HIGH);
788
+  #if BTN_ENC > 0
789
+    pinMode(BTN_ENC,INPUT); 
752
     WRITE(BTN_ENC,HIGH);
790
     WRITE(BTN_ENC,HIGH);
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
753
 #else
799
 #else
754
     pinMode(SHIFT_CLK,OUTPUT);
800
     pinMode(SHIFT_CLK,OUTPUT);
755
     pinMode(SHIFT_LD,OUTPUT);
801
     pinMode(SHIFT_LD,OUTPUT);
759
     WRITE(SHIFT_LD,HIGH); 
805
     WRITE(SHIFT_LD,HIGH); 
760
     WRITE(SHIFT_EN,LOW);
806
     WRITE(SHIFT_EN,LOW);
761
 #endif//!NEWPANEL
807
 #endif//!NEWPANEL
762
-#if (SDCARDDETECT > -1)
808
+#if (SDCARDDETECT > 0)
763
     WRITE(SDCARDDETECT, HIGH);
809
     WRITE(SDCARDDETECT, HIGH);
764
     lcd_oldcardstatus = IS_SD_INSERTED;
810
     lcd_oldcardstatus = IS_SD_INSERTED;
765
-#endif//(SDCARDDETECT > -1)
811
+#endif//(SDCARDDETECT > 0)
766
     lcd_buttons_update();
812
     lcd_buttons_update();
813
+#ifdef ULTIPANEL    
767
     encoderDiff = 0;
814
     encoderDiff = 0;
815
+#endif    
768
 }
816
 }
769
 
817
 
770
 void lcd_update()
818
 void lcd_update()
773
     
821
     
774
     lcd_buttons_update();
822
     lcd_buttons_update();
775
     
823
     
776
-    #if (SDCARDDETECT > -1)
824
+    #ifdef LCD_HAS_SLOW_BUTTONS
825
+    buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
826
+    #endif
827
+    
828
+    #if (SDCARDDETECT > 0)
777
     if((IS_SD_INSERTED != lcd_oldcardstatus))
829
     if((IS_SD_INSERTED != lcd_oldcardstatus))
778
     {
830
     {
779
         lcdDrawUpdate = 2;
831
         lcdDrawUpdate = 2;
796
     if (lcd_next_update_millis < millis())
848
     if (lcd_next_update_millis < millis())
797
     {
849
     {
798
 #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
799
         if (encoderDiff)
862
         if (encoderDiff)
800
         {
863
         {
801
             lcdDrawUpdate = 1;
864
             lcdDrawUpdate = 1;
808
 #endif//ULTIPANEL
871
 #endif//ULTIPANEL
809
 
872
 
810
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
873
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
811
-		blink++;	   // Variable for fan animation and alive dot
812
-		u8g.firstPage();
813
-		do {
814
-				u8g.setFont(u8g_font_6x10_marlin);
815
-				u8g.setPrintPos(125,0);
816
-				if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
817
-				u8g.drawPixel(127,63);	// draw alive dot
818
-				u8g.setColorIndex(1);	// black on white
819
-				(*currentMenu)();
820
-				if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
821
-		   } while( u8g.nextPage() );
874
+        blink++;     // Variable for fan animation and alive dot
875
+        u8g.firstPage();
876
+        do 
877
+        {
878
+            u8g.setFont(u8g_font_6x10_marlin);
879
+            u8g.setPrintPos(125,0);
880
+            if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
881
+            u8g.drawPixel(127,63); // draw alive dot
882
+            u8g.setColorIndex(1); // black on white
883
+            (*currentMenu)();
884
+            if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
885
+        } while( u8g.nextPage() );
822
 #else        
886
 #else        
823
         (*currentMenu)();
887
         (*currentMenu)();
824
 #endif
888
 #endif
825
 
889
 
890
+#ifdef LCD_HAS_STATUS_INDICATORS
891
+        lcd_implementation_update_indicators();
892
+#endif
893
+
826
 #ifdef ULTIPANEL
894
 #ifdef ULTIPANEL
827
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
895
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
828
         {
896
         {
873
     uint8_t newbutton=0;
941
     uint8_t newbutton=0;
874
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
942
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
875
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
943
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
944
+  #if BTN_ENC > 0
876
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
945
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
877
         newbutton |= EN_C;
946
         newbutton |= EN_C;
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
878
     buttons = newbutton;
962
     buttons = newbutton;
879
 #else   //read it from the shift register
963
 #else   //read it from the shift register
880
     uint8_t newbutton=0;
964
     uint8_t newbutton=0;
930
     }
1014
     }
931
     lastEncoderBits = enc;
1015
     lastEncoderBits = enc;
932
 }
1016
 }
1017
+
1018
+void lcd_buzz(long duration, uint16_t freq)
1019
+{ 
1020
+#ifdef LCD_USE_I2C_BUZZER
1021
+  lcd.buzz(duration,freq);
1022
+#endif   
1023
+}
1024
+
1025
+bool lcd_clicked() 
1026
+{ 
1027
+  return LCD_CLICKED;
1028
+}
933
 #endif//ULTIPANEL
1029
 #endif//ULTIPANEL
934
 
1030
 
935
 /********************************/
1031
 /********************************/
1131
 {
1227
 {
1132
   Ki = scalePID_i(raw_Ki);
1228
   Ki = scalePID_i(raw_Ki);
1133
   updatePID();
1229
   updatePID();
1134
-}	
1230
+}
1135
 
1231
 
1136
 // Callback for after editing PID d value
1232
 // Callback for after editing PID d value
1137
 // 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
1139
 {
1235
 {
1140
   Kd = scalePID_d(raw_Kd);
1236
   Kd = scalePID_d(raw_Kd);
1141
   updatePID();
1237
   updatePID();
1142
-}	
1143
-	
1238
+}
1239
+
1144
 #endif //ULTRA_LCD
1240
 #endif //ULTRA_LCD

+ 3
- 20
Marlin/ultralcd.h Parādīt failu

22
 
22
 
23
   #ifdef ULTIPANEL
23
   #ifdef ULTIPANEL
24
   void lcd_buttons_update();
24
   void lcd_buttons_update();
25
-  extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
26
   #else
25
   #else
27
   FORCE_INLINE void lcd_buttons_update() {}
26
   FORCE_INLINE void lcd_buttons_update() {}
28
   #endif
27
   #endif
35
   extern int absPreheatHPBTemp;
34
   extern int absPreheatHPBTemp;
36
   extern int absPreheatFanSpeed;
35
   extern int absPreheatFanSpeed;
37
     
36
     
38
-  #ifdef NEWPANEL
39
-    #define EN_C (1<<BLEN_C)
40
-    #define EN_B (1<<BLEN_B)
41
-    #define EN_A (1<<BLEN_A)
42
-
43
-    #define LCD_CLICKED (buttons&EN_C)
44
-  #else
45
-    //atomatic, do not change
46
-    #define B_LE (1<<BL_LE)
47
-    #define B_UP (1<<BL_UP)
48
-    #define B_MI (1<<BL_MI)
49
-    #define B_DW (1<<BL_DW)
50
-    #define B_RI (1<<BL_RI)
51
-    #define B_ST (1<<BL_ST)
52
-    #define EN_B (1<<BLEN_B)
53
-    #define EN_A (1<<BLEN_A)
54
-    
55
-    #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
56
-  #endif//NEWPANEL
37
+  void lcd_buzz(long duration,uint16_t freq);
38
+  bool lcd_clicked();
57
 
39
 
58
 #else //no lcd
40
 #else //no lcd
59
   FORCE_INLINE void lcd_update() {}
41
   FORCE_INLINE void lcd_update() {}
61
   FORCE_INLINE void lcd_setstatus(const char* message) {}
43
   FORCE_INLINE void lcd_setstatus(const char* message) {}
62
   FORCE_INLINE void lcd_buttons_update() {}
44
   FORCE_INLINE void lcd_buttons_update() {}
63
   FORCE_INLINE void lcd_reset_alert_level() {}
45
   FORCE_INLINE void lcd_reset_alert_level() {}
46
+  FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
64
 
47
 
65
   #define LCD_MESSAGEPGM(x) 
48
   #define LCD_MESSAGEPGM(x) 
66
   #define LCD_ALERTMESSAGEPGM(x) 
49
   #define LCD_ALERTMESSAGEPGM(x) 

+ 748
- 515
Marlin/ultralcd_implementation_hitachi_HD44780.h
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


Notiek ielāde…
Atcelt
Saglabāt