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

    Variable "already exists"

    Scheduled Pinned Locked Moved
    Gcode meta commands
    5
    30
    1.3k
    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.
    • DonStaufferundefined
      DonStauffer @fcwilt
      last edited by

      @fcwilt Oh, wow.

      What I've been doing is editing config.g - just putting in a space, deleting it, then saving it, and telling it yes to restart the board. I just now did that to run another print, and I got a weird error message:

      Error: Failed to rename file 0:/sys/config.g.part: file not found

      And I couldn't see the Duet on the web interface. So I turned it off and on again (even pulled the plug) and when it comes on you hear the fans on rather loud (odd) and the web interface doesn't see it. The PanelDue does seem to work. Not sure what to do with this. I do have a backup of config.g on my PC.

      Phaedruxundefined 1 Reply Last reply Reply Quote 0
      • DonStaufferundefined
        DonStauffer @fcwilt
        last edited by

        @fcwilt I think maybe my SD card just died or something.

        1 Reply Last reply Reply Quote 0
        • fcwiltundefined
          fcwilt @DonStauffer
          last edited by

          @donstauffer said in Variable "already exists":

          @fcwilt I was thinking it might be "neater" just to do an if exists(var.Name). But if this is a bug, I wanted to report it. It doesn't seem like how you'd expect it to be intended.

          I don't know if it is a bug or not - @dc42 would likely know or could find out.

          As to testing for the existence, you know that the test will always be true for every print after the first whenever the printer powers up or is reset.

          So, assuming it's not a bug, to my way of thinking it is cleaner to use globals.

          Someone has asked for a way to "un-create" a variable which would also solve this sort of problem.

          Frederick

          Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

          DonStaufferundefined 2 Replies Last reply Reply Quote 0
          • DonStaufferundefined
            DonStauffer @fcwilt
            last edited by

            @fcwilt Right now I'm concerned about that fact that all the files on the printer appear to be gone. I shut it off and popped the SD card out and pushed it back in, but still nothing. The printer comes on, and the BLTouch self-tests, and the fans go way up, and the PanelDue comes up. But I can't seem to do anything with it. No web interface, and config.g used to turn on my LED lights when you turned it on, but they're not coming on now. I wonder if connecting via USB might help.

            fcwiltundefined 1 Reply Last reply Reply Quote 0
            • DonStaufferundefined
              DonStauffer @fcwilt
              last edited by

              @fcwilt Was able to connect via USB and an M20 shows my print files. So the SD card is still working. Must be that config.g is messed up. Not sure how to confirm that though.

              1 Reply Last reply Reply Quote 0
              • fcwiltundefined
                fcwilt @DonStauffer
                last edited by

                @donstauffer said in Variable "already exists":

                @fcwilt Right now I'm concerned about that fact that all the files on the printer appear to be gone. I shut it off and popped the SD card out and pushed it back in, but still nothing. The printer comes on, and the BLTouch self-tests, and the fans go way up, and the PanelDue comes up. But I can't seem to do anything with it. No web interface, and config.g used to turn on my LED lights when you turned it on, but they're not coming on now. I wonder if connecting via USB might help.

                Can you connect the SD card to your computer and check the files that are on it?

                Frederick

                Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                DonStaufferundefined 3 Replies Last reply Reply Quote 0
                • DonStaufferundefined
                  DonStauffer @fcwilt
                  last edited by

                  @fcwilt Good idea.

                  1 Reply Last reply Reply Quote 0
                  • DonStaufferundefined
                    DonStauffer @fcwilt
                    last edited by

                    @fcwilt The files are there, including config.g, which shows zero bytes!

                    kb58undefined 1 Reply Last reply Reply Quote 0
                    • DonStaufferundefined
                      DonStauffer @fcwilt
                      last edited by

                      @fcwilt And config.g.bak with a date an hour earlier. Maybe I should rename config.g, then rename config.g.bak to config.g. Or copy it. Not sure which.

                      fcwiltundefined 1 Reply Last reply Reply Quote 0
                      • fcwiltundefined
                        fcwilt @DonStauffer
                        last edited by

                        @donstauffer said in Variable "already exists":

                        @fcwilt And config.g.bak with a date an hour earlier. Maybe I should rename config.g, then rename config.g.bak to config.g. Or copy it. Not sure which.

                        I've seen that happen before.

                        The backup file should contain everything but the very last edits you made.

                        If config.g is empty then you can delete it (or rename it) and then rename the backup - all should be good except for the lost edits.

                        Frederick

                        Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                        DonStaufferundefined 3 Replies Last reply Reply Quote 0
                        • DonStaufferundefined
                          DonStauffer @fcwilt
                          last edited by

                          @fcwilt First thing I just copied the entire SD card to my raid array. Then I renamed the files. Now I'll see what happens.

                          1 Reply Last reply Reply Quote 0
                          • DonStaufferundefined
                            DonStauffer @fcwilt
                            last edited by

                            @fcwilt OK, that worked. And the last couple changes I made were to add and then delete a space to the file, so essentially, the backup has everything. Wow. That shouldn't have happened.

                            1 Reply Last reply Reply Quote 0
                            • DonStaufferundefined
                              DonStauffer @fcwilt
                              last edited by

                              @fcwilt Anyhow, nice little bit of drama. Thanks for keeping me grounded there for a bit.

                              As to variables, I may just put in the test because it won't clutter the globals, and the whole purpose for them being in the file was that you could change them as needed. They function like constants in a normal language. So making them global would be counterproductive for this purpose.

                              But I wonder if this is by design. I doubt it.

                              fcwiltundefined 1 Reply Last reply Reply Quote 0
                              • fcwiltundefined
                                fcwilt @DonStauffer
                                last edited by

                                @donstauffer said in Variable "already exists":

                                @fcwilt Anyhow, nice little bit of drama. Thanks for keeping me grounded there for a bit.

                                As to variables, I may just put in the test because it won't clutter the globals, and the whole purpose for them being in the file was that you could change them as needed. They function like constants in a normal language. So making them global would be counterproductive for this purpose.

                                But I wonder if this is by design. I doubt it.

                                If you are going to do the tests it might be easier to read if you had a section where you just tested and created the variables if needed and another section where you just set them knowing they either already exist OR they have just been created by the section above.

                                Otherwise you would have a bunch of if/else where the needed value appeared twice, once for the creation and once for the setting.

                                Frederick

                                Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                                DonStaufferundefined 1 Reply Last reply Reply Quote 0
                                • kb58undefined
                                  kb58 @DonStauffer
                                  last edited by kb58

                                  @donstauffer said in Variable "already exists":

                                  @fcwilt The files are there, including config.g, which shows zero bytes!

                                  Interesting... I had this exact thing happen several weeks ago and am pretty sure it was due to a corrupted write. I had to delete config.g and renamed config.bak as config.g. The other way was to remove the SD drive and fix it in the PC - I always keep duplicates of the SD files on the PC for just this sort of reason.

                                  Scratch-built 350mmx350mm coreXY, linear rails, ballscrews, 3 Z axis, Duet3 6HC, v3.3, Tool Board v1.1, BondTech LGX + Mosquito hot end

                                  1 Reply Last reply Reply Quote 1
                                  • DonStaufferundefined
                                    DonStauffer @fcwilt
                                    last edited by

                                    @fcwilt I see what you mean. Create them with dummy values like zero, if they need to be created. That way the values only need to be tracked in one place. Not sure if you can create them without assigning a value. The documentation seems to say not.

                                    fcwiltundefined 1 Reply Last reply Reply Quote 0
                                    • Phaedruxundefined
                                      Phaedrux Moderator @DonStauffer
                                      last edited by

                                      @donstauffer said in Variable "already exists":

                                      What I've been doing is editing config.g - just putting in a space, deleting it, then saving it, and telling it yes to restart the board.

                                      Kind of a weird way to do it. Hitting the emergency stop button in DWC. Or sending M999 for a soft reset would be cleaner.

                                      How often do you think you've done that to reset the board? I wonder if you've triggered a bug that fails to write the config.g.

                                      Z-Bot CoreXY Build | Thingiverse Profile

                                      DonStaufferundefined 1 Reply Last reply Reply Quote 0
                                      • DonStaufferundefined
                                        DonStauffer @Phaedrux
                                        last edited by

                                        @phaedrux Maybe a half dozen times a day. Usually I turn the machine off over night if I'm not printing anything long. I didn't know about M999 and I sort of thought emergency stop just kind of hung the machine and I had to turn it off anyway. Not sure. I haven't done it much.

                                        1 Reply Last reply Reply Quote 0
                                        • Phaedruxundefined
                                          Phaedrux Moderator
                                          last edited by

                                          The emergency stop button basically runs M112 to do a full halt, and then resets the firmware with M999.

                                          https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_M112_Emergency_Stop

                                          https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_M999_Restart

                                          Z-Bot CoreXY Build | Thingiverse Profile

                                          1 Reply Last reply Reply Quote 0
                                          • Phaedruxundefined
                                            Phaedrux Moderator
                                            last edited by

                                            Was there anything unique to the time that it erased the config.g file?

                                            For the sake of completeness, could you share the config.g and the results of M122?

                                            Z-Bot CoreXY Build | Thingiverse Profile

                                            DonStaufferundefined 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA