Yes, there is a 5 second delay between disconnecting a device and reconnecting a device to the SkyController (There is actually the same delay in the drones, but there is a workaround inside to allow the a re-connection of the same device with a shorter time gap). It does not come from your application, and the result is the same with FreeFlight. We might port the workaround to SkyController at some point, but this is not a priority at the moment as this fix is mainly done to avoid a 5 sec delay when reconnecting to a drone after a connexion loss, and connection loss between a controller and the SkyController are expected to be rare.
Regarding the data to develop an app on the SkyController, here are some insights:
- You can connect to the SkyController using adb and the micro usb port after adding the "0x0525" vendor id to your adb_usb.ini file (and restarting your adb server). Note that booting the SkyController with the micro usb plugged will not work (in this case, the SkyController boots in flashing mode only), so you'll have to plus the cable after switching on the SkyController.
- Most of the things are integrated through Android:
- "Long range" wifi can be controlled by the Android WifiManager (except for country changes, see below)
- Gamepad will be reported as any other HID gamepad would be on Android (MotionEvents/KeyEvents)
- Sensors (GPS, Orientation) are accessed through the Android API (SensorEvents)
- Other things are not:
- The battery level is NOT available through the standard API. It is received as an axis of the gamepad. The conversion function is
float voltage = (float) (((battery + 1) * 1.25) * 1.6) + 9;, and its full a 12.5V, and empty at 9V (with of course a non-linear curve, as any Li-Po batteries have). This function works for both Bebop and Bebop 2 batteries.
- The LEDs have their own API, and the application is responsible for ALL leds (wifi leds are not set by the system). You can find an example of LED control script in bash in
/system/xbin/setleds. Setting leds does not require root permissions.
- The access point and wifi country config is done through a tool called
SCConfig, which has four main commands:
SCConfig get KEY [VALUE_IF_NOT_FOUND] works like
SCConfig set KEY VALUE works like
SCConfig dump will dump the current config
SCConfig remove KEY will remove the key from the config
- Before playing with the configuration, you should note the previous configuration, and restore it in case of a problem !
- The main config keys you might want to look at are:
KEEP_FF_RUNNING: If 1, the system will restart FreeFlight in case of an app crash. FreeFlight will set this to 1 when starting, and is started during boot. FreeFlight is installed as a system app (in
/system/) and should not be uninstalled. The FreeFlight versions on SkyController are NOT the same as on the Play Store. You can NOT reinstall an app this way ! To exit FreeFlight, when a screen is plugged, just press the back button on FreeFlight home screen and confirm the Exit dialog
WIFI_XXX (names without
_APPLIED): Sets the parameters for the access point (SSID, BAND [0 = 2.4GHz, 1 = 5GHz], CHANNEL, COUNTRY). These parameters are not applied immediately, but are applied when the following key is set to 1. Country setting is also applied to the Long Range wifi.
WIFI_REQUEST_UPDATE_SETTINGS: When setting this key to 1, the system will apply all
WIFI_XXX settings (and update the
_APPLIED settings). There will be wifi disconnections during application of the settings
- The key mappings for FreeFlight are different than the one you'll get on other apps: By default, the top-left joystick will be a mouse (with the click on the joystick), and the left joystick will be the DPAD, with takeoff button being the DPAD_CENTER as a fallback.
- If you application can support a full DPAD navigation, you can run
atmegCheckUpdate mode FREEFLIGHT from a root command line to switch back to the FreeFlight mode (DPAD on top-left JS). You can switch back to the default mode by running
atmegCheckUpdate mode HOME_SCREEN.
Hopefully, that should be enough informations to start playing around with the SkyController
(I may condensate all of this in a more formal paper at some point ...)