diff --git a/libs/datalog/_locales/datalog-jsdoc-strings.json b/libs/datalog/_locales/datalog-jsdoc-strings.json index ce94588a..ef31c769 100644 --- a/libs/datalog/_locales/datalog-jsdoc-strings.json +++ b/libs/datalog/_locales/datalog-jsdoc-strings.json @@ -11,5 +11,7 @@ "datalog.addValue|param|value": "value of the cell, eg: 0", "datalog.flush": "Commits any buffered row to disk", "datalog.setEnabled": "Turns on or off datalogging", + "datalog.setSampleInterval": "Sets the minimum number of milli seconds between rows", + "datalog.setSampleInterval|param|millis": "milliseconds between each sample, eg: 50", "datalog.setStorage": "* @param storage custom storage solution" } \ No newline at end of file diff --git a/libs/datalog/_locales/datalog-strings.json b/libs/datalog/_locales/datalog-strings.json index 003a4e46..c29dc881 100644 --- a/libs/datalog/_locales/datalog-strings.json +++ b/libs/datalog/_locales/datalog-strings.json @@ -2,6 +2,7 @@ "datalog.addRow|block": "datalog add row", "datalog.addValue|block": "datalog add %name|=%value", "datalog.setEnabled|block": "datalog %enabled=toggleOnOff", + "datalog.setSampleInterval|block": "set datalog sampling interval to %millis|(ms)", "datalog|block": "datalog", "{id:category}Datalog": "Datalog" } \ No newline at end of file diff --git a/libs/datalog/targetoverrides.ts b/libs/datalog/targetoverrides.ts index 943cb42d..db11423f 100644 --- a/libs/datalog/targetoverrides.ts +++ b/libs/datalog/targetoverrides.ts @@ -2,7 +2,7 @@ namespace datalog.ev3 { /** * A datalog storage for the EV3 */ - export class EV3DatalogStorage extends DatalogStorage { // implements DatalogStorage { + export class EV3DatalogStorage extends DatalogStorage { private _filename: string; private _buffer: string; private _storage: storage.Storage; @@ -38,18 +38,18 @@ namespace datalog.ev3 { // commit row data this._buffer += storage.toCSV(values, this._storage.csvSeparator); // buffered writes - if (this._buffer.length > 1024) + if (this._buffer.length > 512) this.flush(); } /** * Flushes any buffered data */ flush(): void { - if (this._buffer) { + if (this._buffer) { const b = this._buffer; this._buffer = ""; this._storage.append(this._filename, b); - } + } } } // automatic hook up diff --git a/package.json b/package.json index 31fbf7d4..b8bb5442 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "webfonts-generator": "^0.4.0" }, "dependencies": { - "pxt-common-packages": "0.17.12", - "pxt-core": "3.0.26" + "pxt-common-packages": "0.17.13", + "pxt-core": "3.0.29" }, "scripts": { "test": "node node_modules/pxt-core/built/pxt.js travis"