소스 검색

Apply all changes from latest Marlin_V1

Diffed and merged, preserving my updates
Scott Lahteine 11 년 전
부모
커밋
5dabc95409

+ 123
- 44
Marlin/Configuration.h 파일 보기

43
 // 82 = Brainwave (AT90USB646)
43
 // 82 = Brainwave (AT90USB646)
44
 // 9  = Gen3+
44
 // 9  = Gen3+
45
 // 70 = Megatronics
45
 // 70 = Megatronics
46
+// 701= Megatronics v2.0
47
+// 702= Minitronics v1.0
46
 // 90 = Alpha OMCA board
48
 // 90 = Alpha OMCA board
47
 // 91 = Final OMCA board
49
 // 91 = Final OMCA board
48
 // 301 = Rambo
50
 // 301 = Rambo
54
 // Define this to set a custom name for your generic Mendel,
56
 // Define this to set a custom name for your generic Mendel,
55
 // #define CUSTOM_MENDEL_NAME "This Mendel"
57
 // #define CUSTOM_MENDEL_NAME "This Mendel"
56
 
58
 
59
+// This defines the number of extruders
60
+#define EXTRUDERS 1
61
+
57
 //// The following define selects which power supply you have. Please choose the one that matches your setup
62
 //// The following define selects which power supply you have. Please choose the one that matches your setup
58
 // 1 = ATX
63
 // 1 = ATX
59
 // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
64
 // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)
81
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
86
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
82
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
87
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
83
 //
88
 //
84
-//    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k 
89
+//    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)
90
 //                          (but gives greater accuracy and more stable PID)
86
 // 51 is 100k thermistor - EPCOS (1k pullup)
91
 // 51 is 100k thermistor - EPCOS (1k pullup)
87
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
92
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
88
 // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup)
93
 // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup)
89
 
94
 
90
 #define TEMP_SENSOR_0 -1
95
 #define TEMP_SENSOR_0 -1
91
-#define TEMP_SENSOR_1 0
96
+#define TEMP_SENSOR_1 -1
92
 #define TEMP_SENSOR_2 0
97
 #define TEMP_SENSOR_2 0
93
 #define TEMP_SENSOR_BED 0
98
 #define TEMP_SENSOR_BED 0
94
 
99
 
100
+// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
101
+//#define TEMP_SENSOR_1_AS_REDUNDANT 
102
+#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
103
+
95
 // Actual temperature must be close to target for this long before M109 returns success
104
 // Actual temperature must be close to target for this long before M109 returns success
96
-#define TEMP_RESIDENCY_TIME 10	// (seconds)
105
+#define TEMP_RESIDENCY_TIME 10  // (seconds)
97
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
106
 #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 residency timer x degC early.
107
 #define TEMP_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.
99
 
108
 
100
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
109
 // 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. 
110
+// 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.
111
 // Otherwise this would lead to the heater being powered on all the time.
103
 #define HEATER_0_MINTEMP 5
112
 #define HEATER_0_MINTEMP 5
104
 #define HEATER_1_MINTEMP 5
113
 #define HEATER_1_MINTEMP 5
124
 #define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
133
 #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
134
 #define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
126
 #ifdef PIDTEMP
135
 #ifdef PIDTEMP
127
-  //#define PID_DEBUG // Sends debug data to the serial port. 
136
+  //#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
137
   //#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
138
   #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.
139
                                   // 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
144
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
136
 // Ultimaker
145
 // Ultimaker
137
     #define  DEFAULT_Kp 22.2
146
     #define  DEFAULT_Kp 22.2
138
-    #define  DEFAULT_Ki 1.08  
139
-    #define  DEFAULT_Kd 114  
147
+    #define  DEFAULT_Ki 1.08
148
+    #define  DEFAULT_Kd 114
140
 
149
 
141
 // Makergear
150
 // Makergear
142
 //    #define  DEFAULT_Kp 7.0
151
 //    #define  DEFAULT_Kp 7.0
143
-//    #define  DEFAULT_Ki 0.1  
144
-//    #define  DEFAULT_Kd 12  
152
+//    #define  DEFAULT_Ki 0.1
153
+//    #define  DEFAULT_Kd 12
145
 
154
 
146
-// Mendel Parts V9 on 12V    
155
+// Mendel Parts V9 on 12V
147
 //    #define  DEFAULT_Kp 63.0
156
 //    #define  DEFAULT_Kp 63.0
148
 //    #define  DEFAULT_Ki 2.25
157
 //    #define  DEFAULT_Ki 2.25
149
 //    #define  DEFAULT_Kd 440
158
 //    #define  DEFAULT_Kd 440
155
 // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
164
 // Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
156
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
165
 // 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.
166
 // 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 probably 
167
+// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
168
+// If your configuration is significantly different than this and you don't understand the issues involved, you probably
160
 // shouldn't use bed PID until someone else verifies your hardware works.
169
 // shouldn't use bed PID until someone else verifies your hardware works.
161
 // If this is enabled, find your own PID constants below.
170
 // If this is enabled, find your own PID constants below.
162
 //#define PIDTEMPBED
171
 //#define PIDTEMPBED
226
 #endif
235
 #endif
227
 
236
 
228
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
237
 // 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. 
238
+const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
239
+const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
240
+const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
232
 //#define DISABLE_MAX_ENDSTOPS
241
 //#define DISABLE_MAX_ENDSTOPS
233
 
242
 
234
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
243
 // 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
292
 #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)
293
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
285
 
294
 
286
-// default settings 
295
+// default settings
287
 
296
 
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)    
297
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for Ultimaker
298
+#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.
299
 #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
 
300
 
292
-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
301
+#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 retracts
302
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
294
 
303
 
295
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
304
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
310
 // EEPROM
319
 // EEPROM
311
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
320
 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
312
 // M500 - stores paramters in EEPROM
321
 // M500 - stores paramters in EEPROM
313
-// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
322
+// 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.
323
 // 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
324
 //define this to enable eeprom support
316
 //#define EEPROM_SETTINGS
325
 //#define EEPROM_SETTINGS
318
 // please keep turned on if you can.
327
 // please keep turned on if you can.
319
 //#define EEPROM_CHITCHAT
328
 //#define EEPROM_CHITCHAT
320
 
329
 
330
+// Preheat Constants
331
+#define PLA_PREHEAT_HOTEND_TEMP 180 
332
+#define PLA_PREHEAT_HPB_TEMP 70
333
+#define PLA_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
334
+
335
+#define ABS_PREHEAT_HOTEND_TEMP 240
336
+#define ABS_PREHEAT_HPB_TEMP 100
337
+#define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
338
+
321
 //LCD and SD support
339
 //LCD and SD support
322
 //#define ULTRA_LCD  //general lcd support, also 16x2
340
 //#define ULTRA_LCD  //general lcd support, also 16x2
323
-//#define DOGLCD	// Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
341
+//#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
324
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
342
 //#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)
343
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
326
 
344
 
341
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
359
 // ==> 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
360
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
343
 
361
 
362
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
363
+// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
364
+//#define REPRAPWORLD_KEYPAD
365
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
366
+
344
 //automatic expansion
367
 //automatic expansion
345
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
368
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
346
  #define DOGLCD
369
  #define DOGLCD
351
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
374
 #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
352
  #define ULTIPANEL
375
  #define ULTIPANEL
353
  #define NEWPANEL
376
  #define NEWPANEL
354
-#endif 
377
+#endif
355
 
378
 
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
379
+#if defined(REPRAPWORLD_KEYPAD)
380
+  #define NEWPANEL
381
+  #define ULTIPANEL
382
+#endif
360
 
383
 
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
384
+//I2C PANELS
385
+
386
+//#define LCD_I2C_SAINSMART_YWROBOT
387
+#ifdef LCD_I2C_SAINSMART_YWROBOT
388
+  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
389
+  // Make sure it is placed in the Arduino libraries directory.
390
+  #define LCD_I2C_TYPE_PCF8575
391
+  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
392
+  #define NEWPANEL
393
+  #define ULTIPANEL 
394
+#endif
364
 
395
 
396
+// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
397
+//#define LCD_I2C_PANELOLU2
398
+#ifdef LCD_I2C_PANELOLU2
399
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
400
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
401
+  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
402
+  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin 
403
+  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1). 
404
+  #define LCD_I2C_TYPE_MCP23017
405
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
406
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
407
+  #define NEWPANEL
408
+  #define ULTIPANEL 
409
+#endif
410
+
411
+// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
412
+//#define LCD_I2C_VIKI
413
+#ifdef LCD_I2C_VIKI
414
+  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
415
+  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
416
+  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
417
+  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
418
+  #define LCD_I2C_TYPE_MCP23017 
419
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
420
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
421
+  #define NEWPANEL
422
+  #define ULTIPANEL 
423
+#endif
365
 
424
 
366
 #ifdef ULTIPANEL
425
 #ifdef ULTIPANEL
367
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
426
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
368
   #define SDSUPPORT
427
   #define SDSUPPORT
369
   #define ULTRA_LCD
428
   #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 
429
+  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
430
+    #define LCD_WIDTH 20
431
+    #define LCD_HEIGHT 5
432
+  #else
433
+    #define LCD_WIDTH 20
434
+    #define LCD_HEIGHT 4
435
+  #endif
436
+#else //no panel but just lcd
378
   #ifdef ULTRA_LCD
437
   #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    
438
+  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
439
+    #define LCD_WIDTH 20
440
+    #define LCD_HEIGHT 5
441
+  #else
442
+    #define LCD_WIDTH 16
443
+    #define LCD_HEIGHT 2
444
+  #endif
386
   #endif
445
   #endif
387
 #endif
446
 #endif
388
 
447
 
396
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
455
 // SF send wrong arc g-codes when using Arc Point as fillet procedure
397
 //#define SF_ARC_FIX
456
 //#define SF_ARC_FIX
398
 
457
 
458
+// Support for the BariCUDA Paste Extruder.
459
+//#define BARICUDA
460
+
461
+/*********************************************************************\
462
+*
463
+* R/C SERVO support
464
+*
465
+* Sponsored by TrinityLabs, Reworked by codexmas
466
+*
467
+**********************************************************************/
468
+
469
+// Number of servos
470
+//
471
+// If you select a configuration below, this will receive a default value and does not need to be set manually
472
+// set it manually if you have more servos than extruders and wish to manually control some
473
+// leaving it undefined or defining as 0 will disable the servo subsystem
474
+// If unsure, leave commented / disabled
475
+//
476
+// #define NUM_SERVOS 3
477
+
399
 #include "Configuration_adv.h"
478
 #include "Configuration_adv.h"
400
 #include "thermistortables.h"
479
 #include "thermistortables.h"
401
 
480
 

+ 22
- 9
Marlin/Configuration_adv.h 파일 보기

63
 //This is for controlling a fan to cool down the stepper drivers
63
 //This is for controlling a fan to cool down the stepper drivers
64
 //it will turn on when any driver is enabled
64
 //it will turn on when any driver is enabled
65
 //and turn off after the set amount of seconds from last driver being disabled again
65
 //and turn off after the set amount of seconds from last driver being disabled again
66
-//#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
67
-#define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
66
+#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
67
+#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
68
+#define CONTROLLERFAN_SPEED 255  // == full speed
68
 
69
 
69
 // When first starting the main fan, run it at full speed for the
70
 // When first starting the main fan, run it at full speed for the
70
 // given number of milliseconds.  This gets the fan spinning reliably
71
 // given number of milliseconds.  This gets the fan spinning reliably
71
 // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
72
 // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
72
 //#define FAN_KICKSTART_TIME 100
73
 //#define FAN_KICKSTART_TIME 100
73
 
74
 
75
+// Extruder cooling fans
76
+// Configure fan pin outputs to automatically turn on/off when the associated
77
+// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
78
+// Multiple extruders can be assigned to the same pin in which case 
79
+// the fan will turn on when any selected extruder is above the threshold.
80
+#define EXTRUDER_0_AUTO_FAN_PIN   -1
81
+#define EXTRUDER_1_AUTO_FAN_PIN   -1
82
+#define EXTRUDER_2_AUTO_FAN_PIN   -1
83
+#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
84
+#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
85
+
86
+
74
 //===========================================================================
87
 //===========================================================================
75
 //=============================Mechanical Settings===========================
88
 //=============================Mechanical Settings===========================
76
 //===========================================================================
89
 //===========================================================================
77
 
90
 
78
-// This defines the number of extruders
79
-#define EXTRUDERS 1
80
-
81
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
82
 
92
 
83
 
93
 
210
 //  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
220
 //  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
211
 //#define WATCHDOG_RESET_MANUAL
221
 //#define WATCHDOG_RESET_MANUAL
212
 #endif
222
 #endif
213
-
214
-// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
215
-//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
223
+
224
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
225
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
216
 
226
 
217
 // extruder advance constant (s2/mm3)
227
 // extruder advance constant (s2/mm3)
218
 //
228
 //
276
 #else
286
 #else
277
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
287
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
278
 #endif
288
 #endif
279
-
289
+
280
 
290
 
281
 //The ASCII buffer for recieving from the serial:
291
 //The ASCII buffer for recieving from the serial:
282
 #define MAX_CMD_SIZE 96
292
 #define MAX_CMD_SIZE 96
308
 //===========================================================================
318
 //===========================================================================
309
 //=============================  Define Defines  ============================
319
 //=============================  Define Defines  ============================
310
 //===========================================================================
320
 //===========================================================================
321
+#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
322
+  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
323
+#endif
311
 
324
 
312
 #if TEMP_SENSOR_0 > 0
325
 #if TEMP_SENSOR_0 > 0
313
   #define THERMISTORHEATER_0 TEMP_SENSOR_0
326
   #define THERMISTORHEATER_0 TEMP_SENSOR_0

+ 3
- 3
Marlin/DOGMbitmaps.h 파일 보기

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

+ 10
- 10
Marlin/Makefile 파일 보기

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

+ 7
- 3
Marlin/Marlin.h 파일 보기

96
 
96
 
97
 void manage_inactivity();
97
 void manage_inactivity();
98
 
98
 
99
-#if X_ENABLE_PIN > -1
99
+#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
100
   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
100
   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
101
   #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
101
   #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
102
 #else
102
 #else
104
   #define disable_x() ;
104
   #define disable_x() ;
105
 #endif
105
 #endif
106
 
106
 
107
-#if Y_ENABLE_PIN > -1
107
+#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
108
   #define  enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
108
   #define  enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
109
   #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
109
   #define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
110
 #else
110
 #else
112
   #define disable_y() ;
112
   #define disable_y() ;
113
 #endif
113
 #endif
114
 
114
 
115
-#if Z_ENABLE_PIN > -1
115
+#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
116
   #ifdef Z_DUAL_STEPPER_DRIVERS
116
   #ifdef Z_DUAL_STEPPER_DRIVERS
117
     #define  enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
117
     #define  enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
118
     #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); }
118
     #define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); }
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;

+ 12
- 6
Marlin/Marlin.pde 파일 보기

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 defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
45
 #include <SPI.h>
51
 #include <SPI.h>
46
 #endif
52
 #endif

+ 403
- 311
Marlin/Marlin_main.cpp
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 339
- 0
Marlin/Servo.cpp 파일 보기

1
+/*
2
+ Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
3
+ Copyright (c) 2009 Michael Margolis.  All right reserved.
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
+ */
19
+
20
+/*
21
+
22
+ A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
23
+ The servos are pulsed in the background using the value most recently written using the write() method
24
+
25
+ Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
26
+ Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
27
+
28
+ The methods are:
29
+
30
+ Servo - Class for manipulating servo motors connected to Arduino pins.
31
+
32
+ attach(pin )  - Attaches a servo motor to an i/o pin.
33
+ attach(pin, min, max  ) - Attaches to a pin setting min and max values in microseconds
34
+ default min is 544, max is 2400
35
+
36
+ write()     - Sets the servo angle in degrees.  (invalid angle that is valid as pulse in microseconds is treated as microseconds)
37
+ writeMicroseconds() - Sets the servo pulse width in microseconds
38
+ read()      - Gets the last written servo pulse width as an angle between 0 and 180.
39
+ readMicroseconds()   - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
40
+ attached()  - Returns true if there is a servo attached.
41
+ detach()    - Stops an attached servos from pulsing its i/o pin.
42
+
43
+*/
44
+#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 파일 보기

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

+ 20
- 8
Marlin/dogm_lcd_implementation.h 파일 보기

19
 * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
19
 * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
20
 **/
20
 **/
21
 
21
 
22
+#ifdef ULTIPANEL
23
+#define BLEN_A 0
24
+#define BLEN_B 1
25
+#define BLEN_C 2
26
+#define EN_A (1<<BLEN_A)
27
+#define EN_B (1<<BLEN_B)
28
+#define EN_C (1<<BLEN_C)
29
+#define encrot0 0
30
+#define encrot1 2
31
+#define encrot2 3
32
+#define encrot3 1
33
+#define LCD_CLICKED (buttons&EN_C)
34
+#endif
22
 
35
 
23
-// CHANGE_DE begin ***
24
-#include <U8glib.h>	// DE_U8glib
36
+#include <U8glib.h>
25
 #include "DOGMbitmaps.h"
37
 #include "DOGMbitmaps.h"
26
 #include "dogm_font_data_marlin.h"
38
 #include "dogm_font_data_marlin.h"
27
 #include "ultralcd.h"
39
 #include "ultralcd.h"
40
+#include "ultralcd_st7920_u8glib_rrd.h"
28
 
41
 
29
 
42
 
30
 /* Russian language not supported yet, needs custom font
43
 /* Russian language not supported yet, needs custom font
61
 
74
 
62
 #define FONT_STATUSMENU	u8g_font_6x9
75
 #define FONT_STATUSMENU	u8g_font_6x9
63
 
76
 
64
-
65
 // LCD selection
77
 // LCD selection
66
 #ifdef U8GLIB_ST7920
78
 #ifdef U8GLIB_ST7920
67
-// SPI Com: SCK = en = (D4), MOSI = rw = (RS), CS = di = (ENABLE)
68
-U8GLIB_ST7920_128X64_1X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS);
79
+//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
80
+U8GLIB_ST7920_128X64_RRD u8g(0);
69
 #else
81
 #else
70
 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
82
 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
71
 #endif
83
 #endif
88
 	u8g.setRot90();	// Rotate screen by 90°
100
 	u8g.setRot90();	// Rotate screen by 90°
89
 #endif
101
 #endif
90
 
102
 
91
-#ifdef LCD_SCREEN_ROT_180;
103
+#ifdef LCD_SCREEN_ROT_180
92
 	u8g.setRot180();	// Rotate screen by 180°
104
 	u8g.setRot180();	// Rotate screen by 180°
93
 #endif
105
 #endif
94
 
106
 
95
-#ifdef LCD_SCREEN_ROT_270;
107
+#ifdef LCD_SCREEN_ROT_270
96
 	u8g.setRot270();	// Rotate screen by 270°
108
 	u8g.setRot270();	// Rotate screen by 270°
97
 #endif
109
 #endif
98
 
110
 
266
  // Fan
278
  // Fan
267
  u8g.setFont(FONT_STATUSMENU);
279
  u8g.setFont(FONT_STATUSMENU);
268
  u8g.setPrintPos(104,27);
280
  u8g.setPrintPos(104,27);
269
- #if FAN_PIN > 0
281
+ #if defined(FAN_PIN) && FAN_PIN > -1
270
  u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
282
  u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
271
  u8g.print("%");
283
  u8g.print("%");
272
  #else
284
  #else

+ 695
- 1
Marlin/fastio.h 파일 보기

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

+ 533
- 330
Marlin/pins.h
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 37
- 7
Marlin/planner.cpp 파일 보기

98
 //=============================private variables ============================
98
 //=============================private variables ============================
99
 //===========================================================================
99
 //===========================================================================
100
 #ifdef PREVENT_DANGEROUS_EXTRUDE
100
 #ifdef PREVENT_DANGEROUS_EXTRUDE
101
-bool allow_cold_extrude=false;
101
+float extrude_min_temp=EXTRUDE_MINTEMP;
102
 #endif
102
 #endif
103
 #ifdef XY_FREQUENCY_LIMIT
103
 #ifdef XY_FREQUENCY_LIMIT
104
 #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
104
 #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
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];
464
     disable_e1();
472
     disable_e1();
465
     disable_e2(); 
473
     disable_e2(); 
466
   }
474
   }
467
-#if FAN_PIN > -1
475
+#if defined(FAN_PIN) && FAN_PIN > -1
468
   #ifndef FAN_SOFT_PWM
476
   #ifndef FAN_SOFT_PWM
469
     #ifdef FAN_KICKSTART_TIME
477
     #ifdef FAN_KICKSTART_TIME
470
       static unsigned long fan_kick_end;
478
       static unsigned long fan_kick_end;
486
 #ifdef AUTOTEMP
494
 #ifdef AUTOTEMP
487
   getHighESpeed();
495
   getHighESpeed();
488
 #endif
496
 #endif
497
+
498
+#ifdef BARICUDA
499
+  #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1
500
+      analogWrite(HEATER_1_PIN,tail_valve_pressure);
501
+  #endif
502
+
503
+  #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1
504
+      analogWrite(HEATER_2_PIN,tail_e_to_p_pressure);
505
+  #endif
506
+#endif
489
 }
507
 }
490
 
508
 
491
 
509
 
519
   #ifdef PREVENT_DANGEROUS_EXTRUDE
537
   #ifdef PREVENT_DANGEROUS_EXTRUDE
520
   if(target[E_AXIS]!=position[E_AXIS])
538
   if(target[E_AXIS]!=position[E_AXIS])
521
   {
539
   {
522
-    if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
540
+    if(degHotend(active_extruder)<extrude_min_temp)
523
     {
541
     {
524
       position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
542
       position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
525
       SERIAL_ECHO_START;
543
       SERIAL_ECHO_START;
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
888
   return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
918
   return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
889
 }
919
 }
890
 
920
 
891
-void allow_cold_extrudes(bool allow)
892
-{
893
 #ifdef PREVENT_DANGEROUS_EXTRUDE
921
 #ifdef PREVENT_DANGEROUS_EXTRUDE
894
-  allow_cold_extrude=allow;
895
-#endif
922
+void set_extrude_min_temp(float temp)
923
+{
924
+  extrude_min_temp=temp;
896
 }
925
 }
926
+#endif
897
 
927
 
898
 // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
928
 // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
899
 void reset_acceleration_rates()
929
 void reset_acceleration_rates()

+ 7
- 1
Marlin/planner.h 파일 보기

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

+ 32
- 36
Marlin/stepper.cpp 파일 보기

29
 #include "language.h"
29
 #include "language.h"
30
 #include "cardreader.h"
30
 #include "cardreader.h"
31
 #include "speed_lookuptable.h"
31
 #include "speed_lookuptable.h"
32
-#if DIGIPOTSS_PIN > -1
32
+#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
33
 #include <SPI.h>
33
 #include <SPI.h>
34
 #endif
34
 #endif
35
 
35
 
353
       count_direction[X_AXIS]=-1;
353
       count_direction[X_AXIS]=-1;
354
       CHECK_ENDSTOPS
354
       CHECK_ENDSTOPS
355
       {
355
       {
356
-        #if X_MIN_PIN > -1
356
+        #if defined(X_MIN_PIN) && X_MIN_PIN > -1
357
           bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
357
           bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
358
           if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
358
           if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
359
             endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
359
             endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
372
       count_direction[X_AXIS]=1;
372
       count_direction[X_AXIS]=1;
373
       CHECK_ENDSTOPS 
373
       CHECK_ENDSTOPS 
374
       {
374
       {
375
-        #if X_MAX_PIN > -1
375
+        #if defined(X_MAX_PIN) && X_MAX_PIN > -1
376
           bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
376
           bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
377
           if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
377
           if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
378
             endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
378
             endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
391
       count_direction[Y_AXIS]=-1;
391
       count_direction[Y_AXIS]=-1;
392
       CHECK_ENDSTOPS
392
       CHECK_ENDSTOPS
393
       {
393
       {
394
-        #if Y_MIN_PIN > -1
394
+        #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
395
           bool y_min_endstop=(READ(Y_MIN_PIN) != Y_ENDSTOPS_INVERTING);
395
           bool y_min_endstop=(READ(Y_MIN_PIN) != Y_ENDSTOPS_INVERTING);
396
           if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
396
           if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
397
             endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
397
             endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
409
       count_direction[Y_AXIS]=1;
409
       count_direction[Y_AXIS]=1;
410
       CHECK_ENDSTOPS
410
       CHECK_ENDSTOPS
411
       {
411
       {
412
-        #if Y_MAX_PIN > -1
412
+        #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
413
           bool y_max_endstop=(READ(Y_MAX_PIN) != Y_ENDSTOPS_INVERTING);
413
           bool y_max_endstop=(READ(Y_MAX_PIN) != Y_ENDSTOPS_INVERTING);
414
           if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
414
           if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
415
             endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
415
             endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
452
       count_direction[Z_AXIS]=-1;
452
       count_direction[Z_AXIS]=-1;
453
       CHECK_ENDSTOPS
453
       CHECK_ENDSTOPS
454
       {
454
       {
455
-        #if Z_MIN_PIN > -1
455
+        #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
456
           bool z_min_endstop=(READ(Z_MIN_PIN) != Z_ENDSTOPS_INVERTING);
456
           bool z_min_endstop=(READ(Z_MIN_PIN) != Z_ENDSTOPS_INVERTING);
457
           if(z_min_endstop && old_z_min_endstop && (current_block->steps_z > 0)) {
457
           if(z_min_endstop && old_z_min_endstop && (current_block->steps_z > 0)) {
458
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
458
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
473
       count_direction[Z_AXIS]=1;
473
       count_direction[Z_AXIS]=1;
474
       CHECK_ENDSTOPS
474
       CHECK_ENDSTOPS
475
       {
475
       {
476
-        #if Z_MAX_PIN > -1
476
+        #if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
477
           bool z_max_endstop=(READ(Z_MAX_PIN) != Z_ENDSTOPS_INVERTING);
477
           bool z_max_endstop=(READ(Z_MAX_PIN) != Z_ENDSTOPS_INVERTING);
478
           if(z_max_endstop && old_z_max_endstop && (current_block->steps_z > 0)) {
478
           if(z_max_endstop && old_z_max_endstop && (current_block->steps_z > 0)) {
479
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
479
             endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
743
   microstep_init(); //Initialize Microstepping Pins
743
   microstep_init(); //Initialize Microstepping Pins
744
   
744
   
745
   //Initialize Dir Pins
745
   //Initialize Dir Pins
746
-  #if X_DIR_PIN > -1
746
+  #if defined(X_DIR_PIN) && X_DIR_PIN > -1
747
     SET_OUTPUT(X_DIR_PIN);
747
     SET_OUTPUT(X_DIR_PIN);
748
   #endif
748
   #endif
749
-  #if Y_DIR_PIN > -1 
749
+  #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 
750
     SET_OUTPUT(Y_DIR_PIN);
750
     SET_OUTPUT(Y_DIR_PIN);
751
   #endif
751
   #endif
752
-  #if Z_DIR_PIN > -1 
752
+  #if defined(Z_DIR_PIN) && Z_DIR_PIN > -1 
753
     SET_OUTPUT(Z_DIR_PIN);
753
     SET_OUTPUT(Z_DIR_PIN);
754
 
754
 
755
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_DIR_PIN > -1)
755
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_DIR_PIN) && (Z2_DIR_PIN > -1)
756
       SET_OUTPUT(Z2_DIR_PIN);
756
       SET_OUTPUT(Z2_DIR_PIN);
757
     #endif
757
     #endif
758
   #endif
758
   #endif
759
-  #if E0_DIR_PIN > -1 
759
+  #if defined(E0_DIR_PIN) && E0_DIR_PIN > -1 
760
     SET_OUTPUT(E0_DIR_PIN);
760
     SET_OUTPUT(E0_DIR_PIN);
761
   #endif
761
   #endif
762
   #if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
762
   #if defined(E1_DIR_PIN) && (E1_DIR_PIN > -1)
768
 
768
 
769
   //Initialize Enable Pins - steppers default to disabled.
769
   //Initialize Enable Pins - steppers default to disabled.
770
 
770
 
771
-  #if (X_ENABLE_PIN > -1)
771
+  #if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
772
     SET_OUTPUT(X_ENABLE_PIN);
772
     SET_OUTPUT(X_ENABLE_PIN);
773
     if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
773
     if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
774
   #endif
774
   #endif
775
-  #if (Y_ENABLE_PIN > -1)
775
+  #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
776
     SET_OUTPUT(Y_ENABLE_PIN);
776
     SET_OUTPUT(Y_ENABLE_PIN);
777
     if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
777
     if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
778
   #endif
778
   #endif
779
-  #if (Z_ENABLE_PIN > -1)
779
+  #if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
780
     SET_OUTPUT(Z_ENABLE_PIN);
780
     SET_OUTPUT(Z_ENABLE_PIN);
781
     if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
781
     if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
782
     
782
     
783
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_ENABLE_PIN > -1)
783
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_ENABLE_PIN) && (Z2_ENABLE_PIN > -1)
784
       SET_OUTPUT(Z2_ENABLE_PIN);
784
       SET_OUTPUT(Z2_ENABLE_PIN);
785
       if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
785
       if(!Z_ENABLE_ON) WRITE(Z2_ENABLE_PIN,HIGH);
786
     #endif
786
     #endif
787
   #endif
787
   #endif
788
-  #if (E0_ENABLE_PIN > -1)
788
+  #if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
789
     SET_OUTPUT(E0_ENABLE_PIN);
789
     SET_OUTPUT(E0_ENABLE_PIN);
790
     if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
790
     if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
791
   #endif
791
   #endif
800
 
800
 
801
   //endstops and pullups
801
   //endstops and pullups
802
   
802
   
803
-  #if X_MIN_PIN > -1
803
+  #if defined(X_MIN_PIN) && X_MIN_PIN > -1
804
     SET_INPUT(X_MIN_PIN); 
804
     SET_INPUT(X_MIN_PIN); 
805
     #ifdef ENDSTOPPULLUP_XMIN
805
     #ifdef ENDSTOPPULLUP_XMIN
806
       WRITE(X_MIN_PIN,HIGH);
806
       WRITE(X_MIN_PIN,HIGH);
807
     #endif
807
     #endif
808
   #endif
808
   #endif
809
       
809
       
810
-  #if Y_MIN_PIN > -1
810
+  #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
811
     SET_INPUT(Y_MIN_PIN); 
811
     SET_INPUT(Y_MIN_PIN); 
812
     #ifdef ENDSTOPPULLUP_YMIN
812
     #ifdef ENDSTOPPULLUP_YMIN
813
       WRITE(Y_MIN_PIN,HIGH);
813
       WRITE(Y_MIN_PIN,HIGH);
814
     #endif
814
     #endif
815
   #endif
815
   #endif
816
   
816
   
817
-  #if Z_MIN_PIN > -1
817
+  #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
818
     SET_INPUT(Z_MIN_PIN); 
818
     SET_INPUT(Z_MIN_PIN); 
819
     #ifdef ENDSTOPPULLUP_ZMIN
819
     #ifdef ENDSTOPPULLUP_ZMIN
820
       WRITE(Z_MIN_PIN,HIGH);
820
       WRITE(Z_MIN_PIN,HIGH);
821
     #endif
821
     #endif
822
   #endif
822
   #endif
823
       
823
       
824
-  #if X_MAX_PIN > -1
824
+  #if defined(X_MAX_PIN) && X_MAX_PIN > -1
825
     SET_INPUT(X_MAX_PIN); 
825
     SET_INPUT(X_MAX_PIN); 
826
     #ifdef ENDSTOPPULLUP_XMAX
826
     #ifdef ENDSTOPPULLUP_XMAX
827
       WRITE(X_MAX_PIN,HIGH);
827
       WRITE(X_MAX_PIN,HIGH);
828
     #endif
828
     #endif
829
   #endif
829
   #endif
830
       
830
       
831
-  #if Y_MAX_PIN > -1
831
+  #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
832
     SET_INPUT(Y_MAX_PIN); 
832
     SET_INPUT(Y_MAX_PIN); 
833
     #ifdef ENDSTOPPULLUP_YMAX
833
     #ifdef ENDSTOPPULLUP_YMAX
834
       WRITE(Y_MAX_PIN,HIGH);
834
       WRITE(Y_MAX_PIN,HIGH);
835
     #endif
835
     #endif
836
   #endif
836
   #endif
837
   
837
   
838
-  #if Z_MAX_PIN > -1
838
+  #if defined(Z_MAX_PIN) && Z_MAX_PIN > -1
839
     SET_INPUT(Z_MAX_PIN); 
839
     SET_INPUT(Z_MAX_PIN); 
840
     #ifdef ENDSTOPPULLUP_ZMAX
840
     #ifdef ENDSTOPPULLUP_ZMAX
841
       WRITE(Z_MAX_PIN,HIGH);
841
       WRITE(Z_MAX_PIN,HIGH);
844
  
844
  
845
 
845
 
846
   //Initialize Step Pins
846
   //Initialize Step Pins
847
-  #if (X_STEP_PIN > -1) 
847
+  #if defined(X_STEP_PIN) && (X_STEP_PIN > -1) 
848
     SET_OUTPUT(X_STEP_PIN);
848
     SET_OUTPUT(X_STEP_PIN);
849
     WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
849
     WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
850
     disable_x();
850
     disable_x();
851
   #endif  
851
   #endif  
852
-  #if (Y_STEP_PIN > -1) 
852
+  #if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1) 
853
     SET_OUTPUT(Y_STEP_PIN);
853
     SET_OUTPUT(Y_STEP_PIN);
854
     WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
854
     WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
855
     disable_y();
855
     disable_y();
856
   #endif  
856
   #endif  
857
-  #if (Z_STEP_PIN > -1) 
857
+  #if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1) 
858
     SET_OUTPUT(Z_STEP_PIN);
858
     SET_OUTPUT(Z_STEP_PIN);
859
     WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
859
     WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
860
-    #if defined(Z_DUAL_STEPPER_DRIVERS) && (Z2_STEP_PIN > -1)
860
+    #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
861
       SET_OUTPUT(Z2_STEP_PIN);
861
       SET_OUTPUT(Z2_STEP_PIN);
862
       WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
862
       WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
863
     #endif
863
     #endif
864
     disable_z();
864
     disable_z();
865
   #endif  
865
   #endif  
866
-  #if (E0_STEP_PIN > -1) 
866
+  #if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1) 
867
     SET_OUTPUT(E0_STEP_PIN);
867
     SET_OUTPUT(E0_STEP_PIN);
868
     WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
868
     WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
869
     disable_e0();
869
     disable_e0();
879
     disable_e2();
879
     disable_e2();
880
   #endif  
880
   #endif  
881
 
881
 
882
-  #ifdef CONTROLLERFAN_PIN
883
-    SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
884
-  #endif
885
-  
886
   // waveform generation = 0100 = CTC
882
   // waveform generation = 0100 = CTC
887
   TCCR1B &= ~(1<<WGM13);
883
   TCCR1B &= ~(1<<WGM13);
888
   TCCR1B |=  (1<<WGM12);
884
   TCCR1B |=  (1<<WGM12);
978
 
974
 
979
 void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl example
975
 void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl example
980
 {
976
 {
981
-  #if DIGIPOTSS_PIN > -1
977
+  #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
982
     digitalWrite(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip
978
     digitalWrite(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip
983
     SPI.transfer(address); //  send in the address and value via SPI:
979
     SPI.transfer(address); //  send in the address and value via SPI:
984
     SPI.transfer(value);
980
     SPI.transfer(value);
989
 
985
 
990
 void digipot_init() //Initialize Digipot Motor Current
986
 void digipot_init() //Initialize Digipot Motor Current
991
 {
987
 {
992
-  #if DIGIPOTSS_PIN > -1
988
+  #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
993
     const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
989
     const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT;
994
     
990
     
995
     SPI.begin(); 
991
     SPI.begin(); 
1002
 
998
 
1003
 void digipot_current(uint8_t driver, int current)
999
 void digipot_current(uint8_t driver, int current)
1004
 {
1000
 {
1005
-  #if DIGIPOTSS_PIN > -1
1001
+  #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
1006
     const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
1002
     const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
1007
     digitalPotWrite(digipot_ch[driver], current);
1003
     digitalPotWrite(digipot_ch[driver], current);
1008
   #endif
1004
   #endif
1010
 
1006
 
1011
 void microstep_init()
1007
 void microstep_init()
1012
 {
1008
 {
1013
-  #if X_MS1_PIN > -1
1009
+  #if defined(X_MS1_PIN) && X_MS1_PIN > -1
1014
   const uint8_t microstep_modes[] = MICROSTEP_MODES;
1010
   const uint8_t microstep_modes[] = MICROSTEP_MODES;
1015
   pinMode(X_MS2_PIN,OUTPUT);
1011
   pinMode(X_MS2_PIN,OUTPUT);
1016
   pinMode(Y_MS2_PIN,OUTPUT);
1012
   pinMode(Y_MS2_PIN,OUTPUT);

+ 196
- 76
Marlin/temperature.cpp 파일 보기

40
 int target_temperature[EXTRUDERS] = { 0 };
40
 int target_temperature[EXTRUDERS] = { 0 };
41
 int target_temperature_bed = 0;
41
 int target_temperature_bed = 0;
42
 int current_temperature_raw[EXTRUDERS] = { 0 };
42
 int current_temperature_raw[EXTRUDERS] = { 0 };
43
-float current_temperature[EXTRUDERS] = { 0 };
43
+float current_temperature[EXTRUDERS] = { 0.0 };
44
 int current_temperature_bed_raw = 0;
44
 int current_temperature_bed_raw = 0;
45
-float current_temperature_bed = 0;
46
-
45
+float current_temperature_bed = 0.0;
46
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
47
+  int redundant_temperature_raw = 0;
48
+  float redundant_temperature = 0.0;
49
+#endif
47
 #ifdef PIDTEMP
50
 #ifdef PIDTEMP
48
   float Kp=DEFAULT_Kp;
51
   float Kp=DEFAULT_Kp;
49
   float Ki=(DEFAULT_Ki*PID_dT);
52
   float Ki=(DEFAULT_Ki*PID_dT);
99
 #ifdef FAN_SOFT_PWM
102
 #ifdef FAN_SOFT_PWM
100
   static unsigned char soft_pwm_fan;
103
   static unsigned char soft_pwm_fan;
101
 #endif
104
 #endif
105
+#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
106
+    (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
107
+    (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
108
+  static unsigned long extruder_autofan_last_check;
109
+#endif  
102
 
110
 
103
-
104
-  
105
 #if EXTRUDERS > 3
111
 #if EXTRUDERS > 3
106
-# error Unsupported number of extruders
112
+  # error Unsupported number of extruders
107
 #elif EXTRUDERS > 2
113
 #elif EXTRUDERS > 2
108
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
114
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
109
 #elif EXTRUDERS > 1
115
 #elif EXTRUDERS > 1
110
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
116
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
111
 #else
117
 #else
112
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
118
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
113
 #endif
119
 #endif
114
 
120
 
115
 // Init min and max temp with extreme values to prevent false errors during startup
121
 // Init min and max temp with extreme values to prevent false errors during startup
121
 #ifdef BED_MAXTEMP
127
 #ifdef BED_MAXTEMP
122
 static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
128
 static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
123
 #endif
129
 #endif
124
-static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
125
-static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
130
+
131
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
132
+  static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE };
133
+  static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
134
+#else
135
+  static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
136
+  static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
137
+#endif
126
 
138
 
127
 static float analog2temp(int raw, uint8_t e);
139
 static float analog2temp(int raw, uint8_t e);
128
 static float analog2tempBed(int raw);
140
 static float analog2tempBed(int raw);
154
   float Kp, Ki, Kd;
166
   float Kp, Ki, Kd;
155
   float max = 0, min = 10000;
167
   float max = 0, min = 10000;
156
 
168
 
157
-	if ((extruder > EXTRUDERS)
169
+  if ((extruder > EXTRUDERS)
158
   #if (TEMP_BED_PIN <= -1)
170
   #if (TEMP_BED_PIN <= -1)
159
-		||(extruder < 0)
160
-	#endif
161
-	){
162
-  	SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
163
-  	return;
164
-	}
171
+       ||(extruder < 0)
172
+  #endif
173
+       ){
174
+          SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
175
+          return;
176
+        }
165
 	
177
 	
166
   SERIAL_ECHOLN("PID Autotune start");
178
   SERIAL_ECHOLN("PID Autotune start");
167
   
179
   
168
   disable_heater(); // switch off all heaters.
180
   disable_heater(); // switch off all heaters.
169
 
181
 
170
-	if (extruder<0)
171
-	{
172
-	 	soft_pwm_bed = (MAX_BED_POWER)/2;
173
-		bias = d = (MAX_BED_POWER)/2;
174
-  }
175
-	else
176
-	{
177
-	  soft_pwm[extruder] = (PID_MAX)/2;
178
-		bias = d = (PID_MAX)/2;
182
+  if (extruder<0)
183
+  {
184
+     soft_pwm_bed = (MAX_BED_POWER)/2;
185
+     bias = d = (MAX_BED_POWER)/2;
186
+   }
187
+   else
188
+   {
189
+     soft_pwm[extruder] = (PID_MAX)/2;
190
+     bias = d = (PID_MAX)/2;
179
   }
191
   }
180
 
192
 
181
 
193
 
193
       if(heating == true && input > temp) {
205
       if(heating == true && input > temp) {
194
         if(millis() - t2 > 5000) { 
206
         if(millis() - t2 > 5000) { 
195
           heating=false;
207
           heating=false;
196
-					if (extruder<0)
197
-						soft_pwm_bed = (bias - d) >> 1;
198
-					else
199
-						soft_pwm[extruder] = (bias - d) >> 1;
208
+          if (extruder<0)
209
+            soft_pwm_bed = (bias - d) >> 1;
210
+          else
211
+            soft_pwm[extruder] = (bias - d) >> 1;
200
           t1=millis();
212
           t1=millis();
201
           t_high=t1 - t2;
213
           t_high=t1 - t2;
202
           max=temp;
214
           max=temp;
247
               */
259
               */
248
             }
260
             }
249
           }
261
           }
250
-					if (extruder<0)
251
-						soft_pwm_bed = (bias + d) >> 1;
252
-					else
253
-						soft_pwm[extruder] = (bias + d) >> 1;
262
+          if (extruder<0)
263
+            soft_pwm_bed = (bias + d) >> 1;
264
+          else
265
+            soft_pwm[extruder] = (bias + d) >> 1;
254
           cycles++;
266
           cycles++;
255
           min=temp;
267
           min=temp;
256
         }
268
         }
261
       return;
273
       return;
262
     }
274
     }
263
     if(millis() - temp_millis > 2000) {
275
     if(millis() - temp_millis > 2000) {
264
-			int p;
265
-			if (extruder<0){
266
-	      p=soft_pwm_bed;       
267
-	      SERIAL_PROTOCOLPGM("ok B:");
268
-			}else{
269
-	      p=soft_pwm[extruder];       
270
-	      SERIAL_PROTOCOLPGM("ok T:");
271
-			}
276
+      int p;
277
+      if (extruder<0){
278
+        p=soft_pwm_bed;       
279
+        SERIAL_PROTOCOLPGM("ok B:");
280
+      }else{
281
+        p=soft_pwm[extruder];       
282
+        SERIAL_PROTOCOLPGM("ok T:");
283
+      }
272
 			
284
 			
273
       SERIAL_PROTOCOL(input);   
285
       SERIAL_PROTOCOL(input);   
274
       SERIAL_PROTOCOLPGM(" @:");
286
       SERIAL_PROTOCOLPGM(" @:");
306
   return soft_pwm[heater];
318
   return soft_pwm[heater];
307
 }
319
 }
308
 
320
 
321
+#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
322
+    (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
323
+    (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
324
+
325
+  #if defined(FAN_PIN) && FAN_PIN > -1
326
+    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN 
327
+       #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
328
+    #endif
329
+    #if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN 
330
+       #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
331
+    #endif
332
+    #if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN 
333
+       #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
334
+    #endif
335
+  #endif 
336
+
337
+void setExtruderAutoFanState(int pin, bool state)
338
+{
339
+  unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
340
+  // this idiom allows both digital and PWM fan outputs (see M42 handling).
341
+  pinMode(pin, OUTPUT);
342
+  digitalWrite(pin, newFanSpeed);
343
+  analogWrite(pin, newFanSpeed);
344
+}
345
+
346
+void checkExtruderAutoFans()
347
+{
348
+  uint8_t fanState = 0;
349
+
350
+  // which fan pins need to be turned on?      
351
+  #if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
352
+    if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
353
+      fanState |= 1;
354
+  #endif
355
+  #if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
356
+    if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
357
+    {
358
+      if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
359
+        fanState |= 1;
360
+      else
361
+        fanState |= 2;
362
+    }
363
+  #endif
364
+  #if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
365
+    if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
366
+    {
367
+      if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
368
+        fanState |= 1;
369
+      else if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN) 
370
+        fanState |= 2;
371
+      else
372
+        fanState |= 4;
373
+    }
374
+  #endif
375
+  
376
+  // update extruder auto fan states
377
+  #if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
378
+    setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
379
+  #endif 
380
+  #if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
381
+    if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) 
382
+      setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
383
+  #endif 
384
+  #if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
385
+    if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN 
386
+        && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
387
+      setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
388
+  #endif 
389
+}
390
+
391
+#endif // any extruder auto fan pins set
392
+
309
 void manage_heater()
393
 void manage_heater()
310
 {
394
 {
311
   float pid_input;
395
   float pid_input;
396
         }
480
         }
397
     }
481
     }
398
     #endif
482
     #endif
399
-
483
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
484
+      if(fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
485
+        disable_heater();
486
+        if(IsStopped() == false) {
487
+          SERIAL_ERROR_START;
488
+          SERIAL_ERRORLNPGM("Extruder switched off. Temperature difference between temp sensors is too high !");
489
+          LCD_ALERTMESSAGEPGM("Err: REDUNDANT TEMP ERROR");
490
+        }
491
+        #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
492
+          Stop();
493
+        #endif
494
+      }
495
+    #endif
400
   } // End extruder for loop
496
   } // End extruder for loop
401
-  
402
 
497
 
498
+  #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
499
+      (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
500
+      (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
501
+  if(millis() - extruder_autofan_last_check > 2500)  // only need to check fan state very infrequently
502
+  {
503
+    checkExtruderAutoFans();
504
+    extruder_autofan_last_check = millis();
505
+  }  
506
+  #endif       
507
+  
403
   #ifndef PIDTEMPBED
508
   #ifndef PIDTEMPBED
404
   if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
509
   if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
405
     return;
510
     return;
481
 // Derived from RepRap FiveD extruder::getTemperature()
586
 // Derived from RepRap FiveD extruder::getTemperature()
482
 // For hot end temperature measurement.
587
 // For hot end temperature measurement.
483
 static float analog2temp(int raw, uint8_t e) {
588
 static float analog2temp(int raw, uint8_t e) {
589
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
590
+  if(e > EXTRUDERS)
591
+#else
484
   if(e >= EXTRUDERS)
592
   if(e >= EXTRUDERS)
593
+#endif
485
   {
594
   {
486
       SERIAL_ERROR_START;
595
       SERIAL_ERROR_START;
487
       SERIAL_ERROR((int)e);
596
       SERIAL_ERROR((int)e);
560
         current_temperature[e] = analog2temp(current_temperature_raw[e], e);
669
         current_temperature[e] = analog2temp(current_temperature_raw[e], e);
561
     }
670
     }
562
     current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
671
     current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
563
-
672
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
673
+      redundant_temperature = analog2temp(redundant_temperature_raw, 1);
674
+    #endif
564
     //Reset the watchdog after we know we have a temperature measurement.
675
     //Reset the watchdog after we know we have a temperature measurement.
565
     watchdog_reset();
676
     watchdog_reset();
566
 
677
 
571
 
682
 
572
 void tp_init()
683
 void tp_init()
573
 {
684
 {
685
+#if (MOTHERBOARD == 80) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
686
+  //disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
687
+  MCUCR=(1<<JTD); 
688
+  MCUCR=(1<<JTD);
689
+#endif
690
+  
574
   // Finish init of mult extruder arrays 
691
   // Finish init of mult extruder arrays 
575
   for(int e = 0; e < EXTRUDERS; e++) {
692
   for(int e = 0; e < EXTRUDERS; e++) {
576
     // populate with the first value 
693
     // populate with the first value 
585
 #endif //PIDTEMPBED
702
 #endif //PIDTEMPBED
586
   }
703
   }
587
 
704
 
588
-  #if (HEATER_0_PIN > -1) 
705
+  #if defined(HEATER_0_PIN) && (HEATER_0_PIN > -1) 
589
     SET_OUTPUT(HEATER_0_PIN);
706
     SET_OUTPUT(HEATER_0_PIN);
590
   #endif  
707
   #endif  
591
-  #if (HEATER_1_PIN > -1) 
708
+  #if defined(HEATER_1_PIN) && (HEATER_1_PIN > -1) 
592
     SET_OUTPUT(HEATER_1_PIN);
709
     SET_OUTPUT(HEATER_1_PIN);
593
   #endif  
710
   #endif  
594
-  #if (HEATER_2_PIN > -1) 
711
+  #if defined(HEATER_2_PIN) && (HEATER_2_PIN > -1) 
595
     SET_OUTPUT(HEATER_2_PIN);
712
     SET_OUTPUT(HEATER_2_PIN);
596
   #endif  
713
   #endif  
597
-  #if (HEATER_BED_PIN > -1) 
714
+  #if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1) 
598
     SET_OUTPUT(HEATER_BED_PIN);
715
     SET_OUTPUT(HEATER_BED_PIN);
599
   #endif  
716
   #endif  
600
-  #if (FAN_PIN > -1) 
717
+  #if defined(FAN_PIN) && (FAN_PIN > -1) 
601
     SET_OUTPUT(FAN_PIN);
718
     SET_OUTPUT(FAN_PIN);
602
     #ifdef FAST_PWM_FAN
719
     #ifdef FAST_PWM_FAN
603
     setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
720
     setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
629
   #ifdef DIDR2
746
   #ifdef DIDR2
630
     DIDR2 = 0;
747
     DIDR2 = 0;
631
   #endif
748
   #endif
632
-  #if (TEMP_0_PIN > -1)
749
+  #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)
633
     #if TEMP_0_PIN < 8
750
     #if TEMP_0_PIN < 8
634
        DIDR0 |= 1 << TEMP_0_PIN; 
751
        DIDR0 |= 1 << TEMP_0_PIN; 
635
     #else
752
     #else
636
        DIDR2 |= 1<<(TEMP_0_PIN - 8); 
753
        DIDR2 |= 1<<(TEMP_0_PIN - 8); 
637
     #endif
754
     #endif
638
   #endif
755
   #endif
639
-  #if (TEMP_1_PIN > -1)
756
+  #if defined(TEMP_1_PIN) && (TEMP_1_PIN > -1)
640
     #if TEMP_1_PIN < 8
757
     #if TEMP_1_PIN < 8
641
        DIDR0 |= 1<<TEMP_1_PIN; 
758
        DIDR0 |= 1<<TEMP_1_PIN; 
642
     #else
759
     #else
643
        DIDR2 |= 1<<(TEMP_1_PIN - 8); 
760
        DIDR2 |= 1<<(TEMP_1_PIN - 8); 
644
     #endif
761
     #endif
645
   #endif
762
   #endif
646
-  #if (TEMP_2_PIN > -1)
763
+  #if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1)
647
     #if TEMP_2_PIN < 8
764
     #if TEMP_2_PIN < 8
648
        DIDR0 |= 1 << TEMP_2_PIN; 
765
        DIDR0 |= 1 << TEMP_2_PIN; 
649
     #else
766
     #else
650
-       DIDR2 = 1<<(TEMP_2_PIN - 8); 
767
+       DIDR2 |= 1<<(TEMP_2_PIN - 8); 
651
     #endif
768
     #endif
652
   #endif
769
   #endif
653
-  #if (TEMP_BED_PIN > -1)
770
+  #if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
654
     #if TEMP_BED_PIN < 8
771
     #if TEMP_BED_PIN < 8
655
        DIDR0 |= 1<<TEMP_BED_PIN; 
772
        DIDR0 |= 1<<TEMP_BED_PIN; 
656
     #else
773
     #else
689
 
806
 
690
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
807
 #if (EXTRUDERS > 1) && defined(HEATER_1_MINTEMP)
691
   minttemp[1] = HEATER_1_MINTEMP;
808
   minttemp[1] = HEATER_1_MINTEMP;
692
-  while(analog2temp(minttemp_raw[1], 1) > HEATER_1_MINTEMP) {
809
+  while(analog2temp(minttemp_raw[1], 1) < HEATER_1_MINTEMP) {
693
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
810
 #if HEATER_1_RAW_LO_TEMP < HEATER_1_RAW_HI_TEMP
694
     minttemp_raw[1] += OVERSAMPLENR;
811
     minttemp_raw[1] += OVERSAMPLENR;
695
 #else
812
 #else
710
 
827
 
711
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
828
 #if (EXTRUDERS > 2) && defined(HEATER_2_MINTEMP)
712
   minttemp[2] = HEATER_2_MINTEMP;
829
   minttemp[2] = HEATER_2_MINTEMP;
713
-  while(analog2temp(minttemp_raw[2], 2) > HEATER_2_MINTEMP) {
830
+  while(analog2temp(minttemp_raw[2], 2) < HEATER_2_MINTEMP) {
714
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
831
 #if HEATER_2_RAW_LO_TEMP < HEATER_2_RAW_HI_TEMP
715
     minttemp_raw[2] += OVERSAMPLENR;
832
     minttemp_raw[2] += OVERSAMPLENR;
716
 #else
833
 #else
771
   for(int i=0;i<EXTRUDERS;i++)
888
   for(int i=0;i<EXTRUDERS;i++)
772
     setTargetHotend(0,i);
889
     setTargetHotend(0,i);
773
   setTargetBed(0);
890
   setTargetBed(0);
774
-  #if TEMP_0_PIN > -1
891
+  #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
775
   target_temperature[0]=0;
892
   target_temperature[0]=0;
776
   soft_pwm[0]=0;
893
   soft_pwm[0]=0;
777
-   #if HEATER_0_PIN > -1  
894
+   #if defined(HEATER_0_PIN) && HEATER_0_PIN > -1  
778
      WRITE(HEATER_0_PIN,LOW);
895
      WRITE(HEATER_0_PIN,LOW);
779
    #endif
896
    #endif
780
   #endif
897
   #endif
781
      
898
      
782
-  #if TEMP_1_PIN > -1
899
+  #if defined(TEMP_1_PIN) && TEMP_1_PIN > -1
783
     target_temperature[1]=0;
900
     target_temperature[1]=0;
784
     soft_pwm[1]=0;
901
     soft_pwm[1]=0;
785
-    #if HEATER_1_PIN > -1 
902
+    #if defined(HEATER_1_PIN) && HEATER_1_PIN > -1 
786
       WRITE(HEATER_1_PIN,LOW);
903
       WRITE(HEATER_1_PIN,LOW);
787
     #endif
904
     #endif
788
   #endif
905
   #endif
789
       
906
       
790
-  #if TEMP_2_PIN > -1
907
+  #if defined(TEMP_2_PIN) && TEMP_2_PIN > -1
791
     target_temperature[2]=0;
908
     target_temperature[2]=0;
792
     soft_pwm[2]=0;
909
     soft_pwm[2]=0;
793
-    #if HEATER_2_PIN > -1  
910
+    #if defined(HEATER_2_PIN) && HEATER_2_PIN > -1  
794
       WRITE(HEATER_2_PIN,LOW);
911
       WRITE(HEATER_2_PIN,LOW);
795
     #endif
912
     #endif
796
   #endif 
913
   #endif 
797
 
914
 
798
-  #if TEMP_BED_PIN > -1
915
+  #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
799
     target_temperature_bed=0;
916
     target_temperature_bed=0;
800
     soft_pwm_bed=0;
917
     soft_pwm_bed=0;
801
-    #if HEATER_BED_PIN > -1  
918
+    #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1  
802
       WRITE(HEATER_BED_PIN,LOW);
919
       WRITE(HEATER_BED_PIN,LOW);
803
     #endif
920
     #endif
804
   #endif 
921
   #endif 
934
     soft_pwm_2 = soft_pwm[2];
1051
     soft_pwm_2 = soft_pwm[2];
935
     if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
1052
     if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
936
     #endif
1053
     #endif
937
-    #if HEATER_BED_PIN > -1
1054
+    #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
938
     soft_pwm_b = soft_pwm_bed;
1055
     soft_pwm_b = soft_pwm_bed;
939
     if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
1056
     if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
940
     #endif
1057
     #endif
950
   #if EXTRUDERS > 2
1067
   #if EXTRUDERS > 2
951
   if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
1068
   if(soft_pwm_2 <= pwm_count) WRITE(HEATER_2_PIN,0);
952
   #endif
1069
   #endif
953
-  #if HEATER_BED_PIN > -1
1070
+  #if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
954
   if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);
1071
   if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);
955
   #endif
1072
   #endif
956
   #ifdef FAN_SOFT_PWM
1073
   #ifdef FAN_SOFT_PWM
962
   
1079
   
963
   switch(temp_state) {
1080
   switch(temp_state) {
964
     case 0: // Prepare TEMP_0
1081
     case 0: // Prepare TEMP_0
965
-      #if (TEMP_0_PIN > -1)
1082
+      #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)
966
         #if TEMP_0_PIN > 7
1083
         #if TEMP_0_PIN > 7
967
           ADCSRB = 1<<MUX5;
1084
           ADCSRB = 1<<MUX5;
968
         #else
1085
         #else
975
       temp_state = 1;
1092
       temp_state = 1;
976
       break;
1093
       break;
977
     case 1: // Measure TEMP_0
1094
     case 1: // Measure TEMP_0
978
-      #if (TEMP_0_PIN > -1)
1095
+      #if defined(TEMP_0_PIN) && (TEMP_0_PIN > -1)
979
         raw_temp_0_value += ADC;
1096
         raw_temp_0_value += ADC;
980
       #endif
1097
       #endif
981
       #ifdef HEATER_0_USES_MAX6675 // TODO remove the blocking
1098
       #ifdef HEATER_0_USES_MAX6675 // TODO remove the blocking
984
       temp_state = 2;
1101
       temp_state = 2;
985
       break;
1102
       break;
986
     case 2: // Prepare TEMP_BED
1103
     case 2: // Prepare TEMP_BED
987
-      #if (TEMP_BED_PIN > -1)
1104
+      #if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
988
         #if TEMP_BED_PIN > 7
1105
         #if TEMP_BED_PIN > 7
989
           ADCSRB = 1<<MUX5;
1106
           ADCSRB = 1<<MUX5;
990
         #else
1107
         #else
997
       temp_state = 3;
1114
       temp_state = 3;
998
       break;
1115
       break;
999
     case 3: // Measure TEMP_BED
1116
     case 3: // Measure TEMP_BED
1000
-      #if (TEMP_BED_PIN > -1)
1117
+      #if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
1001
         raw_temp_bed_value += ADC;
1118
         raw_temp_bed_value += ADC;
1002
       #endif
1119
       #endif
1003
       temp_state = 4;
1120
       temp_state = 4;
1004
       break;
1121
       break;
1005
     case 4: // Prepare TEMP_1
1122
     case 4: // Prepare TEMP_1
1006
-      #if (TEMP_1_PIN > -1)
1123
+      #if defined(TEMP_1_PIN) && (TEMP_1_PIN > -1)
1007
         #if TEMP_1_PIN > 7
1124
         #if TEMP_1_PIN > 7
1008
           ADCSRB = 1<<MUX5;
1125
           ADCSRB = 1<<MUX5;
1009
         #else
1126
         #else
1016
       temp_state = 5;
1133
       temp_state = 5;
1017
       break;
1134
       break;
1018
     case 5: // Measure TEMP_1
1135
     case 5: // Measure TEMP_1
1019
-      #if (TEMP_1_PIN > -1)
1136
+      #if defined(TEMP_1_PIN) && (TEMP_1_PIN > -1)
1020
         raw_temp_1_value += ADC;
1137
         raw_temp_1_value += ADC;
1021
       #endif
1138
       #endif
1022
       temp_state = 6;
1139
       temp_state = 6;
1023
       break;
1140
       break;
1024
     case 6: // Prepare TEMP_2
1141
     case 6: // Prepare TEMP_2
1025
-      #if (TEMP_2_PIN > -1)
1142
+      #if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1)
1026
         #if TEMP_2_PIN > 7
1143
         #if TEMP_2_PIN > 7
1027
           ADCSRB = 1<<MUX5;
1144
           ADCSRB = 1<<MUX5;
1028
         #else
1145
         #else
1035
       temp_state = 7;
1152
       temp_state = 7;
1036
       break;
1153
       break;
1037
     case 7: // Measure TEMP_2
1154
     case 7: // Measure TEMP_2
1038
-      #if (TEMP_2_PIN > -1)
1155
+      #if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1)
1039
         raw_temp_2_value += ADC;
1156
         raw_temp_2_value += ADC;
1040
       #endif
1157
       #endif
1041
       temp_state = 0;
1158
       temp_state = 0;
1055
 #if EXTRUDERS > 1
1172
 #if EXTRUDERS > 1
1056
       current_temperature_raw[1] = raw_temp_1_value;
1173
       current_temperature_raw[1] = raw_temp_1_value;
1057
 #endif
1174
 #endif
1175
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
1176
+      redundant_temperature_raw = raw_temp_1_value;
1177
+#endif
1058
 #if EXTRUDERS > 2
1178
 #if EXTRUDERS > 2
1059
       current_temperature_raw[2] = raw_temp_2_value;
1179
       current_temperature_raw[2] = raw_temp_2_value;
1060
 #endif
1180
 #endif

+ 3
- 0
Marlin/temperature.h 파일 보기

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

+ 156
- 33
Marlin/ultralcd.cpp 파일 보기

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
+#define ENCODER_FEEDRATE_DEADZONE 10
80
+
81
+#if !defined(LCD_I2C_VIKI)
82
+  #define ENCODER_STEPS_PER_MENU_ITEM 5
83
+#else
84
+  #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
85
+#endif
86
+
80
 
87
 
81
 /* Helper macros for menus */
88
 /* Helper macros for menus */
82
 #define START_MENU() do { \
89
 #define START_MENU() do { \
112
     } } while(0)
119
     } } while(0)
113
 
120
 
114
 /** Used variables to keep track of the menu */
121
 /** Used variables to keep track of the menu */
122
+#ifndef REPRAPWORLD_KEYPAD
115
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
123
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
124
+#else
125
+volatile uint16_t buttons;//Contains the bits of the currently pressed buttons (extended).
126
+#endif
116
 
127
 
117
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
128
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
118
 uint32_t blocking_enc;
129
 uint32_t blocking_enc;
119
 uint8_t lastEncoderBits;
130
 uint8_t lastEncoderBits;
120
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
131
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
121
 uint32_t encoderPosition;
132
 uint32_t encoderPosition;
122
-#if (SDCARDDETECT > -1)
133
+#if (SDCARDDETECT > 0)
123
 bool lcd_oldcardstatus;
134
 bool lcd_oldcardstatus;
124
 #endif
135
 #endif
125
 #endif//ULTIPANEL
136
 #endif//ULTIPANEL
157
     if (LCD_CLICKED)
168
     if (LCD_CLICKED)
158
     {
169
     {
159
         currentMenu = lcd_main_menu;
170
         currentMenu = lcd_main_menu;
171
+        encoderPosition = 0;
160
         lcd_quick_feedback();
172
         lcd_quick_feedback();
161
     }
173
     }
162
-    feedmultiply += int(encoderPosition);
163
-    encoderPosition = 0;
174
+
175
+    // Dead zone at 100% feedrate
176
+    if (feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100 ||
177
+            feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)
178
+    {
179
+        encoderPosition = 0;
180
+        feedmultiply = 100;
181
+    }
182
+
183
+    if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
184
+    {
185
+        feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
186
+        encoderPosition = 0;
187
+    }
188
+    else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
189
+    {
190
+        feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
191
+        encoderPosition = 0;	
192
+    }
193
+    else if (feedmultiply != 100)
194
+    {
195
+        feedmultiply += int(encoderPosition);
196
+        encoderPosition = 0;
197
+    }
198
+
164
     if (feedmultiply < 10)
199
     if (feedmultiply < 10)
165
         feedmultiply = 10;
200
         feedmultiply = 10;
166
     if (feedmultiply > 999)
201
     if (feedmultiply > 999)
221
         }else{
256
         }else{
222
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
257
             MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
223
 #if SDCARDDETECT < 1
258
 #if SDCARDDETECT < 1
224
-			MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));	// SD-card changed by user
225
-#endif			
259
+            MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
260
+#endif
226
         }
261
         }
227
     }else{
262
     }else{
228
         MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
263
         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		
264
+#if SDCARDDETECT < 1
265
+        MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
266
+#endif
232
     }
267
     }
233
 #endif
268
 #endif
234
     END_MENU();
269
     END_MENU();
251
     setTargetBed(plaPreheatHPBTemp);
286
     setTargetBed(plaPreheatHPBTemp);
252
     fanSpeed = plaPreheatFanSpeed;
287
     fanSpeed = plaPreheatFanSpeed;
253
     lcd_return_to_status();
288
     lcd_return_to_status();
289
+    setWatch(); // heater sanity check timer
254
 }
290
 }
255
 
291
 
256
 void lcd_preheat_abs()
292
 void lcd_preheat_abs()
261
     setTargetBed(absPreheatHPBTemp);
297
     setTargetBed(absPreheatHPBTemp);
262
     fanSpeed = absPreheatFanSpeed;
298
     fanSpeed = absPreheatFanSpeed;
263
     lcd_return_to_status();
299
     lcd_return_to_status();
300
+    setWatch(); // heater sanity check timer
301
+}
302
+
303
+static void lcd_cooldown()
304
+{
305
+    setTargetHotend0(0);
306
+    setTargetHotend1(0);
307
+    setTargetHotend2(0);
308
+    setTargetBed(0);
309
+    lcd_return_to_status();
264
 }
310
 }
265
 
311
 
266
 static void lcd_tune_menu()
312
 static void lcd_tune_menu()
298
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
344
     //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
299
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
345
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
300
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
346
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
301
-    MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
347
+    MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
302
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
348
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
303
     END_MENU();
349
     END_MENU();
304
 }
350
 }
459
 
505
 
460
 static void lcd_control_temperature_menu()
506
 static void lcd_control_temperature_menu()
461
 {
507
 {
462
-	// set up temp variables - undo the default scaling
463
-	raw_Ki = unscalePID_i(Ki);
464
-	raw_Kd = unscalePID_d(Kd);
465
-	
508
+    // set up temp variables - undo the default scaling
509
+    raw_Ki = unscalePID_i(Ki);
510
+    raw_Kd = unscalePID_d(Kd);
511
+
466
     START_MENU();
512
     START_MENU();
467
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
513
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
468
     MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
514
     MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
484
 #endif
530
 #endif
485
 #ifdef PIDTEMP
531
 #ifdef PIDTEMP
486
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
532
     MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
487
-	// i is typically a small value so allows values below 1
533
+    // 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);
534
     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);
535
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
490
 # ifdef PID_ADD_EXTRUSION_RATE
536
 # ifdef PID_ADD_EXTRUSION_RATE
687
 menu_edit_type(float, float52, ftostr52, 100)
733
 menu_edit_type(float, float52, ftostr52, 100)
688
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
734
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
689
 
735
 
736
+#ifdef REPRAPWORLD_KEYPAD
737
+    static void reprapworld_keypad_move_y_down() {
738
+        encoderPosition = 1;
739
+        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
740
+        lcd_move_y();
741
+    }
742
+    static void reprapworld_keypad_move_y_up() {
743
+        encoderPosition = -1;
744
+        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
745
+        lcd_move_y();
746
+    }
747
+    static void reprapworld_keypad_move_home() {
748
+        //enquecommand_P((PSTR("G28"))); // move all axis home
749
+        // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
750
+        enquecommand_P((PSTR("G28 Y")));
751
+    }
752
+#endif
753
+
690
 /** End of menus **/
754
 /** End of menus **/
691
 
755
 
692
 static void lcd_quick_feedback()
756
 static void lcd_quick_feedback()
745
 #ifdef NEWPANEL
809
 #ifdef NEWPANEL
746
     pinMode(BTN_EN1,INPUT);
810
     pinMode(BTN_EN1,INPUT);
747
     pinMode(BTN_EN2,INPUT); 
811
     pinMode(BTN_EN2,INPUT); 
748
-    pinMode(BTN_ENC,INPUT); 
749
     pinMode(SDCARDDETECT,INPUT);
812
     pinMode(SDCARDDETECT,INPUT);
750
     WRITE(BTN_EN1,HIGH);
813
     WRITE(BTN_EN1,HIGH);
751
     WRITE(BTN_EN2,HIGH);
814
     WRITE(BTN_EN2,HIGH);
815
+  #if BTN_ENC > 0
816
+    pinMode(BTN_ENC,INPUT); 
752
     WRITE(BTN_ENC,HIGH);
817
     WRITE(BTN_ENC,HIGH);
818
+  #endif    
819
+  #ifdef REPRAPWORLD_KEYPAD
820
+    pinMode(SHIFT_CLK,OUTPUT);
821
+    pinMode(SHIFT_LD,OUTPUT);
822
+    pinMode(SHIFT_OUT,INPUT);
823
+    WRITE(SHIFT_OUT,HIGH);
824
+    WRITE(SHIFT_LD,HIGH);
825
+  #endif
753
 #else
826
 #else
754
     pinMode(SHIFT_CLK,OUTPUT);
827
     pinMode(SHIFT_CLK,OUTPUT);
755
     pinMode(SHIFT_LD,OUTPUT);
828
     pinMode(SHIFT_LD,OUTPUT);
759
     WRITE(SHIFT_LD,HIGH); 
832
     WRITE(SHIFT_LD,HIGH); 
760
     WRITE(SHIFT_EN,LOW);
833
     WRITE(SHIFT_EN,LOW);
761
 #endif//!NEWPANEL
834
 #endif//!NEWPANEL
762
-#if (SDCARDDETECT > -1)
835
+#if (SDCARDDETECT > 0)
763
     WRITE(SDCARDDETECT, HIGH);
836
     WRITE(SDCARDDETECT, HIGH);
764
     lcd_oldcardstatus = IS_SD_INSERTED;
837
     lcd_oldcardstatus = IS_SD_INSERTED;
765
-#endif//(SDCARDDETECT > -1)
838
+#endif//(SDCARDDETECT > 0)
766
     lcd_buttons_update();
839
     lcd_buttons_update();
840
+#ifdef ULTIPANEL    
767
     encoderDiff = 0;
841
     encoderDiff = 0;
842
+#endif    
768
 }
843
 }
769
 
844
 
770
 void lcd_update()
845
 void lcd_update()
773
     
848
     
774
     lcd_buttons_update();
849
     lcd_buttons_update();
775
     
850
     
776
-    #if (SDCARDDETECT > -1)
851
+    #ifdef LCD_HAS_SLOW_BUTTONS
852
+    buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
853
+    #endif
854
+    
855
+    #if (SDCARDDETECT > 0)
777
     if((IS_SD_INSERTED != lcd_oldcardstatus))
856
     if((IS_SD_INSERTED != lcd_oldcardstatus))
778
     {
857
     {
779
         lcdDrawUpdate = 2;
858
         lcdDrawUpdate = 2;
796
     if (lcd_next_update_millis < millis())
875
     if (lcd_next_update_millis < millis())
797
     {
876
     {
798
 #ifdef ULTIPANEL
877
 #ifdef ULTIPANEL
878
+        #ifdef REPRAPWORLD_KEYPAD
879
+        if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
880
+            reprapworld_keypad_move_y_down();
881
+        }
882
+        if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
883
+            reprapworld_keypad_move_y_up();
884
+        }
885
+        if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
886
+            reprapworld_keypad_move_home();
887
+        }
888
+        #endif
799
         if (encoderDiff)
889
         if (encoderDiff)
800
         {
890
         {
801
             lcdDrawUpdate = 1;
891
             lcdDrawUpdate = 1;
808
 #endif//ULTIPANEL
898
 #endif//ULTIPANEL
809
 
899
 
810
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
900
 #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() );
901
+        blink++;     // Variable for fan animation and alive dot
902
+        u8g.firstPage();
903
+        do 
904
+        {
905
+            u8g.setFont(u8g_font_6x10_marlin);
906
+            u8g.setPrintPos(125,0);
907
+            if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
908
+            u8g.drawPixel(127,63); // draw alive dot
909
+            u8g.setColorIndex(1); // black on white
910
+            (*currentMenu)();
911
+            if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
912
+        } while( u8g.nextPage() );
822
 #else        
913
 #else        
823
         (*currentMenu)();
914
         (*currentMenu)();
824
 #endif
915
 #endif
825
 
916
 
917
+#ifdef LCD_HAS_STATUS_INDICATORS
918
+        lcd_implementation_update_indicators();
919
+#endif
920
+
826
 #ifdef ULTIPANEL
921
 #ifdef ULTIPANEL
827
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
922
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
828
         {
923
         {
873
     uint8_t newbutton=0;
968
     uint8_t newbutton=0;
874
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
969
     if(READ(BTN_EN1)==0)  newbutton|=EN_A;
875
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
970
     if(READ(BTN_EN2)==0)  newbutton|=EN_B;
971
+  #if BTN_ENC > 0
876
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
972
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
877
         newbutton |= EN_C;
973
         newbutton |= EN_C;
974
+  #endif      
975
+  #ifdef REPRAPWORLD_KEYPAD
976
+    // for the reprapworld_keypad
977
+    uint8_t newbutton_reprapworld_keypad=0;
978
+    WRITE(SHIFT_LD,LOW);
979
+    WRITE(SHIFT_LD,HIGH);
980
+    for(int8_t i=0;i<8;i++) {
981
+        newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
982
+        if(READ(SHIFT_OUT))
983
+            newbutton_reprapworld_keypad|=(1<<7);
984
+        WRITE(SHIFT_CLK,HIGH);
985
+        WRITE(SHIFT_CLK,LOW);
986
+    }
987
+    newbutton |= ((~newbutton_reprapworld_keypad) << REPRAPWORLD_BTN_OFFSET); //invert it, because a pressed switch produces a logical 0
988
+  #endif
878
     buttons = newbutton;
989
     buttons = newbutton;
879
 #else   //read it from the shift register
990
 #else   //read it from the shift register
880
     uint8_t newbutton=0;
991
     uint8_t newbutton=0;
930
     }
1041
     }
931
     lastEncoderBits = enc;
1042
     lastEncoderBits = enc;
932
 }
1043
 }
1044
+
1045
+void lcd_buzz(long duration, uint16_t freq)
1046
+{ 
1047
+#ifdef LCD_USE_I2C_BUZZER
1048
+  lcd.buzz(duration,freq);
1049
+#endif   
1050
+}
1051
+
1052
+bool lcd_clicked() 
1053
+{ 
1054
+  return LCD_CLICKED;
1055
+}
933
 #endif//ULTIPANEL
1056
 #endif//ULTIPANEL
934
 
1057
 
935
 /********************************/
1058
 /********************************/
1131
 {
1254
 {
1132
   Ki = scalePID_i(raw_Ki);
1255
   Ki = scalePID_i(raw_Ki);
1133
   updatePID();
1256
   updatePID();
1134
-}	
1257
+}
1135
 
1258
 
1136
 // Callback for after editing PID d value
1259
 // 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
1260
 // grab the pid d value out of the temp variable; scale it; then update the PID driver
1139
 {
1262
 {
1140
   Kd = scalePID_d(raw_Kd);
1263
   Kd = scalePID_d(raw_Kd);
1141
   updatePID();
1264
   updatePID();
1142
-}	
1143
-	
1265
+}
1266
+
1144
 #endif //ULTRA_LCD
1267
 #endif //ULTRA_LCD

+ 3
- 20
Marlin/ultralcd.h 파일 보기

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) 

+ 259
- 26
Marlin/ultralcd_implementation_hitachi_HD44780.h 파일 보기

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

+ 131
- 0
Marlin/ultralcd_st7920_u8glib_rrd.h 파일 보기

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

+ 98
- 72
README.md 파일 보기

1
-WARNING: 
2
---------
3
-THIS IS RELEASE CANDIDATE 2 FOR MARLIN 1.0.0
1
+==========================
2
+Marlin 3D Printer Firmware
3
+==========================
4
 
4
 
5
-The configuration is now split in two files
6
-Configuration.h for the normal settings
7
-Configuration_adv.h for the advanced settings
8
-
9
-Gen7T is not supported.
5
+[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/ErikZalm/Marlin&title=Marlin&language=&tags=github&category=software)
10
 
6
 
11
 Quick Information
7
 Quick Information
12
 ===================
8
 ===================
46
 *   PID tuning
42
 *   PID tuning
47
 *   CoreXY kinematics (www.corexy.com/theory.html)
43
 *   CoreXY kinematics (www.corexy.com/theory.html)
48
 *   Configurable serial port to support connection of wireless adaptors.
44
 *   Configurable serial port to support connection of wireless adaptors.
45
+*   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
49
 
46
 
50
 The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
47
 The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
51
 
48
 
129
 An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
126
 An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
130
 This leads to less blocking in the heater management routine.
127
 This leads to less blocking in the heater management routine.
131
 
128
 
129
+Implemented G Codes:
130
+====================
131
+
132
+*  G0  -> G1
133
+*  G1  - Coordinated Movement X Y Z E
134
+*  G2  - CW ARC
135
+*  G3  - CCW ARC
136
+*  G4  - Dwell S<seconds> or P<milliseconds>
137
+*  G10 - retract filament according to settings of M207
138
+*  G11 - retract recover filament according to settings of M208
139
+*  G28 - Home all Axis
140
+*  G90 - Use Absolute Coordinates
141
+*  G91 - Use Relative Coordinates
142
+*  G92 - Set current position to cordinates given
143
+
144
+RepRap M Codes
145
+*  M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
146
+*  M1   - Same as M0
147
+*  M104 - Set extruder target temp
148
+*  M105 - Read current temp
149
+*  M106 - Fan on
150
+*  M107 - Fan off
151
+*  M109 - Wait for extruder current temp to reach target temp.
152
+*  M114 - Display current position
153
+
154
+Custom M Codes
155
+*  M17  - Enable/Power all stepper motors
156
+*  M18  - Disable all stepper motors; same as M84
157
+*  M20  - List SD card
158
+*  M21  - Init SD card
159
+*  M22  - Release SD card
160
+*  M23  - Select SD file (M23 filename.g)
161
+*  M24  - Start/resume SD print
162
+*  M25  - Pause SD print
163
+*  M26  - Set SD position in bytes (M26 S12345)
164
+*  M27  - Report SD print status
165
+*  M28  - Start SD write (M28 filename.g)
166
+*  M29  - Stop SD write
167
+*  M30  - Delete file from SD (M30 filename.g)
168
+*  M31  - Output time since last M109 or SD card start to serial
169
+*  M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
170
+*  M80  - Turn on Power Supply
171
+*  M81  - Turn off Power Supply
172
+*  M82  - Set E codes absolute (default)
173
+*  M83  - Set E codes relative while in Absolute Coordinates (G90) mode
174
+*  M84  - Disable steppers until next move, or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled.  S0 to disable the timeout.
175
+*  M85  - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
176
+*  M92  - Set axis_steps_per_unit - same syntax as G92
177
+*  M114 - Output current position to serial port
178
+*  M115 - Capabilities string
179
+*  M117 - display message
180
+*  M119 - Output Endstop status to serial port
181
+*  M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
182
+*  M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
183
+*  M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
184
+*  M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
185
+*  M140 - Set bed target temp
186
+*  M190 - Wait for bed current temp to reach target temp.
187
+*  M200 - Set filament diameter
188
+*  M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
189
+*  M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
190
+*  M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
191
+*  M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
192
+*  M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk
193
+*  M206 - set additional homeing offset
194
+*  M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
195
+*  M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
196
+*  M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
197
+*  M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
198
+*  M220 S<factor in percent>- set speed factor override percentage
199
+*  M221 S<factor in percent>- set extrude factor override percentage
200
+*  M240 - Trigger a camera to take a photograph
201
+*  M280 - set servo position absolute. P: servo index, S: angle or microseconds
202
+*  M300 - Play beepsound S<frequency Hz> P<duration ms>
203
+*  M301 - Set PID parameters P I and D
204
+*  M302 - Allow cold extrudes
205
+*  M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
206
+*  M304 - Set bed PID parameters P I and D
207
+*  M400 - Finish all moves
208
+*  M500 - stores paramters in EEPROM
209
+*  M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
210
+*  M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
211
+*  M503 - print the current settings (from memory not from eeprom)
212
+*  M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
213
+*  M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
214
+*  M907 - Set digital trimpot motor current using axis codes.
215
+*  M908 - Control digital trimpot directly.
216
+*  M350 - Set microstepping mode.
217
+*  M351 - Toggle MS1 MS2 pins directly.
218
+*  M928 - Start SD logging (M928 filename.g) - ended by M29
219
+*  M999 - Restart after being stopped by error
132
 
220
 
133
-Non-standard M-Codes, different to an old version of sprinter:
134
-==============================================================
135
-Movement:
136
-
137
-*   G2  - CW ARC
138
-*   G3  - CCW ARC
139
-
140
-General:
141
-
142
-*   M17  - Enable/Power all stepper motors. Compatibility to ReplicatorG.
143
-*   M18  - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
144
-*   M30  - Print time since last M109 or SD card start to serial
145
-*   M42  - Change pin status via gcode
146
-*   M80  - Turn on Power Supply
147
-*   M81  - Turn off Power Supply
148
-*   M114 - Output current position to serial port 
149
-*   M119 - Output Endstop status to serial port
150
-
151
-Movement variables:
152
-
153
-*   M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
154
-*   M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
155
-*   M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
156
-*   M206 - set home offsets.  This sets the X,Y,Z coordinates of the endstops (and is added to the {X,Y,Z}_HOME_POS configuration options (and is also added to the coordinates, if any, provided to G82, as with earlier firmware)
157
-*   M220 - set build speed mulitplying S:factor in percent ; aka "realtime tuneing in the gcode". So you can slow down if you have islands in one height-range, and speed up otherwise.
158
-*   M221 - set the extrude multiplying S:factor in percent
159
-*   M400 - Finish all buffered moves.
160
-
161
-Temperature variables:
162
-*   M301 - Set PID parameters P I and D
163
-*   M302 - Allow cold extrudes
164
-*   M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
165
-
166
-Advance:
167
-
168
-*   M200 - Set filament diameter for advance
169
-*   M205 - advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
170
-
171
-EEPROM:
172
-
173
-*   M500 - stores paramters in EEPROM. This parameters are stored:  axis_steps_per_unit,  max_feedrate, max_acceleration  ,acceleration,retract_acceleration,
174
-  minimumfeedrate,mintravelfeedrate,minsegmenttime,  jerk velocities, PID
175
-*   M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
176
-*   M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
177
-*   M503 - print the current settings (from memory not from eeprom)
178
-
179
-MISC:
180
-
181
-*   M240 - Trigger a camera to take a photograph
182
-*   M999 - Restart after being stopped by error
183
 
221
 
184
 Configuring and compilation:
222
 Configuring and compilation:
185
 ============================
223
 ============================
190
 For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
228
 For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
191
   copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
229
   copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
192
 
230
 
193
-Install Ultimaker's RepG 25 build
194
-    http://software.ultimaker.com
195
-For SD handling and as better substitute (apart from stl manipulation) download
196
-the very nice Kliment's printrun/pronterface  https://github.com/kliment/Printrun
197
-
198
-Copy the Ultimaker Marlin firmware
231
+Copy the Marlin firmware
199
    https://github.com/ErikZalm/Marlin/tree/Marlin_v1
232
    https://github.com/ErikZalm/Marlin/tree/Marlin_v1
200
    (Use the download button)
233
    (Use the download button)
201
 
234
 
209
 Click the Upload button
242
 Click the Upload button
210
 If all goes well the firmware is uploading
243
 If all goes well the firmware is uploading
211
 
244
 
212
-Start Ultimaker's Custom RepG 25
213
-Make sure Show Experimental Profiles is enabled in Preferences
214
-Select Sprinter as the Driver
215
-
216
-Press the Connect button.
217
-
218
-KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
219
-
220
 That's ok.  Enjoy Silky Smooth Printing.
245
 That's ok.  Enjoy Silky Smooth Printing.
221
 
246
 
222
 
247
 
223
 
248
 
249
+

Loading…
취소
저장