rebuild for sampling (#261)

* rebuild for sampling

* bump pxt
This commit is contained in:
Peli de Halleux 2018-01-30 16:01:12 -08:00 committed by GitHub
parent 9ef5b8d4ad
commit a71dee2923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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

View File

@ -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"