Macro to update PanelDue Firmware
-
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
-
It's best not to think about that too much...
-
-
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
-
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:)
-
@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"
-
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
-
@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
-
@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!
-
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
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