//-/////////////////////////////////////////////////////////////////////////////
//-                                                                           //
//-               This file is part of the Buildbotics firmware.              //
//-                                                                           //
//-      Copyright (c) 2015 - 2021, Buildbotics LLC, All rights reserved.     //
//-                                                                           //
//-       This Source describes Open Hardware and is licensed under the       //
//-                               CERN-OHL-S v2.                              //
//-                                                                           //
//-       You may redistribute and modify this Source and make products       //
//-  using it under the terms of the CERN-OHL-S v2 (https:/cern.ch/cern-ohl). //
//-         This Source is distributed WITHOUT ANY EXPRESS OR IMPLIED         //
//-  WARRANTY, INCLUDING OF MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS //
//-   FOR A PARTICULAR PURPOSE. Please see the CERN-OHL-S v2 for applicable   //
//-                                conditions.                                //
//-                                                                           //
//-              Source location: https://github.com/buildbotics              //
//-                                                                           //
//-    As per CERN-OHL-S v2 section 4, should You produce hardware based on   //
//-  these sources, You must maintain the Source Location clearly visible on  //
//-  the external case of the CNC Controller or other product you make using  //
//-                                this Source.                               //
//-                                                                           //
//-              For more information, email info@buildbotics.com             //
//-                                                                           //
//-/////////////////////////////////////////////////////////////////////////////

script#settings-motor-template(type="text/x-template")
  .motor(:class="{slave: is_slave}")
    h1 Motor {{index}} Configuration

    .pure-form.pure-form-aligned
      fieldset(v-for="category in template.motors.template", v-if='showCategory($key)', :class="$key")
        h2 {{$key}}

        templated-input(v-for="templ in category", v-if="show($key, templ)",
          :name="$key", :model.sync="motor[$key]", :template="templ")

          label.extra(v-if="$key == 'microsteps'", slot="extra",
            title="Microsteps per second")
            | ({{ustepPerSec / 1000 | fixed 1}}k µstep/sec)

          label.extra(v-if="$key == 'max-velocity'", slot="extra",
            title="Revolutions Per Minute") ({{rpm | fixed 0}} RPM)

          label.extra(v-if="$key == 'max-accel' && metric", slot="extra",
            title="G-force") ({{gForce | fixed 3}} g)

          label.extra(v-if="$key == 'max-jerk' && metric", slot="extra",
            title="G-force per minute") ({{gForcePerMin | fixed 2}} g/min)

          label.extra(v-if="$key == 'step-angle'", slot="extra",
            title="Steps per revolution") ({{stepsPerRev | fixed 0}} steps/rev)

          label.extra(v-if="$key == 'travel-per-rev' && metric", slot="extra",
            title="Micrometers per step") ({{umPerStep | fixed 1}} µm/step)

          label.extra(v-if="$key == 'travel-per-rev' && !metric", slot="extra",
            title="Thousandths of an inch per step")
            | ({{milPerStep | fixed 2}} mil/step)

          label.extra(v-if="$key == 'search-velocity'", slot="extra",
            title="Revolutions Per Minute") ({{stallRPM | fixed 0}} RPM)

          label.extra(v-if="$key == 'stall-microstep'", slot="extra",
            title="Microsteps per second")
            | ({{stallUStepPerSec / 1000 | fixed 1}}k µstep/sec)
