Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aio: Fix setting adc bits when initializing #1103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AsuraZeng
Copy link

Set the adc bits to the default value of 10,
so the raw bits of the platform will not take
effect during initialization, and it is always the default value

Signed-off-by: chao zeng chao.zeng@siemens.com

Copy link
Contributor

@jan-kiszka jan-kiszka left a comment

Choose a reason for hiding this comment

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

The fix appear correct to me, but you should rework the commit message: set the number of bits to those that the hardware reports - rather than hard-coded 10 bits.

Also, DEFAULT_BITS seems unused now.

Use the number of adc bits set by the hardware
instead of using the default hard-coded 10 bits

Signed-off-by: chao zeng <chao.zeng@siemens.com>
@AsuraZeng
Copy link
Author

The fix appear correct to me, but you should rework the commit message: set the number of bits to those that the hardware reports - rather than hard-coded 10 bits.

Also, DEFAULT_BITS seems unused now.

yes, remove the DEFAULT_BITS and rewrote the commit.

@jan-kiszka
Copy link
Contributor

On second look, the situation looks less clear to me again: raw_bits is actually a global variable and not a local var that was forgotten to be used in mraa_aio_set_bit as I initially thought. So, it should be perfectly fine to first set a smaller value_bits by calling mraa_aio_set_bit and then let node-red-nodes raise that again to the value the concrete platform supports. The actual bug must be elsewhere, this here is just papering over it.

@jan-kiszka
Copy link
Contributor

None-issue, see siemens/meta-iot2050#407. MRAA chose to start AIO pins with a hardware-independent number bit of bits, even if the hardware can do more. Nothing to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants