|
1 | | -/// @file |
| 1 | +/** |
| 2 | + * Marlin 3D Printer Firmware |
| 3 | + * Copyright (c) 2024 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 <https://www.gnu.org/licenses/>. |
| 20 | + * |
| 21 | + */ |
| 22 | + |
| 23 | +/** |
| 24 | + * SpoolJoin.h |
| 25 | + */ |
| 26 | + |
2 | 27 | #pragma once |
3 | 28 | #include <stdint.h> |
4 | 29 | #include "src/MarlinCore.h" |
5 | 30 | #if HAS_PRUSA_MMU3 |
6 | | -// See documentation here: https://help.prusa3d.com/article/spooljoin-mmu2s_134252 |
| 31 | + // See documentation here: https://help.prusa3d.com/article/spooljoin-mmu2s_134252 |
7 | 32 |
|
8 | | -namespace SpoolJoin { |
| 33 | + namespace SpoolJoin { |
9 | 34 |
|
10 | | -class SpoolJoin { |
| 35 | + class SpoolJoin { |
11 | 36 | public: |
12 | | - SpoolJoin(); |
| 37 | + SpoolJoin(); |
13 | 38 |
|
14 | | - enum class EEPROM : uint8_t { |
15 | | - Unknown, ///< SpoolJoin is unknown while printer is booting up |
16 | | - Enabled, ///< SpoolJoin is enabled in EEPROM |
17 | | - Disabled, ///< SpoolJoin is disabled in EEPROM |
18 | | - Empty = 0xFF ///< EEPROM has not been set before and all bits are 1 (0xFF) - either a new printer or user erased the memory |
19 | | - }; |
| 39 | + enum class EEPROM : uint8_t { |
| 40 | + Unknown, ///< SpoolJoin is unknown while printer is booting up |
| 41 | + Enabled, ///< SpoolJoin is enabled in EEPROM |
| 42 | + Disabled, ///< SpoolJoin is disabled in EEPROM |
| 43 | + Empty = 0xFF ///< EEPROM has not been set before and all bits are 1 (0xFF) - either a new printer or user erased the memory |
| 44 | + }; |
20 | 45 |
|
21 | | - // @brief Contrary to Prusa's implementation we store the enabled status in a variable |
22 | | - static int epprom_addr; |
23 | | - static bool enabled; |
| 46 | + // @brief Contrary to Prusa's implementation we store the enabled status in a variable |
| 47 | + static int epprom_addr; |
| 48 | + static bool enabled; |
24 | 49 |
|
25 | | - /// @brief Called when EEPROM is ready to be read |
26 | | - void initSpoolJoinStatus(); |
| 50 | + /// @brief Called when EEPROM is ready to be read |
| 51 | + void initSpoolJoinStatus(); |
27 | 52 |
|
28 | | - /// @brief Toggle SpoolJoin |
29 | | - static void toggleSpoolJoin(); |
| 53 | + /// @brief Toggle SpoolJoin |
| 54 | + static void toggleSpoolJoin(); |
30 | 55 |
|
31 | | - /// @brief Check if SpoolJoin is enabled |
32 | | - /// @returns true if enabled, false if disabled |
33 | | - bool isSpoolJoinEnabled(); |
| 56 | + /// @brief Check if SpoolJoin is enabled |
| 57 | + /// @returns true if enabled, false if disabled |
| 58 | + bool isSpoolJoinEnabled(); |
34 | 59 |
|
35 | | - /// @brief Update the saved MMU slot number so SpoolJoin can determine the next slot to use |
36 | | - /// @param slot number of the slot to set |
37 | | - void setSlot(uint8_t slot); |
| 60 | + /// @brief Update the saved MMU slot number so SpoolJoin can determine the next slot to use |
| 61 | + /// @param slot number of the slot to set |
| 62 | + void setSlot(uint8_t slot); |
38 | 63 |
|
39 | | - /// @brief Fetch the next slot number should count from 0 to 4. |
40 | | - /// When filament slot 4 is depleted, the next slot should be 0. |
41 | | - /// @returns the next slot, ranges from 0 to 4 |
42 | | - uint8_t nextSlot(); |
| 64 | + /// @brief Fetch the next slot number should count from 0 to 4. |
| 65 | + /// When filament slot 4 is depleted, the next slot should be 0. |
| 66 | + /// @returns the next slot, ranges from 0 to 4 |
| 67 | + uint8_t nextSlot(); |
43 | 68 |
|
44 | 69 | private: |
45 | | - /// @brief Currently used slot, ranges from 0 to 4 |
46 | | - uint8_t currentMMUSlot; |
47 | | -}; |
| 70 | + /// @brief Currently used slot, ranges from 0 to 4 |
| 71 | + uint8_t currentMMUSlot; |
| 72 | + }; |
48 | 73 |
|
49 | | -extern SpoolJoin spooljoin; |
| 74 | + extern SpoolJoin spooljoin; |
50 | 75 |
|
51 | | -} // namespace SpoolJoin |
| 76 | + } // namespace SpoolJoin |
52 | 77 | #endif // HAS_PRUSA_MMU3 |
0 commit comments