When a new device is added via Device.appendOrUpdate, the RSSI check compares the newDevice against itself in the first logical expression (line 34). I believe it should compare the new device against the existing one (like it does in the second logical expression).
It looks like the new device is to be added if its RSSI is less than or greater than the existing device's (by some threshold). If so, wouldn't switching the two devices in the second logical expression make for a better filter? For example,
if (newDevice.RSSI < (existingDevice.RSSI - 5)) or (newDevice.RSSI > (existingDevice.RSSI+2)):
When a new device is added via Device.appendOrUpdate, the RSSI check compares the
newDevice
against itself in the first logical expression (line 34). I believe it should compare the new device against the existing one (like it does in the second logical expression).It looks like the new device is to be added if its RSSI is less than or greater than the existing device's (by some threshold). If so, wouldn't switching the two devices in the second logical expression make for a better filter? For example,