Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Spindle/Laser Control menu #20347

Merged
merged 14 commits into from
Dec 9, 2020
1 change: 1 addition & 0 deletions Marlin/src/feature/spindle_laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
SpindleLaser cutter;
uint8_t SpindleLaser::power;
bool SpindleLaser::isReady; // Ready to apply power setting from the UI to OCR
bool SpindleLaser::state; // Cutter/Laser on/off state
cutter_power_t SpindleLaser::menuPower, // Power set via LCD menu in PWM, PERCENT, or RPM
SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/feature/spindle_laser.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class SpindleLaser {
static const cutter_power_t mpower_max() { return cpwr_to_upwr(SPEED_POWER_MAX); }

static bool isReady; // Ready to apply power setting from the UI to OCR
static bool state; // Cutter/Laser on/off state
static uint8_t power;

#if ENABLED(MARLIN_DEV_MODE)
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ namespace Language_en {
#endif
PROGMEM Language_Str MSG_PREHEAT_CUSTOM = _UxGT("Preheat Custom");
PROGMEM Language_Str MSG_COOLDOWN = _UxGT("Cooldown");

PROGMEM Language_Str MSG_CUTTER_FREQUENCY = _UxGT("Frequency");
PROGMEM Language_Str MSG_LASER_MENU = _UxGT("Laser Control");
PROGMEM Language_Str MSG_LASER_OFF = _UxGT("Laser Off");
PROGMEM Language_Str MSG_LASER_ON = _UxGT("Laser On");
PROGMEM Language_Str MSG_LASER_POWER = _UxGT("Laser Power");
PROGMEM Language_Str MSG_LASER_STATE = _UxGT("Laser State");
PROGMEM Language_Str MSG_SPINDLE_STATE = _UxGT("Spindle State");
PROGMEM Language_Str MSG_SPINDLE_MENU = _UxGT("Spindle Control");
PROGMEM Language_Str MSG_SPINDLE_OFF = _UxGT("Spindle Off");
PROGMEM Language_Str MSG_SPINDLE_ON = _UxGT("Spindle On");
PROGMEM Language_Str MSG_SPINDLE_POWER = _UxGT("Spindle Power");
PROGMEM Language_Str MSG_SPINDLE_REVERSE = _UxGT("Spindle Reverse");

PROGMEM Language_Str MSG_SWITCH_PS_ON = _UxGT("Switch Power On");
PROGMEM Language_Str MSG_SWITCH_PS_OFF = _UxGT("Switch Power Off");
PROGMEM Language_Str MSG_EXTRUDE = _UxGT("Extrude");
Expand Down
13 changes: 6 additions & 7 deletions Marlin/src/lcd/menu/menu_spindle_laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

START_MENU();
BACK_ITEM(MSG_MAIN);
// Messing with a Cutter/Laser manually needs the menu to stay modal
ui.defer_status_screen();

#if ENABLED(SPINDLE_LASER_PWM)
// Change the cutter's "current power" value without turning the cutter on or off
Expand All @@ -47,17 +49,14 @@
#endif

if (is_enabled)
ACTION_ITEM(MSG_CUTTER(OFF), cutter.disable);
else {
ACTION_ITEM(MSG_CUTTER(ON), cutter.enable_forward);
#if ENABLED(SPINDLE_CHANGE_DIR)
ACTION_ITEM(MSG_SPINDLE_REVERSE, cutter.enable_reverse);
#endif
}
EDIT_ITEM(bool, MSG_CUTTER(STATE), &cutter.state, cutter.disable);
else
EDIT_ITEM(bool, MSG_CUTTER(STATE), &cutter.state, TERN(SPINDLE_CHANGE_DIR, cutter.enable_reverse, cutter.enable_forward));

#if BOTH(MARLIN_DEV_MODE, HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY)
EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 50000, cutter.refresh_frequency);
#endif

END_MENU();
}

Expand Down