Set motor current in amps, Fixed control view updates
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 4 May 2017 07:06:00 +0000 (00:06 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 4 May 2017 07:06:00 +0000 (00:06 -0700)
src/jade/templates/control-view.jade
src/js/app.js
src/js/control-view.js
src/py/bbctrl/AVR.py
src/py/bbctrl/Web.py
src/resources/config-template.json

index 6844058fad64030a89416ba0ce6526e2802b35ce..4da12cc948302252766e01a4dfa87acda4a21977 100644 (file)
@@ -147,7 +147,7 @@ script#control-view-template(type="text/x-template")
             input(v-model="mdi", @keyup.enter="submit_mdi")
 
         .history(:class="{placeholder: !history}")
-          {{history || 'MDI history displays here.'}}
+          {{history || 'MDI history displays here.'}}
 
       section#content3.tab-content
         .jog
index ac701ec65e3c63f2a569da26ca292efc690ff97d..a5092ef32b7228b7758418269e0ab23542631daf 100644 (file)
@@ -84,7 +84,7 @@ module.exports = new Vue({
 
         if (typeof msg == 'object') {
           for (var key in msg)
-            this.$set('state.' + key, msg[key]);
+            Vue.set(this.state, key, msg[key]);
 
           if ('msg' in msg) this.$broadcast('message', msg);
         }
@@ -100,6 +100,8 @@ module.exports = new Vue({
         this.status = 'disconnected';
         this.$broadcast(this.status);
       }.bind(this);
+
+      console.debug('Hello');
     },
 
 
index 43ac7d86183ab6aa7dc3dee55d0e08d756595e0c..0740e49df3255dec0ff2670e44a1471d7e83cf46 100644 (file)
@@ -77,7 +77,9 @@ module.exports = {
 
 
     get_reason: function () {
-      return this.state.x == 'HOLDING' ? this.state.pr : '';
+      if (this.state.x == 'ESTOPPED') return this.state.er;
+      if (this.state.x == 'HOLDING') return this.state.pr;
+      return '';
     },
 
 
index d38d9d76bea7a58cf5c10ba50da3cd86eb487c87..99af7438555137c0a42f25157ae00f4d3134286d 100644 (file)
@@ -212,9 +212,16 @@ class AVR():
                 self._stop_sending_gcode()
 
             self.vars.update(update)
-            self.ctrl.lcd.update(update)
-            self.ctrl.web.broadcast(update)
 
+            try:
+                self.ctrl.lcd.update(update)
+            except Exception as e:
+                log.error('Updating LCD: %s', e)
+
+            try:
+                self.ctrl.web.broadcast(update)
+            except Exception as e:
+                log.error('Updating Web: %s', e)
 
     def queue_command(self, cmd):
         self.queue.append(cmd)
index 9fbf2530ebe5e0bc78c0d05384f686c15d26de45..001509af16b990ed3c0e2b861a7094bbdfa3b9de 100644 (file)
@@ -171,5 +171,5 @@ class Web(tornado.web.Application):
 
 
     def broadcast(self, msg):
-        if self.clients:
+        if len(self.clients):
             self.clients[0].broadcast(self.clients, msg)
index bceb4c07a4cab9027d95814917ebd037ce21ee62..9c50a2f798fff1f17e634cc52cda98922ba9f75d 100644 (file)
         "default": "when-moving",
         "code": "pm"
       },
-      "max-current": {
-        "type": "percent",
-        "unit": "%",
-        "default": 80,
-        "code": "xc"
-      },
-      "min-current": {
-        "type": "percent",
-        "unit": "%",
-        "default": 20,
-        "code": "lc"
+      "drive-current": {
+        "type": "float",
+        "min": 0,
+        "max": 8,
+        "unit": "A",
+        "default": 2,
+        "code": "dc"
       },
       "idle-current": {
-        "type": "percent",
-        "unit": "%",
-        "default": 1,
+        "type": "float",
+        "min": 0,
+        "max": 8,
+        "unit": "A",
+        "default": 0,
         "code": "ic"
       }
     },