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

use word-sized params in scd4x self-calibration #660

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions components/scd4x/scd4x.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,19 @@ esp_err_t scd4x_perform_forced_recalibration(i2c_dev_t *dev, uint16_t target_co2
esp_err_t scd4x_get_automatic_self_calibration(i2c_dev_t *dev, bool *enabled)
{
CHECK_ARG(enabled);

return execute_cmd(dev, CMD_GET_AUTOMATIC_SELF_CALIBRATION_ENABLED, 1, NULL, 0, (uint16_t *)enabled, 1);
uint16_t e = *enabled;
esp_err_t err = execute_cmd(dev, CMD_GET_AUTOMATIC_SELF_CALIBRATION_ENABLED, 1, NULL, 0, &e, 1);
if(err == ESP_OK)
{
*enabled = !!e;
}
return err;
}

esp_err_t scd4x_set_automatic_self_calibration(i2c_dev_t *dev, bool enabled)
{
return execute_cmd(dev, CMD_SET_AUTOMATIC_SELF_CALIBRATION_ENABLED, 1, (uint16_t *)&enabled, 1, NULL, 0);
uint16_t e = enabled;
return execute_cmd(dev, CMD_SET_AUTOMATIC_SELF_CALIBRATION_ENABLED, 1, &e, 1, NULL, 0);
}

esp_err_t scd4x_start_low_power_periodic_measurement(i2c_dev_t *dev)
Expand Down
Loading