@@ -54,12 +54,17 @@ module.exports = {
54
54
} ,
55
55
56
56
57
- maxStepsPerSecond : function ( ) { return 250000 } ,
57
+ maxStepsPerSecond : function ( ) { return ( 0.5 / this . motor [ 'step-length' ] ) } ,
58
58
59
59
60
- maxMaxVelocity : function ( ) { // In meters per minute
61
- let metersPerUStep = this . umPerStep / this . motor . microsteps / 1000000
62
- return 1 * ( this . maxStepsPerSec * 60 * metersPerUStep ) . toFixed ( 3 )
60
+ maxMaxVelocity : function ( ) {
61
+ let maxUStepsPerSecond = 0.5 / this . motor [ 'step-length' ] ;
62
+ let uStepsPerRevolution =
63
+ ( 360.0 / this . motor [ 'step-angle' ] ) * this . motor [ 'microsteps' ] ;
64
+ let maxRPS = maxUStepsPerSecond / uStepsPerRevolution ;
65
+
66
+ return parseFloat ( ( maxRPS * 60.0 * this . motor [ 'travel-per-rev' ] / 1000 )
67
+ . toFixed ( 3 ) ) ; // returns max vel in meters / minute
63
68
} ,
64
69
65
70
@@ -119,6 +124,10 @@ module.exports = {
119
124
events : {
120
125
'input-changed' : function ( ) {
121
126
Vue . nextTick ( function ( ) {
127
+ // set step length to default of 2ms if user selects internal drivers
128
+ if ( this . motor [ 'type-of-driver' ] == 'internal' )
129
+ this . $set ( 'motor["step-length"]' , 0.000002 ) ;
130
+
122
131
// Limit max-velocity
123
132
if ( this . invalidMaxVelocity )
124
133
this . $set ( 'motor["max-velocity"]' , this . maxMaxVelocity ) ;
@@ -127,6 +136,7 @@ module.exports = {
127
136
if ( this . invalidStallVelocity )
128
137
this . $set ( 'motor["search-velocity"]' , this . maxStallVelocity ) ;
129
138
139
+
130
140
this . $dispatch ( 'config-changed' ) ;
131
141
} . bind ( this ) )
132
142
return true ;
@@ -136,8 +146,34 @@ module.exports = {
136
146
137
147
methods : {
138
148
show : function ( name , templ ) {
149
+ if ( name == 'step-length' && this . motor [ 'type-of-driver' ] == 'internal' )
150
+ return false ;
151
+
152
+ if ( this . motor [ 'type-of-driver' ] == 'generic external' &&
153
+ name == 'homing-mode' ) return false ;
154
+
155
+ if ( this . motor [ 'type-of-driver' ] == 'internal' &&
156
+ name == 'homing-mode-external' ) return false ;
157
+
158
+ if ( ( this . motor [ 'type-of-driver' ] == 'generic external' ) &&
159
+ [ 'stall-microstep' , 'stall-volts' , 'stall-sample-time' ,
160
+ 'stall-current' ] . includes ( name ) ) return false ;
161
+
139
162
if ( templ . hmodes == undefined ) return true ;
140
- return templ . hmodes . indexOf ( this . motor [ 'homing-mode' ] ) != - 1 ;
163
+
164
+ if ( this . motor [ 'type-of-driver' ] == 'internal' )
165
+ return templ . hmodes . indexOf ( this . motor [ 'homing-mode' ] ) != - 1 ;
166
+
167
+ return templ . hmodes . indexOf ( this . motor [ 'homing-mode-external' ] ) != - 1 ;
168
+ } ,
169
+
170
+
171
+ showCategory : function ( name ) {
172
+ if ( name == 'power' && this . motor [ 'type-of-driver' ] == 'generic external' )
173
+ return false
174
+
175
+ return true ;
141
176
}
142
177
}
178
+
143
179
}
0 commit comments