Merge branch 'MK3' into mbl_mag_comp
This commit is contained in:
commit
1996f977e1
|
|
@ -2820,15 +2820,13 @@ static void gcode_G80()
|
||||||
run = false;
|
run = false;
|
||||||
#endif //PINDA_THERMISTOR
|
#endif //PINDA_THERMISTOR
|
||||||
|
|
||||||
uint8_t nMeasPoints = code_seen('N') ? code_value_uint8() : eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR);
|
uint8_t nMeasPoints = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR);
|
||||||
if (nMeasPoints != 7) {
|
if (uint8_t codeSeen = code_seen('N'), value = code_value_uint8(); codeSeen && (value == 7 || value == 3))
|
||||||
nMeasPoints = 3;
|
nMeasPoints = value;
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nProbeRetryCount = code_seen('C') ? code_value_uint8() : eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR);
|
uint8_t nProbeRetryCount = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR);
|
||||||
if (nProbeRetryCount > 10) {
|
if (uint8_t codeSeen = code_seen('C'), value = code_value_uint8(); codeSeen && value >= 1 && value <= 10)
|
||||||
nProbeRetryCount = 10;
|
nProbeRetryCount = value;
|
||||||
}
|
|
||||||
|
|
||||||
const float area_min_x = code_seen('X') ? code_value() - x_mesh_density - X_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
const float area_min_x = code_seen('X') ? code_value() - x_mesh_density - X_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
||||||
const float area_min_y = code_seen('Y') ? code_value() - y_mesh_density - Y_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
const float area_min_y = code_seen('Y') ? code_value() - y_mesh_density - Y_PROBE_OFFSET_FROM_EXTRUDER : -INFINITY;
|
||||||
|
|
@ -2973,7 +2971,7 @@ static void gcode_G80()
|
||||||
static uint8_t g80_fail_cnt = 0;
|
static uint8_t g80_fail_cnt = 0;
|
||||||
if (mesh_point != MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) {
|
if (mesh_point != MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) {
|
||||||
if (g80_fail_cnt++ >= 2) {
|
if (g80_fail_cnt++ >= 2) {
|
||||||
kill(PSTR("Mesh bed leveling failed. Please run Z calibration."));
|
kill(_i("Mesh bed leveling failed. Please run Z calibration.")); ////MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
}
|
}
|
||||||
Sound_MakeSound(e_SOUND_TYPE_StandardAlert);
|
Sound_MakeSound(e_SOUND_TYPE_StandardAlert);
|
||||||
bool bState;
|
bool bState;
|
||||||
|
|
@ -3328,10 +3326,10 @@ static void mmu_M600_filament_change_screen(uint8_t eject_slot) {
|
||||||
manage_heater();
|
manage_heater();
|
||||||
manage_inactivity(true);
|
manage_inactivity(true);
|
||||||
|
|
||||||
btn = MMU2::mmu2.getPrinterButtonOperation();
|
btn = MMU2::mmu2.GetPrinterButtonOperation();
|
||||||
if (btn != MMU2::Buttons::NoButton)
|
if (btn != MMU2::Buttons::NoButton)
|
||||||
{
|
{
|
||||||
MMU2::mmu2.clearPrinterButtonOperation();
|
MMU2::mmu2.ClearPrinterButtonOperation();
|
||||||
|
|
||||||
if (btn == MMU2::Buttons::Eject) {
|
if (btn == MMU2::Buttons::Eject) {
|
||||||
if (eject_slot != (uint8_t)MMU2::FILAMENT_UNKNOWN) {
|
if (eject_slot != (uint8_t)MMU2::FILAMENT_UNKNOWN) {
|
||||||
|
|
@ -4886,9 +4884,9 @@ void process_commands()
|
||||||
G80 [ N | C | O | M | L | R | F | B | X | Y | W | H ]
|
G80 [ N | C | O | M | L | R | F | B | X | Y | W | H ]
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
- `N` - Number of mesh points on x axis. Default is 3. Valid values are 3 and 7.
|
- `N` - Number of mesh points on x axis. Default is value stored in EEPROM. Valid values are 3 and 7.
|
||||||
- `C` - Probe retry counts. Default 3 max. 10
|
- `C` - Probe retry counts. Default is value stored in EEPROM. Valid values are 1 to 10.
|
||||||
- `O` - Return to origin. Default 1 (true)
|
- `O` - Return to origin. Default is 1. Valid values are 0 (false) and 1 (true).
|
||||||
- `M` - Use magnet compensation. Will only be used if number of mesh points is set to 7. Default is value stored in EEPROM. Valid values are 0 (false) and 1 (true).
|
- `M` - Use magnet compensation. Will only be used if number of mesh points is set to 7. Default is value stored in EEPROM. Valid values are 0 (false) and 1 (true).
|
||||||
|
|
||||||
Using the following parameters enables additional "manual" bed leveling correction. Valid values are -100 microns to 100 microns.
|
Using the following parameters enables additional "manual" bed leveling correction. Valid values are -100 microns to 100 microns.
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,7 @@ void MMU2::StopKeepPowered() {
|
||||||
void MMU2::Tune() {
|
void MMU2::Tune() {
|
||||||
switch (lastErrorCode) {
|
switch (lastErrorCode) {
|
||||||
case ErrorCode::HOMING_SELECTOR_FAILED:
|
case ErrorCode::HOMING_SELECTOR_FAILED:
|
||||||
case ErrorCode::HOMING_IDLER_FAILED:
|
case ErrorCode::HOMING_IDLER_FAILED: {
|
||||||
{
|
|
||||||
// Prompt a menu for different values
|
// Prompt a menu for different values
|
||||||
tuneIdlerStallguardThreshold();
|
tuneIdlerStallguardThreshold();
|
||||||
break;
|
break;
|
||||||
|
|
@ -115,7 +114,7 @@ void MMU2::ResetX0() {
|
||||||
logic.ResetMMU(); // Send soft reset
|
logic.ResetMMU(); // Send soft reset
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::ResetX42(){
|
void MMU2::ResetX42() {
|
||||||
logic.ResetMMU(42);
|
logic.ResetMMU(42);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,7 +195,7 @@ void __attribute__((noinline)) MMU2::mmu_loop_inner(bool reportErrors) {
|
||||||
if (isErrorScreenRunning()) {
|
if (isErrorScreenRunning()) {
|
||||||
// Call this every iteration to keep the knob rotation responsive
|
// Call this every iteration to keep the knob rotation responsive
|
||||||
// This includes when mmu_loop is called within manage_response
|
// This includes when mmu_loop is called within manage_response
|
||||||
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)lastErrorCode, uint8_t(lastErrorSource));
|
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), lastErrorCode, uint8_t(lastErrorSource));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,7 +203,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
|
||||||
|
|
@ -218,10 +217,10 @@ struct ReportingRAII {
|
||||||
CommandInProgress cip;
|
CommandInProgress cip;
|
||||||
explicit inline __attribute__((always_inline)) ReportingRAII(CommandInProgress cip)
|
explicit inline __attribute__((always_inline)) ReportingRAII(CommandInProgress cip)
|
||||||
: cip(cip) {
|
: cip(cip) {
|
||||||
BeginReport(cip, (uint16_t)ProgressCode::EngagingIdler);
|
BeginReport(cip, ProgressCode::EngagingIdler);
|
||||||
}
|
}
|
||||||
inline __attribute__((always_inline)) ~ReportingRAII() {
|
inline __attribute__((always_inline)) ~ReportingRAII() {
|
||||||
EndReport(cip, (uint16_t)ProgressCode::OK);
|
EndReport(cip, ProgressCode::OK);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -237,7 +236,7 @@ bool MMU2::WaitForMMUReady() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::RetryIfPossible(uint16_t ec) {
|
bool MMU2::RetryIfPossible(ErrorCode ec) {
|
||||||
if (logic.RetryAttempts()) {
|
if (logic.RetryAttempts()) {
|
||||||
SetButtonResponse(ButtonOperations::Retry);
|
SetButtonResponse(ButtonOperations::Retry);
|
||||||
// check, that Retry is actually allowed on that operation
|
// check, that Retry is actually allowed on that operation
|
||||||
|
|
@ -256,23 +255,13 @@ bool MMU2::RetryIfPossible(uint16_t ec) {
|
||||||
bool MMU2::VerifyFilamentEnteredPTFE() {
|
bool MMU2::VerifyFilamentEnteredPTFE() {
|
||||||
planner_synchronize();
|
planner_synchronize();
|
||||||
|
|
||||||
if (WhereIsFilament() == FilamentState::NOT_PRESENT)
|
if (WhereIsFilament() != FilamentState::AT_FSENSOR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint8_t fsensorState = 0;
|
|
||||||
uint8_t fsensorStateLCD = 0;
|
|
||||||
uint8_t lcd_cursor_col = 0;
|
|
||||||
// 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 delta_mm = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance();
|
TryLoadUnloadReporter tlur(tryload_length);
|
||||||
|
|
||||||
// The total length is twice delta_mm. Divide that length by number of pixels
|
|
||||||
// available to get length per pixel.
|
|
||||||
// Note: Below is the reciprocal of (2 * delta_mm) / LCD_WIDTH [mm/pixel]
|
|
||||||
const float pixel_per_mm = 0.5f * float(LCD_WIDTH) / (delta_mm);
|
|
||||||
|
|
||||||
TryLoadUnloadProgressbarInit();
|
|
||||||
|
|
||||||
/* The position is a triangle wave
|
/* The position is a triangle wave
|
||||||
// current position is not zero, it is an offset
|
// current position is not zero, it is an offset
|
||||||
|
|
@ -284,7 +273,7 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
|
||||||
// in the slope's sign or check the last machine position.
|
// in the slope's sign or check the last machine position.
|
||||||
// y(x)
|
// y(x)
|
||||||
// ▲
|
// ▲
|
||||||
// │ ^◄────────── delta_mm + current_position
|
// │ ^◄────────── tryload_length + current_position
|
||||||
// machine │ / \
|
// machine │ / \
|
||||||
// position │ / \◄────────── stepper_position_mm + current_position
|
// position │ / \◄────────── stepper_position_mm + current_position
|
||||||
// (mm) │ / \
|
// (mm) │ / \
|
||||||
|
|
@ -295,42 +284,24 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
|
||||||
// pixel #
|
// pixel #
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool filament_inserted = true; // expect success
|
||||||
// Pixel index will go from 0 to 10, then back from 10 to 0
|
// Pixel index will go from 0 to 10, then back from 10 to 0
|
||||||
// The change in this number is used to indicate a new pixel
|
// The change in this number is used to indicate a new pixel
|
||||||
// should be drawn on the display
|
// should be drawn on the display
|
||||||
uint8_t dpixel1 = 0;
|
|
||||||
uint8_t dpixel0 = 0;
|
|
||||||
for (uint8_t move = 0; move < 2; move++) {
|
for (uint8_t move = 0; move < 2; move++) {
|
||||||
MoveE(move == 0 ? delta_mm : -delta_mm, MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
|
extruder_move(move == 0 ? tryload_length : -tryload_length, MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE);
|
||||||
while (planner_any_moves()) {
|
while (planner_any_moves()) {
|
||||||
// Wait for move to finish and monitor the fsensor the entire time
|
filament_inserted = filament_inserted && (WhereIsFilament() == FilamentState::AT_FSENSOR);
|
||||||
// A single 0 reading will set the bit.
|
tlur.Progress(filament_inserted);
|
||||||
fsensorStateLCD |= (WhereIsFilament() == FilamentState::NOT_PRESENT);
|
|
||||||
fsensorState |= fsensorStateLCD; // No need to do the above comparison twice, just bitwise OR
|
|
||||||
|
|
||||||
// Always round up, you can only have 'whole' pixels. (floor is also an option)
|
|
||||||
dpixel1 = ceil((stepper_get_machine_position_E_mm() - planner_get_current_position_E()) * pixel_per_mm);
|
|
||||||
if (dpixel1 - dpixel0) {
|
|
||||||
dpixel0 = dpixel1;
|
|
||||||
if (lcd_cursor_col > (LCD_WIDTH - 1)) lcd_cursor_col = LCD_WIDTH - 1;
|
|
||||||
TryLoadUnloadProgressbar(lcd_cursor_col++, fsensorStateLCD);
|
|
||||||
fsensorStateLCD = 0; // Clear temporary bit
|
|
||||||
}
|
|
||||||
safe_delay_keep_alive(0);
|
safe_delay_keep_alive(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Disable_E0();
|
Disable_E0();
|
||||||
TryLoadUnloadProgressbarEcho();
|
if (!filament_inserted) {
|
||||||
TryLoadUnloadProgressbarDeinit();
|
|
||||||
|
|
||||||
if (fsensorState) {
|
|
||||||
IncrementLoadFails();
|
IncrementLoadFails();
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
// else, happy printing! :)
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
tlur.DumpToSerial();
|
||||||
|
return filament_inserted;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
|
bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
|
||||||
|
|
@ -355,8 +326,6 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot) {
|
||||||
// but honestly - if the MMU restarts during every toolchange,
|
// but honestly - if the MMU restarts during every toolchange,
|
||||||
// something else is seriously broken and stopping a print is probably our best option.
|
// something else is seriously broken and stopping a print is probably our best option.
|
||||||
}
|
}
|
||||||
// reset current position to whatever the planner thinks it is
|
|
||||||
planner_set_current_position_E(planner_get_current_position_E());
|
|
||||||
if (VerifyFilamentEnteredPTFE()) {
|
if (VerifyFilamentEnteredPTFE()) {
|
||||||
return true; // success
|
return true; // success
|
||||||
} else { // Prepare a retry attempt
|
} else { // Prepare a retry attempt
|
||||||
|
|
@ -455,7 +424,7 @@ uint8_t MMU2::get_tool_change_tool() const {
|
||||||
bool MMU2::set_filament_type(uint8_t /*slot*/, uint8_t /*type*/) {
|
bool MMU2::set_filament_type(uint8_t /*slot*/, uint8_t /*type*/) {
|
||||||
if (!WaitForMMUReady())
|
if (!WaitForMMUReady())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// @@TODO - this is not supported in the new MMU yet
|
// @@TODO - this is not supported in the new MMU yet
|
||||||
// slot = slot; // @@TODO
|
// slot = slot; // @@TODO
|
||||||
// type = type; // @@TODO
|
// type = type; // @@TODO
|
||||||
|
|
@ -496,9 +465,11 @@ bool MMU2::unload() {
|
||||||
|
|
||||||
WaitForHotendTargetTempBeep();
|
WaitForHotendTargetTempBeep();
|
||||||
|
|
||||||
ReportingRAII rep(CommandInProgress::UnloadFilament);
|
{
|
||||||
UnloadInner();
|
ReportingRAII rep(CommandInProgress::UnloadFilament);
|
||||||
|
UnloadInner();
|
||||||
|
}
|
||||||
|
ScreenUpdateEnable();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -526,10 +497,10 @@ bool MMU2::cut_filament(uint8_t slot, bool enableFullScreenMsg /*= true*/) {
|
||||||
|
|
||||||
ReportingRAII rep(CommandInProgress::CutFilament);
|
ReportingRAII rep(CommandInProgress::CutFilament);
|
||||||
CutFilamentInner(slot);
|
CutFilamentInner(slot);
|
||||||
|
extruder = MMU2_NO_TOOL;
|
||||||
|
tool_change_extruder = MMU2_NO_TOOL;
|
||||||
|
MakeSound(SoundType::Confirm);
|
||||||
}
|
}
|
||||||
extruder = MMU2_NO_TOOL;
|
|
||||||
tool_change_extruder = MMU2_NO_TOOL;
|
|
||||||
MakeSound(SoundType::Confirm);
|
|
||||||
ScreenUpdateEnable();
|
ScreenUpdateEnable();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -548,20 +519,18 @@ bool MMU2::load_filament(uint8_t slot) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FullScreenMsgLoad(slot);
|
FullScreenMsgLoad(slot);
|
||||||
|
{
|
||||||
ReportingRAII rep(CommandInProgress::LoadFilament);
|
ReportingRAII rep(CommandInProgress::LoadFilament);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Disable_E0();
|
Disable_E0();
|
||||||
logic.LoadFilament(slot);
|
logic.LoadFilament(slot);
|
||||||
if (manage_response(false, false))
|
if (manage_response(false, false))
|
||||||
break;
|
break;
|
||||||
IncrementMMUFails();
|
IncrementMMUFails();
|
||||||
|
}
|
||||||
|
MakeSound(SoundType::Confirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeSound(SoundType::Confirm);
|
|
||||||
|
|
||||||
ScreenUpdateEnable();
|
ScreenUpdateEnable();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -611,10 +580,11 @@ bool MMU2::eject_filament(uint8_t slot, bool enableFullScreenMsg /* = true */) {
|
||||||
break;
|
break;
|
||||||
IncrementMMUFails();
|
IncrementMMUFails();
|
||||||
}
|
}
|
||||||
|
extruder = MMU2_NO_TOOL;
|
||||||
|
tool_change_extruder = MMU2_NO_TOOL;
|
||||||
|
MakeSound(Confirm);
|
||||||
}
|
}
|
||||||
extruder = MMU2_NO_TOOL;
|
ScreenUpdateEnable();
|
||||||
tool_change_extruder = MMU2_NO_TOOL;
|
|
||||||
MakeSound(Confirm);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -647,14 +617,14 @@ 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;
|
||||||
resume_position = planner_current_position(); // save current pos
|
resume_position = planner_current_position(); // save current pos
|
||||||
|
|
||||||
// lift Z
|
// lift Z
|
||||||
MoveRaiseZ(MMU_ERR_Z_PAUSE_LIFT);
|
move_raise_z(MMU_ERR_Z_PAUSE_LIFT);
|
||||||
|
|
||||||
// move XY aside
|
// move XY aside
|
||||||
if (all_axes_homed()) {
|
if (all_axes_homed()) {
|
||||||
|
|
@ -706,14 +676,14 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::CheckUserInput() {
|
void MMU2::CheckUserInput() {
|
||||||
auto btn = ButtonPressed((uint16_t)lastErrorCode);
|
auto btn = ButtonPressed(lastErrorCode);
|
||||||
|
|
||||||
// Was a button pressed on the MMU itself instead of the LCD?
|
// Was a button pressed on the MMU itself instead of the LCD?
|
||||||
if (btn == Buttons::NoButton && lastButton != Buttons::NoButton) {
|
if (btn == Buttons::NoButton && lastButton != Buttons::NoButton) {
|
||||||
|
|
@ -737,12 +707,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.
|
||||||
|
|
@ -763,7 +733,7 @@ void MMU2::CheckUserInput() {
|
||||||
case Buttons::Load:
|
case Buttons::Load:
|
||||||
case Buttons::Eject:
|
case Buttons::Eject:
|
||||||
// High level operation
|
// High level operation
|
||||||
setPrinterButtonOperation(btn);
|
SetPrinterButtonOperation(btn);
|
||||||
break;
|
break;
|
||||||
case Buttons::ResetMMU:
|
case Buttons::ResetMMU:
|
||||||
Reset(ResetPin); // we cannot do power cycle on the MK3
|
Reset(ResetPin); // we cannot do power cycle on the MK3
|
||||||
|
|
@ -929,8 +899,8 @@ void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t steps) {
|
||||||
planner_synchronize();
|
planner_synchronize();
|
||||||
|
|
||||||
const E_Step *step = sequence;
|
const E_Step *step = sequence;
|
||||||
for (uint8_t i = steps; i ; --i) {
|
for (uint8_t i = steps; i > 0; --i) {
|
||||||
MoveE(pgm_read_float(&(step->extrude)), pgm_read_float(&(step->feedRate)));
|
extruder_move(pgm_read_float(&(step->extrude)), pgm_read_float(&(step->feedRate)));
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
planner_synchronize(); // it looks like it's better to sync the moves at the end - smoother move (if the sequence is not too long).
|
planner_synchronize(); // it looks like it's better to sync the moves at the end - smoother move (if the sequence is not too long).
|
||||||
|
|
@ -976,12 +946,13 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
|
||||||
if (ec != lastErrorCode) { // deduplicate: only report changes in error codes into the log
|
if (ec != lastErrorCode) { // deduplicate: only report changes in error codes into the log
|
||||||
lastErrorCode = ec;
|
lastErrorCode = ec;
|
||||||
lastErrorSource = res;
|
lastErrorSource = res;
|
||||||
LogErrorEvent_P(_O(PrusaErrorTitle(PrusaErrorCodeIndex((uint16_t)ec))));
|
LogErrorEvent_P(_O(PrusaErrorTitle(PrusaErrorCodeIndex(ec))));
|
||||||
|
|
||||||
if (ec != ErrorCode::OK && ec != ErrorCode::FILAMENT_EJECTED && ec != ErrorCode::FILAMENT_CHANGE) {
|
if (ec != ErrorCode::OK && ec != ErrorCode::FILAMENT_EJECTED && ec != ErrorCode::FILAMENT_CHANGE) {
|
||||||
IncrementMMUFails();
|
IncrementMMUFails();
|
||||||
|
|
||||||
// check if it is a "power" failure - we consider TMC-related errors as power failures
|
// check if it is a "power" failure - we consider TMC-related errors as power failures
|
||||||
|
// clang-format off
|
||||||
static constexpr uint16_t tmcMask =
|
static constexpr uint16_t tmcMask =
|
||||||
( (uint16_t)ErrorCode::TMC_IOIN_MISMATCH
|
( (uint16_t)ErrorCode::TMC_IOIN_MISMATCH
|
||||||
| (uint16_t)ErrorCode::TMC_RESET
|
| (uint16_t)ErrorCode::TMC_RESET
|
||||||
|
|
@ -990,6 +961,7 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
|
||||||
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN
|
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN
|
||||||
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR
|
| (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR
|
||||||
| (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION ) & 0x7fffU; // skip the top bit
|
| (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION ) & 0x7fffU; // skip the top bit
|
||||||
|
// clang-format on
|
||||||
static_assert(tmcMask == 0x7e00); // just make sure we fail compilation if any of the TMC error codes change
|
static_assert(tmcMask == 0x7e00); // just make sure we fail compilation if any of the TMC error codes change
|
||||||
|
|
||||||
if ((uint16_t)ec & tmcMask) { // @@TODO can be optimized to uint8_t operation
|
if ((uint16_t)ec & tmcMask) { // @@TODO can be optimized to uint8_t operation
|
||||||
|
|
@ -999,11 +971,11 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mmu2.RetryIfPossible((uint16_t)ec)) {
|
if (!mmu2.RetryIfPossible(ec)) {
|
||||||
// If retry attempts are all used up
|
// If retry attempts are all used up
|
||||||
// or if 'Retry' operation is not available
|
// or if 'Retry' operation is not available
|
||||||
// raise the MMU error sceen and wait for user input
|
// raise the MMU error screen and wait for user input
|
||||||
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)ec, uint8_t(lastErrorSource));
|
ReportErrorHook((CommandInProgress)logic.CommandInProgress(), ec, uint8_t(lastErrorSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
static_assert(mmu2Magic[0] == 'M'
|
static_assert(mmu2Magic[0] == 'M'
|
||||||
|
|
@ -1016,8 +988,8 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::ReportProgress(ProgressCode pc) {
|
void MMU2::ReportProgress(ProgressCode pc) {
|
||||||
ReportProgressHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)pc);
|
ReportProgressHook((CommandInProgress)logic.CommandInProgress(), pc);
|
||||||
LogEchoEvent_P(_O(ProgressCodeToText((uint16_t)pc)));
|
LogEchoEvent_P(_O(ProgressCodeToText(pc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::OnMMUProgressMsg(ProgressCode pc) {
|
void MMU2::OnMMUProgressMsg(ProgressCode pc) {
|
||||||
|
|
@ -1058,7 +1030,7 @@ void MMU2::OnMMUProgressMsgChanged(ProgressCode pc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((noinline)) MMU2::HelpUnloadToFinda() {
|
void __attribute__((noinline)) MMU2::HelpUnloadToFinda() {
|
||||||
MoveE(-MMU2_RETRY_UNLOAD_TO_FINDA_LENGTH, MMU2_RETRY_UNLOAD_TO_FINDA_FEED_RATE);
|
extruder_move(-MMU2_RETRY_UNLOAD_TO_FINDA_LENGTH, MMU2_RETRY_UNLOAD_TO_FINDA_FEED_RATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
|
void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
|
||||||
|
|
@ -1089,7 +1061,7 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
|
||||||
// After the MMU knows the FSENSOR is triggered it will:
|
// After the MMU knows the FSENSOR is triggered it will:
|
||||||
// 1. Push the filament by additional 30mm (see fsensorToNozzle)
|
// 1. Push the filament by additional 30mm (see fsensorToNozzle)
|
||||||
// 2. Disengage the idler and push another 2mm.
|
// 2. Disengage the idler and push another 2mm.
|
||||||
MoveE(logic.ExtraLoadDistance() + 2, logic.PulleySlowFeedRate());
|
extruder_move(logic.ExtraLoadDistance() + 2, logic.PulleySlowFeedRate());
|
||||||
break;
|
break;
|
||||||
case FilamentState::NOT_PRESENT:
|
case FilamentState::NOT_PRESENT:
|
||||||
// fsensor not triggered, continue moving extruder
|
// fsensor not triggered, continue moving extruder
|
||||||
|
|
@ -1099,7 +1071,7 @@ void MMU2::OnMMUProgressMsgSame(ProgressCode pc) {
|
||||||
// than 450mm because the firmware will ignore too long extrusions
|
// than 450mm because the firmware will ignore too long extrusions
|
||||||
// for safety reasons. See PREVENT_LENGTHY_EXTRUDE.
|
// for safety reasons. See PREVENT_LENGTHY_EXTRUDE.
|
||||||
// Use 350mm to be safely away from the prevention threshold
|
// Use 350mm to be safely away from the prevention threshold
|
||||||
MoveE(350.0f, logic.PulleySlowFeedRate());
|
extruder_move(350.0f, logic.PulleySlowFeedRate());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,11 @@
|
||||||
#include "mmu2_marlin.h"
|
#include "mmu2_marlin.h"
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#include "mmu2_protocol_logic.h"
|
#include "mmu2_protocol_logic.h"
|
||||||
typedef float feedRate_t;
|
typedef float feedRate_t;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "protocol_logic.h"
|
#include "protocol_logic.h"
|
||||||
#include "../../Marlin/src/core/macros.h"
|
|
||||||
#include "../../Marlin/src/core/types.h"
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -48,9 +45,9 @@ public:
|
||||||
|
|
||||||
/// Different levels of resetting the MMU
|
/// Different levels of resetting the MMU
|
||||||
enum ResetForm : uint8_t {
|
enum ResetForm : uint8_t {
|
||||||
Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself
|
Software = 0, ///< sends a X0 command into the MMU, the MMU will watchdog-reset itself
|
||||||
ResetPin = 1, ///< trigger the reset pin of the MMU
|
ResetPin = 1, ///< trigger the reset pin of the MMU
|
||||||
CutThePower = 2, ///< power off and power on (that includes +5V and +24V power lines)
|
CutThePower = 2, ///< power off and power on (that includes +5V and +24V power lines)
|
||||||
EraseEEPROM = 42, ///< erase MMU EEPROM and then perform a software reset
|
EraseEEPROM = 42, ///< erase MMU EEPROM and then perform a software reset
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -182,7 +179,7 @@ public:
|
||||||
/// Automagically "press" a Retry button if we have any retry attempts left
|
/// Automagically "press" a Retry button if we have any retry attempts left
|
||||||
/// @param ec ErrorCode enum value
|
/// @param ec ErrorCode enum value
|
||||||
/// @returns true if auto-retry is ongoing, false when retry is unavailable or retry attempts are all used up
|
/// @returns true if auto-retry is ongoing, false when retry is unavailable or retry attempts are all used up
|
||||||
bool RetryIfPossible(uint16_t ec);
|
bool RetryIfPossible(ErrorCode ec);
|
||||||
|
|
||||||
/// @return count for toolchange in current print
|
/// @return count for toolchange in current print
|
||||||
inline uint16_t ToolChangeCounter() const { return toolchange_counter; };
|
inline uint16_t ToolChangeCounter() const { return toolchange_counter; };
|
||||||
|
|
@ -201,9 +198,9 @@ public:
|
||||||
};
|
};
|
||||||
inline void InvokeErrorScreen(ErrorCode ec) {
|
inline void InvokeErrorScreen(ErrorCode ec) {
|
||||||
// The printer may not raise an error when the MMU is busy
|
// The printer may not raise an error when the MMU is busy
|
||||||
if ( !logic.CommandInProgress() // MMU must not be busy
|
if (!logic.CommandInProgress() // MMU must not be busy
|
||||||
&& MMUCurrentErrorCode() == ErrorCode::OK // The protocol must not be in error state
|
&& MMUCurrentErrorCode() == ErrorCode::OK // The protocol must not be in error state
|
||||||
&& lastErrorCode != ec) // The error code is not a duplicate
|
&& lastErrorCode != ec) // The error code is not a duplicate
|
||||||
{
|
{
|
||||||
ReportError(ec, ErrorSource::ErrorSourcePrinter);
|
ReportError(ec, ErrorSource::ErrorSourcePrinter);
|
||||||
}
|
}
|
||||||
|
|
@ -217,21 +214,23 @@ public:
|
||||||
|
|
||||||
/// @brief Queue a button operation which the printer can act upon
|
/// @brief Queue a button operation which the printer can act upon
|
||||||
/// @param btn Button operation
|
/// @param btn Button operation
|
||||||
inline void setPrinterButtonOperation(Buttons btn) {
|
inline void SetPrinterButtonOperation(Buttons btn) {
|
||||||
printerButtonOperation = btn;
|
printerButtonOperation = btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Get the printer button operation
|
/// @brief Get the printer button operation
|
||||||
/// @return currently set printer button operation, it can be NoButton if nothing is queued
|
/// @return currently set printer button operation, it can be NoButton if nothing is queued
|
||||||
inline Buttons getPrinterButtonOperation() {
|
inline Buttons GetPrinterButtonOperation() {
|
||||||
return printerButtonOperation;
|
return printerButtonOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void clearPrinterButtonOperation() {
|
inline void ClearPrinterButtonOperation() {
|
||||||
printerButtonOperation = Buttons::NoButton;
|
printerButtonOperation = Buttons::NoButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef UNITTEST
|
||||||
private:
|
private:
|
||||||
|
#endif
|
||||||
/// Perform software self-reset of the MMU (sends an X0 command)
|
/// Perform software self-reset of the MMU (sends an X0 command)
|
||||||
void ResetX0();
|
void ResetX0();
|
||||||
|
|
||||||
|
|
@ -279,6 +278,11 @@ private:
|
||||||
|
|
||||||
/// Responds to a change of MMU's progress
|
/// Responds to a change of MMU's progress
|
||||||
/// - plans additional steps, e.g. starts the E-motor after fsensor trigger
|
/// - plans additional steps, e.g. starts the E-motor after fsensor trigger
|
||||||
|
/// The function is quite complex, because it needs to handle asynchronnous
|
||||||
|
/// progress and error reports coming from the MMU without an explicit command
|
||||||
|
/// - typically after MMU's start or after some HW issue on the MMU.
|
||||||
|
/// It must ensure, that calls to @ref ReportProgress and/or @ref ReportError are
|
||||||
|
/// only executed after @ref BeginReport has been called first.
|
||||||
void OnMMUProgressMsg(ProgressCode pc);
|
void OnMMUProgressMsg(ProgressCode pc);
|
||||||
/// Progress code changed - act accordingly
|
/// Progress code changed - act accordingly
|
||||||
void OnMMUProgressMsgChanged(ProgressCode pc);
|
void OnMMUProgressMsgChanged(ProgressCode pc);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
namespace MMU2 {
|
||||||
|
|
||||||
// Register map for MMU
|
// Register map for MMU
|
||||||
enum class Register : uint8_t
|
enum class Register : uint8_t {
|
||||||
{
|
|
||||||
Project_Major = 0x00,
|
Project_Major = 0x00,
|
||||||
Project_Minor = 0x01,
|
Project_Minor = 0x01,
|
||||||
Project_Revision = 0x02,
|
Project_Revision = 0x02,
|
||||||
|
|
@ -38,3 +40,5 @@ enum class Register : uint8_t
|
||||||
Set_Get_Idler_iRun = 0x20,
|
Set_Get_Idler_iRun = 0x20,
|
||||||
Reserved = 0x21,
|
Reserved = 0x21,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
#include "mmu2_crc.h"
|
#include "mmu2_crc.h"
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#include <util/crc16.h>
|
#include <util/crc16.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
|
// clang-format off
|
||||||
namespace crc {
|
namespace crc {
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) {
|
uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) {
|
||||||
return _crc8_ccitt_update(crc, b);
|
return _crc8_ccitt_update(crc, b);
|
||||||
|
|
@ -17,6 +17,6 @@ uint8_t CRC8::CCITT_update(uint8_t crc, uint8_t b) {
|
||||||
return CCITT_updateCX(crc, b);
|
return CCITT_updateCX(crc, b);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace crc
|
} // namespace crc
|
||||||
|
// clang-format on
|
||||||
} // namespace modules
|
} // namespace modules
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
// prevent silly indenting of the whole file
|
||||||
|
|
||||||
/// Contains all the necessary functions for computation of CRC
|
/// Contains all the necessary functions for computation of CRC
|
||||||
namespace crc {
|
namespace crc {
|
||||||
|
|
||||||
|
|
@ -40,4 +43,6 @@ public:
|
||||||
|
|
||||||
} // namespace crc
|
} // namespace crc
|
||||||
|
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
} // namespace modules
|
} // namespace modules
|
||||||
|
|
|
||||||
|
|
@ -35,116 +35,125 @@ static_assert( FindErrorIndex(ERR_MECHANICAL_FINDA_FILAMENT_STUCK) == 1);
|
||||||
static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER) == 2);
|
static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER) == 2);
|
||||||
static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK) == 3);
|
static_assert( FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK) == 3);
|
||||||
|
|
||||||
uint8_t PrusaErrorCodeIndex(uint16_t ec) {
|
constexpr ErrorCode operator&(ErrorCode a, ErrorCode b){
|
||||||
|
return (ErrorCode)((uint16_t)a & (uint16_t)b);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool ContainsBit(ErrorCode ec, ErrorCode mask){
|
||||||
|
return (uint16_t)ec & (uint16_t)mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t PrusaErrorCodeIndex(ErrorCode ec) {
|
||||||
switch (ec) {
|
switch (ec) {
|
||||||
case (uint16_t)ErrorCode::FINDA_DIDNT_SWITCH_ON:
|
case ErrorCode::FINDA_DIDNT_SWITCH_ON:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_TRIGGER);
|
return FindErrorIndex(ERR_MECHANICAL_FINDA_DIDNT_TRIGGER);
|
||||||
case (uint16_t)ErrorCode::FINDA_DIDNT_SWITCH_OFF:
|
case ErrorCode::FINDA_DIDNT_SWITCH_OFF:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_FINDA_FILAMENT_STUCK);
|
return FindErrorIndex(ERR_MECHANICAL_FINDA_FILAMENT_STUCK);
|
||||||
case (uint16_t)ErrorCode::FSENSOR_DIDNT_SWITCH_ON:
|
case ErrorCode::FSENSOR_DIDNT_SWITCH_ON:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER);
|
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_DIDNT_TRIGGER);
|
||||||
case (uint16_t)ErrorCode::FSENSOR_DIDNT_SWITCH_OFF:
|
case ErrorCode::FSENSOR_DIDNT_SWITCH_OFF:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK);
|
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_FILAMENT_STUCK);
|
||||||
case (uint16_t)ErrorCode::FSENSOR_TOO_EARLY:
|
case ErrorCode::FSENSOR_TOO_EARLY:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_TOO_EARLY);
|
return FindErrorIndex(ERR_MECHANICAL_FSENSOR_TOO_EARLY);
|
||||||
case (uint16_t)ErrorCode::FINDA_FLICKERS:
|
case ErrorCode::FINDA_FLICKERS:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_INSPECT_FINDA);
|
return FindErrorIndex(ERR_MECHANICAL_INSPECT_FINDA);
|
||||||
case (uint16_t)ErrorCode::LOAD_TO_EXTRUDER_FAILED:
|
case ErrorCode::LOAD_TO_EXTRUDER_FAILED:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_LOAD_TO_EXTRUDER_FAILED);
|
return FindErrorIndex(ERR_MECHANICAL_LOAD_TO_EXTRUDER_FAILED);
|
||||||
case (uint16_t)ErrorCode::FILAMENT_EJECTED:
|
case ErrorCode::FILAMENT_EJECTED:
|
||||||
return FindErrorIndex(ERR_SYSTEM_FILAMENT_EJECTED);
|
return FindErrorIndex(ERR_SYSTEM_FILAMENT_EJECTED);
|
||||||
case (uint16_t)ErrorCode::FILAMENT_CHANGE:
|
case ErrorCode::FILAMENT_CHANGE:
|
||||||
return FindErrorIndex(ERR_SYSTEM_FILAMENT_CHANGE);
|
return FindErrorIndex(ERR_SYSTEM_FILAMENT_CHANGE);
|
||||||
|
|
||||||
case (uint16_t)ErrorCode::STALLED_PULLEY:
|
case ErrorCode::STALLED_PULLEY:
|
||||||
case (uint16_t)ErrorCode::MOVE_PULLEY_FAILED:
|
case ErrorCode::MOVE_PULLEY_FAILED:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE);
|
return FindErrorIndex(ERR_MECHANICAL_PULLEY_CANNOT_MOVE);
|
||||||
|
|
||||||
case (uint16_t)ErrorCode::HOMING_SELECTOR_FAILED:
|
case ErrorCode::HOMING_SELECTOR_FAILED:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME);
|
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_HOME);
|
||||||
case (uint16_t)ErrorCode::MOVE_SELECTOR_FAILED:
|
case ErrorCode::MOVE_SELECTOR_FAILED:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE);
|
return FindErrorIndex(ERR_MECHANICAL_SELECTOR_CANNOT_MOVE);
|
||||||
|
|
||||||
case (uint16_t)ErrorCode::HOMING_IDLER_FAILED:
|
case ErrorCode::HOMING_IDLER_FAILED:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME);
|
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_HOME);
|
||||||
case (uint16_t)ErrorCode::MOVE_IDLER_FAILED:
|
case ErrorCode::MOVE_IDLER_FAILED:
|
||||||
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE);
|
return FindErrorIndex(ERR_MECHANICAL_IDLER_CANNOT_MOVE);
|
||||||
|
|
||||||
case (uint16_t)ErrorCode::MMU_NOT_RESPONDING:
|
case ErrorCode::MMU_NOT_RESPONDING:
|
||||||
return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING);
|
return FindErrorIndex(ERR_CONNECT_MMU_NOT_RESPONDING);
|
||||||
case (uint16_t)ErrorCode::PROTOCOL_ERROR:
|
case ErrorCode::PROTOCOL_ERROR:
|
||||||
return FindErrorIndex(ERR_CONNECT_COMMUNICATION_ERROR);
|
return FindErrorIndex(ERR_CONNECT_COMMUNICATION_ERROR);
|
||||||
case (uint16_t)ErrorCode::FILAMENT_ALREADY_LOADED:
|
case ErrorCode::FILAMENT_ALREADY_LOADED:
|
||||||
return FindErrorIndex(ERR_SYSTEM_FILAMENT_ALREADY_LOADED);
|
return FindErrorIndex(ERR_SYSTEM_FILAMENT_ALREADY_LOADED);
|
||||||
case (uint16_t)ErrorCode::INVALID_TOOL:
|
case ErrorCode::INVALID_TOOL:
|
||||||
return FindErrorIndex(ERR_SYSTEM_INVALID_TOOL);
|
return FindErrorIndex(ERR_SYSTEM_INVALID_TOOL);
|
||||||
case (uint16_t)ErrorCode::QUEUE_FULL:
|
case ErrorCode::QUEUE_FULL:
|
||||||
return FindErrorIndex(ERR_SYSTEM_QUEUE_FULL);
|
return FindErrorIndex(ERR_SYSTEM_QUEUE_FULL);
|
||||||
case (uint16_t)ErrorCode::VERSION_MISMATCH:
|
case ErrorCode::VERSION_MISMATCH:
|
||||||
return FindErrorIndex(ERR_SYSTEM_FW_UPDATE_NEEDED);
|
return FindErrorIndex(ERR_SYSTEM_FW_UPDATE_NEEDED);
|
||||||
case (uint16_t)ErrorCode::INTERNAL:
|
case ErrorCode::INTERNAL:
|
||||||
return FindErrorIndex(ERR_SYSTEM_FW_RUNTIME_ERROR);
|
return FindErrorIndex(ERR_SYSTEM_FW_RUNTIME_ERROR);
|
||||||
case (uint16_t)ErrorCode::FINDA_VS_EEPROM_DISREPANCY:
|
case ErrorCode::FINDA_VS_EEPROM_DISREPANCY:
|
||||||
return FindErrorIndex(ERR_SYSTEM_UNLOAD_MANUALLY);
|
return FindErrorIndex(ERR_SYSTEM_UNLOAD_MANUALLY);
|
||||||
case (uint16_t)ErrorCode::MCU_UNDERVOLTAGE_VCC:
|
case ErrorCode::MCU_UNDERVOLTAGE_VCC:
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_MMU_MCU_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_MMU_MCU_ERROR);
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Electrical issues which can be detected somehow.
|
// Electrical issues which can be detected somehow.
|
||||||
// Need to be placed before TMC-related errors in order to process couples of error bits between single ones
|
// Need to be placed before TMC-related errors in order to process couples of error bits between single ones
|
||||||
// and to keep the code size down.
|
// and to keep the code size down.
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_PULLEY_BIT) {
|
if (ContainsBit(ec, ErrorCode::TMC_PULLEY_BIT)) {
|
||||||
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
|
if ((ec & ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_MMU_PULLEY_SELFTEST_FAILED);
|
return FindErrorIndex(ERR_ELECTRICAL_MMU_PULLEY_SELFTEST_FAILED);
|
||||||
} else if (ec & (uint16_t)ErrorCode::TMC_SELECTOR_BIT) {
|
} else if (ContainsBit(ec, ErrorCode::TMC_SELECTOR_BIT)) {
|
||||||
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
|
if ((ec & ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_MMU_SELECTOR_SELFTEST_FAILED);
|
return FindErrorIndex(ERR_ELECTRICAL_MMU_SELECTOR_SELFTEST_FAILED);
|
||||||
} else if (ec & (uint16_t)ErrorCode::TMC_IDLER_BIT) {
|
} else if (ContainsBit(ec, ErrorCode::TMC_IDLER_BIT)) {
|
||||||
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
|
if ((ec & ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_MMU_IDLER_SELFTEST_FAILED);
|
return FindErrorIndex(ERR_ELECTRICAL_MMU_IDLER_SELFTEST_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TMC-related errors - multiple of these can occur at once
|
// TMC-related errors - multiple of these can occur at once
|
||||||
// - in such a case we report the first which gets found/converted into Prusa-Error-Codes (usually the fact, that one TMC has an issue is serious enough)
|
// - in such a case we report the first which gets found/converted into Prusa-Error-Codes (usually the fact, that one TMC has an issue is serious enough)
|
||||||
// By carefully ordering the checks here we can prioritize the errors being reported to the user.
|
// By carefully ordering the checks here we can prioritize the errors being reported to the user.
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_PULLEY_BIT) {
|
if (ContainsBit(ec, ErrorCode::TMC_PULLEY_BIT)) {
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_IOIN_MISMATCH)
|
if (ContainsBit(ec, ErrorCode::TMC_IOIN_MISMATCH))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_ERROR);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_RESET)
|
if (ContainsBit(ec, ErrorCode::TMC_RESET))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_RESET);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_RESET);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)
|
if (ContainsBit(ec, ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_UNDERVOLTAGE_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_UNDERVOLTAGE_ERROR);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_SHORT_TO_GROUND)
|
if (ContainsBit(ec, ErrorCode::TMC_SHORT_TO_GROUND))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_SHORTED);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_PULLEY_DRIVER_SHORTED);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN)
|
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_WARN))
|
||||||
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_PULLEY_TOO_HOT);
|
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_PULLEY_TOO_HOT);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR)
|
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_ERROR))
|
||||||
return FindErrorIndex(ERR_TEMPERATURE_TMC_PULLEY_OVERHEAT_ERROR);
|
return FindErrorIndex(ERR_TEMPERATURE_TMC_PULLEY_OVERHEAT_ERROR);
|
||||||
} else if (ec & (uint16_t)ErrorCode::TMC_SELECTOR_BIT) {
|
} else if (ContainsBit(ec, ErrorCode::TMC_SELECTOR_BIT)) {
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_IOIN_MISMATCH)
|
if (ContainsBit(ec, ErrorCode::TMC_IOIN_MISMATCH))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_ERROR);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_RESET)
|
if (ContainsBit(ec, ErrorCode::TMC_RESET))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_RESET);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_RESET);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)
|
if (ContainsBit(ec, ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_UNDERVOLTAGE_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_UNDERVOLTAGE_ERROR);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_SHORT_TO_GROUND)
|
if (ContainsBit(ec, ErrorCode::TMC_SHORT_TO_GROUND))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_SHORTED);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_SELECTOR_DRIVER_SHORTED);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN)
|
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_WARN))
|
||||||
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_SELECTOR_TOO_HOT);
|
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_SELECTOR_TOO_HOT);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR)
|
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_ERROR))
|
||||||
return FindErrorIndex(ERR_TEMPERATURE_TMC_SELECTOR_OVERHEAT_ERROR);
|
return FindErrorIndex(ERR_TEMPERATURE_TMC_SELECTOR_OVERHEAT_ERROR);
|
||||||
} else if (ec & (uint16_t)ErrorCode::TMC_IDLER_BIT) {
|
} else if (ContainsBit(ec, ErrorCode::TMC_IDLER_BIT)) {
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_IOIN_MISMATCH)
|
if (ContainsBit(ec, ErrorCode::TMC_IOIN_MISMATCH))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_ERROR);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_RESET)
|
if (ContainsBit(ec, ErrorCode::TMC_RESET))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_RESET);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_RESET);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP)
|
if (ContainsBit(ec, ErrorCode::TMC_UNDERVOLTAGE_ON_CHARGE_PUMP))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_UNDERVOLTAGE_ERROR);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_UNDERVOLTAGE_ERROR);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_SHORT_TO_GROUND)
|
if (ContainsBit(ec, ErrorCode::TMC_SHORT_TO_GROUND))
|
||||||
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_SHORTED);
|
return FindErrorIndex(ERR_ELECTRICAL_TMC_IDLER_DRIVER_SHORTED);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_WARN)
|
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_WARN))
|
||||||
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_IDLER_TOO_HOT);
|
return FindErrorIndex(ERR_TEMPERATURE_WARNING_TMC_IDLER_TOO_HOT);
|
||||||
if (ec & (uint16_t)ErrorCode::TMC_OVER_TEMPERATURE_ERROR)
|
if (ContainsBit(ec, ErrorCode::TMC_OVER_TEMPERATURE_ERROR))
|
||||||
return FindErrorIndex(ERR_TEMPERATURE_TMC_IDLER_OVERHEAT_ERROR);
|
return FindErrorIndex(ERR_TEMPERATURE_TMC_IDLER_OVERHEAT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -184,7 +193,7 @@ struct ResetOnExit {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Buttons ButtonPressed(uint16_t ec) {
|
Buttons ButtonPressed(ErrorCode ec) {
|
||||||
if (buttonSelectedOperation == ButtonOperations::NoOperation) {
|
if (buttonSelectedOperation == ButtonOperations::NoOperation) {
|
||||||
return Buttons::NoButton; // no button
|
return Buttons::NoButton; // no button
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +202,7 @@ Buttons ButtonPressed(uint16_t ec) {
|
||||||
return ButtonAvailable(ec);
|
return ButtonAvailable(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buttons ButtonAvailable(uint16_t ec) {
|
Buttons ButtonAvailable(ErrorCode ec) {
|
||||||
uint8_t ei = PrusaErrorCodeIndex(ec);
|
uint8_t ei = PrusaErrorCodeIndex(ec);
|
||||||
|
|
||||||
// The list of responses which occur in mmu error dialogs
|
// The list of responses which occur in mmu error dialogs
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "mmu2/buttons.h"
|
#ifdef __AVR__
|
||||||
|
#include "mmu2/buttons.h"
|
||||||
|
#include "mmu2/error_codes.h"
|
||||||
|
#else
|
||||||
|
#include "buttons.h"
|
||||||
|
#include "../../../../../../Prusa-Error-Codes/04_MMU/button_operations.h"
|
||||||
|
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
/// Translates MMU2::ErrorCode into an index of Prusa-Error-Codes
|
/// Translates MMU2::ErrorCode into an index of Prusa-Error-Codes
|
||||||
/// Basically this is the way to obtain an index into all other functions in this API
|
/// Basically this is the way to obtain an index into all other functions in this API
|
||||||
uint8_t PrusaErrorCodeIndex(uint16_t ec);
|
uint8_t PrusaErrorCodeIndex(ErrorCode ec);
|
||||||
|
|
||||||
/// @returns pointer to a PROGMEM string representing the Title of the Prusa-Error-Codes error
|
/// @returns pointer to a PROGMEM string representing the Title of the Prusa-Error-Codes error
|
||||||
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
/// @param i index of the error - obtained by calling ErrorCodeIndex
|
||||||
|
|
@ -38,11 +45,11 @@ void SetButtonResponse(ButtonOperations rsp);
|
||||||
|
|
||||||
/// @returns button index/code based on currently processed error/screen
|
/// @returns button index/code based on currently processed error/screen
|
||||||
/// Clears the "pressed" button upon exit
|
/// Clears the "pressed" button upon exit
|
||||||
Buttons ButtonPressed(uint16_t ec);
|
Buttons ButtonPressed(ErrorCode ec);
|
||||||
|
|
||||||
/// @returns button index/code based on currently processed error/screen
|
/// @returns button index/code based on currently processed error/screen
|
||||||
/// Used as a subfunction of ButtonPressed.
|
/// Used as a subfunction of ButtonPressed.
|
||||||
/// Does not clear the "pressed" button upon exit
|
/// Does not clear the "pressed" button upon exit
|
||||||
Buttons ButtonAvailable(uint16_t ec);
|
Buttons ButtonAvailable(ErrorCode ec);
|
||||||
|
|
||||||
} // namespace MMU2
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#ifdef __AVR__
|
||||||
#ifndef UNITTEST
|
#include <avr/pgmspace.h>
|
||||||
#include "Marlin.h"
|
#endif
|
||||||
|
|
||||||
// Beware - before changing this prefix, think twice
|
// Beware - before changing this prefix, think twice
|
||||||
// you'd need to change appmain.cpp app_marlin_serial_output_write_hook
|
// you'd need to change appmain.cpp app_marlin_serial_output_write_hook
|
||||||
|
|
@ -14,16 +14,22 @@ namespace MMU2 {
|
||||||
/// @param msg pointer to a string in PROGMEM
|
/// @param msg pointer to a string in PROGMEM
|
||||||
/// On the AVR platform this variant reads the input string from PROGMEM.
|
/// On the AVR platform this variant reads the input string from PROGMEM.
|
||||||
/// On the ARM platform it calls LogErrorEvent directly (silently expecting the compiler to optimize it away)
|
/// On the ARM platform it calls LogErrorEvent directly (silently expecting the compiler to optimize it away)
|
||||||
void LogErrorEvent_P(const char *msg);
|
void LogErrorEvent_P(const char *msg_P);
|
||||||
|
|
||||||
/// Report the msg into the general logging subsystem (through Marlin's SERIAL_ECHO stuff)
|
/// Report the msg into the general logging subsystem (through Marlin's SERIAL_ECHO stuff)
|
||||||
/// @param msg pointer to a string in PROGMEM
|
/// @param msg pointer to a string in PROGMEM
|
||||||
/// On the AVR platform this variant reads the input string from PROGMEM.
|
/// On the AVR platform this variant reads the input string from PROGMEM.
|
||||||
/// On the ARM platform it calls LogErrorEvent directly (silently expecting the compiler to optimize it away)
|
/// On the ARM platform it calls LogErrorEvent directly (silently expecting the compiler to optimize it away)
|
||||||
void LogEchoEvent_P(const char *msg);
|
void LogEchoEvent_P(const char *msg_P);
|
||||||
|
|
||||||
} // namespace
|
} // namespace MMU2
|
||||||
|
|
||||||
|
#ifndef UNITTEST
|
||||||
|
#ifdef __AVR__
|
||||||
|
#include "Marlin.h"
|
||||||
|
#else
|
||||||
|
#include "../../core/serial.h"
|
||||||
|
#endif
|
||||||
#define SERIAL_MMU2() \
|
#define SERIAL_MMU2() \
|
||||||
{ serialprintPGM(mmu2Magic); }
|
{ serialprintPGM(mmu2Magic); }
|
||||||
|
|
||||||
|
|
@ -49,11 +55,14 @@ void LogEchoEvent_P(const char *msg);
|
||||||
} while (0)
|
} while (0)
|
||||||
#define MMU2_ERROR_MSG(S) MMU2_ECHO_MSG(S) //!@todo Decide MMU errors on serial line
|
#define MMU2_ERROR_MSG(S) MMU2_ECHO_MSG(S) //!@todo Decide MMU errors on serial line
|
||||||
|
|
||||||
#else // #ifndef UNITTEST
|
#else // #ifndef UNITTEST
|
||||||
|
#include "stubs/stub_interfaces.h"
|
||||||
|
#define MMU2_ECHO_MSGLN(S) marlinLogSim.AppendLine(S)
|
||||||
|
#define MMU2_ERROR_MSGLN(S) marlinLogSim.AppendLine(S)
|
||||||
|
#define MMU2_ECHO_MSGRPGM(S) /*marlinLogSim.AppendLine(S)*/
|
||||||
|
#define MMU2_ERROR_MSGRPGM(S) /*marlinLogSim.AppendLine(S)*/
|
||||||
|
#define SERIAL_ECHOLNPGM(S) /*marlinLogSim.AppendLine(S)*/
|
||||||
|
#define SERIAL_ECHOPGM(S) /* */
|
||||||
|
#define SERIAL_ECHOLN(S) /*marlinLogSim.AppendLine(S)*/
|
||||||
|
|
||||||
#define MMU2_ECHO_MSGLN(S) /* */
|
#endif // #ifndef UNITTEST
|
||||||
#define MMU2_ERROR_MSGLN(S) /* */
|
|
||||||
#define MMU2_ECHO_MSGRPGM(S) /* */
|
|
||||||
#define MMU2_ERROR_MSGRPGM(S) /* */
|
|
||||||
|
|
||||||
#endif // #ifndef UNITTEST
|
|
||||||
|
|
|
||||||
|
|
@ -14,27 +14,25 @@ struct pos3d {
|
||||||
pos3d() = default;
|
pos3d() = default;
|
||||||
inline constexpr pos3d(float x, float y, float z)
|
inline constexpr pos3d(float x, float y, float z)
|
||||||
: xyz { x, y, z } {}
|
: xyz { x, y, z } {}
|
||||||
pos3d operator=(const float *newP){
|
pos3d operator=(const float *newP) {
|
||||||
for(uint8_t i = 0; i < 3; ++i){
|
for (uint8_t i = 0; i < 3; ++i) {
|
||||||
xyz[i] = newP[i];
|
xyz[i] = newP[i];
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void MoveE(float delta, float feedRate);
|
void extruder_move(float distance, float feed_rate);
|
||||||
|
void extruder_schedule_turning(float feed_rate);
|
||||||
|
|
||||||
float MoveRaiseZ(float delta);
|
float move_raise_z(float delta);
|
||||||
|
|
||||||
void planner_abort_queued_moves();
|
void planner_abort_queued_moves();
|
||||||
void planner_synchronize();
|
void planner_synchronize();
|
||||||
bool planner_any_moves();
|
bool planner_any_moves();
|
||||||
float planner_get_machine_position_E_mm();
|
|
||||||
float stepper_get_machine_position_E_mm();
|
float stepper_get_machine_position_E_mm();
|
||||||
float planner_get_current_position_E();
|
float planner_get_current_position_E();
|
||||||
void planner_set_current_position_E(float e);
|
void planner_set_current_position_E(float e);
|
||||||
void planner_line_to_current_position(float feedRate_mm_s);
|
|
||||||
void planner_line_to_current_position_sync(float feedRate_mm_s);
|
|
||||||
pos3d planner_current_position();
|
pos3d planner_current_position();
|
||||||
|
|
||||||
void motion_do_blocking_move_to_xy(float rx, float ry, float feedRate_mm_s);
|
void motion_do_blocking_move_to_xy(float rx, float ry, float feedRate_mm_s);
|
||||||
|
|
@ -46,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();
|
||||||
|
|
@ -61,6 +62,4 @@ bool all_axes_homed();
|
||||||
|
|
||||||
void gcode_reset_stepper_timeout();
|
void gcode_reset_stepper_timeout();
|
||||||
|
|
||||||
bool cutter_enabled();
|
|
||||||
|
|
||||||
} // namespace MMU2
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,21 @@
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
void MoveE(float delta, float feedRate) {
|
static void planner_line_to_current_position(float feedRate_mm_s){
|
||||||
|
plan_buffer_line_curposXYZE(feedRate_mm_s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void planner_line_to_current_position_sync(float feedRate_mm_s){
|
||||||
|
planner_line_to_current_position(feedRate_mm_s);
|
||||||
|
planner_synchronize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void extruder_move(float delta, float feedRate) {
|
||||||
current_position[E_AXIS] += delta;
|
current_position[E_AXIS] += delta;
|
||||||
planner_line_to_current_position(feedRate);
|
planner_line_to_current_position(feedRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
float MoveRaiseZ(float delta) {
|
float move_raise_z(float delta) {
|
||||||
return raise_z(delta);
|
return raise_z(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,15 +62,6 @@ void planner_set_current_position_E(float e){
|
||||||
current_position[E_AXIS] = e;
|
current_position[E_AXIS] = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void planner_line_to_current_position(float feedRate_mm_s){
|
|
||||||
plan_buffer_line_curposXYZE(feedRate_mm_s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void planner_line_to_current_position_sync(float feedRate_mm_s){
|
|
||||||
planner_line_to_current_position(feedRate_mm_s);
|
|
||||||
planner_synchronize();
|
|
||||||
}
|
|
||||||
|
|
||||||
pos3d planner_current_position(){
|
pos3d planner_current_position(){
|
||||||
return pos3d(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
|
return pos3d(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
|
||||||
}
|
}
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
@ -132,8 +144,4 @@ bool all_axes_homed(){
|
||||||
return axis_known_position[X_AXIS] && axis_known_position[Y_AXIS];
|
return axis_known_position[X_AXIS] && axis_known_position[Y_AXIS];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cutter_enabled(){
|
|
||||||
return eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED) == EEPROM_MMU_CUTTER_ENABLED_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace MMU2
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
// brings _O and _T macros into MMU
|
// brings _O and _T macros into MMU
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#define MARLIN_KEEPALIVE_STATE_IN_PROCESS KEEPALIVE_STATE(IN_PROCESS)
|
#define MARLIN_KEEPALIVE_STATE_IN_PROCESS KEEPALIVE_STATE(IN_PROCESS)
|
||||||
|
#elif defined(UNITTEST)
|
||||||
|
#define _O(x) x
|
||||||
|
#define _T(x) x
|
||||||
|
#define MARLIN_KEEPALIVE_STATE_IN_PROCESS /*KEEPALIVE_STATE(IN_PROCESS) TODO*/
|
||||||
#else
|
#else
|
||||||
#include "../../gcode/gcode.h"
|
#include "../../gcode/gcode.h"
|
||||||
#define _O(x) x
|
#define _O(x) x
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,10 @@ static const char * const progressTexts[] PROGMEM = {
|
||||||
_R(MSG_PROGRESS_FEED_FSENSOR)
|
_R(MSG_PROGRESS_FEED_FSENSOR)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * ProgressCodeToText(uint16_t pc){
|
const char * ProgressCodeToText(ProgressCode pc){
|
||||||
// @@TODO ?? a better fallback option?
|
// @@TODO ?? a better fallback option?
|
||||||
return ( pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
|
return ( (uint16_t)pc <= (sizeof(progressTexts) / sizeof(progressTexts[0])) )
|
||||||
? static_cast<const char *>(pgm_read_ptr(&progressTexts[pc]))
|
? static_cast<const char *>(pgm_read_ptr(&progressTexts[(uint16_t)pc]))
|
||||||
: static_cast<const char *>(pgm_read_ptr(&progressTexts[0]));
|
: static_cast<const char *>(pgm_read_ptr(&progressTexts[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#ifdef __AVR__
|
||||||
|
#include "mmu2/progress_codes.h"
|
||||||
|
#else
|
||||||
|
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
const char * ProgressCodeToText(uint16_t pc);
|
const char *ProgressCodeToText(ProgressCode pc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@
|
||||||
// irrelevant on Buddy FW, just keep "_millis" as "millis"
|
// irrelevant on Buddy FW, just keep "_millis" as "millis"
|
||||||
#include <wiring_time.h>
|
#include <wiring_time.h>
|
||||||
#define _millis millis
|
#define _millis millis
|
||||||
|
#ifdef UNITTEST
|
||||||
|
#define strncmp_P strncmp
|
||||||
|
#else
|
||||||
|
#include <Marlin/src/core/serial.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -16,7 +21,7 @@
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
/// Beware:
|
/// Beware - on AVR/MK3S:
|
||||||
/// Changing the supportedMmuVersion numbers requires patching MSG_DESC_FW_UPDATE_NEEDED and all its related translations by hand.
|
/// Changing the supportedMmuVersion numbers requires patching MSG_DESC_FW_UPDATE_NEEDED and all its related translations by hand.
|
||||||
///
|
///
|
||||||
/// The message reads:
|
/// The message reads:
|
||||||
|
|
@ -27,18 +32,18 @@ namespace MMU2 {
|
||||||
static constexpr uint8_t supportedMmuFWVersion[3] PROGMEM = { mmuVersionMajor, mmuVersionMinor, mmuVersionPatch };
|
static constexpr uint8_t supportedMmuFWVersion[3] PROGMEM = { mmuVersionMajor, mmuVersionMinor, mmuVersionPatch };
|
||||||
|
|
||||||
const Register ProtocolLogic::regs8Addrs[ProtocolLogic::regs8Count] PROGMEM = {
|
const Register ProtocolLogic::regs8Addrs[ProtocolLogic::regs8Count] PROGMEM = {
|
||||||
Register::FINDA_State, // FINDA state
|
Register::FINDA_State, // FINDA state
|
||||||
Register::Set_Get_Selector_Slot, // Selector slot
|
Register::Set_Get_Selector_Slot, // Selector slot
|
||||||
Register::Set_Get_Idler_Slot, // Idler slot
|
Register::Set_Get_Idler_Slot, // Idler slot
|
||||||
};
|
};
|
||||||
|
|
||||||
const Register ProtocolLogic::regs16Addrs[ProtocolLogic::regs16Count] PROGMEM = {
|
const Register ProtocolLogic::regs16Addrs[ProtocolLogic::regs16Count] PROGMEM = {
|
||||||
Register::MMU_Errors, // MMU errors - aka statistics
|
Register::MMU_Errors, // MMU errors - aka statistics
|
||||||
Register::Get_Pulley_Position, // Pulley position [mm]
|
Register::Get_Pulley_Position, // Pulley position [mm]
|
||||||
};
|
};
|
||||||
|
|
||||||
const Register ProtocolLogic::initRegs8Addrs[ProtocolLogic::initRegs8Count] PROGMEM = {
|
const Register ProtocolLogic::initRegs8Addrs[ProtocolLogic::initRegs8Count] PROGMEM = {
|
||||||
Register::Extra_Load_Distance, // extra load distance [mm]
|
Register::Extra_Load_Distance, // extra load distance [mm]
|
||||||
Register::Pulley_Slow_Feedrate, // pulley slow feedrate [mm/s]
|
Register::Pulley_Slow_Feedrate, // pulley slow feedrate [mm/s]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -181,7 +186,7 @@ StepStatus ProtocolLogic::ExpectingMessage() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[[fallthrough]]; // otherwise
|
[[fallthrough]]; // otherwise
|
||||||
default:
|
default:
|
||||||
RecordUARTActivity(); // something has happened on the UART, update the timeout record
|
RecordUARTActivity(); // something has happened on the UART, update the timeout record
|
||||||
return ProtocolError;
|
return ProtocolError;
|
||||||
|
|
@ -197,7 +202,11 @@ StepStatus ProtocolLogic::ExpectingMessage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolLogic::SendMsg(RequestMsg rq) {
|
void ProtocolLogic::SendMsg(RequestMsg rq) {
|
||||||
|
#ifdef __AVR__
|
||||||
|
// Buddy FW cannot use stack-allocated txbuff - DMA doesn't work with CCMRAM
|
||||||
|
// No restrictions on MK3/S/+ though
|
||||||
uint8_t txbuff[Protocol::MaxRequestSize()];
|
uint8_t txbuff[Protocol::MaxRequestSize()];
|
||||||
|
#endif
|
||||||
uint8_t len = Protocol::EncodeRequest(rq, txbuff);
|
uint8_t len = Protocol::EncodeRequest(rq, txbuff);
|
||||||
uart->write(txbuff, len);
|
uart->write(txbuff, len);
|
||||||
LogRequestMsg(txbuff, len);
|
LogRequestMsg(txbuff, len);
|
||||||
|
|
@ -205,7 +214,11 @@ void ProtocolLogic::SendMsg(RequestMsg rq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolLogic::SendWriteMsg(RequestMsg rq) {
|
void ProtocolLogic::SendWriteMsg(RequestMsg rq) {
|
||||||
|
#ifdef __AVR__
|
||||||
|
// Buddy FW cannot use stack-allocated txbuff - DMA doesn't work with CCMRAM
|
||||||
|
// No restrictions on MK3/S/+ though
|
||||||
uint8_t txbuff[Protocol::MaxRequestSize()];
|
uint8_t txbuff[Protocol::MaxRequestSize()];
|
||||||
|
#endif
|
||||||
uint8_t len = Protocol::EncodeWriteRequest(rq.value, rq.value2, txbuff);
|
uint8_t len = Protocol::EncodeWriteRequest(rq.value, rq.value2, txbuff);
|
||||||
uart->write(txbuff, len);
|
uart->write(txbuff, len);
|
||||||
LogRequestMsg(txbuff, len);
|
LogRequestMsg(txbuff, len);
|
||||||
|
|
@ -275,9 +288,9 @@ StepStatus ProtocolLogic::ScopeStep() {
|
||||||
case Scope::StartSeq:
|
case Scope::StartSeq:
|
||||||
return StartSeqStep(); // ~270B
|
return StartSeqStep(); // ~270B
|
||||||
case Scope::Idle:
|
case Scope::Idle:
|
||||||
return IdleStep(); // ~300B
|
return IdleStep(); // ~300B
|
||||||
case Scope::Command:
|
case Scope::Command:
|
||||||
return CommandStep(); // ~430B
|
return CommandStep(); // ~430B
|
||||||
case Scope::Stopped:
|
case Scope::Stopped:
|
||||||
return StoppedStep();
|
return StoppedStep();
|
||||||
default:
|
default:
|
||||||
|
|
@ -322,7 +335,7 @@ StepStatus ProtocolLogic::StartSeqStep() {
|
||||||
StepStatus ProtocolLogic::DelayedRestartWait() {
|
StepStatus ProtocolLogic::DelayedRestartWait() {
|
||||||
if (Elapsed(heartBeatPeriod)) { // this basically means, that we are waiting until there is some traffic on
|
if (Elapsed(heartBeatPeriod)) { // this basically means, that we are waiting until there is some traffic on
|
||||||
while (uart->read() != -1)
|
while (uart->read() != -1)
|
||||||
; // clear the input buffer
|
; // clear the input buffer
|
||||||
// switch to StartSeq
|
// switch to StartSeq
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
@ -349,6 +362,7 @@ StepStatus ProtocolLogic::ProcessCommandQueryResponse() {
|
||||||
return Processing;
|
return Processing;
|
||||||
case ResponseMsgParamCodes::Error:
|
case ResponseMsgParamCodes::Error:
|
||||||
// in case of an error the progress code remains as it has been before
|
// in case of an error the progress code remains as it has been before
|
||||||
|
progressCode = ProgressCode::ERRWaitingForUser;
|
||||||
errorCode = static_cast<ErrorCode>(rsp.paramValue);
|
errorCode = static_cast<ErrorCode>(rsp.paramValue);
|
||||||
// keep on reporting the state of fsensor regularly even in command error state
|
// keep on reporting the state of fsensor regularly even in command error state
|
||||||
// - the MMU checks FINDA and fsensor even while recovering from errors
|
// - the MMU checks FINDA and fsensor even while recovering from errors
|
||||||
|
|
@ -469,9 +483,11 @@ StepStatus ProtocolLogic::IdleStep() {
|
||||||
case ResponseMsgParamCodes::Processing:
|
case ResponseMsgParamCodes::Processing:
|
||||||
// @@TODO we may actually use this branch to report progress of manual operation on the MMU
|
// @@TODO we may actually use this branch to report progress of manual operation on the MMU
|
||||||
// The MMU sends e.g. X0 P27 after its restart when the user presses an MMU button to move the Selector
|
// The MMU sends e.g. X0 P27 after its restart when the user presses an MMU button to move the Selector
|
||||||
|
progressCode = static_cast<ProgressCode>(rsp.paramValue);
|
||||||
errorCode = ErrorCode::OK;
|
errorCode = ErrorCode::OK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
progressCode = ProgressCode::ERRWaitingForUser;
|
||||||
errorCode = static_cast<ErrorCode>(rsp.paramValue);
|
errorCode = static_cast<ErrorCode>(rsp.paramValue);
|
||||||
StartReading8bitRegisters(); // continue Idle state without restarting the communication
|
StartReading8bitRegisters(); // continue Idle state without restarting the communication
|
||||||
return CommandError;
|
return CommandError;
|
||||||
|
|
@ -758,6 +774,7 @@ void ProtocolLogic::LogResponse() {
|
||||||
StepStatus ProtocolLogic::SuppressShortDropOuts(const char *msg_P, StepStatus ss) {
|
StepStatus ProtocolLogic::SuppressShortDropOuts(const char *msg_P, StepStatus ss) {
|
||||||
if (dataTO.Record(ss)) {
|
if (dataTO.Record(ss)) {
|
||||||
LogError(msg_P);
|
LogError(msg_P);
|
||||||
|
dataTO.Reset(); // prepare for another run of consecutive retries before firing an error
|
||||||
return dataTO.InitialCause();
|
return dataTO.InitialCause();
|
||||||
} else {
|
} else {
|
||||||
return Processing; // suppress short drop outs of communication
|
return Processing; // suppress short drop outs of communication
|
||||||
|
|
|
||||||
|
|
@ -3,37 +3,39 @@
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#include "mmu2/error_codes.h"
|
#include "mmu2/error_codes.h"
|
||||||
#include "mmu2/progress_codes.h"
|
#include "mmu2/progress_codes.h"
|
||||||
#include "mmu2/buttons.h"
|
#include "mmu2/buttons.h"
|
||||||
#include "mmu2/registers.h"
|
#include "mmu2/registers.h"
|
||||||
#include "mmu2_protocol.h"
|
#include "mmu2_protocol.h"
|
||||||
|
|
||||||
// #include <array> std array is not available on AVR ... we need to "fake" it
|
// #include <array> std array is not available on AVR ... we need to "fake" it
|
||||||
namespace std {
|
namespace std {
|
||||||
template<typename T, uint8_t N>
|
template <typename T, uint8_t N>
|
||||||
class array {
|
class array {
|
||||||
T data[N];
|
T data[N];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
array() = default;
|
array() = default;
|
||||||
inline constexpr T* begin()const { return data; }
|
inline constexpr T *begin() const { return data; }
|
||||||
inline constexpr T* end()const { return data + N; }
|
inline constexpr T *end() const { return data + N; }
|
||||||
static constexpr uint8_t size() { return N; }
|
static constexpr uint8_t size() { return N; }
|
||||||
inline T &operator[](uint8_t i){
|
inline T &operator[](uint8_t i) {
|
||||||
return data[i];
|
return data[i];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} // namespace std
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
|
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
|
||||||
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
|
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
|
||||||
|
|
||||||
// prevent ARM HAL macros from breaking our code
|
// prevent ARM HAL macros from breaking our code
|
||||||
#undef CRC
|
#undef CRC
|
||||||
#include "../../../../../../Prusa-Firmware-MMU/src/modules/protocol.h"
|
#include "../../../../../../Prusa-Firmware-MMU/src/modules/protocol.h"
|
||||||
#include "buttons.h"
|
#include "buttons.h"
|
||||||
|
#include "registers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mmu2_serial.h"
|
#include "mmu2_serial.h"
|
||||||
|
|
@ -50,9 +52,9 @@ class ProtocolLogic;
|
||||||
/// ProtocolLogic stepping statuses
|
/// ProtocolLogic stepping statuses
|
||||||
enum StepStatus : uint_fast8_t {
|
enum StepStatus : uint_fast8_t {
|
||||||
Processing = 0,
|
Processing = 0,
|
||||||
MessageReady, ///< a message has been successfully decoded from the received bytes
|
MessageReady, ///< a message has been successfully decoded from the received bytes
|
||||||
Finished, ///< Scope finished successfully
|
Finished, ///< Scope finished successfully
|
||||||
Interrupted, ///< received "Finished" message related to a different command than originally issued (most likely the MMU restarted while doing something)
|
Interrupted, ///< received "Finished" message related to a different command than originally issued (most likely the MMU restarted while doing something)
|
||||||
CommunicationTimeout, ///< the MMU failed to respond to a request within a specified time frame
|
CommunicationTimeout, ///< the MMU failed to respond to a request within a specified time frame
|
||||||
ProtocolError, ///< bytes read from the MMU didn't form a valid response
|
ProtocolError, ///< bytes read from the MMU didn't form a valid response
|
||||||
CommandRejected, ///< the MMU rejected the command due to some other command in progress, may be the user is operating the MMU locally (button commands)
|
CommandRejected, ///< the MMU rejected the command due to some other command in progress, may be the user is operating the MMU locally (button commands)
|
||||||
|
|
@ -60,19 +62,17 @@ enum StepStatus : uint_fast8_t {
|
||||||
VersionMismatch, ///< the MMU reports its firmware version incompatible with our implementation
|
VersionMismatch, ///< the MMU reports its firmware version incompatible with our implementation
|
||||||
PrinterError, ///< printer's explicit error - MMU is fine, but the printer was unable to complete the requested operation
|
PrinterError, ///< printer's explicit error - MMU is fine, but the printer was unable to complete the requested operation
|
||||||
CommunicationRecovered,
|
CommunicationRecovered,
|
||||||
ButtonPushed, ///< The MMU reported the user pushed one of its three buttons.
|
ButtonPushed, ///< The MMU reported the user pushed one of its three buttons.
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr uint32_t linkLayerTimeout = 2000; ///< default link layer communication timeout
|
inline constexpr uint32_t linkLayerTimeout = 2000; ///< default link layer communication timeout
|
||||||
static constexpr uint32_t dataLayerTimeout = linkLayerTimeout * 3; ///< data layer communication timeout
|
inline constexpr uint32_t dataLayerTimeout = linkLayerTimeout * 3; ///< data layer communication timeout
|
||||||
static constexpr uint32_t heartBeatPeriod = linkLayerTimeout / 2; ///< period of heart beat messages (Q0)
|
inline constexpr uint32_t heartBeatPeriod = linkLayerTimeout / 2; ///< period of heart beat messages (Q0)
|
||||||
|
|
||||||
static_assert(heartBeatPeriod < linkLayerTimeout && linkLayerTimeout < dataLayerTimeout, "Incorrect ordering of timeouts");
|
static_assert(heartBeatPeriod < linkLayerTimeout && linkLayerTimeout < dataLayerTimeout, "Incorrect ordering of timeouts");
|
||||||
|
|
||||||
///< Filter of short consecutive drop outs which are recovered instantly
|
///< Filter of short consecutive drop outs which are recovered instantly
|
||||||
class DropOutFilter {
|
class DropOutFilter {
|
||||||
StepStatus cause;
|
|
||||||
uint8_t occurrences;
|
|
||||||
public:
|
public:
|
||||||
static constexpr uint8_t maxOccurrences = 10; // ideally set this to >8 seconds -> 12x heartBeatPeriod
|
static constexpr uint8_t maxOccurrences = 10; // ideally set this to >8 seconds -> 12x heartBeatPeriod
|
||||||
static_assert(maxOccurrences > 1, "we should really silently ignore at least 1 comm drop out if recovered immediately afterwards");
|
static_assert(maxOccurrences > 1, "we should really silently ignore at least 1 comm drop out if recovered immediately afterwards");
|
||||||
|
|
@ -86,6 +86,10 @@ public:
|
||||||
|
|
||||||
/// Rearms the object for further processing - basically call this once the MMU responds with something meaningful (e.g. S0 A2)
|
/// Rearms the object for further processing - basically call this once the MMU responds with something meaningful (e.g. S0 A2)
|
||||||
inline void Reset() { occurrences = maxOccurrences; }
|
inline void Reset() { occurrences = maxOccurrences; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
StepStatus cause;
|
||||||
|
uint8_t occurrences = maxOccurrences;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Logic layer of the MMU vs. printer communication protocol
|
/// Logic layer of the MMU vs. printer communication protocol
|
||||||
|
|
@ -115,11 +119,11 @@ public:
|
||||||
/// Sets the extra load distance to be reported to the MMU.
|
/// Sets the extra load distance to be reported to the MMU.
|
||||||
/// Beware - this call doesn't send anything to the MMU.
|
/// Beware - this call doesn't send anything to the MMU.
|
||||||
/// The MMU gets the newly set value either by a communication restart or via an explicit WriteRegister call
|
/// The MMU gets the newly set value either by a communication restart or via an explicit WriteRegister call
|
||||||
inline void PlanExtraLoadDistance(uint8_t eld_mm){
|
inline void PlanExtraLoadDistance(uint8_t eld_mm) {
|
||||||
initRegs8[0] = eld_mm;
|
initRegs8[0] = eld_mm;
|
||||||
}
|
}
|
||||||
/// @returns the currently preset extra load distance
|
/// @returns the currently preset extra load distance
|
||||||
inline uint8_t ExtraLoadDistance()const {
|
inline uint8_t ExtraLoadDistance() const {
|
||||||
return initRegs8[0];
|
return initRegs8[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,13 +191,13 @@ public:
|
||||||
inAutoRetry = iar;
|
inAutoRetry = iar;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPrinterError(ErrorCode ec){
|
inline void SetPrinterError(ErrorCode ec) {
|
||||||
explicitPrinterError = ec;
|
explicitPrinterError = ec;
|
||||||
}
|
}
|
||||||
inline void ClearPrinterError(){
|
inline void ClearPrinterError() {
|
||||||
explicitPrinterError = ErrorCode::OK;
|
explicitPrinterError = ErrorCode::OK;
|
||||||
}
|
}
|
||||||
inline bool IsPrinterError()const {
|
inline bool IsPrinterError() const {
|
||||||
return explicitPrinterError != ErrorCode::OK;
|
return explicitPrinterError != ErrorCode::OK;
|
||||||
}
|
}
|
||||||
inline ErrorCode PrinterError() const {
|
inline ErrorCode PrinterError() const {
|
||||||
|
|
@ -228,15 +232,6 @@ private:
|
||||||
Running ///< normal operation - Idle + Command processing
|
Running ///< normal operation - Idle + Command processing
|
||||||
};
|
};
|
||||||
|
|
||||||
// individual sub-state machines - may be they can be combined into a union since only one is active at once
|
|
||||||
// or we can blend them into ProtocolLogic at the cost of a less nice code (but hopefully shorter)
|
|
||||||
// Stopped stopped;
|
|
||||||
// StartSeq startSeq;
|
|
||||||
// DelayedRestart delayedRestart;
|
|
||||||
// Idle idle;
|
|
||||||
// Command command;
|
|
||||||
// ProtocolLogicPartBase *currentState; ///< command currently being processed
|
|
||||||
|
|
||||||
enum class Scope : uint_fast8_t {
|
enum class Scope : uint_fast8_t {
|
||||||
Stopped,
|
Stopped,
|
||||||
StartSeq,
|
StartSeq,
|
||||||
|
|
@ -350,25 +345,30 @@ private:
|
||||||
/// Activate the planned state once the immediate response to a sent request arrived
|
/// Activate the planned state once the immediate response to a sent request arrived
|
||||||
bool ActivatePlannedRequest();
|
bool ActivatePlannedRequest();
|
||||||
|
|
||||||
uint32_t lastUARTActivityMs; ///< timestamp - last ms when something occurred on the UART
|
uint32_t lastUARTActivityMs; ///< timestamp - last ms when something occurred on the UART
|
||||||
DropOutFilter dataTO; ///< Filter of short consecutive drop outs which are recovered instantly
|
DropOutFilter dataTO; ///< Filter of short consecutive drop outs which are recovered instantly
|
||||||
|
|
||||||
ResponseMsg rsp; ///< decoded response message from the MMU protocol
|
ResponseMsg rsp; ///< decoded response message from the MMU protocol
|
||||||
|
|
||||||
State state; ///< internal state of ProtocolLogic
|
State state; ///< internal state of ProtocolLogic
|
||||||
|
|
||||||
Protocol protocol; ///< protocol codec
|
Protocol protocol; ///< protocol codec
|
||||||
|
|
||||||
std::array<uint8_t, 16> lastReceivedBytes; ///< remembers the last few bytes of incoming communication for diagnostic purposes
|
std::array<uint8_t, 16> lastReceivedBytes; ///< remembers the last few bytes of incoming communication for diagnostic purposes
|
||||||
uint8_t lrb;
|
uint8_t lrb;
|
||||||
|
|
||||||
MMU2Serial *uart; ///< UART interface
|
MMU2Serial *uart; ///< UART interface
|
||||||
|
|
||||||
ErrorCode errorCode; ///< last received error code from the MMU
|
ErrorCode errorCode; ///< last received error code from the MMU
|
||||||
ProgressCode progressCode; ///< last received progress code from the MMU
|
ProgressCode progressCode; ///< last received progress code from the MMU
|
||||||
Buttons buttonCode; ///< Last received button from the MMU.
|
Buttons buttonCode; ///< Last received button from the MMU.
|
||||||
|
|
||||||
uint8_t lastFSensor; ///< last state of filament sensor
|
uint8_t lastFSensor; ///< last state of filament sensor
|
||||||
|
|
||||||
|
#ifndef __AVR__
|
||||||
|
uint8_t txbuff[Protocol::MaxRequestSize()]; ///< In Buddy FW - a static transmit buffer needs to exist as DMA cannot be used from CCMRAM.
|
||||||
|
///< On MK3/S/+ the transmit buffer is allocated on the stack without restrictions
|
||||||
|
#endif
|
||||||
|
|
||||||
// 8bit registers
|
// 8bit registers
|
||||||
static constexpr uint8_t regs8Count = 3;
|
static constexpr uint8_t regs8Count = 3;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "mmu2_log.h"
|
#include "mmu2_log.h"
|
||||||
#include "mmu2_reporting.h"
|
#include "mmu2_reporting.h"
|
||||||
#include "mmu2_error_converter.h"
|
#include "mmu2_error_converter.h"
|
||||||
|
#include "mmu2_progress_converter.h"
|
||||||
#include "mmu2/error_codes.h"
|
#include "mmu2/error_codes.h"
|
||||||
#include "mmu2/buttons.h"
|
#include "mmu2/buttons.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
@ -14,14 +15,12 @@
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
const char * ProgressCodeToText(uint16_t pc); // we may join progress convertor and reporter together
|
void BeginReport(CommandInProgress /*cip*/, ProgressCode ec) {
|
||||||
|
|
||||||
void BeginReport(CommandInProgress /*cip*/, uint16_t ec) {
|
|
||||||
custom_message_type = CustomMsg::MMUProgress;
|
custom_message_type = CustomMsg::MMUProgress;
|
||||||
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
|
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndReport(CommandInProgress /*cip*/, uint16_t /*ec*/) {
|
void EndReport(CommandInProgress /*cip*/, ProgressCode /*ec*/) {
|
||||||
// clear the status msg line - let the printed filename get visible again
|
// clear the status msg line - let the printed filename get visible again
|
||||||
if (!printJobOngoing()) {
|
if (!printJobOngoing()) {
|
||||||
lcd_setstatuspgm(MSG_WELCOME);
|
lcd_setstatuspgm(MSG_WELCOME);
|
||||||
|
|
@ -231,7 +230,7 @@ bool TuneMenuEntered() {
|
||||||
return putErrorScreenToSleep;
|
return putErrorScreenToSleep;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportErrorHook(CommandInProgress /*cip*/, uint16_t ec, uint8_t /*es*/) {
|
void ReportErrorHook(CommandInProgress /*cip*/, ErrorCode ec, uint8_t /*es*/) {
|
||||||
if (putErrorScreenToSleep) return;
|
if (putErrorScreenToSleep) return;
|
||||||
|
|
||||||
if (mmu2.MMUCurrentErrorCode() == ErrorCode::OK && mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
|
if (mmu2.MMUCurrentErrorCode() == ErrorCode::OK && mmu2.MMULastErrorSource() == MMU2::ErrorSourceMMU) {
|
||||||
|
|
@ -241,7 +240,7 @@ void ReportErrorHook(CommandInProgress /*cip*/, uint16_t ec, uint8_t /*es*/) {
|
||||||
ReportErrorHookState = ReportErrorHookStates::DISMISS_ERROR_SCREEN;
|
ReportErrorHookState = ReportErrorHookStates::DISMISS_ERROR_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t ei = PrusaErrorCodeIndex(ec);
|
const uint8_t ei = PrusaErrorCodeIndex((ErrorCode)ec);
|
||||||
|
|
||||||
switch ((uint8_t)ReportErrorHookState) {
|
switch ((uint8_t)ReportErrorHookState) {
|
||||||
case (uint8_t)ReportErrorHookStates::RENDER_ERROR_SCREEN:
|
case (uint8_t)ReportErrorHookStates::RENDER_ERROR_SCREEN:
|
||||||
|
|
@ -289,39 +288,57 @@ void ReportErrorHook(CommandInProgress /*cip*/, uint16_t ec, uint8_t /*es*/) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportProgressHook(CommandInProgress cip, uint16_t ec) {
|
void ReportProgressHook(CommandInProgress cip, ProgressCode ec) {
|
||||||
if (cip != CommandInProgress::NoCommand) {
|
if (cip != CommandInProgress::NoCommand) {
|
||||||
custom_message_type = CustomMsg::MMUProgress;
|
custom_message_type = CustomMsg::MMUProgress;
|
||||||
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
|
lcd_setstatuspgm( _T(ProgressCodeToText(ec)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryLoadUnloadProgressbarInit() {
|
TryLoadUnloadReporter::TryLoadUnloadReporter(float delta_mm)
|
||||||
|
: dpixel0(0)
|
||||||
|
, dpixel1(0)
|
||||||
|
, lcd_cursor_col(0)
|
||||||
|
, pixel_per_mm(0.5F * float(LCD_WIDTH) / (delta_mm))
|
||||||
|
{
|
||||||
lcd_clearstatus();
|
lcd_clearstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryLoadUnloadProgressbarDeinit() {
|
TryLoadUnloadReporter::~TryLoadUnloadReporter() {
|
||||||
// Delay the next status message just so
|
// Delay the next status message just so
|
||||||
// the user can see the results clearly
|
// the user can see the results clearly
|
||||||
lcd_reset_status_message_timeout();
|
lcd_reset_status_message_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryLoadUnloadProgressbarEcho() {
|
void TryLoadUnloadReporter::Render(uint8_t col, bool sensorState) {
|
||||||
char buf[LCD_WIDTH];
|
// Set the cursor position each time in case some other
|
||||||
|
// part of the firmware changes the cursor position
|
||||||
|
lcd_insert_char_into_status(col, sensorState ? LCD_STR_SOLID_BLOCK[0] : '-');
|
||||||
|
if (!lcd_update_enabled) lcdui_print_status_line();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TryLoadUnloadReporter::Progress(bool sensorState){
|
||||||
|
// Always round up, you can only have 'whole' pixels. (floor is also an option)
|
||||||
|
dpixel1 = ceil((stepper_get_machine_position_E_mm() - planner_get_current_position_E()) * pixel_per_mm);
|
||||||
|
if (dpixel1 - dpixel0) {
|
||||||
|
dpixel0 = dpixel1;
|
||||||
|
if (lcd_cursor_col > (LCD_WIDTH - 1)) lcd_cursor_col = LCD_WIDTH - 1;
|
||||||
|
Render(lcd_cursor_col++, sensorState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TryLoadUnloadReporter::DumpToSerial(){
|
||||||
|
char buf[LCD_WIDTH + 1];
|
||||||
lcd_getstatus(buf);
|
lcd_getstatus(buf);
|
||||||
for (uint8_t i = 0; i < sizeof(buf); i++) {
|
for (uint8_t i = 0; i < sizeof(buf); i++) {
|
||||||
// 0xFF is -1 when converting from unsigned to signed char
|
// 0xFF is -1 when converting from unsigned to signed char
|
||||||
// If the number is negative, that means filament is present
|
// If the number is negative, that means filament is present
|
||||||
buf[i] = (buf[i] < 0) ? '1' : '0';
|
buf[i] = (buf[i] < 0) ? '1' : '0';
|
||||||
}
|
}
|
||||||
|
buf[LCD_WIDTH] = 0;
|
||||||
MMU2_ECHO_MSGLN(buf);
|
MMU2_ECHO_MSGLN(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryLoadUnloadProgressbar(uint8_t col, bool sensorState) {
|
|
||||||
lcd_insert_char_into_status(col, sensorState ? '-' : LCD_STR_SOLID_BLOCK[0]);
|
|
||||||
if (!lcd_update_enabled) lcdui_print_status_line();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncrementLoadFails(){
|
void IncrementLoadFails(){
|
||||||
eeprom_increment_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL);
|
eeprom_increment_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL);
|
||||||
eeprom_increment_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT);
|
eeprom_increment_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT);
|
||||||
|
|
@ -332,6 +349,10 @@ void IncrementMMUFails(){
|
||||||
eeprom_increment_word((uint16_t *)EEPROM_MMU_FAIL_TOT);
|
eeprom_increment_word((uint16_t *)EEPROM_MMU_FAIL_TOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cutter_enabled(){
|
||||||
|
return eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED) == EEPROM_MMU_CUTTER_ENABLED_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void MakeSound(SoundType s){
|
void MakeSound(SoundType s){
|
||||||
Sound_MakeSound( (eSOUND_TYPE)s);
|
Sound_MakeSound( (eSOUND_TYPE)s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,19 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#ifdef __AVR__
|
||||||
|
#include "mmu2/error_codes.h"
|
||||||
|
#include "mmu2/progress_codes.h"
|
||||||
|
#else
|
||||||
|
#include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
|
||||||
|
#include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MMU2 {
|
namespace MMU2 {
|
||||||
|
|
||||||
enum CommandInProgress : uint8_t {
|
enum CommandInProgress : uint8_t {
|
||||||
NoCommand = 0,
|
NoCommand = 0,
|
||||||
CutFilament = 'C',
|
CutFilament = 'K',
|
||||||
EjectFilament = 'E',
|
EjectFilament = 'E',
|
||||||
Homing = 'H',
|
Homing = 'H',
|
||||||
LoadFilament = 'L',
|
LoadFilament = 'L',
|
||||||
|
|
@ -17,10 +24,10 @@ enum CommandInProgress : uint8_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Called at the begin of every MMU operation
|
/// Called at the begin of every MMU operation
|
||||||
void BeginReport(CommandInProgress cip, uint16_t ec);
|
void BeginReport(CommandInProgress cip, ProgressCode ec);
|
||||||
|
|
||||||
/// Called at the end of every MMU operation
|
/// Called at the end of every MMU operation
|
||||||
void EndReport(CommandInProgress cip, uint16_t ec);
|
void EndReport(CommandInProgress cip, ProgressCode ec);
|
||||||
|
|
||||||
/// Return true if the printer's LCD is drawing the error screen
|
/// Return true if the printer's LCD is drawing the error screen
|
||||||
bool isErrorScreenRunning();
|
bool isErrorScreenRunning();
|
||||||
|
|
@ -35,24 +42,31 @@ bool TuneMenuEntered();
|
||||||
/// and allow the MMU and printer to communicate with each other.
|
/// and allow the MMU and printer to communicate with each other.
|
||||||
/// @param[in] ec error code
|
/// @param[in] ec error code
|
||||||
/// @param[in] es error source
|
/// @param[in] es error source
|
||||||
void ReportErrorHook(CommandInProgress cip, uint16_t ec, uint8_t es);
|
void ReportErrorHook(CommandInProgress cip, ErrorCode ec, uint8_t es);
|
||||||
|
|
||||||
/// Called when the MMU sends operation progress update
|
/// Called when the MMU sends operation progress update
|
||||||
void ReportProgressHook(CommandInProgress cip, uint16_t ec);
|
void ReportProgressHook(CommandInProgress cip, ProgressCode ec);
|
||||||
|
|
||||||
/// @brief Clear the status line and setup the LCD cursor
|
struct TryLoadUnloadReporter {
|
||||||
void TryLoadUnloadProgressbarInit();
|
TryLoadUnloadReporter(float delta_mm);
|
||||||
|
~TryLoadUnloadReporter();
|
||||||
|
void Progress(bool sensorState);
|
||||||
|
void DumpToSerial();
|
||||||
|
|
||||||
/// @brief Clear the status line and setup the LCD cursor
|
private:
|
||||||
void TryLoadUnloadProgressbarDeinit();
|
/// @brief Add one block to the progress bar
|
||||||
|
/// @param col pixel position on the LCD status line, should range from 0 to (LCD_WIDTH - 1)
|
||||||
|
/// @param sensorState if true, filament is not present, else filament is present. This controls which character to render
|
||||||
|
void Render(uint8_t col, bool sensorState);
|
||||||
|
|
||||||
/// @brief Report the results to serial
|
uint8_t dpixel0;
|
||||||
void TryLoadUnloadProgressbarEcho();
|
uint8_t dpixel1;
|
||||||
|
uint8_t lcd_cursor_col;
|
||||||
/// @brief Add one block to the progress bar
|
// The total length is twice delta_mm. Divide that length by number of pixels
|
||||||
/// @param col pixel position on the LCD status line, should range from 0 to (LCD_WIDTH - 1)
|
// available to get length per pixel.
|
||||||
/// @param sensorState if true, filament is not present, else filament is present. This controls which character to render
|
// Note: Below is the reciprocal of (2 * delta_mm) / LCD_WIDTH [mm/pixel]
|
||||||
void TryLoadUnloadProgressbar(uint8_t col, bool sensorState);
|
float pixel_per_mm;
|
||||||
|
};
|
||||||
|
|
||||||
/// Remders the sensor status line. Also used by the "resume temperature" screen.
|
/// Remders the sensor status line. Also used by the "resume temperature" screen.
|
||||||
void ReportErrorHookDynamicRender();
|
void ReportErrorHookDynamicRender();
|
||||||
|
|
@ -74,6 +88,9 @@ void IncrementLoadFails();
|
||||||
/// Increments EEPROM cell - number of MMU errors
|
/// Increments EEPROM cell - number of MMU errors
|
||||||
void IncrementMMUFails();
|
void IncrementMMUFails();
|
||||||
|
|
||||||
|
/// @returns true when Cutter is enabled in the menus
|
||||||
|
bool cutter_enabled();
|
||||||
|
|
||||||
// Beware: enum values intentionally chosen to match the 8bit FW to save code size
|
// Beware: enum values intentionally chosen to match the 8bit FW to save code size
|
||||||
enum SoundType {
|
enum SoundType {
|
||||||
Prompt = 2,
|
Prompt = 2,
|
||||||
|
|
@ -93,4 +110,4 @@ void ScreenClear();
|
||||||
|
|
||||||
void tuneIdlerStallguardThreshold();
|
void tuneIdlerStallguardThreshold();
|
||||||
|
|
||||||
} // namespace
|
} // namespace MMU2
|
||||||
|
|
|
||||||
|
|
@ -1209,6 +1209,11 @@ msgstr ""
|
||||||
msgid "Mesh Bed Leveling"
|
msgid "Mesh Bed Leveling"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. MSG_MODE c=6
|
#. MSG_MODE c=6
|
||||||
#: ../../Firmware/messages.cpp:107 ../../Firmware/ultralcd.cpp:4122
|
#: ../../Firmware/messages.cpp:107 ../../Firmware/ultralcd.cpp:4122
|
||||||
#: ../../Firmware/ultralcd.cpp:4126 ../../Firmware/ultralcd.cpp:4134
|
#: ../../Firmware/ultralcd.cpp:4126 ../../Firmware/ultralcd.cpp:4134
|
||||||
|
|
|
||||||
|
|
@ -2550,6 +2550,11 @@ msgstr "Výměna filamentu M600. Vložte nový filament nebo vysuňte starý."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Citlivost"
|
msgstr "Citlivost"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Mesh Bed Leveling selhal. Spusťte kalibraci osy Z."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Vyjmete stary filament a stisknete tlacitko pro zavedeni noveho."
|
#~ msgstr "Vyjmete stary filament a stisknete tlacitko pro zavedeni noveho."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2578,6 +2578,11 @@ msgstr ""
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensitivität"
|
msgstr "Sensitivität"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "MeshBett Ausgleich fehlgeschlagen. Z Kalibrierung ausführen."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Entferne das alte Fil. und drücke den Knopf, um das neue zu laden."
|
#~ msgstr "Entferne das alte Fil. und drücke den Knopf, um das neue zu laden."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2574,6 +2574,11 @@ msgstr ""
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensibilidad"
|
msgstr "Sensibilidad"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Nivelacion fallada. Ejecute la calibración Z."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr ""
|
#~ msgstr ""
|
||||||
#~ "Retira el fil. viejo y presione el dial para comenzar a cargar el nuevo."
|
#~ "Retira el fil. viejo y presione el dial para comenzar a cargar el nuevo."
|
||||||
|
|
|
||||||
|
|
@ -2589,6 +2589,11 @@ msgstr ""
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensibilité"
|
msgstr "Sensibilité"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr ""
|
#~ msgstr ""
|
||||||
#~ "Retirez l'ancien fil. puis appuyez sur le bouton pour charger le nouveau."
|
#~ "Retirez l'ancien fil. puis appuyez sur le bouton pour charger le nouveau."
|
||||||
|
|
|
||||||
|
|
@ -2567,6 +2567,11 @@ msgstr "Promjena filamenta M600. Stavite novu nit ili izbacite staru."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Osjetljivost"
|
msgstr "Osjetljivost"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Niveliranje podloge nije uspijelo. Pokrenite Z kalibraciju."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Uklonite stari fil. i pritisnite gumb za pocetak stavljanja novog."
|
#~ msgstr "Uklonite stari fil. i pritisnite gumb za pocetak stavljanja novog."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2572,6 +2572,11 @@ msgstr ""
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Érzékenység"
|
msgstr "Érzékenység"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Sikertelen asztal szintezés. Kérjük, futtasd a Z kalibrálást."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Vedd ki a regi fil., majd nyomd meg a gombot az uj fil. betoltesehez."
|
#~ msgstr "Vedd ki a regi fil., majd nyomd meg a gombot az uj fil. betoltesehez."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2573,6 +2573,11 @@ msgstr ""
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensibilità"
|
msgstr "Sensibilità"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Livellamento piano fallito. Si prega di eseguire la calibrazione Z."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Rimuovi il fil. precedente e premi la manopola per caricare il nuovo."
|
#~ msgstr "Rimuovi il fil. precedente e premi la manopola per caricare il nuovo."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2575,6 +2575,11 @@ msgstr "M600-filamentwissel. Laad een nieuw filament of werp het oude uit."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensitiviteit"
|
msgstr "Sensitiviteit"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Bed leveling mislukt. Voer de Z-kalibratie uit."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr ""
|
#~ msgstr ""
|
||||||
#~ "Verwijder de oude filament en druk op de knop om nieuwe filament te laden."
|
#~ "Verwijder de oude filament en druk op de knop om nieuwe filament te laden."
|
||||||
|
|
|
||||||
|
|
@ -2549,6 +2549,11 @@ msgstr "M600 filamentskifte. Sett inn en ny filament eller løs ut den gamle."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensitivitet"
|
msgstr "Sensitivitet"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Sengeplanering feilet. Kjør Z-kalibrering."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Ta bort det gamle filamentet og trykk valghjulet for å laste et nytt."
|
#~ msgstr "Ta bort det gamle filamentet og trykk valghjulet for å laste et nytt."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2568,6 +2568,11 @@ msgstr "Załaduj nowy filament lub wyładuj poprzedni."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Wrażliwość"
|
msgstr "Wrażliwość"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Poziomowanie stołu nieudane. Proszę uruchomić kalibrację Z."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Wyciagnij poprzedni filament i nacisnij pokretlo aby zaladowac nowy."
|
#~ msgstr "Wyciagnij poprzedni filament i nacisnij pokretlo aby zaladowac nowy."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2573,6 +2573,11 @@ msgstr ""
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Sensibilitate"
|
msgstr "Sensibilitate"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Nivelarea patului a eșuat. Rulează Calibrare Z."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Scoateti fil. vechi si apasati butonul pentru a incarca nou."
|
#~ msgstr "Scoateti fil. vechi si apasati butonul pentru a incarca nou."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2555,6 +2555,11 @@ msgstr "Výmena filamentu M600. Vložte nový filament alebo vysuňte starý."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Citlivosť"
|
msgstr "Citlivosť"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Vyrovnanie platne zlyhalo. Spustite kalibráciu Z."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Vyberte stary filament a stlacte tlacidlo pre zavedenie noveho."
|
#~ msgstr "Vyberte stary filament a stlacte tlacidlo pre zavedenie noveho."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2562,6 +2562,11 @@ msgstr "M600 filamentbyte. Ladda en ny filament eller mata ut den gamla."
|
||||||
msgid "Sensitivity"
|
msgid "Sensitivity"
|
||||||
msgstr "Känslighet"
|
msgstr "Känslighet"
|
||||||
|
|
||||||
|
#. MSG_MBL_FAILED_Z_CAL c=20 r=4
|
||||||
|
#: ../../Firmware/Marlin_main.cpp:2976
|
||||||
|
msgid "Mesh bed leveling failed. Please run Z calibration."
|
||||||
|
msgstr "Bäddnivelleringen felade. Kör Z-kalibrering."
|
||||||
|
|
||||||
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
#~ msgid "Remove old filament and press the knob to start loading new filament."
|
||||||
#~ msgstr "Ta bort det gamla fil. och tryck på knappen för att börja ladda nytt."
|
#~ msgstr "Ta bort det gamla fil. och tryck på knappen för att börja ladda nytt."
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue