Skip to content

system/sensortest: Add rows for the voltage, current and power topics. - #3793

Merged
linguini1 merged 2 commits into
apache:masterfrom
Fishwaldo:upstream-sensortest-electrical-rows
Sep 20, 2026
Merged

linguini1 merged 2 commits into
apache:masterfrom
Fishwaldo:upstream-sensortest-electrical-rows

Conversation

@Fishwaldo

Copy link
Copy Markdown
Contributor

Summary

sensortest matches a node name against a table that carries each type's structure size, so a type with no row is rejected before the node is ever opened:

nsh> sensortest -n 2 voltage0
The sensor node name:voltage0 is invalid

voltage, current and power publish like any other topic. Add their rows. All three are a timestamp and a single value, the shape print_valf already handles.

The second commit puts a blank line after the declarations in the ten print helpers. nxstyle reports an error on every one of them, so the file could not be checked cleanly and any change to it had to sort its own errors out of the existing ones. Whitespace only; git diff -w is empty.

Impact

sensortest only. No existing type changes behaviour. Three types that could not be read at all now can.

Testing

ESWIN EIC7700 EVB, reading an MPQ8785 regulator and four INA226 rails:

nsh> sensortest -n 2 voltage0
voltage0: timestamp:71949895 value:0.72
voltage0: timestamp:72950890 value:0.72
nsh> sensortest -n 1 voltage5
voltage5: timestamp:93633993 value:12.03
nsh> sensortest -n 1 current5
current5: timestamp:94560994 value:0.73
nsh> sensortest -n 1 power5
power5: timestamp:95488993 value:8.79

12.03 V x 0.73 A = 8.78 W against the 8.79 W reported, so the values are consistent rather than merely present. nxstyle system/sensortest/sensortest.c is clean after the second commit.

The three electrical topics exist and publish, but sensortest rejects
their node names before opening them: its table is matched by name and
carries each structure's size, so a type without a row is one the tool
cannot read at all.

All three are a timestamp and a single value, the shape print_valf
already handles.

Signed-off-by: Justin Hammond <justin@dynam.ac>
Each of the ten print helpers opens with a declaration followed
immediately by its printf, which nxstyle reports as an error on every
one of them.  The file cannot be checked cleanly until they are fixed,
so a later change to it starts from a failing run and has to sort its
own errors from the existing ones.

Whitespace only.  git diff -w is empty.

Signed-off-by: Justin Hammond <justin@dynam.ac>

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Fishwaldo :-)

@linguini1
linguini1 merged commit 3cfb129 into apache:master Sep 20, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants