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

Replaced byte with uint8_t in the arduino files. #43

Closed

Conversation

SaarYogev
Copy link

Deals with the additional part of #32 (not the sub issue of #11, that'll be in a future PR).

@ElectricRCAircraftGuy
Copy link
Collaborator

ElectricRCAircraftGuy commented Apr 17, 2020

@SaarYogev, thanks. I'll see if I can look at it over the weekend, or maybe @nimrod46 can. Can you do me a favor and run the auto-formatter too?

./run_clang-format.sh

Follow the instructions here: https://github.com/AmboVent-1690-108/AmboVent#software. I want to make sure they are easy enough to follow for you to get it to work.

@SaarYogev
Copy link
Author

Sure, I'll try it tomorrow. By the way, is auto-formatting an issue already? If so just mention it, if not I'll open one. Also, we need to include it in CI ( #42 ).

@SaarYogev
Copy link
Author

@ElectricRCAircraftGuy ./run_clang-format.sh produces an error:

$ ./run_clang-format.sh
THIS_DIR = "..../AmboVent"
FILE_LIST = "..../AmboVent/3-Software/Arduino/ventilation_machine/ventilation_machine.ino"
Formatting ..../AmboVent/3-Software/Arduino/ventilation_machine/ventilation_machine.ino
YAML:184:22: error: unknown key 'Delimiter'
  - Delimiter:       pb
                     ^~
Error reading ..../AmboVent/3-Software/Arduino\.clang-format: invalid argument

Where .... is anything above the project's root directory.

@SaarYogev
Copy link
Author

Is that holding this PR back? If not, it's probably better to open a separate issue on making sure run_clang-format.sh works.

Copy link
Collaborator

@ElectricRCAircraftGuy ElectricRCAircraftGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Blocking) I don't want to change the core Arduino libraries unless we absolutely have to, which we don't here.

(Not blocking the merge): Also, I see 13 missed opportunities to change byte casts or enum types to uint8_t in ventilation_machine.ino.

@@ -275,7 +275,7 @@ void Servo::write(int value)
void Servo::writeMicroseconds(int value)
{
// calculate and store the values for the given channel
byte channel = this->servoIndex;
uint8_t channel = this->servoIndex;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not change anything in the core libraries. Please remove all changes to Libraries/Servo. Otherwise we make our libraries deviate from the Arduino core with no real differences, and it adds work when the core libraries change or get upgraded.

@ElectricRCAircraftGuy
Copy link
Collaborator

@SaarYogev,

Is that holding this PR back? If not, it's probably better to open a separate issue on making sure run_clang-format.sh works.

Yes, we don't want to land any future PRs without running the clang formatter first on the core AmboVent files (this doesn't include Libraries we didn't write--we won't format those).

Please open an issue and I'd love to help you debug getting the formatter to work. The variable renames here are trivial so I'll just catch them real quick. Getting the formatter to work on anyone's system who wants to merge a PR is more important to me, however, so let's work that out if you are willing to. I want to ensure we have instructions that are easy to follow.

ElectricRCAircraftGuy added a commit to ElectricRCAircraftGuy/AmboVent that referenced this pull request Apr 20, 2020
…t8_t`

Cleaning up the #defines included:

1. renaming to have more descriptive names, names in ALL_CAPITALS, and
names which ended in their units (ex: _PA for Pascals)
2. Changing all 0s meaning false to `false`, all 1s meaning true to
`true`
3. Adding more detailed descriptions, such as for the low-pass-filter
IIR (Infinite Impulse Response) alpha constants

When converting `byte` --> `uint8_t`, I also changed the parenthesis
style from `uint8_t(val)`, which mistakenly looks like a function,
to `(uint8_t)val`, which is clearly a C-style type cast.

This closes AmboVent-1690-108#43 (a PR), since it replaces it.
@ElectricRCAircraftGuy
Copy link
Collaborator

ElectricRCAircraftGuy commented Apr 20, 2020

@SaarYogev , no need to fix any of this anymore. #46 does a ton of other stuff and also replaces this PR while I'm at it. I'd still like to get your clang-format tool working, however, so I'd be happy to help you debug if you are willing to open an issue. We need to make that process smooth, as running the formatter is a requirement to land code.

@ElectricRCAircraftGuy
Copy link
Collaborator

By the way, is auto-formatting an issue already? If so just mention it, if not I'll open one. Also, we need to include it in CI ( #42 ).

Agreed, we need to get the auto-formater to run in CI if possible. I don't think we have an open issue to integrate the auto-formatter with CI. Feel free to open an issue for that. I only had one to get the auto-formatter working manually I think. Yes, see #21. It's closed.

ElectricRCAircraftGuy added a commit to ElectricRCAircraftGuy/AmboVent that referenced this pull request Apr 21, 2020
…t8_t`

Cleaning up the #defines included:

1. renaming to have more descriptive names, names in ALL_CAPITALS, and
names which ended in their units (ex: _PA for Pascals)
2. Changing all 0s meaning false to `false`, all 1s meaning true to
`true`
3. Adding more detailed descriptions, such as for the low-pass-filter
IIR (Infinite Impulse Response) alpha constants

When converting `byte` --> `uint8_t`, I also changed the parenthesis
style from `uint8_t(val)`, which mistakenly looks like a function,
to `(uint8_t)val`, which is clearly a C-style type cast.

This closes AmboVent-1690-108#43 (a PR), since it replaces it.
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