diff --git a/src/integrations/thermopile/cluster.ts b/src/integrations/thermopile/cluster.ts index 7503005a..c2ffd716 100644 --- a/src/integrations/thermopile/cluster.ts +++ b/src/integrations/thermopile/cluster.ts @@ -17,8 +17,9 @@ export class Cluster { return ( this.pixels.find(value => { return ( - (value.x >= pixel.x - 1 && value.x <= pixel.x + 1) || - (value.y >= pixel.y - 1 && value.y <= pixel.y + 1) + value.x >= pixel.x - 1 && + value.x <= pixel.x + 1 && + value.y >= pixel.y - 1 && value.y <= pixel.y + 1 ); }) !== undefined ); diff --git a/src/integrations/thermopile/thermopile-occupancy.sensor.ts b/src/integrations/thermopile/thermopile-occupancy.sensor.ts index 32e61823..63e3531d 100644 --- a/src/integrations/thermopile/thermopile-occupancy.sensor.ts +++ b/src/integrations/thermopile/thermopile-occupancy.sensor.ts @@ -21,8 +21,8 @@ export abstract class ThermopileOccupancySensor { const threshold = mean + deltaThreshold; const relevantPixels: Pixel[] = []; - for (const [x, row] of data.entries()) { - for (const [y, value] of row.entries()) { + for (const [y, row] of data.entries()) { + for (const [x, value] of row.entries()) { if (value >= threshold) { relevantPixels.push(new Pixel(x, y, value)); }