|
@@ -27,8 +27,6 @@
|
27
|
27
|
|
28
|
28
|
#include "Marlin.h"
|
29
|
29
|
|
30
|
|
-
|
31
|
|
-
|
32
|
30
|
#include "ultralcd.h"
|
33
|
31
|
#include "planner.h"
|
34
|
32
|
#include "stepper.h"
|
|
@@ -38,12 +36,7 @@
|
38
|
36
|
#include "watchdog.h"
|
39
|
37
|
#include "EEPROMwrite.h"
|
40
|
38
|
|
41
|
|
-
|
42
|
|
-
|
43
|
|
-#define VERSION_STRING "1.0.0 Beta 1"
|
44
|
|
-
|
45
|
|
-
|
46
|
|
-
|
|
39
|
+#define VERSION_STRING "1.0.0 RC1"
|
47
|
40
|
|
48
|
41
|
// look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
|
49
|
42
|
// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
|
|
@@ -147,15 +140,11 @@ static bool home_all_axis = true;
|
147
|
140
|
static float feedrate = 1500.0, next_feedrate, saved_feedrate;
|
148
|
141
|
static long gcode_N, gcode_LastN;
|
149
|
142
|
|
150
|
|
-
|
151
|
|
-
|
152
|
143
|
static bool relative_mode = false; //Determines Absolute or Relative Coordinates
|
153
|
144
|
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.
|
154
|
145
|
|
155
|
146
|
static uint8_t fanpwm=0;
|
156
|
147
|
|
157
|
|
-
|
158
|
|
-
|
159
|
148
|
static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
|
160
|
149
|
static bool fromsd[BUFSIZE];
|
161
|
150
|
static int bufindr = 0;
|
|
@@ -224,6 +213,7 @@ void enquecommand(const char *cmd)
|
224
|
213
|
buflen += 1;
|
225
|
214
|
}
|
226
|
215
|
}
|
|
216
|
+
|
227
|
217
|
void setup_photpin()
|
228
|
218
|
{
|
229
|
219
|
#ifdef PHOTOGRAPH_PIN
|
|
@@ -254,12 +244,6 @@ void suicide()
|
254
|
244
|
#endif
|
255
|
245
|
}
|
256
|
246
|
|
257
|
|
-long millis_diff(unsigned long starttime) {
|
258
|
|
- unsigned long difftime = millis() - starttime;
|
259
|
|
- if (difftime > 0x8000) difftime += 0x8000;
|
260
|
|
- return difftime;
|
261
|
|
-}
|
262
|
|
-
|
263
|
247
|
void setup()
|
264
|
248
|
{
|
265
|
249
|
setup_powerhold();
|
|
@@ -332,7 +316,6 @@ void loop()
|
332
|
316
|
LCD_STATUS;
|
333
|
317
|
}
|
334
|
318
|
|
335
|
|
-
|
336
|
319
|
void get_command()
|
337
|
320
|
{
|
338
|
321
|
while( MSerial.available() > 0 && buflen < BUFSIZE) {
|
|
@@ -556,9 +539,9 @@ void process_commands()
|
556
|
539
|
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
|
557
|
540
|
|
558
|
541
|
st_synchronize();
|
559
|
|
-// codenum += millis(); // keep track of when we started waiting
|
|
542
|
+ codenum += millis(); // keep track of when we started waiting
|
560
|
543
|
previous_millis_cmd = millis();
|
561
|
|
- while(millis_diff(previous_millis_cmd) < codenum ){
|
|
544
|
+ while(millis() < codenum ){
|
562
|
545
|
manage_heater();
|
563
|
546
|
}
|
564
|
547
|
break;
|
|
@@ -795,7 +778,7 @@ void process_commands()
|
795
|
778
|
#if (TEMP_0_PIN > -1)
|
796
|
779
|
SERIAL_PROTOCOLPGM("ok T:");
|
797
|
780
|
SERIAL_PROTOCOL(degHotend(tmp_extruder));
|
798
|
|
- #if TEMP_BED_PIN > -1
|
|
781
|
+ #if TEMP_BED_PIN > -1
|
799
|
782
|
SERIAL_PROTOCOLPGM(" B:");
|
800
|
783
|
SERIAL_PROTOCOL(degBed());
|
801
|
784
|
#endif //TEMP_BED_PIN
|
|
@@ -849,11 +832,11 @@ void process_commands()
|
849
|
832
|
/* continue to loop until we have reached the target temp
|
850
|
833
|
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
|
851
|
834
|
while((residencyStart == -1) ||
|
852
|
|
- (residencyStart > -1 && (millis_diff(residencyStart) < TEMP_RESIDENCY_TIME*1000) )) {
|
|
835
|
+ (residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) {
|
853
|
836
|
#else
|
854
|
837
|
while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
|
855
|
838
|
#endif //TEMP_RESIDENCY_TIME
|
856
|
|
- if(millis_diff(codenum) > 1000 )
|
|
839
|
+ if((millis() - codenum) > 1000 )
|
857
|
840
|
{ //Print Temp Reading and remaining time every 1 second while heating up/cooling down
|
858
|
841
|
SERIAL_PROTOCOLPGM("T:");
|
859
|
842
|
SERIAL_PROTOCOL( degHotend(tmp_extruder) );
|
|
@@ -863,7 +846,7 @@ void process_commands()
|
863
|
846
|
SERIAL_PROTOCOLPGM(" W:");
|
864
|
847
|
if(residencyStart > -1)
|
865
|
848
|
{
|
866
|
|
- codenum = TEMP_RESIDENCY_TIME - (millis_diff(residencyStart) / 1000);
|
|
849
|
+ codenum = TEMP_RESIDENCY_TIME - ((millis() - residencyStart) / 1000);
|
867
|
850
|
SERIAL_PROTOCOLLN( codenum );
|
868
|
851
|
}
|
869
|
852
|
else
|
|
@@ -901,7 +884,7 @@ void process_commands()
|
901
|
884
|
codenum = millis();
|
902
|
885
|
while(isHeatingBed())
|
903
|
886
|
{
|
904
|
|
- if( millis_diff(codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
|
|
887
|
+ if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
|
905
|
888
|
{
|
906
|
889
|
float tt=degHotend(active_extruder);
|
907
|
890
|
SERIAL_PROTOCOLPGM("T:");
|
|
@@ -971,6 +954,7 @@ void process_commands()
|
971
|
954
|
bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3])));
|
972
|
955
|
if(all_axis)
|
973
|
956
|
{
|
|
957
|
+ st_synchronize();
|
974
|
958
|
disable_e0();
|
975
|
959
|
disable_e1();
|
976
|
960
|
disable_e2();
|
|
@@ -1299,11 +1283,11 @@ void prepare_arc_move(char isclockwise) {
|
1299
|
1283
|
|
1300
|
1284
|
void manage_inactivity(byte debug)
|
1301
|
1285
|
{
|
1302
|
|
- if( millis_diff(previous_millis_cmd) > max_inactive_time )
|
|
1286
|
+ if( (millis() - previous_millis_cmd) > max_inactive_time )
|
1303
|
1287
|
if(max_inactive_time)
|
1304
|
1288
|
kill();
|
1305
|
1289
|
if(stepper_inactive_time)
|
1306
|
|
- if( millis_diff(last_stepperdisabled_time) > stepper_inactive_time )
|
|
1290
|
+ if( (millis() - last_stepperdisabled_time) > stepper_inactive_time )
|
1307
|
1291
|
{
|
1308
|
1292
|
if(previous_millis_cmd>last_stepperdisabled_time)
|
1309
|
1293
|
last_stepperdisabled_time=previous_millis_cmd;
|
|
@@ -1315,7 +1299,7 @@ void manage_inactivity(byte debug)
|
1315
|
1299
|
}
|
1316
|
1300
|
}
|
1317
|
1301
|
#ifdef EXTRUDER_RUNOUT_PREVENT
|
1318
|
|
- if( millis_diff(previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
|
1302
|
+ if( (millis() - previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
1319
|
1303
|
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
|
1320
|
1304
|
{
|
1321
|
1305
|
bool oldstatus=READ(E0_ENABLE_PIN);
|