Jackpot / FluidNC WebGUI

Well, I couldn’t get line numbers working anyway. I updated the use_line_numbers setting in my config.yaml from false to true. Then I took a gcode file for the crown and added N codes to it, but it still wasn’t outputting Ln: NNN in the messages.

I even went as far as looking at the FluidNC code:

if (config->_useLineNumbers) {
        // Report current line number
        plan_block_t* cur_block = plan_get_current_block();
        if (cur_block != NULL) {
            uint32_t ln = cur_block->line_number;
            if (ln > 0) {
                msg << "|Ln:" << ln;
            }
        }
    }

Here’s the PowerShell I wrote to prefix all “G” lines with N and an incremental number.

$Index = 1
Get-Content jey-crown.gcode | `
  ForEach-Object -Process { If ($_.StartsWith("G")) { "N" + $Index++ + " " + $_ } Else { $_ }} | `
  Out-File jey-crown-ln.gcode

I’m on FluidNC 3.7.15. Maybe I’ll update to 3.7.17 and try again.

Somehow I went from trying to put the gcode visualizer on the dashboard and got sidetracked by line numbers…

3 Likes

Me too!

I’d love a feature that can restart a job from the last operation !
Would be even better if we could setup some “labels” on operation in the gcode and select the starting label in fluidnc
eg: “Operation 2 - Contour - Pass 3”

Maybe Klipper has a lot more potential for such things with macros and all, but the CNC support in Klipper is not great :confused:

1 Like

I think this is possible indirectly via an extension. The extension would need to parse the gcode file to list the labels and allow you to select it. It would then need to modify the gcode to only include the lines that should be run, upload this modified version to the SD card, and run it.

1 Like

I’d probably take this problem the other way around : implement some kind of “gcode file queue” and split the big gcode file in segments added to this queue or playlist
Then you can select your step/operation in the queue, delete the job from the queue when done and so on

1 Like

Yea, the problem is working within the bounds of what you can do in an extension. When you run a gcode file, all you’re doing is running a command $SD/Run=/myfile.gcode. It streams the status as you run it, but there’s not much you can do with it. It’s possible but there’s not a great way to detecting that a file completed. So, I think it’s probably easier to just create a new gcode file with what you want and run that as a whole. The file can all be parsed and updated on the client JavaScript side. It’s probably possible to implement something to support this on the FluidNC side, but that’s beyond me.

1 Like

Have you seen what they are working on right now? Persistence variables maybe…

1 Like

No? I check out the FluidNC and ESP3D discord channels from time to time, but I haven’t seen anything.

Line numbers work! I must have done something dumb. I wonder if I uploaded the config.yaml and clicked the save macro. I think that would take the current config and overwrite the file?

Edit: Also saw my polling was every 10 seconds instead of every second. Wonder when I changed that. Much more responsive on the line numbers.

3 Likes

There’s a chunk of work to do yet but yes, taking the gcode visualizer from the tablet view and putting it in a panel on the dashboard is absolutely possible. I hacked together a working proof of concept.

There are some issues with the tablet code itself that are causing some issues.

  • The file must be selected and run from the extension panel. The file selector in the tablet extension has some issues with folders. I fixed it enough to make it work but you can’t go back up a level currently.
  • It is scrolling the gcode based on line number (assuming it’s enabled an N codes are added to the gcode). However, the code currently is using the actual line number, not what is listed in the N command.
  • There are some quirks to the current position (pink dot). I saw it working correctly in some circumstances but I’ll need to figure out what those are.
5 Likes

Wow. Jason, you are amazing. Cool stuff.

Whaou !!! Amazing work !

hi jason so you reach to isolate in the javascript the Gcode visualiser and the 3D previewer ?

I’m still working on it but making progress. There’s a mix of issues with the tablet code and some changes to make it better suited to a smaller size.

1 Like

Mitch is in the process of trying to get it ported to WebUI3. He’s not a web developer.

I think there were a few bugs in the v2 tablet code as well.

While he’s probably not that open to UI changes since this is his primary mode of operation, if you happen across any bugs in the code like the folder browsing or function of the plot, etc, I’m sure he would be very open to a PR on it.

Getting that tablet code functional in V3 is a big step to get him on board with V3 as a primary UI.

2 Likes

Yea, perhaps I should tackle these issues one at a time on the existing tablet extension before the one I’m working on.

I’m well versed in Git, but not with contributing to projects on Github. I believe I need to fork the repo, create a feature branch in my fork, and then do a PR back into the main repo.

I was also looking at the guidelines in the FluidNC wiki.
Pull Request Guidelines | Wiki.js

So, I guess I would create an issue and then a PR associated that issue. I understand the part about rebasing.

Just trying to help without being a pain. I know they’re really busy.

2 Likes

The tablet extension is a side project off of the main FluidNC repo. I’m sure for any bug fixes, he would be happy to just get a PR without going through all of the official FluidNC stuff.

As long as he can understand the changes and the reasoning, I would guess he’s pretty open to help on the web side.

3 Likes

Putting my dashboard GCode viewer on hold to resolve issues in the tablet extension it is based on. I’ll need to fix some of these anyway, so I might as well help out. Tonight, I just forked the repo, created a branch, and since I’m a Windows guy, created a PowerShell script to duplicate the existing script that “builds” the extension.

There’s some very cool code in the tablet extension way beyond what I could have sorted out myself. I can make sense of a lot of it. The gcode parser is more thorough than I expected and the code that draws it out to the canvas is pretty interesting.

This is the current list of issues I see. We’ll see what I can tackle. Some of these are more important than others.

  • File Selector
    • Doesn’t handle folders correctly
    • Lists files in random order?
  • GCode Visualizer
    • Not reading the settings for machine bounds properly
    • Possible improvements to centering view within canvas (this might be difficult)
    • Current position not always shown correctly. I’m not sure if this is a bug or just a misunderstanding on my part.
  • GCode Line Number Sync
    • Using actual file line number instead of looking at the N commands
    • Currently doing this by selecting text in a textarea which can cause the popup keyboard to display
  • General Screen Items
    • Can’t get it to go full screen on my tablet within Chrome without an odd workaround
    • Minor formatting issues in portrait orientation

I’m tackling the file selector issues first.

This screenshot hides the issues, but this is where I left it.

6 Likes

Very envious of the skills you have. I am so very out of my league when it comes to that sort of code.

2 Likes

Ditto.