From a51d4f8926583987e402161fd7cdff447eac9575 Mon Sep 17 00:00:00 2001 From: Dmitriy Antipov Date: Sun, 4 Feb 2024 01:12:45 +0300 Subject: [PATCH] Update input.ts When we find the DAL.CONN_NXT_DUMB sensor, we additionally call setAnalogMode(), which passes the sensor mode to the simulator. Perhaps the same thing needs to be done for DAL.CONN_INPUT_DUMB, but there is only one analog sensor ev3 (touch sensor), and it works without this change. --- libs/core/input.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/core/input.ts b/libs/core/input.ts index b25abe34..add5dd41 100644 --- a/libs/core/input.ts +++ b/libs/core/input.ts @@ -256,6 +256,7 @@ namespace sensors.internal { } else if (newConn == DAL.CONN_NXT_DUMB) { sensorInfo.devType = inDcm[sensorInfo.port]; control.dmesg(`new NXT DUMB connection at port ${sensorInfo.port} dev type ${sensorInfo.devType}`); + setAnalogMode(sensorInfo.port, sensorInfo.devType, 0); } else if (newConn == DAL.CONN_INPUT_DUMB) { //sensorInfo.devType = inDcm[sensorInfo.port]; // We get the result DEVICE_TYPE_UNKNOWN sensorInfo.devType = DAL.DEVICE_TYPE_TOUCH; // TODO? for now assume touch @@ -367,7 +368,6 @@ namespace sensors.internal { } _activated() { - this.realmode = 0; this._setMode(this.mode); } @@ -417,7 +417,6 @@ namespace sensors.internal { } protected _setMode(m: number) { - //control.dmesg(`_setMode p=${this.port} m: ${this.realmode} -> ${m}`); let v = m | 0; this.mode = v; if (!this.isActive()) return;