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

[BUG] movement too slow with G2/G3 #72

Open
1 task done
DerAndere1 opened this issue Apr 21, 2024 · 118 comments
Open
1 task done

[BUG] movement too slow with G2/G3 #72

DerAndere1 opened this issue Apr 21, 2024 · 118 comments

Comments

@DerAndere1
Copy link
Owner

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

No, but I will test it now!

Bug Description

WITH SYNTAX G2/G3 X Y Z I J F THE AXIS DO MOVE BUT VERY SLOWLY

This potential bug was first reported by @printercnc here: #55 (comment)

Bug Timeline

unknown

Expected behavior

Feedrate should be accoring to parameter F

Actual behavior

Feedrate too slow

Steps to Reproduce

TODO

Version of Marlin Firmware

unknown

Printer model

custom

Electronics

unknown

Add-ons

unknown

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

TODO

@printercnc
Copy link

i tried with latest marlin bugfix 2.1.x, it works great. Your tcpc branch has many errors, in addition to the g2/g3 migration error, there is also the problem of declaring spindle in the adv.h file. I have downloaded the latest version on your tcpc branch, reconfigured it, I will test it in the next few days to give you feedback. i use chip mega 2560 board ramps 1.4 for 5 axis machine, has limit switches for all 5 axis.

@DerAndere1
Copy link
Owner Author

What do you mean with tcpc branch? Do you use my Marlin2ForPipetBot branch ? With that branch I can enable SPINDLE_FEATURE without problems. Please provide your configs (Configuration.h, Configuration.adv) and the exact error message. You can attach files by putting them in a .zip archive. Then add a new comment below. While editing the comment, click on the button "Paste, drop or click to add file" below the comment.

@printercnc
Copy link

yes, I use the Marlin2ForPipetBot branch, which is the branch with tcpc kinematics
Screenshot 2024-04-23 113629

@printercnc
Copy link

These are the 3 files I have edited in there, In the pin ramps file, I edited the endstop part to add home points for axis a and c
FILE_CONFIG.zip

@printercnc
Copy link

printercnc commented Apr 23, 2024

two weeks ago, did you edit this issue, I don't know if it has anything to do with this g2/g3 x y z i j f move syntax (eg G3 F1800. I-54.51 J212.302 X93.326 Y-198.328) . I downloaded and reconfigured but haven't had time to test the motion on my cnc router.
Screenshot 2024-04-23 120221

@DerAndere1
Copy link
Owner Author

The change in commit d632ff3 was an attemt to fix an issue with erratic, fast moves when a G1 command involving only linear axes was followed by a G1 command without F parameter that involved rotational axes.

The compiltion error when SPINDLE_FEATURE and ABORT_ON_SOFTWARE_ENDSTOP were enabled is now fixed in branch Marlin2ForPipetBot with commit 00e49de.

@printercnc
Copy link

I downloaded your latest fix, compiled it, no more errors appear at the moment. I will test it on my cnc router.
I plan to make a handle through the Joystick port
on board ramps. Do you think it is necessary to add a separate handle to the firmware?

@printercnc
Copy link

PI3_chess-king.zip
This is the gcode sample I used to test the g2/g3 command. on the marlin_bgfix2.1.x branch works perfectly fine. On the Marlin2ForPipetBot tcpc branch they move but very slowly. I will send you the video as soon as possible.

@printercnc
Copy link

video.zip
When the axes move, the g0/g1 commands move very smoothly. When the g3 command comes to interpolate the arc, the two x y axes move slowly. I like your firmware because the axis movements are very smooth compared to the marlin_bugfix firmware.

@printercnc
Copy link

Am I annoying you by asking too many questions? I discovered an error that I cannot use g38 in the adv.h file if I use tcpc kinematics. I love your firmware, so I want to apply it to multi-axis CNC machines, or robotic arms. i know the marlin platform doesn't prioritize cnc work. If I bother you, then please try to fix the g2/g3 error.

@DerAndere1
Copy link
Owner Author

I appreciate any feedback. Please report as much issues as you can. I have a lack of time and I am not a "hardware guy", so I depend on testers and discussions like this to improve support for mills in Marlin. I will look into these bugs one at a time, whenever I have time to spare.

@DerAndere1
Copy link
Owner Author

DerAndere1 commented Apr 24, 2024

I cherry-picked the two most recent change-sets affecting G2/G3 from MarlinFirmware/Marlin. One of the commits was called "Fix G2/G3 error in limit speed", so that might already fix the issue with G2/G3.

Please test the latest Marlin2ForPipetBot branch from today

Enble G38 with a non-cartesian machine at your own risk. It was never tested. Make sure that the rotational axes are in neutral (zero) position before you send G38: Probing currently can only work if your tool and probe is oriented in Z direction and when the table / printbed is oriented in the XY plane. Switch to tool 0 for probing. HOTEND_OFFSET for tool 0 must be 0.

To compile with G38_PROBE_TARGET, remove the following 2 lines from file Marlin/src/inc/SanityCheck.h before compilation:

https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/Marlin/src/inc/SanityCheck.h#L2518-L2519

  #elif !IS_CARTESIAN
    #error "G38_PROBE_TARGET requires a Cartesian machine."

@printercnc
Copy link

I just recompiled, and am excited to test this g2/g3 fix. We'll come back to this g38 topic once we're done with the g2/g3 fix. I will need some time to rebuild my multi-axis cnc router, with tests using high precision measuring tools. will then respond to you.

@printercnc
Copy link

1
2
The error is still not fixed, I took two pictures
Web comparisons and latest downloads. I'm confused and not sure if the download has to be updated.

@printercnc
Copy link

Previously discussed topic, I don't know if it can help?
MarlinFirmware#17348

@printercnc
Copy link

what a mess, marlin bugfix 2.1.x branch cannot connect to cura software like your branch.
g2/g3 motion video of marlin_bugfix2.1 branch
Uploading 1.zip…

@printercnc
Copy link

video when testing code with Marlin-Marlin2ForPipetBot branch, the response from the software is too strange
Uploading 2.zip…

@DerAndere1
Copy link
Owner Author

I can confirm that G2 is totaly broken in Marlin2ForPipetBot. On my machine, trajectories and feedrate are wrong, even when compiling for a cartesian machine (no special kinematics defined). It was working at some point,. Looks like some wrongly zero-initilized variable, but I cannot find it. The fr_mm_s varibale in the body of the function Planner::_populate_block shows correct values when executing G2 commands, so that is not the issue. I think the easiest and best way for me to fix this is to rebase onto current bugfix-2.1.x. Initially the new branch I plan to create will not support G49 or G43, it will allways be in TCPC mode. I have already rebased kinematics, quick_home and tool change. TOOLS and G10 is missing. It will take some weeks to have something ready for testing. Sorry for the inconvenience

@printercnc
Copy link

I feel a bit regretful if I have to go back to the beginning, the official branch on the marlin homepage, or the bugfix branch makes me not very confident about the part that creates pulses to make the axes move, the sound of the moving motors is not as smooth as the Marlin2ForPipetBot branch. your.
I'm not sure what effect tcpc or rtcp kinematics have, although on the 5-axis cnc machines I use they all have rtcp. The cam software I use all has the perfect gcode export feature. If we talk about compensation for misalignment on the spindle joints, adjusting the mechanical mechanism for accuracy will be much easier and better. With a controler for amateurs, I think what is needed on a device is the probe to find the xyz zero coordinate point. We don't always have to process with 5 axes, most of the time it will be 3 axes. Through that, as I mentioned the g38 issue in the adv.h file the other day, it is a perfect conversion feature for CNC 3D printing or CNC milling jobs. I'm on holiday, I brought a small test kit, eagerly waiting for you to fix the error to test, it's a pity to have to wait so long, haha

@HendrikJan-5D
Copy link

HendrikJan-5D commented May 4, 2024

DerAndere1.
Did you see my message last week on GitLab ?

@printercnc
Copy link

I am building an additional handle for a cnc machine by using an Arduino nano to generate rotation pulses for the x y z axes. communicates with the motherboard via the RX TX interface. Everything on the handle is fine, but connecting to the motherboard is not possible. I don't know if the mega 2560 chip allows multiple PORT RX TX ports.
handle_video.zip

@printercnc
Copy link

printercnc commented May 7, 2024

I have completed the handle job version from a free source code, the problem is that I am testing the rx tx communication with the MKS GEN L board, the firmware allows using additional port 2. However, the central controller My heart is building on a multi axis cnc router which is a mega 2560 kit and ramps. I haven't figured out how to solve this problem yet. haha
test.zip

@printercnc
Copy link

printercnc commented May 7, 2024

I am trying to declare additional port 2 for board ramps, leaving two pins 16 17 for rx tx communication blank. Committing from marlin 2.x will allow the use of two ports, which I think is still not perfect.

Screenshot 2024-05-07 185953

@HendrikJan-5D
Copy link

a 2560 motherboard is an 8 bit version
i think you need to go to a 32 bit version for 2 usb connections.
See https://bigtree-tech.com/

@printercnc
Copy link

I have an MKS GEN L board using a 32 bit mega2560au chip, maybe I will test it, that is a temporary solution. with a mega 2560 8bit development kit that also has 3 ports for rx tx communication. pin 16 pin 17 is used for LCD control. Pin 18 pin 19 is used for z axis endstop. In addition, there are empty pins for i2c and spi communication. When I use the i2c pins to connect to the lcd screen, there will be free port rx tx pin 16 pin 17. Therefore, it will have to be used for two SERIAL_PORT, here it is probably an error in the compiler functions.
106ef736-5390-11e6-865d-573262168e94

@HendrikJan-5D
Copy link

Looking at your compiler error list;
((#error “serial port 2 pin D16 and/or D17 conflicts with another pin on the board ))
Seems you have a problem in the pins file of your board.
D16 and D17 are in use there for another function
You have to clear and modify those first to use them as serial ports.

@printercnc
Copy link

That's right, however I can't figure out which lines are talking about the current function of those pins. 8bit chips cannot expand SERIAL_PORT without extensive firmware intervention. After carefully comparing ramps and MKS GEN L, I realized that my handle jod does not need the SERIAL_PORT extension. The above two types are the same, MKS GEN L is just RAMPS expanded with IO. I just need to check where the rx tx pin on the AUX1 of the MKS GEN L is connected to the MEGA 2560 chip. After that, just connect to RAMPS and you will be able to use it.
tải xuống

@printercnc
Copy link

I have connected handle job to board meg2560 + ramps via rx tx port. firmware marlin bugfix 2.1.x
I will use this to test DerAndere1's tcpc branch debugging
.zip

@printercnc
Copy link

DerAndere1
I discovered another error on your tcpc branch, the bugfix branch allows step to run at G0 max speed of 4500 mm/min, your branch is only 1000mm/min.
Board MKS GEN L 1.0
AXIS_STEPS_PER_UNIT 160
DRIVE A4988

@printercnc
Copy link

DerAndere1
Have you updated the fix yet?

@printercnc
Copy link

yesterday i went back to compiling on mega 2560 chip with ramps 1.4 board and MKS_GEN_L. the two standards i have used for testing to ensure that the tests are less prone to errors due to faulty chip boards. i found an error where the y and z axes were swapped, at first i thought it was because i tested on the stm32f407vet black board test kit which is a faulty board so this problem occurred. can you check this problem again? the g2/g3 - g0 movements were too smooth beyond my expectations.

@DerAndere1
Copy link
Owner Author

DerAndere1 commented Aug 30, 2024

  • verify that the motor for moving the tool-head from front to back is connected to the second socket on the motherboard (labeled "Y")
  • verify that the motor for moving the tool-head up and down is conected to the third motor socket on the motherboard (labeled "Z").
  • Please test the following changes in Configuration.h:
#define INVERT_Y_DIR false
#define INVERT_Z_DIR false

change that to:

#define INVERT_Y_DIR true
#define INVERT_Z_DIR true

and maybe also test

#define Y_HOME_DIR -1
#define Z_HOME_DIR -1

change that to this:

#define Y_HOME_DIR 1
#define Z_HOME_DIR 1

If that did not help, please send a copy of the pins_MKS_GEN_L.h file from your Marlin firmware as a .zip file

@printercnc
Copy link

maybe you don't understand my description. it's not that the direction of movement is wrong, but the control signals for the two axes Y and Z have been changed to each other. of course I didn't change anything on the pin configuration in the RAMPS.H pin file.

Screenshot 2024-08-23 133741

@DerAndere1
Copy link
Owner Author

DerAndere1 commented Sep 2, 2024

Disconnect the Stepper Motors, enable PINS_DEBUGGING and use M43 T I to toggle the Y_STEP and Z_STEP Pins. Measure the voltage between those pins and GND. See if the desired Pins get toggled

@DerAndere1
Copy link
Owner Author

For RAMPS V1.4, M43 T I P60 should toggle the Y_STEP Pin , M43 T I P46 should toggle the Z_STEP Pin. If you could not fix the problem, you can send me the Output of a plain M43 command (send just M43 without Parameters)

@printercnc
Copy link

hello
i'm back after a while of computer running out of memory.
now i have time to continue testing.
m43.txt
This is the information file returned after the m43 command

@DerAndere1
Copy link
Owner Author

DerAndere1 commented Oct 11, 2024

M43 output looks as expected.
If M43 T P46 or M43 T I P46 toggles one of the 5 pins with the silk screen label "Z" on the RAMPS, you have to swap cables connecting the RAMPS and the Y/Z motors.

If M43 T P46 or M43 T I P46 toggles one of the 5 pins with the silk screen label "Y" on the RAMPS, you have a faulty RAMPS. In this case, change pins_RAMPS.h:

#define Y_STEP_PIN                            60
#define Y_DIR_PIN                             61
#define Y_ENABLE_PIN                          56  // (A2)
#ifndef Y_CS_PIN
  #define Y_CS_PIN                       AUX3_02
#endif

#ifndef Z_STEP_PIN
  #define Z_STEP_PIN                          46
#endif
#ifndef Z_DIR_PIN
  #define Z_DIR_PIN                           48
#endif
#ifndef Z_ENABLE_PIN
  #define Z_ENABLE_PIN                        62
#endif
#ifndef Z_CS_PIN
  #define Z_CS_PIN                       AUX2_06
#endif

change it to the following:

#define Y_STEP_PIN                            46
#define Y_DIR_PIN                             48
#define Y_ENABLE_PIN                          62
#ifndef Y_CS_PIN
  #define Y_CS_PIN                       AUX2_06
#endif

#ifndef Z_STEP_PIN
  #define Z_STEP_PIN                          60
#endif
#ifndef Z_DIR_PIN
  #define Z_DIR_PIN                           61
#endif
#ifndef Z_ENABLE_PIN
  #define Z_ENABLE_PIN                        56  // (A2)
#endif
#ifndef Z_CS_PIN
  #define Z_CS_PIN                      AUX3_02
#endif

@printercnc
Copy link

There will not be any ramps errors or any other board errors. I have carefully checked with the firmware on the official marlin branch, they work correctly with the pinout

@DerAndere1
Copy link
Owner Author

interesting. It must be a specific bug related to RAMPS or the atmega2560 environment that I am unable to fix because I have no RAMPS and I cannot reproduce the described behaviour on other boards. In any case, changing file pins_RAMPS.h as advised in my previous comment should be a workaround.

@printercnc
Copy link

testing on black stm32f407vt board also has this error, i will find some boards from other brands to test. i am just afraid that it is a serious error in the future if the firmware is tested more in real life.

@DerAndere1
Copy link
Owner Author

DerAndere1 commented Oct 11, 2024

Do I understand correctly that M43 T P46 or M43 T I P46 toggles one of the 4 pins with the silk screen label "Y" on your RAMPS? You can test it by attaching a LED + matching resistor in series between the Y_STEP pin and GND

@printercnc
Copy link

do you have email? i still have a Marlin2ForPipetBot tested on 4/20/2024, i just reloaded the old version and it works fine. i will send you two old versions and the current version. the old version before g2/g3 debugging still works fine.

@DerAndere1
Copy link
Owner Author

You can compress them into a .zip file and upload them here, But I already went through the changes and could find nothing that would impact mappings of axes to pins. In the mean time, I updated the Marlin2ForPipetBot branch and rebased it onto current MarlinFirmware/Marlin to include improvements to G28 and G30. When you use the current Marlin2ForPipetBot branch and enable PENTA_AXIS_TRT, it now has all the improvements from the penta_axis_kinematics branch plus support for G10, G49, G43 to handle tool offsets like LinuxCNC. It now also supports G43.4 / G49 to be able to enable/disable tool centerpoint control at runtime. On my machine it works as expected.

@DerAndere1
Copy link
Owner Author

Dont forget to send M502 followed by M500 after flashing Marlin

@printercnc
Copy link

the whole thing is too big i cant post here, maybe i will download your latest version, be patient with small modifications and see how it goes. i have not tried compiling with IDE, currently using visual studio code not sure if the compiler causes errors.

@printercnc
Copy link

everything new is here right now?
https://github.com/DerAndere1/Marlin

@DerAndere1
Copy link
Owner Author

Yes, the new Marlin2ForPipetBot branch is the default branch and thus what is displayed on the main page at https://github.com/DerAndere1/Marlin . If you want to make sure, use the branch dropdown menu and select the desired branch (Marlin2ForPipetbot).
The previous version of Marlin2ForPipetBot is now available at this branch: https://github.com/DerAndere1/Marlin/tree/Marlin2ForPipetBot_v2120

Compilation using Visual studio code with the platformIO extension should work fine. Using the PlatformIO-IDE extension for Visual Studio Code will yield the same results. Other IDEs are not recommended.

@printercnc
Copy link

I downloaded the latest version, compiled and everything seems to be fine, now just to assemble the mechanical part and run the tests. maybe the re-download and compiling completely helped me find the error that my previous tests didn't notice. maybe this warning line is causing the error ( platformio run --silent -e mega2560
Marlin\src\gcode\config\M200-M205.cpp:277:4: warning: #warning "Use 'M205 D' for Minimum Segment Time." [-Wcpp]
#warning "Use 'M205 D' for Minimum Segment Time." )
error when enabling this feature //#define SPINDLE_FEATURE

@DerAndere1
Copy link
Owner Author

error when enabling this feature //#define SPINDLE_FEATURE

I just pushed a commit to the Marlin2ForPipetBot branch that fixes compilation with SPINDLE_FEATURE.

Happy to hear that the problem with the swapped axes is fixed now on your end

@DerAndere1
Copy link
Owner Author

Spindle_Feature was reworked to support lasers, spindles and extruders on the same machine. Please report If spindle - related functions do not work as expected.

@printercnc
Copy link

This is the error reported.

Marlin\src\module\motion.cpp: In function 'bool line_to_destination_kinematic()':
Marlin\src\module\motion.cpp:1948:11: error: 'cutter' was not declared in this scope
cutter.kill();
cutter.kill(); )``

@DerAndere1
Copy link
Owner Author

thanks for testing. that error is now also fixed. I never tested with ABORT_ON_SOFTWARE_ENDSTOP disabled before. with multi axis machines I feel it is much safer to have ABORT_ON_SOFTWARE_ENDSTOP enabled. With that feature you can send M211 S1 H1 in the start G-code. Then the machine will be put in error mode (motion and spindle stops) when trying to move beyond software endstops.

@printercnc
Copy link

I have never used that feature either, because on industrial CNC machines, it is strictly forbidden to run close to the limits. They are strictly managed on the CAM software, collision checking during the code generation process is also checked. I often use mechanical limits to cut off the direct power source if there is a collision. On a side note, what 5-axis 3D printing software are you currently using? I am testing a small software running on the Phthon platform, never having used Phthon before makes it difficult for me to install.

@printercnc
Copy link

Can't these two be on at the same time?

#define SPINDLE_FEATURE
#define LASER_FEATURE

This is a warning when both are enabled.

Marlin\src\lcd\menu\menu_spindle_laser.cpp: In function 'void menu_spindle_laser()':
Marlin\src\lcd\menu\menu_spindle_laser.cpp:79:85: error: 'LASER_TEST_PULSE_MIN' was not declared in this scope
       EDIT_ITEM_FAST(CUTTER_MENU_PULSE_TYPE, MSG_LASER_PULSE_MS, &cutter.testPulse, LASER_TEST_PULSE_MIN, LASER_TEST_PULSE_MAX);
 Marlin\src\lcd\menu\menu_spindle_laser.cpp:79:107: error: 'LASER_TEST_PULSE_MAX' was not declared in this scope
       EDIT_ITEM_FAST(CUTTER_MENU_PULSE_TYPE, MSG_LASER_PULSE_MS, &cutter.testPulse, LASER_TEST_PULSE_MIN, LASER_TEST_PULSE_MAX);   

@DerAndere1
Copy link
Owner Author

you need to slightly customize your Configuration_adv.h file to enable both at the same time. but be aware that I never had the time to test this

Replace the Spindle / Laser section with this

/**
 * Spindle & Laser control
 *
 * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and
 * to set spindle speed, spindle direction, and laser power.
 *
 * SuperPID is a router/spindle speed controller used in the CNC milling community.
 * Marlin can be used to turn the spindle on and off. It can also be used to set
 * the spindle speed from 5,000 to 30,000 RPM.
 *
 * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V
 * hardware PWM pin for the speed control and a pin for the rotation direction.
 *
 * See https://marlinfw.org/docs/configuration/2.0.9/laser_spindle.html for more config details.
 */
#define SPINDLE_FEATURE
#define LASER_FEATURE
#if ANY(SPINDLE_FEATURE, LASER_FEATURE)
  #define SPINDLE_LASER_ACTIVE_STATE    LOW    // Set to "HIGH" if SPINDLE_LASER_ENA_PIN is active HIGH

  #define SPINDLE_LASER_USE_PWM                // Enable if your controller supports setting the speed/power
  #if ENABLED(SPINDLE_LASER_USE_PWM)
    #define SPINDLE_LASER_PWM_INVERT    false  // Set to "true" if the speed/power goes up when you want it to go slower
    #define SPINDLE_LASER_FREQUENCY     2500   // (Hz) Spindle/laser frequency (only on supported HALs: AVR, ESP32, and LPC)
                                               // ESP32: If SPINDLE_LASER_PWM_PIN is onboard then <=78125Hz. For I2S expander
                                               //  the frequency determines the PWM resolution. 2500Hz = 0-100, 977Hz = 0-255, ...
                                               //  (250000 / SPINDLE_LASER_FREQUENCY) = max value.
  #endif

  //#define AIR_EVACUATION                     // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
  #if ENABLED(AIR_EVACUATION)
    #define AIR_EVACUATION_ACTIVE       LOW    // Set to "HIGH" if the on/off function is active HIGH
    //#define AIR_EVACUATION_PIN        42     // Override the default Cutter Vacuum or Laser Blower pin
  #endif

  //#define AIR_ASSIST                         // Air Assist control with G-codes M8-M9
  #if ENABLED(AIR_ASSIST)
    #define AIR_ASSIST_ACTIVE           LOW    // Active state on air assist pin
    //#define AIR_ASSIST_PIN            44     // Override the default Air Assist pin
  #endif

  //#define SPINDLE_SERVO                      // A servo converting an angle to spindle power
  #ifdef SPINDLE_SERVO
    #define SPINDLE_SERVO_NR   0               // Index of servo used for spindle control
    #define SPINDLE_SERVO_MIN 10               // Minimum angle for servo spindle
  #endif

  /**
   * Speed / Power can be set ('M3 S') and displayed in terms of:
   *  - PWM255  (S0 - S255)
   *  - PERCENT (S0 - S100)
   *  - RPM     (S0 - S50000)  Best for use with a spindle
   *  - SERVO   (S0 - S180)
   */
  #define CUTTER_POWER_UNIT PWM255

  /**
   * Relative Cutter Power
   * Normally, 'M3 O<power>' sets
   * OCR power is relative to the range SPEED_POWER_MIN...SPEED_POWER_MAX.
   * so input powers of 0...255 correspond to SPEED_POWER_MIN...SPEED_POWER_MAX
   * instead of normal range (0 to SPEED_POWER_MAX).
   * Best used with (e.g.) SuperPID router controller: S0 = 5,000 RPM and S255 = 30,000 RPM
   */
  //#define CUTTER_POWER_RELATIVE              // Set speed proportional to [SPEED_POWER_MIN...SPEED_POWER_MAX]

  #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

  /**
   * M3/M4 Power Equation
   *
   * Each tool uses different value ranges for speed / power control.
   * These parameters are used to convert between tool power units and PWM.
   *
   * Speed/Power = (PWMDC / 255 * 100 - SPEED_POWER_INTERCEPT) / SPEED_POWER_SLOPE
   * PWMDC = (spdpwr - SPEED_POWER_MIN) / (SPEED_POWER_MAX - SPEED_POWER_MIN) / SPEED_POWER_SLOPE
   */
   #if ENABLED(SPINDLE_LASER_USE_PWM)
    #define SPEED_POWER_INTERCEPT       0    // (%) 0-100 i.e., Minimum power percentage
    #define SPEED_POWER_MIN             0    // (RPM)
    #define SPEED_POWER_MAX         30000    // (RPM) SuperPID router controller 0 - 30,000 RPM
    #define SPEED_POWER_STARTUP        80    // (RPM) M3/M4 speed/power default (with no arguments)
  #endif

  #if ENABLED(SPINDLE_FEATURE)
    //#define SPINDLE_CHANGE_DIR               // Enable if your spindle controller can change spindle direction
    #define SPINDLE_CHANGE_DIR_STOP            // Enable if the spindle should stop before changing spin direction
    #define SPINDLE_INVERT_DIR          false  // Set to "true" if the spin direction is reversed
  #endif

  #if ENABLED(LASER_FEATURE)

    // Define the minimum and maximum test pulse time values for a laser test fire function
    #define LASER_TEST_PULSE_MIN           1   // (ms) Used with Laser Control Menu
    #define LASER_TEST_PULSE_MAX         999   // (ms) Caution: Menu may not show more than 3 characters

   /**
    * Laser Safety Timeout
    *
    * The laser should be turned off when there is no movement for a period of time.
    * Consider material flammability, cut rate, and G-code order when setting this
    * value. Too low and it could turn off during a very slow move; too high and
    * the material could ignite.
    */
    #define LASER_SAFETY_TIMEOUT_MS     1000   // (ms)

    /**
     * Any M3 or G1/2/3/5 command with the 'I' parameter enables continuous inline power mode.
     *
     * e.g., 'M3 I' enables continuous inline power which is processed by the planner.
     * Power is stored in move blocks and applied when blocks are processed by the Stepper ISR.
     *
     * 'M4 I' sets dynamic mode which uses the current feedrate to calculate a laser power OCR value.
     *
     * Any move in dynamic mode will use the current feedrate to calculate the laser power.
     * Feed rates are set by the F parameter of a move command e.g. G1 X0 Y10 F6000
     * Laser power would be calculated by bit shifting off 8 LSB's. In binary this is div 256.
     * The calculation gives us ocr values from 0 to 255, values over F65535 will be set as 255 .
     * More refined power control such as compensation for accel/decel will be addressed in future releases.
     *
     * M5 I clears inline mode and set power to 0, M5 sets the power output to 0 but leaves inline mode on.
     */

    /**
     * Enable M3 commands for laser mode inline power planner syncing.
     * This feature enables any M3 S-value to be injected into the block buffers while in
     * CUTTER_MODE_CONTINUOUS. The option allows M3 laser power to be committed without waiting
     * for a planner synchronization
     */
    //#define LASER_POWER_SYNC

    /**
     * Scale the laser's power in proportion to the movement rate.
     *
     * - Sets the entry power proportional to the entry speed over the nominal speed.
     * - Ramps the power up every N steps to approximate the speed trapezoid.
     * - Due to the limited power resolution this is only approximate.
     */
    //#define LASER_POWER_TRAP

    //
    // Laser I2C Ammeter (High precision INA226 low/high side module)
    //
    //#define I2C_AMMETER
    #if ENABLED(I2C_AMMETER)
      #define I2C_AMMETER_IMAX            0.1    // (Amps) Calibration value for the expected current range
      #define I2C_AMMETER_SHUNT_RESISTOR  0.1    // (Ohms) Calibration shunt resistor value
    #endif

    //
    // Laser Coolant Flow Meter
    //
    //#define LASER_COOLANT_FLOW_METER
    #if ENABLED(LASER_COOLANT_FLOW_METER)
      #define FLOWMETER_PIN         20  // Requires an external interrupt-enabled pin (e.g., RAMPS 2,3,18,19,20,21)
      #define FLOWMETER_PPL       5880  // (pulses/liter) Flow meter pulses-per-liter on the input pin
      #define FLOWMETER_INTERVAL  1000  // (ms) Flow rate calculation interval in milliseconds
      #define FLOWMETER_SAFETY          // Prevent running the laser without the minimum flow rate set below
      #if ENABLED(FLOWMETER_SAFETY)
        #define FLOWMETER_MIN_LITERS_PER_MINUTE 1.5 // (liters/min) Minimum flow required when enabled
      #endif
    #endif

  #endif
#endif // SPINDLE_FEATURE || LASER_FEATURE

/**
 * Synchronous Laser Control with M106/M107
 *
 * Marlin normally applies M106/M107 fan speeds at a time "soon after" processing
 * a planner block. This is too inaccurate for a PWM/TTL laser attached to the fan
 * header (as with some add-on laser kits). Enable this option to set fan/laser
 * speeds with much more exact timing for improved print fidelity.
 *
 * NOTE: This option sacrifices some cooling fan speed options.
 */
//#define LASER_SYNCHRONOUS_M106_M107

@printercnc
Copy link

why marlin and grbl software can not connect to each other? i have a 5 axis grbl software shared for free, my idea is to turn it into 3d printer gcode cutting software and also 5 axis cnc.

@DerAndere1
Copy link
Owner Author

DerAndere1 commented Nov 1, 2024

I tried to integrate 5axis kinematics into grbl-HAL, but did not succeed so far, because I am unfamiliar with their codebase. My next plan is to open an issue in the grbl-HAL repository and post the code for the kinematics calculation there, so their team can take over and integrate it. However, grbl-HAL is still missing support for extruders, hotends and heated beds. That has to be added by someone else. Note that Marlin is in fact the result of adding Support for 3D printing to grbl 1.0.

I was also approached by the ReprapFirmware (RRF) team and I am colaborating with them: I offered to check their 5 axis kinematics implementation once Jörgs code (https://github.com/JoergS5/RepRapFirmware_robot) is ready for review (See https://forum.duet3d.com/topic/17421/robotic-kinematics/379).

@printercnc
Copy link

What do you mean by TCPC special kinematics?
GrblCNC-0.01.tar.gz

i send you grbl 5 axis software, i have tested it works well with 5 axis. i don't understand everyone's intention, the fact that i don't use grbl, mach3, linusCNC.. because they depend too much on the computer. they are not like marlin, separate screen and independent. i think grblcnc is the same as linuscnc, TCPC need to change in the software. the movement part of the E extrusion axis we can code the control algorithm like the spindle - laser control.
For the non-professional community, we really lack a free gcode export software.
`

`

@printercnc
Copy link

do you know him?

i also tested the software he built. it works very well even like a paid gcode export software NX-CAM that i am using. if it is possible to combine all of them to create a gcode export software for 3d printers, it would be great.

@printercnc
Copy link

GRBLGRU SOFTWARE DOWNLOAD LINK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants