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

fix: remove unused parameter in ina219_calibrate() #606

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions components/ina219/ina219.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ esp_err_t ina219_get_mode(ina219_t *dev, ina219_mode_t *mode)
return read_conf_bits(dev, MASK_MODE, BIT_MODE, (uint16_t *)mode);
}

esp_err_t ina219_calibrate(ina219_t *dev, float i_expected_max, float r_shunt)
esp_err_t ina219_calibrate(ina219_t *dev, float r_shunt)
{
CHECK_ARG(dev);

Expand All @@ -237,7 +237,7 @@ esp_err_t ina219_calibrate(ina219_t *dev, float i_expected_max, float r_shunt)

uint16_t cal = (uint16_t)((0.04096) / (dev->i_lsb * r_shunt));

ESP_LOGD(TAG, "Calibration: %.04f A, %.04f Ohm, 0x%04x", i_expected_max, r_shunt, cal);
ESP_LOGD(TAG, "Calibration: %.04f Ohm, 0x%04x", r_shunt, cal);

return write_reg_16(dev, REG_CALIBRATION, cal);
}
Expand Down
3 changes: 1 addition & 2 deletions components/ina219/ina219.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,10 @@ esp_err_t ina219_get_mode(ina219_t *dev, ina219_mode_t *mode);
* Current readings will be valid only after calibration
*
* @param dev Device descriptor
* @param i_expected_max Maximum expected current, A
* @param r_shunt Shunt resistance, Ohm
* @return `ESP_OK` on success
*/
esp_err_t ina219_calibrate(ina219_t *dev, float i_expected_max, float r_shunt);
esp_err_t ina219_calibrate(ina219_t *dev, float r_shunt);

/**
* @brief Trigger single conversion
Expand Down
6 changes: 0 additions & 6 deletions examples/ina219/default/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
menu "Example configuration"
config EXAMPLE_MAX_CURRENT
int "Expected max current in Ampare to measure"
default 5
help
Expected max current in Ampare. Note that the value must be int, not float.

config EXAMPLE_SHUNT_RESISTOR_MILLI_OHM
int "Shunt resistor value in milliohm)"
default 100
Expand Down
2 changes: 1 addition & 1 deletion examples/ina219/default/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void task(void *pvParameters)

ESP_LOGI(TAG, "Calibrating INA219");

ESP_ERROR_CHECK(ina219_calibrate(&dev, (float)CONFIG_EXAMPLE_MAX_CURRENT, (float)CONFIG_EXAMPLE_SHUNT_RESISTOR_MILLI_OHM / 1000.0f));
ESP_ERROR_CHECK(ina219_calibrate(&dev, (float)CONFIG_EXAMPLE_SHUNT_RESISTOR_MILLI_OHM / 1000.0f));

float bus_voltage, shunt_voltage, current, power;

Expand Down
Loading