-
Notifications
You must be signed in to change notification settings - Fork 158
Convert Bebop to client instead of access point
To make the drone join an access point instead of broadcasting its own SSID, the following script can be put in /bin/onoffbutton/longpress_0.sh
.
When the power-button is pressed long, the drone will then connect to the access point. Make sure the AP has no encryption enabled. (WEP is possible if script is adapted, WPA2 is untested but will most likely decrease throughput a lot)
Eventually, this can be put inside /etc/init.d/ to apply this configuration at startup. When used in this configuration, the drone might become unreachable without a software reset when the AP cannot be reached!
The drone will automatically request an IP using DCHP. A static IP can be obtained by adjusting the ipconfig
command, or using MAC filtering using the access point.
Remark: apparently the adapter name changed in newest firmwares from eth0 to wifi_bcm. Make sure to check the adapter using ifconfig
and change the script accordingly.
ESSID=DroneAP
DEFAULT_WIFI_SETUP=/sbin/broadcom_setup.sh
# Set light to orange
BLDC_Test_Bench -G 1 1 0 >/dev/null
# Check whether drone is in access point mode
if [ $(bcmwl ap) -eq 1 ]
then
echo "Trying to connect to $ESSID" | logger -s -t "LongPress" -p user.info
# Bring access point mode down
$DEFAULT_WIFI_SETUP remove_net_interface
# Configure wifi to connect to given essid
ifconfig eth0 down
bcmwl down
bcmwl band auto
bcmwl autocountry 1
bcmwl up
bcmwl ap 0
bcmwl join ${ESSID}
ifconfig eth0 up
# Run dhpc client
udhcpc -b -i eth0 --hostname=$(hostname)
else
# Should make drone an access point again
# Bug: does not work yet (turn drone off & on instead)
$DEFAULT_WIFI_SETUP create_net_interface
fi
# Set light back to green after 1 second
(sleep 1; BLDC_Test_Bench -G 0 1 0 >/dev/null) &
Thanks goes out to Yasser Deceukelier who helped me develop this script.