Sync MK3<->MK4 MMU2 Tune, Buttons, PowerPanic hooks refactoring
This commit is contained in:
parent
9b48ab729a
commit
59e49c80f9
|
|
@ -204,7 +204,7 @@ void MMU2::CheckFINDARunout() {
|
||||||
// Check for FINDA filament runout
|
// Check for FINDA filament runout
|
||||||
if (!FindaDetectsFilament() && check_fsensor()) {
|
if (!FindaDetectsFilament() && check_fsensor()) {
|
||||||
SERIAL_ECHOLNPGM("FINDA filament runout!");
|
SERIAL_ECHOLNPGM("FINDA filament runout!");
|
||||||
stop_and_save_print_to_ram(0, 0);
|
marlin_stop_and_save_print_to_ram();
|
||||||
restore_print_from_ram_and_continue(0);
|
restore_print_from_ram_and_continue(0);
|
||||||
if (SpoolJoin::spooljoin.isSpoolJoinEnabled() && get_current_tool() != (uint8_t)FILAMENT_UNKNOWN){ // Can't auto if F=?
|
if (SpoolJoin::spooljoin.isSpoolJoinEnabled() && get_current_tool() != (uint8_t)FILAMENT_UNKNOWN){ // Can't auto if F=?
|
||||||
enquecommand_front_P(PSTR("M600 AUTO")); // save print and run M600 command
|
enquecommand_front_P(PSTR("M600 AUTO")); // save print and run M600 command
|
||||||
|
|
@ -261,7 +261,6 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
|
||||||
|
|
||||||
// MMU has finished its load, push the filament further by some defined constant length
|
// MMU has finished its load, push the filament further by some defined constant length
|
||||||
// If the filament sensor reads 0 at any moment, then report FAILURE
|
// If the filament sensor reads 0 at any moment, then report FAILURE
|
||||||
|
|
||||||
const float tryload_length = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance();
|
const float tryload_length = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance();
|
||||||
TryLoadUnloadReporter tlur(tryload_length);
|
TryLoadUnloadReporter tlur(tryload_length);
|
||||||
|
|
||||||
|
|
@ -617,7 +616,7 @@ void MMU2::SaveAndPark(bool move_axes) {
|
||||||
|
|
||||||
// In case a power panic happens while waiting for the user
|
// In case a power panic happens while waiting for the user
|
||||||
// take a partial back up of print state into RAM (current position, etc.)
|
// take a partial back up of print state into RAM (current position, etc.)
|
||||||
refresh_print_state_in_ram();
|
marlin_refresh_print_state_in_ram();
|
||||||
|
|
||||||
if (move_axes) {
|
if (move_axes) {
|
||||||
mmu_print_saved |= SavedState::ParkExtruder;
|
mmu_print_saved |= SavedState::ParkExtruder;
|
||||||
|
|
@ -676,7 +675,7 @@ void MMU2::ResumeUnpark() {
|
||||||
// From this point forward, power panic should not use
|
// From this point forward, power panic should not use
|
||||||
// the partial backup in RAM since the extruder is no
|
// the partial backup in RAM since the extruder is no
|
||||||
// longer in parking position
|
// longer in parking position
|
||||||
clear_print_state_in_ram();
|
marlin_clear_print_state_in_ram();
|
||||||
|
|
||||||
mmu_print_saved &= ~(SavedState::ParkExtruder);
|
mmu_print_saved &= ~(SavedState::ParkExtruder);
|
||||||
}
|
}
|
||||||
|
|
@ -707,12 +706,12 @@ void MMU2::CheckUserInput() {
|
||||||
case Buttons::Middle:
|
case Buttons::Middle:
|
||||||
case Buttons::Right:
|
case Buttons::Right:
|
||||||
SERIAL_ECHOPGM("CheckUserInput-btnLMR ");
|
SERIAL_ECHOPGM("CheckUserInput-btnLMR ");
|
||||||
SERIAL_ECHOLN(btn);
|
SERIAL_ECHOLN(buttons_to_uint8t(btn));
|
||||||
ResumeHotendTemp(); // Recover the hotend temp before we attempt to do anything else...
|
ResumeHotendTemp(); // Recover the hotend temp before we attempt to do anything else...
|
||||||
|
|
||||||
if (mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
|
if (mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
|
||||||
// Do not send a button to the MMU unless the MMU is in error state
|
// Do not send a button to the MMU unless the MMU is in error state
|
||||||
Button(btn);
|
Button(buttons_to_uint8t(btn));
|
||||||
}
|
}
|
||||||
|
|
||||||
// A quick hack: for specific error codes move the E-motor every time.
|
// A quick hack: for specific error codes move the E-motor every time.
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
// Helper macros to parse the operations from Btns()
|
// Helper macros to parse the operations from Btns()
|
||||||
#define BUTTON_OP_RIGHT(X) ( ( X & 0xF0 ) >> 4 )
|
#define BUTTON_OP_RIGHT(X) ((X & 0xF0) >> 4)
|
||||||
#define BUTTON_OP_MIDDLE(X) ( X & 0x0F )
|
#define BUTTON_OP_MIDDLE(X) (X & 0x0F)
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
|
|
@ -23,11 +23,11 @@ enum class ButtonOperations : uint8_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Button codes + extended actions performed on the printer's side
|
/// Button codes + extended actions performed on the printer's side
|
||||||
enum Buttons : uint8_t {
|
enum class Buttons : uint_least8_t {
|
||||||
Right = 0,
|
Right = 0,
|
||||||
Middle,
|
Middle,
|
||||||
Left,
|
Left,
|
||||||
|
|
||||||
// performed on the printer's side
|
// performed on the printer's side
|
||||||
ResetMMU,
|
ResetMMU,
|
||||||
Load,
|
Load,
|
||||||
|
|
@ -35,9 +35,12 @@ enum Buttons : uint8_t {
|
||||||
StopPrint,
|
StopPrint,
|
||||||
DisableMMU,
|
DisableMMU,
|
||||||
TuneMMU, // Printer changes MMU register value
|
TuneMMU, // Printer changes MMU register value
|
||||||
|
|
||||||
NoButton = 0xff // shall be kept last
|
NoButton = 0xff // shall be kept last
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr uint_least8_t buttons_to_uint8t(Buttons b) {
|
||||||
|
return static_cast<uint8_t>(b);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace MMU2
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ bool marlin_printingIsActive();
|
||||||
void marlin_manage_heater();
|
void marlin_manage_heater();
|
||||||
void marlin_manage_inactivity(bool b);
|
void marlin_manage_inactivity(bool b);
|
||||||
void marlin_idle(bool b);
|
void marlin_idle(bool b);
|
||||||
|
void marlin_refresh_print_state_in_ram();
|
||||||
|
void marlin_clear_print_state_in_ram();
|
||||||
|
void marlin_stop_and_save_print_to_ram();
|
||||||
|
|
||||||
int16_t thermal_degTargetHotend();
|
int16_t thermal_degTargetHotend();
|
||||||
int16_t thermal_degHotend();
|
int16_t thermal_degHotend();
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,18 @@ void marlin_idle(bool b){
|
||||||
manage_inactivity(b);
|
manage_inactivity(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void marlin_refresh_print_state_in_ram(){
|
||||||
|
refresh_print_state_in_ram();
|
||||||
|
}
|
||||||
|
|
||||||
|
void marlin_clear_print_state_in_ram(){
|
||||||
|
clear_print_state_in_ram();
|
||||||
|
}
|
||||||
|
|
||||||
|
void marlin_stop_and_save_print_to_ram(){
|
||||||
|
stop_and_save_print_to_ram(0,0);
|
||||||
|
}
|
||||||
|
|
||||||
int16_t thermal_degTargetHotend() {
|
int16_t thermal_degTargetHotend() {
|
||||||
return degTargetHotend(0);
|
return degTargetHotend(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue