Commit 529e954d authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

serial monitor

parent e3fe3259
body {
overflow: hidden;
min-height: 400px;
min-width: 500px;
}
#sendSerialMessage {
......@@ -8,50 +10,73 @@ body {
border-radius: 0px;
border: none;
border-top: 2px solid #bdc3c7;
left: 0;
right: 0;
}
#serialMonitorOutput {
#wrapper {
width: 100%;
height: 100%;
overflow: auto;
padding: 10px 20px 100px 20px;
padding: 0 0 85px 0;
}
#serialMonitorOutput {
width: 100%;
height: 100%;
overflow: auto;
padding: 10px 20px;
font-family: Courier, monospace;
font-size: 13px;
line-height: 25px;
}
}
#serialMonitorView {
overflow: hidden;
}
#serialMonitorView {
display: block;
height: 100%;
overflow: hidden;
position:relative;
}
.btn {
.btn {
padding: 5px 10px;
margin: 5px 10px;
}
}
#controlPanel {
#controlPanel {
background: #eee;
width: 100%;
position: absolute;
bottom: 40px;
}
left: 0;
right: 0;
}
.checkbox input[type="checkbox"].custom-checkbox:checked + .icons .icon-checked, .radio input[type="checkbox"].custom-checkbox:checked + .icons .icon-checked, .checkbox input[type="radio"].custom-radio:checked + .icons .icon-checked, .radio input[type="radio"].custom-radio:checked + .icons .icon-checked {
.checkbox input[type="checkbox"].custom-checkbox:checked + .icons .icon-checked, .radio input[type="checkbox"].custom-checkbox:checked + .icons .icon-checked, .checkbox input[type="radio"].custom-radio:checked + .icons .icon-checked, .radio input[type="radio"].custom-radio:checked + .icons .icon-checked {
color: #888;
}
}
#autoscrollCheckbox {
#autoscrollCheckbox {
display: inline-block;
position: absolute;
margin-left: 10px;
margin-top: 12px;
}
}
span.incoming {
color: #999;
}
span.incoming {
color: #999;
}
span.outgoing {
font-weight:700;
}
span.outgoing {
font-weight:700;
}
\ No newline at end of file
#positionPanel {
width: 300px;
height: 100%;
background-color: red;
border-left: 2px solid #bdc3c7;
background-color: #fdfdfd;
display: inline-block;
}
\ No newline at end of file
#!/bin/sh
cd ~/Research/CBAStuff/git/dmdesign
git co master
git fetch upstream
git merge upstream/master
git push origin master
cd ~/Research/CBAStuff/git/archives/dma
git subtree pull -P Web/dmdesign fabpeople:people/amanda.ghassaei/dmdesign master --squash
......@@ -23,7 +23,7 @@ define(['jquery', 'underscore', 'backbone'], function($, _, Backbone){
this.popup.focus();
return;
}
this.popup = window.open('js/SerialMonitor/', '', 'height=400, width=400, titlebar=no, toolbar=no, menubar=yes, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
this.popup = window.open('js/SerialMonitor/', '', 'height=400, width=600, titlebar=no, toolbar=no, menubar=yes, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
var self = this;
$(this.popup).unload(function(){
self.onClose();
......
<div id="serialMonitorOutput"></div>
<div id="wrapper">
<div id="serialMonitorOutput"></div>
</div>
<div>
<div id="controlPanel">
<label id="autoscrollCheckbox" class="checkbox" for="autoscroll">
<input id="autoscroll" data-property="autoscroll" type="checkbox" <% if (autoscroll){ %> checked="checked"<% } %> value="" data-toggle="checkbox" class="serialMonitor custom-checkbox">
......@@ -6,4 +9,5 @@
Autoscroll</label>
<a href="#" id="clearMonitor" class="pull-right btn btn-lg btn-default">Clear</a><br/>
</div>
<input id="sendSerialMessage" value="" placeholder="Send Message" class="form-control" type="text">
\ No newline at end of file
<input id="sendSerialMessage" value="" placeholder="Send Message" class="form-control" type="text">
</div>
\ No newline at end of file
......@@ -8,5 +8,8 @@
<script data-main="main" src="../../dependencies/require/require.js"></script>
</head>
<html>
<div id="serialMonitorView"></div>
<div>
<div class="pull-right" id="positionPanel"></div>
<div id="serialMonitorView"></div>
</div>
</html>
\ No newline at end of file
......@@ -47,7 +47,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel
initialize: function(){
_.bindAll(this, "postProcess");
_.bindAll(this, "postProcess", "_stockSimulation");
//bind events
this.listenTo(appState, "change:currentTab", this._tabChanged);
......@@ -299,6 +299,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel
scaledSettings, function(){
currentLine++;
self.set("simLineNumber", currentLine);
console.log(self);
self._stockSimulation();
});
} else {
......
......@@ -29,7 +29,7 @@ define(['jquery', 'underscore', 'menuParent', 'cam', 'text!animationMenuTemplate
self.render();
});
this.listenTo(cam, "change:simLineNumber", this._drawGcodeHighlighter);
$(document).bind('keyup', {state:false}, this._codeEdit);
// $(document).bind('keyup', {state:false}, this._codeEdit);
//this.$el.bind('resize', this._setEditorHeight);
},
......
......@@ -20,6 +20,8 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
__initialize: function(){
this.isStreaming = false;
this.listenTo(this.model, "change:stockSimulationPlaying", this.render);
this.listenTo(cam, "change:simLineNumber", this._drawGcodeHighlighter);
},
_startStream: function(e){
......@@ -59,12 +61,29 @@ define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!s
serialComm.openSerialMonitor();
},
_drawGcodeHighlighter: function(){
var lineNum = cam.get("simLineNumber");
console.log(lineNum);
if (lineNum == 0) return;
var code = cam.get("dataOut").split("\n");
code[lineNum] = "<span id='gcodeHighlighter'>" + code[lineNum] + " </span>";
var newText = code.join("\n");
var $editor = $('#gcodeEditor');
$editor.html(newText);
var $highlighter = $("#gcodeHighlighter");
if (!$editor.position() || !$highlighter.position()) return;//todo weird bug
var highlighterHeight = $highlighter.position().top - $editor.position().top;
var desiredHeight = $editor.height()/2;
if (highlighterHeight > desiredHeight) $editor.scrollTop($editor.scrollTop()+highlighterHeight-desiredHeight);
},
_makeTemplateJSON: function(){
return _.extend(serialComm.toJSON(), commPlist, cam.toJSON(), camPlist, {streaming: this.isStreaming});
},
_render: function(){
if (serialComm.get("lastMessageReceived") === null) $("#incomingSerialMessage").hide();
this._drawGcodeHighlighter();
},
template: _.template(template)
......
#!/bin/sh
cd ~/Research/CBAStuff/git/dmdesign
git co master
git fetch upstream
git merge upstream/master
git push origin master
cd ~/Research/CBAStuff/git/archives/dma
git subtree pull -P Web/mod/dmdesign fabpeople:people/amanda.ghassaei/dmdesign master --squash
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment