I prefer to put the M587 SSID and Password command in a "SETNETWORK" macro which I write to the SD card using a PC, and then run the macro from PanelDue.
If it's the version 3.0 PanelDue board, then the only way I can think of is to flash it with the wrong size firmware (e.g. the 5" firmware), start it up (which will cause it to delete the touch calibration when it detects the screen size change), then flash it with the correct firmware.