DSF 2.2.0 long comments in gcode causes an exception
-
Hi, if I attempt to print or simulate a file with a long comment line I get an exception and the print/simulation is cancelled. The exception is given below:
May 8 21:06:40 duet3 DuetControlServer[1908]: [info] Starting file print May 8 21:06:40 duet3 DuetControlServer[1908]: [error] Code ;12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 has thrown an exception May 8 21:06:40 duet3 DuetControlServer[1908]: System.ArgumentException: Failed to serialize code May 8 21:06:40 duet3 DuetControlServer[1908]: ---> System.ArgumentException: Destination is too short. (Parameter 'destination') May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.SPI.Serialization.Writer.WriteCode(Span`1 to, Code code) in /home/pi/DuetSoftwareFramework/src/DuetControlServer/SPI/Serialization/Writer.cs:line 133 May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.SPI.DataTransfer.GetCodeSize(Code code) in /home/pi/DuetSoftwareFramework/src/DuetControlServer/SPI/DataTransfer.cs:line 523 May 8 21:06:40 duet3 DuetControlServer[1908]: --- End of inner exception stack trace --- May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.SPI.DataTransfer.GetCodeSize(Code code) in /home/pi/DuetSoftwareFramework/src/DuetControlServer/SPI/DataTransfer.cs:line 527 May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.SPI.Channel.Processor.ProcessCode(Code code) in /home/pi/DuetSoftwareFramework/src/DuetControlServer/SPI/Channel/Processor.cs:line 280 May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.SPI.Interface.ProcessCode(Code code) in /home/pi/DuetSoftwareFramework/src/DuetControlServer/SPI/Interface.cs:line 211 May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.Commands.Code.Process() in /home/pi/DuetSoftwareFramework/src/DuetControlServer/Commands/Code.cs:line 412 May 8 21:06:40 duet3 DuetControlServer[1908]: at DuetControlServer.Commands.Code.ExecuteInternally() in /home/pi/DuetSoftwareFramework/src/DuetControlServer/Commands/Code.cs:line 336 May 8 21:06:40 duet3 DuetControlServer[1908]: [info] File: Optional macro file start.g not found May 8 21:06:40 duet3 DuetControlServer[1908]: [info] Starting macro file homeall.g on channel File May 8 21:06:51 duet3 DuetControlServer[1908]: [info] File: Optional macro files deployprobe0.g and deployprobe.g not found May 8 21:06:56 duet3 DuetControlServer[1908]: [info] File: Finished intermediate macro file deployprobe0.g May 8 21:06:56 duet3 DuetControlServer[1908]: [info] File: Optional macro files retractprobe0.g and retractprobe.g not found May 8 21:06:56 duet3 DuetControlServer[1908]: [info] Finished macro file homeall.g May 8 21:06:56 duet3 DuetControlServer[1908]: [error] (comment) has thrown an exception: [ArgumentException] Failed to serialize code May 8 21:06:57 duet3 DuetControlServer[1908]: [info] Aborted job file May 8 21:06:57 duet3 DuetControlServer[1908]: [info] Cancelled printing file 0:/gcodes/xytest3.gcode, print time was 0h 0m
The test file is given below:
G28 ;12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 G1 X0 Y0
Note that some slicers (like Prusa Slicer) generate long comment lines containing a version of the start and end gcode and other parameters. So this problem will cause gcode generated by those slicers to fail (luckily this is usually at the end of the file).
The same files seem to be handled fine when not using SBC. Perhaps long comments could be truncated before being sent to the firmware?
NOTE: I am using the LPC1768 version of RRF with SBC and DSF not a Duet3 board. However I think that this is a general issue and is not specific to the LPC build. On that topic a small plea to not solve this by simply making the buffers larger (at least on the firmware side), we are already struggling for space!
-
Thanks, I've asked @chrishamm to look into this.
-
Thanks, let me know if you need any more information. @jay_s_uk has reproduced this with a Duet3 so it looks like it is not LPC1768 specific.
-
Thanks for the report, I'll truncate whole-line comments from DSF to RRF if they exceed 100 characters.
-
@chrishamm Thanks makes sense to me. May I also ask what the thought is behind sensing comments to the firmware? I assume there must be some situations in which the firmware interprets them in some way?
-
@gloomyandy I've added support for it because whole-line comments are used for object identification.
-
Ah that makes sense! Thanks for the info Chris.