Skip to content

Commit 4cc44ab

Browse files
Merge branch 'refactor/integrated_power_measure_sensor' into 'master'
refactor: integrate power measure sensor See merge request ae_group/esp-iot-solution!1375
2 parents 030a332 + 0a0b529 commit 4cc44ab

39 files changed

+3912
-1119
lines changed

components/i2c_bus/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ChangeLog
22

3+
## v1.4.3 - 2025-9-26
4+
5+
### Bug Fix:
6+
7+
- Synchronize the version information for cmake_utilities
8+
39
## v1.4.2 - 2025-8-26
410

511
### Bug Fix:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.4.2"
1+
version: "1.5.0"
22
description: The I2C Bus Driver supports both hardware and software I2C.
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/i2c_bus
44
repository: https://github.com/espressif/esp-iot-solution.git
@@ -7,7 +7,7 @@ issues: https://github.com/espressif/esp-iot-solution/issues
77

88
dependencies:
99
idf: ">=4.0"
10-
cmake_utilities: "0.*"
10+
cmake_utilities: "*"
1111
sbom:
1212
supplier: 'Organization: Espressif Systems (Shanghai) CO LTD'
1313
originator: 'Organization: Espressif Systems (Shanghai) CO LTD'

components/motor/esp_sensorless_bldc_control/include/bldc_control.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ extern "C" {
2222
* @brief using esp_event_handler_register() to register BLDC_CONTROL_EVENT
2323
*
2424
*/
25+
/** @cond **/
2526
ESP_EVENT_DECLARE_BASE(BLDC_CONTROL_EVENT); /*!< esp event name */
27+
/** @endcond **/
2628

2729
typedef enum {
2830
BLDC_CONTROL_START = 0, /*!< BLDC control start event */

components/sensors/power_measure/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v0.2.0 - 2025-9-5
2+
3+
### Improve:
4+
5+
* Integrate power measurement equipment into a unified management component.
6+
17
## v0.1.0 - 2024-11-5
28

39
### Enhancements:

components/sensors/power_measure/CMakeLists.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
idf_component_register(SRC_DIRS "."
2-
INCLUDE_DIRS "include"
3-
PRIV_INCLUDE_DIRS "priv_include"
4-
REQUIRES esp_timer driver esp_event
1+
set(srcs
2+
src/power_measure_api.c
3+
src/power_measure_bl0937.c
4+
src/power_measure_ina236.c
5+
drivers/ina236/ina236.c
6+
drivers/bl0937/bl0937.c
7+
)
8+
9+
set(incs "include")
10+
11+
set(priv_incs
12+
"drivers/bl0937"
13+
"drivers/ina236"
14+
)
15+
16+
idf_component_register(SRCS ${srcs}
17+
INCLUDE_DIRS ${incs}
18+
PRIV_INCLUDE_DIRS ${priv_incs}
19+
REQUIRES esp_timer driver i2c_bus
520
)
621

722
include(package_manager)
Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,100 @@
11
menu "power_measure"
2+
choice POWER_MEASURE_CHIP_TYPE
3+
prompt "Power measurement chip type"
4+
default POWER_MEASURE_CHIP_BL0937
5+
help
6+
Select the power measurement chip type to use
7+
8+
config POWER_MEASURE_CHIP_BL0937
9+
bool "BL0937"
10+
help
11+
BL0937 is a single-phase power measurement IC with high accuracy
12+
Features: Voltage, Current, Power, Power Factor, Energy measurement
13+
Interface: GPIO (CF, CF1, SEL pins)
14+
15+
config POWER_MEASURE_CHIP_INA236
16+
bool "INA236"
17+
help
18+
INA236 is a precision digital power monitor with I2C interface
19+
Features: Voltage, Current, Power measurement
20+
Interface: I2C
21+
Note: Does not support energy measurement or power factor
22+
endchoice
23+
224
config BL0937_IRAM_OPTIMIZED
3-
bool "Enable IRAM optimization for BL0937"
4-
default n
5-
help
6-
Enable IRAM optimization for BL0937
25+
bool "Enable IRAM optimization for BL0937"
26+
default n
27+
depends on POWER_MEASURE_CHIP_BL0937
28+
help
29+
Enable IRAM optimization for BL0937
30+
31+
menu "BL0937 Hardware Configuration"
32+
config BL0937_VREF_MV
33+
int "Internal voltage reference (mV)"
34+
default 1218
35+
help
36+
Internal voltage reference value for BL0937 in millivolts (1218 = 1.218V)
37+
38+
config BL0937_R_CURRENT_MOHM
39+
int "Current sampling resistor (mOhm)"
40+
default 1
41+
help
42+
Value of the current sampling resistor in milliohms (1 = 1mOhm for ~30A max measurement)
43+
44+
config BL0937_R_VOLTAGE
45+
int "Voltage divider resistor (Ohm)"
46+
default 2010
47+
help
48+
Value of the voltage divider resistor (typically 6x 470K upstream + 1K downstream = 2010)
49+
50+
config BL0937_F_OSC
51+
int "Internal oscillator frequency (Hz)"
52+
default 2000000
53+
help
54+
Frequency of the BL0937 internal clock
55+
56+
config BL0937_PULSE_TIMEOUT_US
57+
int "Pulse timeout (microseconds)"
58+
default 1000000
59+
help
60+
Timeout for pulse detection. Higher values allow better precision but reduce sampling rate.
61+
Lower values increase sampling rate but reduce precision.
62+
Values below 500000 (0.5s) are not recommended.
63+
endmenu
64+
65+
menu "GPIO Pin Configuration"
66+
menu "BL0937 GPIO Pins"
67+
config BL0937_CF_GPIO
68+
int "CF GPIO pin number"
69+
default 3
70+
help
71+
GPIO pin connected to BL0937 CF pin (current frequency output)
72+
73+
config BL0937_SEL_GPIO
74+
int "SEL GPIO pin number"
75+
default 4
76+
help
77+
GPIO pin connected to BL0937 SEL pin (selection pin)
78+
79+
config BL0937_CF1_GPIO
80+
int "CF1 GPIO pin number"
81+
default 7
82+
help
83+
GPIO pin connected to BL0937 CF1 pin (power frequency output)
84+
endmenu
85+
86+
menu "INA236 I2C GPIO Pins"
87+
config INA236_I2C_SCL_GPIO
88+
int "I2C SCL GPIO pin number"
89+
default 13
90+
help
91+
GPIO pin for I2C clock line
92+
93+
config INA236_I2C_SDA_GPIO
94+
int "I2C SDA GPIO pin number"
95+
default 20
96+
help
97+
GPIO pin for I2C data line
98+
endmenu
99+
endmenu
7100
endmenu

0 commit comments

Comments
 (0)