Skip to content

Commit f548145

Browse files
committed
Merge branch 'contrib/github_pr_523' into 'master'
fix(ina236): negative current handling (GitHub PR) Closes AEGHB-1101 See merge request ae_group/esp-iot-solution!1321
2 parents a7221a0 + 9802ad8 commit f548145

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

components/sensors/power_monitor/ina236/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# ChangeLog
22

3+
## v0.1.1 - 2025-7-24
34

4-
## v1.0.0 - 2024-5-23
5+
### Bug Fixes:
6+
7+
* Fix missing handling of negative current
8+
9+
## v0.1.0 - 2024-5-23
510

611
### Enhancements:
712

components/sensors/power_monitor/ina236/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "0.1.0"
1+
version: "0.1.1"
22
description: INA236 power monitor component
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/sensors/power_monitor/ina236
44
repository: https://github.com/espressif/esp-iot-solution.git

components/sensors/power_monitor/ina236/ina236.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ esp_err_t ina236_get_current(ina236_handle_t handle, float *curr)
133133
uint16_t buffer = 0;
134134
ina236_t *ina236 = (ina236_t *)handle;
135135
ina236_read_reg(ina236, INA236_REG_VSHUNT, &buffer);
136-
if ((buffer & 0x8000) >> 15) {
137-
*curr = 0;
138-
} else {
139-
*curr = buffer / 3970.0f;
140-
}
136+
*curr = (int16_t)buffer / 3970.0f;
141137
return ESP_OK;
142138
}
143139

0 commit comments

Comments
 (0)