Here is my script for Auto scan best channel from 1 to 13 (set unused channel), it will patch RC and drone as same time, then show wifi detail result after patch completed.
.
.
.
iwinfo
echo "Patch Completed, Enjoy."
fi
Here is the script log, I save it at /etc/init.d when test, so pls ignore the path
==============================================
/etc/init.d # ./setchan.sh
Checking Connection with Phantom 3 Standard / 4K . . .
Connection - OK.
Channel 1 - In Use
Channel 2 - In Use
Channel 3 - In Use
Channel 4 - In Use
Channel 5 - In Use
Channel 6 - In Use
Channel 7 - In Use
Channel 8 - In Use
Channel 9 - In Use
Channel 10 - In Use
Channel 11 - In Use
Channel 12 - Not In Use
Set CH to 12
Try To Setting Channel = 12 . . .
Patched channel=12
Checking Connection with Phantom 3 Standard / 4K . . .
Connected . . .
Patching Phantom 3 Standard / 4K at 192.168.1.2 . . .
Entering character mode
Escape character is '^]'.
BusyBox v1.22.1 (2015-06-29 19:28:31 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # iw reg get
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 17), (N/A)
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)
/ # iw reg set BO
/ # iw reg get
country BO: DFS-JP
(2402 - 2482 @ 40), (N/A, 30), (N/A)
(5735 - 5835 @ 80), (N/A, 30), (N/A)
/ # iw dev wlan0 set txpower limit 2700
/ #
Patching Phantom 3 Standard / 4K - RC . . .
Restarting AP, it may take a moment . . .
Configuration file: /var/run/hostapd-phy0.conf
Using interface wlan0 with hwaddr 60:60:1f:0b:d8:db and ssid "GaryKan-P3"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
Checking Final Result at 192.168.1.2 . . .
Entering character mode
Escape character is '^]'.
BusyBox v1.22.1 (2015-06-29 19:28:31 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # iwinfo
wlan0 ESSID: "GaryKan-P3"
Access Point: 60:60:1F:0B

8

B
Mode: Client Channel: 12 (2.467 GHz)
Tx-Power: 27 dBm Link Quality: 70/70
Signal: -37 dBm Noise: -95 dBm
Bit Rate: 130.0 MBit/s
Encryption: WPA2 PSK (CCMP)
Type: nl80211 HW Mode(s): 802.11abgn
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
/ #
Checking Final Result at RC . . .
wlan0 ESSID: "GaryKan-P3"
Access Point: 60:60:1F:0B

8

B
Mode: Master Channel: 12 (2.467 GHz)
Tx-Power: 27 dBm Link Quality: 65/70
Signal: -45 dBm Noise: -95 dBm
Bit Rate: 65.0 MBit/s
Encryption: WPA2 PSK (CCMP)
Type: nl80211 HW Mode(s): 802.11abgn
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
wlan0.sta1 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master (VLAN) Channel: 12 (2.467 GHz)
Tx-Power: 27 dBm Link Quality: 70/70
Signal: -39 dBm Noise: -95 dBm
Bit Rate: 78.0 MBit/s
Encryption: none
Type: nl80211 HW Mode(s): 802.11abgn
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
Patch Completed, Enjoy.
/etc/init.d #
========================================
Log for execute with INCORRECT User argument input
===========================================
/etc/init.d # ./setchan.sh 555
Checking Connection with Phantom 3 Standard / 4K . . .
Connection - OK.
User argument = 555
Input Error : Channel must be 1 to 13 !!
/etc/init.d #
===============================
Log for execute with User argument input
=======================================
/etc/init.d # ./setchan.sh 13
Checking Connection with Phantom 3 Standard / 4K . . .
Connection - OK.
User argument = 13
Try To Setting Channel = 13 . . .
Patched channel=13
Checking Connection with Phantom 3 Standard / 4K . . .
Connected . . .
Patching Phantom 3 Standard / 4K at 192.168.1.2 . . .
Entering character mode
Escape character is '^]'.
BusyBox v1.22.1 (2015-06-29 19:28:31 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # iw reg get
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 17), (N/A)
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)
/ # iw reg set BO
/ # iw reg get
country BO: DFS-JP
(2402 - 2482 @ 40), (N/A, 30), (N/A)
(5735 - 5835 @ 80), (N/A, 30), (N/A)
/ # iw dev wlan0 set txpower limit 2700
/ #
Patching Phantom 3 Standard / 4K - RC . . .
Restarting AP, it may take a moment . . .
Configuration file: /var/run/hostapd-phy0.conf
Using interface wlan0 with hwaddr 60:60:1f:0b:d8:db and ssid "GaryKan-P3"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
Checking Final Result at 192.168.1.2 . . .
Entering character mode
Escape character is '^]'.
BusyBox v1.22.1 (2015-06-29 19:28:31 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/ # iwinfo
wlan0 ESSID: "GaryKan-P3"
Access Point: 60:60:1F:0B

8

B
Mode: Client Channel: 13 (2.472 GHz)
Tx-Power: 27 dBm Link Quality: 70/70
Signal: -33 dBm Noise: -95 dBm
Bit Rate: 57.8 MBit/s
Encryption: WPA2 PSK (CCMP)
Type: nl80211 HW Mode(s): 802.11abgn
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
/ #
Checking Final Result at RC . . .
wlan0 ESSID: "GaryKan-P3"
Access Point: 60:60:1F:0B

8

B
Mode: Master Channel: 13 (2.472 GHz)
Tx-Power: 27 dBm Link Quality: 70/70
Signal: -40 dBm Noise: -95 dBm
Bit Rate: 60.6 MBit/s
Encryption: WPA2 PSK (CCMP)
Type: nl80211 HW Mode(s): 802.11abgn
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
wlan0.sta2 ESSID: unknown
Access Point: 00:00:00:00:00:00
Mode: Master (VLAN) Channel: 13 (2.472 GHz)
Tx-Power: 27 dBm Link Quality: 70/70
Signal: -31 dBm Noise: -95 dBm
Bit Rate: 78.0 MBit/s
Encryption: none
Type: nl80211 HW Mode(s): 802.11abgn
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: yes PHY name: phy0
Patch Completed, Enjoy.
/etc/init.d #
==================================================================