motor blocks with optional args (#290)
* motor blocks with optional args * updated signatures * added toggle mode * adding annotations
This commit is contained in:
parent
22ce840181
commit
2f6ad3110a
@ -223,9 +223,10 @@ namespace motors {
|
|||||||
* @param value (optional) measured distance or rotation
|
* @param value (optional) measured distance or rotation
|
||||||
* @param unit (optional) unit of the value
|
* @param unit (optional) unit of the value
|
||||||
*/
|
*/
|
||||||
//% blockId=motorSetSpeed block="set %motor|speed to %speed=motorSpeedPicker|%"
|
//% blockId=motorSetSpeed block="set %motor speed to %speed=motorSpeedPicker|\\%||for %value %unit"
|
||||||
//% weight=100 blockGap=8
|
//% weight=100 blockGap=8
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
|
//% expandableArgumentMode=toggle
|
||||||
//% help=motors/motor/set-speed
|
//% help=motors/motor/set-speed
|
||||||
setSpeed(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
setSpeed(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
this.init();
|
this.init();
|
||||||
@ -495,10 +496,11 @@ namespace motors {
|
|||||||
* @param value (optional) move duration or rotation
|
* @param value (optional) move duration or rotation
|
||||||
* @param unit (optional) unit of the value
|
* @param unit (optional) unit of the value
|
||||||
*/
|
*/
|
||||||
//% blockId=motorPairTank block="tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%"
|
//% blockId=motorPairTank block="tank %motors %speedLeft=motorSpeedPicker|\\% %speedRight=motorSpeedPicker|\\%||for %value %unit"
|
||||||
//% weight=96 blockGap=8
|
//% weight=96 blockGap=8
|
||||||
//% inlineInputMode=inline
|
//% inlineInputMode=inline
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
|
//% expandableArgumentMode=toggle
|
||||||
//% help=motors/synced/tank
|
//% help=motors/synced/tank
|
||||||
tank(speedLeft: number, speedRight: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
tank(speedLeft: number, speedRight: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
this.init();
|
this.init();
|
||||||
@ -521,11 +523,12 @@ namespace motors {
|
|||||||
* @param value (optional) move duration or rotation
|
* @param value (optional) move duration or rotation
|
||||||
* @param unit (optional) unit of the value
|
* @param unit (optional) unit of the value
|
||||||
*/
|
*/
|
||||||
//% blockId=motorPairSteer block="steer %chassis|turn ratio %turnRatio=motorTurnRatioPicker|speed %speed=motorSpeedPicker|%"
|
//% blockId=motorPairSteer block="steer %chassis turn ratio %turnRatio=motorTurnRatioPicker speed %speed=motorSpeedPicker|\\%||for %value %unit"
|
||||||
//% weight=95
|
//% weight=95
|
||||||
//% turnRatio.min=-200 turnRatio=200
|
//% turnRatio.min=-200 turnRatio=200
|
||||||
//% inlineInputMode=inline
|
//% inlineInputMode=inline
|
||||||
//% group="Move"
|
//% group="Move"
|
||||||
|
//% expandableArgumentMode=toggle
|
||||||
//% help=motors/synced/steer
|
//% help=motors/synced/steer
|
||||||
steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
"webfonts-generator": "^0.4.0"
|
"webfonts-generator": "^0.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-common-packages": "0.18.1",
|
"pxt-common-packages": "0.19.1",
|
||||||
"pxt-core": "3.3.1"
|
"pxt-core": "3.4.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||||
|
Loading…
Reference in New Issue
Block a user