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

Conversion enhancements #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jorgemgn
Copy link

@jorgemgn jorgemgn commented Aug 1, 2020

No description provided.

Copy link
Owner

@jesusgn90 jesusgn90 left a comment

Choose a reason for hiding this comment

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

About the code

This is not well structured and is not well coded, here is a proposal:

Out of the loop function, define a new enum type with the different units:

typedef enum {
    PA,
    HPA,
    ATM
} UNIT;

Now create a variable with the desired unit:

UNIT unit = ATM;

Then, in the loop function:

void loop () {
    float pressure = bmp280.readPressure(); // Defaults PA
    switch (unit) {
        case HPA: 
            pressure /= 100.0F;
            break;
        case ATM:
            pressure *= 0.0000102;
            break;
        // etc
    }
    Serial.print(pressure);
    delay(1000);
}

About the PR

  • Do not use commits using the GitHub website, instead create local branch, test it, commit and push. Also if doing commits in the GitHub website, the CI I have configured is not being fired, it's only being fired on push, I have to fix it but please do as I describe.
  • Add a PR description.

@jesusgn90
Copy link
Owner

Please use commit and push and not a comment so I can review the code properly

@jorgemgn
Copy link
Author

jorgemgn commented Aug 3, 2020

Please use commit and push and not a comment so I can review the code properly

Sorry, there's the commit with the requested modifications.

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