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

barometer: Add ICP10100 and ICP1011 #18451

Merged
merged 1 commit into from
Jan 19, 2022
Merged

Conversation

mxiaogit
Copy link
Contributor

No description provided.


// constants for presure calculation
const float _pcal[3] = { 45000.0, 80000.0, 105000.0 };
const float _lut_lower = 3.5 * 0x100000; // 1<<20
Copy link
Member

Choose a reason for hiding this comment

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

Move these constants into the header or even the method where they're used?

You can also make them static constexpr float.

}

// software reset time to be greater than 170us
usleep(250);
Copy link
Member

Choose a reason for hiding this comment

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

This one is small enough, but ideally we shouldn't have any sleeps in these drivers because they'll potentially impact other devices on the same bus. For example see the simple state machine within any of the newer drivers.

case STATE::RESET:
// CNTL3: Software Reset
RegisterWrite(Register::CNTL3, CNTL3_BIT::SRST);
_reset_timestamp = now;
_failure_count = 0;
_state = STATE::WAIT_FOR_RESET;
perf_count(_reset_perf);
ScheduleDelayed(50_ms); // Power On Reset: max 50ms

void _calculate(void);
bool dataReady();
float getTemperatureC(void);
float getTemperatureF(void);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
float getTemperatureF(void);

@mxiaogit mxiaogit changed the title Add drivers for ICP10100 and ICP10111 barometer: Add ICP10100 and ICP1011 Nov 3, 2021
@dagar dagar merged commit 258a563 into PX4:master Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants