Skip to content

Commit

Permalink
add more docs for recorder items
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jan 20, 2025
1 parent 133532e commit 018052d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
17 changes: 17 additions & 0 deletions apps/recorder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ As long as widgets are loaded, you can:
* Call `WIDGETS["recorder"].setRecording(true, {force:"new"/"append"/"overwrite")` to start recording (it returns a promise, and will not show a menu)
* Call `WIDGETS["recorder"].setRecording(false)` to stop recording

### Recording new items

You can add new data items to record by creating a JS file on the Bangle named ending in `.recorder.js` that adds a new item
to the supplied `recorders` array. For example `foobar.recorder.js` could contain:

```
(function(recorders) {
recorders.foobar = {
name : "Foobar", // Name to appear in UIs
fields : ["foobar"], // Column headings to appear as header in recorded CSV data
getValues : () => [123], // Columns of data (length should match 'fields')
start : () => {}, // Called when recording starts - turn on any hardware/intervals you need
stop : () => {}, // Called when recording stops - turn off any hardware/intervals
draw (x,y) => {} // draw 12x12px status image at x,y on g
}
})
```


## Tips
Expand Down
16 changes: 9 additions & 7 deletions apps/recorder/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,17 @@
}
}

/* eg. foobar.recorder.js
/* You can add new data items to record by creating a JS file on the Bangle named ending in `.recorder.js` that adds a new item
to the supplied `recorders` array. For example `foobar.recorder.js` could contain:
(function(recorders) {
recorders.foobar = {
name : "Foobar",
fields : ["foobar"],
getValues : () => [123],
start : () => {},
stop : () => {},
draw (x,y) => {} // draw 12x12px status image
name : "Foobar", // Name to appear in UIs
fields : ["foobar"], // Column headings to appear as header in recorded CSV data
getValues : () => [123], // Columns of data (length should match 'fields')
start : () => {}, // Called when recording starts - turn on any hardware/intervals you need
stop : () => {}, // Called when recording stops - turn off any hardware/intervals
draw (x,y) => {} // draw 12x12px status image at x,y on g
}
})
*/
Expand Down

0 comments on commit 018052d

Please sign in to comment.