Marlin icon indicating copy to clipboard operation
Marlin copied to clipboard

[BUG] Spindle does not wait on power up/down as power_delay() is never called

Open Switchleg1 opened this issue 1 year ago • 2 comments

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

M3/M5 does not honor delays set in configuration:

#define SPINDLE_LASER_POWERUP_DELAY 5000 // (ms) Delay to allow the spindle/laser to come up to speed/power #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // (ms) Delay to allow the spindle to stop

Bug Timeline

Not sure, this is my first marlin build

Expected behavior

M3/M5 should wait for the spindle/laser to power up/down before commencing the next move.

Actual behavior

Machine continues without delay

Steps to Reproduce

current "spindle_laser.h":

static void set_enabled(bool enable) { switch (cutter_mode) { case CUTTER_MODE_STANDARD: apply_power(enable ? TERN(SPINDLE_LASER_USE_PWM, (power ?: (unitPower ? upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)) : 0)), 255) : 0); break; case CUTTER_MODE_CONTINUOUS: case CUTTER_MODE_DYNAMIC: TERN_(LASER_FEATURE, set_inline_enabled(enable)); break; case CUTTER_MODE_ERROR: // Error mode, no enable and kill power. enable = false; apply_power(0); } #if PIN_EXISTS(SPINDLE_LASER_ENA) WRITE(SPINDLE_LASER_ENA_PIN, enable ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); #endif

enable_state = enable;

}

VS:

static void set_enabled(bool enable) { switch (cutter_mode) { case CUTTER_MODE_STANDARD: apply_power(enable ? TERN(SPINDLE_LASER_USE_PWM, (power ?: (unitPower ? upower_to_ocr(cpwr_to_upwr(SPEED_POWER_STARTUP)) : 0)), 255) : 0); break; case CUTTER_MODE_CONTINUOUS: case CUTTER_MODE_DYNAMIC: TERN_(LASER_FEATURE, set_inline_enabled(enable)); break; case CUTTER_MODE_ERROR: // Error mode, no enable and kill power. enable = false; apply_power(0); } #if PIN_EXISTS(SPINDLE_LASER_ENA) WRITE(SPINDLE_LASER_ENA_PIN, enable ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE); #endif

if(enable_state != enable) {
  power_delay(enable);
}

enable_state = enable;

}

please add: if(enable_state != enable) { power_delay(enable); }

to set_enabled()

Version of Marlin Firmware

2.1.2.5

Printer model

DIY

Electronics

mega2560

LCD/Controller

na

Other add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

Repetier Host

Don't forget to include

  • [X] A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

Marlin.zip

Switchleg1 avatar Jan 14 '25 03:01 Switchleg1

When using uv, please stick to the feature set provided by PDM, rather than uv. Otherwise use uv directly. Also the uv integration is experimental.

frostming avatar Dec 06 '24 03:12 frostming

@frostming I don't think I am using any feature outside of pdm, am I ?

ksquarekumar avatar Dec 10 '24 19:12 ksquarekumar

Do you have a repo for reproducing?

frostming avatar Dec 11 '24 03:12 frostming

@frostming sadly, it's private repo, but I you have specifics I would be more than happy to reproduce them.

ksquarekumar avatar Dec 16 '24 13:12 ksquarekumar