Skip to content

Commit

Permalink
More docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Dec 12, 2024
1 parent 341d104 commit 1eb3c4f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
16 changes: 15 additions & 1 deletion _locales/machine-learning-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
{}
{
"ml.getCertainty": "Get the certainty of an ML event in percent.",
"ml.getCertainty|param|event": "one of the actions the machine learning model was trained on",
"ml.isDetected": "Tests if an ML event is currently detected.",
"ml.isDetected|param|event": "one of the actions the machine learning model was trained on",
"ml.onStart": "Do something when an ML event is detected.",
"ml.onStart|param|body": "code to execute",
"ml.onStart|param|event": "one of the actions the machine learning model was trained on",
"ml.onStop": "Do something when an ML event is no longer detected.",
"ml.onStopDetailed": "Do something when an ML event is no longer detected.",
"ml.onStopDetailed|param|body": "code to execute",
"ml.onStopDetailed|param|event": "one of the actions the machine learning model was trained on",
"ml.onStop|param|body": "code to execute",
"ml.onStop|param|event": "one of the actions the machine learning model was trained on"
}
1 change: 1 addition & 0 deletions _locales/machine-learning-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"ml.onStart|block": "on ML $event start",
"ml.onStopDetailed|block": "on ML $event stop $duration (ms)",
"ml.onStop|block": "on ML $event stop",
"ml|block": "Machine Learning",
"{id:category}Ml": "Ml",
"{id:category}MlEvent": "MlEvent",
"{id:group}micro:bit (V2)": "micro:bit (V2)"
Expand Down
18 changes: 18 additions & 0 deletions pxtextension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ namespace ml {
);
}

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

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

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

/**
* Get the certainty of an ML event in percent.
* @param event one of the actions the machine learning model was trained on
*/
//% blockId=ml_on_event_certainty
//% block="certainty (\\%) ML $event"
//% weight=10
Expand Down

0 comments on commit 1eb3c4f

Please sign in to comment.