MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.34k stars 19.25k forks source link

[FR] Safer travel limits #27426

Open Caraffa-git opened 2 months ago

Caraffa-git commented 2 months ago

Is your feature request related to a problem? Please describe.

No response

Are you looking for hardware support?

It would be very useful for CNCs but nothing specific.

Describe the feature you want

I would want to change how current travel limits work. Right now they are referring to max positions:

// The size of the printable area
#define X_BED_SIZE 184
#define Y_BED_SIZE 405

// Travel limits (linear=mm, rotational=°) after homing, corresponding to endstop positions.
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 54

Now lets imagine that I want to cut small element that takes only a fragment in the middle of my bed. Theoretically I could measure where exactly it is and move it accordingly in CAD software that generates gcode, but it's impractical and prone to errors/mistakes.

Ideal scenerio would be moving the CNC to the part origin, then using M428 to set home offsets and running the gcode. In current state it would work perfectly fine but there is a possibility that CNC would crash into itself because travel limits are constraining only relative position, not including size of the machine in any way.

I would suggest changing config to something like this:

// The size of the physical axis dimensions / bed size
#define X_SIZE 184
#define Y_SIZE 405
#define Z_SIZE 54
#define I_SIZE ...

// Printer head position at the end stop / resting position 
// X_MIN_POS + X_SIZE = X_MAX_POS 
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define I_MIN_POS ...

Marlin would have to check if "printer head" is within the axis limits on the runtime. Travel limits would replaced with just MIN_POS definitions to leave flexibility if someones endstop is causing printhead to move outside printable area.

Unless someone else have better idea.

Additional context

No response

Caraffa-git commented 2 months ago

I have found something like G54-G59.3 - Workspace Coordinate System which basically solves my problem but this feature should be better described in the documentation. Anyway, I think that this safety mechanism is implemented in the wrong place and It should be done within travel limits config.