From bbf531fde069fc34deab104daf034d621d961785 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Wed, 10 Oct 2018 20:19:32 -0700 Subject: [PATCH] Update pin authoring to set size of grid picker width (#1377) --- libs/core/pins.cpp | 28 ++++++++++++++-------------- libs/core/shims.d.ts | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libs/core/pins.cpp b/libs/core/pins.cpp index e40983c9..d6e5d5b5 100644 --- a/libs/core/pins.cpp +++ b/libs/core/pins.cpp @@ -138,7 +138,7 @@ namespace pins { //% help=pins/digital-read-pin weight=30 //% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" int digitalReadPin(DigitalPin name) { PINREAD(getDigitalValue()); } @@ -152,7 +152,7 @@ namespace pins { //% blockId=device_set_digital_pin block="digital write|pin %name|to %value" //% value.min=0 value.max=1 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" void digitalWritePin(DigitalPin name, int value) { PINOP(setDigitalValue(value)); } @@ -164,7 +164,7 @@ namespace pins { //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" int analogReadPin(AnalogPin name) { PINREAD(getAnalogValue()); } @@ -178,7 +178,7 @@ namespace pins { //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 //% value.min=0 value.max=1023 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" void analogWritePin(AnalogPin name, int value) { PINOP(setAnalogValue(value)); } @@ -205,7 +205,7 @@ namespace pins { //% help=pins/on-pulsed weight=22 blockGap=16 advanced=true //% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse" //% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4 - //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300" + //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250" void onPulsed(DigitalPin name, PulseValue pulse, Action body) { MicroBitPin* pin = getPin((int)name); if (!pin) return; @@ -234,7 +234,7 @@ namespace pins { //% weight=20 advanced=true //% help=pins/pulse-in //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) { MicroBitPin* pin = getPin((int)name); if (!pin) return 0; @@ -266,7 +266,7 @@ namespace pins { //% parts=microservo trackArgs=0 //% value.min=0 value.max=180 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" void servoWritePin(AnalogPin name, int value) { PINOP(setServoValue(value)); } @@ -279,7 +279,7 @@ namespace pins { //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" //% value.fieldEditor="gridpicker" value.fieldOptions.columns=4 - //% value.fieldOptions.tooltips="false" + //% value.fieldOptions.tooltips="false" value.fieldOptions.width="250" void servoSetPulse(AnalogPin name, int micros) { PINOP(setServoPulseUs(micros)); } @@ -294,7 +294,7 @@ namespace pins { //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name" //% help=pins/analog-set-pitch-pin weight=3 advanced=true //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" void analogSetPitchPin(AnalogPin name) { pitchPin = getPin((int)name); } @@ -333,7 +333,7 @@ namespace pins { //% help=pins/set-pull weight=3 advanced=true //% blockId=device_set_pull block="set pull|pin %pin|to %pull" //% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4 - //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300" + //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250" void setPull(DigitalPin name, PinPullMode pull) { PinMode m = pull == PinPullMode::PullDown ? PinMode::PullDown @@ -351,7 +351,7 @@ namespace pins { //% help=pins/set-events weight=4 advanced=true //% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" //% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4 - //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300" + //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250" void setEvents(DigitalPin name, PinEventType type) { getPin((int)name)->eventOn((int)type); } @@ -434,11 +434,11 @@ namespace pins { //% help=pins/spi-pins weight=2 advanced=true //% blockId=spi_pins block="spi set pins|MOSI %mosi|MISO %miso|SCK %sck" //% mosi.fieldEditor="gridpicker" mosi.fieldOptions.columns=4 - //% mosi.fieldOptions.tooltips="false" mosi.fieldOptions.width="300" + //% mosi.fieldOptions.tooltips="false" mosi.fieldOptions.width="250" //% miso.fieldEditor="gridpicker" miso.fieldOptions.columns=4 - //% miso.fieldOptions.tooltips="false" miso.fieldOptions.width="300" + //% miso.fieldOptions.tooltips="false" miso.fieldOptions.width="250" //% sck.fieldEditor="gridpicker" sck.fieldOptions.columns=4 - //% sck.fieldOptions.tooltips="false" sck.fieldOptions.width="300" + //% sck.fieldOptions.tooltips="false" sck.fieldOptions.width="250" void spiPins(DigitalPin mosi, DigitalPin miso, DigitalPin sck) { if (NULL != spi) { delete spi; diff --git a/libs/core/shims.d.ts b/libs/core/shims.d.ts index 87c08f23..2a12ba0c 100644 --- a/libs/core/shims.d.ts +++ b/libs/core/shims.d.ts @@ -558,7 +558,7 @@ declare namespace pins { //% help=pins/digital-read-pin weight=30 //% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" shim=pins::digitalReadPin + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" shim=pins::digitalReadPin function digitalReadPin(name: DigitalPin): int32; /** @@ -570,7 +570,7 @@ declare namespace pins { //% blockId=device_set_digital_pin block="digital write|pin %name|to %value" //% value.min=0 value.max=1 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" shim=pins::digitalWritePin + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" shim=pins::digitalWritePin function digitalWritePin(name: DigitalPin, value: int32): void; /** @@ -580,7 +580,7 @@ declare namespace pins { //% help=pins/analog-read-pin weight=25 //% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" shim=pins::analogReadPin + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" shim=pins::analogReadPin function analogReadPin(name: AnalogPin): int32; /** @@ -592,7 +592,7 @@ declare namespace pins { //% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8 //% value.min=0 value.max=1023 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" shim=pins::analogWritePin + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" shim=pins::analogWritePin function analogWritePin(name: AnalogPin, value: int32): void; /** @@ -615,7 +615,7 @@ declare namespace pins { //% help=pins/on-pulsed weight=22 blockGap=16 advanced=true //% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse" //% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4 - //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300" shim=pins::onPulsed + //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250" shim=pins::onPulsed function onPulsed(name: DigitalPin, pulse: PulseValue, body: () => void): void; /** @@ -636,7 +636,7 @@ declare namespace pins { //% weight=20 advanced=true //% help=pins/pulse-in //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" name.fieldOptions.width="300" maxDuration.defl=2000000 shim=pins::pulseIn + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" maxDuration.defl=2000000 shim=pins::pulseIn function pulseIn(name: DigitalPin, value: PulseValue, maxDuration?: int32): int32; /** @@ -649,7 +649,7 @@ declare namespace pins { //% parts=microservo trackArgs=0 //% value.min=0 value.max=180 //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" shim=pins::servoWritePin + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" shim=pins::servoWritePin function servoWritePin(name: AnalogPin, value: int32): void; /** @@ -660,7 +660,7 @@ declare namespace pins { //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" //% value.fieldEditor="gridpicker" value.fieldOptions.columns=4 - //% value.fieldOptions.tooltips="false" shim=pins::servoSetPulse + //% value.fieldOptions.tooltips="false" value.fieldOptions.width="250" shim=pins::servoSetPulse function servoSetPulse(name: AnalogPin, micros: int32): void; /** @@ -670,7 +670,7 @@ declare namespace pins { //% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name" //% help=pins/analog-set-pitch-pin weight=3 advanced=true //% name.fieldEditor="gridpicker" name.fieldOptions.columns=4 - //% name.fieldOptions.tooltips="false" shim=pins::analogSetPitchPin + //% name.fieldOptions.tooltips="false" name.fieldOptions.width="250" shim=pins::analogSetPitchPin function analogSetPitchPin(name: AnalogPin): void; /** @@ -690,7 +690,7 @@ declare namespace pins { //% help=pins/set-pull weight=3 advanced=true //% blockId=device_set_pull block="set pull|pin %pin|to %pull" //% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4 - //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300" shim=pins::setPull + //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250" shim=pins::setPull function setPull(name: DigitalPin, pull: PinPullMode): void; /** @@ -702,7 +702,7 @@ declare namespace pins { //% help=pins/set-events weight=4 advanced=true //% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" //% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4 - //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300" shim=pins::setEvents + //% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="250" shim=pins::setEvents function setEvents(name: DigitalPin, type: PinEventType): void; /** @@ -756,11 +756,11 @@ declare namespace pins { //% help=pins/spi-pins weight=2 advanced=true //% blockId=spi_pins block="spi set pins|MOSI %mosi|MISO %miso|SCK %sck" //% mosi.fieldEditor="gridpicker" mosi.fieldOptions.columns=4 - //% mosi.fieldOptions.tooltips="false" mosi.fieldOptions.width="300" + //% mosi.fieldOptions.tooltips="false" mosi.fieldOptions.width="250" //% miso.fieldEditor="gridpicker" miso.fieldOptions.columns=4 - //% miso.fieldOptions.tooltips="false" miso.fieldOptions.width="300" + //% miso.fieldOptions.tooltips="false" miso.fieldOptions.width="250" //% sck.fieldEditor="gridpicker" sck.fieldOptions.columns=4 - //% sck.fieldOptions.tooltips="false" sck.fieldOptions.width="300" shim=pins::spiPins + //% sck.fieldOptions.tooltips="false" sck.fieldOptions.width="250" shim=pins::spiPins function spiPins(mosi: DigitalPin, miso: DigitalPin, sck: DigitalPin): void; }