Marlin.ino

Sat, 07 Nov 2015 13:23:07 +0100

author
mbayer
date
Sat, 07 Nov 2015 13:23:07 +0100
changeset 0
2c8ba1964db7
child 1
b584642d4f58
permissions
-rw-r--r--

Initial code from reprappro Marlin repository

0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1 /*
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2 Reprap firmware based on Sprinter and grbl.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
3 Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
4
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
7 the Free Software Foundation, either version 3 of the License, or
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
8 (at your option) any later version.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
9
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
13 GNU General Public License for more details.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
14
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
17 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
18
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
19 /*
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
20 This firmware is a mashup between Sprinter and grbl.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
21 (https://github.com/kliment/Sprinter)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
22 (https://github.com/simen/grbl/tree)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
23
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
24 It has preliminary support for Matthew Roberts advance algorithm
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
25 http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
26 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
27
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
28 /*
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
29 RepRapPro ammendations, deletions and additions
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
30
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
31 G10, M0, M1, M112 and T commands added/modified by AB 18/7/12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
32 Much conditional-compiled code for old/unused hardware removed - AB 29/7/12
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
33
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
34 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
35
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
36 /*
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
37 NeoSoft modifications:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
38
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
39 Implement:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
40 - M571 to enable PWM on extruder Movement (laser modulation support), second E parameter to disable real E drive
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
41 - MXXX to enable Emergency Stop button (if disabled the button can be used to programmatically pause the lasercut for user interaction. For example:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
42 move to bottom left of print rectangle, ask user to align workpiece (wait for button press), then move to bottom right and ask user to align the other workpiece end, wait for button press to start engraving...
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
43
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
44 EXT PINS:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
45 30, 29,28 = EXT1-3, 27=EXT4=LED
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
46
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
47 M571 pin default to EXT3 (PIN 28) in pins.h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
48
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
49 Emergency Stop (PAUSE) button on EXT2 (PIN 29):
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
50 If not stopped: call stop()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
51 If stopped: execute code from M999 Command (do not inject M999, execute the code!)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
52 // bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
53 //pinMode(inPin, INPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
54
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
55 alternative approach (better?):
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
56 make copy of "void enquecommand(const char *cmd)" with following behaviour:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
57 - pause serial receiver enqueueing (the irq should respond like "buffer full")
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
58 - call alternative of stop() which memorizes the last PROCESSED line?
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
59 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
60
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
61 #include "Marlin.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
62
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
63 #include "ultralcd.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
64 #include "led.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
65 #include "z_probe.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
66 #include "FPUTransform.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
67 #include "planner.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
68 #include "stepper.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
69 #include "temperature.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
70 #include "motion_control.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
71 #include "cardreader.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
72 #include "EEPROMwrite.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
73 #include "language.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
74 #include "pins_arduino.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
75 #include "slave_comms.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
76
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
77 #define VERSION_STRING "1.0.2 RRP/NeoSoft"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
78
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
79 // look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
80 // http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
81
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
82 //Implemented Codes
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
83 //-------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
84 // G0 -> G1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
85 // G1 - Coordinated Movement X Y Z E
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
86 // G2 - CW ARC
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
87 // G3 - CCW ARC
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
88 // G4 - Dwell S<seconds> or P<milliseconds>
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
89 // G10 - set head offset and temps
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
90 // G28 - Home all Axis
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
91 // G29 - Detailed Z-Probe (3 location test)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
92 // G30 - Single Z Probe (probe current location)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
93 // G31 - Report Curent Probe status
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
94 // G32 - Probe Z and calibrate with FPU
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
95 // G90 - Use Absolute Coordinates
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
96 // G91 - Use Relative Coordinates
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
97 // G92 - Set current position to cordinates given
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
98
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
99 //RepRap M Codes
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
100 // M104 - Set extruder target temp (deprecated)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
101 // M105 - Read current temp
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
102 // M106 - Fan on
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
103 // M107 - Fan off
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
104 // M109 - Wait for extruder current temp to reach target temp. (deprecated)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
105 // M114 - Display current position
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
106
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
107 //Custom M Codes
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
108 // M17 - Enable/Power all stepper motors
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
109 // M18 - Disable all stepper motors; same as M84
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
110 // M20 - List SD card
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
111 // M21 - Init SD card
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
112 // M22 - Release SD card
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
113 // M23 - Select SD file (M23 filename.g)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
114 // M24 - Start/resume SD print
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
115 // M25 - Pause SD print
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
116 // M26 - Set SD position in bytes (M26 S12345)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
117 // M27 - Report SD print status
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
118 // M28 - Start SD write (M28 filename.g)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
119 // M29 - Stop SD write
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
120 // M30 - Fast SD transfer
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
121 // M31 - high speed xfer capabilities
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
122 // M35 - Output time since last M109 or SD card start to serial
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
123
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
124 // M42 - Change pin status via gcode
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
125 // M82 - Set E codes absolute (default)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
126 // M83 - Set E codes relative while in Absolute Coordinates (G90) mode
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
127 // M84 - Disable steppers until next move,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
128 // or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
129 // M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
130 // M92 - Set axis_steps_per_unit - same syntax as G92
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
131 // M114 - Output current position to serial port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
132 // M115 - Capabilities string
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
133 // M117 - display message
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
134 // M119 - Output Endstop status to serial port
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
135 // M140 - Set bed target temp
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
136 // M190 - Wait for bed current temp to reach target temp.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
137 // M200 - Set filament diameter
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
138 // M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
139 // M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
140 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
141 // M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
142 // M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
143 // M206 - set additional homeing offset
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
144 // M208 - set axis max length
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
145 // M220 S<factor in percent>- set speed factor override percentage
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
146 // M221 S<factor in percent>- set extrude factor override percentage
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
147 // M240 - Trigger a camera to take a photograph
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
148 // M301 - Set PID parameters P I D and W
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
149 // M302 - S1 Allow cold extrudes, S0 cold extrues not allowed (default)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
150 // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
151 // M304 - Set thermistor parameters
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
152 // M400 - Finish all moves
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
153 // M500 - stores paramters in EEPROM
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
154 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
155 // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
156 // M503 - print the current settings (from memory not from eeprom)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
157 // M510 - FPU Enable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
158 // M511 - FPU Reset
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
159 // M512 - FPU Disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
160 // M999 - Restart after being stopped by error
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
161
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
162 // M555 - Temporary: master/slave comms test
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
163
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
164 // TN - Select extruder N
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
165
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
166 //Stepper Movement Variables
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
167
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
168 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
169 //=============================imported variables============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
170 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
171
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
172
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
173 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
174 //=============================public variables=============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
175 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
176 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
177 CardReader card;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
178 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
179 float homing_feedrate[] = HOMING_FEEDRATE;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
180 float fast_home_feedrate[] = FAST_HOME_FEEDRATE;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
181 bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
182 volatile int feedmultiply=100; //100->1 200->2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
183 int saved_feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
184 volatile bool feedmultiplychanged=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
185 volatile int extrudemultiply=100; //100->1 200->2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
186 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
187 float add_homeing[3]={0,0,0};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
188 float max_length[] = AXES_MAX_LENGTHS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
189 #ifdef ADVANCE
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
190 float advance_k = EXTRUDER_ADVANCE_K;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
191 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
192 uint8_t active_extruder = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
193 float extruder_x_off[EXTRUDERS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
194 float extruder_y_off[EXTRUDERS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
195 float extruder_z_off[EXTRUDERS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
196 float extruder_standby[EXTRUDERS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
197 float extruder_temperature[EXTRUDERS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
198 float x_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
199 float y_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
200 float z_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
201 float temp_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
202 bool extruder_selected=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
203
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
204
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
205 unsigned char FanSpeed=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
206 bool m571_enabled = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
207 bool n571_enabled = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
208
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
209 float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
210 float offset[3] = {0.0, 0.0, 0.0};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
211 float feedrate = 1500.0, next_feedrate, saved_feedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
212
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
213 // used by FPU transform code
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
214 float modified_destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
215
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
216 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
217 //=============================private variables=============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
218 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
219 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
220 static bool home_all_axis = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
221 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
222
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
223 static bool relative_mode = false; //Determines Absolute or Relative Coordinates
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
224 static bool relative_mode_e = false; //Determines Absolute or Relative E Codes while in Absolute Coordinates mode. E is always relative in Relative Coordinates mode.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
225
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
226 static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
227 static bool fromsd[BUFSIZE];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
228 static int bufindr = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
229 static int bufindw = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
230 static int buflen = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
231 //static int i = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
232 static char serial_char;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
233 static int serial_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
234 static boolean comment_mode = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
235 static char *strchr_pointer; // just a pointer to find chars in the cmd string like X, Y, Z, E, etc
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
236
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
237 const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
238
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
239 //static float tt = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
240 //static float bt = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
241
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
242 //Inactivity shutdown variables
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
243 static unsigned long previous_millis_cmd = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
244 static unsigned long max_inactive_time = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
245 static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
246
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
247 static unsigned long starttime=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
248 static unsigned long stoptime=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
249
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
250 static uint8_t tmp_extruder;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
251
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
252
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
253 bool Stopped=false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
254
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
255 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
256 //=============================ROUTINES=============================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
257 //===========================================================================
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
258
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
259 void get_arc_coordinates();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
260
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
261 extern "C"{
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
262 extern unsigned int __bss_end;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
263 extern unsigned int __heap_start;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
264 extern void *__brkval;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
265
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
266 int freeMemory() {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
267 int free_memory;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
268
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
269 if((int)__brkval == 0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
270 free_memory = ((int)&free_memory) - ((int)&__bss_end);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
271 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
272 free_memory = ((int)&free_memory) - ((int)__brkval);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
273
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
274 return free_memory;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
275 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
276 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
277
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
278 //adds an command to the main command buffer
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
279 //thats really done in a non-safe way.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
280 //needs overworking someday
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
281 void enquecommand(const char *cmd)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
282 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
283 if(buflen < BUFSIZE)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
284 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
285 //this is dangerous if a mixing of serial and this happsens
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
286 strcpy(&(cmdbuffer[bufindw][0]),cmd);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
287 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
288 SERIAL_ECHOPGM("enqueing \"");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
289 SERIAL_ECHO(cmdbuffer[bufindw]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
290 SERIAL_ECHOLNPGM("\"");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
291 bufindw= (bufindw + 1)%BUFSIZE;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
292 buflen += 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
293 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
294 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
295
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
296 void setup_photpin()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
297 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
298 #ifdef PHOTOGRAPH_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
299 #if (PHOTOGRAPH_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
300 SET_OUTPUT(PHOTOGRAPH_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
301 WRITE(PHOTOGRAPH_PIN, LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
302 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
303 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
304 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
305
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
306 void setup_powerhold()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
307 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
308 #ifdef SUICIDE_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
309 #if (SUICIDE_PIN> -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
310 SET_OUTPUT(SUICIDE_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
311 WRITE(SUICIDE_PIN, HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
312 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
313 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
314 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
315
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
316 void suicide()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
317 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
318 #ifdef SUICIDE_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
319 #if (SUICIDE_PIN> -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
320 SET_OUTPUT(SUICIDE_PIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
321 WRITE(SUICIDE_PIN, LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
322 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
323 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
324 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
325
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
326 void setup()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
327 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
328 setup_powerhold();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
329 MYSERIAL.begin(BAUDRATE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
330 SERIAL_PROTOCOLLNPGM("start");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
331 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
332
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
333 for(int8_t i = 0; i < EXTRUDERS; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
334 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
335 extruder_x_off[i] = X_EXTRUDER_OFFSET;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
336 extruder_y_off[i] = Y_EXTRUDER_OFFSET;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
337 extruder_z_off[i] = Z_EXTRUDER_OFFSET;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
338 extruder_standby[i] = STANDBY_TEMP;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
339 extruder_temperature[i] = DEFAULT_TEMP;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
340 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
341
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
342
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
343 // Check startup - does nothing if bootloader sets MCUSR to 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
344 byte mcu = MCUSR;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
345 if(mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
346 if(mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
347 if(mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
348 if(mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
349 if(mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
350 MCUSR=0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
351
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
352 SERIAL_ECHOPGM(MSG_MARLIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
353 SERIAL_ECHOLNPGM(VERSION_STRING);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
354 #ifdef STRING_VERSION_CONFIG_H
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
355 #ifdef STRING_CONFIG_H_AUTHOR
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
356 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
357 SERIAL_ECHOPGM(MSG_CONFIGURATION_VER);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
358 SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
359 SERIAL_ECHOPGM(MSG_AUTHOR);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
360 SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
361 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
362 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
363 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
364 SERIAL_ECHOPGM(MSG_FREE_MEMORY);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
365 SERIAL_ECHO(freeMemory());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
366 SERIAL_ECHOPGM(MSG_PLANNER_BUFFER_BYTES);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
367 SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
368 for(int8_t i = 0; i < BUFSIZE; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
369 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
370 fromsd[i] = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
371 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
372
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
373 EEPROM_RetrieveSettings(); // loads data from EEPROM if available
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
374
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
375 for(int8_t i=0; i < NUM_AXIS; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
376 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
377 axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
378 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
379
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
380
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
381 tp_init(); // Initialize temperature loop
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
382 plan_init(); // Initialize planner;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
383 st_init(); // Initialize stepper;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
384 #if (LED_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
385 led_init();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
386 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
387 probe_init(); //Initializes probe if PROBE_PIN is defined
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
388 FPUTransform_init(); //Initializes FPU when UMFPUSUPPORT defined
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
389 setup_photpin();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
390
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
391 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
392 setup_slave();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
393 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
394
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
395 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
396
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
397
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
398 void loop()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
399 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
400 if(buflen < (BUFSIZE-1))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
401 get_command();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
402 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
403 card.checkautostart(false);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
404 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
405 if(buflen)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
406 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
407 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
408 if(card.saving)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
409 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
410 if(strstr(cmdbuffer[bufindr],"M29") == NULL)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
411 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
412 card.write_command(cmdbuffer[bufindr]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
413 SERIAL_PROTOCOLLNPGM(MSG_OK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
414 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
415 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
416 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
417 card.closefile();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
418 SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
419 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
420 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
421 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
422 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
423 process_commands();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
424 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
425 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
426 process_commands();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
427 #endif //SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
428 buflen = (buflen-1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
429 bufindr = (bufindr + 1)%BUFSIZE;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
430 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
431 //check heater every n milliseconds
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
432 manage_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
433 manage_inactivity(1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
434 checkHitEndstops();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
435 LCD_STATUS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
436 LED_STATUS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
437 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
438
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
439 void get_command()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
440 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
441 while( MYSERIAL.available() > 0 && buflen < BUFSIZE) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
442 serial_char = MYSERIAL.read();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
443 if(serial_char == '\n' ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
444 serial_char == '\r' ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
445 (serial_char == ':' && comment_mode == false) ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
446 serial_count >= (MAX_CMD_SIZE - 1) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
447 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
448 if(!serial_count) { //if empty line
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
449 comment_mode = false; //for new command
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
450 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
451 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
452 cmdbuffer[bufindw][serial_count] = 0; //terminate string
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
453 if(!comment_mode){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
454 comment_mode = false; //for new command
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
455 fromsd[bufindw] = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
456 if(strstr(cmdbuffer[bufindw], "N") != NULL)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
457 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
458 strchr_pointer = strchr(cmdbuffer[bufindw], 'N');
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
459 gcode_N = (strtol(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL, 10));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
460 if(gcode_N != gcode_LastN+1 && (strstr(cmdbuffer[bufindw], "M110") == NULL) ) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
461 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
462 SERIAL_ERRORPGM(MSG_ERR_LINE_NO);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
463 SERIAL_ERRORLN(gcode_LastN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
464 //Serial.println(gcode_N);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
465 FlushSerialRequestResend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
466 serial_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
467 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
468 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
469
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
470 if(strstr(cmdbuffer[bufindw], "*") != NULL)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
471 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
472 byte checksum = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
473 byte count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
474 while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
475 strchr_pointer = strchr(cmdbuffer[bufindw], '*');
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
476
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
477 if( (int)(strtod(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL)) != checksum) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
478 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
479 SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
480 SERIAL_ERRORLN(gcode_LastN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
481 FlushSerialRequestResend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
482 serial_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
483 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
484 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
485 //if no errors, continue parsing
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
486 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
487 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
488 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
489 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
490 SERIAL_ERRORPGM(MSG_ERR_NO_CHECKSUM);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
491 SERIAL_ERRORLN(gcode_LastN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
492 FlushSerialRequestResend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
493 serial_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
494 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
495 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
496
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
497 gcode_LastN = gcode_N;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
498 //if no errors, continue parsing
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
499 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
500 else // if we don't receive 'N' but still see '*'
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
501 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
502 if((strstr(cmdbuffer[bufindw], "*") != NULL))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
503 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
504 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
505 SERIAL_ERRORPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
506 SERIAL_ERRORLN(gcode_LastN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
507 serial_count = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
508 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
509 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
510 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
511 if((strstr(cmdbuffer[bufindw], "G") != NULL)){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
512 strchr_pointer = strchr(cmdbuffer[bufindw], 'G');
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
513 switch((int)((strtod(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL)))){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
514 case 0:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
515 case 1:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
516 case 2:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
517 case 3:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
518 if(Stopped == false) { // If printer is stopped by an error the G[0-3] codes are ignored.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
519 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
520 if(card.saving)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
521 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
522 #endif //SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
523 SERIAL_PROTOCOLLNPGM(MSG_OK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
524 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
525 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
526 SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
527 LCD_MESSAGEPGM(MSG_STOPPED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
528 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
529 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
530 default:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
531 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
532 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
533
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
534 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
535 bufindw = (bufindw + 1)%BUFSIZE;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
536 buflen += 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
537 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
538 serial_count = 0; //clear buffer
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
539 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
540 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
541 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
542 if(serial_char == ';') comment_mode = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
543 if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
544 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
545 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
546 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
547 if(!card.sdprinting || serial_count!=0){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
548 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
549 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
550 while( !card.eof() && buflen < BUFSIZE) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
551 int16_t n=card.get();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
552 serial_char = (char)n;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
553 if(serial_char == '\n' ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
554 serial_char == '\r' ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
555 (serial_char == ':' && comment_mode == false) ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
556 serial_count >= (MAX_CMD_SIZE - 1)||n==-1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
557 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
558 if(card.eof()){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
559 SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
560 stoptime=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
561 char time[30];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
562 unsigned long t=(stoptime-starttime)/1000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
563 int sec,min;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
564 min=t/60;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
565 sec=t%60;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
566 sprintf(time,"%i min, %i sec",min,sec);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
567 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
568 SERIAL_ECHOLN(time);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
569 LCD_MESSAGE(time);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
570 card.printingHasFinished();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
571 card.checkautostart(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
572
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
573 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
574 if(!serial_count)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
575 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
576 comment_mode = false; //for new command
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
577 return; //if empty line
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
578 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
579 cmdbuffer[bufindw][serial_count] = 0; //terminate string
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
580 // if(!comment_mode){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
581 fromsd[bufindw] = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
582 buflen += 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
583 bufindw = (bufindw + 1)%BUFSIZE;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
584 // }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
585 comment_mode = false; //for new command
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
586 serial_count = 0; //clear buffer
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
587 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
588 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
589 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
590 if(serial_char == ';') comment_mode = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
591 if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
592 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
593 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
594
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
595 #endif //SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
596
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
597 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
598
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
599
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
600 float code_value()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
601 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
602 return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
603 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
604
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
605 long code_value_long()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
606 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
607 return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
608 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
609
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
610 bool code_seen(char code_string[]) //Return True if the string was found
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
611 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
612 return (strstr(cmdbuffer[bufindr], code_string) != NULL);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
613 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
614
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
615 bool code_seen(char code)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
616 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
617 strchr_pointer = strchr(cmdbuffer[bufindr], code);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
618 return (strchr_pointer != NULL); //Return True if a character was found
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
619 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
620
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
621 #define HOMEAXIS(LETTER) \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
622 if ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
623 { \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
624 current_position[LETTER##_AXIS] = 0; \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
625 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
626 destination[LETTER##_AXIS] = 1.1 * max_length[LETTER##_AXIS] * LETTER##_HOME_DIR; \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
627 feedrate = fast_home_feedrate[LETTER##_AXIS]; \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
628 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
629 st_synchronize();\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
630 \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
631 current_position[LETTER##_AXIS] = 0;\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
632 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
633 destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
634 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
635 st_synchronize();\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
636 \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
637 destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
638 feedrate = homing_feedrate[LETTER##_AXIS] ; \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
639 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
640 st_synchronize();\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
641 \
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
642 current_position[LETTER##_AXIS] = LETTER##_HOME_POS;\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
643 destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
644 feedrate = 0.0;\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
645 endstops_hit_on_purpose();\
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
646 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
647
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
648 void wait_for_temp(uint8_t& t_ext, unsigned long& codenum)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
649 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
650 /* See if we are heating up or cooling down */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
651 bool target_direction = isHeatingHotend(t_ext); // true if heating, false if cooling
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
652
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
653 #ifdef TEMP_RESIDENCY_TIME
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
654 long residencyStart;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
655 residencyStart = -1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
656 /* continue to loop until we have reached the target temp
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
657 _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
658 while((residencyStart == -1) ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
659 (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
660 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
661 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
662 while ( target_direction ? (isHeatingHotend(t_ext)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
663 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
664 #endif //TEMP_RESIDENCY_TIME
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
665 if( (millis() - codenum) > 1000UL )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
666 { //Print Temp Reading and remaining time every 1 second while heating up/cooling down
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
667 SERIAL_PROTOCOLPGM("T:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
668 SERIAL_PROTOCOL_F(degHotend(t_ext),1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
669 SERIAL_PROTOCOLPGM(" E:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
670 SERIAL_PROTOCOL( (int)t_ext );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
671 #ifdef TEMP_RESIDENCY_TIME
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
672 SERIAL_PROTOCOLPGM(" W:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
673 if(residencyStart > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
674 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
675 codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
676 SERIAL_PROTOCOLLN( codenum );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
677 } else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
678 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
679 SERIAL_PROTOCOLLN( "?" );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
680 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
681 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
682 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
683 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
684 codenum = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
685 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
686 manage_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
687 manage_inactivity(1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
688 lcd_status();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
689 led_status();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
690 #ifdef TEMP_RESIDENCY_TIME
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
691 /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
692 or when current temp falls outside the hysteresis after target temp was reached */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
693 if ((residencyStart == -1 && target_direction && (degHotend(t_ext) >= (degTargetHotend(t_ext)-TEMP_WINDOW))) ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
694 (residencyStart == -1 && !target_direction && (degHotend(t_ext) <= (degTargetHotend(t_ext)+TEMP_WINDOW))) ||
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
695 (residencyStart > -1 && labs(degHotend(t_ext) - degTargetHotend(t_ext)) > TEMP_HYSTERESIS) )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
696 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
697 residencyStart = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
698 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
699 #endif //TEMP_RESIDENCY_TIME
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
700 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
701 LCD_MESSAGEPGM(MSG_HEATING_COMPLETE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
702 starttime=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
703 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
704 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
705
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
706
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
707 void process_commands()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
708 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
709 unsigned long codenum; //throw away variable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
710 char *starpos = NULL;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
711
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
712 if(code_seen('G'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
713 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
714 switch((int)code_value())
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
715 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
716 case 0: // G0 -> G1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
717 case 1: // G1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
718 if(Stopped == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
719 get_coordinates(); // For X Y Z E F
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
720 prepare_move();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
721 //ClearToSend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
722 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
723 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
724 //break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
725 case 2: // G2 - CW ARC
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
726 if(Stopped == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
727 get_arc_coordinates();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
728 prepare_arc_move(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
729 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
730 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
731 case 3: // G3 - CCW ARC
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
732 if(Stopped == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
733 get_arc_coordinates();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
734 prepare_arc_move(false);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
735 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
736 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
737 case 4: // G4 dwell
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
738 LCD_MESSAGEPGM(MSG_DWELL);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
739 codenum = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
740 if(code_seen('P')) codenum = code_value(); // milliseconds to wait
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
741 if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
742
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
743 st_synchronize();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
744 codenum += millis(); // keep track of when we started waiting
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
745 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
746 while(millis() < codenum ){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
747 manage_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
748 manage_inactivity(1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
749 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
750 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
751
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
752 case 10: // Set offsets
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
753 if(code_seen('P'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
754 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
755 tmp_extruder = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
756 get_coordinates();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
757 extruder_x_off[tmp_extruder] = destination[0]; // X
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
758 extruder_y_off[tmp_extruder] = destination[1]; // Y
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
759 extruder_z_off[tmp_extruder] = destination[2]; // Z
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
760 if(code_seen('R'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
761 extruder_standby[tmp_extruder] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
762 if(code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
763 extruder_temperature[tmp_extruder] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
764 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
765 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
766
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
767 case 28: //G28 Home all Axis one at a time
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
768 saved_feedrate = feedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
769 saved_feedmultiply = feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
770 feedmultiply = 100;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
771 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
772
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
773 enable_endstops(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
774
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
775 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
776 destination[i] = current_position[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
777 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
778 feedrate = 0.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
779 home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
780
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
781 if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
782 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
783 HOMEAXIS(X);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
784 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
785
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
786 if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
787 HOMEAXIS(Y);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
788 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
789
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
790 if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
791 HOMEAXIS(Z);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
792 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
793
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
794 if((home_all_axis) || code_seen(axis_codes[X_AXIS]))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
795 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
796 if(code_value_long() != 0) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
797 current_position[X_AXIS]=code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
798 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
799 current_position[X_AXIS]+=add_homeing[0];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
800 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
801
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
802 if((home_all_axis) || code_seen(axis_codes[Y_AXIS])) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
803 if(code_value_long() != 0) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
804 current_position[Y_AXIS]=code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
805 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
806 current_position[Y_AXIS]+=add_homeing[1];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
807 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
808
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
809 if((home_all_axis) || code_seen(axis_codes[Z_AXIS])) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
810 if(code_value_long() != 0) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
811 current_position[Z_AXIS]=code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
812 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
813 current_position[Z_AXIS]+=add_homeing[2];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
814 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
815 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
816
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
817 #ifdef ENDSTOPS_ONLY_FOR_HOMING
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
818 enable_endstops(false);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
819 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
820
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
821 feedrate = saved_feedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
822 feedmultiply = saved_feedmultiply;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
823 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
824 endstops_hit_on_purpose();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
825 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
826 case 29:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
827 probe_3points();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
828 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
829 case 30:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
830 probe_1point();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
831 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
832 case 31:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
833 probe_status();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
834 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
835 case 32:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
836 FPUTransform_determineBedOrientation();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
837 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
838 case 90: // G90
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
839 relative_mode = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
840 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
841 case 91: // G91
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
842 relative_mode = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
843 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
844 case 92: // G92
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
845 if(!code_seen(axis_codes[E_AXIS]))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
846 st_synchronize();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
847 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
848 if(code_seen(axis_codes[i])) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
849 current_position[i] = code_value()+add_homeing[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
850 if(i == E_AXIS) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
851 current_position[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
852 plan_set_e_position(current_position[E_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
853 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
854 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
855 current_position[i] = code_value()+add_homeing[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
856 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
857 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
858 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
859 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
860 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
861 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
862 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
863
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
864 else if(code_seen('M'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
865 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
866 switch( (int)code_value() )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
867 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
868 case 0: // Stops - add me...
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
869 case 1:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
870 case 112:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
871 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
872
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
873 case 17:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
874 LCD_MESSAGEPGM(MSG_NO_MOVE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
875 enable_x();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
876 enable_y();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
877 enable_z();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
878 // N571 disables real E drive! (ie. on laser operations)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
879 if (!n571_enabled) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
880 enable_e0();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
881 enable_e1();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
882 enable_e2();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
883 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
884 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
885
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
886 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
887 case 20: // M20 - list SD card
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
888 SERIAL_PROTOCOLLNPGM(MSG_BEGIN_FILE_LIST);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
889 card.ls();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
890 SERIAL_PROTOCOLLNPGM(MSG_END_FILE_LIST);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
891 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
892 case 21: // M21 - init SD card
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
893
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
894 card.initsd();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
895
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
896 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
897 case 22: //M22 - release SD card
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
898 card.release();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
899
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
900 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
901 case 23: //M23 - Select file
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
902 starpos = (strchr(strchr_pointer + 4,'*'));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
903 if(starpos!=NULL)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
904 *(starpos-1)='\0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
905 card.openFile(strchr_pointer + 4,true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
906 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
907 case 24: //M24 - Start SD print
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
908 card.startFileprint();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
909 starttime=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
910 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
911 case 25: //M25 - Pause SD print
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
912 card.pauseSDPrint();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
913 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
914 case 26: //M26 - Set SD index
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
915 if(card.cardOK && code_seen('S')) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
916 card.setIndex(code_value_long());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
917 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
918 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
919 case 27: //M27 - Get SD status
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
920 card.getStatus();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
921 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
922 case 28: //M28 - Start SD write
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
923 starpos = (strchr(strchr_pointer + 4,'*'));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
924 if(starpos != NULL){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
925 char* npos = strchr(cmdbuffer[bufindr], 'N');
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
926 strchr_pointer = strchr(npos,' ') + 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
927 *(starpos-1) = '\0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
928 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
929 card.openFile(strchr_pointer+4,false);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
930 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
931 case 29: //M29 - Stop SD write
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
932 //processed in write to file routine above
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
933 //card,saving = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
934 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
935 case 30: //M30 <filename> Delete File
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
936 if (card.cardOK){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
937 card.closefile();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
938 starpos = (strchr(strchr_pointer + 4,'*'));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
939 if(starpos != NULL){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
940 char* npos = strchr(cmdbuffer[bufindr], 'N');
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
941 strchr_pointer = strchr(npos,' ') + 1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
942 *(starpos-1) = '\0';
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
943 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
944 card.removeFile(strchr_pointer + 4);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
945 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
946 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
947
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
948 case 32: //M32 - fast SD transfer
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
949 card.fast_xfer(strchr_pointer+4);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
950 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
951 case 33: //M31 - high speed xfer capabilities
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
952 SERIAL_ECHOPGM("RAW:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
953 SERIAL_ECHOLN(SD_FAST_XFER_CHUNK_SIZE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
954 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
955 #endif //SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
956
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
957 case 35: //M35 take time since the start of the SD print or an M109 command
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
958 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
959 stoptime=millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
960 char time[30];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
961 unsigned long t=(stoptime-starttime)/1000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
962 int sec,min;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
963 min=t/60;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
964 sec=t%60;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
965 sprintf(time,"%i min, %i sec",min,sec);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
966 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
967 SERIAL_ECHOLN(time);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
968 LCD_MESSAGE(time);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
969 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
970 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
971 case 42: //M42 -Change pin status via gcode
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
972 if (code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
973 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
974 int pin_status = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
975 if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
976 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
977 int pin_number = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
978 for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
979 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
980 if (sensitive_pins[i] == pin_number)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
981 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
982 pin_number = -1;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
983 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
984 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
985 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
986
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
987 if (pin_number > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
988 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
989 pinMode(pin_number, OUTPUT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
990 digitalWrite(pin_number, pin_status);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
991 analogWrite(pin_number, pin_status);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
992 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
993 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
994 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
995 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
996 case 104: // M104
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
997 tmp_extruder = active_extruder;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
998 if(code_seen('T')) { // Why is this T and not S? - AB
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
999 tmp_extruder = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1000 if(tmp_extruder >= EXTRUDERS) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1001 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1002 SERIAL_ECHO(MSG_M104_INVALID_EXTRUDER);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1003 SERIAL_ECHOLN(tmp_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1004 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1005 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1006 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1007 if (code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1008 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1009 extruder_temperature[tmp_extruder] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1010 setTargetHotend(code_value(), tmp_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1011 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1012
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1013 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1014 case 140: // M140 set bed temp
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1015 if (code_seen('S')) setTargetBed(code_value());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1016 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1017 case 1105:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1018 #if (TEMP_0_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1019 SERIAL_PROTOCOLPGM("ok T0 raw:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1020 SERIAL_PROTOCOL(rawHotend(tmp_extruder));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1021 SERIAL_PROTOCOLPGM(", min:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1022 SERIAL_PROTOCOL(minHotend(tmp_extruder));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1023 SERIAL_PROTOCOLPGM(", max:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1024 SERIAL_PROTOCOL(maxHotend(tmp_extruder));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1025 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1026 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1027 case 105 : // M105
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1028 tmp_extruder = active_extruder;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1029 if(code_seen('T')) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1030 tmp_extruder = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1031 if(tmp_extruder >= EXTRUDERS) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1032 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1033 SERIAL_ECHO(MSG_M105_INVALID_EXTRUDER);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1034 SERIAL_ECHOLN(tmp_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1035 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1036 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1037 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1038 #if (TEMP_0_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1039 SERIAL_PROTOCOLPGM("ok T:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1040 SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1041 SERIAL_PROTOCOLPGM(" /");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1042 SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1043 #if TEMP_BED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1044 SERIAL_PROTOCOLPGM(" B:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1045 SERIAL_PROTOCOL_F(degBed(),1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1046 SERIAL_PROTOCOLPGM(" /");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1047 SERIAL_PROTOCOL_F(degTargetBed(),1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1048 #endif //TEMP_BED_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1049 #else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1050 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1051 SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1052 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1053 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1054 SERIAL_PROTOCOLPGM(" @:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1055 SERIAL_PROTOCOL(getHeaterPower(tmp_extruder));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1056 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1057 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1058 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1059 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1060 case 109:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1061 // M109 - Wait for extruder heater to reach target.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1062 tmp_extruder = active_extruder;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1063 if(code_seen('T')) { // Why is this T and not S? - AB
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1064 tmp_extruder = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1065 if(tmp_extruder >= EXTRUDERS) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1066 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1067 SERIAL_ECHO(MSG_M109_INVALID_EXTRUDER);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1068 SERIAL_ECHOLN(tmp_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1069 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1070 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1071 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1072 LCD_MESSAGEPGM(MSG_HEATING);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1073
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1074 if (code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1075 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1076 extruder_temperature[tmp_extruder] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1077 setTargetHotend(code_value(), tmp_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1078 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1079
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1080
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1081 codenum = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1082 wait_for_temp(tmp_extruder, codenum);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1083 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1084 case 190: // M190 - Wait for bed heater to reach target.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1085 #if TEMP_BED_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1086 LCD_MESSAGEPGM(MSG_BED_HEATING);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1087 if (code_seen('S')) setTargetBed(code_value());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1088 codenum = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1089 while(isHeatingBed())
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1090 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1091 if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1092 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1093 float tt=degHotend(active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1094 SERIAL_PROTOCOLPGM("T:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1095 SERIAL_PROTOCOL(tt);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1096 SERIAL_PROTOCOLPGM(" E:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1097 SERIAL_PROTOCOL((int)active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1098 SERIAL_PROTOCOLPGM(" B:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1099 SERIAL_PROTOCOL_F(degBed(),1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1100 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1101 codenum = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1102 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1103 manage_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1104 manage_inactivity(1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1105 LCD_STATUS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1106 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1107 LCD_MESSAGEPGM(MSG_BED_DONE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1108 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1109 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1110 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1111
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1112 #if FAN_PIN > -1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1113 case 106: //M106 Fan On
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1114 if (code_seen('S')){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1115 FanSpeed=constrain(code_value(),0,255);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1116 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1117 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1118 FanSpeed=255;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1119 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1120 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1121 case 107: //M107 Fan Off
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1122 FanSpeed = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1123 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1124 #endif //FAN_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1125
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1126
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1127 case 82:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1128 axis_relative_modes[3] = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1129 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1130 case 83:
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1131 axis_relative_modes[3] = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1132 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1133 case 18: //compatibility
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1134 case 84: // M84
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1135 if(code_seen('S')){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1136 stepper_inactive_time = code_value() * 1000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1137 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1138 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1139 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1140 bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3])));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1141 if(all_axis)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1142 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1143 st_synchronize();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1144 disable_e0();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1145 disable_e1();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1146 disable_e2();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1147 finishAndDisableSteppers();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1148
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1149 if (m571_enabled) WRITE(M571_PIN, LOW);// M571 disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1150 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1151 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1152 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1153 st_synchronize();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1154 if(code_seen('X')) disable_x();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1155 if(code_seen('Y')) disable_y();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1156 if(code_seen('Z')) disable_z();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1157 #if ((E0_ENABLE_PIN != X_ENABLE_PIN) && (E1_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1158 if(code_seen('E')) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1159 disable_e0();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1160 disable_e1();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1161 disable_e2();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1162 if (m571_enabled) WRITE(M571_PIN, LOW);// M571 disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1163 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1164 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1165 LCD_MESSAGEPGM(MSG_PART_RELEASE);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1166 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1167 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1168 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1169 case 85: // M85
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1170 code_seen('S');
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1171 max_inactive_time = code_value() * 1000;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1172 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1173 case 92: // M92
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1174 for(int8_t i=0; i < NUM_AXIS; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1175 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1176 if(code_seen(axis_codes[i]))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1177 axis_steps_per_unit[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1178 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1179 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1180 case 115: // M115
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1181 SerialprintPGM(MSG_M115_REPORT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1182 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1183 case 117: // M117 display message
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1184 LCD_MESSAGE(cmdbuffer[bufindr]+5);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1185 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1186 case 114: // M114
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1187 SERIAL_PROTOCOLPGM("X:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1188 SERIAL_PROTOCOL(current_position[X_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1189 SERIAL_PROTOCOLPGM("Y:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1190 SERIAL_PROTOCOL(current_position[Y_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1191 SERIAL_PROTOCOLPGM("Z:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1192 SERIAL_PROTOCOL(current_position[Z_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1193 SERIAL_PROTOCOLPGM("E:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1194 SERIAL_PROTOCOL(current_position[E_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1195
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1196 SERIAL_PROTOCOLPGM(MSG_COUNT_X);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1197 SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1198 SERIAL_PROTOCOLPGM("Y:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1199 SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1200 SERIAL_PROTOCOLPGM("Z:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1201 SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1202
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1203 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1204 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1205 case 120: // M120
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1206 enable_endstops(false) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1207 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1208 case 121: // M121
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1209 enable_endstops(true) ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1210 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1211 case 119: // M119
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1212 #if (X_MIN_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1213 SERIAL_PROTOCOLPGM(MSG_X_MIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1214 SERIAL_PROTOCOL(((READ(X_MIN_PIN)^X_ENDSTOPS_INVERTING)?"H ":"L "));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1215 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1216 #if (X_MAX_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1217 SERIAL_PROTOCOLPGM(MSG_X_MAX);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1218 SERIAL_PROTOCOL(((READ(X_MAX_PIN)^X_ENDSTOPS_INVERTING)?"H ":"L "));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1219 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1220 #if (Y_MIN_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1221 SERIAL_PROTOCOLPGM(MSG_Y_MIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1222 SERIAL_PROTOCOL(((READ(Y_MIN_PIN)^Y_ENDSTOPS_INVERTING)?"H ":"L "));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1223 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1224 #if (Y_MAX_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1225 SERIAL_PROTOCOLPGM(MSG_Y_MAX);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1226 SERIAL_PROTOCOL(((READ(Y_MAX_PIN)^Y_ENDSTOPS_INVERTING)?"H ":"L "));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1227 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1228 #if (Z_MIN_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1229 SERIAL_PROTOCOLPGM(MSG_Z_MIN);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1230 SERIAL_PROTOCOL(((READ(Z_MIN_PIN)^Z_ENDSTOPS_INVERTING)?"H ":"L "));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1231 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1232 #if (Z_MAX_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1233 SERIAL_PROTOCOLPGM(MSG_Z_MAX);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1234 SERIAL_PROTOCOL(((READ(Z_MAX_PIN)^Z_ENDSTOPS_INVERTING)?"H ":"L "));
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1235 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1236 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1237 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1238 case 201: // M201
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1239 for(int8_t i=0; i < NUM_AXIS; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1240 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1241 if(code_seen(axis_codes[i]))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1242 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1243 max_acceleration_units_per_sq_second[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1244 axis_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1245 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1246 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1247 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1248 #if 0 // Not used for Sprinter/grbl gen6
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1249 case 202: // M202
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1250 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1251 if(code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1252 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1253 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1254 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1255 case 203: // M203 max feedrate mm/sec
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1256 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1257 if(code_seen(axis_codes[i])) max_feedrate[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1258 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1259 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1260 case 204: // M204 acclereration S normal moves T filmanent only moves
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1261 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1262 if(code_seen('S')) acceleration = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1263 if(code_seen('T')) retract_acceleration = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1264 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1265 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1266 case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1267 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1268 if(code_seen('S')) minimumfeedrate = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1269 if(code_seen('T')) mintravelfeedrate = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1270 if(code_seen('B')) minsegmenttime = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1271 if(code_seen('X')) max_xy_jerk = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1272 if(code_seen('Z')) max_z_jerk = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1273 if(code_seen('E')) max_e_jerk = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1274 #ifdef ADVANCE
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1275 if(code_seen('K')) advance_k = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1276 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1277 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1278 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1279 case 206: // M206 additional homeing offset
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1280 for(int8_t i=0; i < 3; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1281 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1282 if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1283 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1284 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1285 case 208: // M208 set axis max length
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1286 for(int8_t i=0; i < 3; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1287 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1288 if(code_seen(axis_codes[i])) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1289 max_length[i] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1290 SERIAL_PROTOCOL(axis_codes[i]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1291 SERIAL_PROTOCOL(" Axis max length: ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1292 SERIAL_PROTOCOL(max_length[i]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1293 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1294 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1295 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1296 case 220: // M220 S<factor in percent>- set speed factor override percentage
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1297 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1298 if(code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1299 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1300 feedmultiply = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1301 feedmultiplychanged=true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1302 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1303 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1304 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1305 case 221: // M221 S<factor in percent>- set extrude factor override percentage
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1306 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1307 if(code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1308 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1309 extrudemultiply = code_value() ;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1310 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1311 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1312 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1313
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1314 #ifdef PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1315 case 301: // M301
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1316 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1317 if(code_seen('P')) Kp = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1318 if(code_seen('I')) Ki = code_value()*PID_dT;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1319 if(code_seen('D')) Kd = code_value()/PID_dT;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1320 if(code_seen('W')) Ki_Max = constrain(code_value(),0,255);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1321
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1322 updatePID();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1323 SERIAL_PROTOCOL(MSG_OK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1324 SERIAL_PROTOCOL(" p:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1325 SERIAL_PROTOCOL(Kp);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1326 SERIAL_PROTOCOL(" i:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1327 SERIAL_PROTOCOL(Ki/PID_dT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1328 SERIAL_PROTOCOL(" d:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1329 SERIAL_PROTOCOL(Kd*PID_dT);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1330 SERIAL_PROTOCOL(" w:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1331 SERIAL_PROTOCOL(Ki_Max);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1332
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1333 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1334 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1335 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1336 #endif //PIDTEMP
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1337 case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1338 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1339 #ifdef PHOTOGRAPH_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1340 #if (PHOTOGRAPH_PIN > -1)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1341 const uint8_t NUM_PULSES=16;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1342 const float PULSE_LENGTH=0.01524;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1343 for(int i=0; i < NUM_PULSES; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1344 WRITE(PHOTOGRAPH_PIN, HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1345 _delay_ms(PULSE_LENGTH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1346 WRITE(PHOTOGRAPH_PIN, LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1347 _delay_ms(PULSE_LENGTH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1348 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1349 delay(7.33);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1350 for(int i=0; i < NUM_PULSES; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1351 WRITE(PHOTOGRAPH_PIN, HIGH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1352 _delay_ms(PULSE_LENGTH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1353 WRITE(PHOTOGRAPH_PIN, LOW);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1354 _delay_ms(PULSE_LENGTH);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1355 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1356 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1357 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1358 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1359 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1360
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1361 case 302: // allow cold extrudes
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1362 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1363 if (code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1364 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1365 allow_cold_extrudes(code_value());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1366 }else{
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1367 allow_cold_extrudes(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1368 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1369 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1370 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1371 case 303: // M303 PID autotune
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1372 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1373 float temp = 150.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1374 if (code_seen('S')) temp=code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1375 PID_autotune(temp);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1376 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1377 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1378 case 304: // Set thermistor parameters
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1379 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1380 // M304 H0 B3960 R4700
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1381 // M304 H1 Bb Rr
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1382 if (code_seen('H'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1383 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1384 if(!code_value()){
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1385 //set BED thermistor
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1386 if(code_seen('B')) b_beta = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1387 if(code_seen('R')) b_resistor = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1388 if(code_seen('T')) b_thermistor = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1389 b_inf = ( b_thermistor*exp(-b_beta/298.15) );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1390 SERIAL_PROTOCOL(MSG_OK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1391 SERIAL_PROTOCOL(" M304 H0 B");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1392 SERIAL_PROTOCOL(b_beta);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1393 SERIAL_PROTOCOL(" R");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1394 SERIAL_PROTOCOL(b_resistor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1395 SERIAL_PROTOCOL(" T");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1396 SERIAL_PROTOCOL(b_thermistor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1397 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1398 }else{
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1399 //set active Nozzle thermistor
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1400 if(code_seen('B')) n_beta = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1401 if(code_seen('R')) n_resistor = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1402 if(code_seen('T')) n_thermistor = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1403 n_inf = ( n_thermistor*exp(-n_beta/298.15) );
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1404 SERIAL_PROTOCOL(MSG_OK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1405 SERIAL_PROTOCOL(" M304 H1 B");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1406 SERIAL_PROTOCOL(n_beta);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1407 SERIAL_PROTOCOL(" R");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1408 SERIAL_PROTOCOL(n_resistor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1409 SERIAL_PROTOCOL(" T");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1410 SERIAL_PROTOCOL(n_thermistor);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1411 SERIAL_PROTOCOLLN("");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1412 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1413 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1414 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1415 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1416 case 400: // M400 finish all moves
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1417 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1418 st_synchronize();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1419 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1420 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1421 case 500: // Store settings in EEPROM
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1422 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1423 EEPROM_StoreSettings();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1424 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1425 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1426 case 501: // Read settings from EEPROM
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1427 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1428 EEPROM_RetrieveSettings();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1429 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1430 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1431 case 502: // Revert to default settings
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1432 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1433 EEPROM_RetrieveSettings(true);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1434 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1435 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1436 case 503: // print settings currently in memory
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1437 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1438 EEPROM_printSettings();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1439 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1440 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1441 case 504: // print free memory
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1442 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1443 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1444 SERIAL_ECHOPGM("Free Memory:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1445 SERIAL_ECHO(freeMemory());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1446 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1447 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1448 case 999: // Restart after being stopped
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1449 Stopped = false;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1450 gcode_LastN = Stopped_gcode_LastN;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1451 FlushSerialRequestResend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1452 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1453 case 510: // FPU Enable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1454 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1455 FPUEnable();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1456 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1457 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1458 case 511: // FPU Reset
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1459 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1460 FPUReset();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1461 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1462 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1463 case 512: // FPU Disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1464 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1465 FPUDisable();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1466 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1467 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1468 #ifdef REPRAPPRO_MULTIMATERIALS
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1469 case 555: // Slave comms test
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1470 talkToSlave("t 0");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1471 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1472 SERIAL_ECHOPGM("Slave response:");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1473 SERIAL_ECHO(listenToSlave());
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1474 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1475 case 556: // Set temp
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1476 talkToSlave("T 0 100");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1477 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1478 case 557: // Call stepper test
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1479 talkToSlave("A");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1480 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1481 case 558: // Send interrupt
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1482 for(int ii=0; ii < 1000; ii++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1483 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1484 toggleSlaveClock();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1485 delay(1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1486 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1487 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1488 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1489
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1490 case 571: // enable extruder active pin
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1491 if (code_seen('S'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1492 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1493 m571_enabled = (int)code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1494 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1495
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1496 if (code_seen('E'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1497 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1498 n571_enabled = (int)code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1499 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1500
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1501 WRITE(M571_PIN, LOW);// M571 disable in any case!
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1502
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1503 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1504 SERIAL_ECHO("Parameters: S<0|1> enable extruder active pin, E<0|1> if enabled prevent real drive movement");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1505
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1506 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1507 SERIAL_ECHO("Extruder active pin: ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1508 if (m571_enabled) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1509 SERIAL_ECHOLN("enabled");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1510 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1511 SERIAL_ECHOLN("disabled");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1512 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1513
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1514 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1515 SERIAL_ECHO("Extruder motor move: ");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1516 if (!n571_enabled) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1517 SERIAL_ECHOLN("enabled");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1518 } else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1519 SERIAL_ECHOLN("disabled");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1520 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1521
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1522 break;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1523
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1524
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1525
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1526 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1527 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1528
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1529 else if(code_seen('T'))
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1530 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1531 tmp_extruder = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1532 if(tmp_extruder >= EXTRUDERS)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1533 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1534 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1535 SERIAL_ECHO(MSG_STANDBY_TEMP);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1536 SERIAL_ECHO(active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1537 setTargetHotend(extruder_standby[active_extruder], active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1538 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1539 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1540 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1541 if((tmp_extruder != active_extruder) || !extruder_selected)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1542 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1543 setTargetHotend(extruder_standby[active_extruder], active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1544 extruder_selected = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1545
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1546 // Deal with offsets here: record current pos as temp_position;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1547 // move to temp_position + tmp_extruder - active_extruder;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1548 // Set current pos to be temp_position
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1549 // TOTHINKABOUT: What about cumulative errors with a LOT of extruder changes?
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1550
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1551 for(int8_t i=0; i < NUM_AXIS; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1552 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1553 temp_position[i] = current_position[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1554 destination[i] = current_position[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1555 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1556 next_feedrate = feedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1557 x_off_d = extruder_x_off[tmp_extruder] - extruder_x_off[active_extruder];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1558 y_off_d = extruder_y_off[tmp_extruder] - extruder_y_off[active_extruder];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1559 z_off_d = extruder_z_off[tmp_extruder] - extruder_z_off[active_extruder];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1560
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1561 if(z_off_d > 0)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1562 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1563 destination[Z_AXIS] += z_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1564 feedrate = fast_home_feedrate[Z_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1565 prepare_move();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1566 destination[X_AXIS] = temp_position[X_AXIS] + x_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1567 destination[Y_AXIS] = temp_position[Y_AXIS] + y_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1568 feedrate = fast_home_feedrate[X_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1569 prepare_move();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1570 } else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1571 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1572 destination[X_AXIS] += x_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1573 destination[Y_AXIS] += y_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1574 feedrate = fast_home_feedrate[X_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1575 prepare_move();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1576 destination[Z_AXIS] = temp_position[Z_AXIS] + z_off_d;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1577 feedrate = fast_home_feedrate[Z_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1578 prepare_move();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1579 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1580
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1581 for(int8_t i=0; i < NUM_AXIS; i++)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1582 current_position[i] = temp_position[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1583 feedrate = next_feedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1584 active_extruder = tmp_extruder;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1585
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1586 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1587 SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1588 SERIAL_PROTOCOLLN((int)active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1589
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1590 setTargetHotend(extruder_temperature[active_extruder], active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1591
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1592
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1593 codenum = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1594 wait_for_temp(active_extruder, codenum);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1595 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1596 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1597 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1598
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1599
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1600 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1601 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1602 SERIAL_ECHO_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1603 SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1604 SERIAL_ECHO(cmdbuffer[bufindr]);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1605 SERIAL_ECHOLNPGM("\"");
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1606 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1607
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1608 ClearToSend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1609 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1610
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1611 void FlushSerialRequestResend()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1612 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1613 //char cmdbuffer[bufindr][100]="Resend:";
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1614 MYSERIAL.flush();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1615 SERIAL_PROTOCOLPGM(MSG_RESEND);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1616 SERIAL_PROTOCOLLN(gcode_LastN + 1);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1617 ClearToSend();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1618 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1619
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1620 void ClearToSend()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1621 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1622 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1623 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1624 if(fromsd[bufindr])
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1625 return;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1626 #endif //SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1627 SERIAL_PROTOCOLLNPGM(MSG_OK);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1628 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1629
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1630 void get_coordinates()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1631 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1632 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1633 if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1634 else destination[i] = current_position[i]; //Are these else lines really needed?
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1635 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1636 if(code_seen('F')) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1637 next_feedrate = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1638 if(next_feedrate > 0.0) feedrate = next_feedrate;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1639 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1640 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1641
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1642 void get_arc_coordinates()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1643 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1644 get_coordinates();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1645 if(code_seen('I')) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1646 offset[0] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1647 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1648 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1649 offset[0] = 0.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1650 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1651 if(code_seen('J')) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1652 offset[1] = code_value();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1653 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1654 else {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1655 offset[1] = 0.0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1656 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1657 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1658
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1659 void prepare_move()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1660 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1661
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1662 // transform destination *********************************************
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1663
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1664 FPUTransform_transformDestination();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1665
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1666 if (min_software_endstops) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1667 if (modified_destination[X_AXIS] < X_HOME_POS) modified_destination[X_AXIS] = X_HOME_POS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1668 if (modified_destination[Y_AXIS] < Y_HOME_POS) modified_destination[Y_AXIS] = Y_HOME_POS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1669 if (modified_destination[Z_AXIS] < Z_HOME_POS) modified_destination[Z_AXIS] = Z_HOME_POS;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1670 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1671
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1672 if (max_software_endstops) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1673 if (modified_destination[X_AXIS] > max_length[X_AXIS]) modified_destination[X_AXIS] = max_length[X_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1674 if (modified_destination[Y_AXIS] > max_length[Y_AXIS]) modified_destination[Y_AXIS] = max_length[Y_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1675 if (modified_destination[Z_AXIS] > max_length[Z_AXIS]) modified_destination[Z_AXIS] = max_length[Z_AXIS];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1676 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1677 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1678 plan_buffer_line(modified_destination[X_AXIS], modified_destination[Y_AXIS], modified_destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1679 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1680 current_position[i] = destination[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1681 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1682 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1683
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1684 void prepare_arc_move(char isclockwise) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1685 float r = hypot(offset[X_AXIS], offset[Y_AXIS]); // Compute arc radius for mc_arc
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1686
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1687 // transform destination *********************************************
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1688 FPUTransform_transformDestination();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1689
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1690 // Trace the arc
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1691 mc_arc(current_position, modified_destination, offset, X_AXIS, Y_AXIS, Z_AXIS, feedrate*feedmultiply/60/100.0, r, isclockwise, active_extruder);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1692
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1693 // As far as the parser is concerned, the position is now == target. In reality the
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1694 // motion control system might still be processing the action and the real tool position
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1695 // in any intermediate location.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1696 for(int8_t i=0; i < NUM_AXIS; i++) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1697 current_position[i] = destination[i];
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1698 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1699 previous_millis_cmd = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1700 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1701
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1702 #ifdef CONTROLLERFAN_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1703 unsigned long lastMotor = 0; //Save the time for when a motor was turned on last
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1704 unsigned long lastMotorCheck = 0;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1705
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1706 void controllerFan()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1707 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1708 if ((millis() - lastMotorCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1709 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1710 lastMotorCheck = millis();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1711
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1712 if(!READ(X_ENABLE_PIN) || !READ(Y_ENABLE_PIN) || !READ(Z_ENABLE_PIN)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1713 #if EXTRUDERS > 2
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1714 || !READ(E2_ENABLE_PIN)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1715 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1716 #if EXTRUDER > 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1717 || !READ(E2_ENABLE_PIN)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1718 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1719 || !READ(E0_ENABLE_PIN)) //If any of the drivers are enabled...
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1720 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1721 lastMotor = millis(); //... set time to NOW so the fan will turn on
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1722 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1723
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1724 if ((millis() - lastMotor) >= (CONTROLLERFAN_SEC*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1725 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1726 WRITE(CONTROLLERFAN_PIN, LOW); //... turn the fan off
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1727 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1728 else
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1729 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1730 WRITE(CONTROLLERFAN_PIN, HIGH); //... turn the fan on
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1731 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1732 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1733 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1734 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1735
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1736 void manage_inactivity(byte debug)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1737 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1738 if( (millis() - previous_millis_cmd) > max_inactive_time )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1739 if(max_inactive_time)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1740 kill();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1741 if(stepper_inactive_time) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1742 if( (millis() - previous_millis_cmd) > stepper_inactive_time )
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1743 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1744 if(blocks_queued() == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1745 disable_x();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1746 disable_y();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1747 disable_z();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1748 disable_e0();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1749 disable_e1();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1750 disable_e2();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1751 if (m571_enabled) WRITE(M571_PIN, LOW);// M571 disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1752 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1753 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1754 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1755 #ifdef CONTROLLERFAN_PIN
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1756 controllerFan(); //Check if fan should be turned on to cool stepper drivers down
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1757 #endif
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1758 check_axes_activity();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1759 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1760
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1761 void kill()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1762 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1763 cli(); // Stop interrupts
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1764 disable_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1765
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1766 disable_x();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1767 disable_y();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1768 disable_z();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1769 disable_e0();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1770 disable_e1();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1771 disable_e2();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1772 if (m571_enabled) WRITE(M571_PIN, LOW);// M571 disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1773
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1774 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1775 SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1776 LCD_MESSAGEPGM(MSG_KILLED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1777 suicide();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1778 while(1); // Wait for reset
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1779 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1780
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1781 void Stop()
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1782 {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1783 disable_heater();
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1784 if(Stopped == false) {
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1785 Stopped = true;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1786 Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1787 if (m571_enabled) WRITE(M571_PIN, LOW);// M571 disable
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1788 SERIAL_ERROR_START;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1789 SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1790 LCD_MESSAGEPGM(MSG_STOPPED);
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1791 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1792 }
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1793
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1794 bool IsStopped() { return Stopped; };
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1795
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1796

mercurial