Skip to content

[BUG] Multiple typecasting issues in this library. #23

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

Open
yashmulgaonkar opened this issue Jun 22, 2023 · 3 comments
Open

[BUG] Multiple typecasting issues in this library. #23

yashmulgaonkar opened this issue Jun 22, 2023 · 3 comments

Comments

@yashmulgaonkar
Copy link
Contributor

yashmulgaonkar commented Jun 22, 2023

This is a very poorly written library, with blatant errors.

There are multiple instances where variables are incorrectly typecasted.
Durations are requested in milliseconds, but are typecasted as uint8_t.

Here is one such example:
tOn requested as milliseconds:
void SX1509::blink(uint8_t pin, unsigned long tOn, unsigned long tOff, uint8_t onIntensity, uint8_t offIntensity)

Later typecasted as uint8_t:
void SX1509::setupBlink(uint8_t pin, uint8_t tOn, uint8_t tOff, uint8_t onIntensity, uint8_t offIntensity, uint8_t tRise, uint8_t tFall, bool log)

@yashmulgaonkar yashmulgaonkar changed the title Multiple typecasting issues in this library. [BUG] Multiple typecasting issues in this library. Jun 22, 2023
@yashmulgaonkar
Copy link
Contributor Author

Looks like this was caused by what looks like a careless "replace all" operation in this commit:
3ba49b6

@nseidle
Copy link
Member

nseidle commented Jun 22, 2023

You're probably right. Maybe you can fix it. PRs are always welcome.

@gb-123-git
Copy link
Contributor

gb-123-git commented Oct 14, 2023

@yashmulgaonkar
I went through the earlier commits. I don't think this has been caused by "replace all". (Disclaimer: It ("replace all") was not done by me btw)

The code for void SX1509::blink & void SX1509::setupBlink seems to be different. In void SX1509::setupBlink, remarks are specifically mentioning that tOn for this method should not be more than 5 bits.

There seems to be some other problem.

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

No branches or pull requests

3 participants