Compare commits

...

20 Commits

Author SHA1 Message Date
6bdae6547a 0.1.41 2018-05-03 15:03:24 -07:00
30a67b729d Align all modules to a minimum height. (#563) 2018-05-03 15:02:13 -07:00
3e2c61e212 0.1.40 2018-05-03 11:59:50 -07:00
7a37dec196 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-05-03 11:48:19 -07:00
bac792f188 upgrade firmware -> troubleshoot 2018-05-03 11:48:10 -07:00
e4c3fa0e57 Make the light around the color sensor appear bright and not a reflection of the current color detected. (#561) 2018-05-03 08:39:06 -07:00
76f7df7579 Update favicon 2018-05-03 08:06:39 -07:00
d7e671175c 0.1.39 2018-05-03 06:57:18 -07:00
f4b7230a67 remove "pxtrequire" 2018-05-03 06:55:50 -07:00
afe0f9b0f7 updated pxt 2018-05-03 06:54:30 -07:00
23b6edc4bf Release app 0.1.36 2018-05-03 09:22:18 -04:00
13b3c1a194 Attempt to shorten color sensor ambient and reflected blocks by removing detected keyword (#560) 2018-05-02 22:09:04 -07:00
7e58b9b699 Motor angle (#559)
* control angle with slider

* called changed state

* remove logging
2018-05-02 22:04:29 -07:00
08a860bd80 Update tutorial gifs to match new sim inputs (#558) 2018-05-02 17:15:29 -07:00
4a966a73f1 0.1.38 2018-05-02 16:24:41 -07:00
542216000c 0.1.37 2018-05-02 16:24:35 -07:00
b323929f03 Fix color grid on IE. (#556) 2018-05-02 16:23:53 -07:00
1e3647738d Update download dialog. (#555) 2018-05-02 15:15:25 -07:00
838b3f7f9a 0.1.36 2018-05-02 15:07:55 -07:00
0ff2d7866d bump pxt-core to 3.12.16, 2018-05-02 15:07:45 -07:00
21 changed files with 51 additions and 52 deletions

View File

@ -1,6 +0,0 @@
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
import * as path from "path";
export let pxtCore = require("pxt-core");
// require.resolve() gives path to [pxt dir]/built/pxt.js, so move up twice to get pxt root dir
export let pxtCoreDir = path.resolve(require.resolve("pxt-core"), "..", "..");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 KiB

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -33,10 +33,8 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
</div>
<div class="content">
<div class="description">
<span class="ui yellow circular label">1</span>
<strong>${lf("Connect EV3 to computer with USB cable")}</strong>
<br/>
${lf("Use the miniUSB port on top of EV3 brick")}
<span class="ui blue circular label">1</span>
<strong>${lf("Connect the EV3 brick to your computer with a USB cable.")}</strong>
</div>
</div>
</div>
@ -57,9 +55,9 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
</div>
<div class="ui one column grid">
<div class="column">
<a href="/troubleshoot" target="_blank" class="ui segment container yellow">
<a href="/troubleshoot" target="_blank" class="ui segment container" style="background:#ffdb90">
<i class="icon exclamation circle large" aria-hidden="true"></i>
${lf("Something wrong? Click here to troubleshoot..")}
${lf("Did you prepare your EV3 brick for MakeCode?")}
</a>
</div>
</div>`;

View File

@ -185,7 +185,7 @@ namespace sensors {
* @param handler the code to run when detected
*/
//% help=sensors/color-sensor/on-light-detected
//% block="on **color sensor** %this|detected %mode|%condition"
//% block="on **color sensor** %this|%mode|%condition"
//% blockId=colorOnLightDetected
//% parts="colorsensor"
//% blockNamespace=sensors
@ -202,7 +202,7 @@ namespace sensors {
* @param color the color to detect
*/
//% help=sensors/color-sensor/pause-until-light-detected
//% block="pause until **color sensor** %this|detected %mode|%condition"
//% block="pause until **color sensor** %this|%mode|%condition"
//% blockId=colorPauseUntilLightDetected
//% parts="colorsensor"
//% blockNamespace=sensors

2
package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.1.35",
"version": "0.1.41",
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
"private": true,
"keywords": [
@ -30,8 +30,6 @@
"docs/*/*.md",
"docs/*/*/*.md"
],
"main": "built/pxtrequire.js",
"typings": "built/pxtrequire.d.ts",
"devDependencies": {
"typescript": "2.6.1",
"semantic-ui-less": "2.2.14",
@ -42,7 +40,7 @@
},
"dependencies": {
"pxt-common-packages": "0.22.1",
"pxt-core": "3.12.12"
"pxt-core": "3.12.17"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"

View File

@ -110,8 +110,8 @@
"path": "http://service.lego.com"
},
{
"name": "Upgrade Firmware",
"path": "https://ev3manager.education.lego.com/"
"name": "Troubleshoot",
"path": "/troubleshoot"
},
{
"name": "Blocks",

View File

@ -17,7 +17,8 @@ namespace pxsim {
private speedCmdTime: number;
private _synchedMotor: MotorNode; // non-null if synchronized
private manualSpeed: number = undefined;
private manualReferenceAngle: number = undefined;
private manualAngle: number = undefined;
constructor(port: number, large: boolean) {
super(port);
@ -103,14 +104,18 @@ namespace pxsim {
}
manualMotorDown() {
this.manualReferenceAngle = this.angle;
this.manualAngle = 0;
}
manualMotorMove(speed: number) {
this.manualSpeed = speed;
// position: 0, 360
manualMotorAngle(angle: number) {
this.manualAngle = angle;
}
manualMotorUp() {
this.manualSpeed = undefined;
delete this.manualReferenceAngle;
delete this.manualAngle;
}
updateState(elapsed: number) {
@ -126,7 +131,7 @@ namespace pxsim {
}
private updateStateStep(elapsed: number) {
if (!this.manualSpeed) {
if (this.manualAngle === undefined) {
// compute new speed
switch (this.speedCmd) {
case DAL.opOutputSpeed:
@ -202,7 +207,11 @@ namespace pxsim {
}
}
else {
this.speed = this.manualSpeed;
// the user is holding the handle - so position is the angle
this.speed = 0;
// rotate by the desired angle change
this.angle = this.manualReferenceAngle + this.manualAngle;
this.setChangedState();
}
this.speed = Math.round(this.speed); // integer only
@ -217,7 +226,8 @@ namespace pxsim {
// if the motor was stopped or there are no speed commands,
// let it coast to speed 0
if (this.speed && !(this.started || this.speedCmd)) {
if ((this.manualReferenceAngle === undefined)
&& this.speed && !(this.started || this.speedCmd)) {
// decay speed 5% per tick
this.speed = Math.round(Math.max(0, Math.abs(this.speed) - 10) * sign(this.speed));
}

View File

@ -8,6 +8,8 @@ namespace pxsim.visuals {
private static colorIds = ['red', 'yellow', 'blue', 'green', 'black', 'grey', 'white'];
private static colorValue = [5, 4, 2, 3, 1, 7, 6];
private colorDivs: Element[] = [];
getInnerView() {
this.group = svg.elt("g") as SVGGElement;
this.group.setAttribute("transform", `translate(2, 2.5) scale(0.6)`)
@ -23,6 +25,7 @@ namespace pxsim.visuals {
const circle = pxsim.svg.child(this.group, "circle", {
'class': `sim-color-grid-circle sim-color-grid-${colorIds[c]}`,
'cx': cx, 'cy': cy, 'r': '2', 'style': `fill: ${colors[c]}` });
this.colorDivs.push(circle);
pointerEvents.down.forEach(evid => circle.addEventListener(evid, ev => {
this.setColor(ColorGridControl.colorValue[c]);
}));
@ -30,7 +33,8 @@ namespace pxsim.visuals {
}
const whiteCircleWrapper = pxsim.svg.child(this.group, "g", { 'id': 'white-cirlce-wrapper' });
pxsim.svg.child(whiteCircleWrapper, "circle", { 'class': 'sim-color-grid-circle sim-color-grid-white', 'cx': 2.2, 'cy': '16', 'r': '2', 'style': `fill: #fff` });
const circle = pxsim.svg.child(whiteCircleWrapper, "circle", { 'class': 'sim-color-grid-circle sim-color-grid-white', 'cx': 2.2, 'cy': '16', 'r': '2', 'style': `fill: #fff` });
this.colorDivs.push(circle);
pxsim.svg.child(whiteCircleWrapper, "circle", { 'cx': 2.2, 'cy': '16', 'r': '2', 'style': `fill: none;stroke: #94989b;stroke-width: 0.1px` });
pointerEvents.down.forEach(evid => whiteCircleWrapper.addEventListener(evid, ev => {
this.setColor(6);
@ -56,7 +60,7 @@ namespace pxsim.visuals {
for (let c = 0; c < ColorGridControl.colorValue.length; c++) {
const colorId = ColorGridControl.colorIds[c];
const colorValue = ColorGridControl.colorValue[c];
const colorDiv = this.group.getElementsByClassName(`sim-color-grid-${colorId}`)[0] as HTMLElement;
const colorDiv = this.colorDivs[c] as HTMLElement;
if (colorValue == color) {
pxsim.U.addClass(colorDiv, 'sim-color-selected');

View File

@ -13,7 +13,7 @@ namespace pxsim.visuals {
private static SLIDER_RADIUS = 100;
private internalSpeed: number = 0;
private internalAngle: number = 0;
getInnerView(parent: SVGSVGElement, globalDefs: SVGDefsElement) {
this.group = svg.elt("g") as SVGGElement;
@ -102,9 +102,9 @@ namespace pxsim.visuals {
} else if (dx >= 0 && dy <= 0) {
deg = 90 - deg;
}
const value = Math.abs(Math.ceil((deg % 360) / 360 * this.getMax()));
const value = Math.abs(Math.ceil((deg % 360)));
this.internalSpeed = value;
this.internalAngle = value;
this.updateDial();
this.prevVal = deg;
@ -119,7 +119,7 @@ namespace pxsim.visuals {
private handleSliderMove() {
this.dial.setAttribute('cursor', '-webkit-grabbing');
const state = this.state;
state.manualMotorMove(this.internalSpeed);
state.manualMotorAngle(this.internalAngle);
}
private handleSliderUp() {
@ -127,19 +127,18 @@ namespace pxsim.visuals {
const state = this.state;
state.manualMotorUp();
this.internalSpeed = 0;
this.internalAngle = 0;
this.updateDial();
}
private updateDial() {
let speed = this.internalSpeed;
let angle = this.internalAngle;
// Update dial position
const deg = speed / this.getMax() * 360; // degrees
const radius = MotorSliderControl.SLIDER_RADIUS;
const dialRadius = 5;
const x = Math.ceil((radius - dialRadius) * Math.sin(deg * Math.PI / 180)) + radius;
const y = Math.ceil((radius - dialRadius) * -Math.cos(deg * Math.PI / 180)) + radius;
const x = Math.ceil((radius - dialRadius) * Math.sin(angle * Math.PI / 180)) + radius;
const y = Math.ceil((radius - dialRadius) * -Math.cos(angle * Math.PI / 180)) + radius;
this.dial.setAttribute('transform', `translate(${x}, ${y})`);
}
@ -148,18 +147,10 @@ namespace pxsim.visuals {
return;
}
const node = this.state;
const speed = node.getSpeed();
const angle = node.getAngle() % 360;
// Update reporter
this.reporter.textContent = `${speed}`;
}
private getMin() {
return 0;
}
private getMax() {
return 100;
this.reporter.textContent = `${angle}°`;
}
}

View File

@ -12,6 +12,7 @@ namespace pxsim.visuals {
export const MODULE_INNER_PADDING_RATIO = 1 / 35;
export const MAX_MODULE_WIDTH = 100;
export const MIN_MODULE_HEIGHT = 40;
export const CLOSE_ICON_GAP_MULTIPLIER = 0.3;
@ -372,7 +373,7 @@ namespace pxsim.visuals {
// Translate and resize view
view.resize(inputWidth - inputPadding * 2, inputHeight);
const viewHeight = view.getActualHeight();
const viewHeight = Math.max(view.getActualHeight(), MIN_MODULE_HEIGHT);
view.translate(inputPadding, 0, true);
// Resize control

View File

@ -36,7 +36,10 @@ namespace pxsim.visuals {
private updateSensorLightVisual(color: string) {
const sensorHole = this.content.getElementById(this.normalizeId(ColorSensorView.sensor_hole_id)) as SVGCircleElement;
sensorHole.style.fill = color;
sensorHole.style.stroke = color;
if (color != '#ffffff') {
sensorHole.style.strokeWidth = '2px';
}
}
}
}

View File

@ -15,6 +15,6 @@
"Maker": "maker"
},
"electronManifest": {
"latest": "v0.1.30"
"latest": "v0.1.36"
}
}