From: Joseph Coffland Date: Tue, 13 Sep 2016 10:21:47 +0000 (-0700) Subject: Implemented stepping X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=982b0f27f7fa3e8ec63ba88111ccb2d82006c9e6;p=bbctrl-firmware Implemented stepping --- diff --git a/src/jade/templates/control-view.jade b/src/jade/templates/control-view.jade index 6862e54..247b296 100644 --- a/src/jade/templates/control-view.jade +++ b/src/jade/templates/control-view.jade @@ -31,7 +31,7 @@ script#control-view-template(type="text/x-template") td tr th Reason - td {{state.pr}} + td {{get_reason()}} td tr th Feed @@ -53,7 +53,7 @@ script#control-view-template(type="text/x-template") td mm/min tr th Line - td {{state.ln || ''}} + td {{0 <= state.ln ? state.ln : '-'}} td tr th Tool @@ -89,7 +89,7 @@ script#control-view-template(type="text/x-template") button.pure-button( title="{{state.x == 'RUNNING' ? 'Pause' : 'Start'}} program.", @click="start_pause", - :disabled="state.c == 'HOMING'") + :disabled="state.c == 'HOMING' || !file") .fa(:class="state.x == 'RUNNING' ? 'fa-pause' : 'fa-play'") button.pure-button(title="Stop program.", @click="stop", diff --git a/src/js/control-view.js b/src/js/control-view.js index 4510c51..b926088 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -52,8 +52,13 @@ module.exports = { methods: { get_state: function () { var state = this.state.x || ''; - if (state == 'running' && this.state.c) state = this.state.c; - return state.toUpperCase(); + if (state == 'RUNNING' && this.state.c) state = this.state.c; + return state; + }, + + + get_reason: function () { + return this.state.x == 'HOLDING' ? this.state.pr : ''; }, @@ -77,8 +82,9 @@ module.exports = { if (0 <= this.state.ln) { var line = this.state.ln - 1; - $('#gcode-line-' + line) - .addClass('highlight')[0] + var e = $('#gcode-line-' + line); + if (e.length) + e.addClass('highlight')[0] .scrollIntoView({behavior: 'smooth'}); this.last_line = line; @@ -141,7 +147,7 @@ module.exports = { api.get('file/' + file) .done(function (data) { - var lines = data.split(/\r?\n/); + var lines = data.trimRight().split(/\r?\n/); var html = '