• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

M911 "string too long" error

Scheduled Pinned Locked Moved Solved
General Discussion
3
5
181
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    NeoDue
    last edited by NeoDue 21 Apr 2024, 15:42

    I want to save one global variable in case of a power loss since this is not done automatically, and I expected this code to do the job:

    M911 S22.0 R23.5 P"M913 X0 U0 Y0 Z40 E0:0 G91 M83 echo >""Modus.g"" ""set global.Modus = ""^{global.Modus} G1 Z1 F12000"
    

    (double quotes are set for every quote as noted by @dc42 in this post)

    But I get a "string too long" error - and I wonder why. The whole command has 99 characters which is well below the 256 characters maximum of RRF 3.5.1. Can anyone point me towards my error?

    undefined 1 Reply Last reply 21 Apr 2024, 16:35 Reply Quote 0
    • undefined NeoDue marked this topic as a question 21 Apr 2024, 15:43
    • undefined
      gloomyandy @NeoDue
      last edited by 21 Apr 2024, 16:35

      @NeoDue The current max string length of the P parameter to M911 is 80 characters, I make your string to be 90+.

      undefined 1 Reply Last reply 21 Apr 2024, 17:19 Reply Quote 0
      • undefined
        NeoDue @gloomyandy
        last edited by 21 Apr 2024, 17:19

        @gloomyandy Just 80 characters... that explains it. Let's see how I can keep that. Thank you!

        undefined 1 Reply Last reply 21 Apr 2024, 18:04 Reply Quote 0
        • undefined NeoDue has marked this topic as solved 21 Apr 2024, 17:19
        • undefined
          NeoDue @NeoDue
          last edited by NeoDue 21 Apr 2024, 18:04

          If anyone happens to have the same issue: use the file name as variable. That complicates somewhat the code in resurrect-prologue.g (you need to check for each possible file name if that file exists and recreate the associated variable(s) instead of just executing it), but shortens the string significantly:

          M913 X0 U0 Y0 Z40 E0:0 echo >{""r""^global.Modus} G91 M83 G1 Z1 F12000
          

          (I added "r" as a bit of luxury 😇 to place the file close to "resurrect.g", since the variable only consists of a number in my case. Using only the variable gives you six precious characters more)

          undefined 1 Reply Last reply 22 Apr 2024, 07:08 Reply Quote 0
          • undefined
            dc42 administrators @NeoDue
            last edited by 22 Apr 2024, 07:08

            @NeoDue I've increased the maximum length of that string in the source code. In the next release it will be limited only by the maximum GCode command length, which is currently 256 characters.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            1 Reply Last reply Reply Quote 1
            4 out of 5
            • First post
              4/5
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA