Compare commits

...

6 Commits

Author SHA1 Message Date
6a577287c1 1.4.8 2019-10-16 21:24:06 -07:00
8bd884e155 bump blockly 2019-10-16 21:23:14 -07:00
20be398c2c refactor constants 2019-10-13 09:32:43 -07:00
ccf6164d87 logging 2019-10-13 09:22:07 -07:00
58294883d7 blink fix (#949) 2019-10-13 00:36:44 -07:00
38b2fc7b95 Add run it again to try tutorial to show where to find programs on brick (#947) 2019-10-12 15:36:13 -07:00
4 changed files with 29 additions and 18 deletions

View File

@ -73,6 +73,12 @@ Verify that the program you just created shows eyes on the Brick Display, and th
**Well done!**
## Run it Again
![EV3 Brick with Try in BrkProg_Save Folder in File Manager](/static/getting-started/try-in-file-manager.png)
Use the Brick Buttons and navigate to the File Manager tab. Open the **BrkProg_SAVE** folder, select **Try** and click the center button to run it again.
## Connect a Large Motor @unplugged
Now you will learn to control the Large Motor.

View File

@ -1,5 +1,4 @@
const enum ColorSensorMode {
None = 0,
//% block="reflected light intensity"
ReflectedLightIntensity = 0,
//% block="ambient light intensity"
@ -59,7 +58,6 @@ namespace sensors {
constructor(port: number) {
super(port)
this._setMode(ColorSensorMode.None);
this.thresholdDetector = new sensors.ThresholdDetector(this.id());
this.calibrating = false;
}

View File

@ -277,22 +277,25 @@ void cUiUpdatePower(void)
const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
let r = 0;
for (let i = 0; i < conns.length; ++i) {
r = (r << 8 | conns[i]);
r = conns[i] + (r << 6) + (r << 16) - r;
}
return r;
}
let nonActivated = 0;
function detectDevices() {
//control.dmesg(`detect devices (${nonActivated} na)`)
control.dmesg(`detect devices (hash ${hashDevices()})`)
const conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
let numChanged = 0;
const uartSensors: SensorInfo[] = [];
for (const sensorInfo of sensorInfos) {
const newConn = conns[sensorInfo.port]
if (newConn == sensorInfo.connType) {
// control.dmesg(`connection unchanged ${newConn} at ${sensorInfo.port}`)
if (newConn == sensorInfo.connType
&& sensorInfo.sensor
&& sensorInfo.sensor.isActive()) {
if (newConn == DAL.CONN_INPUT_UART)
uartSensors.push(sensorInfo);
continue;
}
numChanged++
@ -323,7 +326,8 @@ void cUiUpdatePower(void)
for (const sensorInfo of uartSensors) {
let uinfo = readUartInfo(sensorInfo.port, 0)
sensorInfo.devType = uinfo[TypesOff.Type]
control.dmesg(`UART type ${sensorInfo.devType}`)
const mode = uinfo[TypesOff.Mode];
control.dmesg(`UART type ${sensorInfo.devType} mode ${mode}`)
}
}
@ -458,7 +462,7 @@ void cUiUpdatePower(void)
reset() {
if (this.isActive()) uartReset(this._port);
this.realmode = 0;
this.realmode = -1;
}
}
@ -536,8 +540,6 @@ void cUiUpdatePower(void)
function uartClearChange(port: number) {
control.dmesg(`UART clear change`);
const UART_DATA_READY = 8
const UART_PORT_CHANGED = 1
while (true) {
let status = getUartStatus(port)
if (port < 0) break
@ -558,7 +560,7 @@ void cUiUpdatePower(void)
}
function setUartModes() {
control.dmesg(`UART set modes`)
control.dmesg(`UART set modes 0x${devcon.toHex()}`)
uartMM.ioctl(IO.UART_SET_CONN, devcon)
const ports: number[] = [];
for (let port = 0; port < DAL.NUM_INPUTS; ++port) {
@ -570,22 +572,26 @@ void cUiUpdatePower(void)
while (ports.length) {
const port = ports.pop();
const status = waitNonZeroUartStatus(port)
control.dmesg(`UART set mode ${status} at ${port}`);
control.dmesg(`UART status ${status} at ${port}`);
if (!(status & UART_DATA_READY))
setUartMode(port, devcon[DevConOff.Mode + port]);
}
}
function updateUartMode(port: number, mode: number) {
control.dmesg(`UART set mode to ${mode} at ${port}`)
control.dmesg(`UART update mode to ${mode} at ${port}`)
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Connection + port, DAL.CONN_INPUT_UART)
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Type + port, 33)
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Mode + port, mode)
}
const UART_PORT_CHANGED = 1
const UART_DATA_READY = 8
function setUartMode(port: number, mode: number) {
const UART_PORT_CHANGED = 1
while (true) {
if (port < 0) return
updateUartMode(port, mode);
control.dmesg(`UART set mode 0x${devcon.toHex()}`)
uartMM.ioctl(IO.UART_SET_CONN, devcon)
let status = waitNonZeroUartStatus(port)
if (status & UART_PORT_CHANGED) {
@ -593,7 +599,8 @@ void cUiUpdatePower(void)
uartClearChange(port)
} else {
control.dmesg(`UART status ${status}`);
break;
if (status & UART_DATA_READY)
break;
}
pause(10)
}

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "1.4.7",
"version": "1.4.8",
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
"private": false,
"keywords": [
@ -45,8 +45,8 @@
"@types/web-bluetooth": "0.0.4"
},
"dependencies": {
"pxt-common-packages": "6.16.10",
"pxt-core": "5.25.13"
"pxt-common-packages": "6.16.11",
"pxt-core": "5.25.16"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"