node-red / node-red/node-red-nodes

please remove duplicate value check from node-red-node-pisrf

Open
#979 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
13h 57m
Merged PRs (30d)
3

Description

Which node are you reporting an issue on?

node-red-node-pisrf

What are the steps to reproduce?

use it

What happens?

duplicate values are dropped

What do you expect to happen?

every value comes through

Please tell us about your environment:
  • [ 3.0.2] Node-RED version:
  • node.js version:
  • npm version:
  • Platform/OS:
  • Browser:

pisrf sensors are prone to noise (esp. if there are more present), so error correction is necessary anyway (f.e. with median). This gets difficult if the message count isn't consistent. The duplicate check (duplicate values don't get published) is kind of poor and can be easily implemented with a filter node. On the other hand, a median filter f.e. is difficult when the message count is not predictable.

Just change:

if distance != OLD and distance > 2 and distance < 400: print(distance) OLD = distance

to

if distance > 2 and distance < 400: print(distance)

in node-red-nodes/hardware/PiSrf/nrsrf.py at line 83 to 85 or at least make it an option. I am not familiar with pull requests, otherwise i would submit one.

Thank you

ps: i don't know why the new lines in the code brackets get swallowed, i tried, normally it does work as expected

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open node-red-nodes/hardware/PiSrf/nrsrf.py around lines 83–85 and inspect how the duplicate-value check affects published readings. Confirm the desired behavior for valid distances between 2 and 400, then verify that repeated valid values are published while out-of-range values remain excluded.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.