Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#4214 from 3d-gussner/MK3_Fix_MMU_IR…
Browse files Browse the repository at this point in the history
…sensor

Fix IRsensor with MMU
  • Loading branch information
3d-gussner authored May 24, 2023
2 parents d4beab9 + 9b4c8e9 commit 135247c
Showing 1 changed file with 9 additions and 45 deletions.
54 changes: 9 additions & 45 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5888,9 +5888,6 @@ bool lcd_selftest()
if (!MMU2::mmu2.Enabled()) {
lcd_detect_IRsensor();
}
else {
fsensor.setSensorRevision(IR_sensor_analog::SensorRevision::_Old, true);
}
}
#endif
lcd_wait_for_cool_down();
Expand Down Expand Up @@ -6673,50 +6670,17 @@ static bool lcd_selftest_fsensor(void)
//! @retval false failed
static bool selftest_irsensor()
{
class TempBackup
{
public:
TempBackup():
m_temp(degTargetHotend(active_extruder)){}
~TempBackup(){setTargetHotend(m_temp);}
private:
float m_temp;
};
uint8_t progress;
{
TempBackup tempBackup;
setTargetHotend(ABS_PREHEAT_HOTEND_TEMP);
progress = lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0);
}
progress = lcd_selftest_screen(TestScreen::Fsensor, progress, 1, true, 0);
MMU2::mmu2.unload();
// Ask user which slot to load filament from
uint8_t slot = choose_menu_P(_T(MSG_SELECT_FILAMENT), _T(MSG_FILAMENT));

for(uint_least8_t i = 0; i < 200; ++i)
{
if (0 == (i % 32)) progress = lcd_selftest_screen(TestScreen::Fsensor, progress, 1, true, 0);
// Render self-test screen
lcd_selftest_screen(TestScreen::Fsensor, 0, 1, true, 0);

//@@TODO mmu_load_step(false);
while (blocks_queued())
{
if (fsensor.getFilamentPresent())
{
lcd_selftest_error(TestError::TriggeringFsensor, "", "");
return false;
}
#ifdef TMC2130
manage_heater();
// Vojtech: Don't disable motors inside the planner!
if (!tmc2130_update_sg())
{
manage_inactivity(true);
}
#else //TMC2130
manage_heater();
// Vojtech: Don't disable motors inside the planner!
manage_inactivity(true);
#endif //TMC2130
}
}
// Run self-test
set_extrude_min_temp(0);
MMU2::mmu2.tool_change(slot);
MMU2::mmu2.unload(); //Unload filament
set_extrude_min_temp(EXTRUDE_MINTEMP);
return true;
}
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
Expand Down

0 comments on commit 135247c

Please # to comment.