Compare commits

...

7 Commits

Author SHA1 Message Date
71fe612ced 0.0.91 2018-02-05 16:38:50 -08:00
e58ec06e91 IR button indexing fixes (#303)
* IR remote id fixes

* hiding private api

* fixing indexing of buttons
2018-02-05 15:11:11 -08:00
538493369b adding button class on remote buttons 2018-02-05 13:57:24 -08:00
56dd8e0875 enabling doc checks 2018-02-03 09:11:49 -08:00
1f7ef637b2 Fix links in target 2018-02-03 09:09:10 -08:00
f4f2e0ba0e 0.0.90 2018-02-02 14:19:17 -08:00
22c31c57df fix port bug 2018-02-02 14:19:07 -08:00
9 changed files with 31 additions and 31 deletions

View File

@ -48,7 +48,6 @@
* [show mood](/reference/brick/show-mood)
* [show image](/reference/brick/show-image)
* [clear screen](/reference/brick/clear-screen)
* [print ports](/reference/brick/print-ports)
* [on event](/reference/brick/button/on-event)
* [is pressed](/reference/brick/button/is-pressed)
* [was pressed](/reference/brick/button/was-pressed)

View File

@ -19,7 +19,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
The editor work in [most modern browsers](/browsers), work [offline](/offline) once loaded and do not require any installation.
## [Compile and Flash: Your Program!](/device/usb)
## Compile and Flash: Your Program!
When you have your code ready, you connect your @boardname@ to a computer via a USB cable
so it appears as a mounted drive (named **EV3**).

View File

@ -39,10 +39,10 @@ const enum InfraredSensorEvent {
namespace sensors {
function mapButton(v: number) {
switch (v) {
case 1: return InfraredRemoteButton.TopLeft
case 2: return InfraredRemoteButton.BottomLeft
case 3: return InfraredRemoteButton.TopRight
case 4: return InfraredRemoteButton.TopRight | InfraredRemoteButton.BottomRight
case 1: return InfraredRemoteButton.TopLeft;
case 2: return InfraredRemoteButton.BottomLeft;
case 3: return InfraredRemoteButton.TopRight;
case 4: return InfraredRemoteButton.BottomRight;
case 5: return InfraredRemoteButton.TopLeft | InfraredRemoteButton.TopRight
case 6: return InfraredRemoteButton.TopLeft | InfraredRemoteButton.BottomRight
case 7: return InfraredRemoteButton.BottomLeft | InfraredRemoteButton.TopRight
@ -68,14 +68,15 @@ namespace sensors {
//% fixedInstances
export class RemoteInfraredBeaconButton extends control.Component {
position: InfraredRemoteButton;
private button: brick.Button;
private _button: brick.Button;
constructor(position: InfraredRemoteButton, button: brick.Button) {
super();
this.button = button;
this.position = position;
this._button = button;
}
_update(curr: boolean) {
this.button._update(curr);
this._button._update(curr);
}
/**
@ -90,7 +91,7 @@ namespace sensors {
//% weight=81 blockGap=8
//% group="Remote Infrared Beacon"
isPressed() {
return this.button.isPressed();
return this._button.isPressed();
}
/**
@ -105,7 +106,7 @@ namespace sensors {
//% weight=80
//% group="Remote Infrared Beacon"
wasPressed() {
return this.button.wasPressed();
return this._button.wasPressed();
}
/**
@ -121,7 +122,7 @@ namespace sensors {
//% weight=99 blockGap=8
//% group="Remote Infrared Beacon"
onEvent(ev: ButtonEvent, body: () => void) {
this.button.onEvent(ev, body);
this._button.onEvent(ev, body);
}
/**
@ -135,7 +136,7 @@ namespace sensors {
//% weight=99 blockGap=8
//% group="Remote Infrared Beacon"
pauseUntil(ev: ButtonEvent) {
this.button.pauseUntil(ev);
this._button.pauseUntil(ev);
}
}
@ -163,7 +164,7 @@ namespace sensors {
_update(prev: number, curr: number) {
if (this.mode == InfraredSensorMode.RemoteControl) {
for (let i = 0; i < __remoteButtons.length; ++i) {
let v = !!(curr & (1 << i))
const v = !!(curr & __remoteButtons[i].position);
__remoteButtons[i]._update(v)
}
} else if (this.mode == InfraredSensorMode.Proximity) {
@ -294,24 +295,24 @@ namespace sensors {
/**
* Remote top-left button.
*/
//% whenUsed block="remote button top-left" weight=95 fixedInstance
//% whenUsed block="remote button top left" weight=95 fixedInstance
export const remoteButtonTopLeft = __irButton(InfraredRemoteButton.TopLeft)
/**
* Remote top-right button.
*/
//% whenUsed block="remote button top-right" weight=95 fixedInstance
//% whenUsed block="remote button top right" weight=95 fixedInstance
export const remoteButtonTopRight = __irButton(InfraredRemoteButton.TopRight)
/**
* Remote bottom-left button.
*/
//% whenUsed block="remote button bottom-left" weight=95 fixedInstance
//% whenUsed block="remote button bottom left" weight=95 fixedInstance
export const remoteButtonBottomLeft = __irButton(InfraredRemoteButton.BottomLeft)
/**
* Remote bottom-right button.
*/
//% whenUsed block="remote button bottom-right" weight=95 fixedInstance
//% whenUsed block="remote button bottom right" weight=95 fixedInstance
export const remoteButtonBottomRight = __irButton(InfraredRemoteButton.BottomRight)
}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.0.89",
"version": "0.0.91",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.0.89",
"version": "0.0.91",
"description": "LEGO Mindstorms EV3 for Microsoft MakeCode",
"private": true,
"keywords": [

View File

@ -83,7 +83,7 @@
},
"appTheme": {
"accentColor": "#0089BF",
"logoUrl": "https://lego.makecode.com",
"logoUrl": "https://education.lego.com/",
"logo": "./static/lego_education_logo.png",
"highContrastLogo": "./static/lego_education_logo_white.png",
"docsLogo": "./static/lego-logo.svg",
@ -95,12 +95,12 @@
"organizationUrl": "https://makecode.com/",
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray-square.png",
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-gray.png",
"homeUrl": "https://lego.makecode.com/",
"embedUrl": "https://lego.makecode.com/",
"homeUrl": "https://makecode.legoeducation.com/",
"embedUrl": "https://makecode.legoeducation.com/",
"privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839",
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
"githubUrl": "https://github.com/Microsoft/pxt-ev3",
"betaUrl": "https://lego.makecode.com/",
"betaUrl": "https://makecode.legoeducation.com/about",
"boardName": "LEGO Mindstorms EV3 Brick",
"selectLanguage": true,
"highContrast": true,
@ -157,5 +157,5 @@
"editor.background": "#ecf6ff"
}
},
"ignoreDocsErrors": true
"ignoreDocsErrors": false
}

View File

@ -24,13 +24,13 @@ namespace pxsim {
switch(this.state) {
case InfraredRemoteButton.TopLeft: return 1;
case InfraredRemoteButton.BottomLeft: return 2;
case InfraredRemoteButton.TopLeft: return 3;
case InfraredRemoteButton.TopRight | InfraredRemoteButton.BottomRight: return 4;
case InfraredRemoteButton.TopRight: return 3;
case InfraredRemoteButton.BottomRight: return 4;
case InfraredRemoteButton.TopLeft | InfraredRemoteButton.TopRight: return 5;
case InfraredRemoteButton.TopLeft | InfraredRemoteButton.BottomRight: return 6;
case InfraredRemoteButton.BottomLeft | InfraredRemoteButton.TopRight: return 7;
case InfraredRemoteButton.BottomLeft | InfraredRemoteButton.BottomRight: return 8;
case InfraredRemoteButton.CenterBeacon: return 9;
case InfraredRemoteButton.CenterBeacon: return 9;
case InfraredRemoteButton.BottomLeft | InfraredRemoteButton.TopLeft: return 10;
case InfraredRemoteButton.TopRight | InfraredRemoteButton.BottomRight: return 11;
default: return 0;

View File

@ -231,7 +231,7 @@ namespace pxsim.visuals {
break;
}
case NodeType.InfraredSensor: {
const state = ev3board().getInputNodes()[0] as InfraredSensorNode;
const state = ev3board().getInputNodes()[port] as InfraredSensorNode;
if (state.getMode() == InfraredSensorMode.Proximity)
view = new ProximitySliderControl(this.element, this.defs, state, port);
else if (state.getMode() == InfraredSensorMode.RemoteControl)

View File

@ -28,11 +28,11 @@ namespace pxsim.visuals {
"bottomleft": InfraredRemoteButton.BottomLeft,
"bottomright": InfraredRemoteButton.BottomRight
}
Object.keys(btns).forEach(bid => {
const cid = btns[bid];
const bel = content.getElementById(pxsim.visuals.normalizeId(this.id, bid));
bel.className += " sim-button";
bel.setAttribute("class", "sim-button");
pointerEvents.down.forEach(evid => bel.addEventListener(evid, ev => {
ev3board().remoteState.setPressed(cid, true);
}));