Simplify filament_presence_check usage
Pull all checks needed into the function such that the caller only needs to check the return value Also added description for the filament_presence_check function
This commit is contained in:
parent
75c980c4e7
commit
40d3830e6d
|
|
@ -5224,17 +5224,10 @@ void process_commands()
|
||||||
lcd_resume_print();
|
lcd_resume_print();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!MMU2::mmu2.Enabled()) {
|
if (!filament_presence_check()) {
|
||||||
// Check if the filament is present before starting a print.
|
// Print was aborted
|
||||||
// When MMU is enabled, this is not necessary and the G-code file
|
|
||||||
// should always tell the MMU which filament to load.
|
|
||||||
filament_presence_check();
|
|
||||||
|
|
||||||
if (lcd_commands_type == LcdCommands::StopPrint) {
|
|
||||||
// Print job was canceled
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!card.get_sdpos())
|
if (!card.get_sdpos())
|
||||||
{
|
{
|
||||||
|
|
@ -5866,17 +5859,10 @@ Sigma_Exit:
|
||||||
*/
|
*/
|
||||||
case 75:
|
case 75:
|
||||||
{
|
{
|
||||||
if (!MMU2::mmu2.Enabled()) {
|
if (!filament_presence_check()) {
|
||||||
// Check if the filament is present before starting a host print.
|
// Print was aborted
|
||||||
// When MMU is enabled, this is not necessary and the G-code file
|
|
||||||
// should always tell the MMU which filament to load.
|
|
||||||
filament_presence_check();
|
|
||||||
|
|
||||||
if (lcd_commands_type == LcdCommands::StopPrint) {
|
|
||||||
// Print job was canceled
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
print_job_timer.start();
|
print_job_timer.start();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -371,19 +371,32 @@ void fw_version_check(const char *pVersion) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void filament_presence_check() {
|
bool filament_presence_check() {
|
||||||
if (fsensor.isEnabled() && !fsensor.getFilamentPresent())
|
// When MMU is enabled, this is not necessary and the G-code file
|
||||||
{
|
// should always tell the MMU which filament to load.
|
||||||
if (oCheckFilament == ClCheckMode::_None)
|
if (MMU2::mmu2.Enabled()) {
|
||||||
return;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fsensor.isEnabled() && !fsensor.getFilamentPresent()) {
|
||||||
|
if (oCheckFilament == ClCheckMode::_None) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
render_M862_warnings(
|
render_M862_warnings(
|
||||||
_T(MSG_MISSING_FILAMENT_CONTINUE)
|
_T(MSG_MISSING_FILAMENT_CONTINUE)
|
||||||
,_T(MSG_MISSING_FILAMENT_CANCELLED)
|
,_T(MSG_MISSING_FILAMENT_CANCELLED)
|
||||||
,(uint8_t)oCheckFilament
|
,(uint8_t)oCheckFilament
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (lcd_commands_type == LcdCommands::StopPrint) {
|
||||||
|
// Print job was canceled
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gcode_level_check(uint16_t nGcodeLevel) {
|
void gcode_level_check(uint16_t nGcodeLevel) {
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,22 @@ void nozzle_diameter_check(uint16_t nDiameter);
|
||||||
void printer_model_check(uint16_t nPrinterModel, uint16_t actualPrinterModel);
|
void printer_model_check(uint16_t nPrinterModel, uint16_t actualPrinterModel);
|
||||||
void printer_smodel_check(const char *pStrPos, const char *actualPrinterSModel);
|
void printer_smodel_check(const char *pStrPos, const char *actualPrinterSModel);
|
||||||
void fw_version_check(const char *pVersion);
|
void fw_version_check(const char *pVersion);
|
||||||
void filament_presence_check();
|
|
||||||
void gcode_level_check(uint16_t nGcodeLevel);
|
void gcode_level_check(uint16_t nGcodeLevel);
|
||||||
|
|
||||||
|
/// Check if the filament is present before starting a print job.
|
||||||
|
/// Depending on the check level set in the menus the printer will:
|
||||||
|
/// - None: not issue any warning about missing filament
|
||||||
|
/// - Warning (default): The user is warned about missing filament
|
||||||
|
/// and is prompted to continue with Yes/No. If No is selected,
|
||||||
|
/// the print is aborted. If no user input is given (e.g. from
|
||||||
|
/// host printing) then the warning will expire in 30 seconds and
|
||||||
|
/// the printer assumes the Yes option was selected.
|
||||||
|
/// - Strict: If the filament is not detected when a print is started,
|
||||||
|
/// it is immediately canceled with a message saying the filament is
|
||||||
|
/// missing.
|
||||||
|
/// @returns false if the print is canceled, true otherwise
|
||||||
|
bool filament_presence_check();
|
||||||
|
|
||||||
uint16_t nPrinterType(bool bMMu);
|
uint16_t nPrinterType(bool bMMu);
|
||||||
const char *sPrinterType(bool bMMu);
|
const char *sPrinterType(bool bMMu);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue