Corrupt (sort of) file error
-
I do not know if the following issue is a DWC issue or firmware issue.
I have a macro like this:
M291 P"Remove probe from printer build plate. OK or cancel?" R"WARNING" S2
This is a straight copy/paste of the file and it is actually two lines with the second line appearing to be empty (carriage return maybe)
Upon running this file, I first get the window displayed but once I click on 'ok' I get an error "M292 Error: Bad command"After a lot of futzing around, I found out that there are two non-printable characters in that last (invisible) line. One is likely a carriage return. If I delete that last line then the error message goes away.
The file is not actually corrupt but just has some sort of unprintable character in it. I can copy and paste the file's content to a new file and get the same error.
Question: Is it possible to introduce checking in the g code interpreter that would catch (or alert) a non-printable character that is not a carriage return, line feed or space? It is not easy finding an error that is there but you can't see it.
-
@jens55
Checking for invalid hidden characters is a valid request.
Not sure whether there's anything that is valid in some sections but not others though.However the problem is likely your text editor is not set to use Linux/Unix style line endings (or you have copy/pasted code)
Also you can set your editor (if it's not VERY a basic) to display control characters line carriage returns and line feeds as special characters so that you can easily see anything "out of place" -
@OwenD said in Corrupt (sort of) file error:
display control characters line carriage returns and line feeds as special characters so that you can easily see anything "out of place"
It would be nice if the DWC editor had that option.
-
@Phaedrux said in Corrupt (sort of) file error:
@OwenD said in Corrupt (sort of) file error:
display control characters line carriage returns and line feeds as special characters so that you can easily see anything "out of place"
It would be nice if the DWC editor had that option.
Yes it would be a good idea as that's usually the first editor used when there's an issue
-
@OwenD said in Corrupt (sort of) file error:
However the problem is likely your text editor is not set to use Linux/Unix style line endings (or you have copy/pasted code)
Also you can set your editor (if it's not VERY a basic) to display control characters line carriage returns and line feeds as special characters so that you can easily see anything "out of place"I use gedit under Ubuntu as my normal editor but I don't know what is used when I start a new file in the editor in the DWC web page.
-
@jens55 can you attach the file to a post, so that we can see what the non=printable character is?
-
The file was generated using DWC's 'New file' button while displaying my Macro files. I then copied and pasted the section that contains the mystery character from an existing macro. I then added the last line (M291) to clearly deliniate where the character is. It is in the line just prior to the last line (M291).
I verified that running this will get me the M292 Bad command error.File was 'uploaded' to my computer from DWC using the 'upload macro file' button
File was renamed (added .txt extension) and attached to this post via the 'upload file' icon in this web page. -
@jens55 thanks. The extra character comprises bytes C2 A0 which is Unicode code point U+00A0 which codes for non-breaking space. No wonder it wasn't visible! I'm guessing that there is no easy way to make it visible in a standard editor component.
-
Thinking back a ways, I think I ran into this kind of error once or twice before but never chased it down to an unprintable character. I believe I ended up cutting out a section of code and re-typing it.
I have absolutely zero clue as to how the character in question managed to creep in. I am pretty sure that all my interaction with the code was through the DWC window.