Skip to content
Snippets Groups Projects
Commit 196f34dd authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

trigger event when ready for next line

parent 0dd890b9
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,6 @@ define(['jquery', 'underscore', 'backbone', 'text!PositionControlPanelView.html' ...@@ -27,7 +27,6 @@ define(['jquery', 'underscore', 'backbone', 'text!PositionControlPanelView.html'
_renderPositionData: function(){ _renderPositionData: function(){
var machineState = this.model.getMachineState(); var machineState = this.model.getMachineState();
console.log(machineState.toJSON());
$("#positionData").html(_.template(positionTemplate)(machineState.toJSON())); $("#positionData").html(_.template(positionTemplate)(machineState.toJSON()));
}, },
......
...@@ -23,7 +23,6 @@ define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorVie ...@@ -23,7 +23,6 @@ define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorVie
this.listenTo(serialComm, "change:lastMessageReceived", this._updateIncomingMessage); this.listenTo(serialComm, "change:lastMessageReceived", this._updateIncomingMessage);
this.listenTo(serialComm, "change:lastMessageSent", this._updateOutgoingMessage); this.listenTo(serialComm, "change:lastMessageSent", this._updateOutgoingMessage);
this.listenTo(serialComm, "change:baudRate change:portName", this.render); this.listenTo(serialComm, "change:baudRate change:portName", this.render);
this.listenTo(serialComm, "change:baudRate", function(){console.log("got it")});
this.listenTo(serialComm, "change:connected", function(){ this.listenTo(serialComm, "change:connected", function(){
if (!serialComm.get("connected")) this._close(); if (!serialComm.get("connected")) this._close();
}); });
...@@ -115,7 +114,6 @@ define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorVie ...@@ -115,7 +114,6 @@ define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorVie
}, },
render: function(){ render: function(){
console.log("render");
if ($("input[type=text]").is(":focus")) return; if ($("input[type=text]").is(":focus")) return;
this.$el.html(this.template(this._makeTemplateJSON())); this.$el.html(this.template(this._makeTemplateJSON()));
}, },
......
...@@ -23,15 +23,23 @@ define(['underscore', 'backbone'], function(_, Backbone){ ...@@ -23,15 +23,23 @@ define(['underscore', 'backbone'], function(_, Backbone){
var val = data["pos" + key]; var val = data["pos" + key];
if (val !== null && val !== undefined) self.set(key, val); if (val !== null && val !== undefined) self.set(key, val);
}); });
if (data.stat !== null && data.stat !== undefined) this.set("status", data.stat); if (data.stat !== null && data.stat !== undefined) {
this.set("status", data.stat);
if (data.stat == 1 || data.stat == 3 || data.stat == 4) this._triggerNextCommand();
}
}, },
setFooterStatus: function(data){ setFooterStatus: function(data){
if (data[1] == 0){//ok status if (data[1] == 0){//ok status
this.set("status", 3); this.set("status", 3);
this._triggerNextCommand();
} else this.set("status", 10); } else this.set("status", 10);
}, },
_triggerNextCommand: function(){
this.trigger("readyForNextCommand");
},
refresh: function(){ refresh: function(){
this.set(this.defaults); this.set(this.defaults);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment