Skip to content

fix(rak12035): add missing returns, remove unused locals, and cleanup#2649

Open
LeoCatsune wants to merge 1 commit into
meshcore-dev:devfrom
LeoCatsune:fix/raksoilmoisture
Open

fix(rak12035): add missing returns, remove unused locals, and cleanup#2649
LeoCatsune wants to merge 1 commit into
meshcore-dev:devfrom
LeoCatsune:fix/raksoilmoisture

Conversation

@LeoCatsune
Copy link
Copy Markdown

This commit seeks to address a number of issues in src/helpers/sensors/RAK12035_SoilMoisture.cpp, namely:

  • Undefined Behaviour: Missing return in RAK12035_SoilMoisture::sensor_on() (return type bool)
  • Numerous unused local variables
  • Redundant or unnecessary function calls in non-debug cases
  • Miscellaneous spelling, formatting, indentation, and whitespace issues

The missing return caused downstream projects depending on MeshCore to fail compilation under -Werror=return-type, which subsequently led to discovery of the other issues addressed here.

One notable change affects initialisation in EnvironmentSensorManager.cpp. RAK12035_SoilMoisture::begin() was observed to ignore its addr parameter and instead rely on the address supplied via the constructor. To make this behaviour explicit and consistent with existing patterns, the initialisation flow was updated to match how INA226 is handled in the same file. No change in effective addressing behaviour is intended.

Please note that I do not have access to the relevant hardware and therefore am unable to fully validate runtime behaviour. I would appreciate any input from those who depend on this module.

CC: @KPrivitt

Removed unused/shadowing locals, eliminated redundant version reads,
fixed missing `sensor_on()` return path, aligned timeout behavior with
comments, and clean up debug-only code and formatting.

Address handling behavior is unchanged; `begin(addr)` was already
ignoring the passed address and now relies on constructor-initialised `_addr`.
@ripplebiz ripplebiz self-requested a review May 31, 2026 05:19
@LeoCatsune
Copy link
Copy Markdown
Author

Just double-checked, wio build fails on dev before this, no change 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.

1 participant