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

[🐛Bug]: constrainの値がおかしい #94

Open
usuyuki opened this issue Dec 16, 2023 · 1 comment
Open

[🐛Bug]: constrainの値がおかしい #94

usuyuki opened this issue Dec 16, 2023 · 1 comment
Assignees
Labels
🐛bug バグ

Comments

@usuyuki
Copy link
Member

usuyuki commented Dec 16, 2023

🐛 概要

	serial.Print("constrain(100,0,10): ")
	serial.PrintInt(arduino.Constrain(100, 0, 10))
	serial.Println("")

の値が

constrain(100,0,10): 21

になる。

原因

#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))

マクロで展開する感じなので、コンパイル後に動的にくる値に対応できない?

備考

@usuyuki usuyuki added the 🐛bug バグ label Dec 16, 2023
@usuyuki usuyuki self-assigned this Dec 16, 2023
@usuyuki
Copy link
Member Author

usuyuki commented Dec 16, 2023

rust未検証

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug バグ
Projects
None yet
Development

No branches or pull requests

1 participant