Skip to content

Commit adf6c8b

Browse files
author
Raphael Kubo da Costa
authored
Fix comparison of rounded readings in threshold check algorithm (#85)
The ambient light reading quantization algorithm returns an entire reading, not an illuminance, so account for that properly in the threshold check algorithm. While here, remove custom anchors for some definitions that are exported by the Generic Sensor spec.
1 parent 5e43a98 commit adf6c8b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

index.bs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ urlPrefix: https://w3c.github.io/sensors/; spec: GENERIC-SENSOR
4848
text: mock sensor type
4949
text: MockSensorType
5050
text: mock sensor reading values
51-
text: threshold check algorithm
52-
text: reading quantization algorithm
5351
text: latest reading
5452
urlPrefix: https://tc39.es/ecma262/; spec: ECMA-262
5553
type: abstract-op
@@ -384,12 +382,12 @@ check algorithm=]:
384382
1. Let |latestIlluminance| be |latestReading|["illuminance"].
385383
1. If [$abs$](|latestIlluminance| - |newIlluminance|) < [=illuminance
386384
threshold value=], return false.
387-
1. Let |roundedNewIlluminance| be the result of invoking the [=ambient light
385+
1. Let |roundedNewReading| be the result of invoking the [=ambient light
388386
reading quantization algorithm=] algorithm with |newIlluminance|.
389-
1. Let |roundedLatestIlluminance| be the result of invoking the [=ambient
387+
1. Let |roundedLatestReading| be the result of invoking the [=ambient
390388
light reading quantization algorithm=] algorithm with |latestIlluminance|.
391-
1. If |roundedNewIlluminance| and |roundedLatestIlluminance| are equal,
392-
return false.
389+
1. If |roundedNewReading|["illuminance"] and |roundedLatestIlluminance|["illuminance"]
390+
are equal, return false.
393391
1. Otherwise, return true.
394392
395393

0 commit comments

Comments
 (0)