diff --git a/src/js/app.js b/src/js/app.js index 7804ab4..36fc603 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -238,12 +238,12 @@ module.exports = new Vue({ }, is_rotary_active: function() { - if(this.config.motors[2]['axis'] == 'Y') return false; + if(this.state["2an"] == 1) return false; return true; }, enable_rotary: function() { - if(this.config.motors[2]['axis'] == 'Y' || this.config.motors[2]['axis'] == 'A') return true; + if(this.state["2an"] == 1 || this.state["2an"] == 3) return true; return false; } }, @@ -338,6 +338,7 @@ module.exports = new Vue({ this.config.motors[1]['max-velocity'] /= 2; } try { + await api.put("rotary", {status : motor['axis'] == 'A'}); await api.put("config/save", this.config); } catch (error) { console.error("Restore failed:", error); diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 17f13de..e1c5462 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -98,7 +98,7 @@ script#control-view-template(type="text/x-template") button(:style="getJogIncrStyle('large')", @click="jog_incr = 'large'") span {{jog_incr_amounts[display_units].large}}#[span.jog-units {{metric ? 'mm' : 'in'}}] - tr(v-if="config.motors[2]['axis'] == 'A'") + tr(v-if="state['2an'] == 3") td(style="height:100px", align="center", colspan="1") button(@click="showProbeDialog('a')") | Probe diff --git a/src/py/bbctrl/Web.py b/src/py/bbctrl/Web.py index 2009e50..f317b29 100644 --- a/src/py/bbctrl/Web.py +++ b/src/py/bbctrl/Web.py @@ -603,6 +603,18 @@ class TimeHandler(bbctrl.APIHandler): except Exception as e: self.get_log('TimeHandler').info('Error: {}'.format(e)) +class RotaryHandler(bbctrl.APIHandler): + + def put_ok(self): + status = self.json.get('status', None) + state = self.get_ctrl().state + try: + self.get_log('RotaryHandler').info('Status: {}'.format(status)) + state.set("rotary", status) + + except Exception as e: + self.get_log('RotaryHandler').info('Error: {}'.format(e)) + class RemoteDiagnosticsHandler(bbctrl.APIHandler): @@ -776,6 +788,7 @@ class Web(tornado.web.Application): (r'/api/video', bbctrl.VideoHandler), (r'/api/screen-rotation', ScreenRotationHandler), (r'/api/time', TimeHandler), + (r'/api/rotary', RotaryHandler), (r'/api/remote-diagnostics', RemoteDiagnosticsHandler), (r'/(.*)', StaticFileHandler, {'path': bbctrl.get_resource('http/'),