|
@@ -547,9 +547,7 @@ void servo_init()
|
547
|
547
|
#endif
|
548
|
548
|
}
|
549
|
549
|
|
550
|
|
-
|
551
|
|
-void setup()
|
552
|
|
-{
|
|
550
|
+void setup() {
|
553
|
551
|
setup_killpin();
|
554
|
552
|
setup_filrunoutpin();
|
555
|
553
|
setup_powerhold();
|
|
@@ -559,15 +557,16 @@ void setup()
|
559
|
557
|
|
560
|
558
|
// Check startup - does nothing if bootloader sets MCUSR to 0
|
561
|
559
|
byte mcu = MCUSR;
|
562
|
|
- if(mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP);
|
563
|
|
- if(mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET);
|
564
|
|
- if(mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET);
|
565
|
|
- if(mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET);
|
566
|
|
- if(mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET);
|
567
|
|
- MCUSR=0;
|
|
560
|
+ if (mcu & 1) SERIAL_ECHOLNPGM(MSG_POWERUP);
|
|
561
|
+ if (mcu & 2) SERIAL_ECHOLNPGM(MSG_EXTERNAL_RESET);
|
|
562
|
+ if (mcu & 4) SERIAL_ECHOLNPGM(MSG_BROWNOUT_RESET);
|
|
563
|
+ if (mcu & 8) SERIAL_ECHOLNPGM(MSG_WATCHDOG_RESET);
|
|
564
|
+ if (mcu & 32) SERIAL_ECHOLNPGM(MSG_SOFTWARE_RESET);
|
|
565
|
+ MCUSR = 0;
|
568
|
566
|
|
569
|
567
|
SERIAL_ECHOPGM(MSG_MARLIN);
|
570
|
|
- SERIAL_ECHOLNPGM(STRING_VERSION);
|
|
568
|
+ SERIAL_ECHOLNPGM(" " STRING_VERSION);
|
|
569
|
+
|
571
|
570
|
#ifdef STRING_VERSION_CONFIG_H
|
572
|
571
|
#ifdef STRING_CONFIG_H_AUTHOR
|
573
|
572
|
SERIAL_ECHO_START;
|
|
@@ -579,17 +578,16 @@ void setup()
|
579
|
578
|
SERIAL_ECHOLNPGM(__DATE__);
|
580
|
579
|
#endif // STRING_CONFIG_H_AUTHOR
|
581
|
580
|
#endif // STRING_VERSION_CONFIG_H
|
|
581
|
+
|
582
|
582
|
SERIAL_ECHO_START;
|
583
|
583
|
SERIAL_ECHOPGM(MSG_FREE_MEMORY);
|
584
|
584
|
SERIAL_ECHO(freeMemory());
|
585
|
585
|
SERIAL_ECHOPGM(MSG_PLANNER_BUFFER_BYTES);
|
586
|
586
|
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
|
|
587
|
+
|
587
|
588
|
#ifdef SDSUPPORT
|
588
|
|
- for(int8_t i = 0; i < BUFSIZE; i++)
|
589
|
|
- {
|
590
|
|
- fromsd[i] = false;
|
591
|
|
- }
|
592
|
|
- #endif //!SDSUPPORT
|
|
589
|
+ for (int8_t i = 0; i < BUFSIZE; i++) fromsd[i] = false;
|
|
590
|
+ #endif // !SDSUPPORT
|
593
|
591
|
|
594
|
592
|
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
|
595
|
593
|
Config_RetrieveSettings();
|
|
@@ -600,7 +598,6 @@ void setup()
|
600
|
598
|
st_init(); // Initialize stepper, this enables interrupts!
|
601
|
599
|
setup_photpin();
|
602
|
600
|
servo_init();
|
603
|
|
-
|
604
|
601
|
|
605
|
602
|
lcd_init();
|
606
|
603
|
_delay_ms(1000); // wait 1sec to display the splash screen
|
|
@@ -612,20 +609,23 @@ void setup()
|
612
|
609
|
#ifdef DIGIPOT_I2C
|
613
|
610
|
digipot_i2c_init();
|
614
|
611
|
#endif
|
615
|
|
-#ifdef Z_PROBE_SLED
|
616
|
|
- pinMode(SERVO0_PIN, OUTPUT);
|
617
|
|
- digitalWrite(SERVO0_PIN, LOW); // turn it off
|
618
|
|
-#endif // Z_PROBE_SLED
|
|
612
|
+
|
|
613
|
+ #ifdef Z_PROBE_SLED
|
|
614
|
+ pinMode(SERVO0_PIN, OUTPUT);
|
|
615
|
+ digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
616
|
+ #endif // Z_PROBE_SLED
|
|
617
|
+
|
619
|
618
|
setup_homepin();
|
620
|
619
|
|
621
|
|
-#ifdef STAT_LED_RED
|
622
|
|
- pinMode(STAT_LED_RED, OUTPUT);
|
623
|
|
- digitalWrite(STAT_LED_RED, LOW); // turn it off
|
624
|
|
-#endif
|
625
|
|
-#ifdef STAT_LED_BLUE
|
626
|
|
- pinMode(STAT_LED_BLUE, OUTPUT);
|
627
|
|
- digitalWrite(STAT_LED_BLUE, LOW); // turn it off
|
628
|
|
-#endif
|
|
620
|
+ #ifdef STAT_LED_RED
|
|
621
|
+ pinMode(STAT_LED_RED, OUTPUT);
|
|
622
|
+ digitalWrite(STAT_LED_RED, LOW); // turn it off
|
|
623
|
+ #endif
|
|
624
|
+
|
|
625
|
+ #ifdef STAT_LED_BLUE
|
|
626
|
+ pinMode(STAT_LED_BLUE, OUTPUT);
|
|
627
|
+ digitalWrite(STAT_LED_BLUE, LOW); // turn it off
|
|
628
|
+ #endif
|
629
|
629
|
}
|
630
|
630
|
|
631
|
631
|
|
|
@@ -5447,26 +5447,37 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
5447
|
5447
|
}
|
5448
|
5448
|
#endif // MESH_BED_LEVELING
|
5449
|
5449
|
|
5450
|
|
-void prepare_move() {
|
5451
|
|
- clamp_to_software_endstops(destination);
|
5452
|
|
- refresh_cmd_timeout();
|
|
5450
|
+#ifdef PREVENT_DANGEROUS_EXTRUDE
|
5453
|
5451
|
|
5454
|
|
- #ifdef PREVENT_DANGEROUS_EXTRUDE
|
5455
|
|
- float de = destination[E_AXIS] - current_position[E_AXIS];
|
|
5452
|
+ inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) {
|
|
5453
|
+ float de = dest_e - curr_e;
|
5456
|
5454
|
if (de) {
|
5457
|
5455
|
if (degHotend(active_extruder) < extrude_min_temp) {
|
5458
|
|
- current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
5456
|
+ curr_e = dest_e; // Behave as if the move really took place, but ignore E part
|
5459
|
5457
|
SERIAL_ECHO_START;
|
5460
|
5458
|
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
|
|
5459
|
+ return 0;
|
5461
|
5460
|
}
|
5462
|
5461
|
#ifdef PREVENT_LENGTHY_EXTRUDE
|
5463
|
5462
|
if (labs(de) > EXTRUDE_MAXLENGTH) {
|
5464
|
|
- current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
|
5463
|
+ curr_e = dest_e; // Behave as if the move really took place, but ignore E part
|
5465
|
5464
|
SERIAL_ECHO_START;
|
5466
|
5465
|
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
|
|
5466
|
+ return 0;
|
5467
|
5467
|
}
|
5468
|
5468
|
#endif
|
5469
|
5469
|
}
|
|
5470
|
+ return de;
|
|
5471
|
+ }
|
|
5472
|
+
|
|
5473
|
+#endif // PREVENT_DANGEROUS_EXTRUDE
|
|
5474
|
+
|
|
5475
|
+void prepare_move() {
|
|
5476
|
+ clamp_to_software_endstops(destination);
|
|
5477
|
+ refresh_cmd_timeout();
|
|
5478
|
+
|
|
5479
|
+ #ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
5480
|
+ (void)prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]);
|
5470
|
5481
|
#endif
|
5471
|
5482
|
|
5472
|
5483
|
#ifdef SCARA //for now same as delta-code
|