FluidNC icon indicating copy to clipboard operation
FluidNC copied to clipboard

Error setting macro from web interface

Open ein-erin opened this issue 4 years ago • 4 comments

Hi,

When I try to change a macro from the web interface configuration section, I get an error:

Set failed Error 500 :Error: Invalid value for setting

The error occurs, as far as I can see, only if the macro line contains the command to run the file from the SD card, like $SD/Run=test.nc.

If I set up the macro via the terminal by running the command $/macros/macro0=$SD/Run=test.nc, no error occurs. When setting other commands, like $Home, the error will not be thrown either.

ein-erin avatar May 11 '22 05:05 ein-erin

This is difficult to fix due to a quirk in the way that WebUI (which is a separate project) communicates with FluidNC. I will give details below just to document the situation. A totally new version of the (separate project) WebUI is in the works. We will switch to it as time permits, so it does not make sense to go to a lot of trouble to fix or work around the communication limitations in the existing version.

Details of why it doesn't work:

WebUI sends setting changes as a string like: T=type P=name V=value . That string must be parsed to separate out those fields. That parser looks for the character '=' to find the various fields. If the "value" string itself contains an '=' character - as in "$SD/Run=test.nc" the parser gets confused and fails to separate the fields correctly. One solution would be to rewrite the parser so that, once it has found the V= key, it stops. Another solution would be to encode the value string to replace the = with, for example, %3d, similar to the way that some special characters are encoded in URLs.

MitchBradley avatar May 11 '22 17:05 MitchBradley

I found a way to fix it without too much trouble. The fix will probably be in the next release.

Please note that, if you change a configuration setting of this type, the change will not persist across resets unless you save the config file.

MitchBradley avatar May 11 '22 18:05 MitchBradley

Thanks.

The news about the development of a new version of WebUI is great.

ein-erin avatar May 12 '22 04:05 ein-erin

The news about the development of a new version of WebUI is great.

Please note that WebUI is controlled by a developer who is not part of this project. People often ask us for WebUI improvements that strain our ability to work on FluidNC features and also coordinate with the separate project.

MitchBradley avatar May 12 '22 17:05 MitchBradley