Skip to content

Conversation

@Ishan1923
Copy link

This PR attempts to address Issue #1970 ("Boolean data type signals are not supported by GPIO Controller"). Users were encountering crashes and exceptions when reading states, likely due to uninitialized values or type mismatches.

I have introduced a sanitize_double helper function to handle state readings.

Approach & Reasoning:
Instead of a hard cast to bool, this function detects NaN (uninitialized memory) or invalid values and defaults them safely to 0.0. This stops the crashes while preserving the original double value if valid.

This supports both use cases:

  • Boolean logic: Works as expected (Values like 0.0 and 1.0 pass through).
  • Analog logic: Remains supported (Values like 3.1 or 5.0 are preserved).

I have also updated the ReproduceBadCastCrash test case to EXPECT_NO_THROW to verify that these edge cases are now handled gracefully.

Resolves #1970

@JavierIntermodalicsKion

Any news on this? Thanks in advance for all the effort @Ishan1923

@Ishan1923
Copy link
Author

Any news on this? Thanks in advance for all the effort @Ishan1923

Hi @JavierIntermodalicsKion, thanks for checking in! The PR is fully ready and tested on my end. Currently, I am just waiting for a maintainer to approve the CI workflows (since I am a new contributor, they don't run automatically) and for a code review. Fingers crossed we can get this merged soon!

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.

Boolean data type signals are not supported by GPIO Controller

2 participants