Luban icon indicating copy to clipboard operation
Luban copied to clipboard

Bug: Settings in Laser - Raspberry Pi 4

Open alexastro41 opened this issue 10 months ago • 5 comments

Cannot Find Laser Settings

When building and running Luban on Raspberry Pi 4 with Raspberry Pi OS (arm64), I am running into the cut settings for the 40 W laser not being found. This results in not being about to generate any laser GCODE. Following error is:

2025-03-06T17:08:27.206Z - GET /api/profileDefaultDefinitions/laser?_=1741280906926&configPath=laser%2Fa400_40w 200 136.216 ms
2025-03-06T17:08:27.251Z - error service:definition Failed to read JSON file: /home/alex/.config/Electron/Config/laser/a400_40w/present.default_CUT.def.json
2025-03-06T17:08:27.254Z - error service:definition Error: ENOENT: no such file or directory, open '/home/alex/.config/Electron/Config/laser/a400_40w/present.default_CUT.def.json'
    at Object.openSync (node:fs:582:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1800)
    at Object.readFileSync (node:fs:450:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9148)
    at DefinitionLoader.loadDefinition (/home/alex/github/Luban/output/src/server/slicer/definition.js:78:39)
    at loadDefinitionLoaderByFilename (/home/alex/github/Luban/output/src/server/slicer/definition.js:373:42)
    at loadAllSeriesDefinitions (/home/alex/github/Luban/output/src/server/slicer/definition.js:453:41)
    at getConfigDefinitions (/home/alex/github/Luban/output/src/server/services/api/api-profile-definitions.js:109:63)
    at Layer.handle [as handle_request] (/home/alex/github/Luban/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/alex/github/Luban/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/home/alex/github/Luban/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/home/alex/github/Luban/node_modules/express/lib/router/layer.js:95:5)
    at /home/alex/github/Luban/node_modules/express/lib/router/index.js:284:15
    at param (/home/alex/github/Luban/node_modules/express/lib/router/index.js:365:14)
    at param (/home/alex/github/Luban/node_modules/express/lib/router/index.js:376:14)
    at Function.process_params (/home/alex/github/Luban/node_modules/express/lib/router/index.js:421:3) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/alex/.config/Electron/Config/laser/a400_40w/present.default_CUT.def.json'
}

Goals

  • Some way to run Luban on the Raspberry Pi (I have tried many different approaches)
  • Repeatable workaround to run this via npm run dev
  • Repeatable workaround to run this via npm run prod
  • IDEAL: A way to create the installer and run it natively on Raspberry pi... (Other bug report sure to follow)
    • Currently running into font-manager not being found despite manually installing libfontconfig-dev

Affected Version(s)

The issue is caused by version x.y.z

Observed in 4.15.0

Is this a regression? (optional)

Yes, this works elsewhere just not on Raspberry Pi OS

Yes, the previous version in which this bug was not present was: ....

To Reproduce

Steps to reproduce the behavior:

Building

  • git clone <>
  • cd Luban
  • git submodule update --init --recursive
  • npm install
  • npm run build
  • npm run dev

In App

  1. Select machine and Laser
  2. Select Laser (2D)
  3. Follow Laser Tutorial
  4. Delete toolpaths
  5. Manually select the objects assigning cutting and engraving
  6. Click Generate
  7. Observe Failed Message in App
  8. Observe Failed Message in terminal

🌍 Your Environment

Platform:



Computer: Rasberry Pi 4
OS: Raspberry Pi OS (arm64/aarch64)
Machine: Artisan
Laser: 40W

alexastro41 avatar Mar 06 '25 17:03 alexastro41

I'm seeing this same bug on macOS using the A350 and 1600mW laser running v4.15.1.

I was able to cd to the folder where Luban is looking for that default profile file and it's not there. There is, however, a file by that name in the adjacent original_1600mW. I tried just copying it over, but I'm still seeing the same error.

safaaleigh avatar Mar 10 '25 04:03 safaaleigh

From what I could tell, it looked as if Luban assumes to use the default settings. I am able to manage the laser settings via the UI and see the built-in settings via json files. I think the error is occurring when linking the selected settings and the toolpaths. I don't mind to look into this though I am very new to JS and TS. I was also having difficulty finding where this would be located in the code.

alexastro80 avatar Mar 18 '25 14:03 alexastro80

So I did a bit of investigating. This error message can be fixed via adding the preset_*.json files to the print settings repo. However I think this error may be caught appropriately and not the main issue. From what I can tell the error is coming from snapmaker-lunar during the "slice" to generate GCode. Attempting to get more info I went looking to add debug statements in snapmaker-lunar and found the source without a matching repository... From the looks it looks like snapmaker-lunar comes with prebuilt binaries which also don't have repositories:

  • LunarMP (does have a repo)
  • LunarTPP (no repo and the thing throwing the error)
  • LunarSlicer (repo available, however looks 3D printing specific)

It looks like only 2 error codes get processed and the one thrown is about settings:

slice ()
cmd: /home/alex/github/Luban/node_modules/@snapmaker/snapmaker-lunar/engine/Linux/LunarTPP slicelaser -v -p -j /home/alex/.config/Electron/Tmp/settings_07880036.json -l /home/alex/.config/Electron/Tmp -o /home/alex/.config/Electron/Tmp
2025-03-22T17:07:24.016Z - error laser-cnc-slice LunarTPP slice error, Code: 2 | Msg: Error for Settings

NOTE: the tmp file isn't there so I am going to attempt to see if it even is created.

alexastro41 avatar Mar 22 '25 17:03 alexastro41

So checking back... LunarTPP when I run it by hand it says wrong exec format. Which confirms this is precompiled. I wonder how this could be built for arm64...

alexastro41 avatar Mar 23 '25 20:03 alexastro41

any updates?

alexastro41 avatar Nov 21 '25 22:11 alexastro41