diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index 52bb471b0f7e..ced9b19494dc 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -39,16 +39,18 @@ #endif SpindleLaser cutter; -uint8_t SpindleLaser::power; +uint8_t SpindleLaser::ocr_power = 0; // Startup disable +SpindleDir SpindleLaser::spindle_dir = SpindleDirCW; // Startup clockwise +CutterState SpindleLaser::state = STAY_OFF; // Startup OFF #if ENABLED(LASER_FEATURE) - cutter_test_pulse_t SpindleLaser::testPulse = 50; // Test fire Pulse time ms value. + cutter_test_pulse_t SpindleLaser::testPulse = 50; // Test fire Pulse time ms value. #endif -bool SpindleLaser::isReady; // Ready to apply power setting from the UI to OCR -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 +bool SpindleLaser::isReady; // Ready to apply power setting from the UI to OCR +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 #if ENABLED(MARLIN_DEV_MODE) - cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K + cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K #endif #define SPINDLE_LASER_PWM_OFF TERN(SPINDLE_LASER_PWM_INVERT, 255, 0) @@ -62,7 +64,8 @@ void SpindleLaser::init() { OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Init spindle to off #endif #if ENABLED(SPINDLE_CHANGE_DIR) - OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR); // Init rotation to clockwise (M3) + SET_OUTPUT(SPINDLE_DIR_PIN); + dir_pin_set(); // Init rotation to clockwise (M3) #endif #if ENABLED(SPINDLE_LASER_USE_PWM) SET_PWM(SPINDLE_LASER_PWM_PIN); @@ -87,66 +90,155 @@ void SpindleLaser::init() { * * @param ocr Power value */ - void SpindleLaser::_set_ocr(const uint8_t ocr) { + void SpindleLaser::ocr_set(const uint8_t ocr) { #if ENABLED(HAL_CAN_SET_PWM_FREQ) && SPINDLE_LASER_FREQUENCY hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), TERN(MARLIN_DEV_MODE, frequency, SPINDLE_LASER_FREQUENCY)); #endif hal.set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); } - void SpindleLaser::set_ocr(const uint8_t ocr) { - WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Cutter ON - _set_ocr(ocr); - } +#endif // SPINDLE_LASER_USE_PWM + +/** + * Set state for pin spindle/laser + * @param enable true = on; false = off + */ +void SpindleLaser::ena_pin_set(const bool enable) { + WRITE(SPINDLE_LASER_ENA_PIN, enable ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); +} - void SpindleLaser::ocr_off() { - WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Cutter OFF - _set_ocr(0); +#if ENABLED(SPINDLE_CHANGE_DIR) + /** + * Set direction pin for spindle + */ + void SpindleLaser::dir_pin_set() { + // Forward (M3) HIGH when not inverted + const uint8_t dir_state = (spindle_dir == TERN(SPINDLE_INVERT_DIR, SpindleDirCCW, SpindleDirCW)) ? HIGH : LOW; + WRITE(SPINDLE_DIR_PIN, dir_state); } -#endif // SPINDLE_LASER_USE_PWM +#endif /** - * Apply power for laser/spindle - * - * Apply cutter power value for PWM, Servo, and on/off pin. + * Get a change event based on current and new state * - * @param opwr Power value. Range 0 to MAX. When 0 disable spindle/laser. + * @param opwr New power value + * @param odir New direction spindle + * @param oena_pin_on New ena_pin state */ -void SpindleLaser::apply_power(const uint8_t opwr) { - static uint8_t last_power_applied = 0; - if (opwr == last_power_applied) return; - last_power_applied = opwr; - power = opwr; - #if ENABLED(SPINDLE_LASER_USE_PWM) - if (cutter.unitPower == 0 && CUTTER_UNIT_IS(RPM)) { - ocr_off(); - isReady = false; - } - else if (ENABLED(CUTTER_POWER_RELATIVE) || enabled()) { - set_ocr(power); - isReady = true; - } - else { - ocr_off(); - isReady = false; - } - #elif ENABLED(SPINDLE_SERVO) - MOVE_SERVO(SPINDLE_SERVO_NR, power); - #else - WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); - isReady = true; +CutterState SpindleLaser::get_event(const uint8_t opwr, const SpindleDir odir, const bool oena_pin_on) { + // Setting PWM and ENA both off + if (opwr == 0 && !oena_pin_on) + return state == STAY_OFF ? STAY_OFF : TURN_OFF; + + // Setting PWM or ENA while OFF + if (state == STAY_OFF) + return TURN_ON; + + // Changing direction while already ON + if (odir != spindle_dir) + return STAY_ON_REV; + + return state; +} + +/** + * Change hardware state + */ +void SpindleLaser::_change_hw(const bool ena_pin_on) { + TERN_(SPINDLE_LASER_USE_PWM, ocr_set(ocr_power)); + + TERN(SPINDLE_SERVO, MOVE_SERVO(SPINDLE_SERVO_NR, ocr_power), ena_pin_set(ena_pin_on)); + + #if ENABLED(SPINDLE_LASER_USE_PWM) || DISABLED(SPINDLE_SERVO) + isReady = ena_pin_on; // This is a hack. isReady state and ena_pin_on are equivalent. #endif } +/** + * Set cutter ocr_power value for PWM, Servo, and on/off pin. + * + * @param opwr Power value. Range 0 to MAX. When 0 disable spindle/laser. + * @param odir Direction spindle (default SpindleDirSame) + * @param ena_pin_on Enable/disable ENA_PIN. Work only in separate mode PWM. + * If separate mode is disable - ENA_PIN is managed through opwr value + * if true - enable pin; false - disable pin (default true) + */ +void SpindleLaser::ocr_set_power(const uint8_t opwr, const SpindleDir odir/*=SpindleDirSame*/, const bool ena_pin_on/*=true*/) { + const SpindleDir dir_value = TERN(SPINDLE_CHANGE_DIR, (odir == SpindleDirSame) ? spindle_dir : odir, SpindleDirCW); + + const bool ena_pin_on_value = TERN(HAS_CUTTER_PWM_AND_ENA, ena_pin_on, opwr > 0); + + switch (get_event(opwr, dir_value, ena_pin_on_value)) { + // Already ON and staying ON + case STAY_ON: + state = STAY_ON; // Probably already the current state + if (opwr != ocr_power) { + ocr_power = opwr; + _change_hw(ena_pin_on_value); + } + break; + + case TURN_ON: + state = STAY_ON; + ocr_power = opwr; + spindle_dir = dir_value; + dir_pin_set(); + _change_hw(ena_pin_on_value); + power_delay(true); + break; + + case STAY_OFF: + state = STAY_OFF; // Probably already the current state + spindle_dir = dir_value; + break; + + case TURN_OFF: + state = STAY_OFF; + ocr_power = opwr; + spindle_dir = dir_value; + dir_pin_set(); + _change_hw(false); + power_delay(false); + break; + + case STAY_ON_REV: { + state = STAY_ON; + ocr_power = opwr; + spindle_dir = dir_value; + + #if ENABLED(SPINDLE_CHANGE_DIR_STOP) + // Stop Spindle and wait + const uint8_t curr_power = ocr_power; + ocr_power = 0; + _change_hw(false); + power_delay(false); + // Start spindle and wait + ocr_power = curr_power; + dir_pin_set(); + _change_hw(ena_pin_on_value); + power_delay(true); + #else + dir_pin_set(); + #endif + } break; + } + + UNUSED(ena_pin_on); +} + +/** + * Return value ocr_power + */ +uint8_t SpindleLaser::get_ocr_power(){ return ocr_power; } + #if ENABLED(SPINDLE_CHANGE_DIR) /** * Set the spindle direction and apply immediately - * Stop on direction change if SPINDLE_STOP_ON_DIR_CHANGE is enabled + * ! deprecate and need delete + * @param reverse If True is SpindleDirCCW, false is SpindleDirCW */ void SpindleLaser::set_reverse(const bool reverse) { - const bool dir_state = (reverse == SPINDLE_INVERT_DIR); // Forward (M3) HIGH when not inverted - if (TERN0(SPINDLE_STOP_ON_DIR_CHANGE, enabled()) && READ(SPINDLE_DIR_PIN) != dir_state) disable(); - WRITE(SPINDLE_DIR_PIN, dir_state); + ocr_set_power(ocr_power, reverse ? SpindleDirCCW : SpindleDirCW); } #endif diff --git a/Marlin/src/feature/spindle_laser.h b/Marlin/src/feature/spindle_laser.h index e948d2d37b73..ff2de410bf14 100644 --- a/Marlin/src/feature/spindle_laser.h +++ b/Marlin/src/feature/spindle_laser.h @@ -41,16 +41,32 @@ #define PCT_TO_PWM(X) ((X) * 255 / 100) #define PCT_TO_SERVO(X) ((X) * 180 / 100) +enum SpindleDir : uint8_t { SpindleDirSame, SpindleDirCW, SpindleDirCCW }; + +// Current ON/OFF state and transitions for get_event +enum CutterState : uint8_t { + STAY_OFF, + STAY_ON, + STAY_ON_REV, + TURN_ON, + TURN_OFF +}; + // #define _MAP(N,S1,S2,D1,D2) ((N)*_MAX((D2)-(D1),0)/_MAX((S2)-(S1),1)+(D1)) class SpindleLaser { +private: + static SpindleDir spindle_dir; // Spindle direction + static uint8_t ocr_power; // Value for PWM out + static CutterState state; // Current state + public: - static const inline uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); } + static constexpr uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); } // cpower = configured values (e.g., SPEED_POWER_MAX) // Convert configured power range to a percentage - static const inline uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { + static const uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) { constexpr cutter_cpower_t power_floor = TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0), power_range = SPEED_POWER_MAX - power_floor; return cpwr ? round(100.0f * (cpwr - power_floor) / power_range) : 0; @@ -58,7 +74,7 @@ class SpindleLaser { // Convert a cpower (e.g., SPEED_POWER_STARTUP) to unit power (upwr, upower), // which can be PWM, Percent, Servo angle, or RPM (rel/abs). - static const inline cutter_power_t cpwr_to_upwr(const cutter_cpower_t cpwr) { // STARTUP power to Unit power + static const cutter_power_t cpwr_to_upwr(const cutter_cpower_t cpwr) { // STARTUP power to Unit power const cutter_power_t upwr = ( #if ENABLED(SPINDLE_FEATURE) // Spindle configured values are in RPM @@ -91,7 +107,6 @@ class SpindleLaser { #endif static bool isReady; // Ready to apply power setting from the UI to OCR - static uint8_t power; #if ENABLED(MARLIN_DEV_MODE) static cutter_frequency_t frequency; // Set PWM frequency; range: 2K-50K @@ -100,35 +115,40 @@ class SpindleLaser { static cutter_power_t menuPower, // Power as set via LCD menu in PWM, Percentage or RPM unitPower; // Power as displayed status in PWM, Percentage or RPM - static void init(); - #if ENABLED(MARLIN_DEV_MODE) static void refresh_frequency() { hal.set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), frequency); } #endif - // Modifying this function should update everywhere - static bool enabled(const cutter_power_t opwr) { return opwr > 0; } - static bool enabled() { return enabled(power); } - - static void apply_power(const uint8_t inpow); +private: + static void ena_pin_set(const bool enable); + static void _change_hw(const bool ena_pin_on); + static CutterState get_event(const uint8_t opwr, const SpindleDir odir, const bool oena_pin_on); - FORCE_INLINE static void refresh() { apply_power(power); } - FORCE_INLINE static void set_power(const uint8_t upwr) { power = upwr; refresh(); } + #if ENABLED(SPINDLE_CHANGE_DIR) + static void dir_pin_set(); + #else + static void dir_pin_set() {} + #endif #if ENABLED(SPINDLE_LASER_USE_PWM) + static void ocr_set(const uint8_t ocr); + #endif - private: - - static void _set_ocr(const uint8_t ocr); +public: + static void init(); + static void ocr_set_power(const uint8_t opwr, const SpindleDir odir=SpindleDirSame, const bool ena_pin_on=true); + static uint8_t get_ocr_power(); - public: + /** + * Return state laser/spindle; true if enable. + */ + static bool enabled() { return state != CutterState::STAY_OFF; } - static void set_ocr(const uint8_t ocr); - static void ocr_set_power(const uint8_t ocr) { power = ocr; set_ocr(ocr); } - static void ocr_off(); + FORCE_INLINE static void refresh() {} + #if ENABLED(SPINDLE_LASER_USE_PWM) /** - * Update output for power->OCR translation + * Update output for upower->OCR translation */ static uint8_t upower_to_ocr(const cutter_power_t upwr) { return uint8_t( @@ -187,20 +207,21 @@ class SpindleLaser { /** * Enable/Disable spindle/laser * @param enable true = enable; false = disable + * @param odir Direction spindle (default SpindleDirSame) */ - static void set_enabled(const bool enable) { - uint8_t value = 0; + static void set_enabled(const bool enable, SpindleDir odir=SpindleDirSame) { + uint8_t opwr = 0; if (enable) { #if ENABLED(SPINDLE_LASER_USE_PWM) - if (power) - value = power; + if (ocr_power) + opwr = ocr_power; else if (unitPower) - value = upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)); + opwr = upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)); #else - value = 255; + opwr = 255; #endif } - set_power(value); + ocr_set_power(opwr, odir, enable); } static void disable() { isReady = false; set_enabled(false); } @@ -247,20 +268,20 @@ class SpindleLaser { isReady = true; const uint8_t ocr = TERN(SPINDLE_LASER_USE_PWM, upower_to_ocr(menuPower), 255); if (menuPower) - power = ocr; + ocr_power = ocr; else menuPower = cpwr_to_upwr(SPEED_POWER_STARTUP); unitPower = menuPower; set_reverse(reverse); set_enabled(true); } - FORCE_INLINE static void enable_forward() { enable_with_dir(false); } - FORCE_INLINE static void enable_reverse() { enable_with_dir(true); } + FORCE_INLINE static void enable_forward() { enable_with_dir(false); } + FORCE_INLINE static void enable_reverse() { enable_with_dir(true); } FORCE_INLINE static void enable_same_dir() { enable_with_dir(is_reverse()); } #if ENABLED(SPINDLE_LASER_USE_PWM) static void update_from_mpower() { - if (isReady) power = upower_to_ocr(menuPower); + if (isReady) ocr_power = upower_to_ocr(menuPower); unitPower = menuPower; } #endif @@ -329,10 +350,9 @@ class SpindleLaser { static void inline_direction(const bool) { /* never */ } #if ENABLED(SPINDLE_LASER_USE_PWM) - static void inline_ocr_power(const uint8_t ocrpwr) { - isReady = ocrpwr > 0; - planner.laser_inline.status.isEnabled = ocrpwr > 0; - planner.laser_inline.power = ocrpwr; + static void inline_ocr_power(const uint8_t opwr) { + planner.laser_inline.status.isEnabled = isReady = opwr > 0; + planner.laser_inline.power = opwr; } #endif #endif // LASER_POWER_INLINE diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index cdb37a1207ad..169c53c93c6c 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -80,7 +80,7 @@ void GcodeSuite::M3_M4(const bool is_M4) { } else cutter.unitPower = cutter.cpwr_to_upwr(SPEED_POWER_STARTUP); - return cutter.unitPower; + return cutter.upower_to_ocr(cutter.unitPower); }; #endif @@ -94,7 +94,7 @@ void GcodeSuite::M3_M4(const bool is_M4) { cutter.inline_ocr_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t) } else - cutter.inline_power(cutter.upower_to_ocr(get_s_power())); + cutter.inline_power(get_s_power()); #else cutter.set_inline_enabled(true); #endif @@ -105,19 +105,20 @@ void GcodeSuite::M3_M4(const bool is_M4) { #endif planner.synchronize(); // Wait for previous movement commands (G0/G0/G2/G3) to complete before changing power - cutter.set_reverse(is_M4); + + const SpindleDir dir_value = is_M4 ? SpindleDirCCW : SpindleDirCW; #if ENABLED(SPINDLE_LASER_USE_PWM) if (parser.seenval('O')) { cutter.unitPower = cutter.power_to_range(parser.value_byte(), 0); - cutter.ocr_set_power(cutter.unitPower); // The OCR is a value from 0 to 255 (uint8_t) + cutter.ocr_set_power(cutter.unitPower, dir_value); // The OCR is a value from 0 to 255 (uint8_t) } else - cutter.set_power(cutter.upower_to_ocr(get_s_power())); + cutter.ocr_set_power(get_s_power(), dir_value); #elif ENABLED(SPINDLE_SERVO) - cutter.set_power(get_s_power()); + cutter.ocr_set_power(get_s_power()); #else - cutter.set_enabled(true); + cutter.set_enabled(true, dir_value); #endif cutter.menuPower = cutter.unitPower; } diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 5b70f58cdc60..4d36eedd95ef 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -688,6 +688,9 @@ #define _CUTTER_POWER_RPM 3 #define _CUTTER_POWER(V) _CAT(_CUTTER_POWER_, V) #define CUTTER_UNIT_IS(V) (_CUTTER_POWER(CUTTER_POWER_UNIT) == _CUTTER_POWER(V)) + #if ENABLED(SPINDLE_LASER_USE_PWM) && PINS_EXIST(SPINDLE_LASER_ENA, SPINDLE_LASER_PWM) + #define HAS_CUTTER_PWM_AND_ENA 1 + #endif #endif #if !defined(__AVR__) || !defined(USBCON) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index e1de8b28b06c..55a6c570af8b 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -730,7 +730,7 @@ #endif // Software SPI - enable if MISO/SCK are defined. - #if PIN_EXISTS(TEMP_0_MISO) && PIN_EXISTS(TEMP_0_SCK) && DISABLED(TEMP_SENSOR_0_FORCE_HW_SPI) + #if PINS_EXIST(TEMP_0_MISO, TEMP_0_SCK) && DISABLED(TEMP_SENSOR_0_FORCE_HW_SPI) #if TEMP_SENSOR_0_IS_MAX31865 && !PIN_EXISTS(TEMP_0_MOSI) #error "TEMP_SENSOR_0 MAX31865 requires TEMP_0_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_0_FORCE_HW_SPI." #else @@ -799,7 +799,7 @@ #endif // Software SPI - enable if MISO/SCK are defined. - #if PIN_EXISTS(TEMP_1_MISO) && PIN_EXISTS(TEMP_1_SCK) && DISABLED(TEMP_SENSOR_1_FORCE_HW_SPI) + #if PINS_EXIST(TEMP_1_MISO, TEMP_1_SCK) && DISABLED(TEMP_SENSOR_1_FORCE_HW_SPI) #if TEMP_SENSOR_1_IS_MAX31865 && !PIN_EXISTS(TEMP_1_MOSI) #error "TEMP_SENSOR_1 MAX31865 requires TEMP_1_MOSI_PIN defined for Software SPI. To use Hardware SPI instead, undefine MISO/SCK or enable TEMP_SENSOR_1_FORCE_HW_SPI." #else diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 0745397f4f99..0ce7d5e1349b 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -860,7 +860,7 @@ void MarlinUI::draw_status_screen() { #endif // - // Line 6..8 Temperatures, FAN for printer or Cooler, Flowmetter, Ampermeter, Cutter for laser/spindle + // Line 6..8 Temperatures, FAN for printer or Cooler, Flowmetter, Ampermeter, Cutter for spindle/laser // #if HAS_HOTEND diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 6dc2c9e084dd..94f352e33318 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2201,7 +2201,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, TERN_(MIXING_EXTRUDER, mixer.populate_block(block->b_color)); - TERN_(HAS_CUTTER, block->cutter_power = cutter.power); + TERN_(HAS_CUTTER, block->cutter_ocr_power = cutter.get_ocr_power()); #if HAS_FAN FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index afcc5a1566cb..4ec3e45382ea 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -228,7 +228,7 @@ typedef struct block_t { #endif #if HAS_CUTTER - cutter_power_t cutter_power; // Power level for Spindle, Laser, etc. + cutter_power_t cutter_ocr_power; // Power level for Spindle, Laser, etc. #endif #if HAS_FAN diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 1140a6eb1e38..ee19f118c289 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2197,7 +2197,8 @@ uint32_t Stepper::block_phase_isr() { // For non-inline cutter, grossly apply power #if ENABLED(LASER_FEATURE) && DISABLED(LASER_POWER_INLINE) - cutter.apply_power(current_block->cutter_power); + if (cutter.enabled()) + cutter.ocr_set_power(current_block->cutter_ocr_power); #endif #if ENABLED(POWER_LOSS_RECOVERY) diff --git a/Marlin/src/pins/ramps/pins_TT_OSCAR.h b/Marlin/src/pins/ramps/pins_TT_OSCAR.h index 9d844ebcdcba..00d6621fdae6 100644 --- a/Marlin/src/pins/ramps/pins_TT_OSCAR.h +++ b/Marlin/src/pins/ramps/pins_TT_OSCAR.h @@ -241,7 +241,7 @@ // // Case Light // -#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN) +#if ENABLED(CASE_LIGHT_ENABLE) && !ANY_PIN(CASE_LIGHT, SPINDLE_LASER_ENA) #if !NUM_SERVOS // Prefer the servo connector #define CASE_LIGHT_PIN 6 // Hardware PWM #elif HAS_FREE_AUX2_PINS // Try to use AUX 2 diff --git a/buildroot/tests/mega1280 b/buildroot/tests/mega1280 index a7f25953acd0..b463ba6b7994 100755 --- a/buildroot/tests/mega1280 +++ b/buildroot/tests/mega1280 @@ -13,19 +13,34 @@ set -e #exec_test $1 $2 "Default Configuration" "$3" # -# Test MESH_BED_LEVELING feature, with LCD +# Test MESH_BED_LEVELING, Closed-loop, Power Monitor, Ultimaker LCD # restore_configs opt_set LCD_LANGUAGE an \ POWER_MONITOR_CURRENT_PIN 14 POWER_MONITOR_VOLTAGE_PIN 15 \ CLOSED_LOOP_ENABLE_PIN 44 CLOSED_LOOP_MOVE_COMPLETE_PIN 45 -opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING \ +opt_enable ULTIMAKERCONTROLLER \ EEPROM_SETTINGS EEPROM_BOOT_SILENT EEPROM_AUTO_INIT \ SENSORLESS_BACKOFF_MM HOMING_BACKOFF_POST_MM HOME_Y_BEFORE_X CODEPENDENT_XY_HOMING \ - MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \ - G26_MESH_VALIDATION MESH_EDIT_MENU GCODE_QUOTED_STRINGS \ + MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN LCD_BED_LEVELING MESH_EDIT_MENU \ + G26_MESH_VALIDATION GCODE_QUOTED_STRINGS \ EXTERNAL_CLOSED_LOOP_CONTROLLER POWER_MONITOR_CURRENT POWER_MONITOR_VOLTAGE -exec_test $1 $2 "Spindle, MESH_BED_LEVELING, closed loop, Power Monitor, and LCD" "$3" +exec_test $1 $2 "MESH_BED_LEVELING, Closed-loop, Power Monitor, Ultimaker LCD" "$3" + +# +# Test SPINDLE_FEATURE with zero extruders +# +restore_configs +opt_set MOTHERBOARD BOARD_RIGIDBOARD EXTRUDERS 0 LCD_LANGUAGE hu \ + AXIS_RELATIVE_MODES '{ true, true, true }' \ + DEFAULT_AXIS_STEPS_PER_UNIT '{ 80, 80, 400 }' \ + DEFAULT_MAX_FEEDRATE '{ 300, 300, 5 }' \ + DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ + MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' +opt_enable SPINDLE_FEATURE SPINDLE_CHANGE_DIR RIGIDBOT_PANEL EEPROM_SETTINGS \ + HOMING_BACKOFF_POST_MM HOME_Y_BEFORE_X HOME_Y_BEFORE_X +opt_disable EEPROM_BOOT_SILENT EEPROM_AUTO_INIT FASTER_GCODE_PARSER +exec_test $1 $2 "Spindle, Zero Extruders, Rigidbot Panel" "$3" # # ...and without PWM