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

Fixed small issue regarding inconsistencies between types and moved to int16_t #14

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

RudideC
Copy link
Contributor

@RudideC RudideC commented Nov 9, 2024

Why int16_t?

  • 32 thousand is way more than enough pings and the benefits of having a signed int outweigh those that come from having double the max as no one will use it
  • I am aware that some compilers turn int to int16 by default but this solution works on everything
  • int8_t or uint8_t could be used, but I chose not to because they don't provide much headroom.

I haven't done much testing but it fixed my issue and seems stable. I would appreciate if someone else tested if it works

@dvarrel
Copy link
Owner

dvarrel commented Nov 10, 2024

Hi,
have you got compiling issue ?
esp8266 library is now 3.x

@RudideC
Copy link
Contributor Author

RudideC commented Nov 10, 2024

This is completely unrelated to the ESP8266 issue. Just fixes a small bug i was facing

@RudideC
Copy link
Contributor Author

RudideC commented Nov 11, 2024

Does this PR work for you?

@dvarrel
Copy link
Owner

dvarrel commented Nov 12, 2024

perhaps better use uint16_t when it's > 0 ?

@RudideC
Copy link
Contributor Author

RudideC commented Nov 12, 2024

not really. in the case that someone wants the amount of pings to be entered by the user, the following could happen:

  • if we use uint16_t, if a negative number is accidentally inserted it will turn into an insanely high number which the program cannot detect
  • if we use int16_t we can just add a negative number check and throw an error

also no one will ping a machine 32 thousand times, let alone 64 thousand

@dvarrel dvarrel merged commit 05f1d8c into dvarrel:main Nov 13, 2024
1 check passed
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