Ver código fonte

merge from the branch bkubicek/Marlin/zalmmerge

Bernhard Kubicek 13 anos atrás
pai
commit
00674af3a8
20 arquivos alterados com 4067 adições e 3869 exclusões
  1. 243
    220
      Marlin/Configuration.h
  2. 129
    123
      Marlin/EEPROMwrite.h
  3. 314
    268
      Marlin/Makefile
  4. 82
    83
      Marlin/Marlin.h
  5. 1233
    1233
      Marlin/Marlin.pde
  6. 5
    5
      Marlin/fastio.h
  7. 0
    10
      Marlin/lcd.h
  8. 0
    1
      Marlin/lcd.pde
  9. 10
    8
      Marlin/planner.cpp
  10. 92
    90
      Marlin/planner.h
  11. 1
    1
      Marlin/stepper.cpp
  12. 44
    40
      Marlin/stepper.h
  13. 16
    13
      Marlin/temperature.cpp
  14. 58
    55
      Marlin/temperature.h
  15. 90
    90
      Marlin/thermistortables.h
  16. 1
    1
      Marlin/ultralcd.h
  17. 1593
    1593
      Marlin/ultralcd.pde
  18. 29
    35
      README
  19. 69
    0
      README.md
  20. 58
    0
      merging still needs.txt

+ 243
- 220
Marlin/Configuration.h Ver arquivo

@@ -1,220 +1,243 @@
1
-#ifndef CONFIGURATION_H
2
-#define CONFIGURATION_H
3
-
4
-//#define DEBUG_STEPS
5
-
6
-// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
7
-
8
-//// The following define selects which electronics board you have. Please choose the one that matches your setup
9
-// MEGA/RAMPS up to 1.2 = 3,
10
-// RAMPS 1.3 = 33
11
-// Gen6 = 5,
12
-// Sanguinololu 1.2 and above = 62
13
-// Ultimaker = 7,
14
-#define MOTHERBOARD 7
15
-//#define MOTHERBOARD 5
16
-
17
-
18
-//// Thermistor settings:
19
-// 1 is 100k thermistor
20
-// 2 is 200k thermistor
21
-// 3 is mendel-parts thermistor
22
-// 4 is 10k thermistor
23
-// 5 is ParCan supplied 104GT-2 100K
24
-// 6 is EPCOS 100k
25
-// 7 is 100k Honeywell thermistor 135-104LAG-J01
26
-#define THERMISTORHEATER_1 3
27
-#define THERMISTORHEATER_2 3
28
-#define THERMISTORBED 3
29
-
30
-//#define HEATER_1_USES_THERMISTOR
31
-//#define HEATER_2_USES_THERMISTOR
32
-#define HEATER_1_USES_AD595
33
-//#define HEATER_2_USES_AD595
34
-
35
-// Select one of these only to define how the bed temp is read.
36
-//#define BED_USES_THERMISTOR
37
-//#define BED_USES_AD595
38
-
39
-#define HEATER_CHECK_INTERVAL 50
40
-#define BED_CHECK_INTERVAL 5000
41
-
42
-
43
-//// Endstop Settings
44
-#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
45
-// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
46
-const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
47
-// For optos H21LOB set to true, for Mendel-Parts newer optos TCST2103 set to false
48
-
49
-// This determines the communication speed of the printer
50
-//#define BAUDRATE 250000
51
-#define BAUDRATE 115200
52
-//#define BAUDRATE 230400
53
-
54
-// Comment out (using // at the start of the line) to disable SD support:
55
-
56
-// #define ULTRA_LCD  //any lcd 
57
-#define LCD_WIDTH 16
58
-#define LCD_HEIGHT 2
59
-
60
-//#define ULTIPANEL
61
-#ifdef ULTIPANEL
62
- //#define NEWPANEL  //enable this if you have a click-encoder panel
63
- #define SDSUPPORT
64
- #define ULTRA_LCD
65
- #define LCD_WIDTH 20
66
-#define LCD_HEIGHT 4
67
-#endif
68
-
69
-
70
-//#define SDSUPPORT // Enable SD Card Support in Hardware Console
71
-
72
-
73
-
74
-const int dropsegments=5; //everything with this number of steps  will be ignored as move
75
-
76
-//// ADVANCED SETTINGS - to tweak parameters
77
-
78
-#include "thermistortables.h"
79
-
80
-// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
81
-#define X_ENABLE_ON 0
82
-#define Y_ENABLE_ON 0
83
-#define Z_ENABLE_ON 0
84
-#define E_ENABLE_ON 0
85
-
86
-// Disables axis when it's not being used.
87
-#define DISABLE_X false
88
-#define DISABLE_Y false
89
-#define DISABLE_Z false
90
-#define DISABLE_E false
91
-
92
-// Inverting axis direction
93
-#define INVERT_X_DIR true    // for Mendel set to false, for Orca set to true
94
-#define INVERT_Y_DIR false   // for Mendel set to true, for Orca set to false
95
-#define INVERT_Z_DIR true    // for Mendel set to false, for Orca set to true
96
-#define INVERT_E_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
97
-
98
-//// ENDSTOP SETTINGS:
99
-// Sets direction of endstops when homing; 1=MAX, -1=MIN
100
-#define X_HOME_DIR -1
101
-#define Y_HOME_DIR -1
102
-#define Z_HOME_DIR -1
103
-
104
-#define min_software_endstops false //If true, axis won't move to coordinates less than zero.
105
-#define max_software_endstops false  //If true, axis won't move to coordinates greater than the defined lengths below.
106
-#define X_MAX_LENGTH 210
107
-#define Y_MAX_LENGTH 210
108
-#define Z_MAX_LENGTH 210
109
-
110
-//// MOVEMENT SETTINGS
111
-#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
112
-//note: on bernhards ultimaker 200 200 12 are working well.
113
-#define HOMING_FEEDRATE {50*60, 50*60, 12*60, 0}  // set the homing speeds
114
-//the followint checks if an extrusion is existent in the move. if _not_, the speed of the move is set to the maximum speed. 
115
-//!!!!!!Use only if you know that your printer works at the maximum declared speeds.
116
-// works around the skeinforge cool-bug. There all moves are slowed to have a minimum layer time. However slow travel moves= ooze
117
-#define TRAVELING_AT_MAXSPEED  
118
-#define AXIS_RELATIVE_MODES {false, false, false, false}
119
-
120
-#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
121
-
122
-// default settings 
123
-
124
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {79.87220447,79.87220447,200*8/3,14}                    // default steps per unit for ultimaker 
125
-#define DEFAULT_MAX_FEEDRATE          {160*60, 160*60, 10*60, 500000}        
126
-#define DEFAULT_MAX_ACCELERATION      {9000,9000,150,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.
127
-
128
-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
129
-#define DEFAULT_RETRACT_ACCELERATION  7000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
130
-
131
-#define DEFAULT_MINIMUMFEEDRATE       10     // minimum feedrate
132
-#define DEFAULT_MINTRAVELFEEDRATE     10
133
-
134
-// minimum time in microseconds that a movement needs to take if the buffer is emptied.   Increase this number if you see blobs while printing high speed & high detail.  It will slowdown on the detailed stuff.
135
-#define DEFAULT_MINSEGMENTTIME        20000
136
-#define DEFAULT_XYJERK                30.0*60    
137
-#define DEFAULT_ZJERK                 10.0*60
138
-
139
-
140
-// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
141
-//this enables the watchdog interrupt.
142
-#define USE_WATCHDOG
143
-//you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
144
-#define RESET_MANUAL
145
-
146
-#define WATCHDOG_TIMEOUT 4
147
-
148
-
149
-
150
-//// Experimental watchdog and minimal temp
151
-// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
152
-// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
153
-//#define WATCHPERIOD 5000 //5 seconds
154
-
155
-// Actual temperature must be close to target for this long before M109 returns success
156
-//#define TEMP_RESIDENCY_TIME 20  // (seconds)
157
-//#define TEMP_HYSTERESIS 5       // (C°) range of +/- temperatures considered "close" to the target one
158
-
159
-//// The minimal temperature defines the temperature below which the heater will not be enabled
160
-#define MINTEMP 5
161
-#define BED_MINTEMP 5
162
-
163
-
164
-// When temperature exceeds max temp, your heater will be switched off.
165
-// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
166
-// You should use MINTEMP for thermistor short/failure protection.
167
-#define MAXTEMP 275
168
-#define BED_MAXTEMP 150
169
-
170
-/// PID settings:
171
-// Uncomment the following line to enable PID support.
172
-//#define SMOOTHING
173
-//#define SMOOTHFACTOR 5.0
174
-//float current_raw_average=0;
175
-
176
-#define PIDTEMP
177
-#ifdef PIDTEMP
178
-//#define PID_DEBUG // Sends debug data to the serial port. 
179
-//#define PID_OPENLOOP 1 // Puts PID in open loop. M104 sets the output power in %
180
-#define PID_MAX 255 // limits current to nozzle
181
-#define PID_INTEGRAL_DRIVE_MAX 255
182
-#define PID_dT 0.10 // 100ms sample time
183
-#define DEFAULT_Kp 20.0
184
-#define DEFAULT_Ki 1.5*PID_dT
185
-#define DEFAULT_Kd 80/PID_dT
186
-#define DEFAULT_Kc 0
187
-#endif // PIDTEMP
188
-
189
-
190
-// extruder advance constant (s2/mm3)
191
-//
192
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
193
-//
194
-// hooke's law says:		force = k * distance
195
-// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
196
-// so: v ^ 2 is proportional to number of steps we advance the extruder
197
-//#define ADVANCE
198
-
199
-#ifdef ADVANCE
200
-#define EXTRUDER_ADVANCE_K .3
201
-
202
-#define D_FILAMENT 1.7
203
-#define STEPS_MM_E 65
204
-#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
205
-#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
206
-
207
-#endif // ADVANCE
208
-
209
-#if defined SDSUPPORT
210
-// The number of linear motions that can be in the plan at any give time.  
211
-  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
212
-#else
213
-  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
214
-#endif
215
-
216
-#ifdef SIMPLE_LCD
217
-  #define BLOCK_BUFFER_SIZE 16 // A little less buffer for just a simple LCD
218
-#endif
219
-
220
-#endif
1
+#ifndef CONFIGURATION_H
2
+#define CONFIGURATION_H
3
+
4
+//#define DEBUG_STEPS
5
+
6
+// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
7
+
8
+//// The following define selects which electronics board you have. Please choose the one that matches your setup
9
+// MEGA/RAMPS up to 1.2 = 3,
10
+// RAMPS 1.3 = 33
11
+// Gen6 = 5,
12
+// Sanguinololu 1.2 and above = 62
13
+// Ultimaker = 7,
14
+#define MOTHERBOARD 7
15
+//#define MOTHERBOARD 5
16
+
17
+
18
+//// Thermistor settings:
19
+// 1 is 100k thermistor
20
+// 2 is 200k thermistor
21
+// 3 is mendel-parts thermistor
22
+// 4 is 10k thermistor
23
+// 5 is ParCan supplied 104GT-2 100K
24
+// 6 is EPCOS 100k
25
+// 7 is 100k Honeywell thermistor 135-104LAG-J01
26
+#define THERMISTORHEATER_1 3
27
+#define THERMISTORHEATER_2 3
28
+#define THERMISTORBED 3
29
+
30
+//#define HEATER_1_USES_THERMISTOR
31
+//#define HEATER_2_USES_THERMISTOR
32
+#define HEATER_1_USES_AD595
33
+//#define HEATER_2_USES_AD595
34
+
35
+// Select one of these only to define how the bed temp is read.
36
+//#define BED_USES_THERMISTOR
37
+//#define BED_USES_AD595
38
+
39
+#define HEATER_CHECK_INTERVAL 50
40
+#define BED_CHECK_INTERVAL 5000
41
+
42
+
43
+//// Endstop Settings
44
+#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
45
+// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
46
+const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
47
+// For optos H21LOB set to true, for Mendel-Parts newer optos TCST2103 set to false
48
+
49
+// This determines the communication speed of the printer
50
+//#define BAUDRATE 250000
51
+#define BAUDRATE 115200
52
+//#define BAUDRATE 230400
53
+
54
+// Comment out (using // at the start of the line) to disable SD support:
55
+
56
+// #define ULTRA_LCD  //any lcd 
57
+
58
+
59
+#define ULTIPANEL
60
+#ifdef ULTIPANEL
61
+ //#define NEWPANEL  //enable this if you have a click-encoder panel
62
+ #define SDSUPPORT
63
+ #define ULTRA_LCD
64
+ #define LCD_WIDTH 20
65
+#define LCD_HEIGHT 4
66
+#else //no panel but just lcd 
67
+  #ifdef ULTRA_LCD
68
+    #define LCD_WIDTH 16
69
+    #define LCD_HEIGHT 2
70
+  #endif
71
+#endif
72
+
73
+
74
+//#define SDSUPPORT // Enable SD Card Support in Hardware Console
75
+
76
+
77
+
78
+const int dropsegments=5; //everything with this number of steps  will be ignored as move
79
+
80
+//// ADVANCED SETTINGS - to tweak parameters
81
+
82
+#include "thermistortables.h"
83
+
84
+// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
85
+#define X_ENABLE_ON 0
86
+#define Y_ENABLE_ON 0
87
+#define Z_ENABLE_ON 0
88
+#define E_ENABLE_ON 0
89
+
90
+// Disables axis when it's not being used.
91
+#define DISABLE_X false
92
+#define DISABLE_Y false
93
+#define DISABLE_Z false
94
+#define DISABLE_E false
95
+
96
+// Inverting axis direction
97
+#define INVERT_X_DIR true    // for Mendel set to false, for Orca set to true
98
+#define INVERT_Y_DIR false   // for Mendel set to true, for Orca set to false
99
+#define INVERT_Z_DIR true    // for Mendel set to false, for Orca set to true
100
+#define INVERT_E_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
101
+
102
+//// ENDSTOP SETTINGS:
103
+// Sets direction of endstops when homing; 1=MAX, -1=MIN
104
+#define X_HOME_DIR -1
105
+#define Y_HOME_DIR -1
106
+#define Z_HOME_DIR -1
107
+
108
+#define min_software_endstops false //If true, axis won't move to coordinates less than zero.
109
+#define max_software_endstops false  //If true, axis won't move to coordinates greater than the defined lengths below.
110
+#define X_MAX_LENGTH 210
111
+#define Y_MAX_LENGTH 210
112
+#define Z_MAX_LENGTH 210
113
+
114
+//// MOVEMENT SETTINGS
115
+#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
116
+//note: on bernhards ultimaker 200 200 12 are working well.
117
+#define HOMING_FEEDRATE {50*60, 50*60, 12*60, 0}  // set the homing speeds
118
+//the followint checks if an extrusion is existent in the move. if _not_, the speed of the move is set to the maximum speed. 
119
+//!!!!!!Use only if you know that your printer works at the maximum declared speeds.
120
+// works around the skeinforge cool-bug. There all moves are slowed to have a minimum layer time. However slow travel moves= ooze
121
+#define TRAVELING_AT_MAXSPEED  
122
+#define AXIS_RELATIVE_MODES {false, false, false, false}
123
+
124
+#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
125
+
126
+// default settings 
127
+
128
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {79.87220447,79.87220447,200*8/3,14}                    // default steps per unit for ultimaker 
129
+#define DEFAULT_MAX_FEEDRATE          {160*60, 160*60, 10*60, 500000}        
130
+#define DEFAULT_MAX_ACCELERATION      {9000,9000,150,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.
131
+
132
+#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
133
+#define DEFAULT_RETRACT_ACCELERATION  7000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
134
+
135
+#define DEFAULT_MINIMUMFEEDRATE       10     // minimum feedrate
136
+#define DEFAULT_MINTRAVELFEEDRATE     10
137
+
138
+// minimum time in microseconds that a movement needs to take if the buffer is emptied.   Increase this number if you see blobs while printing high speed & high detail.  It will slowdown on the detailed stuff.
139
+#define DEFAULT_MINSEGMENTTIME        20000
140
+#define DEFAULT_XYJERK                30.0*60    
141
+#define DEFAULT_ZJERK                 10.0*60
142
+
143
+
144
+// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
145
+//this enables the watchdog interrupt.
146
+#define USE_WATCHDOG
147
+//you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
148
+#define RESET_MANUAL
149
+
150
+#define WATCHDOG_TIMEOUT 4
151
+
152
+
153
+
154
+//// Experimental watchdog and minimal temp
155
+// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
156
+// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
157
+//#define WATCHPERIOD 5000 //5 seconds
158
+
159
+// Actual temperature must be close to target for this long before M109 returns success
160
+//#define TEMP_RESIDENCY_TIME 20  // (seconds)
161
+//#define TEMP_HYSTERESIS 5       // (C°) range of +/- temperatures considered "close" to the target one
162
+
163
+//// The minimal temperature defines the temperature below which the heater will not be enabled
164
+#define MINTEMP 5
165
+#define BED_MINTEMP 5
166
+
167
+
168
+// When temperature exceeds max temp, your heater will be switched off.
169
+// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
170
+// You should use MINTEMP for thermistor short/failure protection.
171
+#define MAXTEMP 275
172
+#define BED_MAXTEMP 150
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+#define PIDTEMP
181
+#ifdef PIDTEMP
182
+  /// PID settings:
183
+  // Uncomment the following line to enable PID support.
184
+  //#define SMOOTHING
185
+  //#define SMOOTHFACTOR 5.0
186
+  //float current_raw_average=0;
187
+    #define K1 0.95 //smoothing of the PID
188
+  //#define PID_DEBUG // Sends debug data to the serial port. 
189
+  //#define PID_OPENLOOP 1 // Puts PID in open loop. M104 sets the output power in %
190
+  #define PID_MAX 255 // limits current to nozzle
191
+  #define PID_INTEGRAL_DRIVE_MAX 255
192
+  #define PID_dT 0.1
193
+ //machine with red silicon: 1950:45 second ; with fan fully blowin 3000:47
194
+
195
+  #define PID_CRITIAL_GAIN 3000
196
+  #define PID_SWING_AT_CRITIAL 45 //seconds
197
+  #define PIDIADD 5
198
+  /*
199
+  //PID according to Ziegler-Nichols method
200
+  float Kp = 0.6*PID_CRITIAL_GAIN; 
201
+  float Ki =PIDIADD+2*Kp/PID_SWING_AT_CRITIAL*PID_dT;  
202
+  float Kd = Kp*PID_SWING_AT_CRITIAL/8./PID_dT;  
203
+  */
204
+  //PI according to Ziegler-Nichols method
205
+  #define  DEFAULT_Kp (PID_CRITIAL_GAIN/2.2) 
206
+  #define  DEFAULT_Ki (1.2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
207
+  #define  DEFAULT_Kd (0)
208
+  
209
+  #define PID_ADD_EXTRUSION_RATE  
210
+  #ifdef PID_ADD_EXTRUSION_RATE
211
+    #define  DEFAULT_Kc (5) //heatingpower=Kc*(e_speed)
212
+  #endif
213
+#endif // PIDTEMP
214
+
215
+// extruder advance constant (s2/mm3)
216
+//
217
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
218
+//
219
+// hooke's law says:		force = k * distance
220
+// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
221
+// so: v ^ 2 is proportional to number of steps we advance the extruder
222
+//#define ADVANCE
223
+
224
+#ifdef ADVANCE
225
+#define EXTRUDER_ADVANCE_K .3
226
+
227
+#define D_FILAMENT 1.7
228
+#define STEPS_MM_E 65
229
+#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
230
+#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
231
+
232
+#endif // ADVANCE
233
+
234
+// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, e.g. 8,16,32 
235
+#if defined SDSUPPORT
236
+// The number of linear motions that can be in the plan at any give time.  
237
+  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
238
+#else
239
+  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
240
+#endif
241
+
242
+
243
+#endif

Marlin/EEPROM.h → Marlin/EEPROMwrite.h Ver arquivo

@@ -1,123 +1,129 @@
1
-
2
-#include "planner.h"
3
-#include "temperature.h"
4
-
5
-//======================================================================================
6
-template <class T> int EEPROM_writeAnything(int &ee, const T& value)
7
-{
8
-    const byte* p = (const byte*)(const void*)&value;
9
-    int i;
10
-    for (i = 0; i < sizeof(value); i++)
11
-	  EEPROM.write(ee++, *p++);
12
-    return i;
13
-}
14
-//======================================================================================
15
-template <class T> int EEPROM_readAnything(int &ee, T& value)
16
-{
17
-    byte* p = (byte*)(void*)&value;
18
-    int i;
19
-    for (i = 0; i < sizeof(value); i++)
20
-	  *p++ = EEPROM.read(ee++);
21
-    return i;
22
-}
23
-//======================================================================================
24
-
25
-#define EEPROM_OFFSET 100
26
-
27
-#define EEPROM_VERSION "V04"  // IMPORTANT:  Whenever there are changes made to the variables stored in EEPROM
28
-                              // in the functions below, also increment the version number. This makes sure that
29
-                              // the default values are used whenever there is a change to the data, to prevent
30
-                              // wrong data being written to the variables.
31
-                              // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
32
-void StoreSettings() {
33
-  char ver[4]= "000";
34
-  int i=EEPROM_OFFSET;
35
-  EEPROM_writeAnything(i,ver); // invalidate data first 
36
-  EEPROM_writeAnything(i,axis_steps_per_unit);  
37
-  EEPROM_writeAnything(i,max_feedrate);  
38
-  EEPROM_writeAnything(i,max_acceleration_units_per_sq_second);
39
-  EEPROM_writeAnything(i,acceleration);
40
-  EEPROM_writeAnything(i,retract_acceleration);
41
-  EEPROM_writeAnything(i,minimumfeedrate);
42
-  EEPROM_writeAnything(i,mintravelfeedrate);
43
-  EEPROM_writeAnything(i,minsegmenttime);
44
-  EEPROM_writeAnything(i,max_xy_jerk);
45
-  EEPROM_writeAnything(i,max_z_jerk);
46
-  #ifdef PIDTEMP
47
-  EEPROM_writeAnything(i,Kp);
48
-  EEPROM_writeAnything(i,Ki);
49
-  EEPROM_writeAnything(i,Kd);
50
-#else
51
-  EEPROM_writeAnything(i,3000);
52
-  EEPROM_writeAnything(i,0);
53
-  EEPROM_writeAnything(i,0);
54
-#endif
55
-  char ver2[4]=EEPROM_VERSION;
56
-  i=EEPROM_OFFSET;
57
-  EEPROM_writeAnything(i,ver2); // validate data
58
-   ECHOLN("Settings Stored");
59
-
60
-}
61
-
62
-void RetrieveSettings(bool def=false){  // if def=true, the default values will be used
63
-  int i=EEPROM_OFFSET;
64
-  char stored_ver[4];
65
-  char ver[4]=EEPROM_VERSION;
66
-  EEPROM_readAnything(i,stored_ver); //read stored version
67
-//  ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
68
-  if ((!def)&&(strncmp(ver,stored_ver,3)==0)) {   // version number match
69
-      EEPROM_readAnything(i,axis_steps_per_unit);  
70
-      EEPROM_readAnything(i,max_feedrate);  
71
-      EEPROM_readAnything(i,max_acceleration_units_per_sq_second);
72
-      EEPROM_readAnything(i,acceleration);
73
-      EEPROM_readAnything(i,retract_acceleration);
74
-      EEPROM_readAnything(i,minimumfeedrate);
75
-      EEPROM_readAnything(i,mintravelfeedrate);
76
-      EEPROM_readAnything(i,minsegmenttime);
77
-      EEPROM_readAnything(i,max_xy_jerk);
78
-      EEPROM_readAnything(i,max_z_jerk);
79
-#ifndef PIDTEMP
80
-      float Kp,Ki,Kd;
81
-#endif
82
-      EEPROM_readAnything(i,Kp);
83
-      EEPROM_readAnything(i,Ki);
84
-      EEPROM_readAnything(i,Kd);
85
-
86
-      ECHOLN("Stored settings retreived:");
87
-  }
88
-  else {
89
-    float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT;
90
-    float tmp2[]=DEFAULT_MAX_FEEDRATE;
91
-    long tmp3[]=DEFAULT_MAX_ACCELERATION;
92
-    for (int i=0;i<4;i++) {
93
-      axis_steps_per_unit[i]=tmp1[i];  
94
-      max_feedrate[i]=tmp2[i];  
95
-      max_acceleration_units_per_sq_second[i]=tmp3[i];
96
-    }
97
-    acceleration=DEFAULT_ACCELERATION;
98
-    retract_acceleration=DEFAULT_RETRACT_ACCELERATION;
99
-    minimumfeedrate=DEFAULT_MINIMUMFEEDRATE;
100
-    minsegmenttime=DEFAULT_MINSEGMENTTIME;       
101
-    mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
102
-    max_xy_jerk=DEFAULT_XYJERK;
103
-    max_z_jerk=DEFAULT_ZJERK;
104
-    ECHOLN("Using Default settings:");
105
-  }
106
-  ECHOLN("Steps per unit:");
107
-  ECHOLN("   M92 X"   <<_FLOAT(axis_steps_per_unit[0],3) << " Y" <<  _FLOAT(axis_steps_per_unit[1],3) << " Z" << _FLOAT(axis_steps_per_unit[2],3) << " E" << _FLOAT(axis_steps_per_unit[3],3));
108
-  ECHOLN("Maximum feedrates (mm/s):");
109
-  ECHOLN("   M203 X"  <<_FLOAT(max_feedrate[0]/60,2)<<" Y" << _FLOAT(max_feedrate[1]/60,2) << " Z" << _FLOAT(max_feedrate[2]/60,2) << " E" << _FLOAT(max_feedrate[3]/60,2));
110
-  ECHOLN("Maximum Acceleration (mm/s2):");
111
-  ECHOLN("   M201 X"  <<_FLOAT(max_acceleration_units_per_sq_second[0],0) << " Y" << _FLOAT(max_acceleration_units_per_sq_second[1],0) << " Z" << _FLOAT(max_acceleration_units_per_sq_second[2],0) << " E" << _FLOAT(max_acceleration_units_per_sq_second[3],0));
112
-  ECHOLN("Acceleration: S=acceleration, T=retract acceleration");
113
-  ECHOLN("   M204 S"  <<_FLOAT(acceleration,2) << " T" << _FLOAT(retract_acceleration,2));
114
-  ECHOLN("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s),  Z=maximum Z jerk (mm/s)");
115
-  ECHOLN("   M205 S"  <<_FLOAT(minimumfeedrate/60,2) << " T" << _FLOAT(mintravelfeedrate/60,2) << " B" << _FLOAT(minsegmenttime,2) << " X" << _FLOAT(max_xy_jerk/60,2) << " Z" << _FLOAT(max_z_jerk/60,2));
116
-#ifdef PIDTEMP
117
-  ECHOLN("PID settings:");
118
-  ECHOLN("   M301 P"  << _FLOAT(Kp,3) << " I" << _FLOAT(Ki,3) << " D" << _FLOAT(Kd,3));  
119
-#endif
120
-  
121
-}  
122
-
123
-
1
+#ifndef __EEPROMH
2
+#define __EEPROMH
3
+#include "planner.h"
4
+#include "temperature.h"
5
+#include <EEPROM.h>
6
+#include "Marlin.h"
7
+#include "streaming.h"
8
+
9
+//======================================================================================
10
+template <class T> int EEPROM_writeAnything(int &ee, const T& value)
11
+{
12
+    const byte* p = (const byte*)(const void*)&value;
13
+    int i;
14
+    for (i = 0; i < (int)sizeof(value); i++)
15
+	  EEPROM.write(ee++, *p++);
16
+    return i;
17
+}
18
+//======================================================================================
19
+template <class T> int EEPROM_readAnything(int &ee, T& value)
20
+{
21
+    byte* p = (byte*)(void*)&value;
22
+    int i;
23
+    for (i = 0; i < (int)sizeof(value); i++)
24
+	  *p++ = EEPROM.read(ee++);
25
+    return i;
26
+}
27
+//======================================================================================
28
+
29
+#define EEPROM_OFFSET 100
30
+
31
+#define EEPROM_VERSION "V04"  // IMPORTANT:  Whenever there are changes made to the variables stored in EEPROM
32
+                              // in the functions below, also increment the version number. This makes sure that
33
+                              // the default values are used whenever there is a change to the data, to prevent
34
+                              // wrong data being written to the variables.
35
+                              // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
36
+void StoreSettings() {
37
+  char ver[4]= "000";
38
+  int i=EEPROM_OFFSET;
39
+  EEPROM_writeAnything(i,ver); // invalidate data first 
40
+  EEPROM_writeAnything(i,axis_steps_per_unit);  
41
+  EEPROM_writeAnything(i,max_feedrate);  
42
+  EEPROM_writeAnything(i,max_acceleration_units_per_sq_second);
43
+  EEPROM_writeAnything(i,acceleration);
44
+  EEPROM_writeAnything(i,retract_acceleration);
45
+  EEPROM_writeAnything(i,minimumfeedrate);
46
+  EEPROM_writeAnything(i,mintravelfeedrate);
47
+  EEPROM_writeAnything(i,minsegmenttime);
48
+  EEPROM_writeAnything(i,max_xy_jerk);
49
+  EEPROM_writeAnything(i,max_z_jerk);
50
+  #ifdef PIDTEMP
51
+  EEPROM_writeAnything(i,Kp);
52
+  EEPROM_writeAnything(i,Ki);
53
+  EEPROM_writeAnything(i,Kd);
54
+#else
55
+  EEPROM_writeAnything(i,3000);
56
+  EEPROM_writeAnything(i,0);
57
+  EEPROM_writeAnything(i,0);
58
+#endif
59
+  char ver2[4]=EEPROM_VERSION;
60
+  i=EEPROM_OFFSET;
61
+  EEPROM_writeAnything(i,ver2); // validate data
62
+   ECHOLN("Settings Stored");
63
+
64
+}
65
+
66
+void RetrieveSettings(bool def=false){  // if def=true, the default values will be used
67
+  int i=EEPROM_OFFSET;
68
+  char stored_ver[4];
69
+  char ver[4]=EEPROM_VERSION;
70
+  EEPROM_readAnything(i,stored_ver); //read stored version
71
+//  ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
72
+  if ((!def)&&(strncmp(ver,stored_ver,3)==0)) {   // version number match
73
+      EEPROM_readAnything(i,axis_steps_per_unit);  
74
+      EEPROM_readAnything(i,max_feedrate);  
75
+      EEPROM_readAnything(i,max_acceleration_units_per_sq_second);
76
+      EEPROM_readAnything(i,acceleration);
77
+      EEPROM_readAnything(i,retract_acceleration);
78
+      EEPROM_readAnything(i,minimumfeedrate);
79
+      EEPROM_readAnything(i,mintravelfeedrate);
80
+      EEPROM_readAnything(i,minsegmenttime);
81
+      EEPROM_readAnything(i,max_xy_jerk);
82
+      EEPROM_readAnything(i,max_z_jerk);
83
+#ifndef PIDTEMP
84
+      float Kp,Ki,Kd;
85
+#endif
86
+      EEPROM_readAnything(i,Kp);
87
+      EEPROM_readAnything(i,Ki);
88
+      EEPROM_readAnything(i,Kd);
89
+
90
+      ECHOLN("Stored settings retreived:");
91
+  }
92
+  else {
93
+    float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT;
94
+    float tmp2[]=DEFAULT_MAX_FEEDRATE;
95
+    long tmp3[]=DEFAULT_MAX_ACCELERATION;
96
+    for (int i=0;i<4;i++) {
97
+      axis_steps_per_unit[i]=tmp1[i];  
98
+      max_feedrate[i]=tmp2[i];  
99
+      max_acceleration_units_per_sq_second[i]=tmp3[i];
100
+    }
101
+    acceleration=DEFAULT_ACCELERATION;
102
+    retract_acceleration=DEFAULT_RETRACT_ACCELERATION;
103
+    minimumfeedrate=DEFAULT_MINIMUMFEEDRATE;
104
+    minsegmenttime=DEFAULT_MINSEGMENTTIME;       
105
+    mintravelfeedrate=DEFAULT_MINTRAVELFEEDRATE;
106
+    max_xy_jerk=DEFAULT_XYJERK;
107
+    max_z_jerk=DEFAULT_ZJERK;
108
+    ECHOLN("Using Default settings:");
109
+  }
110
+  ECHOLN("Steps per unit:");
111
+  ECHOLN("   M92 X"   <<_FLOAT(axis_steps_per_unit[0],3) << " Y" <<  _FLOAT(axis_steps_per_unit[1],3) << " Z" << _FLOAT(axis_steps_per_unit[2],3) << " E" << _FLOAT(axis_steps_per_unit[3],3));
112
+  ECHOLN("Maximum feedrates (mm/s):");
113
+  ECHOLN("   M203 X"  <<_FLOAT(max_feedrate[0]/60,2)<<" Y" << _FLOAT(max_feedrate[1]/60,2) << " Z" << _FLOAT(max_feedrate[2]/60,2) << " E" << _FLOAT(max_feedrate[3]/60,2));
114
+  ECHOLN("Maximum Acceleration (mm/s2):");
115
+  ECHOLN("   M201 X"  <<_FLOAT(max_acceleration_units_per_sq_second[0],0) << " Y" << _FLOAT(max_acceleration_units_per_sq_second[1],0) << " Z" << _FLOAT(max_acceleration_units_per_sq_second[2],0) << " E" << _FLOAT(max_acceleration_units_per_sq_second[3],0));
116
+  ECHOLN("Acceleration: S=acceleration, T=retract acceleration");
117
+  ECHOLN("   M204 S"  <<_FLOAT(acceleration,2) << " T" << _FLOAT(retract_acceleration,2));
118
+  ECHOLN("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s),  Z=maximum Z jerk (mm/s)");
119
+  ECHOLN("   M205 S"  <<_FLOAT(minimumfeedrate/60,2) << " T" << _FLOAT(mintravelfeedrate/60,2) << " B" << _FLOAT(minsegmenttime,2) << " X" << _FLOAT(max_xy_jerk/60,2) << " Z" << _FLOAT(max_z_jerk/60,2));
120
+#ifdef PIDTEMP
121
+  ECHOLN("PID settings:");
122
+  ECHOLN("   M301 P"  << _FLOAT(Kp,3) << " I" << _FLOAT(Ki,3) << " D" << _FLOAT(Kd,3));  
123
+#endif
124
+  
125
+}  
126
+
127
+#endif
128
+
129
+

+ 314
- 268
Marlin/Makefile Ver arquivo

@@ -1,274 +1,320 @@
1
+TARGET = $(notdir $(CURDIR))
2
+# CHANGE BELOW:
3
+#~ INSTALL_DIR = /Applications/Arduino.app/Contents/Resources/Java
4
+INSTALL_DIR = /home/bkubicek/software/arduino-0022
5
+#~ PORT = /dev/cu.usbserial*
6
+PORT = /dev/ttyACM0
7
+
8
+# Get these values from:
9
+#     $(INSTALL_DIR)/hardware/boards.txt
10
+#     (arduino-0022/hardware/arduino/boards.txt)
11
+# The values below are for the "Arduino Duemilanove or Nano w/ ATmega328"
12
+# now for "Arduino Mega 2560"
13
+UPLOAD_SPEED = 115200
14
+UPLOAD_PROTOCOL = stk500v2
15
+BUILD_MCU = atmega2560
16
+BUILD_F_CPU = 16000000L
17
+
18
+# getting undefined reference to `__cxa_pure_virtual'
19
+#~ [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254180518 Arduino Forum - Makefile]
20
+#~ http://www.arduino.cc/playground/OpenBSD/CLI
21
+#~ [http://arduino.cc/forum/index.php?topic=52041.0 A "simple" makefile for Arduino]
22
+#~ [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1275488191 Arduino Forum - Configuring avr-gcc options in arduino IDE]
23
+# found in /usr/lib/gcc/avr/4.3.5/cc1plus; fixed with -Wl,--gc-section
24
+
25
+############################################################################
26
+# Below here nothing should be changed...
27
+
28
+ARDUINO = $(INSTALL_DIR)/hardware/arduino/cores/arduino
1 29
 #
2
-# Arduino 0022 Makefile 
3
-# Uno with DOGS102 Shield
30
+#~ AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
31
+# in Ubuntu, avr-gcc is installed separate;
32
+# only avrdude comes with the IDE
33
+AVR_TOOLS_PATH = /usr/bin
34
+AVR_DUDE_PATH = $(INSTALL_DIR)/hardware/tools
4 35
 #
5
-# written by olikraus@gmail.com
6
-#
7
-# Features:
8
-#   - boards.txt is used to derive parameters
9
-#   - All intermediate files are put into a separate directory (TMPDIRNAME)
10
-#   - Simple use: Copy Makefile into the same directory of the .pde file
11
-#
12
-# Limitations:
13
-#   - requires UNIX environment
14
-#   - TMPDIRNAME must be subdirectory of the current directory.
15
-#
16
-# Targets
17
-# 	all		build everything
18
-#	upload	build and upload to arduino
19
-#	clean	remove all temporary files (includes final hex file)
20
-#
21
-# History
22
-#	001	28 Apr 2010	first  release
23
-#	002  05 Oct 2010	added 'uno'
24
-#
25
-
26
-#=== user configuration ===
27
-# All ...PATH variables must have a '/' at the end
28
-
29
-# Board (and prozessor) information: see $(ARDUINO_PATH)hardware/arduino/boards.txt
30
-# Some examples:
31
-#	BOARD		DESCRIPTION
32
-#	uno			Arduino Uno
33
-#	atmega328	Arduino Duemilanove or Nano w/ ATmega328
34
-#	diecimila		Arduino Diecimila, Duemilanove, or Nano w/ ATmega168
35
-#	mega		Arduino Mega
36
-#	mini			Arduino Mini
37
-#	lilypad328	LilyPad Arduino w/ ATmega328  
38
-BOARD:=mega
39
-
40
-# additional (comma separated) defines 
41
-# -DDOGM128_HW		board is connected to DOGM128 display
42
-# -DDOGM132_HW		board is connected to DOGM132 display
43
-# -DDOGS102_HW		board is connected to DOGS102 display
44
-# -DDOG_REVERSE		180 degree rotation
45
-# -DDOG_SPI_SW_ARDUINO	force SW shiftOut
46
-DEFS=-DDOGS102_HW -DDOG_DOUBLE_MEMORY -DDOG_SPI_SW_ARDUINO
47
-
48
-# The location where the avr tools (e.g. avr-gcc) are located. Requires a '/' at the end.
49
-# Can be empty if all tools are accessable through the search path
50
-AVR_TOOLS_PATH:=/usr/bin/
51
-
52
-# Install path of the arduino software. Requires a '/' at the end.
53
-ARDUINO_PATH:=/home/bkubicek/software/arduino-0022/
54
-
55
-# Install path for avrdude. Requires a '/' at the end. Can be empty if avrdude is in the search path.
56
-AVRDUDE_PATH:= 
57
-
58
-# The unix device where we can reach the arduino board
59
-# Uno: /dev/ttyACM0
60
-# Duemilanove: /dev/ttyUSB0
61
-AVRDUDE_PORT:=/dev/ttyACM0
62
-
63
-# List of all libaries which should be included.
64
-#EXTRA_DIRS=$(ARDUINO_PATH)libraries/LiquidCrystal/
65
-#EXTRA_DIRS+=$(ARDUINO_PATH)libraries/Dogm/
66
-#EXTRA_DIRS+=/home/kraus/src/arduino/dogm128/hg/libraries/Dogm/
67
-
68
-#=== fetch parameter from boards.txt processor parameter ===
69
-# the basic idea is to get most of the information from boards.txt
70
-
71
-BOARDS_TXT:=$(ARDUINO_PATH)hardware/arduino/boards.txt
72
-
73
-# get the MCU value from the $(BOARD).build.mcu variable. For the atmega328 board this is atmega328p
74
-MCU:=$(shell sed -n -e "s/$(BOARD).build.mcu=\(.*\)/\1/p" $(BOARDS_TXT))
75
-# get the F_CPU value from the $(BOARD).build.f_cpu variable. For the atmega328 board this is 16000000
76
-F_CPU:=$(shell sed -n -e "s/$(BOARD).build.f_cpu=\(.*\)/\1/p" $(BOARDS_TXT))
77
-
78
-# avrdude
79
-# get the AVRDUDE_UPLOAD_RATE value from the $(BOARD).upload.speed variable. For the atmega328 board this is 57600
80
-AVRDUDE_UPLOAD_RATE:=$(shell sed -n -e "s/$(BOARD).upload.speed=\(.*\)/\1/p" $(BOARDS_TXT))
81
-# get the AVRDUDE_PROGRAMMER value from the $(BOARD).upload.protocol variable. For the atmega328 board this is stk500
82
-# AVRDUDE_PROGRAMMER:=$(shell sed -n -e "s/$(BOARD).upload.protocol=\(.*\)/\1/p" $(BOARDS_TXT))
83
-# use stk500v1, because stk500 will default to stk500v2
84
-AVRDUDE_PROGRAMMER:=stk500v1
85
-
86
-#=== identify user files ===
87
-PDESRC:=$(shell ls *.pde)
88
-TARGETNAME=$(basename $(PDESRC))
89
-
90
-CDIRS:=$(EXTRA_DIRS) $(addsuffix utility/,$(EXTRA_DIRS))
91
-CDIRS:=*.c utility/*.c $(addsuffix *.c,$(CDIRS)) $(ARDUINO_PATH)hardware/arduino/cores/arduino/*.c
92
-CSRC:=$(shell ls $(CDIRS) 2>/dev/null)
93
-
94
-CCSRC:=$(shell ls *.cc 2>/dev/null)
95
-
96
-CPPDIRS:=$(EXTRA_DIRS) $(addsuffix utility/,$(EXTRA_DIRS))
97
-CPPDIRS:=*.cpp utility/*.cpp $(addsuffix *.cpp,$(CPPDIRS)) $(ARDUINO_PATH)hardware/arduino/cores/arduino/*.cpp 
98
-CPPSRC:=$(shell ls $(CPPDIRS) 2>/dev/null)
99
-
100
-#=== build internal variables ===
101
-
102
-# the name of the subdirectory where everything is stored
103
-TMPDIRNAME:=tmp
104
-TMPDIRPATH:=$(TMPDIRNAME)/
105
-
106
-AVRTOOLSPATH:=$(AVR_TOOLS_PATH)
107
-
108
-OBJCOPY:=$(AVRTOOLSPATH)avr-objcopy
109
-OBJDUMP:=$(AVRTOOLSPATH)avr-objdump
110
-SIZE:=$(AVRTOOLSPATH)avr-size
111
-
112
-CPPSRC:=$(addprefix $(TMPDIRPATH),$(PDESRC:.pde=.cpp)) $(CPPSRC)
113
-
114
-COBJ:=$(CSRC:.c=.o)
115
-CCOBJ:=$(CCSRC:.cc=.o)
116
-CPPOBJ:=$(CPPSRC:.cpp=.o)
117
-
118
-OBJFILES:=$(COBJ)  $(CCOBJ)  $(CPPOBJ)
119
-DIRS:= $(dir $(OBJFILES))
120
-
121
-DEPFILES:=$(OBJFILES:.o=.d)
122
-# assembler files from avr-gcc -S
123
-ASSFILES:=$(OBJFILES:.o=.s)
124
-# disassembled object files with avr-objdump -S
125
-DISFILES:=$(OBJFILES:.o=.dis)
126
-
127
-
128
-LIBNAME:=$(TMPDIRPATH)$(TARGETNAME).a
129
-ELFNAME:=$(TMPDIRPATH)$(TARGETNAME).elf
130
-HEXNAME:=$(TMPDIRPATH)$(TARGETNAME).hex
131
-
132
-AVRDUDE_FLAGS = -V -F
133
-AVRDUDE_FLAGS += -C $(ARDUINO_PATH)/hardware/tools/avrdude.conf 
134
-AVRDUDE_FLAGS += -p $(MCU)
135
-AVRDUDE_FLAGS += -P $(AVRDUDE_PORT)
136
-AVRDUDE_FLAGS += -c $(AVRDUDE_PROGRAMMER) 
137
-AVRDUDE_FLAGS += -b $(AVRDUDE_UPLOAD_RATE)
138
-AVRDUDE_FLAGS += -U flash:w:$(HEXNAME)
139
-
140
-AVRDUDE = avrdude
141
-
142
-#=== predefined variable override ===
143
-# use "make -p -f/dev/null" to see the default rules and definitions
144
-
145
-# Build C and C++ flags. Include path information must be placed here
146
-COMMON_FLAGS = -DF_CPU=$(F_CPU) -mmcu=$(MCU) $(DEFS)
147
-# COMMON_FLAGS += -gdwarf-2
148
-COMMON_FLAGS += -Os
149
-COMMON_FLAGS += -Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
150
-COMMON_FLAGS += -I. 
151
-COMMON_FLAGS += -I$(ARDUINO_PATH)hardware/arduino/cores/arduino
152
-COMMON_FLAGS += $(addprefix -I,$(EXTRA_DIRS))
153
-COMMON_FLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections
154
-COMMON_FLAGS += -Wl,--relax
155
-COMMON_FLAGS += -mcall-prologues
156
-
157
-CFLAGS = $(COMMON_FLAGS) -std=gnu99 -Wstrict-prototypes  
158
-CXXFLAGS = $(COMMON_FLAGS) 
159
-
160
-# Replace standard build tools by avr tools
161
-CC = $(AVRTOOLSPATH)avr-gcc
162
-CXX = $(AVRTOOLSPATH)avr-g++
163
-AR  = @$(AVRTOOLSPATH)avr-ar
164
-
165
-
166
-# "rm" must be able to delete a directory tree
167
-RM = rm -rf 
168
-
169
-#=== rules ===
170
-
171
-# add rules for the C/C++ files where the .o file is placed in the TMPDIRPATH
172
-# reuse existing variables as far as possible
173
-
174
-$(TMPDIRPATH)%.o: %.c
175
-	@echo compile $<
176
-	@$(COMPILE.c) $(OUTPUT_OPTION) $<
177
-
178
-$(TMPDIRPATH)%.o: %.cc
179
-	@echo compile $< 
180
-	@$(COMPILE.cc) $(OUTPUT_OPTION) $<
181
-
182
-$(TMPDIRPATH)%.o: %.cpp
183
-	@echo compile $<
184
-	@$(COMPILE.cpp) $(OUTPUT_OPTION) $<
185
-
186
-$(TMPDIRPATH)%.s: %.c
187
-	@$(COMPILE.c) $(OUTPUT_OPTION) -S $<
188
-
189
-$(TMPDIRPATH)%.s: %.cc
190
-	@$(COMPILE.cc) $(OUTPUT_OPTION) -S $<
191
-
192
-$(TMPDIRPATH)%.s: %.cpp
193
-	@$(COMPILE.cpp) $(OUTPUT_OPTION) -S $<
194
-
195
-$(TMPDIRPATH)%.dis: $(TMPDIRPATH)%.o
196
-	@$(OBJDUMP) -S $< > $@
197
-
198
-.SUFFIXES: .elf .hex .pde
36
+SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
37
+    $(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
38
+    $(ARDUINO)/wiring_pulse.c \
39
+    $(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
40
+# added applet/$(TARGET).cpp as in IDE 0022
41
+CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp \
42
+    $(ARDUINO)/Print.cpp \
43
+    $(ARDUINO)/main.cpp
44
+#    applet/$(TARGET).cpp # no need, having a rule now for applet/$(TARGET).cpp.o
45
+# added main.cpp, as in 0022
46
+FORMAT = ihex
47
+
48
+# Name of this Makefile (used for "make depend").
49
+MAKEFILE = Makefile
50
+
51
+# Debugging format.
52
+# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
53
+# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
54
+DEBUG = stabs
55
+
56
+OPT = 2
57
+
58
+# Place -D or -U options here
59
+#~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
60
+#~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
61
+# now called DF_CPU
62
+CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22
63
+CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=22
64
+
65
+# Place -I options here
66
+CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/
67
+CXXINCS = -I$(ARDUINO)
68
+
69
+# Compiler flag to set the C Standard level.
70
+# c89 - "ANSI" C
71
+# gnu89 - c89 plus GCC extensions
72
+# c99 - ISO C99 standard (not yet fully implemented)
73
+# gnu99 - c99 plus GCC extensions
74
+CSTANDARD = -std=gnu99
75
+CDEBUG = -g$(DEBUG)
76
+# note that typically, IDE 0022 uses -w to suppress warnings (both in cpp and c)!
77
+CWARN = -Wall
78
+#~ CWARN = -w
79
+#  "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++:
80
+CCWARN = -Wstrict-prototypes
81
+CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
82
+#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
83
+
84
+# to eliminate pins_ardiuno warnings:
85
+# http://arduino.cc/pipermail/developers_arduino.cc/2010-December/004005.html
86
+
87
+# [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254180518 Arduino Forum - Makefile]
88
+#~ For building the objects files "-ffunction-sections -fdata-sections" was missing
89
+#~ and the final avr-gcc call needs "-Wl,--gc-section".
90
+CXSECTF = -fno-exceptions -ffunction-sections -fdata-sections
91
+CFINALF = -Wl,--gc-section
92
+
93
+CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CCWARN) $(CSTANDARD) $(CEXTRA)
94
+# added CWARN also to .cpp
95
+CXXFLAGS = $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CXSECTF)
96
+#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
97
+LDFLAGS = -lm
98
+
99
+# Programming support using avrdude. Settings and variables.
100
+AVRDUDE_PORT = $(PORT)
101
+AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex
102
+AVRDUDE_FLAGS = -V -F \
103
+    -p $(BUILD_MCU) -P $(AVRDUDE_PORT) -c $(UPLOAD_PROTOCOL) \
104
+    -b $(UPLOAD_SPEED) -C $(INSTALL_DIR)/hardware/tools/avrdude.conf
105
+#    -b $(UPLOAD_SPEED) -C $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
106
+
107
+# Program settings
108
+CC = $(AVR_TOOLS_PATH)/avr-gcc
109
+CXX = $(AVR_TOOLS_PATH)/avr-g++
110
+OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
111
+OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
112
+AR = $(AVR_TOOLS_PATH)/avr-ar
113
+SIZE = $(AVR_TOOLS_PATH)/avr-size
114
+NM = $(AVR_TOOLS_PATH)/avr-nm
115
+#~ AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
116
+AVRDUDE = $(AVR_DUDE_PATH)/avrdude
117
+REMOVE = rm -f
118
+MV = mv -f
119
+
120
+# Define all object files.
121
+# NOTE: obj files will be created in respective src directories (libraries or $(INSTALL_DIR));
122
+#  make clean deletes them fine
123
+# note that srcs are in libraries or other directories;
124
+# $(CXXSRC:.cpp=.o) will cause obj files to be in same loc as src files
125
+#~ OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
126
+# to change the output directory for object files;
127
+# must change the obj list here!
128
+# and then, match to corresponding rule somehow?
129
+# or leave this - and parse in rule (auth automatic variable $(@F))?
130
+# "Suffix Replacement"
131
+OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
132
+
133
+# added - OBJ list, transformed into applet/
134
+OBJT = $(addprefix applet/,$(notdir $(OBJ)))
135
+ALLSRC = $(SRC) $(CXXSRC) $(ASRC)
136
+
137
+# Define all listing files.
138
+LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
139
+
140
+# Combine all necessary flags and optional flags.
141
+# Add target processor to flags.
142
+ALL_CFLAGS = -mmcu=$(BUILD_MCU) -I. $(CFLAGS)
143
+ALL_CXXFLAGS = -mmcu=$(BUILD_MCU) -I. $(CXXFLAGS)
144
+ALL_ASFLAGS = -mmcu=$(BUILD_MCU) -I. -x assembler-with-cpp $(ASFLAGS)
145
+
146
+# depended libraries of .pde need to be added from
147
+# $(INSTALL_DIR)/libraries (TODO: and/or ~/sketchbook/libraries)
148
+# grep for 'include', test if exists, add...
149
+# note: prefix "a real tab character" http://www.delorie.com/djgpp/doc/ug/larger/makefiles.html
150
+# $$ to escape $ for shell;
151
+# note: must NOT put comments # inside bash execution;
152
+# those would get removed by make; making shell see "EOF in backquote substitution"
153
+#		 echo $$ix ; \
154
+# 'shell' twice - for each subprocess! Backtick doesn't get expanded?
155
+GREPRES:=$(shell for ix in $(shell grep include $(TARGET).pde | sed 's/.*[<"]\(.*\).h[>"].*/\1/'); do \
156
+		if [ -d $(INSTALL_DIR)/libraries/$$ix ] ; then \
157
+			LINCS="$$LINCS -I$(INSTALL_DIR)/libraries/$$ix" ;\
158
+		fi; \
159
+	done; \
160
+	echo $$LINCS)
161
+# append includes:
162
+CINCS += $(GREPRES)
163
+CXXINCS += $(GREPRES)
164
+# append library source .cpp files too (CXXSRC)
165
+GREPRESB:=$(shell for ix in $(shell grep include $(TARGET).pde | sed 's/.*[<"]\(.*\).h[>"].*/\1/'); do \
166
+		if [ -d $(INSTALL_DIR)/libraries/$$ix ] ; then \
167
+			CPPSRCS="$$CPPSRCS $(INSTALL_DIR)/libraries/$$ix/*.cpp" ;\
168
+		fi; \
169
+	done; \
170
+	echo $$CPPSRCS)
171
+CXXSRC += $(GREPRESB)
172
+# added - only CXX obj from libraries:
173
+CXXLIBOBJ = $(GREPRESB:.cpp=.o)
174
+
175
+# Default target.
176
+all: applet_files build sizeafter
177
+
178
+build: elf hex
179
+
180
+applet_files: $(TARGET).pde
181
+    # Here is the "preprocessing".
182
+    # It creates a .cpp file based with the same name as the .pde file.
183
+    # On top of the new .cpp file comes the WProgram.h header.
184
+    # At the end there is a generic main() function attached.
185
+    # Then the .cpp file will be compiled. Errors during compile will
186
+    # refer to this new, automatically generated, file.
187
+    # Not the original .pde file you actually edit...
188
+	test -d applet || mkdir applet
189
+    # @ supresses printout of the cmdline itself; so only the out of echo is printed
190
+	@echo ALL OBJT: $(OBJT)
191
+	@echo ALL CXXLIBOBJ: $(CXXLIBOBJ)
192
+#	echo '#include "WProgram.h"' > applet/$(TARGET).cpp
193
+	@echo "#include \"WProgram.h\"\nvoid setup();\nvoid loop();\n" > applet/$(TARGET).cpp
194
+	cat $(TARGET).pde >> applet/$(TARGET).cpp
195
+    # no more need to cat main.cpp (v0022) - now it is compiled in
196
+#	cat $(ARDUINO)/main.cpp >> applet/$(TARGET).cpp
197
+
198
+
199
+elf: applet/$(TARGET).elf
200
+hex: applet/$(TARGET).hex
201
+eep: applet/$(TARGET).eep
202
+lss: applet/$(TARGET).lss
203
+sym: applet/$(TARGET).sym
204
+
205
+# Program the device.
206
+upload: applet/$(TARGET).hex
207
+	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
208
+
209
+# Display size of file.
210
+HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex
211
+ELFSIZE = $(SIZE) applet/$(TARGET).elf
212
+sizebefore:
213
+	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
214
+
215
+sizeafter:
216
+	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(HEXSIZE); echo; fi
217
+
218
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
219
+COFFCONVERT=$(OBJCOPY) --debugging \
220
+    --change-section-address .data-0x800000 \
221
+    --change-section-address .bss-0x800000 \
222
+    --change-section-address .noinit-0x800000 \
223
+    --change-section-address .eeprom-0x810000
224
+
225
+coff: applet/$(TARGET).elf
226
+	$(COFFCONVERT) -O coff-avr applet/$(TARGET).elf $(TARGET).cof
227
+
228
+extcoff: $(TARGET).elf
229
+	$(COFFCONVERT) -O coff-ext-avr applet/$(TARGET).elf $(TARGET).cof
230
+
231
+.SUFFIXES: .elf .hex .eep .lss .sym
199 232
 
200 233
 .elf.hex:
201
-	@$(OBJCOPY) -O ihex -R .eeprom $< $@
202
-	
203
-$(TMPDIRPATH)%.cpp: %.pde
204
-	@cat $(ARDUINO_PATH)hardware/arduino/cores/arduino/main.cpp > $@
205
-	@cat $< >> $@
206
-	@echo >> $@
207
-	@echo 'extern "C" void __cxa_pure_virtual() { while (1); }' >> $@
208
-
209
-
210
-.PHONY: all
211
-all: tmpdir $(HEXNAME) assemblersource showsize
212
-	ls -al $(HEXNAME) $(ELFNAME)
213
-
214
-$(ELFNAME): $(LIBNAME)($(addprefix $(TMPDIRPATH),$(OBJFILES))) 
215
-	$(LINK.o) $(COMMON_FLAGS) $(LIBNAME) $(LOADLIBES) $(LDLIBS) -o $@
216
-
217
-$(LIBNAME)(): $(addprefix $(TMPDIRPATH),$(OBJFILES))
218
-
219
-#=== create temp directory ===
220
-# not really required, because it will be also created during the dependency handling
221
-.PHONY: tmpdir
222
-tmpdir:
223
-	@test -d $(TMPDIRPATH) || mkdir $(TMPDIRPATH)
224
-
225
-#=== create assembler files for each C/C++ file ===
226
-.PHONY: assemblersource
227
-assemblersource: $(addprefix $(TMPDIRPATH),$(ASSFILES)) $(addprefix $(TMPDIRPATH),$(DISFILES))
228
-
229
-
230
-#=== show the section sizes of the ELF file ===
231
-.PHONY: showsize
232
-showsize: $(ELFNAME)
233
-	$(SIZE) $<
234
-
235
-#=== clean up target ===
236
-# this is simple: the TMPDIRPATH is removed
237
-.PHONY: clean
234
+	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
235
+
236
+.elf.eep:
237
+    -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
238
+    --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
239
+
240
+# Create extended listing file from ELF output file.
241
+.elf.lss:
242
+	$(OBJDUMP) -h -S $< > $@
243
+
244
+# Create a symbol table from ELF output file.
245
+.elf.sym:
246
+	$(NM) -n $< > $@
247
+
248
+# Link: create ELF output file from library.
249
+# NOTE: applet/$(TARGET).cpp.o MUST BE BEFORE applet/core.a
250
+#  in the dependency list, so its rule runs first!
251
+applet/$(TARGET).elf: $(TARGET).pde applet/$(TARGET).cpp.o applet/core.a
252
+#	$(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
253
+# changed as in IDE v0022: link cpp obj files
254
+	@echo $$(tput bold)$$(tput setaf 2) $(CC) $$(tput sgr0) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
255
+	@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
256
+
257
+# added: cpp.o depends on cpp (and .pde which generates it)
258
+# $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"
259
+# http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
260
+applet/$(TARGET).cpp.o: applet/$(TARGET).cpp
261
+	@echo $$(tput bold) $(CXX) $$(tput sgr0) -c $(ALL_CXXFLAGS) $< -o $@
262
+	@$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
263
+
264
+#~ applet/core.a: $(OBJ)
265
+#~	 @for i in $(OBJ); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
266
+
267
+applet/core.a: $(OBJT)
268
+	 @for i in $(OBJT); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
269
+
270
+# iterate through OBJ to find the original location; then build depending on source extension
271
+# TODO: add handling of assembler files
272
+applet/%.o:
273
+	@for iob in $(OBJ); do \
274
+		if [ "`basename $$iob`" = "`basename $@`" ]; then \
275
+			for ios in $(ALLSRC); do \
276
+				if [ "$${iob%%.*}" = "$${ios%%.*}" ]; then \
277
+					case $${ios##*.} in \
278
+						"cpp") \
279
+							echo "$$(tput bold)$$(tput setaf 1) $(CXX) $$(tput sgr0) -c $(ALL_CXXFLAGS) $$ios -o $@"; \
280
+							$(CXX) -c $(ALL_CXXFLAGS) $$ios -o $@;; \
281
+						"c") \
282
+							echo "$$(tput bold)$$(tput setaf 1) $(CC) $$(tput sgr0) -c $(ALL_CFLAGS) $$ios -o $@"; \
283
+							$(CC) -c $(ALL_CFLAGS) $$ios -o $@;; \
284
+					esac; \
285
+				fi; \
286
+			done; \
287
+		fi; \
288
+	done;
289
+
290
+#~ # Compile: create object files from C++ source files.
291
+#~ .cpp.o:
292
+#~	 $(CXX) -c $(ALL_CXXFLAGS) $< -o $@
293
+
294
+#~ # Compile: create object files from C source files.
295
+#~ .c.o:
296
+#~	 $(CC) -c $(ALL_CFLAGS) $< -o $@
297
+
298
+#~ # Compile: create assembler files from C source files.
299
+#~ .c.s:
300
+#~	 $(CC) -S $(ALL_CFLAGS) $< -o $@
301
+
302
+#~ # Assemble: create object files from assembler source files.
303
+#~ .S.o:
304
+#~	 $(CC) -c $(ALL_ASFLAGS) $< -o $@
305
+
306
+#~ # Automatic dependencies
307
+#~ %.d: %.c
308
+#~	 $(CC) -M $(ALL_CFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
309
+
310
+#~ %.d: %.cpp
311
+#~	 $(CXX) -M $(ALL_CXXFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
312
+
313
+# Target: clean project.
238 314
 clean:
239
-	$(RM) $(TMPDIRPATH)
240
-
241
-# Program the device.  
242
-# step 1: reset the arduino board with the stty command
243
-# step 2: user avrdude to upload the software
244
-.PHONY: upload
245
-upload: $(HEXNAME)
246
-	stty -F $(AVRDUDE_PORT) hupcl
247
-	$(AVRDUDE) $(AVRDUDE_FLAGS)
248
-
249
-
250
-# === dependency handling ===
251
-# From the gnu make manual (section 4.14, Generating Prerequisites Automatically)
252
-# Additionally (because this will be the first executed rule) TMPDIRPATH is created here.
253
-# Instead of "sed" the "echo" command is used
254
-# cd $(TMPDIRPATH); mkdir -p $(DIRS) 2> /dev/null; cd ..
255
-DEPACTION=test -d $(TMPDIRPATH) || mkdir $(TMPDIRPATH);\
256
-mkdir -p $(addprefix $(TMPDIRPATH),$(DIRS));\
257
-set -e; echo -n $@ $(dir $@) > $@; $(CC) -MM $(COMMON_FLAGS) $< >> $@
258
-
259
-
260
-$(TMPDIRPATH)%.d: %.c
261
-	@$(DEPACTION)
262
-
263
-$(TMPDIRPATH)%.d: %.cc
264
-	@$(DEPACTION)
265
-
266
-
267
-$(TMPDIRPATH)%.d: %.cpp
268
-	@$(DEPACTION)
269
-
270
-# Include dependency files. If a .d file is missing, a warning is created and the .d file is created
271
-# This warning is not a problem (gnu make manual, section 3.3 Including Other Makefiles)
272
--include $(addprefix $(TMPDIRPATH),$(DEPFILES))
273
-
315
+	$(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
316
+        applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
317
+        $(OBJT) applet/$(TARGET).cpp.o \
318
+        $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
274 319
 
320
+.PHONY: all build elf hex eep lss sym program coff extcoff clean applet_files sizebefore sizeafter

+ 82
- 83
Marlin/Marlin.h Ver arquivo

@@ -1,83 +1,82 @@
1
-#ifndef __MARLINH
2
-#define __MARLINH
3
-
4
-// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
5
-// Licence: GPL
6
-#include <WProgram.h>
7
-#include "fastio.h"
8
-
9
-
10
-#define ECHO(x) Serial << "echo: " << x;
11
-#define ECHOLN(x) Serial << "echo: "<<x<<endl;
12
-
13
-void get_command();
14
-void process_commands();
15
-
16
-void manage_inactivity(byte debug);
17
-
18
-#if X_ENABLE_PIN > -1
19
-#define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
20
-#define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
21
-#else
22
-#define enable_x() ;
23
-#define disable_x() ;
24
-#endif
25
-#if Y_ENABLE_PIN > -1
26
-#define  enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
27
-#define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
28
-#else
29
-#define enable_y() ;
30
-#define disable_y() ;
31
-#endif
32
-#if Z_ENABLE_PIN > -1
33
-#define  enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
34
-#define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
35
-#else
36
-#define enable_z() ;
37
-#define disable_z() ;
38
-#endif
39
-
40
-#if E_ENABLE_PIN > -1
41
-
42
-	#define  enable_e() WRITE(E_ENABLE_PIN, E_ENABLE_ON)
43
-	#define disable_e() WRITE(E_ENABLE_PIN,!E_ENABLE_ON)
44
-
45
-#else
46
-#define enable_e() ;
47
-#define disable_e() ;
48
-#endif
49
-
50
-#define X_AXIS 0
51
-#define Y_AXIS 1
52
-#define Z_AXIS 2
53
-#define E_AXIS 3
54
-
55
-void FlushSerialRequestResend();
56
-void ClearToSend();
57
-
58
-void get_coordinates();
59
-void prepare_move();
60
-void kill(byte debug);
61
-
62
-//void check_axes_activity();
63
-//void plan_init();
64
-//void st_init();
65
-//void tp_init();
66
-//void plan_buffer_line(float x, float y, float z, float e, float feed_rate);
67
-//void plan_set_position(float x, float y, float z, float e);
68
-//void st_wake_up();
69
-//void st_synchronize();
70
-void enquecommand(const char *cmd);
71
-void wd_reset();
72
-
73
-#ifndef CRITICAL_SECTION_START
74
-#define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
75
-#define CRITICAL_SECTION_END    SREG = _sreg;
76
-#endif //CRITICAL_SECTION_START
77
-
78
-extern float homing_feedrate[];
79
-extern bool axis_relative_modes[];
80
-
81
-void manage_inactivity(byte debug);
82
-
83
-#endif
1
+#ifndef __MARLINH
2
+#define __MARLINH
3
+
4
+// Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
5
+// Licence: GPL
6
+#include <WProgram.h>
7
+#include "fastio.h"
8
+
9
+
10
+#define ECHO(x) Serial << "echo: " << x;
11
+#define ECHOLN(x) Serial << "echo: "<<x<<endl;
12
+
13
+void get_command();
14
+void process_commands();
15
+
16
+void manage_inactivity(byte debug);
17
+
18
+#if X_ENABLE_PIN > -1
19
+#define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
20
+#define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
21
+#else
22
+#define enable_x() ;
23
+#define disable_x() ;
24
+#endif
25
+#if Y_ENABLE_PIN > -1
26
+#define  enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
27
+#define disable_y() WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON)
28
+#else
29
+#define enable_y() ;
30
+#define disable_y() ;
31
+#endif
32
+#if Z_ENABLE_PIN > -1
33
+#define  enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
34
+#define disable_z() WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON)
35
+#else
36
+#define enable_z() ;
37
+#define disable_z() ;
38
+#endif
39
+
40
+#if E_ENABLE_PIN > -1
41
+
42
+	#define  enable_e() WRITE(E_ENABLE_PIN, E_ENABLE_ON)
43
+	#define disable_e() WRITE(E_ENABLE_PIN,!E_ENABLE_ON)
44
+
45
+#else
46
+#define enable_e() ;
47
+#define disable_e() ;
48
+#endif
49
+
50
+#define X_AXIS 0
51
+#define Y_AXIS 1
52
+#define Z_AXIS 2
53
+#define E_AXIS 3
54
+
55
+void FlushSerialRequestResend();
56
+void ClearToSend();
57
+
58
+void get_coordinates();
59
+void prepare_move();
60
+void kill();
61
+
62
+//void check_axes_activity();
63
+//void plan_init();
64
+//void st_init();
65
+//void tp_init();
66
+//void plan_buffer_line(float x, float y, float z, float e, float feed_rate);
67
+//void plan_set_position(float x, float y, float z, float e);
68
+//void st_wake_up();
69
+//void st_synchronize();
70
+void enquecommand(const char *cmd);
71
+
72
+
73
+#ifndef CRITICAL_SECTION_START
74
+#define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
75
+#define CRITICAL_SECTION_END    SREG = _sreg;
76
+#endif //CRITICAL_SECTION_START
77
+
78
+extern float homing_feedrate[];
79
+extern bool axis_relative_modes[];
80
+
81
+void wd_reset() ;
82
+#endif

+ 1233
- 1233
Marlin/Marlin.pde
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 5
- 5
Marlin/fastio.h Ver arquivo

@@ -24,12 +24,12 @@
24 24
 */
25 25
 
26 26
 /// Read a pin
27
-#define		_READ(IO)					((bool)(DIO ## IO ## _RPORT & MASK(DIO ## IO ## _PIN)))
27
+#define         _READ(IO)                                       ((bool)(DIO ## IO ## _RPORT & MASK(DIO ## IO ## _PIN)))
28 28
 /// write to a pin
29
-#define		_WRITE(IO, v)			do { if (v) {DIO ##  IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ##  IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }; } while (0)
30
-//#define		_WRITE(IO, v)	do { #if (DIO ##  IO ## _WPORT >= 0x100) CRITICAL_SECTION_START; if (v) {DIO ##  IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ##  IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); };#if (DIO ##  IO ## _WPORT >= 0x100) CRITICAL_SECTION_END; } while (0)
29
+#define         _WRITE(IO, v)                   do { if (v) {DIO ##  IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ##  IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }; } while (0)
30
+//#define               _WRITE(IO, v)   do { #if (DIO ##  IO ## _WPORT >= 0x100) CRITICAL_SECTION_START; if (v) {DIO ##  IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ##  IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); };#if (DIO ##  IO ## _WPORT >= 0x100) CRITICAL_SECTION_END; } while (0)
31 31
 /// toggle a pin
32
-#define		_TOGGLE(IO)				do {DIO ##  IO ## _RPORT = MASK(DIO ## IO ## _PIN); } while (0)
32
+#define         _TOGGLE(IO)                             do {DIO ##  IO ## _RPORT = MASK(DIO ## IO ## _PIN); } while (0)
33 33
 
34 34
 /// set pin as input
35 35
 #define		_SET_INPUT(IO)		do {DIO ##  IO ## _DDR &= ~MASK(DIO ## IO ## _PIN); } while (0)
@@ -2556,4 +2556,4 @@ pins
2556 2556
 #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
2557 2557
 #endif
2558 2558
 
2559
-#endif /* _ARDUINO_H */
2559
+#endif /* _ARDUINO_H */

+ 0
- 10
Marlin/lcd.h Ver arquivo

@@ -1,10 +0,0 @@
1
-#ifndef __LCDH
2
-#define __LCDH
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-#endif

+ 0
- 1
Marlin/lcd.pde Ver arquivo

@@ -1 +0,0 @@
1
-

+ 10
- 8
Marlin/planner.cpp Ver arquivo

@@ -381,13 +381,6 @@ void check_axes_activity() {
381 381
 // calculation the caller must also provide the physical length of the line in millimeters.
382 382
 void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
383 383
 
384
-  // The target position of the tool in absolute steps
385
-  // Calculate target position in absolute steps
386
-  long target[4];
387
-  target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
388
-  target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
389
-  target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);     
390
-  target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]);     
391 384
 
392 385
   // Calculate the buffer head after we push this byte
393 386
   int next_buffer_head = (block_buffer_head + 1) & (BLOCK_BUFFER_SIZE - 1);
@@ -400,6 +393,15 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
400 393
     LCD_STATUS;
401 394
   }
402 395
 
396
+  // The target position of the tool in absolute steps
397
+  // Calculate target position in absolute steps
398
+  //this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
399
+  long target[4];
400
+  target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
401
+  target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
402
+  target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);     
403
+  target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS]); 
404
+  
403 405
   // Prepare to set up new block
404 406
   block_t *block = &block_buffer[block_buffer_head];
405 407
   
@@ -433,7 +435,7 @@ void plan_buffer_line(float x, float y, float z, float e, float feed_rate) {
433 435
   unsigned long microseconds;
434 436
 
435 437
   if (block->steps_e == 0) {
436
-	if(feed_rate<mintravelfeedrate) feed_rate=mintravelfeedrate;
438
+        if(feed_rate<mintravelfeedrate) feed_rate=mintravelfeedrate;
437 439
   }
438 440
   else {
439 441
     	if(feed_rate<minimumfeedrate) feed_rate=minimumfeedrate;

+ 92
- 90
Marlin/planner.h Ver arquivo

@@ -1,90 +1,92 @@
1
-/*
2
-  planner.h - buffers movement commands and manages the acceleration profile plan
3
-  Part of Grbl
4
-
5
-  Copyright (c) 2009-2011 Simen Svale Skogsrud
6
-
7
-  Grbl is free software: you can redistribute it and/or modify
8
-  it under the terms of the GNU General Public License as published by
9
-  the Free Software Foundation, either version 3 of the License, or
10
-  (at your option) any later version.
11
-
12
-  Grbl is distributed in the hope that it will be useful,
13
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
-  GNU General Public License for more details.
16
-
17
-  You should have received a copy of the GNU General Public License
18
-  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
19
-*/
20
-
21
-// This module is to be considered a sub-module of stepper.c. Please don't include 
22
-// this file from any other module.
23
-
24
-#ifndef planner_h
25
-#define planner_h
26
-
27
-// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
28
-// the source g-code and may never actually be reached if acceleration management is active.
29
-typedef struct {
30
-  // Fields used by the bresenham algorithm for tracing the line
31
-  long steps_x, steps_y, steps_z, steps_e;  // Step count along each axis
32
-  long step_event_count;                    // The number of step events required to complete this block
33
-  volatile long accelerate_until;                    // The index of the step event on which to stop acceleration
34
-  volatile long decelerate_after;                    // The index of the step event on which to start decelerating
35
-  volatile long acceleration_rate;                   // The acceleration rate used for acceleration calculation
36
-  unsigned char direction_bits;             // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
37
-#ifdef ADVANCE
38
-  long advance_rate;
39
-  volatile long initial_advance;
40
-  volatile long final_advance;
41
-  float advance;
42
-#endif
43
-
44
-  // Fields used by the motion planner to manage acceleration
45
-  float speed_x, speed_y, speed_z, speed_e;          // Nominal mm/minute for each axis
46
-  float nominal_speed;                               // The nominal speed for this block in mm/min  
47
-  float millimeters;                                 // The total travel of this block in mm
48
-  float entry_speed;
49
-  float acceleration;                                // acceleration mm/sec^2
50
-
51
-  // Settings for the trapezoid generator
52
-  long nominal_rate;                                 // The nominal step rate for this block in step_events/sec 
53
-  volatile long initial_rate;                        // The jerk-adjusted step rate at start of block  
54
-  volatile long final_rate;                          // The minimal rate at exit
55
-  long acceleration_st;                              // acceleration steps/sec^2
56
-  volatile char busy;
57
-} block_t;
58
-      
59
-// Initialize the motion plan subsystem      
60
-void plan_init();
61
-
62
-// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
63
-// millimaters. Feed rate specifies the speed of the motion.
64
-void plan_buffer_line(float x, float y, float z, float e, float feed_rate);
65
-
66
-// Set position. Used for G92 instructions.
67
-void plan_set_position(float x, float y, float z, float e);
68
-
69
-// Called when the current block is no longer needed. Discards the block and makes the memory
70
-// availible for new blocks.
71
-void plan_discard_current_block();
72
-
73
-// Gets the current block. Returns NULL if buffer empty
74
-block_t *plan_get_current_block();
75
-
76
-void check_axes_activity();
77
-
78
-extern unsigned long minsegmenttime;
79
-extern float max_feedrate[4]; // set the max speeds
80
-extern float axis_steps_per_unit[4];
81
-extern long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
82
-extern float minimumfeedrate;
83
-extern float acceleration;         // Normal acceleration mm/s^2  THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
84
-extern float retract_acceleration; //  mm/s^2   filament pull-pack and push-forward  while standing still in the other axis M204 TXXXX
85
-extern float max_xy_jerk; //speed than can be stopped at once, if i understand correctly.
86
-extern float max_z_jerk;
87
-extern float mintravelfeedrate;
88
-extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
89
-
90
-#endif
1
+/*
2
+  planner.h - buffers movement commands and manages the acceleration profile plan
3
+  Part of Grbl
4
+
5
+  Copyright (c) 2009-2011 Simen Svale Skogsrud
6
+
7
+  Grbl is free software: you can redistribute it and/or modify
8
+  it under the terms of the GNU General Public License as published by
9
+  the Free Software Foundation, either version 3 of the License, or
10
+  (at your option) any later version.
11
+
12
+  Grbl is distributed in the hope that it will be useful,
13
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+  GNU General Public License for more details.
16
+
17
+  You should have received a copy of the GNU General Public License
18
+  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
19
+*/
20
+
21
+// This module is to be considered a sub-module of stepper.c. Please don't include 
22
+// this file from any other module.
23
+
24
+#ifndef planner_h
25
+#define planner_h
26
+
27
+#include "Configuration.h"
28
+
29
+// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
30
+// the source g-code and may never actually be reached if acceleration management is active.
31
+typedef struct {
32
+  // Fields used by the bresenham algorithm for tracing the line
33
+  long steps_x, steps_y, steps_z, steps_e;  // Step count along each axis
34
+  long step_event_count;                    // The number of step events required to complete this block
35
+  volatile long accelerate_until;                    // The index of the step event on which to stop acceleration
36
+  volatile long decelerate_after;                    // The index of the step event on which to start decelerating
37
+  volatile long acceleration_rate;                   // The acceleration rate used for acceleration calculation
38
+  unsigned char direction_bits;             // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
39
+#ifdef ADVANCE
40
+  long advance_rate;
41
+  volatile long initial_advance;
42
+  volatile long final_advance;
43
+  float advance;
44
+#endif
45
+
46
+  // Fields used by the motion planner to manage acceleration
47
+  float speed_x, speed_y, speed_z, speed_e;          // Nominal mm/minute for each axis
48
+  float nominal_speed;                               // The nominal speed for this block in mm/min  
49
+  float millimeters;                                 // The total travel of this block in mm
50
+  float entry_speed;
51
+  float acceleration;                                // acceleration mm/sec^2
52
+
53
+  // Settings for the trapezoid generator
54
+  long nominal_rate;                                 // The nominal step rate for this block in step_events/sec 
55
+  volatile long initial_rate;                        // The jerk-adjusted step rate at start of block  
56
+  volatile long final_rate;                          // The minimal rate at exit
57
+  long acceleration_st;                              // acceleration steps/sec^2
58
+  volatile char busy;
59
+} block_t;
60
+      
61
+// Initialize the motion plan subsystem      
62
+void plan_init();
63
+
64
+// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
65
+// millimaters. Feed rate specifies the speed of the motion.
66
+void plan_buffer_line(float x, float y, float z, float e, float feed_rate);
67
+
68
+// Set position. Used for G92 instructions.
69
+void plan_set_position(float x, float y, float z, float e);
70
+
71
+// Called when the current block is no longer needed. Discards the block and makes the memory
72
+// availible for new blocks.
73
+void plan_discard_current_block();
74
+
75
+// Gets the current block. Returns NULL if buffer empty
76
+block_t *plan_get_current_block();
77
+
78
+void check_axes_activity();
79
+
80
+extern unsigned long minsegmenttime;
81
+extern float max_feedrate[4]; // set the max speeds
82
+extern float axis_steps_per_unit[4];
83
+extern long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
84
+extern float minimumfeedrate;
85
+extern float acceleration;         // Normal acceleration mm/s^2  THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
86
+extern float retract_acceleration; //  mm/s^2   filament pull-pack and push-forward  while standing still in the other axis M204 TXXXX
87
+extern float max_xy_jerk; //speed than can be stopped at once, if i understand correctly.
88
+extern float max_z_jerk;
89
+extern float mintravelfeedrate;
90
+extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
91
+
92
+#endif

+ 1
- 1
Marlin/stepper.cpp Ver arquivo

@@ -115,7 +115,7 @@ asm volatile ( \
115 115
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  TIMSK1 |= (1<<OCIE1A)
116 116
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
117 117
 
118
-static block_t *current_block;  // A pointer to the block currently being traced
118
+block_t *current_block;  // A pointer to the block currently being traced
119 119
 
120 120
 // Variables used by The Stepper Driver Interrupt
121 121
 static unsigned char out_bits;        // The next stepping-bits to be output

+ 44
- 40
Marlin/stepper.h Ver arquivo

@@ -1,40 +1,44 @@
1
-/*
2
-  stepper.h - stepper motor driver: executes motion plans of planner.c using the stepper motors
3
-  Part of Grbl
4
-
5
-  Copyright (c) 2009-2011 Simen Svale Skogsrud
6
-
7
-  Grbl is free software: you can redistribute it and/or modify
8
-  it under the terms of the GNU General Public License as published by
9
-  the Free Software Foundation, either version 3 of the License, or
10
-  (at your option) any later version.
11
-
12
-  Grbl is distributed in the hope that it will be useful,
13
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
-  GNU General Public License for more details.
16
-
17
-  You should have received a copy of the GNU General Public License
18
-  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
19
-*/
20
-
21
-#ifndef stepper_h
22
-#define stepper_h 
23
-// Initialize and start the stepper motor subsystem
24
-void st_init();
25
-
26
-// Block until all buffered steps are executed
27
-void st_synchronize();
28
-
29
-// The stepper subsystem goes to sleep when it runs out of things to execute. Call this
30
-// to notify the subsystem that it is time to go to work.
31
-void st_wake_up();
32
-
33
-// if DEBUG_STEPS is enabled, M114 can be used to compare two methods of determining the X,Y,Z position of the printer.
34
-// for debugging purposes only, should be disabled by default
35
-#ifdef DEBUG_STEPS
36
-extern volatile long count_position[NUM_AXIS];
37
-extern volatile int count_direction[NUM_AXIS];
38
-#endif
39
-
40
-#endif
1
+/*
2
+  stepper.h - stepper motor driver: executes motion plans of planner.c using the stepper motors
3
+  Part of Grbl
4
+
5
+  Copyright (c) 2009-2011 Simen Svale Skogsrud
6
+
7
+  Grbl is free software: you can redistribute it and/or modify
8
+  it under the terms of the GNU General Public License as published by
9
+  the Free Software Foundation, either version 3 of the License, or
10
+  (at your option) any later version.
11
+
12
+  Grbl is distributed in the hope that it will be useful,
13
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+  GNU General Public License for more details.
16
+
17
+  You should have received a copy of the GNU General Public License
18
+  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
19
+*/
20
+
21
+#ifndef stepper_h
22
+#define stepper_h 
23
+
24
+#include "planner.h"
25
+
26
+// Initialize and start the stepper motor subsystem
27
+void st_init();
28
+
29
+// Block until all buffered steps are executed
30
+void st_synchronize();
31
+
32
+// The stepper subsystem goes to sleep when it runs out of things to execute. Call this
33
+// to notify the subsystem that it is time to go to work.
34
+void st_wake_up();
35
+
36
+// if DEBUG_STEPS is enabled, M114 can be used to compare two methods of determining the X,Y,Z position of the printer.
37
+// for debugging purposes only, should be disabled by default
38
+#ifdef DEBUG_STEPS
39
+extern volatile long count_position[NUM_AXIS];
40
+extern volatile int count_direction[NUM_AXIS];
41
+#endif
42
+
43
+extern block_t *current_block;  // A pointer to the block currently being traced
44
+#endif

+ 16
- 13
Marlin/temperature.cpp Ver arquivo

@@ -90,14 +90,15 @@ void manage_heater()
90 90
   
91 91
   float pid_input;
92 92
   float pid_output;
93
-  if(temp_meas_ready == true) {
93
+  if(temp_meas_ready != true)   //better readability
94
+    return; 
94 95
 
95 96
 CRITICAL_SECTION_START;
96 97
     temp_meas_ready = false;
97 98
 CRITICAL_SECTION_END;
98 99
 
99 100
 #ifdef PIDTEMP
100
-    pid_input = analog2temp(current_raw[0]);
101
+    pid_input = analog2temp(current_raw[TEMPSENSOR_HOTEND]);
101 102
 
102 103
 #ifndef PID_OPENLOOP
103 104
     pid_error = pid_setpoint - pid_input;
@@ -118,10 +119,13 @@ CRITICAL_SECTION_END;
118 119
       temp_iState += pid_error;
119 120
       temp_iState = constrain(temp_iState, temp_iState_min, temp_iState_max);
120 121
       iTerm = Ki * temp_iState;
121
-      #define K1 0.95
122
+      //K1 defined in Configuration.h in the PID settings
122 123
       #define K2 (1.0-K1)
123 124
       dTerm = (Kd * (pid_input - temp_dState))*K2 + (K1 * dTerm);
124 125
       temp_dState = pid_input;
126
+      #ifdef PID_ADD_EXTRUSION_RATE
127
+        pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high
128
+      #endif
125 129
       pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX);
126 130
     }
127 131
 #endif //PID_OPENLOOP
@@ -157,7 +161,7 @@ CRITICAL_SECTION_END;
157 161
   previous_millis_bed_heater = millis();
158 162
   
159 163
   #if TEMP_1_PIN > -1
160
-    if(current_raw[1] >= target_raw[1])
164
+    if(current_raw[TEMPSENSOR_BED] >= target_raw[TEMPSENSOR_BED])
161 165
     {
162 166
       WRITE(HEATER_1_PIN,LOW);
163 167
     }
@@ -167,7 +171,6 @@ CRITICAL_SECTION_END;
167 171
     }
168 172
   #endif
169 173
   }
170
-}
171 174
 
172 175
 // Takes hot end temperature value as input and returns corresponding raw value. 
173 176
 // For a thermistor, it uses the RepRap thermistor temp table.
@@ -428,15 +431,15 @@ ISR(TIMER0_COMPB_vect)
428 431
     raw_temp_2_value = 0;
429 432
 #ifdef MAXTEMP
430 433
   #if (HEATER_0_PIN > -1)
431
-    if(current_raw[0] >= maxttemp) {
432
-      target_raw[0] = 0;
434
+    if(current_raw[TEMPSENSOR_HOTEND] >= maxttemp) {
435
+      target_raw[TEMPSENSOR_HOTEND] = 0;
433 436
       analogWrite(HEATER_0_PIN, 0);
434 437
       Serial.println("!! Temperature extruder 0 switched off. MAXTEMP triggered !!");
435 438
     }
436 439
   #endif
437 440
   #if (HEATER_2_PIN > -1)
438
-    if(current_raw[2] >= maxttemp) {
439
-      target_raw[2] = 0;
441
+    if(current_raw[TEMPSENSOR_AUX] >= maxttemp) {
442
+      target_raw[TEMPSENSOR_AUX] = 0;
440 443
       analogWrite(HEATER_2_PIN, 0);
441 444
       Serial.println("!! Temperature extruder 1 switched off. MAXTEMP triggered !!");
442 445
     }
@@ -444,15 +447,15 @@ ISR(TIMER0_COMPB_vect)
444 447
 #endif //MAXTEMP
445 448
 #ifdef MINTEMP
446 449
   #if (HEATER_0_PIN > -1)
447
-    if(current_raw[0] <= minttemp) {
448
-      target_raw[0] = 0;
450
+    if(current_raw[TEMPSENSOR_HOTEND] <= minttemp) {
451
+      target_raw[TEMPSENSOR_HOTEND] = 0;
449 452
       analogWrite(HEATER_0_PIN, 0);
450 453
       Serial.println("!! Temperature extruder 0 switched off. MINTEMP triggered !!");
451 454
     }
452 455
   #endif
453 456
   #if (HEATER_2_PIN > -1)
454
-    if(current_raw[2] <= minttemp) {
455
-      target_raw[2] = 0;
457
+    if(current_raw[TEMPSENSOR_AUX] <= minttemp) {
458
+      target_raw[TEMPSENSOR_AUX] = 0;
456 459
       analogWrite(HEATER_2_PIN, 0);
457 460
       Serial.println("!! Temperature extruder 1 switched off. MINTEMP triggered !!");
458 461
     }

+ 58
- 55
Marlin/temperature.h Ver arquivo

@@ -1,55 +1,58 @@
1
-/*
2
-  temperature.h - temperature controller
3
-  Part of Marlin
4
-
5
-  Copyright (c) 2011 Erik van der Zalm
6
-
7
-  Grbl is free software: you can redistribute it and/or modify
8
-  it under the terms of the GNU General Public License as published by
9
-  the Free Software Foundation, either version 3 of the License, or
10
-  (at your option) any later version.
11
-
12
-  Grbl is distributed in the hope that it will be useful,
13
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
-  GNU General Public License for more details.
16
-
17
-  You should have received a copy of the GNU General Public License
18
-  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
19
-*/
20
-
21
-#ifndef temperature_h
22
-#define temperature_h 
23
-
24
-void manage_inactivity(byte debug);
25
-
26
-void tp_init();
27
-void manage_heater();
28
-//int temp2analogu(int celsius, const short table[][2], int numtemps);
29
-//float analog2tempu(int raw, const short table[][2], int numtemps);
30
-float temp2analog(int celsius);
31
-float temp2analogBed(int celsius);
32
-float analog2temp(int raw);
33
-float analog2tempBed(int raw);
34
-
35
-#ifdef HEATER_USES_THERMISTOR
36
-    #define HEATERSOURCE 1
37
-#endif
38
-#ifdef BED_USES_THERMISTOR
39
-    #define BEDSOURCE 1
40
-#endif
41
-
42
-//#define temp2analogh( c ) temp2analogu((c),temptable,NUMTEMPS)
43
-//#define analog2temp( c ) analog2tempu((c),temptable,NUMTEMPS
44
-
45
-
46
-extern float Kp;
47
-extern float Ki;
48
-extern float Kd;
49
-extern float Kc;
50
-
51
-extern int target_raw[3];
52
-extern int current_raw[3];
53
-extern double pid_setpoint;
54
-
55
-#endif
1
+/*
2
+  temperature.h - temperature controller
3
+  Part of Marlin
4
+
5
+  Copyright (c) 2011 Erik van der Zalm
6
+
7
+  Grbl is free software: you can redistribute it and/or modify
8
+  it under the terms of the GNU General Public License as published by
9
+  the Free Software Foundation, either version 3 of the License, or
10
+  (at your option) any later version.
11
+
12
+  Grbl is distributed in the hope that it will be useful,
13
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+  GNU General Public License for more details.
16
+
17
+  You should have received a copy of the GNU General Public License
18
+  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
19
+*/
20
+
21
+#ifndef temperature_h
22
+#define temperature_h 
23
+
24
+#include "Marlin.h"
25
+#ifdef PID_ADD_EXTRUSION_RATE
26
+  #include "stepper.h"
27
+#endif
28
+void tp_init();
29
+void manage_heater();
30
+//int temp2analogu(int celsius, const short table[][2], int numtemps);
31
+//float analog2tempu(int raw, const short table[][2], int numtemps);
32
+float temp2analog(int celsius);
33
+float temp2analogBed(int celsius);
34
+float analog2temp(int raw);
35
+float analog2tempBed(int raw);
36
+
37
+#ifdef HEATER_USES_THERMISTOR
38
+    #define HEATERSOURCE 1
39
+#endif
40
+#ifdef BED_USES_THERMISTOR
41
+    #define BEDSOURCE 1
42
+#endif
43
+
44
+//#define temp2analogh( c ) temp2analogu((c),temptable,NUMTEMPS)
45
+//#define analog2temp( c ) analog2tempu((c),temptable,NUMTEMPS
46
+
47
+
48
+extern float Kp;
49
+extern float Ki;
50
+extern float Kd;
51
+extern float Kc;
52
+
53
+enum {TEMPSENSOR_HOTEND=0,TEMPSENSOR_BED=1, TEMPSENSOR_AUX=2};
54
+extern int target_raw[3];
55
+extern int current_raw[3];
56
+extern double pid_setpoint;
57
+
58
+#endif

+ 90
- 90
Marlin/thermistortables.h Ver arquivo

@@ -7,67 +7,67 @@
7 7
 
8 8
 #define NUMTEMPS_1 61
9 9
 const short temptable_1[NUMTEMPS_1][2] = {
10
-{	23*OVERSAMPLENR	,	300	},
11
-{	25*OVERSAMPLENR	,	295	},
12
-{	27*OVERSAMPLENR	,	290	},
13
-{	28*OVERSAMPLENR	,	285	},
14
-{	31*OVERSAMPLENR	,	280	},
15
-{	33*OVERSAMPLENR	,	275	},
16
-{	35*OVERSAMPLENR	,	270	},
17
-{	38*OVERSAMPLENR	,	265	},
18
-{	41*OVERSAMPLENR	,	260	},
19
-{	44*OVERSAMPLENR	,	255	},
20
-{	48*OVERSAMPLENR	,	250	},
21
-{	52*OVERSAMPLENR	,	245	},
22
-{	56*OVERSAMPLENR	,	240	},
23
-{	61*OVERSAMPLENR	,	235	},
24
-{	66*OVERSAMPLENR	,	230	},
25
-{	71*OVERSAMPLENR	,	225	},
26
-{	78*OVERSAMPLENR	,	220	},
27
-{	84*OVERSAMPLENR	,	215	},
28
-{	92*OVERSAMPLENR	,	210	},
29
-{	100*OVERSAMPLENR	,	205	},
30
-{	109*OVERSAMPLENR	,	200	},
31
-{	120*OVERSAMPLENR	,	195	},
32
-{	131*OVERSAMPLENR	,	190	},
33
-{	143*OVERSAMPLENR	,	185	},
34
-{	156*OVERSAMPLENR	,	180	},
35
-{	171*OVERSAMPLENR	,	175	},
36
-{	187*OVERSAMPLENR	,	170	},
37
-{	205*OVERSAMPLENR	,	165	},
38
-{	224*OVERSAMPLENR	,	160	},
39
-{	245*OVERSAMPLENR	,	155	},
40
-{	268*OVERSAMPLENR	,	150	},
41
-{	293*OVERSAMPLENR	,	145	},
42
-{	320*OVERSAMPLENR	,	140	},
43
-{	348*OVERSAMPLENR	,	135	},
44
-{	379*OVERSAMPLENR	,	130	},
45
-{	411*OVERSAMPLENR	,	125	},
46
-{	445*OVERSAMPLENR	,	120	},
47
-{	480*OVERSAMPLENR	,	115	},
48
-{	516*OVERSAMPLENR	,	110	},
49
-{	553*OVERSAMPLENR	,	105	},
50
-{	591*OVERSAMPLENR	,	100	},
51
-{	628*OVERSAMPLENR	,	95	},
52
-{	665*OVERSAMPLENR	,	90	},
53
-{	702*OVERSAMPLENR	,	85	},
54
-{	737*OVERSAMPLENR	,	80	},
55
-{	770*OVERSAMPLENR	,	75	},
56
-{	801*OVERSAMPLENR	,	70	},
57
-{	830*OVERSAMPLENR	,	65	},
58
-{	857*OVERSAMPLENR	,	60	},
59
-{	881*OVERSAMPLENR	,	55	},
60
-{	903*OVERSAMPLENR	,	50	},
61
-{	922*OVERSAMPLENR	,	45	},
62
-{	939*OVERSAMPLENR	,	40	},
63
-{	954*OVERSAMPLENR	,	35	},
64
-{	966*OVERSAMPLENR	,	30	},
65
-{	977*OVERSAMPLENR	,	25	},
66
-{	985*OVERSAMPLENR	,	20	},
67
-{	993*OVERSAMPLENR	,	15	},
68
-{	999*OVERSAMPLENR	,	10	},
69
-{	1004*OVERSAMPLENR	,	5	},
70
-{	1008*OVERSAMPLENR	,	0	} //safety
10
+{       23*OVERSAMPLENR ,       300     },
11
+{       25*OVERSAMPLENR ,       295     },
12
+{       27*OVERSAMPLENR ,       290     },
13
+{       28*OVERSAMPLENR ,       285     },
14
+{       31*OVERSAMPLENR ,       280     },
15
+{       33*OVERSAMPLENR ,       275     },
16
+{       35*OVERSAMPLENR ,       270     },
17
+{       38*OVERSAMPLENR ,       265     },
18
+{       41*OVERSAMPLENR ,       260     },
19
+{       44*OVERSAMPLENR ,       255     },
20
+{       48*OVERSAMPLENR ,       250     },
21
+{       52*OVERSAMPLENR ,       245     },
22
+{       56*OVERSAMPLENR ,       240     },
23
+{       61*OVERSAMPLENR ,       235     },
24
+{       66*OVERSAMPLENR ,       230     },
25
+{       71*OVERSAMPLENR ,       225     },
26
+{       78*OVERSAMPLENR ,       220     },
27
+{       84*OVERSAMPLENR ,       215     },
28
+{       92*OVERSAMPLENR ,       210     },
29
+{       100*OVERSAMPLENR        ,       205     },
30
+{       109*OVERSAMPLENR        ,       200     },
31
+{       120*OVERSAMPLENR        ,       195     },
32
+{       131*OVERSAMPLENR        ,       190     },
33
+{       143*OVERSAMPLENR        ,       185     },
34
+{       156*OVERSAMPLENR        ,       180     },
35
+{       171*OVERSAMPLENR        ,       175     },
36
+{       187*OVERSAMPLENR        ,       170     },
37
+{       205*OVERSAMPLENR        ,       165     },
38
+{       224*OVERSAMPLENR        ,       160     },
39
+{       245*OVERSAMPLENR        ,       155     },
40
+{       268*OVERSAMPLENR        ,       150     },
41
+{       293*OVERSAMPLENR        ,       145     },
42
+{       320*OVERSAMPLENR        ,       140     },
43
+{       348*OVERSAMPLENR        ,       135     },
44
+{       379*OVERSAMPLENR        ,       130     },
45
+{       411*OVERSAMPLENR        ,       125     },
46
+{       445*OVERSAMPLENR        ,       120     },
47
+{       480*OVERSAMPLENR        ,       115     },
48
+{       516*OVERSAMPLENR        ,       110     },
49
+{       553*OVERSAMPLENR        ,       105     },
50
+{       591*OVERSAMPLENR        ,       100     },
51
+{       628*OVERSAMPLENR        ,       95      },
52
+{       665*OVERSAMPLENR        ,       90      },
53
+{       702*OVERSAMPLENR        ,       85      },
54
+{       737*OVERSAMPLENR        ,       80      },
55
+{       770*OVERSAMPLENR        ,       75      },
56
+{       801*OVERSAMPLENR        ,       70      },
57
+{       830*OVERSAMPLENR        ,       65      },
58
+{       857*OVERSAMPLENR        ,       60      },
59
+{       881*OVERSAMPLENR        ,       55      },
60
+{       903*OVERSAMPLENR        ,       50      },
61
+{       922*OVERSAMPLENR        ,       45      },
62
+{       939*OVERSAMPLENR        ,       40      },
63
+{       954*OVERSAMPLENR        ,       35      },
64
+{       966*OVERSAMPLENR        ,       30      },
65
+{       977*OVERSAMPLENR        ,       25      },
66
+{       985*OVERSAMPLENR        ,       20      },
67
+{       993*OVERSAMPLENR        ,       15      },
68
+{       999*OVERSAMPLENR        ,       10      },
69
+{       1004*OVERSAMPLENR       ,       5       },
70
+{       1008*OVERSAMPLENR       ,       0       } //safety
71 71
 };
72 72
 #endif
73 73
 #if (THERMISTORHEATER_1 == 2) || (THERMISTORHEATER_2 == 2) || (THERMISTORBED == 2) //200k bed thermistor
@@ -100,35 +100,35 @@ const short temptable_2[NUMTEMPS_2][2] = {
100 100
 #if (THERMISTORHEATER_1 == 3) || (THERMISTORHEATER_2 == 3) || (THERMISTORBED == 3) //mendel-parts
101 101
 #define NUMTEMPS_3 28
102 102
 const short temptable_3[NUMTEMPS_3][2] = {
103
-		{1*OVERSAMPLENR,864},
104
-		{21*OVERSAMPLENR,300},
105
-		{25*OVERSAMPLENR,290},
106
-		{29*OVERSAMPLENR,280},
107
-		{33*OVERSAMPLENR,270},
108
-		{39*OVERSAMPLENR,260},
109
-		{46*OVERSAMPLENR,250},
110
-		{54*OVERSAMPLENR,240},
111
-		{64*OVERSAMPLENR,230},
112
-		{75*OVERSAMPLENR,220},
113
-		{90*OVERSAMPLENR,210},
114
-		{107*OVERSAMPLENR,200},
115
-		{128*OVERSAMPLENR,190},
116
-		{154*OVERSAMPLENR,180},
117
-		{184*OVERSAMPLENR,170},
118
-		{221*OVERSAMPLENR,160},
119
-		{265*OVERSAMPLENR,150},
120
-		{316*OVERSAMPLENR,140},
121
-		{375*OVERSAMPLENR,130},
122
-		{441*OVERSAMPLENR,120},
123
-		{513*OVERSAMPLENR,110},
124
-		{588*OVERSAMPLENR,100},
125
-		{734*OVERSAMPLENR,80},
126
-		{856*OVERSAMPLENR,60},
127
-		{938*OVERSAMPLENR,40},
128
-		{986*OVERSAMPLENR,20},
129
-		{1008*OVERSAMPLENR,0},
130
-		{1018*OVERSAMPLENR,-20}
131
-	};
103
+                {1*OVERSAMPLENR,864},
104
+                {21*OVERSAMPLENR,300},
105
+                {25*OVERSAMPLENR,290},
106
+                {29*OVERSAMPLENR,280},
107
+                {33*OVERSAMPLENR,270},
108
+                {39*OVERSAMPLENR,260},
109
+                {46*OVERSAMPLENR,250},
110
+                {54*OVERSAMPLENR,240},
111
+                {64*OVERSAMPLENR,230},
112
+                {75*OVERSAMPLENR,220},
113
+                {90*OVERSAMPLENR,210},
114
+                {107*OVERSAMPLENR,200},
115
+                {128*OVERSAMPLENR,190},
116
+                {154*OVERSAMPLENR,180},
117
+                {184*OVERSAMPLENR,170},
118
+                {221*OVERSAMPLENR,160},
119
+                {265*OVERSAMPLENR,150},
120
+                {316*OVERSAMPLENR,140},
121
+                {375*OVERSAMPLENR,130},
122
+                {441*OVERSAMPLENR,120},
123
+                {513*OVERSAMPLENR,110},
124
+                {588*OVERSAMPLENR,100},
125
+                {734*OVERSAMPLENR,80},
126
+                {856*OVERSAMPLENR,60},
127
+                {938*OVERSAMPLENR,40},
128
+                {986*OVERSAMPLENR,20},
129
+                {1008*OVERSAMPLENR,0},
130
+                {1018*OVERSAMPLENR,-20}
131
+        };
132 132
 
133 133
 #endif
134 134
 #if (THERMISTORHEATER_1 == 4) || (THERMISTORHEATER_2 == 4) || (THERMISTORBED == 4) //10k thermistor

+ 1
- 1
Marlin/ultralcd.h Ver arquivo

@@ -153,4 +153,4 @@
153 153
 #define BLOCK ;
154 154
 #endif 
155 155
 #endif //ULTRALCD
156
-
156
+

+ 1593
- 1593
Marlin/ultralcd.pde
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 29
- 35
README Ver arquivo

@@ -1,7 +1,14 @@
1
-This firmware is a mashup between Sprinter, grbl and many original parts.
1
+This RepRap firmware is a mashup between Sprinter, grbl and many original parts.
2 2
  (https://github.com/kliment/Sprinter)
3 3
  (https://github.com/simen/grbl/tree)
4 4
 
5
+Derived from Sprinter and Grbl by Erik van der Zalm.
6
+Sprinters lead developers are Kliment and caru.
7
+Grbls lead developer is Simen Svale Skogsrud.
8
+It has been adapted to the Ultimaker Printer by:
9
+Bernhard Kubicek, Matthijs Keuper, Bradley Feldman, and others...
10
+
11
+
5 12
 Features:
6 13
  - Interrupt based movement with real linear acceleration
7 14
  - High steprate
@@ -9,62 +16,49 @@ Features:
9 16
  - Interrupt based temperature protection
10 17
  - preliminary support for Matthew Roberts advance algorithm 
11 18
    For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
19
+ - Full endstop support
20
+ - Simple LCD support (16x2)
21
+ - SD Card support
22
+ - Provisions for Bernhard Kubicek's new hardware control console and 20x4 lcd
23
+
24
+This firmware is optimized for Ultimaker's gen6 electronics (including the Ultimaker 1.5.x daughterboard and Arduino Mega 2560).
12 25
 
13
-This firmware is optimized for gen6 electronics.
26
+The default baudrate is 115200. 
14 27
 
15
-The default baudrate is 250000. 
16
-This gives less communication errors then regular baudrates.
17 28
 
18 29
 ========================================================================================
19 30
 
20 31
 Configuring and compilation
21 32
 
22 33
 
23
-Install the arduino software version 0018
34
+Install the latest arduino software IDE/toolset (currently 0022)
24 35
    http://www.arduino.cc/en/Main/Software
25 36
 
26
-Install the sanguino software, version 0018
27
-   http://sanguino.cc/useit
37
+Install Ultimaker's RepG 25 build
38
+    http://software.ultimaker.com
39
+(or alternatively install Kliment's printrun/pronterface  https://github.com/kliment/Printrun_)
28 40
 
29
-Install pronterface
30
-   https://github.com/kliment/Printrun
31
-
32
-Copy the Marlin firmware
33
-   https:/github.com/ErikZalm/Marlin
41
+Copy the Ultimaker Marlin firmware
42
+   https:/github.com/bkubicek/Marlin
34 43
    (Use the download button)
35 44
 
36 45
 Start the arduino IDE.
37
-Select Tools -> Board -> Sanguino 
46
+Select Tools -> Board -> Arduino Mega 2560 
38 47
 Select the correct serial port in Tools ->Serial Port
39 48
 Open Marlin.pde
40 49
 
41
-Change the printer specific setting in Configuration.h to the correct values.
42
-
43
-The following values are the most important:
44
- - float axis_steps_per_unit[]....         // Set the correct steps / mm in the corresponding field
45
- - const bool ENDSTOPS_INVERTING = false;  // Change if only positive moves are executed
46
- - #define INVERT_x_DIR true               // Change if the motor direction is wrong
50
+Click the Verify/Compile button
47 51
 
48 52
 Click the Upload button
49 53
 If all goes well the firmware is uploading
50 54
 
51
-Start pronterface
52
-
53
-Select the correct Serial Port. Type 250000 in the baudrate field.
54
-Press the Connect button
55
-
56
-===============================================================================================
57
-Known issues
58
-
59
-On some systems we get compilation errors.
60
-
61
-This is caused by the "wiring_serial.c" and "wiring.c".
62
-The simple fix is to delete these files but this may have a performance impact.
63
-
64
-The best workaround is to move these files to sanguino directory. 
65
-(".../arduino-0018/hardware/Sanguino/cores/arduino/" on windows systems)
66
-
55
+Start Ultimaker's Custom RepG 25
56
+Make sure Show Experimental Profiles is enabled in Preferences
57
+Select Sprinter as the Driver
67 58
 
59
+Press the Connect button.
68 60
 
61
+KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
69 62
 
63
+That's ok.  Enjoy Silky Smooth Printing.
70 64
 

+ 69
- 0
README.md Ver arquivo

@@ -0,0 +1,69 @@
1
+WARNING: THIS IN A PROCESS OF HEAVY OVERWORKING.
2
+DO NOT USE THIS ON YOUR MACHINE UNTIL FURTHER NOTICE!!!
3
+
4
+===========================================
5
+
6
+This RepRap firmware is a mashup between <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/simen/grbl/tree">grbl</a> and many original parts.
7
+
8
+Derived from Sprinter and Grbl by Erik van der Zalm.
9
+Sprinters lead developers are Kliment and caru.
10
+Grbls lead developer is Simen Svale Skogsrud.
11
+Some features have been added by and configuration has been added by:
12
+Bernhard Kubicek, Matthijs Keuper, Bradley Feldman, and others...
13
+
14
+
15
+Features:
16
+ - Interrupt based movement with real linear acceleration
17
+ - High steprate
18
+ - Look ahead (Keep the speed high when possible. High cornering speed)
19
+ - Interrupt based temperature protection
20
+ - preliminary support for Matthew Roberts advance algorithm 
21
+   For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
22
+ - Full endstop support
23
+ - Simple LCD support (16x2)
24
+ - SD Card support
25
+ - Provisions for Bernhard Kubicek's new hardware control console and 20x4 lcd
26
+
27
+This firmware is optimized for Ultimaker's gen6 electronics (including the Ultimaker 1.5.x daughterboard and Arduino Mega 2560).
28
+
29
+The default baudrate is 115200. 
30
+
31
+
32
+========================================================================================
33
+
34
+Configuring and compilation
35
+
36
+
37
+Install the latest arduino software IDE/toolset (currently 0022)
38
+   http://www.arduino.cc/en/Main/Software
39
+
40
+Install Ultimaker's RepG 25 build
41
+    http://software.ultimaker.com
42
+(or alternatively install Kliment's printrun/pronterface  https://github.com/kliment/Printrun_)
43
+
44
+Copy the Ultimaker Marlin firmware
45
+   https:/github.com/bkubicek/Marlin
46
+   (Use the download button)
47
+
48
+Start the arduino IDE.
49
+Select Tools -> Board -> Arduino Mega 2560 
50
+Select the correct serial port in Tools ->Serial Port
51
+Open Marlin.pde
52
+
53
+Click the Verify/Compile button
54
+
55
+Click the Upload button
56
+If all goes well the firmware is uploading
57
+
58
+Start Ultimaker's Custom RepG 25
59
+Make sure Show Experimental Profiles is enabled in Preferences
60
+Select Sprinter as the Driver
61
+
62
+Press the Connect button.
63
+
64
+KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
65
+
66
+That's ok.  Enjoy Silky Smooth Printing.
67
+
68
+
69
+

+ 58
- 0
merging still needs.txt Ver arquivo

@@ -0,0 +1,58 @@
1
+files to compare manually:
2
+planner.cpp
3
+stepper.cpp
4
+temperature.cpp
5
+
6
+---
7
+things that changed:
8
+* planner.cpp
9
+estimate_acc_distance now works with floats.
10
+in calculate_trapezoid:for_block
11
+ long acceleration_rate=(long)((float)acceleration*8.388608) is gone
12
+ so is block_>acceleration_rate
13
+void planner_reverse_pass:
14
+ some stuff I don't understand right now changed
15
+in planner_forward_pass:
16
+ done: BLOCK_BUFFER_SIZE is now necessarily power of 2 (aka 8 16, 32). Inportant to document this somewhere.
17
+no more inline in void plan_discard_current_block()
18
+no more inline in plan_get_current_block()
19
+in plan_buffer_line(...)
20
+ the long target[4]; and calculations of thoose should go after the while(block_buffer_tail==..). if the axis_steps_per_unit are changed from the gcode (M92) the calculation for the currently planned buffer move will be corrupt, because Target is calculated with one value, and the stuff afterwards with another. At least this solved the problem I had with the M92 E* changes in the code. Very sure about this, I took me 20min to find this as the solution for the bug I was hunting.
21
+around if(feed_rate<minimumfeedrate) this only should be done if it is not a pure extrusion. I think there is a bug right now.
22
+~line 447 blockcount= 
23
+ not sure if this also works if the difference is negative, as it would happen if the ringbuffer runs over the end and start at 0.
24
+~line 507 tmp_aceleration. not sure whats going on, but a lot changed.
25
+
26
+
27
+* stepper.cpp
28
+~214: if (busy) should be a echoln, maybe
29
+~331: great, The Z_M_PIN checks are in :)
30
+
31
+*temperature.cpp
32
+done: enum for heater, bed,
33
+manage_heater() is seriously different.
34
+  done: if tem_meas_ready ==true->!true+return?
35
+done #define K1 0.95 maybe in the configuration.h?
36
+semi-done: PID-C checking needed. Untested but added.
37
+----
38
+
39
+still needed to finish the merge, before testin!
40
+
41
+ manage_heater
42
+ ISR
43
+ movement planner
44
+
45
+TODO:
46
+
47
+remove traveling at maxpseed
48
+remove Simplelcd
49
+
50
+remove DEBUG_STEPS?
51
+
52
+block_t
53
+pid_dt ->0.1  whats the changes to the PID, checking needed
54
+
55
+
56
+----
57
+second merge saturday morning:
58
+done: PID_dt->0.1

Carregando…
Cancelar
Salvar