🚸 Improve PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED (#25681)
This commit is contained in:
@@ -148,7 +148,7 @@ void PCA9632_set_led_color(const LEDColor &color) {
|
|||||||
|
|
||||||
#if ENABLED(PCA9632_BUZZER)
|
#if ENABLED(PCA9632_BUZZER)
|
||||||
|
|
||||||
void PCA9632_buzz(const long, const uint16_t) {
|
void PCA9632_buzz(const long, const uint16_t=0) {
|
||||||
uint8_t data[] = PCA9632_BUZZER_DATA;
|
uint8_t data[] = PCA9632_BUZZER_DATA;
|
||||||
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
|
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
|
||||||
Wire.write(data, sizeof(data));
|
Wire.write(data, sizeof(data));
|
||||||
|
@@ -33,5 +33,5 @@ void PCA9632_set_led_color(const LEDColor &color);
|
|||||||
|
|
||||||
#if ENABLED(PCA9632_BUZZER)
|
#if ENABLED(PCA9632_BUZZER)
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
void PCA9632_buzz(const long, const uint16_t);
|
void PCA9632_buzz(const long, const uint16_t=0);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -125,7 +125,7 @@ static void createChar_P(const char c, const byte * const ptr) {
|
|||||||
|
|
||||||
#if ENABLED(LCD_USE_I2C_BUZZER)
|
#if ENABLED(LCD_USE_I2C_BUZZER)
|
||||||
|
|
||||||
void MarlinUI::buzz(const long duration, const uint16_t freq) {
|
void MarlinUI::buzz(const long duration, const uint16_t freq/*=0*/) {
|
||||||
if (sound_on) lcd.buzz(duration, freq);
|
if (sound_on) lcd.buzz(duration, freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -299,7 +299,7 @@ uint8_t MarlinUI::read_slow_buttons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Duration in ms, freq in Hz
|
// Duration in ms, freq in Hz
|
||||||
void MarlinUI::buzz(const long duration, const uint16_t freq) {
|
void MarlinUI::buzz(const long duration, const uint16_t freq/*=0*/) {
|
||||||
if (!PanelDetected) return;
|
if (!PanelDetected) return;
|
||||||
if (!sound_on) return;
|
if (!sound_on) return;
|
||||||
#if ENABLED(TFTGLCD_PANEL_SPI)
|
#if ENABLED(TFTGLCD_PANEL_SPI)
|
||||||
|
@@ -127,7 +127,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PCA9632_BUZZER)
|
#if ENABLED(PCA9632_BUZZER)
|
||||||
void MarlinUI::buzz(const long duration, const uint16_t freq) {
|
void MarlinUI::buzz(const long duration, const uint16_t freq/*=0*/) {
|
||||||
if (sound_on) PCA9632_buzz(duration, freq);
|
if (sound_on) PCA9632_buzz(duration, freq);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -228,7 +228,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_MARLINUI_BUZZER
|
#if USE_MARLINUI_BUZZER
|
||||||
static void buzz(const long duration, const uint16_t freq);
|
static void buzz(const long duration, const uint16_t freq=0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void chirp() {
|
static void chirp() {
|
||||||
|
@@ -115,21 +115,20 @@
|
|||||||
extern Buzzer buzzer;
|
extern Buzzer buzzer;
|
||||||
|
|
||||||
// Buzz directly via the BEEPER pin tone queue
|
// Buzz directly via the BEEPER pin tone queue
|
||||||
#define BUZZ(d,f) buzzer.tone(d, f)
|
#define BUZZ(V...) buzzer.tone(V)
|
||||||
|
|
||||||
#elif USE_MARLINUI_BUZZER
|
#elif USE_MARLINUI_BUZZER
|
||||||
|
|
||||||
// Use MarlinUI for a buzzer on the LCD
|
// Use MarlinUI for a buzzer on the LCD
|
||||||
#include "../lcd/marlinui.h"
|
#define BUZZ(V...) ui.buzz(V)
|
||||||
#define BUZZ(d,f) ui.buzz(d,f)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// No buzz capability
|
// No buzz capability
|
||||||
#define BUZZ(d,f) NOOP
|
#define BUZZ(...) NOOP
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ERR_BUZZ() BUZZ(400, 40);
|
#define ERR_BUZZ() BUZZ(400, 40)
|
||||||
#define OKAY_BUZZ() do{ BUZZ(100, 659); BUZZ(10, 0); BUZZ(100, 698); }while(0)
|
#define OKAY_BUZZ() do{ BUZZ(100, 659); BUZZ(10); BUZZ(100, 698); }while(0)
|
||||||
#define DONE_BUZZ(OK) do{ if (OK) OKAY_BUZZ(); else ERR_BUZZ(); }while(0)
|
#define DONE_BUZZ(ok) do{ if (ok) OKAY_BUZZ(); else ERR_BUZZ(); }while(0)
|
||||||
|
@@ -361,25 +361,35 @@ void Probe::do_z_raise(const float z_raise) {
|
|||||||
|
|
||||||
FORCE_INLINE void probe_specific_action(const bool deploy) {
|
FORCE_INLINE void probe_specific_action(const bool deploy) {
|
||||||
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
|
||||||
do {
|
|
||||||
#if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED)
|
|
||||||
if (deploy != PROBE_TRIGGERED()) break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OKAY_BUZZ();
|
// Start preheating before waiting for user confirmation that the probe is ready.
|
||||||
|
TERN_(PREHEAT_BEFORE_PROBING, if (deploy) probe.preheat_for_probing(0, PROBING_BED_TEMP, true));
|
||||||
|
|
||||||
FSTR_P const ds_str = deploy ? GET_TEXT_F(MSG_MANUAL_DEPLOY) : GET_TEXT_F(MSG_MANUAL_STOW);
|
FSTR_P const ds_str = deploy ? GET_TEXT_F(MSG_MANUAL_DEPLOY) : GET_TEXT_F(MSG_MANUAL_STOW);
|
||||||
ui.return_to_status(); // To display the new status message
|
ui.return_to_status(); // To display the new status message
|
||||||
ui.set_status(ds_str, 99);
|
ui.set_status(ds_str, 99);
|
||||||
SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
|
SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW));
|
||||||
|
|
||||||
|
OKAY_BUZZ();
|
||||||
|
|
||||||
|
#if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED)
|
||||||
|
// Wait for the probe to be attached or detached before asking for explicit user confirmation
|
||||||
|
// Allow the user to interrupt
|
||||||
|
{
|
||||||
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
|
TERN_(HAS_RESUME_CONTINUE, wait_for_user = true);
|
||||||
|
while (deploy == PROBE_TRIGGERED() && TERN1(HAS_RESUME_CONTINUE, wait_for_user)) idle_no_sleep();
|
||||||
|
TERN_(HAS_RESUME_CONTINUE, wait_for_user = false);
|
||||||
|
OKAY_BUZZ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str));
|
TERN_(HOST_PROMPT_SUPPORT, hostui.continue_prompt(ds_str));
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
|
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(ds_str));
|
||||||
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
|
TERN_(DWIN_LCD_PROUI, DWIN_Popup_Confirm(ICON_BLTouch, ds_str, FPSTR(CONTINUE_STR)));
|
||||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
|
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
|
||||||
ui.reset_status();
|
|
||||||
|
|
||||||
} while (ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED));
|
ui.reset_status();
|
||||||
|
|
||||||
#endif // PAUSE_BEFORE_DEPLOY_STOW
|
#endif // PAUSE_BEFORE_DEPLOY_STOW
|
||||||
|
|
||||||
@@ -436,7 +446,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|||||||
* - If a preheat input is higher than the current target, raise the target temperature.
|
* - If a preheat input is higher than the current target, raise the target temperature.
|
||||||
* - If a preheat input is higher than the current temperature, wait for stabilization.
|
* - If a preheat input is higher than the current temperature, wait for stabilization.
|
||||||
*/
|
*/
|
||||||
void Probe::preheat_for_probing(const celsius_t hotend_temp, const celsius_t bed_temp) {
|
void Probe::preheat_for_probing(const celsius_t hotend_temp, const celsius_t bed_temp, const bool early/*=false*/) {
|
||||||
#if HAS_HOTEND && (PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP)
|
#if HAS_HOTEND && (PROBING_NOZZLE_TEMP || LEVELING_NOZZLE_TEMP)
|
||||||
#define WAIT_FOR_NOZZLE_HEAT
|
#define WAIT_FOR_NOZZLE_HEAT
|
||||||
#endif
|
#endif
|
||||||
@@ -444,7 +454,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|||||||
#define WAIT_FOR_BED_HEAT
|
#define WAIT_FOR_BED_HEAT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LCD_MESSAGE(MSG_PREHEATING);
|
if (!early) LCD_MESSAGE(MSG_PREHEATING);
|
||||||
|
|
||||||
DEBUG_ECHOPGM("Preheating ");
|
DEBUG_ECHOPGM("Preheating ");
|
||||||
|
|
||||||
@@ -454,14 +464,12 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|||||||
DEBUG_ECHOPGM("hotend (", hotendPreheat, ")");
|
DEBUG_ECHOPGM("hotend (", hotendPreheat, ")");
|
||||||
thermalManager.setTargetHotend(hotendPreheat, 0);
|
thermalManager.setTargetHotend(hotendPreheat, 0);
|
||||||
}
|
}
|
||||||
#elif ENABLED(WAIT_FOR_BED_HEAT)
|
|
||||||
constexpr celsius_t hotendPreheat = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(WAIT_FOR_BED_HEAT)
|
#if ENABLED(WAIT_FOR_BED_HEAT)
|
||||||
const celsius_t bedPreheat = bed_temp > thermalManager.degTargetBed() ? bed_temp : 0;
|
const celsius_t bedPreheat = bed_temp > thermalManager.degTargetBed() ? bed_temp : 0;
|
||||||
if (bedPreheat) {
|
if (bedPreheat) {
|
||||||
if (hotendPreheat) DEBUG_ECHOPGM(" and ");
|
if (TERN0(WAIT_FOR_NOZZLE_HEAT, hotendPreheat)) DEBUG_ECHOPGM(" and ");
|
||||||
DEBUG_ECHOPGM("bed (", bedPreheat, ")");
|
DEBUG_ECHOPGM("bed (", bedPreheat, ")");
|
||||||
thermalManager.setTargetBed(bedPreheat);
|
thermalManager.setTargetBed(bedPreheat);
|
||||||
}
|
}
|
||||||
@@ -469,9 +477,11 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
|||||||
|
|
||||||
DEBUG_EOL();
|
DEBUG_EOL();
|
||||||
|
|
||||||
|
if (!early) {
|
||||||
TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.wholeDegHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
|
TERN_(WAIT_FOR_NOZZLE_HEAT, if (hotend_temp > thermalManager.wholeDegHotend(0) + (TEMP_WINDOW)) thermalManager.wait_for_hotend(0));
|
||||||
TERN_(WAIT_FOR_BED_HEAT, if (bed_temp > thermalManager.wholeDegBed() + (TEMP_BED_WINDOW)) thermalManager.wait_for_bed_heating());
|
TERN_(WAIT_FOR_BED_HEAT, if (bed_temp > thermalManager.wholeDegBed() + (TEMP_BED_WINDOW)) thermalManager.wait_for_bed_heating());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@ public:
|
|||||||
static xyz_pos_t offset;
|
static xyz_pos_t offset;
|
||||||
|
|
||||||
#if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
|
#if EITHER(PREHEAT_BEFORE_PROBING, PREHEAT_BEFORE_LEVELING)
|
||||||
static void preheat_for_probing(const celsius_t hotend_temp, const celsius_t bed_temp);
|
static void preheat_for_probing(const celsius_t hotend_temp, const celsius_t bed_temp, const bool early=false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void probe_error_stop();
|
static void probe_error_stop();
|
||||||
|
Reference in New Issue
Block a user