-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78b94b8
commit af7c1dd
Showing
12 changed files
with
229 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Marlin 3D Printer Firmware | ||
* Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||
* | ||
* Based on Sprinter and grbl. | ||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "../../inc/MarlinConfig.h" | ||
|
||
#if HAS_CHAMELEON | ||
|
||
#include "chameleon.h" | ||
//#include "../../MarlinCore.h" | ||
#include "../../module/planner.h" | ||
#include "../../module/stepper.h" | ||
#include "../../lcd/marlinui.h" | ||
|
||
//#define DEBUG_OUT ENABLED(DEBUG_CHAMELEON) | ||
#include "../../core/debug_out.h" | ||
|
||
Chameleon chameleon; | ||
|
||
struct E_Step { | ||
float extrude; | ||
feedRate_t feedRate; | ||
}; | ||
|
||
void Chameleon::tool_change(const uint8_t index) { | ||
if (index == active_extruder) return; | ||
|
||
ui.status_printf(0, GET_TEXT_F(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); | ||
|
||
static constexpr E_Step ramming_sequence[] PROGMEM = { CHAMELEON_RAMMING_SEQUENCE }; | ||
execute_extruder_sequence(ramming_sequence, COUNT(ramming_sequence)); | ||
|
||
ui.reset_status(); | ||
} | ||
|
||
void Chameleon::execute_extruder_sequence(const E_Step * const sequence, const uint8_t steps) { | ||
planner.synchronize(); | ||
stepper.enable_extruder(); | ||
|
||
const E_Step *step = sequence; | ||
|
||
LOOP_L_N(i, steps) { | ||
const float es = pgm_read_float(&(step->extrude)); | ||
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate)); | ||
|
||
DEBUG_ECHO_MSG("E step ", es, "/", fr_mm_m); | ||
|
||
current_position.e += es; | ||
line_to_current_position(MMM_TO_MMS(fr_mm_m)); | ||
planner.synchronize(); | ||
|
||
step++; | ||
} | ||
|
||
stepper.disable_extruder(); | ||
} | ||
|
||
#endif // HAS_CHAMELEON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Marlin 3D Printer Firmware | ||
* Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||
* | ||
* Based on Sprinter and grbl. | ||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
struct E_Step; | ||
|
||
class Chameleon { | ||
public: | ||
Chameleon() {} | ||
static void tool_change(const uint8_t new_tool); | ||
|
||
private: | ||
static void execute_extruder_sequence(const E_Step * const sequence, const uint8_t steps); | ||
static void push_button(); | ||
}; | ||
|
||
extern Chameleon chameleon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters