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

    Macro to update PanelDue Firmware

    Scheduled Pinned Locked Moved
    Gcode meta commands
    7
    11
    628
    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.
    • OwenDundefined
      OwenD
      last edited by OwenD

      I've done this macro to update paneldue firmware
      Requires RRF 3.2beta4 or later
      Requires paneldue firmware 3.2.4 or later be renamed to PanelDueFirmware.bin and placed in the 0:/sys directory.

      Unfortunately there's no elegant way to check if the file exists yet, so I use M291 to ask.

      ; update_paneldue.g  **** requires RRF firmware version 3.2-beta4.1 or higher to work. ****
      M291 R"File check" P"Has PanelDueFirmware,bin been placed in 0:/sys directory?" S3
      G4 S2
      M997 S4 ; update panel due firmware - file "PanelDueFirmware.bin" must exist in 0:/sys/
      if result = 0
      	G4 S6 ; wait for paneldue reboot
      	M291 R"Update complete" P"Update successful, Press OK to delete update file & reboot in 5 seconds" S3
      	M30 "0:/sys/PanelDueFirmware.bin" ; delete update file
      	if result = 0
      		echo "File deleted"
      	else
      		echo "File could not be deleted"
      	G4 S5 ; wait 5 seconds before reboot
      	M999 ; software reboot
      elif result = 1
      	M291 R"Update Suspect" P"Update returned a warning code, Press OK to reboot in 5 seconds" S3
      	G4 S5 ; wait 5 seconds before reboot
      	M999 ; software reboot
      elif result = 2
      	M291 R"Update Failed" P"Update failed,  Press OK to reboot in 5 seconds" S3
      	G4 S5 ; wait 5 seconds before reboot
      	M999 ; software reboot
      

      update_paneldue.g

      zombiRonundefined 1 Reply Last reply Reply Quote 1
      • OwenDundefined
        OwenD
        last edited by

        It does strike me I've spent 30 minutes writing a macro to save me five minutes looking up the correct G code to do a job that is required only a few times a year 😂😂

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

          It's best not to think about that too much...

          Z-Bot CoreXY Build | Thingiverse Profile

          1 Reply Last reply Reply Quote 0
          • Vetiundefined
            Veti
            last edited by

            https://xkcd.com/1205/

            1 Reply Last reply Reply Quote 1
            • percarundefined
              percar
              last edited by

              Great I appreciate your effort and I am sure a lot of people will give you a nice pat on the back....I would buy you a beer but not sure it would make it to you in one piece

              1 Reply Last reply Reply Quote 0
              • A Former User?
                A Former User
                last edited by

                One good thing came out of it; or I presume this was the trigger; a feature request to rest for the presence of a given file, so its not all bad:)

                1 Reply Last reply Reply Quote 0
                • zombiRonundefined
                  zombiRon @OwenD
                  last edited by zombiRon

                  @OwenD Just thought I'd offer my solution using M38 to check existence of the file and offer the user a chance to check the Hash??

                  M38 "0:/sys/PanelDueFirmware.bin"
                  if result == 0
                      M291 R"PanelDue Upgrade" P"New firmware has been detected, hash has been output to the console. OK to update?" S3
                      ; M997 etc...
                  elif result == 2
                      echo "No PanelDue firmware detected"
                  
                  1 Reply Last reply Reply Quote 1
                  • A Former User?
                    A Former User
                    last edited by

                    Hey there,

                    how does this work with the new "M997 S4" can it be combined to check first and then call M997 S4 or is M997 S4 also error-tolerant regarding the file beeing in place and good? Or became a version of the posted macros here, what is behind M997 S4?

                    Regards

                    zombiRonundefined 1 Reply Last reply Reply Quote 0
                    • zombiRonundefined
                      zombiRon @A Former User
                      last edited by zombiRon

                      @LB it will just error if there's no update file, so you could check the return of that alone, but I think @OwenD was meaning elegant in that there's no ERROR output in the console.

                      M997 S4 
                      Error: M997: File 0:/sys/PanelDueFirmware.bin not found
                      
                      A Former User? 1 Reply Last reply Reply Quote 0
                      • A Former User?
                        A Former User @zombiRon
                        last edited by

                        @zombiRon said in Macro to update PanelDue Firmware:

                        @LB it will just error if there's no update file, so you could check the return of that alone, but I think @OwenD was meaning elegant in that there's no ERROR output in the console.

                        M997 S4 
                        Error: M997: File 0:/sys/PanelDueFirmware.bin not found
                        

                        Thanks! Hash might be good for the company-admin to check if they want to -> will add that!

                        1 Reply Last reply Reply Quote 0
                        • zombiRonundefined
                          zombiRon
                          last edited by

                          Here's where I've got to now, adding this at the beginning of config.g and making sure it's AFTER network/HTTP is started, but before the rest of the machine config.

                          If a PanelDueFirmware.bin is detected a request is pushed to the PanelDue and DWC if connected at the time to update.

                          If DWC is connected, it also shows progress and results in console.

                          M552 S1										; Enable network
                          M586 P0 S1									; Enable HTTP
                          M586 P1 S0									; Enable FTP
                          M586 P2 S1									; Enable Telnet
                          M38 "sys/PanelDueFirmware.bin"				; compute hash of file if exists
                          if result == 0
                          	M291 R"PanelDue Update" P"Update available, checksum is available on console, OK to flash?" S3"
                          	M997 S4									; flash PanelDue
                          	if result == 0
                          		G4 S6 								; wait for paneldue reboot
                          		M30 "0:/sys/PanelDueFirmware.bin"	 	; delete update file
                          		if result != 0
                          			echo "PanelDue update file could not be removed following successful flash"
                          		M291 R"PanelDue Update" P"Update successful, see console for details" S2 T0
                          	else
                          		M291 R"PanelDue Update" P"Update ERROR, see console for details" S2 T0
                          

                          9c717d02-3f7f-406f-8025-c074d2fb4cdc-image.png

                          If an update is declined, the file will need to be removed manually as cancel will abort further processing of config.g.

                          I did consider deleting the file on cancel and then rebooting, but I thought that if I'd declined the updated due to HASH mismatch, then I'd prob want the machine to stay as it is so I can troubleshoot. If you'd rather it deleted and rebooted, add the following after the last M291 making sure of the same indentation.

                          		M30 "0:/sys/PanelDueFirmware.bin"
                          		M999
                          
                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post
                          Unless otherwise noted, all forum content is licensed under CC-BY-SA