Skip to content

Commit 1eb3c4f

Browse files
More docstrings
1 parent 341d104 commit 1eb3c4f

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
{}
1+
{
2+
"ml.getCertainty": "Get the certainty of an ML event in percent.",
3+
"ml.getCertainty|param|event": "one of the actions the machine learning model was trained on",
4+
"ml.isDetected": "Tests if an ML event is currently detected.",
5+
"ml.isDetected|param|event": "one of the actions the machine learning model was trained on",
6+
"ml.onStart": "Do something when an ML event is detected.",
7+
"ml.onStart|param|body": "code to execute",
8+
"ml.onStart|param|event": "one of the actions the machine learning model was trained on",
9+
"ml.onStop": "Do something when an ML event is no longer detected.",
10+
"ml.onStopDetailed": "Do something when an ML event is no longer detected.",
11+
"ml.onStopDetailed|param|body": "code to execute",
12+
"ml.onStopDetailed|param|event": "one of the actions the machine learning model was trained on",
13+
"ml.onStop|param|body": "code to execute",
14+
"ml.onStop|param|event": "one of the actions the machine learning model was trained on"
15+
}

_locales/machine-learning-strings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"ml.onStart|block": "on ML $event start",
66
"ml.onStopDetailed|block": "on ML $event stop $duration (ms)",
77
"ml.onStop|block": "on ML $event stop",
8+
"ml|block": "Machine Learning",
89
"{id:category}Ml": "Ml",
910
"{id:category}MlEvent": "MlEvent",
1011
"{id:group}micro:bit (V2)": "micro:bit (V2)"

pxtextension.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ namespace ml {
8282
);
8383
}
8484

85+
/**
86+
* Do something when an ML event is no longer detected.
87+
* @param event one of the actions the machine learning model was trained on
88+
* @param body code to execute
89+
*/
8590
//% blockId=ml_on_event_stop
8691
//% block="on ML $event stop"
8792
//% weight=40
@@ -95,6 +100,11 @@ namespace ml {
95100
event.onStopHandler = body;
96101
}
97102

103+
/**
104+
* Do something when an ML event is no longer detected.
105+
* @param event one of the actions the machine learning model was trained on
106+
* @param body code to execute
107+
*/
98108
//% blockId=ml_on_event_stop_detailed
99109
//% block="on ML $event stop $duration (ms)"
100110
//% weight=30
@@ -112,6 +122,10 @@ namespace ml {
112122
event.onStopDetailedHandler = body;
113123
}
114124

125+
/**
126+
* Tests if an ML event is currently detected.
127+
* @param event one of the actions the machine learning model was trained on
128+
*/
115129
//% blockId=ml_is_event_detected
116130
//% block="is ML $event detected"
117131
//% weight=20
@@ -126,6 +140,10 @@ namespace ml {
126140
return event.eventValue == currentEventId();
127141
}
128142

143+
/**
144+
* Get the certainty of an ML event in percent.
145+
* @param event one of the actions the machine learning model was trained on
146+
*/
129147
//% blockId=ml_on_event_certainty
130148
//% block="certainty (\\%) ML $event"
131149
//% weight=10

0 commit comments

Comments
 (0)