-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys, phydat: omit scale to string conversion if not applicable #7250
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
Conversation
please state:
|
|
This PR adapts scale to string conversion to work with multi dimensional units like square (m^2) and cubic meters (m^3). For further info see discussion in #7193 |
|
#7193 was merged, please rebase. |
650d65c to
a1d0c7e
Compare
|
rebased |
|
another option would be to leave |
haukepetersen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partly NACK: IMHO we can simplify to the following:
char phydat_scale_to_str(int8_t scale, uint8_t unit)
{
switch (unit) {
case UNIT_M2:
case UNIT_M3:
case UNIT_TEMP_C:
/* ... add all others for which scale names don't make sense */
return '\0';
}
switch (scale) {
...Also, the calls to phydat_str need to be adapted...
Yes, alternatively this check can be done in |
|
would be less intrusive, too - I guess |
|
I changed the handling as suggested |
Now the PR needs a new title ;-) |
|
depends: which version do you and @haukepetersen like better? |
sys/phydat/phydat_str.c
Outdated
| case UNIT_PERCENT: | ||
| case UNIT_TEMP_C: | ||
| case UNIT_TEMP_F: | ||
| case UNIT_TEMP_K: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik Kelvin (a SI unit) my be used with SI prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though completely unrealistic for RIOT, but fine - I'll remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it's one check less saving a few byte of ROM ;-)
|
I don't like to put it into |
|
@haukepetersen currently IMHO for now its fine to have it in |
|
ok, fine with me. Then lets keep it like this. |
|
please squash |
129d738 to
5bbafec
Compare
|
done |
|
Could you quickly fix the whitespace issues murdock is complaining about? Just squash the fixes right in... |
5bbafec to
93c0cfd
Compare
damn, my bad - anyway, fix amended. |
|
Murodck is still unhappy, but the cause could be unrelated to your changes. Would you fix it anyway? Thx |
93c0cfd to
e4382ae
Compare
|
I think I made non-commit, with[out] actually pushing the fix - let's see what Murdock says now |
|
All green -> lets go |
based on #7193