Skip to content

Commit

Permalink
Added tile lock-out mechanism to delete operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Toledo committed Jun 8, 2017
1 parent 74b1c7b commit 1640222
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,27 @@ function Bell(template, id, rotate_to_deg) {
//enable bell tile on screen
this.enable = function(){
$(this.tile).find('*').removeAttr('disabled');
//$(this.tile).removeClass('loader');
};
//add this bell to server
this.add = function(){
this.disable();
this.disable(); //disable tile
addServo(this.id, this.hat, this.channel, this.init_deg, this.rotate_to_deg, function(){
thisBell.enable();
thisBell.enable(); //re-enable tile once successfully added on server
});
};
//delete this bell from server and screen
this.delete = function(){
deleteServo(this.id);
this.tile.remove();
//console.log("removed bell " + id);
this.disable(); //disable tile
deleteServo(this.id, function(){
thisBell.tile.remove(); //remove from screen once successfully deleted from server
});
};
//update this bell with given rotate_to_deg value
this.update = function(rotate_to_deg){
this.disable();
this.disable(); //disable tile
updateServo(this.id, this.hat, this.channel, this.init_deg, this.rotate_to_deg, function(){
thisBell.enable();
thisBell.enable(); //re-enable tile once successfully updated on server
});
//console.log("updated bell " + this.id + " on server... strike angle is " + this.rotate_to_deg);
};
//set strike angle
this.setStrikeAngle = function(angle){
Expand Down

0 comments on commit 1640222

Please sign in to comment.