diff --git a/src/extensions/scratch3_ev3/index.js b/src/extensions/scratch3_ev3/index.js index 801ea25d0..016919f8c 100644 --- a/src/extensions/scratch3_ev3/index.js +++ b/src/extensions/scratch3_ev3/index.js @@ -187,7 +187,7 @@ class EV3 { } get distance () { - if (!this.connected) return; + if (!this.connected) return 0; // https://shop.lego.com/en-US/EV3-Ultrasonic-Sensor-45504 // Measures distances between one and 250 cm (one to 100 in.) @@ -199,19 +199,18 @@ class EV3 { } get brightness () { - if (!this.connected) return; + if (!this.connected) return 0; return this._sensors.brightness; } getMotorPosition (port) { if (!this.connected) return; + return this._motorPositions[port]; - // TODO: read motor position data - log.info(`return motor ${args} position`); } - isButtonPressed (args) { + isButtonPressed (/* args */) { if (!this.connected) return; return this._sensors.button; @@ -545,7 +544,6 @@ class EV3 { if (this._sensorPorts.length === 0) { // SENSOR LIST // JAABAAIefn5+fn5+fn5+fn5+fn5+Bwd+fn5+fn5+fn5+fn5+fgA= - // [36, 0, 1, 0, 2, 30, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 7, 7, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 0] log.info(`device array: ${array}`); this._sensorPorts[0] = EV_DEVICE_TYPES[array[5]]; this._sensorPorts[1] = EV_DEVICE_TYPES[array[6]]; @@ -563,7 +561,7 @@ class EV3 { // TODO: window? this._pollingIntervalID = window.setInterval(this._getSessionData.bind(this), 100); } else { - //log.info(`received compound command result: ${array}`); + // log.info(`received compound command result: ${array}`); let offset = 5; for (let i = 0; i < this._sensorPorts.length; i++) { if (this._sensorPorts[i] !== 'none') { diff --git a/src/util/jsonrpc-web-socket.js b/src/util/jsonrpc-web-socket.js index c06a269b5..ac118cdff 100644 --- a/src/util/jsonrpc-web-socket.js +++ b/src/util/jsonrpc-web-socket.js @@ -1,5 +1,5 @@ const JSONRPC = require('./jsonrpc'); -const log = require('../util/log'); +// const log = require('../util/log'); class JSONRPCWebSocket extends JSONRPC { constructor (webSocket) {