Compare commits
299 Commits
Author | SHA1 | Date | |
---|---|---|---|
0f3de6cf07 | |||
21195e4abf | |||
c992100a38 | |||
20a4673f98 | |||
966fd81870 | |||
cb9d2aeb39 | |||
3cee55f4c2 | |||
3815d2fd3b | |||
1453b7e0a3 | |||
6fb5c54280 | |||
9d5ca35e83 | |||
893dd0f9c4 | |||
c3419c0b74 | |||
a4164470d8 | |||
54cb076002 | |||
dbd3eb464b | |||
fddc4e647a | |||
798a351f15 | |||
e61dffff03 | |||
b9f5096480 | |||
9912d68c8b | |||
951b9be6e4 | |||
f64bf57000 | |||
f1242724b5 | |||
cd0c9df86e | |||
337d42287a | |||
ce3383f1b7 | |||
e51721303a | |||
50f6c77fdb | |||
5ed0135124 | |||
892a2d585f | |||
9890f2340a | |||
109b809909 | |||
9cbf5efd7e | |||
a27a7fcd55 | |||
85263fb84d | |||
b5ad898c9e | |||
456df3c442 | |||
1552eb05b4 | |||
d60e2c4a7d | |||
f4b78c3ee7 | |||
dd5e1957d5 | |||
d61a63f70a | |||
4207bd06c0 | |||
58763e398b | |||
f77bf165eb | |||
4880d9ea5b | |||
ab4fb019f9 | |||
2c2df31ba3 | |||
0f2bda2496 | |||
44386be3c7 | |||
89ca66b8a9 | |||
64389a7689 | |||
f77778ef85 | |||
7d01823caf | |||
b3f9a4c92f | |||
7fe8580de8 | |||
c70d6fe01a | |||
ed7099cc97 | |||
a79704fecc | |||
6a1b560101 | |||
5e21f9ab6d | |||
74648bd1df | |||
e24d4d56b1 | |||
0345277bef | |||
9ae6482f28 | |||
77fb64043d | |||
f875681661 | |||
fbb1fa688d | |||
485f02ed27 | |||
81f406c6cc | |||
ac0a7b326f | |||
c814728354 | |||
abeb378b17 | |||
6928f9e50e | |||
931987468a | |||
94c4e508fe | |||
ea46f1cbc7 | |||
9f9ce29476 | |||
50f6b04ed4 | |||
64d6c2b090 | |||
76ff39605a | |||
2d3ea5631a | |||
e938f354fd | |||
886464b470 | |||
b9ff9d21f1 | |||
aa06fd344a | |||
dc6ce0efc7 | |||
4039a85bc9 | |||
7bd6280292 | |||
2ebe96e563 | |||
a9be582f90 | |||
ac428a3936 | |||
de91dc6ab7 | |||
1e460eef9e | |||
0db6987ee5 | |||
148657908c | |||
f3f87331c8 | |||
5aef77ccc6 | |||
59ca9cf463 | |||
7da811246c | |||
69f8453947 | |||
39ba9b81af | |||
51a14596cd | |||
8518c446cd | |||
2f69df0d9d | |||
1789d0ce21 | |||
d0809510c4 | |||
6b9c0eaf65 | |||
52bdf94233 | |||
fd50ed8f7c | |||
ba0eb93b0f | |||
9a4ed45797 | |||
820fdf3a3c | |||
348d5ffc26 | |||
95e47a0b25 | |||
c3312ed5d1 | |||
b7cdc7d0fe | |||
dde5a35cd9 | |||
be398d84ee | |||
4445acce7a | |||
d6d8b0655b | |||
216aa1ddaf | |||
783a561941 | |||
c916664ae7 | |||
4b836ede1b | |||
52fdaeec99 | |||
2aaa45e10d | |||
7993363e89 | |||
4d671f6cb0 | |||
cc020d5a81 | |||
5c39862a44 | |||
e0e5c95989 | |||
800b4ad224 | |||
40c3b4b0cf | |||
64bdc35e6f | |||
2b5f702bb6 | |||
1c81ecd23f | |||
4d223374b5 | |||
dd9cf9014f | |||
eb11d7926c | |||
609740dc48 | |||
955a2c9757 | |||
02838e6c30 | |||
b0c54e84e6 | |||
b6644b7a23 | |||
3c4c38eb59 | |||
29aba7b10b | |||
7427142243 | |||
436500babb | |||
82be4e344b | |||
81bfca4ed6 | |||
c35dbdd38f | |||
1bc93013e6 | |||
58148eb1c3 | |||
a7c62b45b2 | |||
bd765d49ee | |||
383ca5467d | |||
e240e3b394 | |||
7affbf8cb6 | |||
4dff282633 | |||
5d470fdcef | |||
f30eac41e9 | |||
d7f46c0fb5 | |||
58384017f2 | |||
01f7fe633c | |||
a9a9a89811 | |||
7e2251d8ac | |||
1903a6e347 | |||
2fb75a2d83 | |||
0da175a8cd | |||
f01370e4fd | |||
751df2fe8c | |||
8be4bb11d8 | |||
342e714ae2 | |||
fb31b81f7e | |||
8204995749 | |||
85c14bb05a | |||
c398a5a133 | |||
a1b059171b | |||
afaedaa0b2 | |||
0aa41e9a64 | |||
88df2e14cb | |||
180f32f25c | |||
995527675a | |||
84eb849bc7 | |||
5e0e35b4bd | |||
300a2c1476 | |||
703bd01931 | |||
75a65eeab2 | |||
38a9f153f7 | |||
3c5dae8c7b | |||
85345969d3 | |||
ac1e5d2846 | |||
11b4bbc07e | |||
7f5b8aed99 | |||
c989e2fdab | |||
d3dcb5de85 | |||
9cca35d49f | |||
7123bfecd3 | |||
c8ac770983 | |||
aa031036ee | |||
a7d002d949 | |||
93fd8c8c78 | |||
1765ca2d35 | |||
1ab7ae6cfa | |||
3acf4e9ac5 | |||
ef5fa9ae82 | |||
e1f7a5b8cf | |||
2c73bfc813 | |||
d78d9c8686 | |||
2157af3e63 | |||
eac3e183c3 | |||
785ddff706 | |||
e07d6e3a31 | |||
763ad3f763 | |||
919a03951c | |||
9e427898ae | |||
60bf3a17d3 | |||
0529759a80 | |||
b07f157181 | |||
2f5f7d4133 | |||
e6e1dce59f | |||
43a9d03231 | |||
c0f6cd3651 | |||
f1445c6e89 | |||
04275ee35c | |||
f8d0594eca | |||
5be3b31e00 | |||
84c1079e50 | |||
6320379d02 | |||
b166f6034e | |||
d07f672b28 | |||
363e076f36 | |||
8bf6f265f7 | |||
217958aec3 | |||
367b1b0d1a | |||
6836852122 | |||
944098b9f9 | |||
539cf3d73e | |||
4b3e7cfb7d | |||
b144744509 | |||
e591bed6ad | |||
6a4e64eac0 | |||
f7dd14ff7b | |||
bfd34cedd6 | |||
8e1c075911 | |||
a02f364a4c | |||
48fee2c215 | |||
5780d1982c | |||
6fb08f0f7b | |||
13f8659b98 | |||
edc9d17a8c | |||
c7a3f5bbd0 | |||
41d5052583 | |||
07ddec343a | |||
5a9a5e997a | |||
55b6549999 | |||
fcdc350e40 | |||
9dedbeae1b | |||
124d8a0fd8 | |||
81fcbb6916 | |||
d436bd1227 | |||
cb648019bb | |||
11a88a9d94 | |||
92178f3371 | |||
3c86ae286f | |||
1b6d84a9b8 | |||
2d81be3b24 | |||
14f57f54bf | |||
e7c697c24d | |||
7ac63f038c | |||
557926d631 | |||
da62d51615 | |||
3918857fcc | |||
f1dcebdd88 | |||
1d35c78737 | |||
d17326ad7a | |||
4948a88833 | |||
b73b924ec4 | |||
641d292c33 | |||
223275fd65 | |||
6e42e816d3 | |||
5678cf5df9 | |||
67ec4accb9 | |||
fa867c3a34 | |||
7865876e64 | |||
113b42656c | |||
7557380722 | |||
3e2a1ec9e1 | |||
09db613620 | |||
bacb4673c9 | |||
e649a167cd | |||
997e8efb20 | |||
1f380ce959 | |||
fbc6fc30a7 | |||
fee2329ca7 | |||
5768fcaf35 | |||
0886a5d4e1 |
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
This repo contains the editor target hosted at https://d541eec2-1e96-4b7b-a223-da9d01d0337a.pxt.io/
|
This repo contains the editor target hosted at https://d541eec2-1e96-4b7b-a223-da9d01d0337a.pxt.io/
|
||||||
|
|
||||||
Issue tracker: https://src.education.lego.com/groups/ev3-makecode
|
LEGO Auth: https://src.education.lego.com/groups/ev3-makecode (use Google Authenticator)
|
||||||
|
LEGO Chat: https://chat.internal.education.lego.com/make-code/channels/town-square
|
||||||
|
|
||||||
## Local Dev setup
|
## Local Dev setup
|
||||||
|
|
||||||
|
@ -2,14 +2,10 @@
|
|||||||
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
require("./editor")
|
const deploy = require("./editor/deploy")
|
||||||
|
|
||||||
declare namespace pxt.editor {
|
|
||||||
function deployCoreAsync(resp: pxtc.CompileResult, disconnect?: boolean): Promise<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function deployCoreAsync(resp: pxtc.CompileResult) {
|
export function deployCoreAsync(resp: pxtc.CompileResult) {
|
||||||
return pxt.editor.deployCoreAsync(resp, process.env["PXT_SERIAL"] ? false : true)
|
return deploy.deployCoreAsync(resp, process.env["PXT_SERIAL"] ? false : true)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
fs.writeFileSync("built/full-" + pxtc.BINARY_UF2, resp.outfiles[pxtc.BINARY_UF2], {
|
fs.writeFileSync("built/full-" + pxtc.BINARY_UF2, resp.outfiles[pxtc.BINARY_UF2], {
|
||||||
encoding: "base64"
|
encoding: "base64"
|
||||||
|
171
docs/coding.md
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
# Coding Activites
|
||||||
|
|
||||||
|
12 computer science activities, with cross-curricular opportunities in design and technology, science, and math.
|
||||||
|
|
||||||
|
* [Download Curriculum Materials](https://education.lego.com/en-us/downloads/mindstorms-ev3)
|
||||||
|
|
||||||
|
## Three Point Turn
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Three Point Turn 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/three-point-turn-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Three Point Turn 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/three-point-turn-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Three Point Turn 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/three-point-turn-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reversing the robot
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Reversing the robot 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/reversing-the-robot-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Reversing the robot 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/reversing-the-robot-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Reversing the robot 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/reversing-the-robot-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Light the way
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Light the way 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/light-the-way-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Light the way 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/light-the-way-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Light the way 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/light-the-way-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Traffic Lights
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Traffic Lights 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/traffic-lights-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Traffic Lights 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/traffic-lights-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Traffic Lights 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/traffic-lights-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reverse Bepper
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Reverse Beeper 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/reverse-beeper-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Reverse Beeper 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/reverse-beeper-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Reverse Beeper 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/reverse-beeper-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ignition
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Ignition 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/ingition-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Ignition 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/ignition-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Ignition 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/ignition-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cruise Control
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Cruise Control 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/cruise-control-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Cruise Control 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/cruise-control-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Cruise Control 3",
|
||||||
|
"description": "Activity 3",
|
||||||
|
"url":"/coding/cruise-control-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Roaming
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[{
|
||||||
|
"name": "Roaming 1",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/roaming-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Roaming 2",
|
||||||
|
"description": "Activity 2",
|
||||||
|
"url":"/coding/roaming-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}]
|
||||||
|
```
|
10
docs/coding/cruise-control-1.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Cruise Control Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let speed = 0;
|
||||||
|
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
if (speed < 100)
|
||||||
|
speed = speed + 10;
|
||||||
|
motors.largeBC.setSpeed(speed);
|
||||||
|
})
|
||||||
|
```
|
15
docs/coding/cruise-control-2.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Cruise Control Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let speed = 0;
|
||||||
|
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
if (speed < 100)
|
||||||
|
speed = speed + 10;
|
||||||
|
motors.largeBC.setSpeed(speed);
|
||||||
|
})
|
||||||
|
sensors.touch2.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
if (speed > -100)
|
||||||
|
speed = speed - 10;
|
||||||
|
motors.largeBC.setSpeed(speed);
|
||||||
|
})
|
||||||
|
```
|
28
docs/coding/cruise-control-3.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Cruise Control Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let speed = 0
|
||||||
|
function decelerate() {
|
||||||
|
if (speed > -100) {
|
||||||
|
speed = speed - 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function accelerate() {
|
||||||
|
if (speed < 100) {
|
||||||
|
speed = speed + 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function update() {
|
||||||
|
brick.clearScreen()
|
||||||
|
brick.showString("speed: " + speed, 1)
|
||||||
|
motors.largeBC.setSpeed(speed)
|
||||||
|
}
|
||||||
|
sensors.touch2.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
accelerate()
|
||||||
|
update()
|
||||||
|
})
|
||||||
|
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
decelerate()
|
||||||
|
update()
|
||||||
|
})
|
||||||
|
```
|
11
docs/coding/ignition-1.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Ignition Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
brick.showImage(images.eyesDizzy)
|
||||||
|
})
|
||||||
|
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () {
|
||||||
|
brick.showImage(images.eyesTiredMiddle)
|
||||||
|
})
|
||||||
|
brick.showImage(images.eyesSleeping)
|
||||||
|
```
|
12
docs/coding/ignition-2.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Ignition Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
while (true) {
|
||||||
|
if (sensors.touch1.wasPressed() &&
|
||||||
|
sensors.ultrasonic4.distance() < 10) {
|
||||||
|
music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
|
||||||
|
music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
|
||||||
|
}
|
||||||
|
loops.pause(1);
|
||||||
|
}
|
||||||
|
```
|
13
docs/coding/ignition-3.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Ignition Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
while (true) {
|
||||||
|
if (sensors.ultrasonic4.distance() < 10 &&
|
||||||
|
sensors.touch1.wasPressed() &&
|
||||||
|
brick.buttonEnter.wasPressed()) {
|
||||||
|
music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
|
||||||
|
music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
|
||||||
|
}
|
||||||
|
loops.pause(1);
|
||||||
|
}
|
||||||
|
```
|
9
docs/coding/light-the-way-1.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Light the way Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () {
|
||||||
|
brick.showImage(images.objectsLightOn)
|
||||||
|
loops.pause(5000)
|
||||||
|
brick.clearScreen()
|
||||||
|
})
|
||||||
|
```
|
10
docs/coding/light-the-way-2.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Light the way Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Bright, function () {
|
||||||
|
brick.clearScreen()
|
||||||
|
})
|
||||||
|
sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () {
|
||||||
|
brick.showImage(images.objectsLightOn)
|
||||||
|
})
|
||||||
|
```
|
13
docs/coding/light-the-way-3.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Light the way Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Bright, function () {
|
||||||
|
brick.clearScreen()
|
||||||
|
})
|
||||||
|
sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () {
|
||||||
|
brick.showImage(images.objectsLightOn)
|
||||||
|
})
|
||||||
|
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||||
|
brick.showImage(images.objectsLightOn);
|
||||||
|
})
|
||||||
|
```
|
11
docs/coding/reverse-beeper-1.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Reverse Beeper Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
loops.forever(function () {
|
||||||
|
music.playTone(440, sensors.ultrasonic4.distance());
|
||||||
|
loops.pause(50)
|
||||||
|
})
|
||||||
|
motors.largeBC.setSpeed(-20);
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
|
||||||
|
motors.largeBC.stop();
|
||||||
|
```
|
13
docs/coding/reverse-beeper-2.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Reverse Beeper Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
loops.forever(function () {
|
||||||
|
if (motors.largeB.speed() != 0 && sensors.ultrasonic4.distance() < 20) {
|
||||||
|
music.playTone(440, sensors.ultrasonic4.distance());
|
||||||
|
loops.pause(50)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
motors.largeBC.setSpeed(-20);
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
|
||||||
|
motors.largeBC.stop();
|
||||||
|
```
|
20
docs/coding/reverse-beeper-3.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Reverse Beeper Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let beep = false
|
||||||
|
beep = true
|
||||||
|
control.runInBackground(function () {
|
||||||
|
motors.largeBC.setSpeed(-20)
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear)
|
||||||
|
motors.largeBC.stop()
|
||||||
|
beep = false
|
||||||
|
})
|
||||||
|
control.runInBackground(function () {
|
||||||
|
while (beep) {
|
||||||
|
if (sensors.ultrasonic4.distance() < 20) {
|
||||||
|
music.playTone(440, sensors.ultrasonic4.distance())
|
||||||
|
loops.pause(50)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
14
docs/coding/reversing-the-robot-1.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Reversing the robot Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.setSpeed(50)
|
||||||
|
sensors.touchSensor1.pauseUntil(TouchSensorEvent.Pressed)
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
loops.pause(1000)
|
||||||
|
brick.setLight(LightsPattern.OrangeFlash)
|
||||||
|
motors.largeBC.setSpeed(-50)
|
||||||
|
loops.pause(2000)
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
})
|
||||||
|
```
|
15
docs/coding/reversing-the-robot-2.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Reversing the robot Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
sensors.touchSensor1.pauseUntil(TouchSensorEvent.Pressed)
|
||||||
|
motors.largeBC.setSpeed(50)
|
||||||
|
sensors.touchSensor2.pauseUntil(TouchSensorEvent.Pressed)
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
loops.pause(1000)
|
||||||
|
brick.setLight(LightsPattern.OrangeFlash)
|
||||||
|
motors.largeBC.setSpeed(-50)
|
||||||
|
loops.pause(2000)
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
})
|
||||||
|
```
|
19
docs/coding/reversing-the-robot-3.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Reversing the robot Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
brick.showImage(images.eyesSleeping)
|
||||||
|
sensors.touchSensor1.pauseUntil(TouchSensorEvent.Pressed)
|
||||||
|
brick.showImage(images.eyesNeutral)
|
||||||
|
motors.largeBC.setSpeed(50)
|
||||||
|
sensors.touchSensor2.pauseUntil(TouchSensorEvent.Pressed)
|
||||||
|
brick.showImage(images.eyesTiredMiddle)
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
loops.pause(1000)
|
||||||
|
brick.setLight(LightsPattern.OrangeFlash)
|
||||||
|
brick.showImage(images.eyesDizzy)
|
||||||
|
motors.largeBC.setSpeed(-50)
|
||||||
|
loops.pause(2000)
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
})
|
||||||
|
```
|
36
docs/coding/roaming-1.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Roaming Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let drive: number[] = []
|
||||||
|
brick.buttonLeft.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(1)
|
||||||
|
})
|
||||||
|
brick.buttonRight.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(3)
|
||||||
|
})
|
||||||
|
brick.buttonUp.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(4)
|
||||||
|
})
|
||||||
|
brick.buttonDown.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(5)
|
||||||
|
})
|
||||||
|
pauseUntil(() => drive.length >= 5)
|
||||||
|
loops.pause(1000)
|
||||||
|
music.playSoundEffectUntilDone(sounds.communicationGo)
|
||||||
|
for (let d of drive) {
|
||||||
|
if (d == 1) {
|
||||||
|
motors.largeC.setSpeedFor(50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeC.pauseUntilReady()
|
||||||
|
} else if (d == 3) {
|
||||||
|
motors.largeB.setSpeedFor(50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeB.pauseUntilReady()
|
||||||
|
} else if (d == 4) {
|
||||||
|
motors.largeBC.setSpeedFor(50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeBC.pauseUntilReady()
|
||||||
|
} else {
|
||||||
|
motors.largeBC.setSpeedFor(-50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeBC.pauseUntilReady()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
music.playSoundEffectUntilDone(sounds.communicationGameOver)
|
||||||
|
```
|
40
docs/coding/roaming-2.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Roaming Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let drive: number[] = []
|
||||||
|
brick.buttonLeft.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(1)
|
||||||
|
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||||
|
})
|
||||||
|
brick.buttonRight.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(3)
|
||||||
|
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||||
|
})
|
||||||
|
brick.buttonUp.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(4)
|
||||||
|
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||||
|
})
|
||||||
|
brick.buttonDown.onEvent(ButtonEvent.Click, function () {
|
||||||
|
drive.push(5)
|
||||||
|
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||||
|
})
|
||||||
|
brick.buttonEnter.pauseUntil(ButtonEvent.Click);
|
||||||
|
loops.pause(1000)
|
||||||
|
music.playSoundEffectUntilDone(sounds.communicationGo)
|
||||||
|
for (let d of drive) {
|
||||||
|
if (d == 1) {
|
||||||
|
motors.largeC.setSpeedFor(50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeC.pauseUntilReady()
|
||||||
|
} else if (d == 3) {
|
||||||
|
motors.largeB.setSpeedFor(50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeB.pauseUntilReady()
|
||||||
|
} else if (d == 4) {
|
||||||
|
motors.largeBC.setSpeedFor(50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeBC.pauseUntilReady()
|
||||||
|
} else {
|
||||||
|
motors.largeBC.setSpeedFor(-50, 360, MoveUnit.Degrees)
|
||||||
|
motors.largeBC.pauseUntilReady()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
music.playSoundEffectUntilDone(sounds.communicationGameOver)
|
||||||
|
```
|
12
docs/coding/three-point-turn-1.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Three Point Turn Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(75, 30)
|
||||||
|
loops.pause(1500)
|
||||||
|
motors.largeBC.tank(-30, -75)
|
||||||
|
loops.pause(1000)
|
||||||
|
motors.largeBC.tank(50, 50)
|
||||||
|
loops.pause(3000)
|
||||||
|
})
|
||||||
|
```
|
14
docs/coding/three-point-turn-2.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Three Point Turn Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(75, 30)
|
||||||
|
loops.pause(1500)
|
||||||
|
motors.largeBC.tank(-30, -75)
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
|
||||||
|
motors.largeBC.tank(0, 0)
|
||||||
|
loops.pause(1000)
|
||||||
|
motors.largeBC.tank(50, 50)
|
||||||
|
loops.pause(3000)
|
||||||
|
})
|
||||||
|
```
|
15
docs/coding/three-point-turn-3.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Three Point Turn Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(75, 30)
|
||||||
|
loops.pause(1500)
|
||||||
|
motors.largeBC.tank(-30, -75)
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
|
||||||
|
motors.largeBC.tank(0, 0)
|
||||||
|
music.playSoundEffect(sounds.animalsDogBark1)
|
||||||
|
loops.pause(1000)
|
||||||
|
motors.largeBC.tank(50, 50)
|
||||||
|
loops.pause(3000)
|
||||||
|
})
|
||||||
|
```
|
9
docs/coding/traffic-lights-1.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Traffic Lights Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(20, 20)
|
||||||
|
sensors.color3.pauseForColor(ColorSensorColor.Red)
|
||||||
|
motors.largeBC.tank(0, 0)
|
||||||
|
})
|
||||||
|
```
|
10
docs/coding/traffic-lights-2.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Traffic Lights Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
sensors.color3.onColorDetected(ColorSensorColor.Red, function () {
|
||||||
|
motors.largeBC.tank(0, 0)
|
||||||
|
})
|
||||||
|
sensors.color3.onColorDetected(ColorSensorColor.Green, function () {
|
||||||
|
motors.largeBC.tank(20, 20)
|
||||||
|
})
|
||||||
|
```
|
11
docs/coding/traffic-lights-3.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Traffic Lights Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
loops.forever(function () {
|
||||||
|
if (sensors.color3.light(LightIntensityMode.Reflected) < 15) {
|
||||||
|
motors.largeBC.tank(30, 12)
|
||||||
|
} else {
|
||||||
|
motors.largeBC.tank(12, 30)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
50
docs/examples/line-follower-pid.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Gradien follower PID + calibration
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let lasterror = 0
|
||||||
|
let D = 0
|
||||||
|
let I = 0
|
||||||
|
let P = 0
|
||||||
|
let error = 0
|
||||||
|
let setpoint = 0
|
||||||
|
let max = 0
|
||||||
|
let min = 0
|
||||||
|
let v = 0
|
||||||
|
v = sensors.color3.light(LightIntensityMode.Reflected)
|
||||||
|
min = v
|
||||||
|
max = v
|
||||||
|
setpoint = v
|
||||||
|
while (!(brick.buttonEnter.wasPressed())) {
|
||||||
|
brick.clearScreen()
|
||||||
|
brick.showString("Move robot on terrain", 1)
|
||||||
|
brick.showString("Press ENTER when done", 2)
|
||||||
|
v = sensors.color3.light(LightIntensityMode.Reflected)
|
||||||
|
min = Math.min(min, v)
|
||||||
|
max = Math.max(max, v)
|
||||||
|
setpoint = (max + min) / 2
|
||||||
|
brick.showValue("v", v, 3)
|
||||||
|
brick.showValue("min", min, 4)
|
||||||
|
brick.showValue("max", v, 5)
|
||||||
|
brick.showValue("setpoint", setpoint, 6)
|
||||||
|
loops.pause(100)
|
||||||
|
}
|
||||||
|
loops.forever(function () {
|
||||||
|
brick.clearScreen()
|
||||||
|
v = sensors.color3.light(LightIntensityMode.Reflected)
|
||||||
|
brick.showValue("light", v, 1)
|
||||||
|
error = v - setpoint
|
||||||
|
brick.showValue("error", error, 2)
|
||||||
|
P = error * 5
|
||||||
|
brick.showValue("P", P, 3)
|
||||||
|
I = I + error * 0.01
|
||||||
|
brick.showValue("I", I, 4)
|
||||||
|
D = (error - lasterror) * 0.2
|
||||||
|
brick.showValue("D", D, 5)
|
||||||
|
motors.largeBC.steer(P + (I + D), 100)
|
||||||
|
lasterror = error
|
||||||
|
if (brick.buttonEnter.wasPressed()) {
|
||||||
|
motors.largeBC.setSpeed(0)
|
||||||
|
brick.buttonDown.pauseUntil(ButtonEvent.Click)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
BIN
docs/static/MC-LEGO-loader-eyes.gif
vendored
Normal file
After Width: | Height: | Size: 69 KiB |
109
docs/static/avatar.svg
vendored
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1"
|
||||||
|
id="svg2" inkscape:version="0.91 r13725" sodipodi:docname="avatar.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 32 32"
|
||||||
|
style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#303030;}
|
||||||
|
</style>
|
||||||
|
<sodipodi:namedview bordercolor="#666666" borderopacity="1" gridtolerance="10" guidetolerance="10" id="namedview15" inkscape:current-layer="svg2" inkscape:cx="16" inkscape:cy="16" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="661" inkscape:window-maximized="0" inkscape:window-width="997" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="5.2149125" objecttolerance="10" pagecolor="#ffffff" showgrid="false">
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<g id="avatar_mf" transform="translate(-5304.979 8145.745)">
|
||||||
|
<path id="Path_180" class="st0" d="M5317.1-8125.6c0.2,0,0.3-0.1,0.5-0.1l2.9-0.6c1.3-0.3,2.5-0.5,3.8-0.8c0.5-0.1,1-0.2,1.5-0.3
|
||||||
|
c0.1,0,0.1,0,0.1-0.1c0-0.5,0-1-0.1-1.5c-0.1-0.6-0.2-1.1-0.3-1.7c-0.1-0.4-0.1-0.8-0.2-1.2c-0.1-0.7-0.2-1.4-0.3-2
|
||||||
|
c-0.1-0.6-0.2-1.1-0.3-1.7c0-0.2-0.2-0.4-0.4-0.4c0,0,0,0-0.1,0c-0.2,0-0.5,0.1-0.7,0.1c-0.5,0.1-1,0.1-1.5,0.2
|
||||||
|
c-0.5,0.1-1,0.1-1.6,0.2c-0.5,0.1-1,0.1-1.4,0.2c-0.2,0-0.3,0-0.5,0.1c-0.2,0-0.4,0.2-0.5,0.4c0,0.2-0.1,0.4-0.1,0.5
|
||||||
|
c0,0.4-0.1,0.8-0.1,1.2c-0.1,0.5-0.1,1-0.2,1.5c0,0.4-0.1,0.9-0.1,1.3l-0.1,1.3l-0.1,1.3c-0.1,0.5-0.1,1-0.2,1.5
|
||||||
|
C5317.1-8126,5317.1-8125.8,5317.1-8125.6z"/>
|
||||||
|
<path id="Path_181" class="st0" d="M5316.1-8140c0,0.6,0.1,1.2,0.1,1.8c0,0.4,0.2,0.8,0.6,1c0.3,0.2,0.7,0.3,1.1,0.3
|
||||||
|
c0.7,0.1,1.4,0.1,2.1,0c0.6,0,1.2-0.1,1.8-0.2c0.4,0,0.9-0.2,1.2-0.5c0.3-0.3,0.5-0.7,0.5-1.1c0-1.2,0-2.3-0.1-3.5
|
||||||
|
c0-0.3-0.1-0.6-0.3-0.8c-0.3-0.4-0.8-0.6-1.4-0.6c0,0,0,0-0.1,0c-0.2,0.1-0.4,0.1-0.6,0.1c-0.9,0-1.8,0.1-2.7,0.1
|
||||||
|
c-0.1,0-0.3,0-0.4,0c-0.4-0.1-0.8,0-1.2,0.2c-0.4,0.2-0.6,0.6-0.7,1c0,0.1,0,0.2,0,0.3C5316-8141.2,5316.1-8140.6,5316.1-8140
|
||||||
|
L5316.1-8140z"/>
|
||||||
|
<path id="Path_182" class="st0" d="M5312-8129.2c0,0.6,0,1.2,0,1.8c0,0.1,0,0.1,0.1,0.1c0.3,0,0.6,0.1,0.9,0.1c0.3,0,0.7,0,1,0
|
||||||
|
c0.1,0,0.2,0,0.3,0c0.1,0,0.1,0,0.1-0.1c0.1-0.4,0.2-0.8,0.2-1.2c0.1-0.5,0.2-1,0.3-1.4c0-0.1,0.1-0.1,0.1-0.1
|
||||||
|
c0.4-0.2,0.8-0.5,1.2-0.8c0.4-0.4,0.7-0.9,0.8-1.5c0.1-0.6,0-1.2-0.4-1.7c-0.2-0.3-0.6-0.4-0.9-0.3c-0.3,0.1-0.6,0.3-0.9,0.5
|
||||||
|
c-0.7,0.6-1.5,1.2-2.2,1.8c-0.3,0.2-0.5,0.5-0.6,0.8c0,0.2-0.1,0.4-0.1,0.6C5311.9-8130.2,5311.9-8129.7,5312-8129.2
|
||||||
|
C5311.9-8129.2,5312-8129.2,5312-8129.2z"/>
|
||||||
|
<path id="Path_183" class="st0" d="M5315.5-8124.7c0,0.2-0.1,0.5-0.1,0.7c-0.1,0.5-0.4,0.9-0.8,1.1c0,0,0,0,0,0
|
||||||
|
c-0.1,0-0.2,0.2-0.2,0.3c-0.4,1.4-0.9,2.7-1.3,4.1c0,0,0,0.1,0,0.1c0.8,1.1,1.6,2.2,2.4,3.3c0,0,0,0,0.1,0.1
|
||||||
|
c0.1-0.2,0.1-0.3,0.2-0.5c0.1-0.3,0.2-0.5,0.3-0.8c0,0,0-0.1,0-0.1c-0.2-0.3-0.5-0.7-0.7-1c0,0,0-0.1,0-0.2
|
||||||
|
c0.3-0.9,0.6-1.7,0.9-2.6c0,0,0-0.1,0.1-0.1c0.5-0.2,0.9-0.6,1.1-1.1c0.1-0.3,0.1-0.7,0.1-1.1c0-0.4-0.1-0.8-0.3-1.2
|
||||||
|
c-0.2-0.4-0.5-0.8-1-1C5315.9-8124.7,5315.7-8124.7,5315.5-8124.7z"/>
|
||||||
|
<path id="Path_184" class="st0" d="M5314.7-8134.2c0.1-0.1,0.2-0.1,0.3-0.2c0.3-0.2,0.7-0.3,1-0.3c0.4,0,0.7,0.2,0.8,0.6
|
||||||
|
c0.6,1.1,0.5,2.4-0.4,3.3c-0.4,0.4-0.8,0.7-1.3,1c0,0-0.1,0.1-0.1,0.1c-0.2,0.8-0.3,1.6-0.5,2.5c0,0,0,0.1,0,0.1
|
||||||
|
c0,0.2,0,0.2-0.2,0.2c-0.1,0-0.1,0-0.2,0c0,0.1,0,0.2,0,0.3c0,0,0,0,0.1,0.1l1.9,0.7c0.2,0.1,0.4,0.2,0.7,0.2c0-0.1,0-0.2,0-0.2
|
||||||
|
c0-0.3,0-0.6,0-0.8l0.2-1.5l0.2-1.5c0.1-0.5,0.1-1,0.2-1.5c0.1-0.5,0.1-1.1,0.2-1.6c0.1-0.5,0.1-1,0.2-1.5c0-0.2,0-0.4,0-0.6
|
||||||
|
c0-0.2-0.1-0.4-0.3-0.4c0,0,0,0,0,0c-0.1,0-0.1,0-0.2,0c-0.6-0.1-1.2-0.2-1.9-0.3c-0.1,0-0.2,0-0.3,0c-0.1,0-0.2,0.1-0.3,0.3
|
||||||
|
C5314.8-8135,5314.7-8134.6,5314.7-8134.2z"/>
|
||||||
|
<path id="Path_185" class="st0" d="M5324.5-8117.2c-0.2-0.7-0.5-1.3-0.7-2l-0.7,0.3c0,0-0.1,0-0.1,0c-0.1,0.1-0.2,0-0.2-0.1
|
||||||
|
c-0.1-0.3-0.2-0.5-0.3-0.8c-0.2-0.7-0.5-1.4-0.7-2.1c0,0,0-0.1,0-0.1c0,0,0,0.1-0.1,0.1c-0.1,0.2-0.3,0.3-0.5,0.5c0,0-0.1,0-0.1,0
|
||||||
|
c-0.3,0.1-0.6,0.1-0.8,0.2c0,0-0.1,0-0.1,0c0,0.2-0.1,0.3-0.1,0.5c0.6,1.5,1.1,3.1,1.7,4.6c0,0,0,0,0,0.1
|
||||||
|
C5322.7-8116.3,5323.6-8116.7,5324.5-8117.2z"/>
|
||||||
|
<path id="Path_186" class="st0" d="M5325.4-8123.1c-0.7,0.2-1.3,0.3-2,0.5c-0.5,0.1-0.9,0.2-1.4,0.3c-0.1,0-0.2,0.1-0.1,0.2
|
||||||
|
c0,0,0,0,0,0.1c0.2,0.5,0.3,0.9,0.5,1.4c0.2,0.5,0.4,1.1,0.6,1.6c0,0,0,0,0,0c0.1-0.1,0.2-0.1,0.3-0.2c0.2-0.1,0.3-0.2,0.5-0.2
|
||||||
|
c0.2-0.1,0.4-0.1,0.6-0.2c0.7-0.2,1.5-0.4,2.2-0.6c0,0,0,0,0.1,0C5326.3-8121.1,5325.9-8122.1,5325.4-8123.1z"/>
|
||||||
|
<path id="Path_187" class="st0" d="M5320.7-8124.4c-0.4,0.1-0.8,0.2-1.2,0.3c-0.6,0.1-1.3,0.3-1.9,0.4c0,0-0.1,0-0.1,0
|
||||||
|
c-0.1,0-0.2-0.1-0.3-0.1c0,0,0,0.1,0,0.1c0.3,0.7,0.4,1.5,0.3,2.2c-0.1,0.4-0.3,0.8-0.5,1.1c0,0,0,0-0.1,0.1
|
||||||
|
c0.2-0.1,0.4-0.1,0.6-0.1l2.5-0.6c0.5-0.1,0.9-0.6,1-1.1c0.1-0.5,0-1-0.1-1.5C5320.8-8124,5320.8-8124.2,5320.7-8124.4z"/>
|
||||||
|
<path id="Path_188" class="st0" d="M5325.5-8127c-2.7,0.5-5.3,1.1-7.9,1.6c0,0.5,0,0.9,0.1,1.4c0.1,0,0.2,0,0.3-0.1
|
||||||
|
c1.2-0.3,2.3-0.5,3.5-0.8c1.2-0.3,2.4-0.5,3.6-0.8c0.1,0,0.3-0.1,0.4-0.1c0,0,0.1,0,0.1-0.1
|
||||||
|
C5325.6-8126.2,5325.5-8126.6,5325.5-8127z"/>
|
||||||
|
<path id="Path_189" class="st0" d="M5328.6-8118.4c-0.2-0.4-0.3-0.7-0.5-1.1c-0.1-0.2-0.2-0.5-0.3-0.7c0-0.1,0-0.1-0.1,0
|
||||||
|
c-1.2,0.3-2.4,0.6-3.6,1c0,0,0,0-0.1,0c0.2,0.7,0.5,1.3,0.7,2C5326-8117.6,5327.3-8118,5328.6-8118.4z"/>
|
||||||
|
<path id="Path_190" class="st0" d="M5319.9-8120.9l-0.6,0.1c-1,0.2-2,0.5-3,0.7c-0.1,0-0.1,0.1-0.1,0.1c-0.3,0.7-0.5,1.5-0.8,2.2
|
||||||
|
c0,0,0,0,0,0.1c0.2,0,0.4-0.1,0.5-0.1c1-0.3,2-0.5,3.1-0.8c0.1,0,0.2-0.1,0.3-0.2C5319.5-8119.5,5319.7-8120.2,5319.9-8120.9z"/>
|
||||||
|
<path id="Path_191" class="st0" d="M5325.1-8125.4c-1.1,0.2-2.2,0.5-3.3,0.7c0.3,0.7,0.4,1.4,0.3,2.2c0.2,0,0.4-0.1,0.5-0.1
|
||||||
|
c0.9-0.2,1.8-0.4,2.7-0.6c0.1,0,0.1,0,0.1-0.1c0.1-0.4,0-0.9-0.1-1.3C5325.3-8124.9,5325.2-8125.1,5325.1-8125.4
|
||||||
|
C5325.1-8125.3,5325.1-8125.4,5325.1-8125.4z"/>
|
||||||
|
<path id="Path_192" class="st0" d="M5325.6-8132c0.2,0,0.4,0,0.5,0c0.2,0,0.4,0,0.6,0c0.3,0,0.6-0.2,0.8-0.4c0.3-0.4,0.7-0.8,1-1.2
|
||||||
|
c-0.1-0.1-0.1-0.1-0.1-0.2c0,0,0,0-0.1,0c-0.7-0.1-1.3-0.5-1.4-1.2c-0.1-0.2-0.1-0.4-0.1-0.6c-0.2,0.1-0.3,0.3-0.5,0.4
|
||||||
|
c-0.1,0.1-0.2,0.1-0.3,0.2c0,0-0.1,0.1-0.2,0c-0.2,0-0.5-0.1-0.7-0.1c0,0,0,0-0.1,0C5325.3-8134.1,5325.4-8133.1,5325.6-8132z"/>
|
||||||
|
<path id="Path_193" class="st0" d="M5328.4-8134.2c0.2-0.3,0.5-0.5,0.8-0.7c0.4-0.4,0.6-0.8,0.7-1.4c0-0.1,0-0.2-0.1-0.3
|
||||||
|
c-0.3-0.5-0.7-1.1-1-1.6c0-0.1-0.1-0.1-0.1,0c-0.4,0.2-0.8,0.5-1.1,0.8c-0.2,0.2-0.4,0.4-0.6,0.6c-0.1,0.1-0.1,0.3,0,0.4
|
||||||
|
c0.5,0.7,1,1.5,1.4,2.2C5328.4-8134.2,5328.4-8134.2,5328.4-8134.2z"/>
|
||||||
|
<path id="Path_194" class="st0" d="M5314.3-8126.1c-0.1-0.1-0.1-0.1-0.2-0.2c-0.1,0-0.1-0.1-0.1-0.2c0-0.1,0-0.3,0-0.4h-0.1
|
||||||
|
c-0.6,0-1.2-0.1-1.7-0.2c0,0-0.1,0-0.1,0c-0.4,0.2-0.7,0.4-1,0.8c-0.4,0.6-0.4,1.4,0.1,1.9c0.2,0.2,0.4,0.4,0.6,0.6
|
||||||
|
c0.1,0.1,0.2,0.2,0.3,0.2c-0.2-0.6,0-1.3,0.5-1.8C5313-8125.9,5313.6-8126.2,5314.3-8126.1z"/>
|
||||||
|
<path id="Path_195" class="st0" d="M5315.7-8114.9c0.5-0.1,0.9-0.3,1.4-0.4c0.8-0.2,1.6-0.4,2.4-0.7c0.1,0,0.1,0,0.1-0.1
|
||||||
|
c0.1-0.4,0.2-0.7,0.4-1.1c0,0,0,0,0-0.1c-0.1,0-0.2,0-0.3,0.1c-1.2,0.3-2.3,0.6-3.5,1c-0.1,0-0.1,0.1-0.1,0.1
|
||||||
|
c-0.1,0.4-0.3,0.7-0.4,1.1C5315.7-8115,5315.7-8115,5315.7-8114.9z"/>
|
||||||
|
<path id="Path_196" class="st0" d="M5315.4-8117.4c0.2,0.3,0.4,0.6,0.6,0.9c0,0,0.1,0,0.1,0c1-0.3,1.9-0.5,2.9-0.8
|
||||||
|
c0.3-0.1,0.6-0.2,0.9-0.2c-0.1-0.1-0.1-0.2-0.2-0.2c-0.2-0.2-0.3-0.4-0.5-0.6c0,0-0.1-0.1-0.1,0c-0.9,0.3-1.9,0.5-2.8,0.8
|
||||||
|
C5316-8117.5,5315.7-8117.5,5315.4-8117.4z"/>
|
||||||
|
<path id="Path_197" class="st0" d="M5321.3-8143.6c0-0.3,0-0.7,0-1c0,0-0.1,0-0.1,0c-0.7,0-1.5,0-2.2,0.1c-0.4,0-0.7,0-1.1,0.1
|
||||||
|
c-0.1,0-0.1,0-0.1,0.1c0,0.3,0,0.6,0,0.8c0,0,0,0.1,0.1,0.1c0.4,0,0.8,0,1.1,0c0.5,0,1.1,0,1.6-0.1
|
||||||
|
C5320.9-8143.5,5321.1-8143.6,5321.3-8143.6z"/>
|
||||||
|
<path id="Path_198" class="st0" d="M5329.2-8134.3c0.1,0,0.2,0,0.2-0.1c0.4-0.2,0.8-0.4,1.1-0.7c0.3-0.2,0.4-0.5,0.6-0.8
|
||||||
|
c0.1-0.3,0.1-0.6-0.1-0.9c-0.4-0.5-0.7-1-1.1-1.6c0,0,0,0-0.1-0.1c-0.2,0.2-0.4,0.4-0.6,0.6c0,0,0,0,0,0c0,0,0,0.1,0,0.1
|
||||||
|
c0.2,0.4,0.5,0.7,0.7,1c0.1,0.2,0.2,0.4,0.1,0.6c0,0.5-0.1,0.9-0.4,1.3c-0.1,0.1-0.2,0.2-0.3,0.3
|
||||||
|
C5329.4-8134.5,5329.3-8134.4,5329.2-8134.3C5329.2-8134.3,5329.2-8134.3,5329.2-8134.3z"/>
|
||||||
|
<path id="Path_199" class="st0" d="M5317.5-8136.7c0,0.2,0,0.3,0,0.5c0,0,0,0.1,0.1,0.1c0.2,0,0.3,0.1,0.5,0.1c0.7,0.1,1.4,0.1,2,0
|
||||||
|
c0.4,0,0.8-0.1,1.2-0.1c0.2,0,0.5-0.1,0.7-0.1c0.1,0,0.1,0,0.1-0.1c0-0.2,0-0.3,0-0.5C5320.5-8136.6,5319-8136.5,5317.5-8136.7z"/>
|
||||||
|
<path id="Path_200" class="st0" d="M5312.5-8123.2c0.1-0.4,0.1-0.8,0.2-1.2c0.1-0.6,0.6-1,1.2-1c0.3,0,0.5,0.1,0.7,0.3
|
||||||
|
c0.2,0.2,0.2,0.4,0.2,0.7c-0.1,0.3-0.2,0.6-0.2,0.9c0,0.1-0.1,0.2-0.1,0.4c0,0,0,0,0,0c0.1-0.1,0.2-0.2,0.3-0.3
|
||||||
|
c0.3-0.4,0.4-0.9,0.4-1.4c0-0.6-0.4-1-0.9-1.1c-0.1,0-0.1,0-0.2,0c-0.5,0-1,0.3-1.4,0.7c-0.3,0.3-0.4,0.6-0.5,1
|
||||||
|
c-0.1,0.3,0,0.7,0.2,1C5312.5-8123.2,5312.5-8123.2,5312.5-8123.2z"/>
|
||||||
|
<path id="Path_201" class="st0" d="M5314.3-8123.2c0.1-0.5,0.3-0.9,0.4-1.4c0.1-0.2,0-0.4-0.2-0.5c-0.4-0.2-0.9-0.1-1.2,0.2
|
||||||
|
c0,0,0,0,0,0.1c0,0.2,0,0.4,0.1,0.6c0,0.1,0.1,0.2,0.2,0.3C5313.7-8123.6,5314-8123.4,5314.3-8123.2
|
||||||
|
C5314.2-8123.2,5314.3-8123.2,5314.3-8123.2z"/>
|
||||||
|
<path id="Path_202" class="st0" d="M5317.4-8124.1c0-0.4,0-0.9-0.1-1.3c-0.1,0-0.1,0-0.2,0c-0.1,0-0.2,0-0.3,0
|
||||||
|
c-0.7-0.3-1.4-0.5-2.1-0.8c0,0,0,0,0,0c0.1,0.1,0.1,0.1,0.2,0.2c0.3,0.2,0.5,0.6,0.6,0.9c0,0,0,0,0,0c0.1,0,0.3,0,0.4,0.1
|
||||||
|
c0.3,0.1,0.6,0.3,0.9,0.5c0,0,0.1,0.1,0.1,0.1C5317.1-8124.2,5317.2-8124.1,5317.4-8124.1z"/>
|
||||||
|
<path id="Path_203" class="st0" d="M5321.6-8124.6c-0.2,0-0.4,0.1-0.6,0.1c0.1,0.2,0.1,0.4,0.2,0.6c0.1,0.4,0.2,0.8,0.1,1.2
|
||||||
|
c0,0.5-0.1,0.9-0.4,1.3c0,0,0,0,0,0c0.3,0,0.6-0.2,0.7-0.5c0.2-0.3,0.3-0.6,0.3-0.9C5321.9-8123.4,5321.8-8124,5321.6-8124.6z"/>
|
||||||
|
<path id="Path_204" class="st0" d="M5315.7-8135.8c0.2,0,0.3,0.1,0.5,0.1c0.5,0.1,1,0.2,1.5,0.2c0.2,0,0.5,0,0.7,0
|
||||||
|
c0.7-0.1,1.4-0.2,2.1-0.2c0.6-0.1,1.2-0.2,1.8-0.2c0.5-0.1,1.1-0.1,1.6-0.2l-1.5-0.2c0,0,0,0,0,0c0,0.2-0.1,0.3-0.2,0.3
|
||||||
|
c0,0,0,0,0,0c-0.3,0.1-0.5,0.1-0.8,0.2c-0.8,0.1-1.6,0.1-2.3,0.1c-0.4,0-0.9,0-1.3-0.1c-0.1,0-0.2-0.1-0.3-0.2c0,0-0.1,0-0.1,0
|
||||||
|
c-0.3,0-0.6,0.1-0.9,0.1L5315.7-8135.8L5315.7-8135.8z"/>
|
||||||
|
<path id="Path_205" class="st0" d="M5327.3-8117.7c-0.3,0.1-0.5,0.2-0.8,0.2c-0.6,0.2-1.1,0.3-1.7,0.5c0,0-0.1,0-0.1,0.1
|
||||||
|
c-0.5,0.2-1,0.5-1.5,0.7c0,0,0,0,0,0c0.3-0.1,0.5-0.1,0.8-0.2c0.5-0.2,1.1-0.3,1.6-0.5c0.1,0,0.2-0.1,0.2-0.1
|
||||||
|
C5326.2-8117.2,5326.8-8117.5,5327.3-8117.7C5327.3-8117.7,5327.3-8117.7,5327.3-8117.7C5327.3-8117.7,5327.3-8117.7,5327.3-8117.7
|
||||||
|
z"/>
|
||||||
|
<path id="Path_206" class="st0" d="M5327-8135.8c0,0.1,0,0.2,0,0.4c0.1,0.5,0.3,0.9,0.7,1.1c0.1,0.1,0.3,0.1,0.4,0.2l0,0
|
||||||
|
C5327.8-8134.7,5327.4-8135.2,5327-8135.8L5327-8135.8z"/>
|
||||||
|
<path id="Path_207" class="st0" d="M5329-8134.4c-0.1,0.1-0.2,0.2-0.3,0.4c0,0,0,0,0,0.1c0,0.1,0,0.1,0.1,0.1c0.1,0,0.2,0,0.3-0.1
|
||||||
|
c0.1,0,0.2-0.1,0.3-0.1c-0.1,0-0.1-0.1-0.2-0.1C5329-8134.2,5329-8134.3,5329-8134.4z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 11 KiB |
93
docs/static/fonts/icons/iconfont.css
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: "iconfont";
|
||||||
|
src: url("iconfont.eot?8b7e57577c2d1f1ae9e810b9e010bc84?#iefix") format("embedded-opentype"),
|
||||||
|
url("iconfont.woff2?8b7e57577c2d1f1ae9e810b9e010bc84") format("woff2"),
|
||||||
|
url("iconfont.woff?8b7e57577c2d1f1ae9e810b9e010bc84") format("woff");
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon:before {
|
||||||
|
font-family: iconfont !important;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal !important;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-ultrasonic:before {
|
||||||
|
content: "\f101";
|
||||||
|
}
|
||||||
|
.icon-color:before {
|
||||||
|
content: "\f102";
|
||||||
|
}
|
||||||
|
.icon-touch:before {
|
||||||
|
content: "\f103";
|
||||||
|
}
|
||||||
|
.icon-gyro:before {
|
||||||
|
content: "\f104";
|
||||||
|
}
|
||||||
|
.icon-addpackage:before {
|
||||||
|
content: "\f105";
|
||||||
|
}
|
||||||
|
.icon-brick:before {
|
||||||
|
content: "\f106";
|
||||||
|
}
|
||||||
|
.icon-controls:before {
|
||||||
|
content: "\f107";
|
||||||
|
}
|
||||||
|
.icon-functions:before {
|
||||||
|
content: "\f108";
|
||||||
|
}
|
||||||
|
.icon-list:before {
|
||||||
|
content: "\f109";
|
||||||
|
}
|
||||||
|
.icon-logic:before {
|
||||||
|
content: "\f10a";
|
||||||
|
}
|
||||||
|
.icon-loops:before {
|
||||||
|
content: "\f10b";
|
||||||
|
}
|
||||||
|
.icon-math:before {
|
||||||
|
content: "\f10c";
|
||||||
|
}
|
||||||
|
.icon-motors:before {
|
||||||
|
content: "\f10d";
|
||||||
|
}
|
||||||
|
.icon-music:before {
|
||||||
|
content: "\f10e";
|
||||||
|
}
|
||||||
|
.icon-sensors:before {
|
||||||
|
content: "\f10f";
|
||||||
|
}
|
||||||
|
.icon-text:before {
|
||||||
|
content: "\f110";
|
||||||
|
}
|
||||||
|
.icon-variables:before {
|
||||||
|
content: "\f111";
|
||||||
|
}
|
||||||
|
.icon-console:before {
|
||||||
|
content: "\f112";
|
||||||
|
}
|
||||||
|
.icon-advancedcollapsed:before {
|
||||||
|
content: "\f113";
|
||||||
|
}
|
||||||
|
.icon-advancedexpanded:before {
|
||||||
|
content: "\f114";
|
||||||
|
}
|
||||||
|
.icon-cancel:before {
|
||||||
|
content: "\f115";
|
||||||
|
}
|
||||||
|
.icon-check:before {
|
||||||
|
content: "\f116";
|
||||||
|
}
|
||||||
|
.icon-download:before {
|
||||||
|
content: "\f117";
|
||||||
|
}
|
||||||
|
.icon-save:before {
|
||||||
|
content: "\f118";
|
||||||
|
}
|
||||||
|
.icon-blocks:before {
|
||||||
|
content: "\f119";
|
||||||
|
}
|
BIN
docs/static/fonts/icons/iconfont.eot
vendored
Normal file
87
docs/static/fonts/icons/iconfont.svg
vendored
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<defs>
|
||||||
|
<font id="iconfont" horiz-adv-x="40">
|
||||||
|
<font-face font-family="iconfont"
|
||||||
|
units-per-em="40" ascent="40"
|
||||||
|
descent="0" />
|
||||||
|
<missing-glyph horiz-adv-x="0" />
|
||||||
|
<glyph glyph-name="ultrasonic"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M26.8 13H13.1C15.6 14.6 17 17.3 17 20.2C17 21.8 16.6 23.3 15.8 24.7S13.8 27 12.4 27.8H27.6C26.2 27 25.1 26.1 24.2 24.7S23 21.8 23 20.2C22.9 17.3 24.3 14.6 26.8 13L26.8 13L26.8 13z M8.6 12C4.1 12 0.4 15.7 0.4 20.2S4.1 28.4 8.6 28.4S16.8 24.7 16.8 20.2C16.7 15.7 13.1 12 8.6 12zM8.6 23.4C6.8 23.4 5.4 22 5.4 20.2S6.8 16.9 8.6 16.9S11.9 18.4 11.9 20.2S10.4 23.4 8.6 23.4z M31.4 12C26.9 12 23.2 15.7 23.2 20.2S26.9 28.4 31.4 28.4S39.6 24.7 39.6 20.2C39.5 15.7 35.9 12 31.4 12zM31.4 23.4C29.6 23.4 28.1 22 28.1 20.2S29.6 16.9 31.4 16.9S34.6 18.4 34.6 20.2S33.2 23.4 31.4 23.4z" />
|
||||||
|
<glyph glyph-name="color"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="43.35195530726257" d=" M38.7 -0.1H4.7C3.4 -0.1 2.5 0.6 2.5 1.5V6.8H0.9A0.9608938547486034 0.9608938547486034 0 0 0 0 7.7V31.5A0.9608938547486034 0.9608938547486034 0 0 0 0.9 32.4H2.5V38.4C2.5 39.3 3.6 40 4.7 40H38.7C40 40 40.9 39.3 40.9 38.4V32.4H42.5A0.9608938547486034 0.9608938547486034 0 0 0 43.4 31.5V7.8A0.9608938547486034 0.9608938547486034 0 0 0 42.5 6.9H40.9V1.6C41.1 0.7 40 -0.1 38.7 -0.1zM21.7 35.1A11.374301675977657 11.374301675977657 0 0 1 13.6 15.5A4.916201117318437 4.916201117318437 0 0 1 13.4 13.7A8.268156424581006 8.268156424581006 0 0 1 29.9 13.7A4.916201117318437 4.916201117318437 0 0 1 29.7 15.5A12.379888268156424 12.379888268156424 0 0 1 33.1 23.6A11.1731843575419 11.1731843575419 0 0 1 21.7 35.1zM41.6 18.3V10.9H42.5V18.3zM1.1 18.3V10.9H2V18.3zM41.6 28.6V21.2H42.5V28.6zM1.1 28.6V21.2H2V28.6z M21.9 7.4A6.480446927374302 6.480446927374302 0 0 0 15.4 13.9A9.497206703910615 9.497206703910615 0 0 0 15.9 16.3A9.87709497206704 9.87709497206704 0 0 0 12.3 23.9A9.608938547486035 9.608938547486035 0 0 0 31.5 23.9A9.87709497206704 9.87709497206704 0 0 0 27.9 16.3A8.022346368715086 8.022346368715086 0 0 0 28.4 13.9A6.703910614525141 6.703910614525141 0 0 0 21.9 7.4zM21.9 16.3A2.4581005586592184 2.4581005586592184 0 1 1 24.4 13.9A2.837988826815643 2.837988826815643 0 0 1 21.9 16.3zM21.9 27.7A4.46927374301676 4.46927374301676 0 1 1 26.4 23.2A4.804469273743018 4.804469273743018 0 0 1 21.9 27.7z" />
|
||||||
|
<glyph glyph-name="touch"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M34.3 3.3H4.9C3.8 3.3 2.8 3.9 2.8 4.8V9.3H1.5C1.1 9.3 0.7 9.7 0.7 10.1V30.5C0.7 30.9 1.1 31.3 1.5 31.3H2.8V36.6C2.8 37.4 3.7 38.1 4.9 38.1H16V36.6H22.7V38.1H34.2C35.3 38.1 36.3 37.5 36.3 36.6V31.3H37.6C37.9 31.3 38.3 30.9 38.3 30.5V10.1C38.3 9.7 37.9 9.3 37.6 9.3H36.3V4.8C36.3 3.9 35.3 3.3 34.3 3.3L34.3 3.3zM14.1 16.2C14.7 15.3 15.4 14.7 16.2 14.1V5.6H22.6V14.1C23.5 14.7 24.1 15.4 24.7 16.2H33.4V22.6H24.9C24.3 23.5 23.6 24.3 22.6 24.9V33.6H16.2V24.9C15.3 24.3 14.5 23.6 13.9 22.6H5.4V16.2H14.1L14.1 16.2zM36.6 19.2V13H37.4V19.2H36.6zM1.8 19.2V13H2.6V19.2H1.8zM36.6 28.1V21.9H37.4V28.1H36.6zM1.8 28.1V21.9H2.6V28.1H1.8zM19.4 15.4C18.8 15.4 18.5 15.4 18.1 15.6V17.1C18.1 17.5 17.9 17.7 17.5 17.7L17.5 17.7H16C15.8 18.1 15.6 18.6 15.6 19.2C15.6 19.8 15.6 20.3 16 20.7H17.3C18.1 20.7 18.1 21.6 18.1 21.6L18.1 21.6C18.1 21.8 18.1 22.4 18.1 22.9C18.5 23.1 19 23.1 19.4 23.1C20 23.1 20.5 23.1 21.1 22.9C21.1 22.5 21.1 22 21.1 21.6L21.1 21.6V21.4C21.1 21 21.3 20.8 21.7 20.8C21.7 20.8 21.7 20.8 21.9 20.8L21.9 20.8H23.4C23.8 20.4 23.8 19.9 23.8 19.3S23.6 18.2 23.4 17.8L23.4 17.8C23 17.8 22.5 17.6 22.1 17.6C21.7 17.6 21.3 17.4 21.3 17V15.5C20.7 15.3 20.4 15.3 19.8 15.3C19.4 15.4 19.4 15.4 19.4 15.4z" />
|
||||||
|
<glyph glyph-name="gyro"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="23.578015492438215" d=" M17 0H6.4A5.901881224640355 5.901881224640355 0 0 0 5.1 0.3H2.3A1.283659166359277 1.283659166359277 0 0 0 1 1.6V4.5H0.5A0.5016599040944301 0.5016599040944301 0 0 0 0 5V35.4A0.5016599040944301 0.5016599040944301 0 0 0 0.5 35.9H1V38.7A1.283659166359277 1.283659166359277 0 0 0 2.3 40H10.6V39.6H12.8V40H21.2A1.283659166359277 1.283659166359277 0 0 0 22.5 38.7V35.9H23.1A0.5016599040944301 0.5016599040944301 0 0 0 23.6 35.4V5.1A0.5016599040944301 0.5016599040944301 0 0 0 23.1 4.6H22.5V1.6A1.283659166359277 1.283659166359277 0 0 0 21.2 0.4H18.5C18.4 0.1 17.2 0 17 0zM6.2 34.5L3.7 33.8A1.0033198081888601 1.0033198081888601 0 0 1 3.4 33.7A0.2360752489856142 0.2360752489856142 0 0 1 3.3 33.5A0.20656584286241245 0.20656584286241245 0 0 1 3.4 33.3L4.1 32.8A7.657690888970861 7.657690888970861 0 0 1 3.1 30A8.51346366654371 8.51346366654371 0 0 1 4.8 23.5C5.8 24.2 6.5 24.7 6.5 24.7A7.377351530800443 7.377351530800443 0 0 0 5.4 26.9A6.300258207303577 6.300258207303577 0 0 0 6 31.8L6.5 31.5H6.5L6.6 31.5A0.3541128734784213 0.3541128734784213 0 0 1 6.8 31.4A0.17705643673921065 0.17705643673921065 0 0 1 7 31.5A0.6344522316488379 0.6344522316488379 0 0 1 7 32L6.2 34.5zM17.5 31.8H17.5A6.300258207303577 6.300258207303577 0 0 0 18 26.9A7.510143858354851 7.510143858354851 0 0 0 17 24.7L17.1 24.6L18.6 23.5A8.631501291036518 8.631501291036518 0 0 1 20.3 30A7.657690888970861 7.657690888970861 0 0 1 19.3 32.8L19.8 33.1L20 33.2A0.22132054592401326 0.22132054592401326 0 0 1 20.1 33.4A0.26558465510881596 0.26558465510881596 0 0 1 20 33.6A1.0033198081888601 1.0033198081888601 0 0 1 19.7 33.7L17.2 34.5S17.1 34.1 17 33.6S16.6 32.3 16.5 32A0.619697528587237 0.619697528587237 0 0 1 16.5 31.5A0.17705643673921065 0.17705643673921065 0 0 1 16.6 31.4A0.48690520103282936 0.48690520103282936 0 0 1 16.8 31.4L16.8 31.4L17.4 31.7zM11.7 30.6A1.9918849133161198 1.9918849133161198 0 1 1 13.7 28.6A1.9918849133161198 1.9918849133161198 0 0 1 11.7 30.6H11.7z" />
|
||||||
|
<glyph glyph-name="addpackage"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M20 35.7C11.3 35.7 4.3 28.7 4.3 20S11.3 4.3 20 4.3S35.7 11.3 35.7 20S28.7 35.7 20 35.7zM30.4 18.3H21.7V9.6H18.3V18.3H9.6V21.7H18.3V30.4H21.7V21.7H30.4V18.3z" />
|
||||||
|
<glyph glyph-name="brick"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M34.3 0.9H5.7V39.1H34.4V0.9zM10.4 32.7V18.4H29.6V32.7H10.4z" />
|
||||||
|
<glyph glyph-name="controls"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M6.1 33H9.6V5.2H6.1V33z M18.3 33H21.7V5.2H18.3V33z M30.4 33H33.9V5.2H30.4V33z M2.6 15.7H13V7H2.6V15.7z M14.8 31.3H25.2V22.6H14.8V31.3z M27 22.6H37.4V13.9H27V22.6z" />
|
||||||
|
<glyph glyph-name="functions"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M12.2 25.4H9.1C9.1 26.3 9.1 26.5 9.9 26.5C11.5 26.5 12.5 27.2 13.1 28.6C13.8 30.1 14.8 31.5 15.7 33.1C16.5 34.3 18.1 35.3 19.7 35.5C20.7 35.7 21.9 35.3 22.5 34.5C22.8 33.9 22.8 33.4 22.6 32.7C22.3 32.2 21.8 32 21.1 32.2C20.5 32.2 20.2 32.7 20.2 33.3C20.2 33.4 20.2 33.4 20.2 33.6C20.2 33.9 20.4 34.3 20.4 34.6C20 34.6 19.5 34.8 19.2 34.6C18.5 34.3 17.9 33.9 17.4 33.1C16.7 32 16.2 30.6 15.7 29.4C15.3 28.6 15 27.3 14.8 26.5H17.2C17.1 26.1 17.1 25.8 16.9 25.4H14.5C13.9 23.5 13.6 21.9 12.9 20.2C12.2 16.7 10.8 13.4 9.4 10.1C8.7 8.6 7.7 7.3 6.6 6.3C5.8 5.4 4.5 4.9 3.3 4.9C2.6 4.7 1.8 5.1 1.1 5.4C0.7 5.8 0.5 6.5 0.7 7.2C1.1 7.7 1.6 8 2.5 7.9C3 7.9 3.2 7.3 3.2 6.8C3.2 6.6 3 6.5 3 6.5C2.8 6.3 2.8 6.1 2.8 5.9C3 5.9 3.2 5.8 3.5 5.8C4.4 5.8 5.4 6.3 5.9 7.2C6.5 8 7 9.1 7.2 9.9C8.5 15.2 10.1 20.4 11.7 25.4C12.2 25.3 12.2 25.3 12.2 25.4z M32.5 4.7C32.7 4.9 32.7 5.1 32.9 5.3C34.8 6.3 36 8.4 36.4 10.5C37.1 13.9 37.1 17.4 36.2 20.9C35.7 22.8 34.5 24.2 33.1 25.4C32.9 25.6 32.7 25.8 32.7 25.9C36 24.7 39.2 20.6 39.2 15.3C39.3 10.8 36.7 6.5 32.5 4.7z M23.9 25.8C23.9 25.6 23.7 25.4 23.7 25.4C21.8 24.4 20.5 22.3 20.2 20.2C19.5 16.7 19.5 13.3 20.4 9.6C20.9 7.7 22.1 6.3 23.5 5.1C23.7 4.9 23.9 4.9 23.9 4.6C20 6.5 17.4 10.5 17.6 15C17.4 20.7 20.9 24.9 23.9 25.8z M32 12.2C32 12.2 32.2 12.2 32.4 12C32.4 12 32.4 12 32.4 11.9C31.9 11 31.3 10.1 30.3 9.6C29.9 9.3 29.2 9.1 28.5 9.6C28.4 9.8 28.2 9.9 28.2 10.3C27.9 11.3 27.7 12.4 27.5 13.4C27.5 13.6 27.5 13.6 27.3 13.8C27.2 13.4 27 13.1 26.6 12.7C26.1 12 25.6 11 24.7 10.3C24.4 9.9 24 9.6 23.5 9.4C23 9.3 22.5 9.4 21.9 9.9V10.1C21.9 10.5 21.9 10.8 22.3 11C22.5 11.2 22.8 11.2 23.2 11L23.3 10.8C23.9 10.5 24 10.3 24.4 11C25.1 12 25.9 13.4 26.8 14.5C26.8 14.6 26.8 14.8 26.8 15C26.6 15.7 26.5 16.6 26.3 17.3C25.9 18.5 25.4 19 24 19H23.9C23.7 19.2 23.9 19.3 24 19.3C24.7 19.5 25.8 19.7 26.5 19.7C26.6 19.7 26.8 19.7 27 19.5C27.5 18.8 27.9 18.1 28 17.1C28 16.9 28.2 16.6 28.2 16.4C28.4 16.7 28.7 17.3 29.1 17.6C29.6 18.1 30.1 18.8 30.8 19.3C31.2 19.5 31.5 19.7 31.9 19.7C32.4 19.7 32.7 19.3 32.7 18.8V18.6C32.5 18.1 32.2 17.9 31.7 18.1L31.7 18.1C31.5 18.1 31.5 18.1 31.3 18.1C30.8 18.5 30.1 18.3 29.6 17.8L29.6 17.8C29.2 17.3 28.7 16.6 28.4 15.9C28.4 15.7 28.4 15.7 28.4 15.5C28.7 14.3 28.9 12.9 29.2 11.5C29.2 11.3 29.2 11.3 29.4 11.2C29.6 10.6 29.9 10.5 30.3 11C31.3 11.3 31.5 11.9 32 12.2z" />
|
||||||
|
<glyph glyph-name="list"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M11.1 30.4H36.9V27.3H11.1V30.4z M11.1 22.4H36.9V19.3H11.1V22.4z M11.1 14.4H36.9V11.3H11.1V14.4z M5.6 27.3H3.8V33.6H2.4V34.6C3.3 34.6 4 35.1 4.2 36.2H5.6V27.3z M7.7 17.6V16H1.4V16.7C1.4 18.8 2.8 19.7 4 20.3C5.7 21.2 5.7 21.6 5.7 22.1C5.7 22.6 5.4 23.1 4.5 23.1C3.7 23.1 3.1 22.4 3.1 21.6H1.4C1.4 23.1 2.4 24.7 4.5 24.7C6.6 24.7 7.5 23.3 7.5 22.1C7.5 20.3 6.3 19.8 4.9 19C4 18.4 3.3 17.9 3.3 17.4H7.7z M4.5 4.5C2.4 4.5 1.4 5.9 1.2 7.5H3C3 6.6 3.5 6.1 4.5 6.1C5.6 6.1 6.1 6.6 6.1 7.3C6.1 8 5.6 8.5 4.7 8.5H4.2V9.9H4.5C5.6 9.9 5.9 10.4 5.9 11C5.9 11.7 5.4 12 4.7 12C3.8 12 3.3 11.3 3.3 10.6H1.6C1.6 12.2 2.6 13.6 4.5 13.6C6.4 13.6 7.5 12.3 7.5 11.1C7.5 10.4 7.1 9.7 6.3 9.4C7.3 9 7.7 8.2 7.7 7.3C7.8 6.1 6.8 4.5 4.5 4.5z" />
|
||||||
|
<glyph glyph-name="logic"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M2.8 14.1H7.4C10 14.2 12.2 16 13.1 18.6C15 23.1 18.3 31.3 23.7 31.3S29.8 31.3 29.8 31.3V35.8L36.9 28.3L29.8 21.5V26.4H24.9C22.3 25.7 20.2 24 19.4 21.5C17.3 17 15.2 9.4 8.2 9.2C5.1 9.2 3 9.2 3 9.2V14.1z M2.8 31.1V26.2H8.2C8.2 26.2 11.4 26.2 13.1 22.1C13.8 23.8 14.7 25.4 15.7 26.9C15.7 26.9 12.2 30.9 8.4 30.9S2.8 31.1 2.8 31.1z M19.5 18.4C19.5 18.4 21.8 13.9 24.4 13.9H30V18.4L37.3 11.3L30 4.2V9H23.7C23.7 9 20.2 9 16.9 13.4C18 14.9 18.8 16.7 19.5 18.4z" />
|
||||||
|
<glyph glyph-name="loops"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M6.3 12.7C4.5 15.2 2.6 17.4 0.9 20H4.5C4.5 24.2 6.3 28.4 9.2 31.3C11.3 33.4 13.7 34.8 16.7 35.3C21.9 36.6 27.3 35 31.1 31.2C30.3 30.3 29.4 29.4 28.7 28.7C24.2 32.6 19.3 33.3 14.1 30.5C10.3 28.4 8.2 24.4 8.2 20.2H11.8C9.7 17.6 7.8 15 6.3 12.7z M32.2 20H28.5C30.4 22.5 32.2 24.7 33.9 27.3C35.8 24.9 37.6 22.6 39.3 20H35.6C35.6 15.7 33.7 11.5 30.6 8.6C28.5 6.6 26.1 5.3 23.3 4.7C18.1 3.5 12.7 5.1 8.9 8.9L11.3 11.3C15.6 7.5 20.7 6.6 25.9 9.6C29.9 11.7 32.2 15.7 32.2 20z" />
|
||||||
|
<glyph glyph-name="math"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M15.2 5.3C14.9 4.9 14.2 4.2 13.8 3.9L9.3 8.4C7.6 6.7 6.2 5.3 4.8 3.9C4.4 4.2 3.8 4.9 3.4 5.3L7.9 9.8C6.2 11.5 4.8 12.9 3.4 14.3C3.8 14.7 4.4 15.4 4.8 15.7L9.3 11.2L13.8 15.7C14.2 15.4 14.9 14.7 15.2 14.3L10.7 9.8C12.1 8.2 13.7 6.7 15.2 5.3z M1.5 28V30H7.9V36.4C8.6 36.4 9.1 36.4 9.8 36.4V30H16.3V28H9.8V21.6H7.8V28H1.5z M38.4 10.7H22V14.1H38.4V10.7z M38.4 7.2V3.7H22V7.2H38.4z M38.4 31V27.5H22V31H38.4z" />
|
||||||
|
<glyph glyph-name="motors"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M28.9 25.8C27.5 24.4 25.9 22.9 24.5 21.5H35.7V32.6L32.2 29.1C29.6 32.3 25.9 34.3 21.8 34.9C18.3 35.4 14.6 34.5 11.7 32.6C4.2 28.1 1.9 18.3 6.5 10.9S20.7 1.1 28.2 5.6C30.8 7.2 32.7 9.5 34.1 12.1C32.7 12.6 31.3 13.3 29.9 13.8C28.5 11 25.9 9 23 8.1C20.7 7.4 18.3 7.6 16 8.4C10.3 10.7 7.3 17.1 9.4 22.9C10.6 26.3 13.6 29 17.1 29.8C21.6 31.2 26.3 29.5 28.9 25.8z M16.7 19C16.7 17.1 18.3 15.7 20 15.7S23.3 17.3 23.3 19C23.3 21 21.8 22.3 20 22.3C18.1 22.5 16.7 21 16.7 19C16.7 19 16.7 19 16.7 19z" />
|
||||||
|
<glyph glyph-name="music"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M24.2 17.7C27.1 17.2 29.9 15.7 31.7 13.2C32.5 13.2 33.4 13.2 33.4 13.2S36 20.9 30.3 26.3S13.4 31.7 9.2 26.3C6.3 22.6 5.2 17.6 6.8 13.2C7.3 13.2 7.7 13.2 8.2 13.2C8.2 13.2 11.1 17.6 15.8 17.7C15.7 10.1 15.7 3.5 15.7 3.5C12.3 4.2 9.6 6.3 8 9.4C4.5 10.1 1.7 13.2 1.7 17C1.7 28.3 10.3 34.8 20 34.8S38.8 27.3 38.1 17C37.7 9.9 31.8 9.4 31.8 9.4C30.4 6.3 27.7 4 24.3 3.5C24.2 11.3 24.2 17.7 24.2 17.7z" />
|
||||||
|
<glyph glyph-name="sensors"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M20 36.9C10.6 36.9 3 29.2 3 19.8C3 10.4 10.6 2.8 20 2.8S37 10.4 37 19.8C36.9 29.4 29.4 36.9 20 36.9zM20 8.2C13.4 8.2 8.2 13.6 8.2 20S13.6 31.8 20 31.8S31.8 26.4 31.8 20S26.6 8.2 20 8.2z M13.2 20C13.2 16.3 16.3 13.2 20 13.2C23.7 13.2 26.8 16.3 26.8 20C26.8 23.7 23.7 26.8 20 26.8C16.3 26.8 13.2 23.7 13.2 20z" />
|
||||||
|
<glyph glyph-name="text"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M23.1 30.6V2.8H16.5V30.6H7.7V36.7H32.3V30.6H23.1z" />
|
||||||
|
<glyph glyph-name="variables"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M36.8 12V7.8H3.4V12H36.8z M36.8 22.1V17.9H3.4V22.1H36.8z M36.7 32.2V28H3.3V32.2H36.7z" />
|
||||||
|
<glyph glyph-name="console"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M15.6 21.3L2.3 15L2.3 19.8L11.1 23.6L2.3 27.4L2.3 32.2L15.6 25.9L15.6 21.3z M36 9.1L16.6 9.1L16.6 12.2L36 12.2L36 9.1z" />
|
||||||
|
<glyph glyph-name="advancedcollapsed"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M39.7 28.2L36.2 31.5L20 15.3L3.8 31.5L0.3 28.2L18.3 10.3L18.3 10.3L20 8.5L20.5 9L20.5 9z" />
|
||||||
|
<glyph glyph-name="advancedexpanded"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M39.3 12L21.7 29.6L21.7 29.6L20 31.3L19.5 30.8L19.5 30.8L0.7 12L4 8.7L20 24.7L36 8.7z" />
|
||||||
|
<glyph glyph-name="cancel"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M33 29.6L29.4 33.2L20.2 24L11 33.2L7.3 29.6L16.5 20.3L7.3 11.1L11 7.3L20.2 16.5L29.4 7.3L33 11.1L23.8 20.3z" />
|
||||||
|
<glyph glyph-name="check"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M33.7 32.9L15.3 14.4L7.5 22.3L3.8 18.4L11.7 10.8L11.7 10.8L15.3 7.1L37.4 29.2z" />
|
||||||
|
<glyph glyph-name="download"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M5.2 15.7H36.5V1.7H5.2V15.7z M28.5 24.2L26.1 26.6L22.6 23.1L22.6 36.5L19.1 36.5L19.1 23.5L16 26.6L13.6 24.2L20.9 16.7L21 16.9L21.2 16.7z" />
|
||||||
|
<glyph glyph-name="save"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M25 34.5C25 33.6 25 32.8 25 31.9C25 31 24.7 30.9 24 30.9C23.5 30.9 22.8 30.9 22.4 30.9C22.1 30.9 21.4 31 21.4 31.7V31.9V36.9C21.4 37.3 21.6 37.8 22.3 38C22.3 38 22.3 38 22.4 38C23 38 23.7 38 24.2 38C24.7 38 25.2 37.6 25.2 37.1C25.2 37.1 25.2 37.1 25.2 36.9C25 36.3 25 35.2 25 34.5z M37.6 31.2C35.8 32.9 34.3 34.5 32.5 36.3C31 37.8 31 37.8 28.5 37.8C27.5 37.8 27.3 37.6 27.3 36.6V28.4C27.3 27.4 27.1 27.2 26.1 27.2H14.3C13.2 27.2 13 27.4 13 28.4V36.4C13 37.6 12.9 37.8 11.7 37.8H3.8C2.6 37.8 2.4 37.6 2.4 36.4V19.9C2.4 14.3 2.4 8.9 2.4 3.2C2.4 2 2.6 1.8 3.7 1.8H36.9C37.9 1.8 38.1 2.2 38.1 3.2V29.6C38.3 30.5 37.9 30.9 37.6 31.2zM33.7 6.7H7.1V23H33.7V6.7z" />
|
||||||
|
<glyph glyph-name="blocks"
|
||||||
|
unicode=""
|
||||||
|
horiz-adv-x="40" d=" M10.9 23H39V16.9H10.9V23z M39.2 27.1L39.2 33L0.9 33L0.9 31.1L0.9 27.1L0.9 12.9L0.9 7L39.2 7L39.2 12.9L6.9 12.9L6.9 27.1z" />
|
||||||
|
</font>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 15 KiB |
BIN
docs/static/fonts/icons/iconfont.ttf
vendored
Normal file
BIN
docs/static/fonts/icons/iconfont.woff
vendored
Normal file
BIN
docs/static/fonts/icons/iconfont.woff2
vendored
Normal file
1
docs/static/loader_back.svg
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="301.499" height="179.742" viewBox="0 0 282.655 168.508"><g transform="translate(-41.005 -446.364)"><rect ry="30" rx="30" y="458.77" x="53.41" height="143.698" width="105.312" stroke="#000" stroke-width="17.724" stroke-linecap="round" stroke-linejoin="round"/><rect width="105.668" height="144.183" x="53.232" y="458.527" rx="30.101" ry="30.101" fill="#fff"/></g><g transform="translate(111.528 -446.364)"><rect width="105.312" height="143.698" x="53.41" y="458.77" rx="30" ry="30" stroke="#000" stroke-width="17.724" stroke-linecap="round" stroke-linejoin="round"/><rect ry="30.101" rx="30.101" y="458.527" x="53.232" height="144.183" width="105.668" fill="#fff"/></g></svg>
|
After Width: | Height: | Size: 721 B |
1
docs/static/loader_front.svg
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="301.499" height="179.742" viewBox="0 0 282.655 168.508"><g stroke="#000" stroke-linecap="round" stroke-linejoin="round"><g transform="translate(124.66 -243.829)"><circle r="25.968" cy="356.872" cx="-38.891" fill="none"/><circle cx="-38.891" cy="356.872" r="21.013" stroke-width=".809"/><path d="M-30.581 341.741a13.835 13.835 0 0 1 5.76 4.504l-11.099 8.26z" fill="#fff" stroke-width=".533"/></g><g transform="translate(277.193 -243.829)"><circle cx="-38.891" cy="356.872" r="25.968" fill="none"/><circle r="21.013" cy="356.872" cx="-38.891" stroke-width=".809"/><path d="M-30.581 341.741a13.835 13.835 0 0 1 5.76 4.504l-11.099 8.26z" fill="#fff" stroke-width=".533"/></g></g></svg>
|
After Width: | Height: | Size: 728 B |
1
docs/static/loader_full.svg
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="301.499" height="179.742" viewBox="0 0 282.655 168.508"><g transform="translate(-41.005 -446.364)"><rect ry="30" rx="30" y="458.77" x="53.41" height="143.698" width="105.312" stroke="#000" stroke-width="17.724" stroke-linecap="round" stroke-linejoin="round"/><rect width="105.668" height="144.183" x="53.232" y="458.527" rx="30.101" ry="30.101" fill="#fff"/></g><g transform="translate(124.66 -243.829)" stroke="#000" stroke-linecap="round" stroke-linejoin="round"><circle r="25.968" cy="356.872" cx="-38.891" fill="none"/><circle cx="-38.891" cy="356.872" r="21.013" stroke-width=".809"/><path d="M-30.581 341.741a13.835 13.835 0 0 1 5.76 4.504l-11.099 8.26z" fill="#fff" stroke-width=".533"/></g><g transform="translate(111.528 -446.364)"><rect width="105.312" height="143.698" x="53.41" y="458.77" rx="30" ry="30" stroke="#000" stroke-width="17.724" stroke-linecap="round" stroke-linejoin="round"/><rect ry="30.101" rx="30.101" y="458.527" x="53.232" height="144.183" width="105.668" fill="#fff"/></g><g transform="translate(277.193 -243.829)" stroke="#000" stroke-linecap="round" stroke-linejoin="round"><circle cx="-38.891" cy="356.872" r="25.968" fill="none"/><circle r="21.013" cy="356.872" cx="-38.891" stroke-width=".809"/><path d="M-30.581 341.741a13.835 13.835 0 0 1 5.76 4.504l-11.099 8.26z" fill="#fff" stroke-width=".533"/></g></svg>
|
After Width: | Height: | Size: 1.4 KiB |
134
editor/deploy.ts
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
import UF2 = pxtc.UF2;
|
||||||
|
|
||||||
|
export let ev3: pxt.editor.Ev3Wrapper
|
||||||
|
|
||||||
|
export function debug() {
|
||||||
|
return initAsync()
|
||||||
|
.then(w => w.downloadFileAsync("/tmp/dmesg.txt", v => console.log(pxt.Util.uint8ArrayToString(v))))
|
||||||
|
}
|
||||||
|
|
||||||
|
function hf2Async() {
|
||||||
|
return pxt.HF2.mkPacketIOAsync()
|
||||||
|
.then(h => {
|
||||||
|
let w = new pxt.editor.Ev3Wrapper(h)
|
||||||
|
ev3 = w
|
||||||
|
return w.reconnectAsync(true)
|
||||||
|
.then(() => w)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let noHID = false
|
||||||
|
|
||||||
|
let initPromise: Promise<pxt.editor.Ev3Wrapper>
|
||||||
|
export function initAsync() {
|
||||||
|
if (initPromise)
|
||||||
|
return initPromise
|
||||||
|
|
||||||
|
let canHID = false
|
||||||
|
if (pxt.U.isNodeJS) {
|
||||||
|
// doesn't seem to work ATM
|
||||||
|
canHID = false
|
||||||
|
} else {
|
||||||
|
const forceHexDownload = /forceHexDownload/i.test(window.location.href);
|
||||||
|
if (pxt.Cloud.isLocalHost() && pxt.Cloud.localToken && !forceHexDownload)
|
||||||
|
canHID = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noHID)
|
||||||
|
canHID = false
|
||||||
|
|
||||||
|
if (canHID) {
|
||||||
|
initPromise = hf2Async()
|
||||||
|
.catch(err => {
|
||||||
|
initPromise = null
|
||||||
|
noHID = true
|
||||||
|
return Promise.reject(err)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
noHID = true
|
||||||
|
initPromise = Promise.reject(new Error("no HID"))
|
||||||
|
}
|
||||||
|
|
||||||
|
return initPromise
|
||||||
|
}
|
||||||
|
|
||||||
|
// this comes from aux/pxt.lms
|
||||||
|
const rbfTemplate = `
|
||||||
|
4c45474f580000006d000100000000001c000000000000000e000000821b038405018130813e8053
|
||||||
|
74617274696e672e2e2e0084006080XX00448581644886488405018130813e80427965210084000a
|
||||||
|
`
|
||||||
|
export function deployCoreAsync(resp: pxtc.CompileResult, isCli = false) {
|
||||||
|
let w: pxt.editor.Ev3Wrapper
|
||||||
|
|
||||||
|
let filename = resp.downloadFileBaseName || "pxt"
|
||||||
|
filename = filename.replace(/^lego-/, "")
|
||||||
|
|
||||||
|
let fspath = "../prjs/BrkProg_SAVE/"
|
||||||
|
|
||||||
|
let elfPath = fspath + filename + ".elf"
|
||||||
|
let rbfPath = fspath + filename + ".rbf"
|
||||||
|
|
||||||
|
let rbfHex = rbfTemplate
|
||||||
|
.replace(/\s+/g, "")
|
||||||
|
.replace("XX", pxt.U.toHex(pxt.U.stringToUint8Array(elfPath)))
|
||||||
|
let rbfBIN = pxt.U.fromHex(rbfHex)
|
||||||
|
pxt.HF2.write16(rbfBIN, 4, rbfBIN.length)
|
||||||
|
|
||||||
|
let origElfUF2 = UF2.parseFile(pxt.U.stringToUint8Array(atob(resp.outfiles[pxt.outputName()])))
|
||||||
|
|
||||||
|
let mkFile = (ext: string, data: Uint8Array = null) => {
|
||||||
|
let f = UF2.newBlockFile()
|
||||||
|
f.filename = "Projects/" + filename + ext
|
||||||
|
if (data)
|
||||||
|
UF2.writeBytes(f, 0, data)
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
let elfUF2 = mkFile(".elf")
|
||||||
|
for (let b of origElfUF2) {
|
||||||
|
UF2.writeBytes(elfUF2, b.targetAddr, b.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
let r = UF2.concatFiles([elfUF2, mkFile(".rbf", rbfBIN)])
|
||||||
|
let data = UF2.serializeFile(r)
|
||||||
|
|
||||||
|
resp.outfiles[pxtc.BINARY_UF2] = btoa(data)
|
||||||
|
|
||||||
|
let saveUF2Async = () => {
|
||||||
|
if (isCli || !pxt.commands.saveOnlyAsync) {
|
||||||
|
return Promise.resolve()
|
||||||
|
} else {
|
||||||
|
return pxt.commands.saveOnlyAsync(resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noHID) return saveUF2Async()
|
||||||
|
|
||||||
|
return initAsync()
|
||||||
|
.then(w_ => {
|
||||||
|
w = w_
|
||||||
|
if (w.isStreaming)
|
||||||
|
pxt.U.userError("please stop the program first")
|
||||||
|
return w.stopAsync()
|
||||||
|
})
|
||||||
|
.then(() => w.rmAsync(elfPath))
|
||||||
|
.then(() => w.flashAsync(elfPath, UF2.readBytes(origElfUF2, 0, origElfUF2.length * 256)))
|
||||||
|
.then(() => w.flashAsync(rbfPath, rbfBIN))
|
||||||
|
.then(() => w.runAsync(rbfPath))
|
||||||
|
.then(() => {
|
||||||
|
if (isCli)
|
||||||
|
return w.disconnectAsync()
|
||||||
|
else
|
||||||
|
return Promise.resolve()
|
||||||
|
//return Promise.delay(1000).then(() => w.dmesgAsync())
|
||||||
|
}).catch(e => {
|
||||||
|
// if we failed to initalize, retry
|
||||||
|
if (noHID)
|
||||||
|
return saveUF2Async()
|
||||||
|
else
|
||||||
|
return Promise.reject(e)
|
||||||
|
})
|
||||||
|
}
|
@ -1,152 +1,146 @@
|
|||||||
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts" />
|
/// <reference path="../node_modules/pxt-core/built/pxteditor.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
import { deployCoreAsync, initAsync } from "./deploy";
|
||||||
|
import { FieldPorts } from "./field_ports";
|
||||||
|
import { FieldImages } from "./field_images";
|
||||||
|
import { FieldSpeed } from "./field_speed";
|
||||||
|
import { FieldBrickButtons } from "./field_brickbuttons";
|
||||||
|
import { FieldTurnRatio } from "./field_turnratio";
|
||||||
|
|
||||||
|
pxt.editor.initExtensionsAsync = function(opts: pxt.editor.ExtensionOptions): Promise<pxt.editor.ExtensionResult> {
|
||||||
|
pxt.debug('loading pxt-ev3 target extensions...')
|
||||||
|
updateBlocklyShape();
|
||||||
|
const res: pxt.editor.ExtensionResult = {
|
||||||
|
fieldEditors: [{
|
||||||
|
selector: "ports",
|
||||||
|
editor: FieldPorts
|
||||||
|
}, {
|
||||||
|
selector: "images",
|
||||||
|
editor: FieldImages
|
||||||
|
}, {
|
||||||
|
selector: "speed",
|
||||||
|
editor: FieldSpeed
|
||||||
|
}, {
|
||||||
|
selector: "brickbuttons",
|
||||||
|
editor: FieldBrickButtons
|
||||||
|
}, {
|
||||||
|
selector: "turnratio",
|
||||||
|
editor: FieldTurnRatio
|
||||||
|
}],
|
||||||
|
deployCoreAsync
|
||||||
|
};
|
||||||
|
initAsync().catch(e => {
|
||||||
|
// probably no HID - we'll try this again upon deployment
|
||||||
|
})
|
||||||
|
return Promise.resolve<pxt.editor.ExtensionResult>(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the shape of Blockly blocks with square corners
|
||||||
|
*/
|
||||||
|
function updateBlocklyShape() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rounded corner radius.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).CORNER_RADIUS = 0 * (Blockly.BlockSvg as any).GRID_UNIT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inner space between edge of statement input and notch.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).STATEMENT_INPUT_INNER_SPACE = 3 * (Blockly.BlockSvg as any).GRID_UNIT;
|
||||||
|
/**
|
||||||
|
* SVG path for drawing next/previous notch from left to right.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).NOTCH_PATH_LEFT = (
|
||||||
|
'l 8,8 ' +
|
||||||
|
'h 16 ' +
|
||||||
|
'l 8,-8 '
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing next/previous notch from right to left.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).NOTCH_PATH_RIGHT = (
|
||||||
|
'l -8,8 ' +
|
||||||
|
'h -16 ' +
|
||||||
|
'l -8,-8 '
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG start point for drawing the top-left corner.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).TOP_LEFT_CORNER_START =
|
||||||
|
'm 0,' + 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing the rounded top-left corner.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).TOP_LEFT_CORNER =
|
||||||
|
'l ' + (Blockly.BlockSvg as any).CORNER_RADIUS + ',0 ';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing the rounded top-right corner.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).TOP_RIGHT_CORNER =
|
||||||
|
'l ' + 0 + ',' + (Blockly.BlockSvg as any).CORNER_RADIUS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing the rounded bottom-right corner.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).BOTTOM_RIGHT_CORNER =
|
||||||
|
'l 0,' + (Blockly.BlockSvg as any).CORNER_RADIUS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing the rounded bottom-left corner.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).BOTTOM_LEFT_CORNER =
|
||||||
|
'l -' + (Blockly.BlockSvg as any).CORNER_RADIUS + ',0';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing the top-left corner of a statement input.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).INNER_TOP_LEFT_CORNER =
|
||||||
|
'l ' + (Blockly.BlockSvg as any).CORNER_RADIUS + ',-' + 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVG path for drawing the bottom-left corner of a statement input.
|
||||||
|
* Includes the rounded inside corner.
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly.BlockSvg as any).INNER_BOTTOM_LEFT_CORNER =
|
||||||
|
'l ' + 0 + ',' + (Blockly.BlockSvg as any).CORNER_RADIUS * 2 +
|
||||||
|
'l ' + (Blockly.BlockSvg as any).CORNER_RADIUS + ',' + 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Corner radius of the flyout background.
|
||||||
|
* @type {number}
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly as any).Flyout.prototype.CORNER_RADIUS = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Margin around the edges of the blocks in the flyout.
|
||||||
|
* @type {number}
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
(Blockly as any).Flyout.prototype.MARGIN = 8;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// When require()d from node, bind the global pxt namespace
|
// When require()d from node, bind the global pxt namespace
|
||||||
namespace pxt {
|
// namespace pxt {
|
||||||
export const dummyExport = 1;
|
// export const dummyExport = 1;
|
||||||
}
|
// }
|
||||||
eval("if (typeof process === 'object' && process + '' === '[object process]') pxt = global.pxt")
|
// eval("if (typeof process === 'object' && process + '' === '[object process]') pxt = global.pxt")
|
||||||
|
|
||||||
namespace pxt.editor {
|
|
||||||
import UF2 = pxtc.UF2;
|
|
||||||
|
|
||||||
export let ev3: Ev3Wrapper
|
|
||||||
|
|
||||||
export function debug() {
|
|
||||||
return initAsync()
|
|
||||||
.then(w => w.downloadFileAsync("/tmp/dmesg.txt", v => console.log(pxt.Util.uint8ArrayToString(v))))
|
|
||||||
}
|
|
||||||
|
|
||||||
// this comes from aux/pxt.lms
|
|
||||||
const rbfTemplate = `
|
|
||||||
4c45474f580000006d000100000000001c000000000000000e000000821b038405018130813e8053
|
|
||||||
74617274696e672e2e2e0084006080XX00448581644886488405018130813e80427965210084000a
|
|
||||||
`
|
|
||||||
|
|
||||||
function hf2Async() {
|
|
||||||
return pxt.HF2.mkPacketIOAsync()
|
|
||||||
.then(h => {
|
|
||||||
let w = new Ev3Wrapper(h)
|
|
||||||
ev3 = w
|
|
||||||
return w.reconnectAsync(true)
|
|
||||||
.then(() => w)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let noHID = false
|
|
||||||
|
|
||||||
let initPromise: Promise<Ev3Wrapper>
|
|
||||||
function initAsync() {
|
|
||||||
if (initPromise)
|
|
||||||
return initPromise
|
|
||||||
|
|
||||||
let canHID = false
|
|
||||||
if (U.isNodeJS) {
|
|
||||||
canHID = true
|
|
||||||
} else {
|
|
||||||
const forceHexDownload = /forceHexDownload/i.test(window.location.href);
|
|
||||||
if (Cloud.isLocalHost() && Cloud.localToken && !forceHexDownload)
|
|
||||||
canHID = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noHID)
|
|
||||||
canHID = false
|
|
||||||
|
|
||||||
if (canHID) {
|
|
||||||
initPromise = hf2Async()
|
|
||||||
.catch(err => {
|
|
||||||
initPromise = null
|
|
||||||
noHID = true
|
|
||||||
return Promise.reject(err)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
noHID = true
|
|
||||||
initPromise = Promise.reject(new Error("no HID"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return initPromise
|
|
||||||
}
|
|
||||||
|
|
||||||
export function deployCoreAsync(resp: pxtc.CompileResult, isCli = false) {
|
|
||||||
let w: Ev3Wrapper
|
|
||||||
|
|
||||||
let filename = resp.downloadFileBaseName || "pxt"
|
|
||||||
filename = filename.replace(/^lego-/, "")
|
|
||||||
|
|
||||||
let fspath = "../prjs/BrkProg_SAVE/"
|
|
||||||
|
|
||||||
let elfPath = fspath + filename + ".elf"
|
|
||||||
let rbfPath = fspath + filename + ".rbf"
|
|
||||||
|
|
||||||
let rbfHex = rbfTemplate
|
|
||||||
.replace(/\s+/g, "")
|
|
||||||
.replace("XX", U.toHex(U.stringToUint8Array(elfPath)))
|
|
||||||
let rbfBIN = U.fromHex(rbfHex)
|
|
||||||
HF2.write16(rbfBIN, 4, rbfBIN.length)
|
|
||||||
|
|
||||||
let origElfUF2 = UF2.parseFile(U.stringToUint8Array(atob(resp.outfiles[pxt.outputName()])))
|
|
||||||
|
|
||||||
let mkFile = (ext: string, data: Uint8Array = null) => {
|
|
||||||
let f = UF2.newBlockFile()
|
|
||||||
f.filename = "Projects/" + filename + ext
|
|
||||||
if (data)
|
|
||||||
UF2.writeBytes(f, 0, data)
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
let elfUF2 = mkFile(".elf")
|
|
||||||
for (let b of origElfUF2) {
|
|
||||||
UF2.writeBytes(elfUF2, b.targetAddr, b.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
let r = UF2.concatFiles([elfUF2, mkFile(".rbf", rbfBIN)])
|
|
||||||
let data = UF2.serializeFile(r)
|
|
||||||
|
|
||||||
resp.outfiles[pxtc.BINARY_UF2] = btoa(data)
|
|
||||||
|
|
||||||
let saveUF2Async = () => {
|
|
||||||
if (isCli || !pxt.commands.saveOnlyAsync) {
|
|
||||||
return Promise.resolve()
|
|
||||||
} else {
|
|
||||||
return pxt.commands.saveOnlyAsync(resp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noHID) return saveUF2Async()
|
|
||||||
|
|
||||||
return initAsync()
|
|
||||||
.then(w_ => {
|
|
||||||
w = w_
|
|
||||||
if (w.isStreaming)
|
|
||||||
U.userError("please stop the program first")
|
|
||||||
return w.stopAsync()
|
|
||||||
})
|
|
||||||
.then(() => w.rmAsync(elfPath))
|
|
||||||
.then(() => w.flashAsync(elfPath, UF2.readBytes(origElfUF2, 0, origElfUF2.length * 256)))
|
|
||||||
.then(() => w.flashAsync(rbfPath, rbfBIN))
|
|
||||||
.then(() => w.runAsync(rbfPath))
|
|
||||||
.then(() => {
|
|
||||||
if (isCli)
|
|
||||||
return w.disconnectAsync()
|
|
||||||
else
|
|
||||||
return Promise.resolve()
|
|
||||||
//return Promise.delay(1000).then(() => w.dmesgAsync())
|
|
||||||
}).catch(e => {
|
|
||||||
// if we failed to initalize, retry
|
|
||||||
if (noHID)
|
|
||||||
return saveUF2Async()
|
|
||||||
else
|
|
||||||
return Promise.reject(e)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): Promise<pxt.editor.ExtensionResult> {
|
|
||||||
pxt.debug('loading pxt-ev3 target extensions...')
|
|
||||||
const res: pxt.editor.ExtensionResult = {
|
|
||||||
deployCoreAsync,
|
|
||||||
};
|
|
||||||
initAsync().catch(e => {
|
|
||||||
// probably no HID - we'll try this again upon deployment
|
|
||||||
})
|
|
||||||
return Promise.resolve<pxt.editor.ExtensionResult>(res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
159
editor/field_brickbuttons.ts
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
export interface FieldPortsOptions extends Blockly.FieldCustomDropdownOptions {
|
||||||
|
columns?: string;
|
||||||
|
width?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FieldBrickButtons extends Blockly.FieldDropdown implements Blockly.FieldCustom {
|
||||||
|
public isFieldCustom_ = true;
|
||||||
|
|
||||||
|
// Width in pixels
|
||||||
|
private width_: number;
|
||||||
|
|
||||||
|
// Columns in grid
|
||||||
|
private columns_: number;
|
||||||
|
|
||||||
|
private savedPrimary_: string;
|
||||||
|
|
||||||
|
constructor(text: string, options: FieldPortsOptions, validator?: Function) {
|
||||||
|
super(options.data);
|
||||||
|
|
||||||
|
this.columns_ = parseInt(options.columns) || 4;
|
||||||
|
this.width_ = parseInt(options.width) || 150;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a dropdown menu under the text.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
public showEditor_() {
|
||||||
|
// If there is an existing drop-down we own, this is a request to hide the drop-down.
|
||||||
|
if (Blockly.DropDownDiv.hideIfOwner(this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If there is an existing drop-down someone else owns, hide it immediately and clear it.
|
||||||
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
||||||
|
Blockly.DropDownDiv.clearContent();
|
||||||
|
// Populate the drop-down with the icons for this field.
|
||||||
|
let dropdownDiv = Blockly.DropDownDiv.getContentDiv();
|
||||||
|
let contentDiv = document.createElement('div');
|
||||||
|
// Accessibility properties
|
||||||
|
contentDiv.setAttribute('role', 'menu');
|
||||||
|
contentDiv.setAttribute('aria-haspopup', 'true');
|
||||||
|
|
||||||
|
const buttonsSVG = document.createElementNS("http://www.w3.org/2000/svg", "svg") as SVGGElement;
|
||||||
|
pxsim.svg.hydrate(buttonsSVG, {
|
||||||
|
viewBox: "0 0 256.68237 256.68237",
|
||||||
|
width: this.width_,
|
||||||
|
height: this.width_
|
||||||
|
});
|
||||||
|
contentDiv.appendChild(buttonsSVG);
|
||||||
|
|
||||||
|
const gWrapper = pxsim.svg.child(buttonsSVG, 'g', { 'transform': 'translate(-4.695057,58.29823)' });
|
||||||
|
const gInnerWrapper = pxsim.svg.child(gWrapper, 'g', { 'transform': 'translate(3.9780427e-6,-32.677281)' });
|
||||||
|
|
||||||
|
const back = pxsim.svg.child(gInnerWrapper, 'path', {
|
||||||
|
style: 'fill:#6a6a6a;stroke-width:3.91719985',
|
||||||
|
d: 'M 106.30882,198.38022 C 84.431262,177.26258 50.453467,142.52878 50.453467,142.52878 v -7.12931 H 37.087971 a 32.381533,32.381533 0 1 1 0,-64.763062 H 50.457376 V 63.503186 L 105.71731,7.0563355 h 55.25604 c 25.02699,25.5048885 55.25994,55.2599395 55.25994,55.2599395 v 8.320133 h 12.77398 a 32.381533,32.381533 0 0 1 0,64.763062 h -12.77398 v 7.13323 c -29.43384,30.27603 -54.66454,55.85144 -54.66454,55.85144 z'
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttonLeft = pxsim.svg.child(gInnerWrapper, 'path', {
|
||||||
|
style: 'fill:#a8a9a8;stroke-width:3.91719985',
|
||||||
|
d: 'm 36.492567,78.357208 h 40.69971 V 126.48393 H 36.492567 A 24.063359,24.063359 0 0 1 12.429199,102.42057 v 0 A 24.063359,24.063359 0 0 1 36.492567,78.357208 Z'
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttonRight = pxsim.svg.child(gInnerWrapper, 'path', {
|
||||||
|
style: 'fill:#a8a9a8;stroke-width:3.91719985',
|
||||||
|
d: 'M 229.00727,126.48784 H 188.30756 V 78.361126 h 40.69971 a 24.063359,24.063359 0 0 1 24.06335,24.063354 v 0 a 24.063359,24.063359 0 0 1 -24.06335,24.06336 z'
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttonEnter = pxsim.svg.child(gInnerWrapper, 'path', {
|
||||||
|
style: 'fill:#3c3c3c;stroke-width:3.91719985',
|
||||||
|
d: 'm 109.27806,78.357208 h 46.9398 a 1.782326,1.782326 0 0 1 1.78233,1.782326 V 124.7016 a 1.782326,1.782326 0 0 1 -1.78233,1.78233 h -46.9398 a 1.782326,1.782326 0 0 1 -1.78233,-1.78233 V 80.139534 a 1.782326,1.782326 0 0 1 1.78233,-1.782326 z'
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttonTop = pxsim.svg.child(gInnerWrapper, 'path', {
|
||||||
|
style: 'fill:#a8a9a8;stroke-width:3.91719985',
|
||||||
|
d: 'm 108.09114,15.967966 49.90905,-0.59542 37.43276,38.619675 -15.44943,15.449437 V 97.367379 H 165.7249 V 81.306861 A 11.978797,11.978797 0 0 0 153.84012,69.422075 c -11.59883,-0.184102 -43.37516,0 -43.37516,0 A 9.6676495,9.6676495 0 0 0 100.36251,79.520618 V 97.347793 H 86.103905 V 69.422075 L 70.654464,53.97264 Z'
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttonBottom = pxsim.svg.child(gInnerWrapper, 'path', {
|
||||||
|
style: 'fill:#a8a9a8;stroke-width:3.91719985',
|
||||||
|
d: 'M 157.78865,189.01028 108.18908,189.38233 70.654464,150.794 86.323259,135.4895 v -28.08625 h 14.101921 v 16.11144 a 12.006218,12.006218 0 0 0 11.85346,11.9788 c 11.59882,0.1841 43.13227,0 43.13227,0 a 10.18472,10.18472 0 0 0 10.38059,-10.38058 v -17.70966 h 14.39179 v 28.08632 l 15.3045,15.3045 z'
|
||||||
|
})
|
||||||
|
|
||||||
|
const buttons = [buttonEnter, buttonLeft, buttonRight, buttonTop, buttonBottom];
|
||||||
|
const options = this.getOptions();
|
||||||
|
for (let i = 0, option: any; option = options[i]; i++) {
|
||||||
|
let content = (options[i] as any)[0]; // Human-readable text or image.
|
||||||
|
const value = (options[i] as any)[1]; // Language-neutral value.
|
||||||
|
const button = buttons[i];
|
||||||
|
button.setAttribute('id', ':' + i); // For aria-activedescendant
|
||||||
|
button.setAttribute('role', 'menuitem');
|
||||||
|
button.setAttribute('cursor', 'pointer');
|
||||||
|
const title = pxsim.svg.child(button, 'title');
|
||||||
|
title.textContent = content;
|
||||||
|
|
||||||
|
Blockly.bindEvent_(button, 'click', this, this.buttonClick_);
|
||||||
|
Blockly.bindEvent_(button, 'mouseup', this, this.buttonClick_);
|
||||||
|
// These are applied manually instead of using the :hover pseudoclass
|
||||||
|
// because Android has a bad long press "helper" menu and green highlight
|
||||||
|
// that we must prevent with ontouchstart preventDefault
|
||||||
|
Blockly.bindEvent_(button, 'mousedown', button, function (e) {
|
||||||
|
this.setAttribute('stroke', '#ffffff');
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
Blockly.bindEvent_(button, 'mouseover', button, function () {
|
||||||
|
this.setAttribute('stroke', '#ffffff');
|
||||||
|
});
|
||||||
|
Blockly.bindEvent_(button, 'mouseout', button, function () {
|
||||||
|
this.setAttribute('stroke', 'transparent');
|
||||||
|
});
|
||||||
|
|
||||||
|
button.setAttribute('data-value', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
contentDiv.style.width = this.width_ + 'px';
|
||||||
|
dropdownDiv.appendChild(contentDiv);
|
||||||
|
|
||||||
|
Blockly.DropDownDiv.setColour('#ffffff', '#dddddd');
|
||||||
|
|
||||||
|
// Calculate positioning based on the field position.
|
||||||
|
var scale = this.sourceBlock_.workspace.scale;
|
||||||
|
var bBox = { width: this.size_.width, height: this.size_.height };
|
||||||
|
bBox.width *= scale;
|
||||||
|
bBox.height *= scale;
|
||||||
|
var position = this.fieldGroup_.getBoundingClientRect();
|
||||||
|
var primaryX = position.left + bBox.width / 2;
|
||||||
|
var primaryY = position.top + bBox.height;
|
||||||
|
var secondaryX = primaryX;
|
||||||
|
var secondaryY = position.top;
|
||||||
|
// Set bounds to workspace; show the drop-down.
|
||||||
|
(Blockly.DropDownDiv as any).setBoundsElement(this.sourceBlock_.workspace.getParentSvg().parentNode);
|
||||||
|
(Blockly.DropDownDiv as any).show(this, primaryX, primaryY, secondaryX, secondaryY,
|
||||||
|
this.onHide_.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for when a button is clicked inside the drop-down.
|
||||||
|
* Should be bound to the FieldIconMenu.
|
||||||
|
* @param {Event} e DOM event for the click/touch
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private buttonClick_ = function (e: any) {
|
||||||
|
let value = e.target.getAttribute('data-value');
|
||||||
|
this.setValue(value);
|
||||||
|
Blockly.DropDownDiv.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for when the drop-down is hidden.
|
||||||
|
*/
|
||||||
|
private onHide_ = function () {
|
||||||
|
Blockly.DropDownDiv.content_.removeAttribute('role');
|
||||||
|
Blockly.DropDownDiv.content_.removeAttribute('aria-haspopup');
|
||||||
|
Blockly.DropDownDiv.content_.removeAttribute('aria-activedescendant');
|
||||||
|
};
|
||||||
|
}
|
114
editor/field_images.ts
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtblocks.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
export interface FieldImagesOptions extends pxtblockly.FieldImageDropdownOptions {
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FieldImages extends pxtblockly.FieldImageDropdown implements Blockly.FieldCustom {
|
||||||
|
public isFieldCustom_ = true;
|
||||||
|
|
||||||
|
constructor(text: string, options: FieldImagesOptions, validator?: Function) {
|
||||||
|
super(text, options, validator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a dropdown menu under the text.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
public showEditor_() {
|
||||||
|
// If there is an existing drop-down we own, this is a request to hide the drop-down.
|
||||||
|
if (Blockly.DropDownDiv.hideIfOwner(this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If there is an existing drop-down someone else owns, hide it immediately and clear it.
|
||||||
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
||||||
|
Blockly.DropDownDiv.clearContent();
|
||||||
|
// Populate the drop-down with the icons for this field.
|
||||||
|
let dropdownDiv = Blockly.DropDownDiv.getContentDiv();
|
||||||
|
let contentDiv = document.createElement('div');
|
||||||
|
// Accessibility properties
|
||||||
|
contentDiv.setAttribute('role', 'menu');
|
||||||
|
contentDiv.setAttribute('aria-haspopup', 'true');
|
||||||
|
const options = this.getOptions();
|
||||||
|
for (let i = 0, option: any; option = options[i]; i++) {
|
||||||
|
let content = (options[i] as any)[0]; // Human-readable text or image.
|
||||||
|
const value = (options[i] as any)[1]; // Language-neutral value.
|
||||||
|
// Icons with the type property placeholder take up space but don't have any functionality
|
||||||
|
// Use for special-case layouts
|
||||||
|
if (content.type == 'placeholder') {
|
||||||
|
let placeholder = document.createElement('span');
|
||||||
|
placeholder.setAttribute('class', 'blocklyDropDownPlaceholder');
|
||||||
|
placeholder.style.width = content.width + 'px';
|
||||||
|
placeholder.style.height = content.height + 'px';
|
||||||
|
contentDiv.appendChild(placeholder);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let button = document.createElement('button');
|
||||||
|
button.setAttribute('id', ':' + i); // For aria-activedescendant
|
||||||
|
button.setAttribute('role', 'menuitem');
|
||||||
|
button.setAttribute('class', 'blocklyDropDownButton');
|
||||||
|
button.title = content.alt;
|
||||||
|
if ((this as any).columns_) {
|
||||||
|
button.style.width = (((this as any).width_ / (this as any).columns_) - 8) + 'px';
|
||||||
|
//button.style.height = ((this.width_ / this.columns_) - 8) + 'px';
|
||||||
|
} else {
|
||||||
|
button.style.width = content.width + 'px';
|
||||||
|
button.style.height = content.height + 'px';
|
||||||
|
}
|
||||||
|
let backgroundColor = this.sourceBlock_.getColour();
|
||||||
|
if (value == this.getValue()) {
|
||||||
|
// This icon is selected, show it in a different colour
|
||||||
|
backgroundColor = this.sourceBlock_.getColourTertiary();
|
||||||
|
button.setAttribute('aria-selected', 'true');
|
||||||
|
}
|
||||||
|
button.style.backgroundColor = backgroundColor;
|
||||||
|
button.style.borderColor = this.sourceBlock_.getColourTertiary();
|
||||||
|
Blockly.bindEvent_(button, 'click', this, (this as any).buttonClick_);
|
||||||
|
Blockly.bindEvent_(button, 'mouseup', this, (this as any).buttonClick_);
|
||||||
|
// These are applied manually instead of using the :hover pseudoclass
|
||||||
|
// because Android has a bad long press "helper" menu and green highlight
|
||||||
|
// that we must prevent with ontouchstart preventDefault
|
||||||
|
Blockly.bindEvent_(button, 'mousedown', button, function (e) {
|
||||||
|
this.setAttribute('class', 'blocklyDropDownButton blocklyDropDownButtonHover');
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
Blockly.bindEvent_(button, 'mouseover', button, function () {
|
||||||
|
this.setAttribute('class', 'blocklyDropDownButton blocklyDropDownButtonHover');
|
||||||
|
contentDiv.setAttribute('aria-activedescendant', this.id);
|
||||||
|
});
|
||||||
|
Blockly.bindEvent_(button, 'mouseout', button, function () {
|
||||||
|
this.setAttribute('class', 'blocklyDropDownButton');
|
||||||
|
contentDiv.removeAttribute('aria-activedescendant');
|
||||||
|
});
|
||||||
|
let buttonImg = document.createElement('img');
|
||||||
|
buttonImg.src = content.src;
|
||||||
|
//buttonImg.alt = icon.alt;
|
||||||
|
// Upon click/touch, we will be able to get the clicked element as e.target
|
||||||
|
// Store a data attribute on all possible click targets so we can match it to the icon.
|
||||||
|
button.setAttribute('data-value', value);
|
||||||
|
buttonImg.setAttribute('data-value', value);
|
||||||
|
button.appendChild(buttonImg);
|
||||||
|
contentDiv.appendChild(button);
|
||||||
|
}
|
||||||
|
contentDiv.style.width = (this as any).width_ + 'px';
|
||||||
|
dropdownDiv.appendChild(contentDiv);
|
||||||
|
|
||||||
|
Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(), this.sourceBlock_.getColourTertiary());
|
||||||
|
|
||||||
|
// Calculate positioning based on the field position.
|
||||||
|
var scale = this.sourceBlock_.workspace.scale;
|
||||||
|
var bBox = { width: this.size_.width, height: this.size_.height };
|
||||||
|
bBox.width *= scale;
|
||||||
|
bBox.height *= scale;
|
||||||
|
var position = this.fieldGroup_.getBoundingClientRect();
|
||||||
|
var primaryX = position.left + bBox.width / 2;
|
||||||
|
var primaryY = position.top + bBox.height;
|
||||||
|
var secondaryX = primaryX;
|
||||||
|
var secondaryY = position.top;
|
||||||
|
// Set bounds to workspace; show the drop-down.
|
||||||
|
(Blockly.DropDownDiv as any).setBoundsElement(this.sourceBlock_.workspace.getParentSvg().parentNode);
|
||||||
|
(Blockly.DropDownDiv as any).show(this, primaryX, primaryY, secondaryX, secondaryY,
|
||||||
|
(this as any).onHide_.bind(this));
|
||||||
|
}
|
||||||
|
}
|
151
editor/field_ports.ts
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
export interface FieldPortsOptions extends Blockly.FieldCustomDropdownOptions {
|
||||||
|
columns?: string;
|
||||||
|
width?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FieldPorts extends Blockly.FieldDropdown implements Blockly.FieldCustom {
|
||||||
|
public isFieldCustom_ = true;
|
||||||
|
|
||||||
|
// Width in pixels
|
||||||
|
private width_: number;
|
||||||
|
|
||||||
|
// Columns in grid
|
||||||
|
private columns_: number;
|
||||||
|
|
||||||
|
private savedPrimary_: string;
|
||||||
|
|
||||||
|
constructor(text: string, options: FieldPortsOptions, validator?: Function) {
|
||||||
|
super(options.data);
|
||||||
|
|
||||||
|
this.columns_ = parseInt(options.columns) || 4;
|
||||||
|
this.width_ = parseInt(options.width) || 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
trimOptions_() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a dropdown menu under the text.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
public showEditor_() {
|
||||||
|
// If there is an existing drop-down we own, this is a request to hide the drop-down.
|
||||||
|
if (Blockly.DropDownDiv.hideIfOwner(this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If there is an existing drop-down someone else owns, hide it immediately and clear it.
|
||||||
|
Blockly.DropDownDiv.hideWithoutAnimation();
|
||||||
|
Blockly.DropDownDiv.clearContent();
|
||||||
|
// Populate the drop-down with the icons for this field.
|
||||||
|
let dropdownDiv = Blockly.DropDownDiv.getContentDiv();
|
||||||
|
let contentDiv = document.createElement('div');
|
||||||
|
// Accessibility properties
|
||||||
|
contentDiv.setAttribute('role', 'menu');
|
||||||
|
contentDiv.setAttribute('aria-haspopup', 'true');
|
||||||
|
let options = this.getOptions();
|
||||||
|
options = options.sort();
|
||||||
|
for (let i = 0, option: any; option = options[i]; i++) {
|
||||||
|
let content = (options[i] as any)[0]; // Human-readable text or image.
|
||||||
|
const value = (options[i] as any)[1]; // Language-neutral value.
|
||||||
|
// Icons with the type property placeholder take up space but don't have any functionality
|
||||||
|
// Use for special-case layouts
|
||||||
|
if (content.type == 'placeholder') {
|
||||||
|
let placeholder = document.createElement('span');
|
||||||
|
placeholder.setAttribute('class', 'blocklyDropDownPlaceholder');
|
||||||
|
placeholder.style.width = content.width + 'px';
|
||||||
|
placeholder.style.height = content.height + 'px';
|
||||||
|
contentDiv.appendChild(placeholder);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let button = document.createElement('button');
|
||||||
|
button.setAttribute('id', ':' + i); // For aria-activedescendant
|
||||||
|
button.setAttribute('role', 'menuitem');
|
||||||
|
button.setAttribute('class', 'blocklyDropDownButton');
|
||||||
|
button.title = content.alt;
|
||||||
|
if (this.columns_) {
|
||||||
|
button.style.width = ((this.width_ / this.columns_) - 8) + 'px';
|
||||||
|
button.style.height = ((this.width_ / this.columns_) - 8) + 'px';
|
||||||
|
} else {
|
||||||
|
button.style.width = content.width + 'px';
|
||||||
|
button.style.height = content.height + 'px';
|
||||||
|
}
|
||||||
|
let backgroundColor = this.sourceBlock_.getColour();
|
||||||
|
if (value == this.getValue()) {
|
||||||
|
// This icon is selected, show it in a different colour
|
||||||
|
backgroundColor = this.sourceBlock_.getColourTertiary();
|
||||||
|
button.setAttribute('aria-selected', 'true');
|
||||||
|
}
|
||||||
|
button.style.backgroundColor = backgroundColor;
|
||||||
|
button.style.borderColor = this.sourceBlock_.getColourTertiary();
|
||||||
|
Blockly.bindEvent_(button, 'click', this, this.buttonClick_);
|
||||||
|
Blockly.bindEvent_(button, 'mouseup', this, this.buttonClick_);
|
||||||
|
// These are applied manually instead of using the :hover pseudoclass
|
||||||
|
// because Android has a bad long press "helper" menu and green highlight
|
||||||
|
// that we must prevent with ontouchstart preventDefault
|
||||||
|
Blockly.bindEvent_(button, 'mousedown', button, function (e) {
|
||||||
|
this.setAttribute('class', 'blocklyDropDownButton blocklyDropDownButtonHover');
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
Blockly.bindEvent_(button, 'mouseover', button, function () {
|
||||||
|
this.setAttribute('class', 'blocklyDropDownButton blocklyDropDownButtonHover');
|
||||||
|
contentDiv.setAttribute('aria-activedescendant', this.id);
|
||||||
|
});
|
||||||
|
Blockly.bindEvent_(button, 'mouseout', button, function () {
|
||||||
|
this.setAttribute('class', 'blocklyDropDownButton');
|
||||||
|
contentDiv.removeAttribute('aria-activedescendant');
|
||||||
|
});
|
||||||
|
let buttonImg = document.createElement('img');
|
||||||
|
buttonImg.src = content.src;
|
||||||
|
//buttonImg.alt = icon.alt;
|
||||||
|
// Upon click/touch, we will be able to get the clicked element as e.target
|
||||||
|
// Store a data attribute on all possible click targets so we can match it to the icon.
|
||||||
|
button.setAttribute('data-value', value);
|
||||||
|
buttonImg.setAttribute('data-value', value);
|
||||||
|
button.appendChild(buttonImg);
|
||||||
|
contentDiv.appendChild(button);
|
||||||
|
}
|
||||||
|
contentDiv.style.width = this.width_ + 'px';
|
||||||
|
dropdownDiv.appendChild(contentDiv);
|
||||||
|
|
||||||
|
Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(), this.sourceBlock_.getColourTertiary());
|
||||||
|
|
||||||
|
// Calculate positioning based on the field position.
|
||||||
|
var scale = this.sourceBlock_.workspace.scale;
|
||||||
|
var bBox = { width: this.size_.width, height: this.size_.height };
|
||||||
|
bBox.width *= scale;
|
||||||
|
bBox.height *= scale;
|
||||||
|
var position = this.fieldGroup_.getBoundingClientRect();
|
||||||
|
var primaryX = position.left + bBox.width / 2;
|
||||||
|
var primaryY = position.top + bBox.height;
|
||||||
|
var secondaryX = primaryX;
|
||||||
|
var secondaryY = position.top;
|
||||||
|
// Set bounds to workspace; show the drop-down.
|
||||||
|
(Blockly.DropDownDiv as any).setBoundsElement(this.sourceBlock_.workspace.getParentSvg().parentNode);
|
||||||
|
(Blockly.DropDownDiv as any).show(this, primaryX, primaryY, secondaryX, secondaryY,
|
||||||
|
this.onHide_.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for when a button is clicked inside the drop-down.
|
||||||
|
* Should be bound to the FieldIconMenu.
|
||||||
|
* @param {Event} e DOM event for the click/touch
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private buttonClick_ = function (e: any) {
|
||||||
|
let value = e.target.getAttribute('data-value');
|
||||||
|
this.setValue(value);
|
||||||
|
Blockly.DropDownDiv.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for when the drop-down is hidden.
|
||||||
|
*/
|
||||||
|
private onHide_ = function () {
|
||||||
|
Blockly.DropDownDiv.content_.removeAttribute('role');
|
||||||
|
Blockly.DropDownDiv.content_.removeAttribute('aria-haspopup');
|
||||||
|
Blockly.DropDownDiv.content_.removeAttribute('aria-activedescendant');
|
||||||
|
};
|
||||||
|
}
|
96
editor/field_speed.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
export interface FieldSpeedOptions extends Blockly.FieldCustomOptions {
|
||||||
|
min?: string;
|
||||||
|
max?: string;
|
||||||
|
label?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FieldSpeed extends Blockly.FieldSlider implements Blockly.FieldCustom {
|
||||||
|
public isFieldCustom_ = true;
|
||||||
|
|
||||||
|
private params: any;
|
||||||
|
|
||||||
|
private speedSVG: SVGElement;
|
||||||
|
private circleBar: SVGCircleElement;
|
||||||
|
private reporter: SVGTextElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for a color wheel field.
|
||||||
|
* @param {number|string} value The initial content of the field.
|
||||||
|
* @param {Function=} opt_validator An optional function that is called
|
||||||
|
* to validate any constraints on what the user entered. Takes the new
|
||||||
|
* text as an argument and returns either the accepted text, a replacement
|
||||||
|
* text, or null to abort the change.
|
||||||
|
* @extends {Blockly.FieldNumber}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
constructor(value_: any, params: FieldSpeedOptions, opt_validator?: Function) {
|
||||||
|
super(String(value_), '-100', '100', null, '10', 'Speed', opt_validator);
|
||||||
|
this.params = params;
|
||||||
|
if (this.params['min']) this.min_ = parseFloat(this.params.min);
|
||||||
|
if (this.params['max']) this.max_ = parseFloat(this.params.max);
|
||||||
|
if (this.params['label']) this.labelText_ = this.params.label;
|
||||||
|
|
||||||
|
(this as any).sliderColor_ = '#a8aaa8';
|
||||||
|
}
|
||||||
|
|
||||||
|
createLabelDom_(labelText: string) {
|
||||||
|
var labelContainer = document.createElement('div');
|
||||||
|
this.speedSVG = document.createElementNS("http://www.w3.org/2000/svg", "svg") as SVGGElement;
|
||||||
|
pxsim.svg.hydrate(this.speedSVG, {
|
||||||
|
viewBox: "0 0 200 100"
|
||||||
|
});
|
||||||
|
|
||||||
|
labelContainer.appendChild(this.speedSVG);
|
||||||
|
|
||||||
|
const outerCircle = pxsim.svg.child(this.speedSVG, "circle", {
|
||||||
|
'stroke-dasharray': '565.48', 'stroke-dashoffset': '0',
|
||||||
|
'cx': 100, 'cy': 100, 'r': '90', 'style': `fill:transparent; transition: stroke-dashoffset 0.1s linear;`,
|
||||||
|
'stroke': '#a8aaa8', 'stroke-width': '1rem'
|
||||||
|
}) as SVGCircleElement;
|
||||||
|
this.circleBar = pxsim.svg.child(this.speedSVG, "circle", {
|
||||||
|
'stroke-dasharray': '565.48', 'stroke-dashoffset': '0',
|
||||||
|
'cx': 100, 'cy': 100, 'r': '90', 'style': `fill:transparent; transition: stroke-dashoffset 0.1s linear;`,
|
||||||
|
'stroke': '#f12a21', 'stroke-width': '1rem'
|
||||||
|
}) as SVGCircleElement;
|
||||||
|
|
||||||
|
this.reporter = pxsim.svg.child(this.speedSVG, "text", {
|
||||||
|
'x': 100, 'y': 80,
|
||||||
|
'text-anchor': 'middle', 'alignment-baseline': 'middle',
|
||||||
|
'style': 'font-size: 50px',
|
||||||
|
'class': 'sim-text inverted number'
|
||||||
|
}) as SVGTextElement;
|
||||||
|
|
||||||
|
// labelContainer.setAttribute('class', 'blocklyFieldSliderLabel');
|
||||||
|
var readout = document.createElement('span');
|
||||||
|
readout.setAttribute('class', 'blocklyFieldSliderReadout');
|
||||||
|
// var label = document.createElement('span');
|
||||||
|
// label.setAttribute('class', 'blocklyFieldSliderLabelText');
|
||||||
|
// label.innerHTML = labelText;
|
||||||
|
// labelContainer.appendChild(label);
|
||||||
|
// labelContainer.appendChild(readout);
|
||||||
|
return [labelContainer, readout];
|
||||||
|
};
|
||||||
|
|
||||||
|
setReadout_(readout: Element, value: string) {
|
||||||
|
this.updateSpeed(parseFloat(value));
|
||||||
|
// Update reporter
|
||||||
|
this.reporter.textContent = `${value}%`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateSpeed(speed: number) {
|
||||||
|
let sign = this.sign(speed);
|
||||||
|
speed = (Math.abs(speed) / 100 * 50) + 50;
|
||||||
|
if (sign == -1) speed = 50 - speed;
|
||||||
|
let c = Math.PI * (90 * 2);
|
||||||
|
let pct = ((100 - speed) / 100) * c;
|
||||||
|
this.circleBar.setAttribute('stroke-dashoffset', `${pct}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// A re-implementation of Math.sign (since IE11 doesn't support it)
|
||||||
|
private sign(num: number) {
|
||||||
|
return num ? num < 0 ? -1 : 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
108
editor/field_turnratio.ts
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/// <reference path="../node_modules/pxt-core/localtypings/blockly.d.ts"/>
|
||||||
|
/// <reference path="../node_modules/pxt-core/built/pxtsim.d.ts"/>
|
||||||
|
|
||||||
|
export interface FieldTurnRatioOptions extends Blockly.FieldCustomOptions {
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FieldTurnRatio extends Blockly.FieldSlider implements Blockly.FieldCustom {
|
||||||
|
public isFieldCustom_ = true;
|
||||||
|
|
||||||
|
private params: any;
|
||||||
|
|
||||||
|
private path_: SVGPathElement;
|
||||||
|
private reporter_: SVGTextElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for a color wheel field.
|
||||||
|
* @param {number|string} value The initial content of the field.
|
||||||
|
* @param {Function=} opt_validator An optional function that is called
|
||||||
|
* to validate any constraints on what the user entered. Takes the new
|
||||||
|
* text as an argument and returns either the accepted text, a replacement
|
||||||
|
* text, or null to abort the change.
|
||||||
|
* @extends {Blockly.FieldNumber}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
constructor(value_: any, params: FieldTurnRatioOptions, opt_validator?: Function) {
|
||||||
|
super(String(value_), '-100', '100', null, '10', 'TurnRatio', opt_validator);
|
||||||
|
this.params = params;
|
||||||
|
(this as any).sliderColor_ = '#a8aaa8';
|
||||||
|
}
|
||||||
|
|
||||||
|
static HALF = 80;
|
||||||
|
static HANDLE_RADIUS = 30;
|
||||||
|
static RADIUS = FieldTurnRatio.HALF - FieldTurnRatio.HANDLE_RADIUS - 1;
|
||||||
|
|
||||||
|
createLabelDom_(labelText: string) {
|
||||||
|
let labelContainer = document.createElement('div');
|
||||||
|
let svg = Blockly.utils.createSvgElement('svg', {
|
||||||
|
'xmlns': 'http://www.w3.org/2000/svg',
|
||||||
|
'xmlns:html': 'http://www.w3.org/1999/xhtml',
|
||||||
|
'xmlns:xlink': 'http://www.w3.org/1999/xlink',
|
||||||
|
'version': '1.1',
|
||||||
|
'height': (FieldTurnRatio.HALF + FieldTurnRatio.HANDLE_RADIUS + 10) + 'px',
|
||||||
|
'width': (FieldTurnRatio.HALF * 2) + 'px'
|
||||||
|
}, labelContainer);
|
||||||
|
let defs = Blockly.utils.createSvgElement('defs', {}, svg);
|
||||||
|
let marker = Blockly.utils.createSvgElement('marker', {
|
||||||
|
'id': 'head',
|
||||||
|
'orient': "auto",
|
||||||
|
'markerWidth': '2',
|
||||||
|
'markerHeight': '4',
|
||||||
|
'refX': '0.1', 'refY': '1.5'
|
||||||
|
}, defs);
|
||||||
|
let markerPath = Blockly.utils.createSvgElement('path', {
|
||||||
|
'd': 'M0,0 V3 L1.5,1.5 Z',
|
||||||
|
'fill': '#f12a21'
|
||||||
|
}, marker);
|
||||||
|
this.reporter_ = pxsim.svg.child(svg, "text", {
|
||||||
|
'x': FieldTurnRatio.HALF, 'y': 96,
|
||||||
|
'text-anchor': 'middle', 'alignment-baseline': 'middle',
|
||||||
|
'style': 'font-size: 50px',
|
||||||
|
'class': 'sim-text inverted number'
|
||||||
|
}) as SVGTextElement;
|
||||||
|
this.path_ = Blockly.utils.createSvgElement('path', {
|
||||||
|
'x1': FieldTurnRatio.HALF,
|
||||||
|
'y1': FieldTurnRatio.HALF,
|
||||||
|
'marker-end': 'url(#head)',
|
||||||
|
'style': 'fill: none; stroke: #f12a21; stroke-width: 10'
|
||||||
|
}, svg);
|
||||||
|
this.updateGraph_();
|
||||||
|
let readout = document.createElement('span');
|
||||||
|
readout.setAttribute('class', 'blocklyFieldSliderReadout');
|
||||||
|
return [labelContainer, readout];
|
||||||
|
};
|
||||||
|
|
||||||
|
updateGraph_() {
|
||||||
|
if (!this.path_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let v = goog.math.clamp(parseFloat(this.getText()), -100, 100);
|
||||||
|
if (isNaN(v)) {
|
||||||
|
v = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const x = goog.math.clamp(parseFloat(this.getText()), -100, 100) / 100;
|
||||||
|
const theta = x * Math.PI / 2;
|
||||||
|
const cx = FieldTurnRatio.HALF;
|
||||||
|
const cy = FieldTurnRatio.HALF - 14;
|
||||||
|
const gamma = Math.PI - 2 * theta;
|
||||||
|
const r = FieldTurnRatio.RADIUS;
|
||||||
|
const alpha = 0.2 + Math.abs(x) * 0.5;
|
||||||
|
const x1 = 0;
|
||||||
|
const y1 = r * alpha;
|
||||||
|
const y2 = r * Math.sin(Math.PI / 2 - theta);
|
||||||
|
const x2 = r * Math.cos(Math.PI / 2 - theta);
|
||||||
|
const y3 = y2 - r * alpha * Math.cos(2 * theta);
|
||||||
|
const x3 = x2 - r * alpha * Math.sin(2 * theta);
|
||||||
|
|
||||||
|
|
||||||
|
const d = `M ${cx} ${cy} C ${cx} ${cy - y1} ${cx + x3} ${cy - y3} ${cx + x2} ${cy - y2}`;
|
||||||
|
this.path_.setAttribute('d', d);
|
||||||
|
|
||||||
|
this.reporter_.textContent = `${v}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
setReadout_(readout: Element, value: string) {
|
||||||
|
this.updateGraph_();
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,14 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"declaration": true,
|
"module": "commonjs",
|
||||||
"out": "../built/editor.js",
|
"outDir": "../built/editor",
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"newLine": "LF",
|
"newLine": "LF",
|
||||||
"sourceMap": false
|
"sourceMap": false,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"declaration": true
|
||||||
}
|
}
|
||||||
}
|
}
|
After Width: | Height: | Size: 375 KiB |
BIN
legoresources/MC22122017/01b - MakeCode - basicdesign@2x.png
Normal file
After Width: | Height: | Size: 384 KiB |
After Width: | Height: | Size: 383 KiB |
After Width: | Height: | Size: 418 KiB |
BIN
legoresources/MC22122017/02a - MakeCode - portselector@2x.png
Normal file
After Width: | Height: | Size: 386 KiB |
BIN
legoresources/MC22122017/03a - MakeCode - all elements@2x.png
Normal file
After Width: | Height: | Size: 442 KiB |
BIN
legoresources/MC22122017/03b - MakeCode - motorsync@2x.png
Normal file
After Width: | Height: | Size: 404 KiB |
BIN
legoresources/MC22122017/04a - MakeCode - medmotor@2x.png
Normal file
After Width: | Height: | Size: 430 KiB |
BIN
legoresources/MC22122017/04b - MakeCode - medmotor@2x.png
Normal file
After Width: | Height: | Size: 428 KiB |
BIN
legoresources/MC22122017/05a - MakeCode - large motor@2x.png
Normal file
After Width: | Height: | Size: 426 KiB |
BIN
legoresources/MC22122017/05b - MakeCode - large motor@2x.png
Normal file
After Width: | Height: | Size: 425 KiB |
BIN
legoresources/MC22122017/06 - MakeCode - color - 1@2x.png
Normal file
After Width: | Height: | Size: 428 KiB |
BIN
legoresources/MC22122017/06 - MakeCode - color - 2@2x.png
Normal file
After Width: | Height: | Size: 422 KiB |
BIN
legoresources/MC22122017/06 - MakeCode - color - 3@2x.png
Normal file
After Width: | Height: | Size: 429 KiB |
BIN
legoresources/MC22122017/07a - MakeCode - Gyro@2x.png
Normal file
After Width: | Height: | Size: 423 KiB |
BIN
legoresources/MC22122017/07b - MakeCode - Gyro@2x.png
Normal file
After Width: | Height: | Size: 413 KiB |
BIN
legoresources/MC22122017/08 - MakeCode - UltraSound@2x.png
Normal file
After Width: | Height: | Size: 408 KiB |
BIN
legoresources/MC22122017/09a - MakeCode - display image@2x.png
Normal file
After Width: | Height: | Size: 478 KiB |
BIN
legoresources/MC22122017/10a - MakeCode – mouseover@2x.png
Normal file
After Width: | Height: | Size: 407 KiB |
BIN
legoresources/MC22122017/10b - MakeCode – mouseover@2x.png
Normal file
After Width: | Height: | Size: 408 KiB |
BIN
legoresources/MC22122017/10c - MakeCode - popup w-overlay@2x.png
Normal file
After Width: | Height: | Size: 351 KiB |
BIN
legoresources/MC22122017/11a - MakeCode - delete block@2x.png
Normal file
After Width: | Height: | Size: 346 KiB |
BIN
legoresources/MC22122017/11b - MakeCode - delete block@2x.png
Normal file
After Width: | Height: | Size: 366 KiB |
BIN
legoresources/MC22122017/12a - MakeCode - fullscreen@2x.png
Normal file
After Width: | Height: | Size: 382 KiB |
BIN
legoresources/MC22122017/12b - MakeCode - fullscreen@2x.png
Normal file
After Width: | Height: | Size: 424 KiB |
BIN
legoresources/MC22122017/Loader - 1@2x.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
legoresources/MC22122017/Loader – 2@2x.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
legoresources/MC22122017/XX-blocks@2x.png
Normal file
After Width: | Height: | Size: 270 KiB |
5914
legoresources/MakeCode_overview.ai
Normal file
BIN
legoresources/SVGassets/.DS_Store
vendored
14
libs/behaviors/_locales/behaviors-jsdoc-strings.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"behaviors": "Behavior drive blocks",
|
||||||
|
"behaviors.Behavior": "A behavior",
|
||||||
|
"behaviors.BehaviorManager": "A manager for behaviors",
|
||||||
|
"behaviors.BehaviorManager.add": "Adds a new behavior to the behavior manager",
|
||||||
|
"behaviors.BehaviorManager.add|param|behavior": "the behavior to add",
|
||||||
|
"behaviors.BehaviorManager.start": "Starts the behavior control loop",
|
||||||
|
"behaviors.BehaviorManager.stop": "Stops the execution loop",
|
||||||
|
"behaviors.addBehavior": "Adds the behavior and starts it",
|
||||||
|
"behaviors.addBehavior|param|behavior": "a behavior",
|
||||||
|
"behaviors.avoidCrash": "A behavior that stops all motors if the sensor distance get too short",
|
||||||
|
"behaviors.driveForward": "A behavior that turns on the motors to the specified speed",
|
||||||
|
"behaviors.driveForward|param|motors": "@param speed the desired speed, eg: 50"
|
||||||
|
}
|
7
libs/behaviors/_locales/behaviors-strings.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"behaviors.addBehavior|block": "add behavior %behavior",
|
||||||
|
"behaviors.avoidCrash|block": "avoid crash using %ultrasonic",
|
||||||
|
"behaviors.driveForward|block": "drive %motors|forward at %speed=motorSpeedPicker|%",
|
||||||
|
"behaviors|block": "behaviors",
|
||||||
|
"{id:category}Behaviors": "Behaviors"
|
||||||
|
}
|
6
libs/behaviors/pxt.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/behaviors",
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../ev3"
|
||||||
|
}
|
||||||
|
}
|
56
libs/behaviors/targetoverrides.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
namespace behaviors {
|
||||||
|
class AvoidCrashBehavior extends behaviors.Behavior {
|
||||||
|
private ultrasonic: sensors.UltraSonicSensor;
|
||||||
|
constructor(ultrasonic: sensors.UltraSonicSensor) {
|
||||||
|
super();
|
||||||
|
this.ultrasonic = ultrasonic;
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldRun(): boolean {
|
||||||
|
return this.ultrasonic.distance() < 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
run(): void {
|
||||||
|
motors.stopAllMotors();
|
||||||
|
this.active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A behavior that stops all motors if the sensor distance get too short
|
||||||
|
*/
|
||||||
|
//% blockId=behaviorsAvoidCrash block="avoid crash using %ultrasonic"
|
||||||
|
export function avoidCrash(ultrasonic: sensors.UltraSonicSensor) : behaviors.Behavior {
|
||||||
|
return new AvoidCrashBehavior(ultrasonic);
|
||||||
|
}
|
||||||
|
|
||||||
|
class DriveForwardBehavior extends behaviors.Behavior {
|
||||||
|
private motors: motors.MotorBase;
|
||||||
|
private speed: number;
|
||||||
|
constructor(motors: motors.MotorBase, speed: number) {
|
||||||
|
super();
|
||||||
|
this.motors = motors;
|
||||||
|
this.speed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldRun(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
run(): void {
|
||||||
|
this.motors.setSpeed(this.speed);
|
||||||
|
pauseUntil(() => !this.active);
|
||||||
|
this.motors.setSpeed(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A behavior that turns on the motors to the specified speed
|
||||||
|
* @param motors
|
||||||
|
* @param speed the desired speed, eg: 50
|
||||||
|
*/
|
||||||
|
//% blockId=behaviorsDriveForward block="drive %motors|forward at %speed=motorSpeedPicker|%"
|
||||||
|
export function driveForward(motors: motors.MotorBase, speed: number): behaviors.Behavior {
|
||||||
|
return new DriveForwardBehavior(motors, speed);
|
||||||
|
}
|
||||||
|
}
|
3
libs/chassis/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Chassis
|
||||||
|
|
||||||
|
A library to control a chassis.
|
11
libs/chassis/_locales/chassis-jsdoc-strings.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"chassis.Chassis": "A differential drive robot",
|
||||||
|
"chassis.Chassis.drive": "Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s)\nusing a unicycle model.",
|
||||||
|
"chassis.Chassis.drive|param|rotationSpeed": "rotation of the robot around the center point, eg: 30",
|
||||||
|
"chassis.Chassis.drive|param|speed": "speed of the center point between motors, eg: 10",
|
||||||
|
"chassis.Chassis.drive|param|value": "the amount of movement, eg: 2",
|
||||||
|
"chassis.Chassis.setMotors": "Sets the motors used by the chassis, default is B+C",
|
||||||
|
"chassis.Chassis.setProperty": "Sets a property of the robot",
|
||||||
|
"chassis.Chassis.setProperty|param|property": "the property to set",
|
||||||
|
"chassis.Chassis.setProperty|param|value": "the value to set"
|
||||||
|
}
|
9
libs/chassis/_locales/chassis-strings.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ChassisProperty.BaseLength|block": "base length (cm)",
|
||||||
|
"ChassisProperty.WheelRadius|block": "wheel radius (cm)",
|
||||||
|
"chassis.Chassis.drive|block": "drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s",
|
||||||
|
"chassis.Chassis.setMotors|block": "set %chassis|motors to %motors",
|
||||||
|
"chassis.Chassis.setProperty|block": "set %chassis|%property|to %value",
|
||||||
|
"chassis|block": "chassis",
|
||||||
|
"{id:category}Chassis": "Chassis"
|
||||||
|
}
|
88
libs/chassis/chassis.ts
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
enum ChassisProperty {
|
||||||
|
//% block="wheel radius (cm)"
|
||||||
|
WheelRadius,
|
||||||
|
//% block="base length (cm)"
|
||||||
|
BaseLength
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace chassis {
|
||||||
|
/**
|
||||||
|
* A differential drive robot
|
||||||
|
*/
|
||||||
|
//% fixedInstances
|
||||||
|
export class Chassis {
|
||||||
|
// the motor pair
|
||||||
|
public motors: motors.SynchedMotorPair;
|
||||||
|
// the radius of the wheel (cm)
|
||||||
|
public wheelRadius: number;
|
||||||
|
// the distance between the wheels (cm)
|
||||||
|
public baseLength: number;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.motors = motors.largeBC;
|
||||||
|
this.wheelRadius = 3;
|
||||||
|
this.baseLength = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s)
|
||||||
|
* using a unicycle model.
|
||||||
|
* @param speed speed of the center point between motors, eg: 10
|
||||||
|
* @param rotationSpeed rotation of the robot around the center point, eg: 30
|
||||||
|
* @param value the amount of movement, eg: 2
|
||||||
|
* @param unit
|
||||||
|
*/
|
||||||
|
//% blockId=motorDrive block="drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s"
|
||||||
|
//% inlineInputMode=inline
|
||||||
|
//% weight=95 blockGap=8
|
||||||
|
drive(speed: number, rotationSpeed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
|
||||||
|
// speed is expressed in %
|
||||||
|
const R = this.wheelRadius; // cm
|
||||||
|
const L = this.baseLength; // cm
|
||||||
|
const PI = 3.14;
|
||||||
|
const maxw = 170 / 60 * 2 * PI; // rad / s
|
||||||
|
const maxv = maxw * R; // cm / s
|
||||||
|
// speed is cm / s
|
||||||
|
const v = speed; // cm / s
|
||||||
|
const w = rotationSpeed / 360 * 2 * PI; // rad / s
|
||||||
|
|
||||||
|
const vr = (2 * v + w * L) / (2 * R); // rad / s
|
||||||
|
const vl = (2 * v - w * L) / (2 * R); // rad / s
|
||||||
|
|
||||||
|
const sr = vr / maxw * 100; // %
|
||||||
|
const sl = vl / maxw * 100; // %
|
||||||
|
|
||||||
|
this.motors.tank(sr, sl, value, unit)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a property of the robot
|
||||||
|
* @param property the property to set
|
||||||
|
* @param value the value to set
|
||||||
|
*/
|
||||||
|
//% blockId=chassisSetProperty block="set %chassis|%property|to %value"
|
||||||
|
//% blockGap=8
|
||||||
|
//% weight=10
|
||||||
|
setProperty(property: ChassisProperty, value: number) {
|
||||||
|
switch (property) {
|
||||||
|
case ChassisProperty.WheelRadius:
|
||||||
|
this.wheelRadius = Math.max(0.1, value); break;
|
||||||
|
case ChassisProperty.BaseLength:
|
||||||
|
this.baseLength = Math.max(0.1, value); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the motors used by the chassis, default is B+C
|
||||||
|
* @param motors
|
||||||
|
*/
|
||||||
|
//% blockId=chassisSetMotors block="set %chassis|motors to %motors"
|
||||||
|
//% weight=10
|
||||||
|
setMotors(motors: motors.SynchedMotorPair) {
|
||||||
|
this.motors = motors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//% fixedInstance whenUsed
|
||||||
|
export const chassis = new Chassis();
|
||||||
|
}
|
15
libs/chassis/pxt.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "chassis",
|
||||||
|
"description": "Chassis robot support",
|
||||||
|
"files": [
|
||||||
|
"README.md",
|
||||||
|
"chassis.ts"
|
||||||
|
],
|
||||||
|
"testFiles": [
|
||||||
|
"test.ts"
|
||||||
|
],
|
||||||
|
"public": true,
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
}
|
||||||
|
}
|
1
libs/chassis/test.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
@ -8,5 +8,11 @@
|
|||||||
"sensors.ColorSensor.onColorDetected|param|handler": "the code to run when detected",
|
"sensors.ColorSensor.onColorDetected|param|handler": "the code to run when detected",
|
||||||
"sensors.ColorSensor.onLightChanged": "Registers code to run when the ambient light changes.",
|
"sensors.ColorSensor.onLightChanged": "Registers code to run when the ambient light changes.",
|
||||||
"sensors.ColorSensor.onLightChanged|param|condition": "the light condition",
|
"sensors.ColorSensor.onLightChanged|param|condition": "the light condition",
|
||||||
"sensors.ColorSensor.onLightChanged|param|handler": "the code to run when detected"
|
"sensors.ColorSensor.onLightChanged|param|handler": "the code to run when detected",
|
||||||
|
"sensors.ColorSensor.pauseForColor": "Waits for the given color to be detected",
|
||||||
|
"sensors.ColorSensor.pauseForColor|param|color": "the color to detect",
|
||||||
|
"sensors.ColorSensor.pauseForLight": "Waits for the given color to be detected",
|
||||||
|
"sensors.ColorSensor.setThreshold": "Sets a threshold value",
|
||||||
|
"sensors.ColorSensor.setThreshold|param|condition": "the dark or bright light condition",
|
||||||
|
"sensors.ColorSensor.setThreshold|param|value": "the value threshold"
|
||||||
}
|
}
|
@ -13,15 +13,19 @@
|
|||||||
"LightCondition.Dark|block": "dark",
|
"LightCondition.Dark|block": "dark",
|
||||||
"LightIntensityMode.Ambient|block": "ambient light",
|
"LightIntensityMode.Ambient|block": "ambient light",
|
||||||
"LightIntensityMode.Reflected|block": "reflected light",
|
"LightIntensityMode.Reflected|block": "reflected light",
|
||||||
"sensors.ColorSensor.color|block": "`icons.colorSensor` %sensor| color",
|
"sensors.ColorSensor.color|block": "%sensor| color",
|
||||||
"sensors.ColorSensor.light|block": "`icons.colorSensor` %sensor|%mode",
|
"sensors.ColorSensor.light|block": "%sensor|%mode",
|
||||||
"sensors.ColorSensor.onColorDetected|block": "on `icons.colorSensor` %sensor|detected color %color",
|
"sensors.ColorSensor.onColorDetected|block": "on %sensor|detected color %color",
|
||||||
"sensors.ColorSensor.onLightChanged|block": "on `icons.colorSensor` %sensor|%mode|%condition",
|
"sensors.ColorSensor.onLightChanged|block": "on %sensor|%mode|%condition",
|
||||||
"sensors.color1|block": "1",
|
"sensors.ColorSensor.pauseForColor|block": "pause %sensor|for color %color",
|
||||||
"sensors.color2|block": "2",
|
"sensors.ColorSensor.pauseForLight|block": "pause %sensor|for %mode|%condition",
|
||||||
"sensors.color3|block": "3",
|
"sensors.ColorSensor.setThreshold|block": "set %sensor|%condition|to %value",
|
||||||
"sensors.color4|block": "4",
|
"sensors.color1|block": "color 1",
|
||||||
|
"sensors.color2|block": "color 2",
|
||||||
|
"sensors.color3|block": "color 3",
|
||||||
|
"sensors.color4|block": "color 4",
|
||||||
"sensors|block": "sensors",
|
"sensors|block": "sensors",
|
||||||
"{id:category}Sensors": "Sensors",
|
"{id:category}Sensors": "Sensors",
|
||||||
"{id:group}Color Sensor": "Color Sensor"
|
"{id:group}Color Sensor": "Color Sensor",
|
||||||
|
"{id:group}Threshold": "Threshold"
|
||||||
}
|
}
|
@ -56,6 +56,7 @@ namespace sensors {
|
|||||||
|
|
||||||
constructor(port: number) {
|
constructor(port: number) {
|
||||||
super(port)
|
super(port)
|
||||||
|
this._setMode(ColorSensorMode.None);
|
||||||
this.thresholdDetector = new sensors.internal.ThresholdDetector(this.id());
|
this.thresholdDetector = new sensors.internal.ThresholdDetector(this.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,18 +69,27 @@ namespace sensors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setMode(m: ColorSensorMode) {
|
setMode(m: ColorSensorMode) {
|
||||||
|
if (m == ColorSensorMode.AmbientLightIntensity) {
|
||||||
|
this.thresholdDetector.setLowThreshold(5);
|
||||||
|
this.thresholdDetector.setHighThreshold(20);
|
||||||
|
} else {
|
||||||
|
this.thresholdDetector.setLowThreshold(20);
|
||||||
|
this.thresholdDetector.setHighThreshold(80);
|
||||||
|
}
|
||||||
this._setMode(m)
|
this._setMode(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current color mode
|
* Gets the current color mode
|
||||||
*/
|
*/
|
||||||
colorMode() {
|
colorMode() {
|
||||||
return <ColorSensorMode>this.mode;
|
return <ColorSensorMode>this.mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
_query() {
|
_query() {
|
||||||
if (this.mode == ColorSensorMode.Color)
|
if (this.mode == ColorSensorMode.Color
|
||||||
|
|| this.mode == ColorSensorMode.AmbientLightIntensity
|
||||||
|
|| this.mode == ColorSensorMode.ReflectedLightIntensity)
|
||||||
return this.getNumber(NumberFormat.UInt8LE, 0)
|
return this.getNumber(NumberFormat.UInt8LE, 0)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -97,34 +107,52 @@ namespace sensors {
|
|||||||
* @param handler the code to run when detected
|
* @param handler the code to run when detected
|
||||||
*/
|
*/
|
||||||
//% help=sensors/color-sensor/on-color-detected
|
//% help=sensors/color-sensor/on-color-detected
|
||||||
//% block="on `icons.colorSensor` %sensor|detected color %color"
|
//% block="on %sensor|detected color %color"
|
||||||
//% blockId=colorOnColorDetected
|
//% blockId=colorOnColorDetected
|
||||||
//% parts="colorsensor"
|
//% parts="colorsensor"
|
||||||
//% sensor.fieldEditor="imagedropdown"
|
|
||||||
//% sensor.fieldOptions.columns=4
|
|
||||||
//% blockNamespace=sensors
|
//% blockNamespace=sensors
|
||||||
|
//% sensor.fieldEditor="ports"
|
||||||
//% weight=100 blockGap=8
|
//% weight=100 blockGap=8
|
||||||
//% group="Color Sensor"
|
//% group="Color Sensor"
|
||||||
onColorDetected(color: ColorSensorColor, handler: () => void) {
|
onColorDetected(color: ColorSensorColor, handler: () => void) {
|
||||||
|
this.setMode(ColorSensorMode.Color)
|
||||||
const v = this._colorEventValue(<number>color);
|
const v = this._colorEventValue(<number>color);
|
||||||
control.onEvent(this._id, v, handler);
|
control.onEvent(this._id, v, handler);
|
||||||
this.setMode(ColorSensorMode.Color)
|
|
||||||
if (this.color() == color)
|
if (this.color() == color)
|
||||||
control.raiseEvent(this._id, v);
|
control.raiseEvent(this._id, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits for the given color to be detected
|
||||||
|
* @param color the color to detect
|
||||||
|
*/
|
||||||
|
//% help=sensors/color-sensor/pause-for-color
|
||||||
|
//% block="pause %sensor|for color %color"
|
||||||
|
//% blockId=colorPauseForColorDetected
|
||||||
|
//% parts="colorsensor"
|
||||||
|
//% blockNamespace=sensors
|
||||||
|
//% sensor.fieldEditor="ports"
|
||||||
|
//% weight=99 blockGap=8
|
||||||
|
//% group="Color Sensor"
|
||||||
|
pauseForColor(color: ColorSensorColor) {
|
||||||
|
this.setMode(ColorSensorMode.Color);
|
||||||
|
if (this.color() != color) {
|
||||||
|
const v = this._colorEventValue(<number>color);
|
||||||
|
control.waitForEvent(this._id, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current color from the color sensor.
|
* Get the current color from the color sensor.
|
||||||
* @param sensor the color sensor to query the request
|
* @param sensor the color sensor to query the request
|
||||||
*/
|
*/
|
||||||
//% help=sensors/color-sensor/color
|
//% help=sensors/color-sensor/color
|
||||||
//% block="`icons.colorSensor` %sensor| color"
|
//% block="%sensor| color"
|
||||||
//% blockId=colorGetColor
|
//% blockId=colorGetColor
|
||||||
//% parts="colorsensor"
|
//% parts="colorsensor"
|
||||||
//% sensor.fieldEditor="imagedropdown"
|
|
||||||
//% sensor.fieldOptions.columns=4
|
|
||||||
//% blockNamespace=sensors
|
//% blockNamespace=sensors
|
||||||
//% weight=99
|
//% sensor.fieldEditor="ports"
|
||||||
|
//% weight=98
|
||||||
//% group="Color Sensor"
|
//% group="Color Sensor"
|
||||||
color(): ColorSensorColor {
|
color(): ColorSensorColor {
|
||||||
this.setMode(ColorSensorMode.Color)
|
this.setMode(ColorSensorMode.Color)
|
||||||
@ -137,17 +165,34 @@ namespace sensors {
|
|||||||
* @param handler the code to run when detected
|
* @param handler the code to run when detected
|
||||||
*/
|
*/
|
||||||
//% help=sensors/color-sensor/on-light-changed
|
//% help=sensors/color-sensor/on-light-changed
|
||||||
//% block="on `icons.colorSensor` %sensor|%mode|%condition"
|
//% block="on %sensor|%mode|%condition"
|
||||||
//% blockId=colorOnLightChanged
|
//% blockId=colorOnLightChanged
|
||||||
//% parts="colorsensor"
|
//% parts="colorsensor"
|
||||||
//% sensor.fieldEditor="imagedropdown"
|
|
||||||
//% sensor.fieldOptions.columns=4
|
|
||||||
//% blockNamespace=sensors
|
//% blockNamespace=sensors
|
||||||
|
//% sensor.fieldEditor="ports"
|
||||||
//% weight=89 blockGap=8
|
//% weight=89 blockGap=8
|
||||||
//% group="Color Sensor"
|
//% group="Color Sensor"
|
||||||
onLightChanged(mode: LightIntensityMode, condition: LightCondition, handler: () => void) {
|
onLightChanged(mode: LightIntensityMode, condition: LightCondition, handler: () => void) {
|
||||||
control.onEvent(this._id, <number>condition, handler);
|
|
||||||
this.setMode(<ColorSensorMode><number>mode)
|
this.setMode(<ColorSensorMode><number>mode)
|
||||||
|
control.onEvent(this._id, <number>condition, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits for the given color to be detected
|
||||||
|
* @param color the color to detect
|
||||||
|
*/
|
||||||
|
//% help=sensors/color-sensor/pause-for-light
|
||||||
|
//% block="pause %sensor|for %mode|%condition"
|
||||||
|
//% blockId=colorPauseForLight
|
||||||
|
//% parts="colorsensor"
|
||||||
|
//% blockNamespace=sensors
|
||||||
|
//% sensor.fieldEditor="ports"
|
||||||
|
//% weight=88 blockGap=8
|
||||||
|
//% group="Color Sensor"
|
||||||
|
pauseForLight(mode: LightIntensityMode, condition: LightCondition) {
|
||||||
|
this.setMode(<ColorSensorMode><number>mode)
|
||||||
|
if (this.thresholdDetector.state != <number>condition)
|
||||||
|
control.waitForEvent(this._id, <number>condition)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,13 +200,12 @@ namespace sensors {
|
|||||||
* @param sensor the color sensor port
|
* @param sensor the color sensor port
|
||||||
*/
|
*/
|
||||||
//% help=sensors/color-sensor/light
|
//% help=sensors/color-sensor/light
|
||||||
//% block="`icons.colorSensor` %sensor|%mode"
|
//% block="%sensor|%mode"
|
||||||
//% blockId=colorLight
|
//% blockId=colorLight
|
||||||
//% parts="colorsensor"
|
//% parts="colorsensor"
|
||||||
//% sensor.fieldEditor="imagedropdown"
|
|
||||||
//% sensor.fieldOptions.columns=4
|
|
||||||
//% blockNamespace=sensors
|
//% blockNamespace=sensors
|
||||||
//% weight=88
|
//% sensor.fieldEditor="ports"
|
||||||
|
//% weight=87
|
||||||
//% group="Color Sensor"
|
//% group="Color Sensor"
|
||||||
light(mode: LightIntensityMode) {
|
light(mode: LightIntensityMode) {
|
||||||
this.setMode(<ColorSensorMode><number>mode)
|
this.setMode(<ColorSensorMode><number>mode)
|
||||||
@ -177,17 +221,32 @@ namespace sensors {
|
|||||||
reflectedLight() {
|
reflectedLight() {
|
||||||
return this.light(LightIntensityMode.Reflected);
|
return this.light(LightIntensityMode.Reflected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a threshold value
|
||||||
|
* @param condition the dark or bright light condition
|
||||||
|
* @param value the value threshold
|
||||||
|
*/
|
||||||
|
//% blockId=colorSetThreshold block="set %sensor|%condition|to %value"
|
||||||
|
//% group="Threshold" blockGap=8 weight=90
|
||||||
|
//% value.min=0 value.max=100
|
||||||
|
setThreshold(condition: LightCondition, value: number) {
|
||||||
|
if (condition == LightCondition.Dark)
|
||||||
|
this.thresholdDetector.setLowThreshold(value)
|
||||||
|
else
|
||||||
|
this.thresholdDetector.setHighThreshold(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//% whenUsed block="1" weight=95 fixedInstance jres=icons.port1
|
//% whenUsed block="color 3" weight=90 fixedInstance jres=icons.port3
|
||||||
export const color1: ColorSensor = new ColorSensor(1)
|
|
||||||
|
|
||||||
//% whenUsed block="3" weight=90 fixedInstance jres=icons.port3
|
|
||||||
export const color3: ColorSensor = new ColorSensor(3)
|
export const color3: ColorSensor = new ColorSensor(3)
|
||||||
|
|
||||||
//% whenUsed block="2" weight=90 fixedInstance jres=icons.port2
|
//% whenUsed block="color 1" weight=95 fixedInstance jres=icons.port1
|
||||||
|
export const color1: ColorSensor = new ColorSensor(1)
|
||||||
|
|
||||||
|
//% whenUsed block="color 2" weight=90 fixedInstance jres=icons.port2
|
||||||
export const color2: ColorSensor = new ColorSensor(2)
|
export const color2: ColorSensor = new ColorSensor(2)
|
||||||
|
|
||||||
//% whenUsed block="4" weight=90 fixedInstance jres=icons.port4
|
//% whenUsed block="color 4" weight=90 fixedInstance jres=icons.port4
|
||||||
export const color4: ColorSensor = new ColorSensor(4)
|
export const color4: ColorSensor = new ColorSensor(4)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"BrickLight": "Patterns for lights under the buttons.",
|
||||||
"ButtonEvent": "User interaction on buttons",
|
"ButtonEvent": "User interaction on buttons",
|
||||||
"Draw": "Drawing modes",
|
"Draw": "Drawing modes",
|
||||||
"Image.buffer": "Returns the underlaying Buffer object.",
|
"Image.buffer": "Returns the underlaying Buffer object.",
|
||||||
@ -6,42 +7,50 @@
|
|||||||
"Image.draw": "Draw an image on the screen.",
|
"Image.draw": "Draw an image on the screen.",
|
||||||
"Image.height": "Returns the height of an image.",
|
"Image.height": "Returns the height of an image.",
|
||||||
"Image.width": "Returns the width of an image.",
|
"Image.width": "Returns the width of an image.",
|
||||||
"LightsPattern": "Patterns for lights under the buttons.",
|
|
||||||
"MMap.getNumber": "Read a number in specified format from the buffer.",
|
"MMap.getNumber": "Read a number in specified format from the buffer.",
|
||||||
"MMap.ioctl": "Perform ioctl(2) on the underlaying file",
|
"MMap.ioctl": "Perform ioctl(2) on the underlaying file",
|
||||||
"MMap.length": "Returns the length of a Buffer object.",
|
"MMap.length": "Returns the length of a Buffer object.",
|
||||||
|
"MMap.lseek": "Set pointer on the underlaying file.",
|
||||||
"MMap.read": "Perform read(2) on the underlaying file",
|
"MMap.read": "Perform read(2) on the underlaying file",
|
||||||
"MMap.setNumber": "Write a number in specified format in the buffer.",
|
"MMap.setNumber": "Write a number in specified format in the buffer.",
|
||||||
"MMap.slice": "Read a range of bytes into a buffer.",
|
"MMap.slice": "Read a range of bytes into a buffer.",
|
||||||
"MMap.write": "Perform write(2) on the underlaying file",
|
"MMap.write": "Perform write(2) on the underlaying file",
|
||||||
|
"SeekWhence": "Mode for lseek()",
|
||||||
"brick.Button": "Generic button class, for device buttons and sensors.",
|
"brick.Button": "Generic button class, for device buttons and sensors.",
|
||||||
"brick.Button.isPressed": "Check if button is currently pressed or not.",
|
"brick.Button.isPressed": "Check if button is currently pressed or not.",
|
||||||
"brick.Button.onEvent": "Do something when a button or sensor is clicked, up or down.",
|
"brick.Button.onEvent": "Do something when a button or sensor is clicked, up or down.",
|
||||||
"brick.Button.onEvent|param|body": "code to run when the event is raised",
|
"brick.Button.onEvent|param|body": "code to run when the event is raised",
|
||||||
"brick.Button.waitUntil": "Waits until the event is raised",
|
"brick.Button.pauseUntil": "Waits until the event is raised",
|
||||||
"brick.Button.waitUntil|param|ev": "the event to wait for",
|
"brick.Button.pauseUntil|param|ev": "the event to wait for",
|
||||||
"brick.Button.wasPressed": "See if the button was pressed again since the last time you checked.",
|
"brick.Button.wasPressed": "See if the button was pressed again since the last time you checked.",
|
||||||
"brick._imagePicker": "An image",
|
"brick.batteryLevel": "Returns the current battery level",
|
||||||
"brick._imagePicker|param|image": "the image",
|
|
||||||
"brick.buttonDown": "Down button on the EV3 Brick.",
|
"brick.buttonDown": "Down button on the EV3 Brick.",
|
||||||
"brick.buttonEnter": "Enter button on the EV3 Brick.",
|
"brick.buttonEnter": "Enter button on the EV3 Brick.",
|
||||||
"brick.buttonLeft": "Left button on the EV3 Brick.",
|
"brick.buttonLeft": "Left button on the EV3 Brick.",
|
||||||
"brick.buttonRight": "Right button on the EV3 Brick.",
|
"brick.buttonRight": "Right button on the EV3 Brick.",
|
||||||
"brick.buttonUp": "Up button on the EV3 Brick.",
|
"brick.buttonUp": "Up button on the EV3 Brick.",
|
||||||
"brick.lightPattern": "Pattern block.",
|
"brick.clearScreen": "Clears the screen",
|
||||||
"brick.lightPattern|param|pattern": "the lights pattern to use. eg: LightsPattern.Green",
|
"brick.printPorts": "Prints the port states on the screen",
|
||||||
"brick.print": "Show text on the screen.",
|
"brick.setLight": "Set lights.",
|
||||||
"brick.print|param|text": "the text to print on the screen, eg: \"Hello world\"",
|
"brick.setLight|param|pattern": "the lights pattern to use. eg: BrickLight.Orange",
|
||||||
"brick.print|param|x": "the starting position's x coordinate, eg: 0",
|
|
||||||
"brick.print|param|y": "the starting position's x coordinate, eg: 0",
|
|
||||||
"brick.setPixel": "Sets a pixel on or off",
|
|
||||||
"brick.setPixel|param|on": "a value indicating if the pixel should be on or off",
|
|
||||||
"brick.setPixel|param|x": "the starting position's x coordinate, eg: 0",
|
|
||||||
"brick.setPixel|param|y": "the starting position's x coordinate, eg: 0",
|
|
||||||
"brick.setStatusLight": "Set lights.",
|
|
||||||
"brick.setStatusLight|param|pattern": "the lights pattern to use.",
|
|
||||||
"brick.showImage": "Shows an image on screen",
|
"brick.showImage": "Shows an image on screen",
|
||||||
"brick.showImage|param|image": "image to draw",
|
"brick.showImage|param|image": "image to draw",
|
||||||
|
"brick.showNumber": "Shows a number on the screen",
|
||||||
|
"brick.showNumber|param|line": "the line number to print the text at, eg: 1",
|
||||||
|
"brick.showNumber|param|value": "the numeric value",
|
||||||
|
"brick.showString": "Show text on the screen at a specific line.",
|
||||||
|
"brick.showString|param|line": "the line number to print the text at, eg: 1",
|
||||||
|
"brick.showString|param|text": "the text to print on the screen, eg: \"Hello world\"",
|
||||||
|
"brick.showValue": "Shows a name, value pair on the screen",
|
||||||
|
"brick.showValue|param|line": "the line number to print the text at, eg: 1",
|
||||||
|
"brick.showValue|param|value": "the numeric value",
|
||||||
|
"console": "Reading and writing data to the console output.\n\nReading and writing data to the console output.",
|
||||||
|
"console.addListener": "Adds a listener for the log messages",
|
||||||
|
"console.log": "Write a line of text to the console output.",
|
||||||
|
"console.logValue": "Write a name:value pair as a line of text to the console output.",
|
||||||
|
"console.logValue|param|name": "name of the value stream, eg: \"x\"",
|
||||||
|
"console.logValue|param|value": "to write",
|
||||||
|
"console.sendToScreen": "Sends the log messages to the brick screen and uses the brick up and down buttons to scroll.",
|
||||||
"control": "Program controls and events.",
|
"control": "Program controls and events.",
|
||||||
"control.allocateNotifyEvent": "Allocates the next user notification event",
|
"control.allocateNotifyEvent": "Allocates the next user notification event",
|
||||||
"control.deviceFirmwareVersion": "Determine the version of system software currently running.",
|
"control.deviceFirmwareVersion": "Determine the version of system software currently running.",
|
||||||
@ -50,21 +59,46 @@
|
|||||||
"control.raiseEvent": "Announce that an event happened to registered handlers.",
|
"control.raiseEvent": "Announce that an event happened to registered handlers.",
|
||||||
"control.raiseEvent|param|src": "ID of the Component that generated the event",
|
"control.raiseEvent|param|src": "ID of the Component that generated the event",
|
||||||
"control.raiseEvent|param|value": "Component specific code indicating the cause of the event.",
|
"control.raiseEvent|param|value": "Component specific code indicating the cause of the event.",
|
||||||
"motors.Motor.clearCount": "Clears the motor count",
|
"motors.Motor.angle": "Gets motor angle.",
|
||||||
"motors.Motor.count": "Gets motor step count.",
|
"motors.Motor.clearCounts": "Clears the motor count",
|
||||||
"motors.Motor.move": "Moves the motor by a number of degrees",
|
"motors.Motor.setRegulated": "Indicates if the motor speed should be regulated. Default is true.",
|
||||||
"motors.Motor.move|param|angle": "the degrees to rotate, eg: 360",
|
"motors.Motor.setRegulated|param|value": "true for regulated motor",
|
||||||
"motors.Motor.move|param|power": "the power from ``100`` full forward to ``-100`` full backward, eg: 50",
|
|
||||||
"motors.Motor.reset": "Resets the motor.",
|
|
||||||
"motors.Motor.setBrake": "Sets the automatic brake on or off when the motor is off",
|
|
||||||
"motors.Motor.setBrake|param|brake": "a value indicating if the motor should break when off",
|
|
||||||
"motors.Motor.setReversed": "Reverses the motor polarity",
|
|
||||||
"motors.Motor.setSpeed": "Sets the motor speed level from ``-100`` to ``100``.",
|
|
||||||
"motors.Motor.setSpeed|param|speed": "the power from ``100`` full forward to ``-100`` full backward, eg: 50",
|
|
||||||
"motors.Motor.speed": "Gets motor actual speed.",
|
"motors.Motor.speed": "Gets motor actual speed.",
|
||||||
"motors.Motor.stop": "Stops the motor",
|
"motors.Motor.tacho": "Gets motor tachometer count.",
|
||||||
"motors.Motor.tachoCount": "Gets motor tacho count.",
|
"motors.Motor.toString": "Returns the status of the motor",
|
||||||
|
"motors.MotorBase.isReady": "Returns a value indicating if the motor is still running a previous command.",
|
||||||
|
"motors.MotorBase.pauseUntilReady": "Pauses the execution until the previous command finished.",
|
||||||
|
"motors.MotorBase.pauseUntilReady|param|timeOut": "optional maximum pausing time in milliseconds",
|
||||||
|
"motors.MotorBase.reset": "Resets the motor(s).",
|
||||||
|
"motors.MotorBase.setBrake": "Sets the automatic brake on or off when the motor is off",
|
||||||
|
"motors.MotorBase.setBrake|param|brake": "a value indicating if the motor should break when off",
|
||||||
|
"motors.MotorBase.setReversed": "Reverses the motor polarity",
|
||||||
|
"motors.MotorBase.setSpeed": "Sets the motor speed for limited time or distance.",
|
||||||
|
"motors.MotorBase.setSpeed|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
||||||
|
"motors.MotorBase.setSpeed|param|unit": "(optional) unit of the value",
|
||||||
|
"motors.MotorBase.setSpeed|param|value": "(optional) measured distance or rotation",
|
||||||
|
"motors.MotorBase.stop": "Stops the motor(s).",
|
||||||
|
"motors.SynchedMotorPair.steer": "Turns the motor and the follower motor by a number of rotations",
|
||||||
|
"motors.SynchedMotorPair.steer|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
||||||
|
"motors.SynchedMotorPair.steer|param|turnRatio": "the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0",
|
||||||
|
"motors.SynchedMotorPair.steer|param|unit": "(optional) unit of the value",
|
||||||
|
"motors.SynchedMotorPair.steer|param|value": "(optional) move duration or rotation",
|
||||||
|
"motors.SynchedMotorPair.tank": "The Move Tank block can make a robot drive forward, backward, turn, or stop. \nUse the Move Tank block for robot vehicles that have two Large Motors, \nwith one motor driving the left side of the vehicle and the other the right side. \nYou can make the two motors go at different speeds or in different directions \nto make your robot turn.",
|
||||||
|
"motors.SynchedMotorPair.tank|param|speedLeft": "the speed on the left motor, eg: 50",
|
||||||
|
"motors.SynchedMotorPair.tank|param|speedRight": "the speed on the right motor, eg: 50",
|
||||||
|
"motors.SynchedMotorPair.tank|param|unit": "(optional) unit of the value",
|
||||||
|
"motors.SynchedMotorPair.tank|param|value": "(optional) move duration or rotation",
|
||||||
|
"motors.SynchedMotorPair.toString": "Returns the name(s) of the motor",
|
||||||
|
"motors.mkCmd": "Allocates a message buffer",
|
||||||
|
"motors.mkCmd|param|addSize": "required additional bytes",
|
||||||
|
"motors.mkCmd|param|cmd": "command id",
|
||||||
|
"motors.mkCmd|param|out": "ports",
|
||||||
|
"motors.readPWM": "Sends and receives a message from the motors device",
|
||||||
|
"motors.readPWM|param|buf": "message buffer",
|
||||||
|
"motors.resetAllMotors": "Resets all motors",
|
||||||
"motors.stopAllMotors": "Stops all motors",
|
"motors.stopAllMotors": "Stops all motors",
|
||||||
|
"motors.writePWM": "Sends a command to the motors device",
|
||||||
|
"motors.writePWM|param|buf": "the command buffer",
|
||||||
"output.createBuffer": "Create a new zero-initialized buffer.",
|
"output.createBuffer": "Create a new zero-initialized buffer.",
|
||||||
"output.createBuffer|param|size": "number of bytes in the buffer",
|
"output.createBuffer|param|size": "number of bytes in the buffer",
|
||||||
"screen.clear": "Clear screen and reset font to normal.",
|
"screen.clear": "Clear screen and reset font to normal.",
|
||||||
|
@ -1,62 +1,87 @@
|
|||||||
{
|
{
|
||||||
|
"BrickLight.GreenFlash|block": "green flash",
|
||||||
|
"BrickLight.GreenPulse|block": "green pulse",
|
||||||
|
"BrickLight.Green|block": "green",
|
||||||
|
"BrickLight.Off|block": "off",
|
||||||
|
"BrickLight.OrangeFlash|block": "orange flash",
|
||||||
|
"BrickLight.OrangePulse|block": "orange pulse",
|
||||||
|
"BrickLight.Orange|block": "orange",
|
||||||
|
"BrickLight.RedFlash|block": "red flash",
|
||||||
|
"BrickLight.RedPulse|block": "red pulse",
|
||||||
|
"BrickLight.Red|block": "red",
|
||||||
"ButtonEvent.Click|block": "click",
|
"ButtonEvent.Click|block": "click",
|
||||||
"ButtonEvent.Down|block": "down",
|
"ButtonEvent.Down|block": "down",
|
||||||
"ButtonEvent.Up|block": "up",
|
"ButtonEvent.Up|block": "up",
|
||||||
"LightsPattern.GreenFlash|block": "Flashing Green",
|
"MoveUnit.Degrees|block": "degrees",
|
||||||
"LightsPattern.GreenPulse|block": "Pulsing Green",
|
"MoveUnit.MilliSeconds|block": "milliseconds",
|
||||||
"LightsPattern.Green|block": "Green",
|
"MoveUnit.Rotations|block": "rotations",
|
||||||
"LightsPattern.Off|block": "Off",
|
"MoveUnit.Seconds|block": "seconds",
|
||||||
"LightsPattern.OrangeFlash|block": "Flashing Orange",
|
"Output.AB|block": "A+B",
|
||||||
"LightsPattern.OrangePulse|block": "Pulsing Orange",
|
"Output.AD|block": "A+D",
|
||||||
"LightsPattern.Orange|block": "Orange",
|
|
||||||
"LightsPattern.RedFlash|block": "Flashing Red",
|
|
||||||
"LightsPattern.RedPulse|block": "Pulsing Red",
|
|
||||||
"LightsPattern.Red|block": "Red",
|
|
||||||
"Output.ALL|block": "All",
|
"Output.ALL|block": "All",
|
||||||
"Output.A|block": "A",
|
"Output.A|block": "A",
|
||||||
|
"Output.BC|block": "B+C",
|
||||||
"Output.B|block": "B",
|
"Output.B|block": "B",
|
||||||
|
"Output.CD|block": "C+D",
|
||||||
"Output.C|block": "C",
|
"Output.C|block": "C",
|
||||||
"Output.D|block": "D",
|
"Output.D|block": "D",
|
||||||
"brick.Button.isPressed|block": "`icons.brickButtons` %button|is pressed",
|
"brick.Button.isPressed|block": "%button|is pressed",
|
||||||
"brick.Button.onEvent|block": "on `icons.brickButtons` %button|%event",
|
"brick.Button.onEvent|block": "on %button|%event",
|
||||||
"brick.Button.waitUntil|block": "wait until `icons.brickButtons` %button|%event",
|
"brick.Button.pauseUntil|block": "pause until %button|%event",
|
||||||
"brick.Button.wasPressed|block": "`icons.brickButtons` %button|was pressed",
|
"brick.Button.wasPressed|block": "%button|was pressed",
|
||||||
"brick._imagePicker|block": "%image",
|
"brick.batteryLevel|block": "battery level",
|
||||||
"brick.buttonDown|block": "down",
|
"brick.buttonDown|block": "button down",
|
||||||
"brick.buttonEnter|block": "enter",
|
"brick.buttonEnter|block": "button enter",
|
||||||
"brick.buttonLeft|block": "left",
|
"brick.buttonLeft|block": "button left",
|
||||||
"brick.buttonRight|block": "right",
|
"brick.buttonRight|block": "button right",
|
||||||
"brick.buttonUp|block": "up",
|
"brick.buttonUp|block": "button up",
|
||||||
"brick.lightPattern|block": "%pattern",
|
"brick.clearScreen|block": "clear screen",
|
||||||
"brick.print|block": "`icons.brickDisplay` print %text| at x: %x| y: %y",
|
"brick.printPorts|block": "print ports",
|
||||||
"brick.setPixel|block": "`icons.brickDisplay` set pixel %on| at x: %x| y: %y",
|
"brick.setLight|block": "set light to %pattern",
|
||||||
"brick.setStatusLight|block": "set `icons.brickButtons` to %pattern=led_pattern",
|
"brick.showImage|block": "show image %image=screen_image_picker",
|
||||||
"brick.showImage|block": "`icons.brickDisplay` show image %image=scren_image_picker",
|
"brick.showNumber|block": "show number %name|at line %line",
|
||||||
|
"brick.showString|block": "show string %text|at line %line",
|
||||||
|
"brick.showValue|block": "show value %name|= %text|at line %line",
|
||||||
"brick|block": "brick",
|
"brick|block": "brick",
|
||||||
|
"console.logValue|block": "console|log value %name|= %value",
|
||||||
|
"console.log|block": "console|log %text",
|
||||||
|
"console.sendToScreen|block": "send console to screen",
|
||||||
|
"console|block": "console",
|
||||||
"control.raiseEvent|block": "raise event|from %src|with value %value",
|
"control.raiseEvent|block": "raise event|from %src|with value %value",
|
||||||
"control|block": "control",
|
"control|block": "control",
|
||||||
"motors.Motor.count|block": "`icons.motorLarge` %motor|count",
|
"motors.Motor.angle|block": "%motor|angle",
|
||||||
"motors.Motor.move|block": "move `icons.motorLarge` %motor|by %angle|degrees at %power|%",
|
"motors.Motor.clearCounts|block": "%motor|clear counts",
|
||||||
"motors.Motor.setBrake|block": "set `icons.motorLarge` %motor|brake %brake",
|
"motors.Motor.setRegulated|block": "set %motor|regulated %value",
|
||||||
"motors.Motor.setReversed|block": "set `icons.motorLarge` %motor|reversed %reversed",
|
"motors.Motor.speed|block": "%motor|speed",
|
||||||
"motors.Motor.setSpeed|block": "set speed `icons.motorLarge` %motor|to %speed|%",
|
"motors.Motor.tacho|block": "%motor|tacho",
|
||||||
"motors.Motor.speed|block": "`icons.motorLarge` %motor|speed",
|
"motors.MotorBase.pauseUntilReady|block": "%motor|pause until ready",
|
||||||
"motors.Motor.stop|block": "stop `icons.motorLarge` %motor",
|
"motors.MotorBase.reset|block": "%motors|reset",
|
||||||
"motors.Motor.tachoCount|block": "`icons.motorLarge` %motor|tacho count",
|
"motors.MotorBase.setBrake|block": "set %motor|brake %brake",
|
||||||
"motors.largeMotorA|block": "large A",
|
"motors.MotorBase.setReversed|block": "set %motor|reversed %reversed",
|
||||||
"motors.largeMotorB|block": "large B",
|
"motors.MotorBase.setSpeed|block": "set %motor|speed to %speed=motorSpeedPicker|%",
|
||||||
"motors.largeMotorC|block": "large C",
|
"motors.MotorBase.stop|block": "%motors|stop",
|
||||||
"motors.largeMotorD|block": "large D",
|
"motors.SynchedMotorPair.steer|block": "steer %chassis|turn ratio %turnRatio=motorTurnRatioPicker|speed %speed=motorSpeedPicker|%",
|
||||||
"motors.mediumMotorA|block": "medium A",
|
"motors.SynchedMotorPair.tank|block": "tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%",
|
||||||
"motors.mediumMotorB|block": "medium B",
|
"motors.largeAB|block": "large A+B",
|
||||||
"motors.mediumMotorC|block": "medium C",
|
"motors.largeAD|block": "large A+D",
|
||||||
"motors.mediumMotorD|block": "medium D",
|
"motors.largeA|block": "large A",
|
||||||
"motors.stopAllMotors|block": "stop all `icons.motorLarge`",
|
"motors.largeBC|block": "large B+C",
|
||||||
|
"motors.largeB|block": "large B",
|
||||||
|
"motors.largeCD|block": "large C+D",
|
||||||
|
"motors.largeC|block": "large C",
|
||||||
|
"motors.largeD|block": "large D",
|
||||||
|
"motors.mediumA|block": "medium A",
|
||||||
|
"motors.mediumB|block": "medium B",
|
||||||
|
"motors.mediumC|block": "medium C",
|
||||||
|
"motors.mediumD|block": "medium D",
|
||||||
|
"motors.stopAllMotors|block": "stop all motors",
|
||||||
"motors|block": "motors",
|
"motors|block": "motors",
|
||||||
"output|block": "output",
|
"output|block": "output",
|
||||||
"screen|block": "screen",
|
"screen|block": "screen",
|
||||||
|
"sensors|block": "sensors",
|
||||||
"serial|block": "serial",
|
"serial|block": "serial",
|
||||||
"{id:category}Brick": "Brick",
|
"{id:category}Brick": "Brick",
|
||||||
|
"{id:category}Console": "Console",
|
||||||
"{id:category}Control": "Control",
|
"{id:category}Control": "Control",
|
||||||
"{id:category}Image": "Image",
|
"{id:category}Image": "Image",
|
||||||
"{id:category}Images": "Images",
|
"{id:category}Images": "Images",
|
||||||
@ -66,7 +91,9 @@
|
|||||||
"{id:category}Screen": "Screen",
|
"{id:category}Screen": "Screen",
|
||||||
"{id:category}Serial": "Serial",
|
"{id:category}Serial": "Serial",
|
||||||
"{id:group}Buttons": "Buttons",
|
"{id:group}Buttons": "Buttons",
|
||||||
"{id:group}Light": "Light",
|
"{id:group}Counters": "Counters",
|
||||||
"{id:group}Motors": "Motors",
|
"{id:group}More": "More",
|
||||||
"{id:group}Screen": "Screen"
|
"{id:group}Move": "Move",
|
||||||
|
"{id:group}Screen": "Screen",
|
||||||
|
"{id:group}Sensors": "Sensors"
|
||||||
}
|
}
|
12
libs/core/battery.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
namespace brick {
|
||||||
|
/**
|
||||||
|
* Returns the current battery level
|
||||||
|
*/
|
||||||
|
//% blockId=brickBatteryLevel block="battery level"
|
||||||
|
//% group="More"
|
||||||
|
export function batteryLevel(): number {
|
||||||
|
const info = sensors.internal.getBatteryInfo();
|
||||||
|
return info.current;
|
||||||
|
}
|
||||||
|
}
|
@ -2,35 +2,35 @@
|
|||||||
/**
|
/**
|
||||||
* Patterns for lights under the buttons.
|
* Patterns for lights under the buttons.
|
||||||
*/
|
*/
|
||||||
const enum LightsPattern {
|
const enum BrickLight {
|
||||||
//% block=Off enumval=0
|
//% block=off enumval=0
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
Off = 0,
|
Off = 0,
|
||||||
//% block=Green enumval=1
|
//% block=green enumval=1
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
Green = 1,
|
Green = 1,
|
||||||
//% block=Red enumval=2
|
//% block=red enumval=2
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
Red = 2,
|
Red = 2,
|
||||||
//% block=Orange enumval=3
|
//% block=orange enumval=3
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
Orange = 3,
|
Orange = 3,
|
||||||
//% block="Flashing Green" enumval=4
|
//% block="green flash" enumval=4
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
GreenFlash = 4,
|
GreenFlash = 4,
|
||||||
//% block="Flashing Red" enumval=5
|
//% block="red flash" enumval=5
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
RedFlash = 5,
|
RedFlash = 5,
|
||||||
//% block="Flashing Orange" enumval=6
|
//% block="orange flash" enumval=6
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
OrangeFlash = 6,
|
OrangeFlash = 6,
|
||||||
//% block="Pulsing Green" enumval=7
|
//% block="green pulse" enumval=7
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
GreenPulse = 7,
|
GreenPulse = 7,
|
||||||
//% block="Pulsing Red" enumval=8
|
//% block="red pulse" enumval=8
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
RedPulse = 8,
|
RedPulse = 8,
|
||||||
//% block="Pulsing Orange" enumval=9
|
//% block="orange pulse" enumval=9
|
||||||
//% blockIdentity=brick.lightPattern
|
//% blockIdentity=brick.lightPattern
|
||||||
OrangePulse = 9,
|
OrangePulse = 9,
|
||||||
}
|
}
|
||||||
@ -66,6 +66,7 @@ namespace brick {
|
|||||||
|
|
||||||
//% hidden
|
//% hidden
|
||||||
_update(curr: boolean) {
|
_update(curr: boolean) {
|
||||||
|
if (this == null) return
|
||||||
if (this._isPressed == curr) return
|
if (this._isPressed == curr) return
|
||||||
this._isPressed = curr
|
this._isPressed = curr
|
||||||
if (curr) {
|
if (curr) {
|
||||||
@ -85,12 +86,13 @@ namespace brick {
|
|||||||
* @param button the button to query the request
|
* @param button the button to query the request
|
||||||
*/
|
*/
|
||||||
//% help=input/button/is-pressed
|
//% help=input/button/is-pressed
|
||||||
//% block="`icons.brickButtons` %button|is pressed"
|
//% block="%button|is pressed"
|
||||||
//% blockId=buttonIsPressed
|
//% blockId=buttonIsPressed
|
||||||
//% parts="brick"
|
//% parts="brick"
|
||||||
//% blockNamespace=brick
|
//% blockNamespace=brick
|
||||||
//% weight=81 blockGap=8
|
//% weight=81 blockGap=8
|
||||||
//% group="Buttons"
|
//% group="Buttons"
|
||||||
|
//% button.fieldEditor="brickbuttons"
|
||||||
isPressed() {
|
isPressed() {
|
||||||
return this._isPressed
|
return this._isPressed
|
||||||
}
|
}
|
||||||
@ -100,12 +102,13 @@ namespace brick {
|
|||||||
* @param button the button to query the request
|
* @param button the button to query the request
|
||||||
*/
|
*/
|
||||||
//% help=input/button/was-pressed
|
//% help=input/button/was-pressed
|
||||||
//% block="`icons.brickButtons` %button|was pressed"
|
//% block="%button|was pressed"
|
||||||
//% blockId=buttonWasPressed
|
//% blockId=buttonWasPressed
|
||||||
//% parts="brick"
|
//% parts="brick"
|
||||||
//% blockNamespace=brick
|
//% blockNamespace=brick
|
||||||
//% weight=80 blockGap=8
|
//% weight=80
|
||||||
//% group="Buttons"
|
//% group="Buttons"
|
||||||
|
//% button.fieldEditor="brickbuttons"
|
||||||
wasPressed() {
|
wasPressed() {
|
||||||
const r = this._wasPressed
|
const r = this._wasPressed
|
||||||
this._wasPressed = false
|
this._wasPressed = false
|
||||||
@ -119,11 +122,12 @@ namespace brick {
|
|||||||
* @param body code to run when the event is raised
|
* @param body code to run when the event is raised
|
||||||
*/
|
*/
|
||||||
//% help=input/button/on-event
|
//% help=input/button/on-event
|
||||||
//% blockId=buttonEvent block="on `icons.brickButtons` %button|%event"
|
//% blockId=buttonEvent block="on %button|%event"
|
||||||
//% parts="brick"
|
//% parts="brick"
|
||||||
//% blockNamespace=brick
|
//% blockNamespace=brick
|
||||||
//% weight=99 blockGap=8
|
//% weight=99 blockGap=8
|
||||||
//% group="Buttons"
|
//% group="Buttons"
|
||||||
|
//% button.fieldEditor="brickbuttons"
|
||||||
onEvent(ev: ButtonEvent, body: () => void) {
|
onEvent(ev: ButtonEvent, body: () => void) {
|
||||||
control.onEvent(this._id, ev, body)
|
control.onEvent(this._id, ev, body)
|
||||||
}
|
}
|
||||||
@ -132,13 +136,14 @@ namespace brick {
|
|||||||
* Waits until the event is raised
|
* Waits until the event is raised
|
||||||
* @param ev the event to wait for
|
* @param ev the event to wait for
|
||||||
*/
|
*/
|
||||||
//% help=input/button/wait-until
|
//% help=input/button/pause-until
|
||||||
//% blockId=buttonWaitUntil block="wait until `icons.brickButtons` %button|%event"
|
//% blockId=buttonWaitUntil block="pause until %button|%event"
|
||||||
//% parts="brick"
|
//% parts="brick"
|
||||||
//% blockNamespace=brick
|
//% blockNamespace=brick
|
||||||
//% weight=98 blockGap=8
|
//% weight=98 blockGap=8
|
||||||
//% group="Buttons"
|
//% group="Buttons"
|
||||||
waitUntil(ev: ButtonEvent) {
|
//% button.fieldEditor="brickbuttons"
|
||||||
|
pauseUntil(ev: ButtonEvent) {
|
||||||
control.waitForEvent(this._id, ev);
|
control.waitForEvent(this._id, ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,6 +167,12 @@ namespace brick {
|
|||||||
if (sl[i])
|
if (sl[i])
|
||||||
ret |= 1 << i
|
ret |= 1 << i
|
||||||
}
|
}
|
||||||
|
// this needs to be done in query(), which is run without the main JS execution mutex
|
||||||
|
// otherwise, while(true){} will lock the device
|
||||||
|
if (ret & DAL.BUTTON_ID_ESCAPE) {
|
||||||
|
motors.stopAllMotors(); // ensuring that all motors are off
|
||||||
|
control.reset()
|
||||||
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,8 +182,6 @@ namespace brick {
|
|||||||
if (!btnsMM) control.fail("no buttons?")
|
if (!btnsMM) control.fail("no buttons?")
|
||||||
buttons = []
|
buttons = []
|
||||||
sensors.internal.unsafePollForChanges(50, readButtons, (prev, curr) => {
|
sensors.internal.unsafePollForChanges(50, readButtons, (prev, curr) => {
|
||||||
if (curr & DAL.BUTTON_ID_ESCAPE)
|
|
||||||
control.reset()
|
|
||||||
for (let b of buttons)
|
for (let b of buttons)
|
||||||
b._update(!!(curr & b.mask))
|
b._update(!!(curr & b.mask))
|
||||||
})
|
})
|
||||||
@ -187,7 +196,7 @@ namespace brick {
|
|||||||
initBtns()
|
initBtns()
|
||||||
buttons.push(this)
|
buttons.push(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initBtns() // always ON as it handles ESCAPE button
|
initBtns() // always ON as it handles ESCAPE button
|
||||||
|
|
||||||
@ -195,31 +204,31 @@ namespace brick {
|
|||||||
/**
|
/**
|
||||||
* Enter button on the EV3 Brick.
|
* Enter button on the EV3 Brick.
|
||||||
*/
|
*/
|
||||||
//% whenUsed block="enter" weight=95 fixedInstance
|
//% whenUsed block="button enter" weight=95 fixedInstance
|
||||||
export const buttonEnter: Button = new DevButton(DAL.BUTTON_ID_ENTER)
|
export const buttonEnter: Button = new DevButton(DAL.BUTTON_ID_ENTER)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Left button on the EV3 Brick.
|
* Left button on the EV3 Brick.
|
||||||
*/
|
*/
|
||||||
//% whenUsed block="left" weight=95 fixedInstance
|
//% whenUsed block="button left" weight=95 fixedInstance
|
||||||
export const buttonLeft: Button = new DevButton(DAL.BUTTON_ID_LEFT)
|
export const buttonLeft: Button = new DevButton(DAL.BUTTON_ID_LEFT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Right button on the EV3 Brick.
|
* Right button on the EV3 Brick.
|
||||||
*/
|
*/
|
||||||
//% whenUsed block="right" weight=94 fixedInstance
|
//% whenUsed block="button right" weight=94 fixedInstance
|
||||||
export const buttonRight: Button = new DevButton(DAL.BUTTON_ID_RIGHT)
|
export const buttonRight: Button = new DevButton(DAL.BUTTON_ID_RIGHT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Up button on the EV3 Brick.
|
* Up button on the EV3 Brick.
|
||||||
*/
|
*/
|
||||||
//% whenUsed block="up" weight=95 fixedInstance
|
//% whenUsed block="button up" weight=95 fixedInstance
|
||||||
export const buttonUp: Button = new DevButton(DAL.BUTTON_ID_UP)
|
export const buttonUp: Button = new DevButton(DAL.BUTTON_ID_UP)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Down button on the EV3 Brick.
|
* Down button on the EV3 Brick.
|
||||||
*/
|
*/
|
||||||
//% whenUsed block="down" weight=95 fixedInstance
|
//% whenUsed block="button down" weight=95 fixedInstance
|
||||||
export const buttonDown: Button = new DevButton(DAL.BUTTON_ID_DOWN)
|
export const buttonDown: Button = new DevButton(DAL.BUTTON_ID_DOWN)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +237,7 @@ namespace control {
|
|||||||
/**
|
/**
|
||||||
* Determine the version of system software currently running.
|
* Determine the version of system software currently running.
|
||||||
*/
|
*/
|
||||||
|
//%
|
||||||
export function deviceFirmwareVersion(): string {
|
export function deviceFirmwareVersion(): string {
|
||||||
let buf = output.createBuffer(6)
|
let buf = output.createBuffer(6)
|
||||||
brick.internal.getBtnsMM().read(buf)
|
brick.internal.getBtnsMM().read(buf)
|
||||||
@ -242,32 +252,21 @@ namespace control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace brick {
|
namespace brick {
|
||||||
let currPattern: LightsPattern
|
// the brick starts with the red color
|
||||||
|
let currPattern: BrickLight = BrickLight.Red;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set lights.
|
* Set lights.
|
||||||
* @param pattern the lights pattern to use.
|
* @param pattern the lights pattern to use. eg: BrickLight.Orange
|
||||||
*/
|
*/
|
||||||
//% blockId=setLights block="set `icons.brickButtons` to %pattern=led_pattern"
|
//% blockId=setLights block="set light to %pattern"
|
||||||
//% weight=100 group="Light"
|
//% weight=100 group="Buttons"
|
||||||
export function setStatusLight(pattern: number): void {
|
export function setLight(pattern: BrickLight): void {
|
||||||
if (currPattern === pattern)
|
if (currPattern === pattern)
|
||||||
return
|
return
|
||||||
currPattern = pattern
|
currPattern = pattern;
|
||||||
let cmd = output.createBuffer(2)
|
const cmd = output.createBuffer(2)
|
||||||
cmd[0] = pattern + 48
|
cmd[0] = pattern + 48
|
||||||
brick.internal.getBtnsMM().write(cmd)
|
brick.internal.getBtnsMM().write(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pattern block.
|
|
||||||
* @param pattern the lights pattern to use. eg: LightsPattern.Green
|
|
||||||
*/
|
|
||||||
//% blockId=led_pattern block="%pattern"
|
|
||||||
//% shim=TD_ID colorSecondary="#6e9a36" group="Light"
|
|
||||||
//% blockHidden=true useEnumVal=1 pattern.fieldOptions.decompileLiterals=1
|
|
||||||
export function lightPattern(pattern: LightsPattern): number {
|
|
||||||
return pattern;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
106
libs/core/console.ts
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/// <reference no-default-lib="true"/>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reading and writing data to the console output.
|
||||||
|
*/
|
||||||
|
//% weight=12 color=#00451A icon="\uf112"
|
||||||
|
//% advanced=true
|
||||||
|
namespace console {
|
||||||
|
type Listener = (text: string) => void;
|
||||||
|
|
||||||
|
const listeners: Listener[] = [
|
||||||
|
(text: string) => serial.writeLine(text)
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a line of text to the console output.
|
||||||
|
* @param value to send
|
||||||
|
*/
|
||||||
|
//% weight=90
|
||||||
|
//% help=console/log blockGap=8
|
||||||
|
//% blockId=console_log block="console|log %text"
|
||||||
|
export function log(text: string): void {
|
||||||
|
for (let i = 0; i < listeners.length; ++i)
|
||||||
|
listeners[i](text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a name:value pair as a line of text to the console output.
|
||||||
|
* @param name name of the value stream, eg: "x"
|
||||||
|
* @param value to write
|
||||||
|
*/
|
||||||
|
//% weight=88 blockGap=8
|
||||||
|
//% help=console/log-value
|
||||||
|
//% blockId=console_log_value block="console|log value %name|= %value"
|
||||||
|
export function logValue(name: string, value: number): void {
|
||||||
|
log(`${name}: ${value}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a listener for the log messages
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
//%
|
||||||
|
export function addListener(listener: (text: string) => void) {
|
||||||
|
if (!listener) return;
|
||||||
|
listeners.push(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the log messages to the brick screen and uses the brick up and down buttons to scroll.
|
||||||
|
*/
|
||||||
|
//% blockId=logsendtostreen block="send console to screen"
|
||||||
|
//% weight=1
|
||||||
|
export function sendToScreen(): void {
|
||||||
|
console.screen.attach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace console.screen {
|
||||||
|
const maxLines = 100;
|
||||||
|
const screenLines = 8;
|
||||||
|
let lines: string[];
|
||||||
|
let scrollPosition = 0;
|
||||||
|
|
||||||
|
export function attach() {
|
||||||
|
if (!lines) {
|
||||||
|
lines = [];
|
||||||
|
console.addListener(log);
|
||||||
|
brick.buttonUp.onEvent(ButtonEvent.Click, () => scroll(-1))
|
||||||
|
brick.buttonDown.onEvent(ButtonEvent.Click, () => scroll(1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function printLog() {
|
||||||
|
brick.clearScreen()
|
||||||
|
if (!lines) return;
|
||||||
|
for (let i = 0; i < screenLines; ++i) {
|
||||||
|
const line = lines[i + scrollPosition];
|
||||||
|
if (line)
|
||||||
|
brick.print(line, 0, 4 + i * brick.LINE_HEIGHT)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scroll(pos: number) {
|
||||||
|
if (!pos) return;
|
||||||
|
|
||||||
|
scrollPosition += pos >> 0;
|
||||||
|
if (scrollPosition >= lines.length) scrollPosition = lines.length - 1;
|
||||||
|
if (scrollPosition < 0) scrollPosition = 0;
|
||||||
|
printLog();
|
||||||
|
}
|
||||||
|
|
||||||
|
function log(msg: string): void {
|
||||||
|
lines.push(msg);
|
||||||
|
if (lines.length + 5 > maxLines) {
|
||||||
|
lines.splice(0, maxLines - lines.length);
|
||||||
|
scrollPosition = Math.min(scrollPosition, lines.length - 1)
|
||||||
|
}
|
||||||
|
// move down scroll once it gets large than the screen
|
||||||
|
if (lines.length > screenLines
|
||||||
|
&& lines.length >= scrollPosition + screenLines) {
|
||||||
|
scrollPosition++;
|
||||||
|
}
|
||||||
|
printLog();
|
||||||
|
}
|
||||||
|
}
|
11
libs/core/enums.d.ts
vendored
@ -1,6 +1,17 @@
|
|||||||
// Auto-generated. Do not edit.
|
// Auto-generated. Do not edit.
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mode for lseek()
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare const enum SeekWhence {
|
||||||
|
Set = 0,
|
||||||
|
Current = 1,
|
||||||
|
End = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drawing modes
|
* Drawing modes
|
||||||
*/
|
*/
|
||||||
|
@ -114,23 +114,7 @@
|
|||||||
"progressWaterLevel3": "iVBORw0KGgoAAAANSUhEUgAAALIAAACAAQAAAACHQw5jAAABP0lEQVR42u2VMWrEMBBFRxGsGrNqXYT4CltuFV9lj5EqVlhImyPkKoKFbJcrrHKCKJ2XKFb+BGxsGBdbBRJ/mGHm+VtjJGNT/srQO6cG8cnFKXvKLVdHRFcjfXD3xDyybY9IFVJgbpgHtilEa5E8XJ1m/gJbVwJFXuwRrqSYa9hSCZt/A1/B1VLjqdMG1mu0bgeD4W5Te2r1A6YVJne0qfNP57fWU9AY5dYKd29tDgodldoTqagjGaoc3VAiiibQmlg1ApeIQIjuufDUq+C0Q1z1xaJFi/60iluZ28aJ3Jy9yPU5iFxlmesZvsry+kUz8/z/5qTuZKyizM2F3IYZfnDyuR7kc61fL+P4qYmq0mCZ+tuhfHZjPvhV8iKnMVejuZNXrjnK3O77aeo03hEzNGqyUcbNnJdfPjqLFv2+vgH+JtBJ4nz/SAAAAABJRU5ErkJggg==",
|
"progressWaterLevel3": "iVBORw0KGgoAAAANSUhEUgAAALIAAACAAQAAAACHQw5jAAABP0lEQVR42u2VMWrEMBBFRxGsGrNqXYT4CltuFV9lj5EqVlhImyPkKoKFbJcrrHKCKJ2XKFb+BGxsGBdbBRJ/mGHm+VtjJGNT/srQO6cG8cnFKXvKLVdHRFcjfXD3xDyybY9IFVJgbpgHtilEa5E8XJ1m/gJbVwJFXuwRrqSYa9hSCZt/A1/B1VLjqdMG1mu0bgeD4W5Te2r1A6YVJne0qfNP57fWU9AY5dYKd29tDgodldoTqagjGaoc3VAiiibQmlg1ApeIQIjuufDUq+C0Q1z1xaJFi/60iluZ28aJ3Jy9yPU5iFxlmesZvsry+kUz8/z/5qTuZKyizM2F3IYZfnDyuR7kc61fL+P4qYmq0mCZ+tuhfHZjPvhV8iKnMVejuZNXrjnK3O77aeo03hEzNGqyUcbNnJdfPjqLFv2+vgH+JtBJ4nz/SAAAAABJRU5ErkJggg==",
|
||||||
"systemAccept1": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAAQElEQVR42mM4wMDMsP//X4b6//+AWI6h/p8dQ/2fOob6H/8YKj/+Y6h4/I+hxvkfQx07UJ4fiOf/A6sF6QHqBQDsYh9jNdETHwAAAABJRU5ErkJggg==",
|
"systemAccept1": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAAQElEQVR42mM4wMDMsP//X4b6//+AWI6h/p8dQ/2fOob6H/8YKj/+Y6h4/I+hxvkfQx07UJ4fiOf/A6sF6QHqBQDsYh9jNdETHwAAAABJRU5ErkJggg==",
|
||||||
"systemAccept2": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAAQUlEQVR42mM4wMDMsP//X4YEBjYGB4ZHDA6MhxgcmJsYHNiZGNz4mBjcZZgYnPcwMTj+YGJw+ADECUxgtSA9QL0A+IIPxwiZFtwAAAAASUVORK5CYII=",
|
"systemAccept2": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAAQUlEQVR42mM4wMDMsP//X4YEBjYGB4ZHDA6MhxgcmJsYHNiZGNz4mBjcZZgYnPcwMTj+YGJw+ADECUxgtSA9QL0A+IIPxwiZFtwAAAAASUVORK5CYII=",
|
||||||
"systemAlert": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAVAQAAAAB0khOLAAAARUlEQVR42iXD0QmAIAAE0IvWCtqmMbLG8MtVhAZwjBvALyE85XzwoE/QO8f5WPsd0K+An6c3Jq8sThIUUVg9qfmDDRn7AD/WMAQEJ+pCAAAAAElFTkSuQmCC",
|
|
||||||
"systemBox": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAAGklEQVR42mM4wMDMsP//X4b6//9IwiA9QL0AlQYkzY8nCoAAAAAASUVORK5CYII=",
|
"systemBox": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAAGklEQVR42mM4wMDMsP//X4b6//9IwiA9QL0AlQYkzY8nCoAAAAAASUVORK5CYII=",
|
||||||
"systemBusy0": "iVBORw0KGgoAAAANSUhEUgAAABMAAAAPAQAAAAAuP8mBAAAAMElEQVR42mPY/38Bg/x/BgbnHw4Msd8dGKLeA+k4IL0XSGdB6TioOFAepA6kHqgPAJCPFdTsOCPGAAAAAElFTkSuQmCC",
|
|
||||||
"systemBusy1": "iVBORw0KGgoAAAANSUhEUgAAAA8AAAATAQAAAABnuWoHAAAAOUlEQVR42mNoYGKw/8EAJO9/A6GrYQyv1jF8jWP4tY/hbx3D730M3+4xvH/HcO8bw90yhlvbGGDqAdjhGYsKgwC5AAAAAElFTkSuQmCC",
|
|
||||||
"systemDecline1": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAANUlEQVR42mM4wMDMsP//X4b6//8Y6urtGOrt6hjq5/xjqD8JxI+hGMQGiQHlwGqAakF6gHoBybUeX0RcSJEAAAAASUVORK5CYII=",
|
"systemDecline1": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAANUlEQVR42mM4wMDMsP//X4b6//8Y6urtGOrt6hjq5/xjqD8JxI+hGMQGiQHlwGqAakF6gHoBybUeX0RcSJEAAAAASUVORK5CYII=",
|
||||||
"systemDecline2": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAANUlEQVR42mM4wMDMsP//X4YEBjYGx4ZDDA4HmxgckpkYHMyAWAaKQWyQGFAOpAakFqQHqBcAGz4QyzSHE/gAAAAASUVORK5CYII=",
|
"systemDecline2": "iVBORw0KGgoAAAANSUhEUgAAABgAAAAQAQAAAAAkX4I4AAAANUlEQVR42mM4wMDMsP//X4YEBjYGx4ZDDA4HmxgckpkYHMyAWAaKQWyQGFAOpAakFqQHqBcAGz4QyzSHE/gAAAAASUVORK5CYII="
|
||||||
"systemDotEmpty": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAAfAQAAAAA31SuUAAAAYklEQVR42oWOMQ5AQBRE5yZ7FEfSKTmC25CQuILehkahkc12IvgjRqHUTPX/ew+MzsByNlhxGq7ochz90mFL9gmBFjCSGTxZoSUb1OTwTkquP/Md61cU8USWQzZ5VaCWp+oGeLZn9EklJaAAAAAASUVORK5CYII=",
|
|
||||||
"systemDotFull": "iVBORw0KGgoAAAANSUhEUgAAAB8AAAAfAQAAAAA31SuUAAAAX0lEQVR42mP4/0H+H8P//sf/GP7V//nH8PeDfB3D7wPs+xi+MzDeY3jHAER3GBjKGG4wMJgx7GBgsGLYwMAgBSESGBh4CBAIxWC9YFPA5oFNBtsBtg1sL9gFYLeAXAUAPIwyHWLMTS8AAAAASUVORK5CYII=",
|
|
||||||
"systemEv3small": "iVBORw0KGgoAAAANSUhEUgAAACsAAAANAQAAAAAY06pGAAAAPUlEQVR42mNg4LFvYwACFEr+n32fPYiS5/8P5PLLyz8AUXwQqs8eSMn/b7H/D6IO1NmDBA/UgbTzP/gHpwBcwBWO2QYBDwAAAABJRU5ErkJggg==",
|
|
||||||
"systemPlay": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQAAAAA3iMLMAAAAMElEQVR42mP4Y8/wsZ/h+XOG858Z5v5k2POXwcaGoUYOhIAMIBcoCJQCKgAq+2MPAAFKFVmziLfGAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider0": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAEklEQVR42mM4YMBwfwPV0AEDAHmKKNims3dJAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider1": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAGklEQVR42mM4YMBwfwNFCAKuGjCc2sBwwAAAT7olG9TpXdAAAAAASUVORK5CYII=",
|
|
||||||
"systemSlider2": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAG0lEQVR42mM4YMBwfwM5CAJObWC4aoAgDxgAACpUJGftPg+WAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider3": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAG0lEQVR42mM4YMBwfwMJCAKuGjCc2oCFPGAAAPSIIz417p4OAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider4": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAG0lEQVR42mM4YMBwfwNhBAGnNjBcNcBHHjAAAMJ6IooqNLP/AAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider5": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAG0lEQVR42mM4YMBwfwNOBAFXDRhObSCKPGAAAHfbIWHuFKlNAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider6": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAG0lEQVR42mM4YMBwfwM6goBTGxiuGpBGHjAAADklIK1PooVQAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider7": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAG0lEQVR42mM4YMBwfwMUQcBVA4ZTG8gkDxgAANmVH4SOiUHMAAAAAElFTkSuQmCC",
|
|
||||||
"systemSlider8": "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAbAQAAAABg3VNpAAAAFElEQVR42mM4YMBwagPDVSqRBwwASoohT92wVBIAAAAASUVORK5CYII="
|
|
||||||
}
|
}
|
@ -1,260 +1,229 @@
|
|||||||
namespace images {
|
namespace images {
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsBigSmile = screen.unpackPNG(hex``);
|
export const expressionsBigSmile = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsHeartLarge = screen.unpackPNG(hex``);
|
export const expressionsHeartLarge = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsHeartSmall = screen.unpackPNG(hex``);
|
export const expressionsHeartSmall = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsMouth1open = screen.unpackPNG(hex``);
|
export const expressionsMouth1open = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsMouth1shut = screen.unpackPNG(hex``);
|
export const expressionsMouth1shut = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsMouth2open = screen.unpackPNG(hex``);
|
export const expressionsMouth2open = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsMouth2shut = screen.unpackPNG(hex``);
|
export const expressionsMouth2shut = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsSad = screen.unpackPNG(hex``);
|
export const expressionsSad = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsSick = screen.unpackPNG(hex``);
|
export const expressionsSick = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsSmile = screen.unpackPNG(hex``);
|
export const expressionsSmile = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsSwearing = screen.unpackPNG(hex``);
|
export const expressionsSwearing = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsTalking = screen.unpackPNG(hex``);
|
export const expressionsTalking = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsWink = screen.unpackPNG(hex``);
|
export const expressionsWink = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const expressionsZzz = screen.unpackPNG(hex``);
|
export const expressionsZzz = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesAngry = screen.unpackPNG(hex``);
|
export const eyesAngry = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesAwake = screen.unpackPNG(hex``);
|
export const eyesAwake = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesBlackEye = screen.unpackPNG(hex``);
|
export const eyesBlackEye = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesBottomLeft = screen.unpackPNG(hex``);
|
export const eyesBottomLeft = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesBottomRight = screen.unpackPNG(hex``);
|
export const eyesBottomRight = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesCrazy1 = screen.unpackPNG(hex``);
|
export const eyesCrazy1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesCrazy2 = screen.unpackPNG(hex``);
|
export const eyesCrazy2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesDisappointed = screen.unpackPNG(hex``);
|
export const eyesDisappointed = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesDizzy = screen.unpackPNG(hex``);
|
export const eyesDizzy = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesDown = screen.unpackPNG(hex``);
|
export const eyesDown = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesEvil = screen.unpackPNG(hex``);
|
export const eyesEvil = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesHurt = screen.unpackPNG(hex``);
|
export const eyesHurt = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesKnockedOut = screen.unpackPNG(hex``);
|
export const eyesKnockedOut = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesLove = screen.unpackPNG(hex``);
|
export const eyesLove = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesMiddleLeft = screen.unpackPNG(hex``);
|
export const eyesMiddleLeft = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesMiddleRight = screen.unpackPNG(hex``);
|
export const eyesMiddleRight = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesNeutral = screen.unpackPNG(hex``);
|
export const eyesNeutral = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesNuclear = screen.unpackPNG(hex``);
|
export const eyesNuclear = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesPinchLeft = screen.unpackPNG(hex``);
|
export const eyesPinchLeft = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesPinchMiddle = screen.unpackPNG(hex``);
|
export const eyesPinchMiddle = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesPinchRight = screen.unpackPNG(hex``);
|
export const eyesPinchRight = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesSleeping = screen.unpackPNG(hex``);
|
export const eyesSleeping = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesTear = screen.unpackPNG(hex``);
|
export const eyesTear = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesTiredLeft = screen.unpackPNG(hex``);
|
export const eyesTiredLeft = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesTiredMiddle = screen.unpackPNG(hex``);
|
export const eyesTiredMiddle = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesTiredRight = screen.unpackPNG(hex``);
|
export const eyesTiredRight = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesToxic = screen.unpackPNG(hex``);
|
export const eyesToxic = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesUp = screen.unpackPNG(hex``);
|
export const eyesUp = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const eyesWinking = screen.unpackPNG(hex``);
|
export const eyesWinking = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationAccept = screen.unpackPNG(hex``);
|
export const informationAccept = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationBackward = screen.unpackPNG(hex``);
|
export const informationBackward = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationDecline = screen.unpackPNG(hex``);
|
export const informationDecline = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationForward = screen.unpackPNG(hex``);
|
export const informationForward = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationLeft = screen.unpackPNG(hex``);
|
export const informationLeft = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationNoGo = screen.unpackPNG(hex``);
|
export const informationNoGo = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationQuestionMark = screen.unpackPNG(hex``);
|
export const informationQuestionMark = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationRight = screen.unpackPNG(hex``);
|
export const informationRight = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationStop1 = screen.unpackPNG(hex``);
|
export const informationStop1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationStop2 = screen.unpackPNG(hex``);
|
export const informationStop2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationThumbsDown = screen.unpackPNG(hex``);
|
export const informationThumbsDown = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationThumbsUp = screen.unpackPNG(hex``);
|
export const informationThumbsUp = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const informationWarning = screen.unpackPNG(hex``);
|
export const informationWarning = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoColorSensor = screen.unpackPNG(hex``);
|
export const legoColorSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoEv3icon = screen.unpackPNG(hex``);
|
export const legoEv3icon = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoEv3 = screen.unpackPNG(hex``);
|
export const legoEv3 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoGyroSensor = screen.unpackPNG(hex``);
|
export const legoGyroSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoIrBeacon = screen.unpackPNG(hex``);
|
export const legoIrBeacon = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoIrSensor = screen.unpackPNG(hex``);
|
export const legoIrSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoLego = screen.unpackPNG(hex``);
|
export const legoLego = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoLargeMotor = screen.unpackPNG(hex``);
|
export const legoLargeMotor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoMindstorms = screen.unpackPNG(hex``);
|
export const legoMindstorms = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoMediumMotor = screen.unpackPNG(hex``);
|
export const legoMediumMotor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoSoundSensor = screen.unpackPNG(hex``);
|
export const legoSoundSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoTempSensor = screen.unpackPNG(hex``);
|
export const legoTempSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoTouchSensor = screen.unpackPNG(hex``);
|
export const legoTouchSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const legoUsSensor = screen.unpackPNG(hex``);
|
export const legoUsSensor = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsBomb = screen.unpackPNG(hex``);
|
export const objectsBomb = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsBoom = screen.unpackPNG(hex``);
|
export const objectsBoom = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsFire = screen.unpackPNG(hex``);
|
export const objectsFire = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsFlowers = screen.unpackPNG(hex``);
|
export const objectsFlowers = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsForest = screen.unpackPNG(hex``);
|
export const objectsForest = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsLightOff = screen.unpackPNG(hex``);
|
export const objectsLightOff = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsLightOn = screen.unpackPNG(hex``);
|
export const objectsLightOn = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsLightning = screen.unpackPNG(hex``);
|
export const objectsLightning = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsNight = screen.unpackPNG(hex``);
|
export const objectsNight = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsPirate = screen.unpackPNG(hex``);
|
export const objectsPirate = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsSnow = screen.unpackPNG(hex``);
|
export const objectsSnow = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const objectsTarget = screen.unpackPNG(hex``);
|
export const objectsTarget = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressBar0 = screen.unpackPNG(hex``);
|
export const progressBar0 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressBar1 = screen.unpackPNG(hex``);
|
export const progressBar1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressBar2 = screen.unpackPNG(hex``);
|
export const progressBar2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressBar3 = screen.unpackPNG(hex``);
|
export const progressBar3 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressBar4 = screen.unpackPNG(hex``);
|
export const progressBar4 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDial0 = screen.unpackPNG(hex``);
|
export const progressDial0 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDial1 = screen.unpackPNG(hex``);
|
export const progressDial1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDial2 = screen.unpackPNG(hex``);
|
export const progressDial2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDial3 = screen.unpackPNG(hex``);
|
export const progressDial3 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDial4 = screen.unpackPNG(hex``);
|
export const progressDial4 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDots0 = screen.unpackPNG(hex``);
|
export const progressDots0 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDots1 = screen.unpackPNG(hex``);
|
export const progressDots1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDots2 = screen.unpackPNG(hex``);
|
export const progressDots2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressDots3 = screen.unpackPNG(hex``);
|
export const progressDots3 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressHourglass0 = screen.unpackPNG(hex``);
|
export const progressHourglass0 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressHourglass1 = screen.unpackPNG(hex``);
|
export const progressHourglass1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressHourglass2 = screen.unpackPNG(hex``);
|
export const progressHourglass2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressTimer0 = screen.unpackPNG(hex``);
|
export const progressTimer0 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressTimer1 = screen.unpackPNG(hex``);
|
export const progressTimer1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressTimer2 = screen.unpackPNG(hex``);
|
export const progressTimer2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressTimer3 = screen.unpackPNG(hex``);
|
export const progressTimer3 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressTimer4 = screen.unpackPNG(hex``);
|
export const progressTimer4 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressWaterLevel0 = screen.unpackPNG(hex``);
|
export const progressWaterLevel0 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressWaterLevel1 = screen.unpackPNG(hex``);
|
export const progressWaterLevel1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressWaterLevel2 = screen.unpackPNG(hex``);
|
export const progressWaterLevel2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const progressWaterLevel3 = screen.unpackPNG(hex``);
|
export const progressWaterLevel3 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const systemAccept1 = screen.unpackPNG(hex``);
|
export const systemAccept1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const systemAccept2 = screen.unpackPNG(hex``);
|
export const systemAccept2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const systemAlert = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemBox = screen.unpackPNG(hex``);
|
export const systemBox = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const systemBusy0 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemBusy1 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemDecline1 = screen.unpackPNG(hex``);
|
export const systemDecline1 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const systemDecline2 = screen.unpackPNG(hex``);
|
export const systemDecline2 = screen.unpackPNG(hex``);
|
||||||
//% fixedInstance jres
|
//% fixedInstance jres blockIdentity=brick.__imagePicker
|
||||||
export const systemDotEmpty = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemDotFull = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemEv3small = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemPlay = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider0 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider1 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider2 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider3 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider4 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider5 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider6 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider7 = screen.unpackPNG(hex``);
|
|
||||||
//% fixedInstance jres
|
|
||||||
export const systemSlider8 = screen.unpackPNG(hex``);
|
|
||||||
}
|
}
|
||||||
|
11
libs/core/input.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "pxt.h"
|
||||||
|
|
||||||
|
namespace sensors {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark a sensor as used
|
||||||
|
*/
|
||||||
|
//%
|
||||||
|
void __sensorUsed(int port, int type) {
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ namespace sensors.internal {
|
|||||||
|
|
||||||
control.runInBackground(() => {
|
control.runInBackground(() => {
|
||||||
let prev = query()
|
let prev = query()
|
||||||
|
changeHandler(prev, prev)
|
||||||
while (true) {
|
while (true) {
|
||||||
loops.pause(periodMs)
|
loops.pause(periodMs)
|
||||||
let curr = query()
|
let curr = query()
|
||||||
@ -73,6 +74,11 @@ namespace sensors.internal {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getActiveSensors(): Sensor[] {
|
||||||
|
init();
|
||||||
|
return sensorInfos.filter(si => si.sensor && si.sensor.isActive()).map(si => si.sensor);
|
||||||
|
}
|
||||||
|
|
||||||
function readUartInfo(port: number, mode: number) {
|
function readUartInfo(port: number, mode: number) {
|
||||||
let buf = output.createBuffer(UartCtlOff.Size)
|
let buf = output.createBuffer(UartCtlOff.Size)
|
||||||
buf[UartCtlOff.Port] = port
|
buf[UartCtlOff.Port] = port
|
||||||
@ -83,6 +89,14 @@ namespace sensors.internal {
|
|||||||
//serial.writeLine("UART " + port + " / " + mode + " - " + info)
|
//serial.writeLine("UART " + port + " / " + mode + " - " + info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBatteryInfo(): { temp: number; current: number } {
|
||||||
|
init();
|
||||||
|
return {
|
||||||
|
temp: analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryTemp),
|
||||||
|
current: Math.round(analogMM.getNumber(NumberFormat.Int16LE, AnalogOff.BatteryCurrent) / 10)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function detectDevices() {
|
function detectDevices() {
|
||||||
let conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
|
let conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
|
||||||
let numChanged = 0
|
let numChanged = 0
|
||||||
@ -141,6 +155,11 @@ namespace sensors.internal {
|
|||||||
this._port = port_ - 1
|
this._port = port_ - 1
|
||||||
init()
|
init()
|
||||||
sensorInfos[this._port].sensors.push(this)
|
sensorInfos[this._port].sensors.push(this)
|
||||||
|
this.markUsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
markUsed() {
|
||||||
|
sensors.__sensorUsed(this._port, this._deviceType());
|
||||||
}
|
}
|
||||||
|
|
||||||
_activated() { }
|
_activated() { }
|
||||||
@ -183,14 +202,14 @@ namespace sensors.internal {
|
|||||||
Low = 3,
|
Low = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ThresholdDetector {
|
export class ThresholdDetector {
|
||||||
public id: number;
|
public id: number;
|
||||||
private min: number;
|
private min: number;
|
||||||
private max: number;
|
private max: number;
|
||||||
private lowThreshold: number;
|
private lowThreshold: number;
|
||||||
private highThreshold: number;
|
private highThreshold: number;
|
||||||
private level: number;
|
private level: number;
|
||||||
private state: ThresholdState;
|
public state: ThresholdState;
|
||||||
|
|
||||||
constructor(id: number, min = 0, max = 100, lowThreshold = 20, highThreshold = 80) {
|
constructor(id: number, min = 0, max = 100, lowThreshold = 20, highThreshold = 80) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -203,6 +222,7 @@ namespace sensors.internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setLevel(level: number) {
|
public setLevel(level: number) {
|
||||||
|
if (this == null) return
|
||||||
this.level = this.clampValue(level);
|
this.level = this.clampValue(level);
|
||||||
|
|
||||||
if (this.level >= this.highThreshold) {
|
if (this.level >= this.highThreshold) {
|
||||||
@ -289,6 +309,10 @@ namespace sensors.internal {
|
|||||||
return 0
|
return 0
|
||||||
return getUartNumber(fmt, off, this._port)
|
return getUartNumber(fmt, off, this._port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
if (this.isActive()) uartReset(this._port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function uartReset(port: number) {
|
function uartReset(port: number) {
|
||||||
|
@ -13,14 +13,35 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
|
||||||
#define THREAD_DBG(...)
|
#define THREAD_DBG(...)
|
||||||
|
|
||||||
|
#define MALLOC_LIMIT (8 * 1024 * 1024)
|
||||||
|
#define MALLOC_CHECK_PERIOD (1024 * 1024)
|
||||||
|
|
||||||
|
void *xmalloc(size_t sz) {
|
||||||
|
static size_t allocBytes = 0;
|
||||||
|
allocBytes += sz;
|
||||||
|
if (allocBytes >= MALLOC_CHECK_PERIOD) {
|
||||||
|
allocBytes = 0;
|
||||||
|
auto info = mallinfo();
|
||||||
|
DMESG("malloc used: %d kb", info.uordblks / 1024);
|
||||||
|
if (info.uordblks > MALLOC_LIMIT) {
|
||||||
|
target_panic(904);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto r = malloc(sz);
|
||||||
|
if (r == NULL)
|
||||||
|
target_panic(905); // shouldn't happen
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
void *operator new(size_t size) {
|
void *operator new(size_t size) {
|
||||||
return malloc(size);
|
return xmalloc(size);
|
||||||
}
|
}
|
||||||
void *operator new[](size_t size) {
|
void *operator new[](size_t size) {
|
||||||
return malloc(size);
|
return xmalloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *p) {
|
void operator delete(void *p) {
|
||||||
@ -200,10 +221,6 @@ int current_time_ms() {
|
|||||||
return currTime() - startTime;
|
return currTime() - startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getSerialNumber() {
|
|
||||||
return 42; // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void disposeThread(Thread *t) {
|
void disposeThread(Thread *t) {
|
||||||
if (allThreads == t) {
|
if (allThreads == t) {
|
||||||
allThreads = t->next;
|
allThreads = t->next;
|
||||||
@ -376,6 +393,10 @@ static void runPoller(Thread *thr) {
|
|||||||
// note that this is run without the user mutex held - it should not modify any state!
|
// note that this is run without the user mutex held - it should not modify any state!
|
||||||
TValue prev = pxt::runAction0(query);
|
TValue prev = pxt::runAction0(query);
|
||||||
|
|
||||||
|
startUser();
|
||||||
|
pxt::runAction2(thr->act, prev, prev);
|
||||||
|
stopUser();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
sleep_core_us(us);
|
sleep_core_us(us);
|
||||||
if (paniced)
|
if (paniced)
|
||||||
@ -462,7 +483,15 @@ void runLMS() {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void stopMotors() {
|
||||||
|
uint8_t cmd[2] = { 0xA3, 0x0F };
|
||||||
|
int fd = open("/dev/lms_pwm", O_RDWR);
|
||||||
|
write(fd, cmd, 2);
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void target_reset() {
|
extern "C" void target_reset() {
|
||||||
|
stopMotors();
|
||||||
if (lmsPid)
|
if (lmsPid)
|
||||||
runLMS();
|
runLMS();
|
||||||
else
|
else
|
||||||
|