LaserWeb: Raster GCODE generation stucks at 100%

LaserWeb information

  • Frontend version: 4.0.99
  • Backend version: 4.1.000

My settings are:

  "settings": {
    "__version": "4.0.999",
    "__selectedProfile": "CR10",
    "__latestRelease": "2019-11-26T10:45:07Z",
    "showMachine": true,
    "machineWidth": 300,
    "machineHeight": 300,
    "machineBeamDiameter": 0.2,
    "machineBottomLeftX": 0,
    "machineBottomLeftY": 0,
    "machineFeedRange": {
      "XY": {"min": 1, "max": 50000},
      "Z": {"min": 1, "max": 50000},
      "A": {"min": 1, "max": 50000},
      "S": {"min": 0, "max": 30000}
    "machineXYProbeOffset": 50,
    "machineZEnabled": true,
    "machineZMatThickness": 0,
    "machineZToolOffset": 0,
    "machineZStartHeight": "40",
    "machineZProbeOffset": 0,
    "machineAEnabled": false,
    "machineBlowerEnabled": false,
    "machineBlowerGcodeOn": "",
    "machineBlowerGcodeOff": "",
    "pxPerInch": 96,
    "forcePxPerInch": false,
    "dpiBitmap": 300,
    "toolGridWidth": 500,
    "toolGridHeight": 500,
    "toolGridMinorSpacing": 10,
    "toolGridMajorSpacing": 50,
    "toolSafetyLockDisabled": true,
    "toolCncMode": false,
    "toolImagePosition": "BL",
    "toolUseNumpad": false,
    "toolDisplayCache": false,
    "toolUseGamepad": false,
    "toolCreateEmptyOps": false,
    "toolVideoDevice": null,
    "toolVideoPerspective": {"enabled": false},
    "toolVideoLens": {"a": 1, "b": 1, "F": 1, "scale": 1},
    "toolVideoFov": {"x": 1, "y": 1},
    "toolVideoResolution": "720p(HD)",
    "toolVideoOMR": false,
    "toolVideoOMROffsetX": 0,
    "toolVideoOMROffsetY": 0,
    "toolVideoOMRMarkerSize": 20,
    "toolWebcamUrl": "",
    "toolFeedUnits": "mm/min",
    "toolTestSValue": 1,
    "toolTestDuration": 0,
    "gcodeStart": "G21         ; Set units to mm\nG90         ; Absolute positioning",
    "gcodeEnd": "M107          ; Switch tool offEnd",
    "gcodeHoming": "G28",
    "gcodeGenerator": "marlin",
    "gcodeToolOn": "M106 $INTENSITY",
    "gcodeToolOff": "M107",
    "gcodeLaserIntensity": "S",
    "gcodeLaserIntensitySeparateLine": true,
    "gcodeSMinValue": 0,
    "gcodeSMaxValue": 255,
    "gcodeCheckSizePower": 1,
    "gcodeToolTestPower": 1,
    "gcodeToolTestDuration": 100,
    "gcodeConcurrency": 2,
    "gcodeCurvePrecision": 0.1,
    "comServerVersion": "4.1.000",
    "comServerIP": "",
    "comServerConnect": false,
    "comInterfaces": ["USB", "ESP8266", "Telnet"],
    "comPorts": [
      {"path": "/dev/ttyAMA0"},
        "manufacturer": "FTDI",
        "serialNumber": "AL03PY7Y",
        "pnpId": "usb-FTDI_FT232R_USB_UART_AL03PY7Y-if00-port0",
        "vendorId": "0403",
        "productId": "6001",
        "path": "/dev/ttyUSB0"
    "comAccumulatedJobTime": 0,
    "connectVia": "USB",
    "connectPort": "/dev/ttyUSB0",
    "connectBaud": "115200",
    "connectIP": "",
    "jogStepsize": 1,
    "jogFeedXY": 1800,
    "jogFeedZ": 300,
    "macros": {
      "*GotoXY0": {
        "label": "Goto XY zero",
        "gcode": "G0 X0Y0",
        "keybinding": "ctrl+f1",
        "_locked": false
      "*LaserOff": {
        "keybinding": "ctrl+f2",
        "label": "LASER OFF",
        "gcode": "M107"
      "23809d38-bd32-4537-a67b-cf3d76b96809": {
        "keybinding": "",
        "label": "LAER ON",
        "gcode": "M106 20"
    "uiFcDrag": null,
    "toolUseVideo": false,
    "machineOriginX": 0,
    "machineOriginY": 0

Problem description

I am testing my Laser engraver mod for my CR10. Hardware works, but LaserWeb seems to stuck.
I want to generate a raster but after 100% nothing happens. The browser console says everytime, after reaching the 100%:

Uncaught SyntaxError: Invalid token $I
    at replacer (xregexp.js:1765:1)
    at RegExp.[Symbol.replace] (<anonymous>)
    at String.replace (<anonymous>)
    at xregexp.js:1684:1
    at RegExp.[Symbol.replace] (<anonymous>)
    at String.replace (<anonymous>)
    at String.fixed.replace (xregexp.js:1679:1)
    at Function.XRegExp.replace (xregexp.js:1274:1)
    at MarlinGenerator.postProcessRaster (abstract-generator.js:12:23)
    at postProcessing (cam-gcode-raster.js:123:28)

Is there a Bug in the LaserWeb 4.0.999?

System description

  • My machine is a diode laser

  • Connected to a Raspberry Pi and the LaserWeb as Bundle

  • I connect via USB

  • My computer(s) on which I run LaserWeb run(s) Linux version |

Thanks for the report.
Have you tried different images (as a test), is it all images that hang, or just one particular one?

That looks identical to my problem I reported 2 days ago.

I see you have $INTENSITY command in your GCode settings. This is what is crashing the raster. The laser cut will still work with $INTENSITY.

Even if it is commented, xregexp.js will trip on it and crash the GCode raster generation.

Try creating a different machine for raster use without $INTENSITY.

1 Like

So, to set the intensity to full 255?
or is there not real intensity with the laser mod for Ender and CR10?
this is my first laser to try.


Sorry I can’t really help you any further with your machine. You can try putting 1 first and see if the GCode raster gets generated.

Who told you to put $INTENSITY in the ToolOn command? Where is this documented?
Such variables are not supported.

M106/M107 sounds like Marlin.
Since version 2.0.9.x Marlin supports “Dynamic Inline Mode” which works exactly like GRBL in Laser Mode with M4 (see Laser/Spindle Configuration (2.0.9.x) | Marlin Firmware).

If you have Marlin 2.0.9.x or newer on your board (or can install it), you could just use the default GRBL profile.

Hi @cprezzi,
Have a look at pull request 473

Part of the GCode generator handles it such as laser cutting, while laser raster doesn’t and crash.

I’m using $INTENSITY for piercing function: In my case I back up the Z by 5mm, then G1 move down by 5mm with $INTENSITY. I can’t comment on Marlin but it looks like in 2018 that specific PR was made for Marlin.

@harlock999 This was only working with the special “Marlin” gcode generator, which doesn’t need to be used anymore since Marlin has implemented the Dynamic Inline Mode, which understands GRBL gcode.

Ok great for Marlin. I still find this feature very useful for piercing.

I don’t mind fixing the raster Gcode generation to handle $INTENSITY without crashing but I’d like to wait for the @easytarget front end to be released first.

Sure, it absolutely makes sense to fix that problem after the @easytarget version is out. Getting the raster generator to correctly use all settings is on the todo list since some time now.