️ Fix and improve Inline Laser Power (#22690)

This commit is contained in:
Mike La Spina
2022-07-06 07:46:39 -05:00
committed by Scott Lahteine
parent 5b6c46db29
commit d965303a7a
18 changed files with 851 additions and 715 deletions

View File

@ -670,7 +670,7 @@ void MarlinUI::draw_status_screen() {
// Laser / Spindle
#if DO_DRAW_CUTTER
if (cutter.isReady && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) {
if (cutter.isReadyForUI && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) {
#if CUTTER_UNIT_IS(PERCENT)
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
#elif CUTTER_UNIT_IS(RPM)

View File

@ -27,6 +27,10 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(LASER_SYNCHRONOUS_M106_M107)
#include "../../module/planner.h"
#endif
void lcd_move_z();
////////////////////////////////////////////
@ -538,6 +542,7 @@ class MenuItem_bool : public MenuEditItemBase {
inline void on_fan_update() {
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
TERN_(LASER_SYNCHRONOUS_M106_M107, planner.buffer_sync_block(BLOCK_FLAG_SYNC_FANS));
}
#if ENABLED(EXTRA_FAN_SPEED)

View File

@ -33,7 +33,7 @@
#include "../../feature/spindle_laser.h"
void menu_spindle_laser() {
bool is_enabled = cutter.enabled() && cutter.isReady;
bool is_enabled = cutter.enabled();
#if ENABLED(SPINDLE_CHANGE_DIR)
bool is_rev = cutter.is_reverse();
#endif
@ -49,7 +49,13 @@
#endif
editable.state = is_enabled;
EDIT_ITEM(bool, MSG_CUTTER(TOGGLE), &is_enabled, []{ if (editable.state) cutter.disable(); else cutter.enable_same_dir(); });
EDIT_ITEM(bool, MSG_CUTTER(TOGGLE), &is_enabled, []{
#if ENABLED(SPINDLE_FEATURE)
if (editable.state) cutter.disable(); else cutter.enable_same_dir();
#else
cutter.laser_menu_toggle(!editable.state);
#endif
});
#if ENABLED(AIR_EVACUATION)
bool evac_state = cutter.air_evac_state();
@ -72,12 +78,10 @@
// Setup and fire a test pulse using the current PWM power level for for a duration of test_pulse_min to test_pulse_max ms.
EDIT_ITEM_FAST(CUTTER_MENU_PULSE_TYPE, MSG_LASER_PULSE_MS, &cutter.testPulse, LASER_TEST_PULSE_MIN, LASER_TEST_PULSE_MAX);
ACTION_ITEM(MSG_LASER_FIRE_PULSE, cutter.test_fire_pulse);
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY
EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency);
#endif
#endif
#if BOTH(MARLIN_DEV_MODE, HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY
EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency);
#endif
END_MENU();
}