1 |
ron |
1 |
/**
|
|
|
2 |
* Marlin 3D Printer Firmware
|
|
|
3 |
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
4 |
*
|
|
|
5 |
* Based on Sprinter and grbl.
|
|
|
6 |
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
7 |
*
|
|
|
8 |
* This program is free software: you can redistribute it and/or modify
|
|
|
9 |
* it under the terms of the GNU General Public License as published by
|
|
|
10 |
* the Free Software Foundation, either version 3 of the License, or
|
|
|
11 |
* (at your option) any later version.
|
|
|
12 |
*
|
|
|
13 |
* This program is distributed in the hope that it will be useful,
|
|
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
16 |
* GNU General Public License for more details.
|
|
|
17 |
*
|
|
|
18 |
* You should have received a copy of the GNU General Public License
|
|
|
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20 |
*
|
|
|
21 |
*/
|
|
|
22 |
|
|
|
23 |
/**
|
|
|
24 |
* fwretract.h - Define firmware-based retraction interface
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
#ifndef FWRETRACT_H
|
|
|
28 |
#define FWRETRACT_H
|
|
|
29 |
|
|
|
30 |
#include "MarlinConfig.h"
|
|
|
31 |
|
|
|
32 |
class FWRetract {
|
|
|
33 |
public:
|
|
|
34 |
static bool autoretract_enabled, // M209 S - Autoretract switch
|
|
|
35 |
retracted[EXTRUDERS]; // Which extruders are currently retracted
|
|
|
36 |
#if EXTRUDERS > 1
|
|
|
37 |
static bool retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted
|
|
|
38 |
#endif
|
|
|
39 |
static float retract_length, // M207 S - G10 Retract length
|
|
|
40 |
retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
|
|
|
41 |
retract_zlift, // M207 Z - G10 Retract hop size
|
|
|
42 |
retract_recover_length, // M208 S - G11 Recover length
|
|
|
43 |
retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate
|
|
|
44 |
swap_retract_length, // M207 W - G10 Swap Retract length
|
|
|
45 |
swap_retract_recover_length, // M208 W - G11 Swap Recover length
|
|
|
46 |
swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate
|
|
|
47 |
hop_amount;
|
|
|
48 |
|
|
|
49 |
FWRetract() { reset(); }
|
|
|
50 |
|
|
|
51 |
static void reset();
|
|
|
52 |
|
|
|
53 |
static void refresh_autoretract() {
|
|
|
54 |
for (uint8_t i = 0; i < EXTRUDERS; i++) retracted[i] = false;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
static void enable_autoretract(const bool enable) {
|
|
|
58 |
autoretract_enabled = enable;
|
|
|
59 |
refresh_autoretract();
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
static void retract(const bool retracting
|
|
|
63 |
#if EXTRUDERS > 1
|
|
|
64 |
, bool swapping = false
|
|
|
65 |
#endif
|
|
|
66 |
);
|
|
|
67 |
};
|
|
|
68 |
|
|
|
69 |
extern FWRetract fwretract;
|
|
|
70 |
|
|
|
71 |
#endif // FWRETRACT_H
|