Back to the Gcode Dictionary
M587: Add WiFi host network to remembered list, or list remembered networks
This command must not be used in the config.g file. In SBC mode (v3.3 and later) it is not possible to configure different IP addresses per SSID
- S"ccc" Network SSID (case sensitive)
- P"ccc" Network password (case sensitive)
- Inn.nn.nn.nn (optional) IP address to use when connected to this network. If zero or not specified then an IP address will be acquired via DHCP.
- Jnn.nn.nn.nn (optional) Gateway IP address to use when connected to this network.
- Knn.nn.nn.nn (optional) Netmask to use when connected to this network
- Lnn.nn.nn.nn (optional, supported only by DuetPi + DSF v3.3 or newer) DNS server to use
- Cnnn (supported only by DuetPi + DSF v3.3 or newer) Country code for the WiFi adapter, only required if not set before
The SSID and password must always be enclosed in double quotation marks.
Many programs used to send GCodes convert all characters to uppercase. In firmware 1.19.2 and later, within any quoted string you can use a single-quote character to indicate that the following character should be changed to lowercase. For example, M587 S"ABC" P"P'A'S'SW'O'R'D" would specify that the password is "PassWord". Use two single quote characters to represent one actual single quote character in the password or in the SSID. For example, if your SSID is "Pete's network" then enter "Pete''s network".
The use of special characters in the SSID cannot be guaranteed to work. In general it's best to avoid most special characters. Spaces, periods, dashes, underscores, and other punctuation is likely ok, but special characters on the number keys likely are not safe. (@#$%^&*). If you are having troubles adding your SSID, try a simplified version with only letters and numbers.
M587 with no parameters lists all the remembered SSIDs, but not the remembered passwords.
The M587 command will fail if the WiFi module has not yet been taken out of reset. So if the WiFi module has not been started, send M552 S0 to put it in idle mode first.
Important! Do not use M587 within config.g. As well as being a security hazard, writing the access point parameters to WiFi chip every time you start the Duet may eventually wear out the flash memory. Also, the wifi module does not get enabled until the end of running config.g. It is better to use a macro to send M587 (source: https://forum.duet3d.com/post/42798)