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

modules: Don't read excess status data #779

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

alistair23
Copy link
Contributor

The SX126x get status command returns a single status byte. The status byte is automatically read in the Module::SPItransferStream() function when we increment buffLen (see
https://github.com/jgromes/RadioLib/blob/master/src/Module.cpp#L259).

By setting numBytes we incorrectly end up reading 2 bytes. Instead set numBytes to zero so we only read the single status byte.

The SX126x get status command returns a single status byte. The status
byte is automatically read in the `Module::SPItransferStream()` function
when we increment buffLen (see
https://github.com/jgromes/RadioLib/blob/master/src/Module.cpp#L259).

By setting numBytes we incorrectly end up reading 2 bytes. Instead set
numBytes to zero so we only read the single status byte.

Signed-off-by: Alistair Francis <[email protected]>
@jgromes jgromes merged commit f6203e5 into jgromes:master Jun 27, 2023
@jgromes
Copy link
Owner

jgromes commented Jun 27, 2023

Well spotted, thanks! Setting the value to 0 actually makes sense, since the GetStatus command does not read any data after returning the status byte - unlike all other SX126x read commands.

jgromes added a commit that referenced this pull request Jun 27, 2023
@alistair23 alistair23 deleted the alistair/spi-status branch June 27, 2023 21:27
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.

2 participants