Merge pull request #149 from Debenben/colordistanceSensor

change colordistancesensor distance calculation
This commit is contained in:
Nathan Kellenicki 2022-01-18 17:34:51 -08:00 committed by GitHub
commit 322b269e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,10 +131,10 @@ export class ColorDistanceSensor extends Device {
const partial = message[7]; const partial = message[7];
if (partial > 0) { if (partial > 0) {
distance += 1.0 / partial; distance = 1.0 / partial;
} }
distance = Math.floor(distance * 25.4) - 20; distance = Math.floor(distance * 25.4);
/** /**
* A combined color and distance event, emits when the sensor is activated. * A combined color and distance event, emits when the sensor is activated.