winder / Universal-G-Code-Sender

A cross-platform G-Code sender for GRBL, Smoothieware, TinyG and G2core.
http://winder.github.io/ugs_website/
GNU General Public License v3.0
1.92k stars 768 forks source link

Issue with FluidNC configuration parsing when connecting #2573

Closed ColPaulR closed 4 months ago

ColPaulR commented 4 months ago

Version

2.1.7

Hardware / Firmware

FluidNC

What happened

I just got USG to connect to my FluidNC last night. Looking at the messages.log file, there was a problem reading the FluidNC configuration. Specifically the error message is:

SEVERE [FluidNCController]: Could not initialize the connection

mapping values are not allowed here in 'string', line 3, column 34: meta: (01.02.2022) by Skorpiboard: MKS TinyBee V1.0_001

Looking at this, I set the "meta" config item to a null string and UGS would connect just fine. I'm not sure that the "meta" config item is used for anything and there is no default syntax for this item. I'm assuming that the parsing routine should be modified to ignore this value. From the error message, it looks like it is barfing on the 2nd ":" in the line, as my prior meta configuration included a colon in the string. I'll confirm tonight that removing the : allows UGS to correctly parse the line.

How to reproduce

Use the attached YAML configuration or edit an existing configuration to set meta. Line from my YAML is: ``meta: (01.02.2022) by Skorpiboard: MKS TinyBee V1.0_001" XYZAB_laser_24Jul24.yaml.txt

messages.log

Operating System

Windows 11

Anything else

No response

breiler commented 4 months ago

Thanks for the report.

UGS uses a YAML library for reading the config file, which will fail due to the nested : that is not allowed in YAML. If you open the file through the file browser in https://installer.fluidnc.com/ you will see this error: image

To solve this you should be able to simply wrap the text with " like this:

board: MKS TinyBee V1.0_001
name: CNC Router XYYZA 0-10V spindle and laser
meta: "(01.02.2022) by Skorpiboard: MKS TinyBee V1.0_001"
...

However these gets stripped when retrieving the config file through the command $Config/Dump and will still fail in UGS.

I will try to add a better error message in UGS to notify the user about the problem, and see if I can fix the $Config/Dump command in FluidNC.

In the meantime, you can edit the config and replace the meta text with just:

meta: (01.02.2022) by Skorpi
ColPaulR commented 4 months ago

Thanks for working this for everyone (mainly me). I'll fix my YAML to omit the embedded ":". Another thought would be to strip out the board, name, and meta keys from the string before passing to the YAML parser, assuming those keys aren't actually used by UGS. I greatly appreciate the support.