shortcuts

This commit is contained in:
Scott Lahteine 2024-11-24 21:24:50 -06:00
parent 749c59aa67
commit 2e370b9e7a
15 changed files with 53 additions and 47 deletions

View File

@ -219,14 +219,14 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
while (wait_for_user) {
impatient_beep(max_beep_count);
#if ALL(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
#if ALL(HAS_FILAMENT_SENSOR, FILAMENT_CHANGE_RESUME_ON_INSERT)
#if MULTI_FILAMENT_SENSOR
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
switch (active_extruder) {
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
}
#else
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false;
if (!FILAMENT_IS_OUT()) wait_for_user = false;
#endif
#endif
idle_no_sleep();

View File

@ -51,6 +51,8 @@
#define HAS_FILAMENT_SWITCH 1
#endif
#define FILAMENT_IS_OUT() (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE)
typedef Flags<
#if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS
NUM_MOTION_SENSORS

View File

@ -155,7 +155,7 @@ void GcodeSuite::M115() {
cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
// RUNOUT (M412, M600)
cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
cap_line(F("RUNOUT"), ENABLED(HAS_FILAMENT_SENSOR));
// Z_PROBE (G30)
cap_line(F("Z_PROBE"), ENABLED(HAS_BED_PROBE));

View File

@ -46,7 +46,7 @@
#include "../../../feature/pause.h"
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
#include "../../../feature/runout.h"
#endif
@ -2857,7 +2857,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
#define ADVANCED_LOAD (ADVANCED_LA + ENABLED(ADVANCED_PAUSE_FEATURE))
#define ADVANCED_UNLOAD (ADVANCED_LOAD + ENABLED(ADVANCED_PAUSE_FEATURE))
#define ADVANCED_COLD_EXTRUDE (ADVANCED_UNLOAD + ENABLED(PREVENT_COLD_EXTRUSION))
#define ADVANCED_FILSENSORENABLED (ADVANCED_COLD_EXTRUDE + ENABLED(FILAMENT_RUNOUT_SENSOR))
#define ADVANCED_FILSENSORENABLED (ADVANCED_COLD_EXTRUDE + ENABLED(HAS_FILAMENT_SENSOR))
#define ADVANCED_FILSENSORDISTANCE (ADVANCED_FILSENSORENABLED + ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE))
#define ADVANCED_POWER_LOSS (ADVANCED_FILSENSORDISTANCE + ENABLED(POWER_LOSS_RECOVERY))
#define ADVANCED_TOTAL ADVANCED_POWER_LOSS
@ -2953,7 +2953,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
break;
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
case ADVANCED_FILSENSORENABLED:
if (draw) {
drawMenuItem(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR));
@ -2975,7 +2975,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
modifyValue(runout.runout_distance(), 0, 999, 10);
break;
#endif
#endif // FILAMENT_RUNOUT_SENSOR
#endif // HAS_FILAMENT_SENSOR
#if ENABLED(POWER_LOSS_RECOVERY)
case ADVANCED_POWER_LOSS:
@ -3830,7 +3830,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
#define TUNE_LA (TUNE_ZDOWN + ENABLED(LIN_ADVANCE))
#define TUNE_CHANGEFIL (TUNE_LA + ENABLED(FILAMENT_LOAD_UNLOAD_GCODES))
#define TUNE_FWRETRACT (TUNE_CHANGEFIL + ENABLED(FWRETRACT))
#define TUNE_FILSENSORENABLED (TUNE_FWRETRACT + ENABLED(FILAMENT_RUNOUT_SENSOR))
#define TUNE_FILSENSORENABLED (TUNE_FWRETRACT + ENABLED(HAS_FILAMENT_SENSOR))
#define TUNE_BACKLIGHT_OFF (TUNE_FILSENSORENABLED + 1)
#define TUNE_BACKLIGHT (TUNE_BACKLIGHT_OFF + 1)
#define TUNE_TOTAL TUNE_BACKLIGHT
@ -3950,7 +3950,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
break;
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
case TUNE_FILSENSORENABLED:
if (draw) {
drawMenuItem(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR));
@ -4326,7 +4326,7 @@ void JyersDWIN::popupHandler(const PopupID popupid, const bool option/*=false*/)
case Popup_FilLoad: drawPopup(option ? F("Unloading Filament") : F("Loading Filament"), PWID, F(""), Proc_Wait, ICON_BLTouch); break;
case Popup_FilChange: drawPopup(F("Filament Change"), F("Please wait for prompt."), F(""), Proc_Wait, ICON_BLTouch); break;
case Popup_TempWarn: drawPopup(option ? F("Nozzle temp too low!") : F("Nozzle temp too high!"), F(""), F(""), Proc_Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break;
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
case Popup_Runout: drawPopup(F("Filament Runout"), F(""), F(""), Proc_Wait, ICON_BLTouch); break;
#endif
#if ANY(PIDTEMP, PIDTEMPBED)
@ -4953,7 +4953,7 @@ void JyersDWIN::stateUpdate() {
}
}
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
static bool ranout = false;
if (runout.filament_ran_out != ranout) {
ranout = runout.filament_ran_out;

View File

@ -89,7 +89,7 @@ void AnycubicTFT::onSetup() {
delay_ms(10);
// Init the state of the key pins running on the TFT
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
#endif
@ -894,7 +894,7 @@ void AnycubicTFT::doSDCardStateCheck() {
}
void AnycubicTFT::doFilamentRunoutCheck() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
// NOTE: getFilamentRunoutState() only returns the runout state if the job is printing
// we want to actually check the status of the pin here, regardless of printstate
if (READ(FIL_RUNOUT1_PIN) == FIL_RUNOUT1_STATE) {
@ -909,7 +909,7 @@ void AnycubicTFT::doFilamentRunoutCheck() {
SENDLINE_DBG_PGM("J15", "TFT Serial Debug: Non blocking filament runout... J15");
}
}
#endif // FILAMENT_RUNOUT_SENSOR
#endif // HAS_FILAMENT_SENSOR
}
void AnycubicTFT::startPrint() {
@ -939,7 +939,7 @@ void AnycubicTFT::pausePrint() {
void AnycubicTFT::resumePrint() {
#if HAS_MEDIA
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
if (READ(FIL_RUNOUT1_PIN) == FIL_RUNOUT1_STATE) {
DEBUG_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");

View File

@ -45,6 +45,10 @@
#include "../../../feature/powerloss.h"
#endif
#if HAS_FILAMENT_SENSOR
#include "../../../feature/runout.h"
#endif
#define DEBUG_OUT ACDEBUGLEVEL
#include "../../../core/debug_out.h"
@ -438,7 +442,7 @@ namespace Anycubic {
}
}
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
void DgusTFT::filamentRunout() {
#if ACDEBUG(AC_MARLIN)
@ -453,7 +457,7 @@ namespace Anycubic {
pop_up_index = 15; // show filament lack.
if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) {
if (FILAMENT_IS_OUT()) {
playTune(FilamentOut);
feedrate_back = getFeedrate_percent();
@ -466,7 +470,7 @@ namespace Anycubic {
}
}
#endif // FILAMENT_RUNOUT_SENSOR
#endif // HAS_FILAMENT_SENSOR
void DgusTFT::confirmationRequest(const char * const msg) {
// M108 continue
@ -598,7 +602,7 @@ namespace Anycubic {
printer_state = AC_printer_stopping_from_media_remove;
}
else {
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
#if ACDEBUG(AC_MARLIN)
DEBUG_ECHOLNPGM("setFilamentRunoutState: ", __LINE__);
#endif

View File

@ -102,7 +102,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
#endif
.enabled(ENABLED(HAS_MULTI_HOTEND))
.tag(4) .button(OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU))
.enabled(ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR))
.enabled(ANY(LIN_ADVANCE, HAS_FILAMENT_SENSOR))
.tag(11).button(FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT))
.tag(12).button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS))
.tag(15).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU))
@ -122,29 +122,29 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
#if HAS_BED_PROBE
case 2: GOTO_SCREEN(ZOffsetScreen); break;
case 2: GOTO_SCREEN(ZOffsetScreen); break;
#endif
case 3: GOTO_SCREEN(StepsScreen); break;
#if HAS_MULTI_HOTEND
case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
#endif
case 5: GOTO_SCREEN(MaxVelocityScreen); break;
case 6: GOTO_SCREEN(DefaultAccelerationScreen); break;
case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break;
#if ENABLED(BACKLASH_GCODE)
case 8: GOTO_SCREEN(BacklashCompensationScreen); break;
case 8: GOTO_SCREEN(BacklashCompensationScreen); break;
#endif
case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break;
case 10: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break;
#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
case 11: GOTO_SCREEN(FilamentMenu); break;
#if ANY(LIN_ADVANCE, HAS_FILAMENT_SENSOR)
case 11: GOTO_SCREEN(FilamentMenu); break;
#endif
case 12: GOTO_SCREEN(EndstopStatesScreen); break;
#if HAS_TRINAMIC_CONFIG
case 13: GOTO_SCREEN(StepperCurrentScreen); break;
case 13: GOTO_SCREEN(StepperCurrentScreen); break;
#endif
#if ENABLED(SENSORLESS_HOMING)
case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
case 14: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
#endif
case 15: GOTO_SCREEN(DisplayTuningScreen); break;
case 16: GOTO_SCREEN(FlowPercentScreen); break;

View File

@ -84,12 +84,12 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
#else
PIN_DISABLED(5, 3, PSTR(STR_Z_MIN), Z_MIN)
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT)
#if HAS_FILAMENT_SENSOR && PIN_EXISTS(FIL_RUNOUT)
PIN_ENABLED (1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT, FIL_RUNOUT1_STATE)
#else
PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
#endif
#if ALL(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2)
#if ALL(HAS_MULTI_EXTRUDER, HAS_FILAMENT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2)
PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT2_STATE)
#else
PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)

View File

@ -58,7 +58,7 @@ void FilamentMenu::onRedraw(draw_mode_t what) {
cmd.font(font_large)
.text(TITLE_POS, GET_TEXT_F(MSG_FILAMENT))
.font(font_medium).colors(normal_btn)
.enabled(ENABLED(FILAMENT_RUNOUT_SENSOR))
.enabled(ENABLED(HAS_FILAMENT_SENSOR))
.tag(2).button(RUNOUT_SENSOR_POS, GET_TEXT_F(MSG_RUNOUT_SENSOR))
.enabled(ENABLED(LIN_ADVANCE))
.tag(3).button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE))
@ -69,12 +69,12 @@ void FilamentMenu::onRedraw(draw_mode_t what) {
bool FilamentMenu::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
case 2: GOTO_SCREEN(FilamentRunoutScreen); break;
case 1: GOTO_PREVIOUS(); break;
#if HAS_FILAMENT_SENSOR
case 2: GOTO_SCREEN(FilamentRunoutScreen); break;
#endif
#if ENABLED(LIN_ADVANCE)
case 3: GOTO_SCREEN(LinearAdvanceScreen); break;
case 3: GOTO_SCREEN(LinearAdvanceScreen); break;
#endif
default: return false;
}

View File

@ -75,13 +75,13 @@ enum {
#if ENABLED(CASE_LIGHT_ENABLE)
CASE_LIGHT_SCREEN_CACHE,
#endif
#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
#if ANY(LIN_ADVANCE, HAS_FILAMENT_SENSOR)
FILAMENT_MENU_CACHE,
#endif
#if ENABLED(LIN_ADVANCE)
LINEAR_ADVANCE_SCREEN_CACHE,
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
FILAMENT_RUNOUT_SCREEN_CACHE,
#endif
#if HAS_MEDIA
@ -197,11 +197,11 @@ enum {
#include "case_light_screen.h"
#endif
#if ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
#if ANY(LIN_ADVANCE, HAS_FILAMENT_SENSOR)
#include "filament_menu.h"
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
#include "filament_runout_screen.h"
#endif

View File

@ -374,9 +374,9 @@ void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
.button(TOOL_HEAD_POS, !ExtUI::isPrintingPaused() ? GET_TEXT_F(MSG_BUTTON_PAUSE) : GET_TEXT_F(MSG_BUTTON_RESUME))
.tag(!ExtUI::isPrintingPaused() ? 7 : 14)
.button(CHANGE_FILAMENT_POS, !ExtUI::isPrintingPaused() ? GET_TEXT_F(MSG_SPEED) : F(""));
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
cmd.tag(8).button(PREHEAT_POS, GET_TEXT_F(MSG_SENSOR));
#endif
#if HAS_FILAMENT_SENSOR
cmd.tag(8).button(PREHEAT_POS, GET_TEXT_F(MSG_SENSOR));
#endif
if (ExtUI::isPrintingPaused())
draw_text_box(cmd, CHANGE_FILAMENT_POS, F("Change\nFilament"), OPT_CENTER, font_medium);
}
@ -536,7 +536,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
}
break;
case 7: GOTO_SCREEN(FeedratePercentScreen); break;
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
case 8: GOTO_SCREEN(FilamentRunoutScreen); break;
#endif
case 9: injectCommands(F("G28")); break;

View File

@ -171,7 +171,7 @@ void onUserConfirmRequired(const char *const msg) {
case PAUSE_MESSAGE_PURGE: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
char newMsg[40] = "Yes to ";
strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable "));
strcat_P(newMsg, TERN1(HAS_FILAMENT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable "));
strcat_P(newMsg, PSTR(" No to Purge"));
onStatusChanged(newMsg);
break;
@ -181,7 +181,7 @@ void onUserConfirmRequired(const char *const msg) {
case PAUSE_MESSAGE_OPTION: {
rts.sendData(ExchangePageBase + 78, ExchangepageAddr);
char newMsg[40] = "Yes to ";
strcat_P(newMsg, TERN1(FILAMENT_RUNOUT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable "));
strcat_P(newMsg, TERN1(HAS_FILAMENT_SENSOR, !ExtUI::getFilamentRunoutState() && getFilamentRunoutEnabled()) ? PSTR("Continue") : PSTR("Disable "));
strcat_P(newMsg, PSTR(" No to Purge"));
onStatusChanged(newMsg);
break;

View File

@ -1435,7 +1435,7 @@ void RTS::handleData() {
// pause_resume_selected = true;
}
else {
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
bool runouton = false;
if (getFilamentRunoutState()) {
#if NUM_RUNOUT_SENSORS > 1

View File

@ -138,7 +138,7 @@ void menu_advanced_settings();
#if HAS_BED_PROBE && !HAS_DELTA_SENSORLESS_PROBING
__STOP_ITEM(GET_TEXT_F(MSG_Z_PROBE), Z_MIN_PROBE);
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#if HAS_FILAMENT_SENSOR
REPEAT_1(NUM_RUNOUT_SENSORS, FIL_ITEM)
#endif

View File

@ -1365,7 +1365,7 @@ void RTS::handleData() {
#if HAS_FILAMENT_SENSOR
case FilamentChange: // Automatic material
switch (recdat.data[0]) {
case 1: if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) break;
case 1: if (FILAMENT_IS_OUT()) break;
case 2:
updateTempE0();
wait_for_heatup = wait_for_user = false;