Skip to content

Commit

Permalink
Merge pull request #26 from Philmod/fix-hovering
Browse files Browse the repository at this point in the history
Hovering state if no command
  • Loading branch information
eschnou committed Jun 13, 2013
2 parents 0b68222 + 2e70414 commit efc3033
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions plugins/pilot/public/js/pilot.js
Expand Up @@ -164,11 +164,17 @@ PILOT_ACCELERATION = 0.04;
delete this.keys[key];

// Send a command to set the motion in this direction to zero
var cmd = Keymap[key];
this.cockpit.socket.emit("/pilot/" + cmd.ev, {
action : cmd.action,
speed : 0
});
if (Object.keys(this.keys).length > 0) {
var cmd = Keymap[key];
this.cockpit.socket.emit("/pilot/" + cmd.ev, {
action : cmd.action,
speed : 0
});
} else { // hovering state if no more active commands
this.cockpit.socket.emit("/pilot/drone", {
action : 'stop'
});
}
}

/*
Expand Down

0 comments on commit efc3033

Please sign in to comment.