LaserWeb / LaserWeb4

Collaborative effort on the next version of LaserWeb / CNCWeb
GNU Affero General Public License v3.0
710 stars 192 forks source link

Load Gcode file to controller and run it from it's memory #502

Open zfmaster opened 6 years ago

zfmaster commented 6 years ago

On first view it's again related to Smoothieware (as everyone knows, there is a problem with streaming gcode to Smoothieboards and there is no possibility to resolve it because of differences in team's points of view), but I see such option useful even for situations when streaming works fine. To not dig into too much examples, argument could be reducing amount of places able to broke cutting process in case of crash - only controller vs PC + controller. Last month I started process and forgot to plug in charger into my laptop. When it completely discharged laser machine already worked 2h and 3h were left. Idea is to add one button which will be able to load generated gcode into controller on Files page and possibility to load list of available files and run them on Control page. I can implement it by myself, but here are my questions to community:

  1. Do we really need it?
  2. Which boards expecting Smoothieboard support sending files to machine and running from it?
  3. If anyone has ideas how to fit it better in UI - please share them here.
FabCreator commented 6 years ago

I believe the reason this idea was originally not followed up was the warning that doing this can lead to a corrupting of the SD card. Although I have never experienced this. In light the streaming issue is unlikely to get fixed perhaps a send to controller button is the way forward now. We already do this via pronterface with large complex jobs because the chance LW / SM will drop out is small but incredibly annoying for a long job. In the past we also experienced faster engraving speed with the external SD card over SPI.

cprezzi commented 5 years ago

The backend (lw.comm-server) already has the functionality to handle smoothie SD card functions (see https://github.com/LaserWeb/lw.comm-server/wiki/API-(for-client-communication). It "just" needs to be implemented in the frontend. Something like a "Send Job" button (additional to "Run Job") would be the minimum. Optimal would be a popup dialog to browse the SD card folders.

ckuethe commented 4 years ago

I would very much like to see the ability to spool a job to the back end to protect from network errors, eg. switching wifi access poinnts, my laptop going to sleep and running out of battery before the job finishes.

I've also never seen an SD card die just hanging around in a raspberry pi, even under slightly abusive conditions: writing 2GB of text per day, then compressing it nightly... for 3 years. Same with my octoprint machine. If people are concerned about that, what about a configurable "spool" directory: tmpfs if your gcode is relatively small, a separate device ($2 usb stick) for larger jobs, or /home/laserweb/upload if you trust your main storage device.

cprezzi commented 4 years ago

The actual implementation sends the whole gcode to the backend (lw.comm-server) at the moment you start the job. The frontend is not needed anymore after the gcode has been transferred to the backend. The backend caches the gcode in RAM and streams it line by line to the machine. This means if you run the backend on a Raspberry Pi, you can shutdown your notebook after starting the job.

I have seen a lot of SD cards die, expecially when used in Raspberry Pi's. Mostly because of power off without clean shutdown, but sometimes also just during usage.

zfmaster commented 4 years ago

@cprezzi such setup requires additional node in chain (Raspberry). I think more usual flow is Electron app on PC. Also I think it's possible to warn users about SD cards and leave it for them to decide.

About implementation: I added sending gcode to SD card, but problem I was facing with was control after code execution is started on Smoothieware: it's just impossible to perform any actions after you press 'Start' button. It takes code from SD card and will be unavailable for communication before end. It's the reason why here is no PR and no new updates.

cprezzi commented 4 years ago

LaserWeb was made flexible so the user can decide if he wants to run the all-in-one electron app or have a separate backend.

Running the gcode from SD card is the way most 3d-printers work, but it's not a good option for a laser or CNC mill (in my opinion). But if someone wants to do this, I recommended to attach buttons for pause/abort to the smoothieboard.