td
tr
th Reason
- td {{state.pr}}
+ td {{get_reason()}}
td
tr
th Feed
td mm/min
tr
th Line
- td {{state.ln || ''}}
+ td {{0 <= state.ln ? state.ln : '-'}}
td
tr
th Tool
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",
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 : '';
},
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;
api.get('file/' + file)
.done(function (data) {
- var lines = data.split(/\r?\n/);
+ var lines = data.trimRight().split(/\r?\n/);
var html = '<ul>';
for (var i = 0; i < lines.length; i++)
unpause: function () {api.put('unpause')},
optional_pause: function () {api.put('pause/optional')},
stop: function () {api.put('stop')},
- step: function () {api.put('step')},
+ step: function () {api.put('step/' + this.file).done(this.update)},
override_feed: function () {
self._i2c_command(I2C_RUN)
+ def step(self, path):
+ self._i2c_command(I2C_STEP)
+ if self.stream is None and path and self.vars.get('x', '') == 'READY':
+ self._start_sending_gcode(path)
+
+
def stop(self):
self._i2c_command(I2C_FLUSH)
self._stop_sending_gcode()
def pause(self): self._i2c_command(I2C_PAUSE)
def unpause(self): self._i2c_command(I2C_RUN)
def optional_pause(self): self._i2c_command(I2C_OPTIONAL_PAUSE)
- def step(self): self._i2c_command(I2C_STEP)
def zero(self, axis = None): self._i2c_command(I2C_ZERO, byte = axis)
class StepHandler(bbctrl.APIHandler):
- def put_ok(self): self.ctrl.avr.step()
+ def put_ok(self, path): self.ctrl.avr.step(path)
class ZeroHandler(bbctrl.APIHandler):
(r'/api/pause', PauseHandler),
(r'/api/unpause', UnpauseHandler),
(r'/api/pause/optional', OptionalPauseHandler),
- (r'/api/step', StepHandler),
+ (r'/api/step(/.+)', StepHandler),
(r'/api/zero(/[xyzabcXYZABC])?', ZeroHandler),
(r'/api/override/feed/([\d.]+)', OverrideFeedHandler),
(r'/api/override/speed/([\d.]+)', OverrideSpeedHandler),