voodootikigod / node-rolling-spider

A library for controlling a Parrot Rolling Spider drone via BLE.
Other
254 stars 112 forks source link

Refactor and add callbacks to navigation functions #29

Closed garetht closed 9 years ago

garetht commented 9 years ago

This pull request

The callbacks allow code similar to this to be written without the need for manual timeouts (using Q.js, and where q is a function that converts a callback-based function into a promise-based one).

Q.spawn(function*() {
  yield q(drone.connect);
  yield q(drone.setup);
  drone.calibrate();
  drone.startPing();
  yield q(drone.takeoff);
  yield Q.delay(1000);
  yield q(drone.up);
  yield q(drone.down);
  yield q(drone.land);
});
voodootikigod commented 9 years ago

Love it! I am driving up I-95 and will merge when I am home.