OpenBuilds / OpenBuilds-CONTROL

OpenBuilds CONTROL: Download from https://software.openbuilds.com
https://software.openbuilds.com
GNU General Public License v3.0
171 stars 105 forks source link

FluidNC support #283

Open petervanderwalt opened 1 year ago

petervanderwalt commented 1 year ago

Released as of 1.0.342

Left on Todo:

petervanderwalt commented 1 year ago

Todo Yaml parse https://www.npmjs.com/package/yamljs into legacy $$ setting as used by other parts of CONTROL

grblParams.$30 : used by Tool On > Variable grblParams.$110 : used by JogRate X grblParams.$111 : used by JogRate Y grblParams.$112 : used by JogRate Z grblParams.$113 : used by JogRate A grblParams.$22 : Used by jog grblParams.$27 : Used by Goto Zero Machine Coordinates (pull off from switch) grblParams.$20 : Used by Softlimits calculation grblParams.$130 : Used by Softlimits calculation, Machine extents on 3D view grblParams.$131 : Used by Softlimits calculation, Machine extents on 3D view grblParams.$132 : Used by Softlimits calculation, Machine extents on 3D view grblParams.$133 : Used by Softlimits calculation, Machine extents on 3D view grblParams.$100 : Calibration: X grblParams.$101 : Calibration: Y grblParams.$102 : Calibration: Z

image

petervanderwalt commented 1 year ago

Basic fluidnc config file https://github.com/bdring/FluidNC/pull/746/commits/4af173b928f6032263e434cb41de2b33d2fe0f43 made by @synman

synman commented 1 year ago

I've created a wiki here: https://github.com/synman/Octoprint-Bettergrblsupport/wiki/Hacking-the-OpenBuilds-BlackBox-X32

petervanderwalt commented 1 year ago

https://github.com/bdring/FluidNC/pull/755 relates - but needs a couple adaptations to be more compatible with the typical OpenBuilds Machine kit

petervanderwalt commented 1 year ago

https://openbuilds.com/threads/just-discovered-openbuilds-control-with-fluidnc.20338/#post-134242

Disable "?" statusloop while dumping config file, fluidNC responds to realtime commands in the middle of the config dump

curieos commented 1 year ago

I tried using the latest OBC with a machine running FluidNC today, and it went mostly well. I had two major things I was having issues with, one was connecting over USB. Not sure why, it sounded like that was working for this person based on the forum post:

https://openbuilds.com/threads/just-discovered-openbuilds-control-with-fluidnc.20338/#post-134242

Connecting over the network worked surprisingly well. I'd have occasional delays while jogging using the web interface, but during the several hours using OBC, even on the mobile jog widget, I did not have any noticeable delay when jogging. No stuttering during running a program either. The OBC probing wizard also worked without issue, though I suppose that's to be expected, since FluidNC uses the same codes for that as GRBL.

The second issue I had was the "Home All" button in OBC was disabled, so I had to send $H in the console to get the machine to home. Any reason for this?

petervanderwalt commented 1 year ago

issue I had was the "Home All" button in OBC was disabled, so I had to send $H in the console to get the machine to home. Any reason for this?

Thats the above todo item ^

  • Config parse for CONTROL's "grblParams.xx" needed values (below)

We disable the button when homing is disabled in Grbl's settings. FluidNC's different config means we need to write code to parse its config and see if homing is enabled or not to update the button accordingly

curieos commented 1 year ago

Do you have an ETA on when you think you'll be able to work on this? I downloaded the source and figured out how to build the app in preparation to take a stab at it, but I don't know how useful my contributions will actually be, especially if you plan to work on this more in the next couple weeks.

If it will be a while and you would like the help, could you give me some guidelines for how you want things implemented please?

petervanderwalt commented 1 year ago

Do you have an ETA on when you think you'll be able to work on this? I downloaded the source and figured out how to build the app in preparation to take a stab at it, but I don't know how useful my contributions will actually be, especially if you plan to work on this more in the next couple weeks.

If it will be a while and you would like the help, could you give me some guidelines for how you want things implemented please?

No ETA at the moment, as we are a small team we circle between projects based on current business priority, and we are working on three or four new exciting hardware projects at the moment. grbLHAL still serves us well, so unfortunately not able to commit time to this at the moment over the other priorities.

Your approach of offering help is a good one though - its not unwillingness on our side, but rather a lack of time.

Happy to talk you through what needs to be done (summarised above)

The main bulk of the todo is in that fluidNC drastically changed configs from grbl's $1=xx style (grblHAL stuck with it, so adding grblHAL support was way easier)

To support fluidNC properly, before we can declare support for it, means being able to read, edit, save configs.
It means having all our machine profiles converted to fluidNC configs so people can load them as easily as they can do now (CONTROL > Grbl Settings tab > Select machine from list > Save > Reset when prompted) And then we do have some functionality in CONTROL that looks at grbl Settings values (Above noted all of the ones I know about) - we can just populate a fake grblParams object from reading the YAML for that, rather than rewriting all those sections.

As for editing, we'd love it to be as simple as we made editing Grbl configs - table layout etc. Maybe parsed yaml, draw up the table but have a tab/button for advanced editing allowing direct yaml editing

Uploading the configs over xmodem is also a task that haven't been completed yet (xmodem.js has been added as dependency already https://github.com/OpenBuilds/OpenBuilds-CONTROL/blob/f724560edebae24ec2bd59bf8bcb1a09b9db747f/package.json#L32 but not built into index.js yet)

We also need to bring it into the Flashing tool (: but that's relatively simple

As for our machine profiles, if we work clever on the Editing UI, we can probably use the existing grbl templates to update a generic Yaml and let it rip (rather than keeping two sets of configs updated) - we did that for the grblHAL profiles too, use the grbl 1.1 profile, then just fix up some values that needed changing https://github.com/OpenBuilds/OpenBuilds-CONTROL/blob/f724560edebae24ec2bd59bf8bcb1a09b9db747f/app/js/grbl-settings-defaults.js#L4-L24

Oh and another fluidNC oddity we need to work around https://github.com/OpenBuilds/OpenBuilds-CONTROL/issues/283#issuecomment-1505532537

curieos commented 1 year ago

Sorry for not responding, I had a very busy week. Thanks for the info. I created a workaround for the oddity.

I also figured out why I was having difficulties connecting over USB. When booting, if wifi is enabled, the boot process takes longer since it connects to the network before spitting out the status message with grbl at the front. The first message it sends is [MSG:INFO: FluidNC vX.X.X]. Initially, I extended the connection timeout to get it to work temporarily, but it requires an excessively long timeout (around 15 seconds). I came up with a somewhat hacky solution that prevents the grbl socket from being emitted until the standard grbl message gets received when OBC detects the FluidNC intro message.

I also got config parsing functional. I don't think it's the cleanest, so I'm going to take another pass at it before I make that live.

curieos commented 1 year ago

I pushed my changes. I rewrote the parsing code to use lodash since it handles failing to find properties nicely. There's definitely more work to do, but I think I've gotten it to a minimum viable level for my purposes. I'll put some more work into managing the config in OBC when I get some time.

rhinodavid commented 9 months ago

Update: See below. the GRBL version is actually 1.1, the FluidNC version is 3.7.

Team -- I've tried about a half-dozen Gcode senders with FluidNC and CONTROL, as is, is hands-down the best.

The FluidNC GRBL Gcode senders page unfortunately doesn't list CONTROL, but I'm going to try and get Wiki access and add it.

One issue I did notice: The default FluidNC startup message reads like Grbl 3.7 [FluidNC 3.7.10 (wifi) '$' for help], and CONTROL does not correctly parse it (I think it ends up using "Method 2", which I can't find in the code after a short look).

The log looks like:

[23:18:09] [ connect ] Detecting Firmware: Method 2 (Ctrl+X)

[23:18:09] [ ] Detected an unsupported version: Grbl .7.10. This is sadly outdated. Please upgrade to Grbl 1.1 or newer to use this software. Go to http://github.com/gnea/grbl

[23:18:09] [ ] Grbl 3.7 [FluidNC 3.7.10 (wifi) '$' for help]

[23:18:12] [ connect ] Firmware Detected: grbl version .7.10 on 192.168.0.55

Luckily, one can change the startup message.

Changing the startup string to Grbl \V [\H] will output Grbl 3.7 ['$' for help] and eventually you'll have a log line:

[23:23:04] [ connect ] Firmware Detected: grbl version 3.7 on 192.168.0.55

The startup message can be changed with the $Start/Message command or via the GUI.

Screenshot 2023-11-30 at 11 22 42 PM

Hope this helps someone. -d

dJOS1475 commented 9 months ago

I found the easiest way to get Control working properly with FluidNC was to set the firmware to “ Grbl 1.1g”. Then it works great:

IMG_9532 IMG_9531

synman commented 9 months ago

@dJOS1475 I may still have wiki access and can ask Bart about it if you'd like.

They are fairly active on Discord.

synman commented 9 months ago

Something to keep in mind though with your work around... It may impact other senders that have been fully updated to support FluidNC.

I guess that isn't such a big deal if you plan on sticking with Control, but it is worth mentioning for others.

I also thought we had/have a fork here where this was worked out

rhinodavid commented 9 months ago

Any chance somebody can give me a code pointer to the GRBL detection logic. I've been string searching and can't seem to find it.

viernullvier commented 7 months ago

I've just updated my controller to the latest FluidNC build (3.7.13) and dug around in the OpenBuilds Control code - looks like we're almost there.

First, FluidNC has added support for a major chunk of legacy GRBL settings. Sending $$ will return a config that is understood by OBC and will update the UI accordingly.

Second, I looked into a way to have OBC send the $$ command directly after connecting. As it happens, this is the same behaviour as expected for GrblHAL, so I just set up my controller to impersonate GrblHAL:

FluidNC Settings screenshot. Value 'Start/Message' is set to 'GrblHAL \B (\R) \H'.

Setting Start/Message to GrblHAL \B (\R) \H allows me to use the controller without issues, but of course it forgoes any FluidNC-specific functionality in OBC that might already be there. If someone reading this discussion just wants to get OBC v1.0.370 to work with FluidNC v3.7.13, this is the thing to change.

Here's my take on the remaining open tasks :

I'd be willing to take care of the following:

How does that sound?

dJOS1475 commented 7 months ago

Funny you mentioned GrblHAL, I’ve just ditched FluidNC for it. I was just not 100% happy with it. GrblHAL Has been rock solid.

https://youtu.be/u_wgNvjDEF4

NeOdYmS commented 5 months ago

how can i contribute on this issue ?

petervanderwalt commented 5 months ago

First, FluidNC has added support for a major chunk of legacy GRBL settings. Sending $$ will return a config that is understood by OBC and will update the UI accordingly.

That's very good news, the different settings thing needed a lot of work to accomodate, so that should ease adoption, I think? Reusing the Grbl Settings we have now (even with some modification, still friendlier than editing Yaml)

I'd be willing to take care of the following:

  • Remove previous attempt of FluidNC YAML parsing, use config returned by $$ instead
  • Fix version detection, add warning when attempting to use a pre-3.7.13 version of FluidNC
  • Add support for config backup/restore/save to firmware (hardcoded to config.yaml at first)
  • Try to add support to the flashing tool if it is really as simple as @petervanderwalt described it

How does that sound?

That sounds great! I am allocated on CONTROL for a couple days this week, so please help! Happy to Merge pulls, just don't have a lot of time to work on it myself (:

petervanderwalt commented 5 months ago

Any chance somebody can give me a code pointer to the GRBL detection logic. I've been string searching and can't seem to find it. https://github.com/OpenBuilds/OpenBuilds-CONTROL/blob/8de3acec1f0d35e84072405a7bf02fdc2e3ea9eb/index.js#L1459-L1528