Skip to content

Commit 3628304

Browse files
Add faux French for testing
1 parent 62ab8f9 commit 3628304

File tree

5 files changed

+149
-41
lines changed

5 files changed

+149
-41
lines changed

_locales/fr/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Microsoft MakeCode extension for use with micro:bit CreateAI
2+
3+
FR - This extension is leveraged by micro:bit CreateAI which creates suitable blocks based on the machine learning model you build in the app. It is not useful separate from micro:bit CreateAI.
4+
5+
## Building locally
6+
7+
Ensure you have the required toolchain to build for V1 and V2
8+
(arm-none-eabi-gcc, python, yotta, cmake, ninja, srec_cat) or docker.
9+
10+
```bash
11+
git clone https://github.com/microbit-foundation/pxt-microbit-ml
12+
cd pxt-microbit-ml
13+
npm install pxt --no-save
14+
npx pxt target microbit --no-save
15+
npx pxt install
16+
PXT_FORCE_LOCAL=1 PXT_NODOCKER=1 npx pxt
17+
```
18+
19+
For the V1 build Yotta can hit the GitHub rate limits quite easily if the
20+
project is built from a clean state more than once.
21+
A V2-only build can be performed with the `PXT_COMPILE_SWITCHES=csv---mbcodal`
22+
environmental variable.
23+
24+
```
25+
PXT_FORCE_LOCAL=1 PXT_NODOCKER=1 PXT_COMPILE_SWITCHES=csv---mbcodal npx pxt
26+
```
27+
28+
## Build flags
29+
30+
### Model predictions per second
31+
32+
By default the model will run every 250 ms, to change this value the
33+
`ML_INFERENCE_PERIOD_MS` config can be modified.
34+
35+
```json
36+
{
37+
"yotta": {
38+
"config": {
39+
"ML_INFERENCE_PERIOD_MS": 250
40+
}
41+
}
42+
}
43+
```
44+
45+
### Model events
46+
47+
By default this extension configures the Model prediction events to not be
48+
queued for the same event.
49+
So if an event raised when its handler is still running it will be dropped.
50+
51+
```json
52+
{
53+
"yotta": {
54+
"config": {
55+
"ML_EVENT_LISTENER_DEFAULT_FLAGS": 32
56+
}
57+
}
58+
}
59+
```
60+
61+
The values are defined in the
62+
[codal-core/inc/core/CodalListener.h](https://github.com/lancaster-university/codal-core/blob/df05db9e15499bd8906618192a4d482e3836c62f/inc/core/CodalListener.h#L36-L40)
63+
file:
64+
65+
```cpp
66+
#define MESSAGE_BUS_LISTENER_REENTRANT 0x0008
67+
#define MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY 0x0010
68+
#define MESSAGE_BUS_LISTENER_DROP_IF_BUSY 0x0020
69+
#define MESSAGE_BUS_LISTENER_NONBLOCKING 0x0040
70+
#define MESSAGE_BUS_LISTENER_URGENT 0x0080
71+
```
72+
73+
### Debug messages
74+
75+
To enable debug print from this extension, add the following into your
76+
pxt.json file:
77+
78+
```json
79+
{
80+
"yotta": {
81+
"config": {
82+
"ML_DEBUG_PRINT": 1
83+
}
84+
}
85+
}
86+
```
87+
88+
## License
89+
90+
This software made available under the MIT open source license.
91+
92+
[SPDX-License-Identifier: MIT](/LICENSE)
93+
94+
## Code of Conduct
95+
96+
Trust, partnership, simplicity and passion are our core values we live and breathe in our daily work life and within our projects. Our open-source projects are no exception. We have an active community which spans the globe and we welcome and encourage participation and contributions to our projects by everyone. We work to foster a positive, open, inclusive and supportive environment and trust that our community respects the micro:bit code of conduct. Please see our [code of conduct](https://www.microbit.org/safeguarding/) which outlines our expectations for all those that participate in our community and details on how to report any concerns and what would happen should breaches occur.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mlrunner.customOnEvent": "FR - Register a TypeScript function to run when an event is raised.\n* This custom version of the MakeCode onEvent function is needed due to:\nhttps://github.com/microsoft/pxt-microbit/issues/5709\n*",
3+
"mlrunner.customOnEvent|param|flags": "FR - The specified event flags are ignored and configured via pxt.json.",
4+
"mlrunner.customOnEvent|param|handler": "FR - The function to call when the event is detected.",
5+
"mlrunner.customOnEvent|param|src": "FR - The ID of the component to listen to.",
6+
"mlrunner.customOnEvent|param|value": "FR - The event value to listen to from that component."
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"ml.event.Unknown|block": "FR - unknown",
3+
"ml.getCertainty|block": "FR - certainty (\\%) ML $event",
4+
"ml.isDetected|block": "FR - is ML $event detected",
5+
"ml.onStart|block": "FR - on ML $event start",
6+
"ml.onStopDetailed|block": "FR - on ML $event stop $duration (ms)",
7+
"ml.onStop|block": "FR - on ML $event stop",
8+
"mlrunner|block": "FR - mlrunner",
9+
"{id:category}Ml": "FR - Ml",
10+
"{id:category}MlEvent": "FR - MlEvent",
11+
"{id:category}Mlrunner": "FR - Mlrunner",
12+
"{id:group}micro:bit (V2)": "FR - micro:bit (V2)"
13+
}

pxt.json

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
11
{
2-
"name": "machine-learning",
3-
"version": "1.0.2",
4-
"description": "Machine learning extension to support micro:bit CreateAI",
5-
"dependencies": {
6-
"core": "*",
7-
"machine-learning-runner": "github:microbit-foundation/pxt-microbit-ml-runner#v0.4.8"
8-
},
9-
"files": [
10-
"README.md",
11-
"shims.d.ts",
12-
"enums.d.ts",
13-
"pxtextension.ts",
14-
"pxtextension.cpp"
15-
],
16-
"testFiles": [
17-
"autogenerated.ts",
18-
"main.ts",
19-
"main.blocks"
20-
],
21-
"targetVersions": {
22-
"branch": "v6.0.26",
23-
"tag": "v6.0.26",
24-
"commits": "https://github.com/microsoft/pxt-microbit/commits/0ba979dd8a8f411c37c20b5fd4faba5b43ef51aa",
25-
"target": "6.0.26",
26-
"targetId": "microbit",
27-
"pxt": "9.0.17"
28-
},
29-
"supportedTargets": [
30-
"microbit"
31-
],
32-
"preferredEditor": "tsprj",
33-
"yotta": {
34-
"config": {
35-
"ML_INFERENCE_PERIOD_MS": 250,
36-
"ML_EVENT_LISTENER_DEFAULT_FLAGS": 32
37-
}
2+
"name": "machine-learning",
3+
"version": "1.0.2",
4+
"description": "Machine learning extension to support micro:bit CreateAI",
5+
"dependencies": {
6+
"core": "*",
7+
"machine-learning-runner": "github:microbit-foundation/pxt-microbit-ml-runner#v0.4.8"
8+
},
9+
"files": [
10+
"README.md",
11+
"shims.d.ts",
12+
"enums.d.ts",
13+
"pxtextension.ts",
14+
"pxtextension.cpp",
15+
"_locales/fr/machine-learning-jsdoc-strings.json",
16+
"_locales/fr/machine-learning-strings.json",
17+
"_locales/fr/README.md"
18+
],
19+
"testFiles": ["autogenerated.ts", "main.ts", "main.blocks"],
20+
"targetVersions": {
21+
"branch": "v6.0.26",
22+
"tag": "v6.0.26",
23+
"commits": "https://github.com/microsoft/pxt-microbit/commits/0ba979dd8a8f411c37c20b5fd4faba5b43ef51aa",
24+
"target": "6.0.26",
25+
"targetId": "microbit",
26+
"pxt": "9.0.17"
27+
},
28+
"supportedTargets": ["microbit"],
29+
"preferredEditor": "tsprj",
30+
"yotta": {
31+
"config": {
32+
"ML_INFERENCE_PERIOD_MS": 250,
33+
"ML_EVENT_LISTENER_DEFAULT_FLAGS": 32
3834
}
35+
}
3936
}

pxtextension.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ namespace ml {
5656
//% weight=50
5757
//% parts="v2"
5858
//% group="micro:bit (V2)"
59-
//% help=none
6059
export function onStart(event: MlEvent, body: () => void): void {
6160
event.onStartHandler = body;
6261
const wrappedBody = () => {
@@ -80,7 +79,6 @@ namespace ml {
8079
//% weight=40
8180
//% parts="v2"
8281
//% group="micro:bit (V2)"
83-
//% help=none
8482
export function onStop(event: MlEvent, body: () => void): void {
8583
if (!isRunning()) {
8684
startRunning();
@@ -94,7 +92,6 @@ namespace ml {
9492
//% draggableParameters="reporter"
9593
//% parts="v2"
9694
//% group="micro:bit (V2)"
97-
//% help=none
9895
export function onStopDetailed(
9996
event: MlEvent,
10097
body: (duration: number) => void
@@ -110,7 +107,6 @@ namespace ml {
110107
//% weight=20
111108
//% parts="v2"
112109
//% group="micro:bit (V2)"
113-
//% help=none
114110
export function isDetected(event: MlEvent): boolean {
115111
if (!isRunning()) {
116112
startRunning();
@@ -123,7 +119,6 @@ namespace ml {
123119
//% block="certainty (\\%) ML $event"
124120
//% weight=10
125121
//% parts="v2"
126-
//% help=none
127122
export function getCertainty(event: MlEvent): number {
128123
const eventValue = event.eventValue;
129124
if (eventValue <= 1) {

0 commit comments

Comments
 (0)