From 2f6ad3110a1ade22368f39694d859596d1545d9d Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 9 Feb 2018 10:25:39 -0800 Subject: [PATCH] motor blocks with optional args (#290) * motor blocks with optional args * updated signatures * added toggle mode * adding annotations --- libs/core/output.ts | 9 ++++++--- package.json | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/core/output.ts b/libs/core/output.ts index 6f4563b2..86122dd3 100644 --- a/libs/core/output.ts +++ b/libs/core/output.ts @@ -223,9 +223,10 @@ namespace motors { * @param value (optional) measured distance or rotation * @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 //% group="Move" + //% expandableArgumentMode=toggle //% help=motors/motor/set-speed setSpeed(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) { this.init(); @@ -495,10 +496,11 @@ namespace motors { * @param value (optional) move duration or rotation * @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 //% inlineInputMode=inline //% group="Move" + //% expandableArgumentMode=toggle //% help=motors/synced/tank tank(speedLeft: number, speedRight: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) { this.init(); @@ -521,11 +523,12 @@ namespace motors { * @param value (optional) move duration or rotation * @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 //% turnRatio.min=-200 turnRatio=200 //% inlineInputMode=inline //% group="Move" + //% expandableArgumentMode=toggle //% help=motors/synced/steer steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) { this.init(); diff --git a/package.json b/package.json index 87a730c2..1d2028b2 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "webfonts-generator": "^0.4.0" }, "dependencies": { - "pxt-common-packages": "0.18.1", - "pxt-core": "3.3.1" + "pxt-common-packages": "0.19.1", + "pxt-core": "3.4.1" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis"