esphome 2025.8.4__py3-none-any.whl → 2025.9.0b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +177 -105
- esphome/components/absolute_humidity/absolute_humidity.cpp +3 -5
- esphome/components/adc/__init__.py +1 -26
- esphome/components/adc/adc_sensor_esp32.cpp +29 -6
- esphome/components/adc/sensor.py +20 -0
- esphome/components/ags10/ags10.cpp +3 -18
- esphome/components/ags10/ags10.h +2 -12
- esphome/components/aht10/aht10.cpp +3 -3
- esphome/components/airthings_ble/__init__.py +2 -2
- esphome/components/alarm_control_panel/__init__.py +2 -2
- esphome/components/am2315c/am2315c.cpp +1 -17
- esphome/components/am2315c/am2315c.h +2 -3
- esphome/components/api/__init__.py +2 -2
- esphome/components/api/api_connection.cpp +38 -34
- esphome/components/api/api_connection.h +20 -40
- esphome/components/api/api_frame_helper.cpp +25 -25
- esphome/components/api/api_frame_helper.h +3 -3
- esphome/components/api/api_frame_helper_noise.cpp +75 -40
- esphome/components/api/api_frame_helper_noise.h +3 -7
- esphome/components/api/api_frame_helper_plaintext.cpp +17 -4
- esphome/components/api/api_frame_helper_plaintext.h +1 -4
- esphome/components/api/api_pb2.cpp +12 -2
- esphome/components/api/api_pb2.h +144 -143
- esphome/components/api/api_pb2_dump.cpp +6 -1
- esphome/components/api/api_pb2_service.cpp +0 -14
- esphome/components/api/api_pb2_service.h +1 -3
- esphome/components/api/client.py +5 -3
- esphome/components/api/proto.cpp +33 -37
- esphome/components/async_tcp/__init__.py +2 -2
- esphome/components/atm90e26/sensor.py +2 -0
- esphome/components/atm90e32/sensor.py +4 -2
- esphome/components/audio_adc/__init__.py +2 -2
- esphome/components/audio_dac/__init__.py +2 -2
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +1 -1
- esphome/components/bedjet/bedjet_hub.cpp +1 -1
- esphome/components/binary_sensor/__init__.py +2 -2
- esphome/components/binary_sensor/binary_sensor.cpp +13 -0
- esphome/components/binary_sensor/binary_sensor.h +4 -7
- esphome/components/bl0940/__init__.py +6 -1
- esphome/components/bl0940/bl0940.cpp +178 -41
- esphome/components/bl0940/bl0940.h +121 -76
- esphome/components/bl0940/button/__init__.py +27 -0
- esphome/components/bl0940/button/calibration_reset_button.cpp +20 -0
- esphome/components/bl0940/button/calibration_reset_button.h +19 -0
- esphome/components/bl0940/number/__init__.py +94 -0
- esphome/components/bl0940/number/calibration_number.cpp +29 -0
- esphome/components/bl0940/number/calibration_number.h +26 -0
- esphome/components/bl0940/sensor.py +151 -2
- esphome/components/bl0942/bl0942.cpp +1 -1
- esphome/components/ble_client/output/__init__.py +4 -4
- esphome/components/bluetooth_proxy/__init__.py +1 -1
- esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -1
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +15 -7
- esphome/components/bluetooth_proxy/bluetooth_proxy.h +6 -3
- esphome/components/button/__init__.py +2 -2
- esphome/components/button/button.cpp +13 -0
- esphome/components/button/button.h +4 -7
- esphome/components/camera/buffer.h +18 -0
- esphome/components/camera/buffer_impl.cpp +20 -0
- esphome/components/camera/buffer_impl.h +26 -0
- esphome/components/camera/camera.h +43 -0
- esphome/components/camera/encoder.h +69 -0
- esphome/components/camera_encoder/__init__.py +62 -0
- esphome/components/camera_encoder/encoder_buffer_impl.cpp +23 -0
- esphome/components/camera_encoder/encoder_buffer_impl.h +25 -0
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.cpp +82 -0
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.h +39 -0
- esphome/components/captive_portal/__init__.py +2 -2
- esphome/components/captive_portal/captive_index.h +77 -97
- esphome/components/captive_portal/captive_portal.cpp +35 -12
- esphome/components/captive_portal/captive_portal.h +3 -3
- esphome/components/ccs811/ccs811.cpp +3 -3
- esphome/components/climate/__init__.py +2 -2
- esphome/components/climate/climate.cpp +1 -1
- esphome/components/cover/__init__.py +5 -5
- esphome/components/cover/cover.cpp +1 -1
- esphome/components/cover/cover.h +2 -2
- esphome/components/dallas_temp/dallas_temp.cpp +2 -2
- esphome/components/datetime/__init__.py +2 -2
- esphome/components/datetime/date_entity.h +2 -2
- esphome/components/datetime/datetime_entity.h +2 -2
- esphome/components/datetime/time_entity.h +2 -2
- esphome/components/debug/debug_esp32.cpp +1 -1
- esphome/components/display/__init__.py +4 -4
- esphome/components/duty_time/duty_time_sensor.cpp +1 -1
- esphome/components/esp32/__init__.py +0 -5
- esphome/components/esp32/gpio.cpp +27 -23
- esphome/components/esp32/gpio.h +26 -11
- esphome/components/esp32/preferences.cpp +8 -4
- esphome/components/esp32_ble/__init__.py +7 -2
- esphome/components/esp32_ble/ble_uuid.cpp +30 -9
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +4 -3
- esphome/components/esp32_ble_client/ble_client_base.cpp +7 -3
- esphome/components/esp32_ble_client/ble_client_base.h +8 -5
- esphome/components/esp32_ble_tracker/__init__.py +2 -2
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -47
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -14
- esphome/components/esp8266/__init__.py +2 -2
- esphome/components/esp8266/core.cpp +2 -2
- esphome/components/esp8266/gpio.py +4 -4
- esphome/components/esp8266/preferences.cpp +30 -28
- esphome/components/esphome/ota/__init__.py +2 -2
- esphome/components/esphome/ota/ota_esphome.cpp +21 -19
- esphome/components/esphome/ota/ota_esphome.h +6 -5
- esphome/components/ethernet/__init__.py +7 -2
- esphome/components/ethernet/ethernet_component.cpp +49 -3
- esphome/components/ethernet/ethernet_component.h +2 -0
- esphome/components/event/__init__.py +2 -2
- esphome/components/event/event.h +4 -4
- esphome/components/factory_reset/button/factory_reset_button.cpp +18 -1
- esphome/components/factory_reset/button/factory_reset_button.h +6 -1
- esphome/components/factory_reset/switch/factory_reset_switch.cpp +18 -1
- esphome/components/factory_reset/switch/factory_reset_switch.h +5 -1
- esphome/components/fan/__init__.py +2 -2
- esphome/components/fan/fan.cpp +2 -1
- esphome/components/gdk101/gdk101.cpp +4 -4
- esphome/components/globals/__init__.py +2 -2
- esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +19 -18
- esphome/components/gpio_expander/cached_gpio.h +36 -16
- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +5 -5
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +1 -1
- esphome/components/haier/haier_base.cpp +1 -1
- esphome/components/haier/hon_climate.cpp +1 -1
- esphome/components/hlw8012/hlw8012.cpp +5 -5
- esphome/components/honeywellabp2_i2c/honeywellabp2.cpp +4 -4
- esphome/components/host/preferences.h +3 -2
- esphome/components/hte501/hte501.cpp +3 -21
- esphome/components/hte501/hte501.h +2 -3
- esphome/components/http_request/ota/__init__.py +2 -2
- esphome/components/i2c/__init__.py +2 -2
- esphome/components/i2c/i2c.cpp +13 -9
- esphome/components/i2c/i2c_bus.h +36 -6
- esphome/components/i2s_audio/__init__.py +8 -2
- esphome/components/i2s_audio/media_player/__init__.py +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +1 -1
- esphome/components/i2s_audio/speaker/__init__.py +1 -1
- esphome/components/ina2xx_base/__init__.py +4 -2
- esphome/components/inkplate/__init__.py +1 -0
- esphome/components/inkplate/const.py +105 -0
- esphome/components/inkplate/display.py +238 -0
- esphome/components/{inkplate6 → inkplate}/inkplate.cpp +156 -74
- esphome/components/{inkplate6 → inkplate}/inkplate.h +28 -68
- esphome/components/inkplate6/__init__.py +0 -1
- esphome/components/inkplate6/display.py +2 -211
- esphome/components/integration/integration_sensor.cpp +1 -1
- esphome/components/json/__init__.py +2 -2
- esphome/components/lc709203f/lc709203f.cpp +4 -17
- esphome/components/lc709203f/lc709203f.h +2 -3
- esphome/components/ld2420/text_sensor/{text_sensor.cpp → ld2420_text_sensor.cpp} +1 -1
- esphome/components/ld2450/ld2450.cpp +1 -1
- esphome/components/libretiny/preferences.cpp +13 -5
- esphome/components/light/__init__.py +2 -2
- esphome/components/light/addressable_light_effect.h +7 -0
- esphome/components/light/base_light_effects.h +8 -0
- esphome/components/light/light_call.cpp +22 -20
- esphome/components/light/light_effect.cpp +36 -0
- esphome/components/light/light_effect.h +14 -0
- esphome/components/light/light_json_schema.cpp +9 -1
- esphome/components/light/light_state.cpp +2 -2
- esphome/components/light/light_state.h +38 -0
- esphome/components/lock/__init__.py +2 -2
- esphome/components/lock/lock.h +2 -2
- esphome/components/logger/__init__.py +2 -2
- esphome/components/logger/logger.cpp +25 -4
- esphome/components/logger/logger.h +1 -1
- esphome/components/logger/logger_esp32.cpp +16 -8
- esphome/components/logger/logger_esp8266.cpp +11 -3
- esphome/components/logger/logger_libretiny.cpp +13 -3
- esphome/components/logger/logger_rp2040.cpp +14 -3
- esphome/components/logger/logger_zephyr.cpp +15 -4
- esphome/components/lvgl/defines.py +1 -0
- esphome/components/lvgl/hello_world.py +96 -33
- esphome/components/lvgl/number/lvgl_number.h +1 -1
- esphome/components/lvgl/select/lvgl_select.h +1 -1
- esphome/components/lvgl/widgets/__init__.py +0 -1
- esphome/components/lvgl/widgets/spinbox.py +20 -11
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +1 -1
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +1 -1
- esphome/components/mapping/__init__.py +13 -5
- esphome/components/mapping/mapping.h +69 -0
- esphome/components/max17043/max17043.cpp +2 -2
- esphome/components/mcp23016/__init__.py +1 -0
- esphome/components/mcp23016/mcp23016.cpp +20 -5
- esphome/components/mcp23016/mcp23016.h +10 -4
- esphome/components/mcp23x08_base/mcp23x08_base.cpp +1 -1
- esphome/components/mcp23x17_base/mcp23x17_base.cpp +2 -2
- esphome/components/md5/md5.cpp +3 -2
- esphome/components/mdns/__init__.py +2 -2
- esphome/components/mdns/mdns_component.cpp +145 -54
- esphome/components/media_player/__init__.py +2 -2
- esphome/components/micro_wake_word/__init__.py +2 -2
- esphome/components/microphone/__init__.py +2 -2
- esphome/components/mipi/__init__.py +77 -33
- esphome/components/mipi_rgb/__init__.py +2 -0
- esphome/components/mipi_rgb/display.py +321 -0
- esphome/components/mipi_rgb/mipi_rgb.cpp +388 -0
- esphome/components/mipi_rgb/mipi_rgb.h +127 -0
- esphome/components/mipi_rgb/models/guition.py +24 -0
- esphome/components/mipi_rgb/models/lilygo.py +228 -0
- esphome/components/mipi_rgb/models/rpi.py +9 -0
- esphome/components/mipi_rgb/models/st7701s.py +214 -0
- esphome/components/mipi_rgb/models/waveshare.py +64 -0
- esphome/components/mipi_spi/models/jc.py +229 -0
- esphome/components/mlx90614/mlx90614.cpp +1 -16
- esphome/components/mlx90614/mlx90614.h +0 -1
- esphome/components/mqtt/__init__.py +2 -2
- esphome/components/mqtt/mqtt_sensor.cpp +7 -2
- esphome/components/ms5611/ms5611.cpp +7 -6
- esphome/components/network/__init__.py +2 -2
- esphome/components/nextion/nextion_upload.cpp +4 -1
- esphome/components/nrf52/__init__.py +49 -6
- esphome/components/nrf52/const.py +1 -0
- esphome/components/nrf52/dfu.cpp +51 -0
- esphome/components/nrf52/dfu.h +24 -0
- esphome/components/ntc/ntc.cpp +1 -1
- esphome/components/number/__init__.py +2 -2
- esphome/components/number/automation.cpp +1 -1
- esphome/components/number/number.cpp +21 -0
- esphome/components/number/number.h +4 -13
- esphome/components/opentherm/hub.h +6 -6
- esphome/components/opentherm/number/{number.cpp → opentherm_number.cpp} +2 -2
- esphome/components/opentherm/output/{output.cpp → opentherm_output.cpp} +1 -1
- esphome/components/opentherm/switch/{switch.cpp → opentherm_switch.cpp} +1 -1
- esphome/components/openthread/openthread.cpp +41 -7
- esphome/components/openthread/openthread.h +11 -0
- esphome/components/ota/__init__.py +2 -2
- esphome/components/pca6416a/__init__.py +1 -0
- esphome/components/pca6416a/pca6416a.cpp +20 -5
- esphome/components/pca6416a/pca6416a.h +12 -5
- esphome/components/pca9554/__init__.py +2 -1
- esphome/components/pca9554/pca9554.cpp +12 -18
- esphome/components/pca9554/pca9554.h +10 -9
- esphome/components/pcf8574/__init__.py +1 -0
- esphome/components/pcf8574/pcf8574.cpp +14 -5
- esphome/components/pcf8574/pcf8574.h +13 -6
- esphome/components/pi4ioe5v6408/pi4ioe5v6408.cpp +7 -7
- esphome/components/pipsolar/__init__.py +3 -3
- esphome/components/pipsolar/output/__init__.py +4 -4
- esphome/components/pulse_width/pulse_width.cpp +2 -2
- esphome/components/qmp6988/qmp6988.cpp +81 -126
- esphome/components/qmp6988/qmp6988.h +31 -37
- esphome/components/radon_eye_ble/__init__.py +2 -2
- esphome/components/remote_base/__init__.py +6 -8
- esphome/components/rotary_encoder/rotary_encoder.cpp +1 -1
- esphome/components/rp2040/__init__.py +2 -2
- esphome/components/runtime_stats/runtime_stats.cpp +10 -23
- esphome/components/runtime_stats/runtime_stats.h +4 -10
- esphome/components/safe_mode/__init__.py +2 -2
- esphome/components/safe_mode/safe_mode.cpp +33 -31
- esphome/components/script/script.cpp +6 -0
- esphome/components/script/script.h +19 -5
- esphome/components/sdm_meter/sensor.py +3 -1
- esphome/components/select/__init__.py +2 -2
- esphome/components/select/select.h +2 -2
- esphome/components/sen5x/sen5x.cpp +57 -55
- esphome/components/sen5x/sen5x.h +21 -15
- esphome/components/sen5x/sensor.py +67 -44
- esphome/components/sensirion_common/i2c_sensirion.cpp +18 -47
- esphome/components/sensirion_common/i2c_sensirion.h +39 -55
- esphome/components/sensor/__init__.py +2 -2
- esphome/components/sensor/automation.h +1 -1
- esphome/components/sensor/sensor.cpp +34 -6
- esphome/components/sensor/sensor.h +4 -21
- esphome/components/sgp30/sgp30.cpp +34 -35
- esphome/components/sgp30/sgp30.h +11 -10
- esphome/components/sgp4x/sgp4x.cpp +2 -2
- esphome/components/shelly_dimmer/light.py +7 -7
- esphome/components/sht4x/sht4x.cpp +1 -1
- esphome/components/sntp/sntp_component.cpp +36 -9
- esphome/components/sntp/sntp_component.h +7 -0
- esphome/components/sound_level/sound_level.cpp +1 -1
- esphome/components/speaker/__init__.py +2 -2
- esphome/components/speaker/media_player/__init__.py +2 -2
- esphome/components/speaker/media_player/speaker_media_player.cpp +1 -1
- esphome/components/spi/__init__.py +2 -2
- esphome/components/sprinkler/sprinkler.cpp +1 -1
- esphome/components/sps30/sps30.cpp +18 -23
- esphome/components/sps30/sps30.h +3 -3
- esphome/components/status_led/__init__.py +2 -2
- esphome/components/stepper/__init__.py +2 -2
- esphome/components/switch/__init__.py +2 -2
- esphome/components/switch/switch.cpp +5 -5
- esphome/components/sx1509/__init__.py +1 -1
- esphome/components/sx1509/sx1509.cpp +12 -7
- esphome/components/sx1509/sx1509.h +11 -4
- esphome/components/tca9555/tca9555.cpp +5 -5
- esphome/components/tee501/tee501.cpp +2 -21
- esphome/components/tee501/tee501.h +2 -4
- esphome/components/template/alarm_control_panel/template_alarm_control_panel.cpp +1 -1
- esphome/components/template/datetime/template_date.cpp +1 -1
- esphome/components/template/datetime/template_datetime.cpp +2 -2
- esphome/components/template/datetime/template_time.cpp +1 -1
- esphome/components/template/number/template_number.cpp +1 -1
- esphome/components/template/select/template_select.cpp +1 -1
- esphome/components/template/text/template_text.cpp +1 -1
- esphome/components/text/__init__.py +2 -2
- esphome/components/text/text.h +2 -2
- esphome/components/text_sensor/__init__.py +2 -2
- esphome/components/text_sensor/text_sensor.h +4 -4
- esphome/components/thermostat/climate.py +11 -7
- esphome/components/thermostat/thermostat_climate.cpp +237 -206
- esphome/components/thermostat/thermostat_climate.h +52 -41
- esphome/components/time/__init__.py +2 -2
- esphome/components/tmp1075/tmp1075.cpp +1 -1
- esphome/components/total_daily_energy/total_daily_energy.cpp +1 -1
- esphome/components/touchscreen/__init__.py +2 -2
- esphome/components/tuya/number/tuya_number.cpp +1 -1
- esphome/components/udp/udp_component.cpp +3 -3
- esphome/components/ufire_ec/ufire_ec.cpp +4 -4
- esphome/components/ufire_ise/ufire_ise.cpp +4 -4
- esphome/components/update/__init__.py +2 -2
- esphome/components/usb_uart/usb_uart.cpp +1 -1
- esphome/components/valve/__init__.py +5 -5
- esphome/components/valve/valve.cpp +1 -1
- esphome/components/valve/valve.h +2 -2
- esphome/components/wake_on_lan/wake_on_lan.cpp +2 -2
- esphome/components/waveshare_epaper/waveshare_213v3.cpp +1 -1
- esphome/components/web_server/__init__.py +2 -2
- esphome/components/web_server/ota/__init__.py +2 -2
- esphome/components/web_server/ota/ota_web_server.cpp +11 -0
- esphome/components/web_server/server_index_v2.h +149 -149
- esphome/components/web_server/web_server.cpp +58 -12
- esphome/components/web_server_base/__init__.py +2 -2
- esphome/components/wifi/__init__.py +5 -5
- esphome/components/wifi/wifi_component.cpp +4 -4
- esphome/components/wifi/wifi_component_esp_idf.cpp +2 -0
- esphome/components/wifi_info/wifi_info_text_sensor.h +3 -2
- esphome/config_validation.py +2 -2
- esphome/const.py +3 -1
- esphome/core/__init__.py +1 -0
- esphome/core/application.cpp +89 -51
- esphome/core/application.h +1 -0
- esphome/core/component.cpp +41 -19
- esphome/core/component.h +17 -13
- esphome/core/config.py +7 -7
- esphome/core/defines.h +4 -0
- esphome/core/entity_base.cpp +22 -8
- esphome/core/entity_base.h +43 -0
- esphome/core/helpers.cpp +34 -20
- esphome/core/helpers.h +33 -3
- esphome/core/ring_buffer.cpp +6 -2
- esphome/core/ring_buffer.h +2 -1
- esphome/core/scheduler.cpp +178 -97
- esphome/core/scheduler.h +67 -36
- esphome/core/time.cpp +6 -20
- esphome/coroutine.py +80 -3
- esphome/cpp_generator.py +13 -0
- esphome/cpp_helpers.py +2 -2
- esphome/dashboard/web_server.py +67 -10
- esphome/espota2.py +13 -6
- esphome/helpers.py +68 -83
- esphome/resolver.py +67 -0
- esphome/util.py +9 -6
- esphome/wizard.py +39 -26
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/METADATA +9 -9
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/RECORD +364 -333
- /esphome/components/ld2420/text_sensor/{text_sensor.h → ld2420_text_sensor.h} +0 -0
- /esphome/components/opentherm/number/{number.h → opentherm_number.h} +0 -0
- /esphome/components/opentherm/output/{output.h → opentherm_output.h} +0 -0
- /esphome/components/opentherm/switch/{switch.h → opentherm_switch.h} +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/WHEEL +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/entry_points.txt +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/licenses/LICENSE +0 -0
- {esphome-2025.8.4.dist-info → esphome-2025.9.0b2.dist-info}/top_level.txt +0 -0
@@ -18,14 +18,6 @@ static const uint8_t QMP6988_TEMPERATURE_MSB_REG = 0xFA; /* Temperature MSB Reg
|
|
18
18
|
static const uint8_t QMP6988_CALIBRATION_DATA_START = 0xA0; /* QMP6988 compensation coefficients */
|
19
19
|
static const uint8_t QMP6988_CALIBRATION_DATA_LENGTH = 25;
|
20
20
|
|
21
|
-
static const uint8_t SHIFT_RIGHT_4_POSITION = 4;
|
22
|
-
static const uint8_t SHIFT_LEFT_2_POSITION = 2;
|
23
|
-
static const uint8_t SHIFT_LEFT_4_POSITION = 4;
|
24
|
-
static const uint8_t SHIFT_LEFT_5_POSITION = 5;
|
25
|
-
static const uint8_t SHIFT_LEFT_8_POSITION = 8;
|
26
|
-
static const uint8_t SHIFT_LEFT_12_POSITION = 12;
|
27
|
-
static const uint8_t SHIFT_LEFT_16_POSITION = 16;
|
28
|
-
|
29
21
|
/* power mode */
|
30
22
|
static const uint8_t QMP6988_SLEEP_MODE = 0x00;
|
31
23
|
static const uint8_t QMP6988_FORCED_MODE = 0x01;
|
@@ -95,64 +87,45 @@ static const char *iir_filter_to_str(QMP6988IIRFilter filter) {
|
|
95
87
|
}
|
96
88
|
|
97
89
|
bool QMP6988Component::device_check_() {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if (ret != i2c::ERROR_OK) {
|
102
|
-
ESP_LOGE(TAG, "%s: read chip ID (0xD1) failed", __func__);
|
90
|
+
if (this->read_register(QMP6988_CHIP_ID_REG, &(qmp6988_data_.chip_id), 1) != i2c::ERROR_OK) {
|
91
|
+
ESP_LOGE(TAG, "Read chip ID (0xD1) failed");
|
92
|
+
return false;
|
103
93
|
}
|
104
|
-
|
94
|
+
ESP_LOGV(TAG, "Read chip ID = 0x%x", qmp6988_data_.chip_id);
|
105
95
|
|
106
96
|
return qmp6988_data_.chip_id == QMP6988_CHIP_ID;
|
107
97
|
}
|
108
98
|
|
109
99
|
bool QMP6988Component::get_calibration_data_() {
|
110
|
-
uint8_t status = 0;
|
111
100
|
// BITFIELDS temp_COE;
|
112
101
|
uint8_t a_data_uint8_tr[QMP6988_CALIBRATION_DATA_LENGTH] = {0};
|
113
|
-
int len;
|
114
102
|
|
115
|
-
for (len = 0; len < QMP6988_CALIBRATION_DATA_LENGTH; len += 1) {
|
116
|
-
|
117
|
-
|
118
|
-
ESP_LOGE(TAG, "qmp6988 read calibration data (0xA0) error!");
|
103
|
+
for (uint8_t len = 0; len < QMP6988_CALIBRATION_DATA_LENGTH; len += 1) {
|
104
|
+
if (this->read_register(QMP6988_CALIBRATION_DATA_START + len, &a_data_uint8_tr[len], 1) != i2c::ERROR_OK) {
|
105
|
+
ESP_LOGE(TAG, "Read calibration data (0xA0) error");
|
119
106
|
return false;
|
120
107
|
}
|
121
108
|
}
|
122
109
|
|
123
110
|
qmp6988_data_.qmp6988_cali.COE_a0 =
|
124
|
-
(
|
125
|
-
(a_data_uint8_tr[19] << SHIFT_LEFT_4_POSITION) | (a_data_uint8_tr[24] & 0x0f))
|
126
|
-
<< 12);
|
111
|
+
(int32_t) encode_uint32(a_data_uint8_tr[18], a_data_uint8_tr[19], (a_data_uint8_tr[24] & 0x0f) << 4, 0);
|
127
112
|
qmp6988_data_.qmp6988_cali.COE_a0 = qmp6988_data_.qmp6988_cali.COE_a0 >> 12;
|
128
113
|
|
129
|
-
qmp6988_data_.qmp6988_cali.COE_a1 =
|
130
|
-
|
131
|
-
qmp6988_data_.qmp6988_cali.COE_a2 =
|
132
|
-
(QMP6988_S16_t) (((a_data_uint8_tr[22]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[23]);
|
114
|
+
qmp6988_data_.qmp6988_cali.COE_a1 = (int16_t) encode_uint16(a_data_uint8_tr[20], a_data_uint8_tr[21]);
|
115
|
+
qmp6988_data_.qmp6988_cali.COE_a2 = (int16_t) encode_uint16(a_data_uint8_tr[22], a_data_uint8_tr[23]);
|
133
116
|
|
134
117
|
qmp6988_data_.qmp6988_cali.COE_b00 =
|
135
|
-
(
|
136
|
-
((a_data_uint8_tr[24] & 0xf0) >> SHIFT_RIGHT_4_POSITION))
|
137
|
-
<< 12);
|
118
|
+
(int32_t) encode_uint32(a_data_uint8_tr[0], a_data_uint8_tr[1], a_data_uint8_tr[24] & 0xf0, 0);
|
138
119
|
qmp6988_data_.qmp6988_cali.COE_b00 = qmp6988_data_.qmp6988_cali.COE_b00 >> 12;
|
139
120
|
|
140
|
-
qmp6988_data_.qmp6988_cali.COE_bt1 =
|
141
|
-
|
142
|
-
qmp6988_data_.qmp6988_cali.
|
143
|
-
|
144
|
-
qmp6988_data_.qmp6988_cali.
|
145
|
-
|
146
|
-
qmp6988_data_.qmp6988_cali.
|
147
|
-
|
148
|
-
qmp6988_data_.qmp6988_cali.COE_bp2 =
|
149
|
-
(QMP6988_S16_t) (((a_data_uint8_tr[10]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[11]);
|
150
|
-
qmp6988_data_.qmp6988_cali.COE_b12 =
|
151
|
-
(QMP6988_S16_t) (((a_data_uint8_tr[12]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[13]);
|
152
|
-
qmp6988_data_.qmp6988_cali.COE_b21 =
|
153
|
-
(QMP6988_S16_t) (((a_data_uint8_tr[14]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[15]);
|
154
|
-
qmp6988_data_.qmp6988_cali.COE_bp3 =
|
155
|
-
(QMP6988_S16_t) (((a_data_uint8_tr[16]) << SHIFT_LEFT_8_POSITION) | a_data_uint8_tr[17]);
|
121
|
+
qmp6988_data_.qmp6988_cali.COE_bt1 = (int16_t) encode_uint16(a_data_uint8_tr[2], a_data_uint8_tr[3]);
|
122
|
+
qmp6988_data_.qmp6988_cali.COE_bt2 = (int16_t) encode_uint16(a_data_uint8_tr[4], a_data_uint8_tr[5]);
|
123
|
+
qmp6988_data_.qmp6988_cali.COE_bp1 = (int16_t) encode_uint16(a_data_uint8_tr[6], a_data_uint8_tr[7]);
|
124
|
+
qmp6988_data_.qmp6988_cali.COE_b11 = (int16_t) encode_uint16(a_data_uint8_tr[8], a_data_uint8_tr[9]);
|
125
|
+
qmp6988_data_.qmp6988_cali.COE_bp2 = (int16_t) encode_uint16(a_data_uint8_tr[10], a_data_uint8_tr[11]);
|
126
|
+
qmp6988_data_.qmp6988_cali.COE_b12 = (int16_t) encode_uint16(a_data_uint8_tr[12], a_data_uint8_tr[13]);
|
127
|
+
qmp6988_data_.qmp6988_cali.COE_b21 = (int16_t) encode_uint16(a_data_uint8_tr[14], a_data_uint8_tr[15]);
|
128
|
+
qmp6988_data_.qmp6988_cali.COE_bp3 = (int16_t) encode_uint16(a_data_uint8_tr[16], a_data_uint8_tr[17]);
|
156
129
|
|
157
130
|
ESP_LOGV(TAG, "<-----------calibration data-------------->\r\n");
|
158
131
|
ESP_LOGV(TAG, "COE_a0[%d] COE_a1[%d] COE_a2[%d] COE_b00[%d]\r\n", qmp6988_data_.qmp6988_cali.COE_a0,
|
@@ -166,17 +139,17 @@ bool QMP6988Component::get_calibration_data_() {
|
|
166
139
|
qmp6988_data_.ik.a0 = qmp6988_data_.qmp6988_cali.COE_a0; // 20Q4
|
167
140
|
qmp6988_data_.ik.b00 = qmp6988_data_.qmp6988_cali.COE_b00; // 20Q4
|
168
141
|
|
169
|
-
qmp6988_data_.ik.a1 = 3608L * (
|
170
|
-
qmp6988_data_.ik.a2 = 16889L * (
|
171
|
-
|
172
|
-
qmp6988_data_.ik.bt1 = 2982L * (
|
173
|
-
qmp6988_data_.ik.bt2 = 329854L * (
|
174
|
-
qmp6988_data_.ik.bp1 = 19923L * (
|
175
|
-
qmp6988_data_.ik.b11 = 2406L * (
|
176
|
-
qmp6988_data_.ik.bp2 = 3079L * (
|
177
|
-
qmp6988_data_.ik.b12 = 6846L * (
|
178
|
-
qmp6988_data_.ik.b21 = 13836L * (
|
179
|
-
qmp6988_data_.ik.bp3 = 2915L * (
|
142
|
+
qmp6988_data_.ik.a1 = 3608L * (int32_t) qmp6988_data_.qmp6988_cali.COE_a1 - 1731677965L; // 31Q23
|
143
|
+
qmp6988_data_.ik.a2 = 16889L * (int32_t) qmp6988_data_.qmp6988_cali.COE_a2 - 87619360L; // 30Q47
|
144
|
+
|
145
|
+
qmp6988_data_.ik.bt1 = 2982L * (int64_t) qmp6988_data_.qmp6988_cali.COE_bt1 + 107370906L; // 28Q15
|
146
|
+
qmp6988_data_.ik.bt2 = 329854L * (int64_t) qmp6988_data_.qmp6988_cali.COE_bt2 + 108083093L; // 34Q38
|
147
|
+
qmp6988_data_.ik.bp1 = 19923L * (int64_t) qmp6988_data_.qmp6988_cali.COE_bp1 + 1133836764L; // 31Q20
|
148
|
+
qmp6988_data_.ik.b11 = 2406L * (int64_t) qmp6988_data_.qmp6988_cali.COE_b11 + 118215883L; // 28Q34
|
149
|
+
qmp6988_data_.ik.bp2 = 3079L * (int64_t) qmp6988_data_.qmp6988_cali.COE_bp2 - 181579595L; // 29Q43
|
150
|
+
qmp6988_data_.ik.b12 = 6846L * (int64_t) qmp6988_data_.qmp6988_cali.COE_b12 + 85590281L; // 29Q53
|
151
|
+
qmp6988_data_.ik.b21 = 13836L * (int64_t) qmp6988_data_.qmp6988_cali.COE_b21 + 79333336L; // 29Q60
|
152
|
+
qmp6988_data_.ik.bp3 = 2915L * (int64_t) qmp6988_data_.qmp6988_cali.COE_bp3 + 157155561L; // 28Q65
|
180
153
|
ESP_LOGV(TAG, "<----------- int calibration data -------------->\r\n");
|
181
154
|
ESP_LOGV(TAG, "a0[%d] a1[%d] a2[%d] b00[%d]\r\n", qmp6988_data_.ik.a0, qmp6988_data_.ik.a1, qmp6988_data_.ik.a2,
|
182
155
|
qmp6988_data_.ik.b00);
|
@@ -188,55 +161,55 @@ bool QMP6988Component::get_calibration_data_() {
|
|
188
161
|
return true;
|
189
162
|
}
|
190
163
|
|
191
|
-
|
192
|
-
|
193
|
-
|
164
|
+
int16_t QMP6988Component::get_compensated_temperature_(qmp6988_ik_data_t *ik, int32_t dt) {
|
165
|
+
int16_t ret;
|
166
|
+
int64_t wk1, wk2;
|
194
167
|
|
195
168
|
// wk1: 60Q4 // bit size
|
196
|
-
wk1 = ((
|
197
|
-
wk2 = ((
|
198
|
-
wk2 = (wk2 * (
|
199
|
-
wk2 = ((wk1 + wk2) / 32767) >> 19;
|
200
|
-
ret = (
|
169
|
+
wk1 = ((int64_t) ik->a1 * (int64_t) dt); // 31Q23+24-1=54 (54Q23)
|
170
|
+
wk2 = ((int64_t) ik->a2 * (int64_t) dt) >> 14; // 30Q47+24-1=53 (39Q33)
|
171
|
+
wk2 = (wk2 * (int64_t) dt) >> 10; // 39Q33+24-1=62 (52Q23)
|
172
|
+
wk2 = ((wk1 + wk2) / 32767) >> 19; // 54,52->55Q23 (20Q04)
|
173
|
+
ret = (int16_t) ((ik->a0 + wk2) >> 4); // 21Q4 -> 17Q0
|
201
174
|
return ret;
|
202
175
|
}
|
203
176
|
|
204
|
-
|
205
|
-
|
206
|
-
|
177
|
+
int32_t QMP6988Component::get_compensated_pressure_(qmp6988_ik_data_t *ik, int32_t dp, int16_t tx) {
|
178
|
+
int32_t ret;
|
179
|
+
int64_t wk1, wk2, wk3;
|
207
180
|
|
208
181
|
// wk1 = 48Q16 // bit size
|
209
|
-
wk1 = ((
|
210
|
-
wk2 = ((
|
211
|
-
wk1 += wk2;
|
212
|
-
wk2 = ((
|
213
|
-
wk2 = (wk2 * (
|
214
|
-
wk3 = wk2;
|
215
|
-
wk2 = ((
|
216
|
-
wk2 = (wk2 * (
|
217
|
-
wk3 += wk2;
|
218
|
-
wk2 = ((
|
219
|
-
wk2 = (wk2 * (
|
220
|
-
wk3 += wk2;
|
221
|
-
wk1 += wk3 >> 14;
|
222
|
-
wk2 = ((
|
223
|
-
wk2 = (wk2 * (
|
224
|
-
wk2 = (wk2 * (
|
225
|
-
wk3 = wk2;
|
226
|
-
wk2 = ((
|
227
|
-
wk2 = (wk2 * (
|
228
|
-
wk2 = (wk2 * (
|
229
|
-
wk3 += wk2;
|
230
|
-
wk2 = ((
|
231
|
-
wk2 = (wk2 * (
|
232
|
-
wk2 = (wk2 * (
|
233
|
-
wk3 += wk2;
|
234
|
-
wk1 += wk3 >> 15;
|
182
|
+
wk1 = ((int64_t) ik->bt1 * (int64_t) tx); // 28Q15+16-1=43 (43Q15)
|
183
|
+
wk2 = ((int64_t) ik->bp1 * (int64_t) dp) >> 5; // 31Q20+24-1=54 (49Q15)
|
184
|
+
wk1 += wk2; // 43,49->50Q15
|
185
|
+
wk2 = ((int64_t) ik->bt2 * (int64_t) tx) >> 1; // 34Q38+16-1=49 (48Q37)
|
186
|
+
wk2 = (wk2 * (int64_t) tx) >> 8; // 48Q37+16-1=63 (55Q29)
|
187
|
+
wk3 = wk2; // 55Q29
|
188
|
+
wk2 = ((int64_t) ik->b11 * (int64_t) tx) >> 4; // 28Q34+16-1=43 (39Q30)
|
189
|
+
wk2 = (wk2 * (int64_t) dp) >> 1; // 39Q30+24-1=62 (61Q29)
|
190
|
+
wk3 += wk2; // 55,61->62Q29
|
191
|
+
wk2 = ((int64_t) ik->bp2 * (int64_t) dp) >> 13; // 29Q43+24-1=52 (39Q30)
|
192
|
+
wk2 = (wk2 * (int64_t) dp) >> 1; // 39Q30+24-1=62 (61Q29)
|
193
|
+
wk3 += wk2; // 62,61->63Q29
|
194
|
+
wk1 += wk3 >> 14; // Q29 >> 14 -> Q15
|
195
|
+
wk2 = ((int64_t) ik->b12 * (int64_t) tx); // 29Q53+16-1=45 (45Q53)
|
196
|
+
wk2 = (wk2 * (int64_t) tx) >> 22; // 45Q53+16-1=61 (39Q31)
|
197
|
+
wk2 = (wk2 * (int64_t) dp) >> 1; // 39Q31+24-1=62 (61Q30)
|
198
|
+
wk3 = wk2; // 61Q30
|
199
|
+
wk2 = ((int64_t) ik->b21 * (int64_t) tx) >> 6; // 29Q60+16-1=45 (39Q54)
|
200
|
+
wk2 = (wk2 * (int64_t) dp) >> 23; // 39Q54+24-1=62 (39Q31)
|
201
|
+
wk2 = (wk2 * (int64_t) dp) >> 1; // 39Q31+24-1=62 (61Q20)
|
202
|
+
wk3 += wk2; // 61,61->62Q30
|
203
|
+
wk2 = ((int64_t) ik->bp3 * (int64_t) dp) >> 12; // 28Q65+24-1=51 (39Q53)
|
204
|
+
wk2 = (wk2 * (int64_t) dp) >> 23; // 39Q53+24-1=62 (39Q30)
|
205
|
+
wk2 = (wk2 * (int64_t) dp); // 39Q30+24-1=62 (62Q30)
|
206
|
+
wk3 += wk2; // 62,62->63Q30
|
207
|
+
wk1 += wk3 >> 15; // Q30 >> 15 = Q15
|
235
208
|
wk1 /= 32767L;
|
236
209
|
wk1 >>= 11; // Q15 >> 7 = Q4
|
237
210
|
wk1 += ik->b00; // Q4 + 20Q4
|
238
211
|
// wk1 >>= 4; // 28Q4 -> 24Q0
|
239
|
-
ret = (
|
212
|
+
ret = (int32_t) wk1;
|
240
213
|
return ret;
|
241
214
|
}
|
242
215
|
|
@@ -274,7 +247,7 @@ void QMP6988Component::set_power_mode_(uint8_t power_mode) {
|
|
274
247
|
delay(10);
|
275
248
|
}
|
276
249
|
|
277
|
-
void QMP6988Component::write_filter_(
|
250
|
+
void QMP6988Component::write_filter_(QMP6988IIRFilter filter) {
|
278
251
|
uint8_t data;
|
279
252
|
|
280
253
|
data = (filter & 0x03);
|
@@ -282,7 +255,7 @@ void QMP6988Component::write_filter_(unsigned char filter) {
|
|
282
255
|
delay(10);
|
283
256
|
}
|
284
257
|
|
285
|
-
void QMP6988Component::write_oversampling_pressure_(
|
258
|
+
void QMP6988Component::write_oversampling_pressure_(QMP6988Oversampling oversampling_p) {
|
286
259
|
uint8_t data;
|
287
260
|
|
288
261
|
this->read_register(QMP6988_CTRLMEAS_REG, &data, 1);
|
@@ -292,7 +265,7 @@ void QMP6988Component::write_oversampling_pressure_(unsigned char oversampling_p
|
|
292
265
|
delay(10);
|
293
266
|
}
|
294
267
|
|
295
|
-
void QMP6988Component::write_oversampling_temperature_(
|
268
|
+
void QMP6988Component::write_oversampling_temperature_(QMP6988Oversampling oversampling_t) {
|
296
269
|
uint8_t data;
|
297
270
|
|
298
271
|
this->read_register(QMP6988_CTRLMEAS_REG, &data, 1);
|
@@ -302,16 +275,6 @@ void QMP6988Component::write_oversampling_temperature_(unsigned char oversamplin
|
|
302
275
|
delay(10);
|
303
276
|
}
|
304
277
|
|
305
|
-
void QMP6988Component::set_temperature_oversampling(QMP6988Oversampling oversampling_t) {
|
306
|
-
this->temperature_oversampling_ = oversampling_t;
|
307
|
-
}
|
308
|
-
|
309
|
-
void QMP6988Component::set_pressure_oversampling(QMP6988Oversampling oversampling_p) {
|
310
|
-
this->pressure_oversampling_ = oversampling_p;
|
311
|
-
}
|
312
|
-
|
313
|
-
void QMP6988Component::set_iir_filter(QMP6988IIRFilter iirfilter) { this->iir_filter_ = iirfilter; }
|
314
|
-
|
315
278
|
void QMP6988Component::calculate_altitude_(float pressure, float temp) {
|
316
279
|
float altitude;
|
317
280
|
altitude = (pow((101325 / pressure), 1 / 5.257) - 1) * (temp + 273.15) / 0.0065;
|
@@ -320,10 +283,10 @@ void QMP6988Component::calculate_altitude_(float pressure, float temp) {
|
|
320
283
|
|
321
284
|
void QMP6988Component::calculate_pressure_() {
|
322
285
|
uint8_t err = 0;
|
323
|
-
|
324
|
-
|
286
|
+
uint32_t p_read, t_read;
|
287
|
+
int32_t p_raw, t_raw;
|
325
288
|
uint8_t a_data_uint8_tr[6] = {0};
|
326
|
-
|
289
|
+
int32_t t_int, p_int;
|
327
290
|
this->qmp6988_data_.temperature = 0;
|
328
291
|
this->qmp6988_data_.pressure = 0;
|
329
292
|
|
@@ -332,13 +295,11 @@ void QMP6988Component::calculate_pressure_() {
|
|
332
295
|
ESP_LOGE(TAG, "Error reading raw pressure/temp values");
|
333
296
|
return;
|
334
297
|
}
|
335
|
-
p_read = (
|
336
|
-
|
337
|
-
p_raw = (QMP6988_S32_t) (p_read - SUBTRACTOR);
|
298
|
+
p_read = encode_uint24(a_data_uint8_tr[0], a_data_uint8_tr[1], a_data_uint8_tr[2]);
|
299
|
+
p_raw = (int32_t) (p_read - SUBTRACTOR);
|
338
300
|
|
339
|
-
t_read = (
|
340
|
-
|
341
|
-
t_raw = (QMP6988_S32_t) (t_read - SUBTRACTOR);
|
301
|
+
t_read = encode_uint24(a_data_uint8_tr[3], a_data_uint8_tr[4], a_data_uint8_tr[5]);
|
302
|
+
t_raw = (int32_t) (t_read - SUBTRACTOR);
|
342
303
|
|
343
304
|
t_int = this->get_compensated_temperature_(&(qmp6988_data_.ik), t_raw);
|
344
305
|
p_int = this->get_compensated_pressure_(&(qmp6988_data_.ik), p_raw, t_int);
|
@@ -348,10 +309,9 @@ void QMP6988Component::calculate_pressure_() {
|
|
348
309
|
}
|
349
310
|
|
350
311
|
void QMP6988Component::setup() {
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
ESP_LOGCONFIG(TAG, "Setup failed - device not found");
|
312
|
+
if (!this->device_check_()) {
|
313
|
+
this->mark_failed(ESP_LOG_MSG_COMM_FAIL);
|
314
|
+
return;
|
355
315
|
}
|
356
316
|
|
357
317
|
this->software_reset_();
|
@@ -365,9 +325,6 @@ void QMP6988Component::setup() {
|
|
365
325
|
void QMP6988Component::dump_config() {
|
366
326
|
ESP_LOGCONFIG(TAG, "QMP6988:");
|
367
327
|
LOG_I2C_DEVICE(this);
|
368
|
-
if (this->is_failed()) {
|
369
|
-
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
|
370
|
-
}
|
371
328
|
LOG_UPDATE_INTERVAL(this);
|
372
329
|
|
373
330
|
LOG_SENSOR(" ", "Temperature", this->temperature_sensor_);
|
@@ -377,8 +334,6 @@ void QMP6988Component::dump_config() {
|
|
377
334
|
ESP_LOGCONFIG(TAG, " IIR Filter: %s", iir_filter_to_str(this->iir_filter_));
|
378
335
|
}
|
379
336
|
|
380
|
-
float QMP6988Component::get_setup_priority() const { return setup_priority::DATA; }
|
381
|
-
|
382
337
|
void QMP6988Component::update() {
|
383
338
|
this->calculate_pressure_();
|
384
339
|
float pressurehectopascals = this->qmp6988_data_.pressure / 100;
|
@@ -1,24 +1,17 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#include "esphome/components/i2c/i2c.h"
|
4
|
+
#include "esphome/components/sensor/sensor.h"
|
3
5
|
#include "esphome/core/component.h"
|
4
6
|
#include "esphome/core/hal.h"
|
5
7
|
#include "esphome/core/helpers.h"
|
6
8
|
#include "esphome/core/log.h"
|
7
|
-
#include "esphome/components/sensor/sensor.h"
|
8
|
-
#include "esphome/components/i2c/i2c.h"
|
9
9
|
|
10
10
|
namespace esphome {
|
11
11
|
namespace qmp6988 {
|
12
12
|
|
13
|
-
#define QMP6988_U16_t unsigned short
|
14
|
-
#define QMP6988_S16_t short
|
15
|
-
#define QMP6988_U32_t unsigned int
|
16
|
-
#define QMP6988_S32_t int
|
17
|
-
#define QMP6988_U64_t unsigned long long
|
18
|
-
#define QMP6988_S64_t long long
|
19
|
-
|
20
13
|
/* oversampling */
|
21
|
-
enum QMP6988Oversampling {
|
14
|
+
enum QMP6988Oversampling : uint8_t {
|
22
15
|
QMP6988_OVERSAMPLING_SKIPPED = 0x00,
|
23
16
|
QMP6988_OVERSAMPLING_1X = 0x01,
|
24
17
|
QMP6988_OVERSAMPLING_2X = 0x02,
|
@@ -30,7 +23,7 @@ enum QMP6988Oversampling {
|
|
30
23
|
};
|
31
24
|
|
32
25
|
/* filter */
|
33
|
-
enum QMP6988IIRFilter {
|
26
|
+
enum QMP6988IIRFilter : uint8_t {
|
34
27
|
QMP6988_IIR_FILTER_OFF = 0x00,
|
35
28
|
QMP6988_IIR_FILTER_2X = 0x01,
|
36
29
|
QMP6988_IIR_FILTER_4X = 0x02,
|
@@ -40,18 +33,18 @@ enum QMP6988IIRFilter {
|
|
40
33
|
};
|
41
34
|
|
42
35
|
using qmp6988_cali_data_t = struct Qmp6988CaliData {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
36
|
+
int32_t COE_a0;
|
37
|
+
int16_t COE_a1;
|
38
|
+
int16_t COE_a2;
|
39
|
+
int32_t COE_b00;
|
40
|
+
int16_t COE_bt1;
|
41
|
+
int16_t COE_bt2;
|
42
|
+
int16_t COE_bp1;
|
43
|
+
int16_t COE_b11;
|
44
|
+
int16_t COE_bp2;
|
45
|
+
int16_t COE_b12;
|
46
|
+
int16_t COE_b21;
|
47
|
+
int16_t COE_bp3;
|
55
48
|
};
|
56
49
|
|
57
50
|
using qmp6988_fk_data_t = struct Qmp6988FkData {
|
@@ -60,9 +53,9 @@ using qmp6988_fk_data_t = struct Qmp6988FkData {
|
|
60
53
|
};
|
61
54
|
|
62
55
|
using qmp6988_ik_data_t = struct Qmp6988IkData {
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
int32_t a0, b00;
|
57
|
+
int32_t a1, a2;
|
58
|
+
int64_t bt1, bt2, bp1, b11, bp2, b12, b21, bp3;
|
66
59
|
};
|
67
60
|
|
68
61
|
using qmp6988_data_t = struct Qmp6988Data {
|
@@ -77,17 +70,18 @@ using qmp6988_data_t = struct Qmp6988Data {
|
|
77
70
|
|
78
71
|
class QMP6988Component : public PollingComponent, public i2c::I2CDevice {
|
79
72
|
public:
|
80
|
-
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
|
81
|
-
void set_pressure_sensor(sensor::Sensor *pressure_sensor) { pressure_sensor_ = pressure_sensor; }
|
73
|
+
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
|
74
|
+
void set_pressure_sensor(sensor::Sensor *pressure_sensor) { this->pressure_sensor_ = pressure_sensor; }
|
82
75
|
|
83
76
|
void setup() override;
|
84
77
|
void dump_config() override;
|
85
|
-
float get_setup_priority() const override;
|
86
78
|
void update() override;
|
87
79
|
|
88
|
-
void set_iir_filter(QMP6988IIRFilter iirfilter);
|
89
|
-
void set_temperature_oversampling(QMP6988Oversampling oversampling_t)
|
90
|
-
|
80
|
+
void set_iir_filter(QMP6988IIRFilter iirfilter) { this->iir_filter_ = iirfilter; }
|
81
|
+
void set_temperature_oversampling(QMP6988Oversampling oversampling_t) {
|
82
|
+
this->temperature_oversampling_ = oversampling_t;
|
83
|
+
}
|
84
|
+
void set_pressure_oversampling(QMP6988Oversampling oversampling_p) { this->pressure_oversampling_ = oversampling_p; }
|
91
85
|
|
92
86
|
protected:
|
93
87
|
qmp6988_data_t qmp6988_data_;
|
@@ -102,14 +96,14 @@ class QMP6988Component : public PollingComponent, public i2c::I2CDevice {
|
|
102
96
|
bool get_calibration_data_();
|
103
97
|
bool device_check_();
|
104
98
|
void set_power_mode_(uint8_t power_mode);
|
105
|
-
void write_oversampling_temperature_(
|
106
|
-
void write_oversampling_pressure_(
|
107
|
-
void write_filter_(
|
99
|
+
void write_oversampling_temperature_(QMP6988Oversampling oversampling_t);
|
100
|
+
void write_oversampling_pressure_(QMP6988Oversampling oversampling_p);
|
101
|
+
void write_filter_(QMP6988IIRFilter filter);
|
108
102
|
void calculate_pressure_();
|
109
103
|
void calculate_altitude_(float pressure, float temp);
|
110
104
|
|
111
|
-
|
112
|
-
|
105
|
+
int32_t get_compensated_pressure_(qmp6988_ik_data_t *ik, int32_t dp, int16_t tx);
|
106
|
+
int16_t get_compensated_temperature_(qmp6988_ik_data_t *ik, int32_t dt);
|
113
107
|
};
|
114
108
|
|
115
109
|
} // namespace qmp6988
|
@@ -18,6 +18,6 @@ CONFIG_SCHEMA = cv.Schema(
|
|
18
18
|
).extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
|
19
19
|
|
20
20
|
|
21
|
-
def to_code(config):
|
21
|
+
async def to_code(config):
|
22
22
|
var = cg.new_Pvariable(config[CONF_ID])
|
23
|
-
|
23
|
+
await esp32_ble_tracker.register_ble_device(var, config)
|
@@ -1782,14 +1782,12 @@ def nexa_dumper(var, config):
|
|
1782
1782
|
|
1783
1783
|
|
1784
1784
|
@register_action("nexa", NexaAction, NEXA_SCHEMA)
|
1785
|
-
def nexa_action(var, config, args):
|
1786
|
-
cg.add(var.set_device(
|
1787
|
-
cg.add(var.set_group(
|
1788
|
-
cg.add(var.set_state(
|
1789
|
-
cg.add(
|
1790
|
-
|
1791
|
-
)
|
1792
|
-
cg.add(var.set_level((yield cg.templatable(config[CONF_LEVEL], args, cg.uint8))))
|
1785
|
+
async def nexa_action(var, config, args):
|
1786
|
+
cg.add(var.set_device(await cg.templatable(config[CONF_DEVICE], args, cg.uint32)))
|
1787
|
+
cg.add(var.set_group(await cg.templatable(config[CONF_GROUP], args, cg.uint8)))
|
1788
|
+
cg.add(var.set_state(await cg.templatable(config[CONF_STATE], args, cg.uint8)))
|
1789
|
+
cg.add(var.set_channel(await cg.templatable(config[CONF_CHANNEL], args, cg.uint8)))
|
1790
|
+
cg.add(var.set_level(await cg.templatable(config[CONF_LEVEL], args, cg.uint8)))
|
1793
1791
|
|
1794
1792
|
|
1795
1793
|
# Midea
|
@@ -132,7 +132,7 @@ void RotaryEncoderSensor::setup() {
|
|
132
132
|
int32_t initial_value = 0;
|
133
133
|
switch (this->restore_mode_) {
|
134
134
|
case ROTARY_ENCODER_RESTORE_DEFAULT_ZERO:
|
135
|
-
this->rtc_ = global_preferences->make_preference<int32_t>(this->
|
135
|
+
this->rtc_ = global_preferences->make_preference<int32_t>(this->get_preference_hash());
|
136
136
|
if (!this->rtc_.load(&initial_value)) {
|
137
137
|
initial_value = 0;
|
138
138
|
}
|
@@ -18,7 +18,7 @@ from esphome.const import (
|
|
18
18
|
PLATFORM_RP2040,
|
19
19
|
ThreadModel,
|
20
20
|
)
|
21
|
-
from esphome.core import CORE, EsphomeError, coroutine_with_priority
|
21
|
+
from esphome.core import CORE, CoroPriority, EsphomeError, coroutine_with_priority
|
22
22
|
from esphome.helpers import copy_file_if_changed, mkdir_p, read_file, write_file
|
23
23
|
|
24
24
|
from .const import KEY_BOARD, KEY_PIO_FILES, KEY_RP2040, rp2040_ns
|
@@ -159,7 +159,7 @@ CONFIG_SCHEMA = cv.All(
|
|
159
159
|
)
|
160
160
|
|
161
161
|
|
162
|
-
@coroutine_with_priority(
|
162
|
+
@coroutine_with_priority(CoroPriority.PLATFORM)
|
163
163
|
async def to_code(config):
|
164
164
|
cg.add(rp2040_ns.setup_preferences())
|
165
165
|
|
@@ -17,16 +17,8 @@ void RuntimeStatsCollector::record_component_time(Component *component, uint32_t
|
|
17
17
|
if (component == nullptr)
|
18
18
|
return;
|
19
19
|
|
20
|
-
//
|
21
|
-
|
22
|
-
if (name_it == this->component_names_cache_.end()) {
|
23
|
-
// First time seeing this component, cache its name
|
24
|
-
const char *source = component->get_component_source();
|
25
|
-
this->component_names_cache_[component] = source;
|
26
|
-
this->component_stats_[source].record_time(duration_ms);
|
27
|
-
} else {
|
28
|
-
this->component_stats_[name_it->second].record_time(duration_ms);
|
29
|
-
}
|
20
|
+
// Record stats using component pointer as key
|
21
|
+
this->component_stats_[component].record_time(duration_ms);
|
30
22
|
|
31
23
|
if (this->next_log_time_ == 0) {
|
32
24
|
this->next_log_time_ = current_time + this->log_interval_;
|
@@ -42,9 +34,10 @@ void RuntimeStatsCollector::log_stats_() {
|
|
42
34
|
std::vector<ComponentStatPair> stats_to_display;
|
43
35
|
|
44
36
|
for (const auto &it : this->component_stats_) {
|
37
|
+
Component *component = it.first;
|
45
38
|
const ComponentRuntimeStats &stats = it.second;
|
46
39
|
if (stats.get_period_count() > 0) {
|
47
|
-
ComponentStatPair pair = {
|
40
|
+
ComponentStatPair pair = {component, &stats};
|
48
41
|
stats_to_display.push_back(pair);
|
49
42
|
}
|
50
43
|
}
|
@@ -54,12 +47,9 @@ void RuntimeStatsCollector::log_stats_() {
|
|
54
47
|
|
55
48
|
// Log top components by period runtime
|
56
49
|
for (const auto &it : stats_to_display) {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
ESP_LOGI(TAG, " %s: count=%" PRIu32 ", avg=%.2fms, max=%" PRIu32 "ms, total=%" PRIu32 "ms", source,
|
61
|
-
stats->get_period_count(), stats->get_period_avg_time_ms(), stats->get_period_max_time_ms(),
|
62
|
-
stats->get_period_time_ms());
|
50
|
+
ESP_LOGI(TAG, " %s: count=%" PRIu32 ", avg=%.2fms, max=%" PRIu32 "ms, total=%" PRIu32 "ms",
|
51
|
+
LOG_STR_ARG(it.component->get_component_log_str()), it.stats->get_period_count(),
|
52
|
+
it.stats->get_period_avg_time_ms(), it.stats->get_period_max_time_ms(), it.stats->get_period_time_ms());
|
63
53
|
}
|
64
54
|
|
65
55
|
// Log total stats since boot
|
@@ -72,12 +62,9 @@ void RuntimeStatsCollector::log_stats_() {
|
|
72
62
|
});
|
73
63
|
|
74
64
|
for (const auto &it : stats_to_display) {
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
ESP_LOGI(TAG, " %s: count=%" PRIu32 ", avg=%.2fms, max=%" PRIu32 "ms, total=%" PRIu32 "ms", source,
|
79
|
-
stats->get_total_count(), stats->get_total_avg_time_ms(), stats->get_total_max_time_ms(),
|
80
|
-
stats->get_total_time_ms());
|
65
|
+
ESP_LOGI(TAG, " %s: count=%" PRIu32 ", avg=%.2fms, max=%" PRIu32 "ms, total=%" PRIu32 "ms",
|
66
|
+
LOG_STR_ARG(it.component->get_component_log_str()), it.stats->get_total_count(),
|
67
|
+
it.stats->get_total_avg_time_ms(), it.stats->get_total_max_time_ms(), it.stats->get_total_time_ms());
|
81
68
|
}
|
82
69
|
}
|
83
70
|
|
@@ -79,7 +79,7 @@ class ComponentRuntimeStats {
|
|
79
79
|
|
80
80
|
// For sorting components by run time
|
81
81
|
struct ComponentStatPair {
|
82
|
-
|
82
|
+
Component *component;
|
83
83
|
const ComponentRuntimeStats *stats;
|
84
84
|
|
85
85
|
bool operator>(const ComponentStatPair &other) const {
|
@@ -109,15 +109,9 @@ class RuntimeStatsCollector {
|
|
109
109
|
}
|
110
110
|
}
|
111
111
|
|
112
|
-
//
|
113
|
-
//
|
114
|
-
|
115
|
-
// causing identical component names at different addresses to be treated as different keys
|
116
|
-
struct CStrCompare {
|
117
|
-
bool operator()(const char *a, const char *b) const { return std::strcmp(a, b) < 0; }
|
118
|
-
};
|
119
|
-
std::map<const char *, ComponentRuntimeStats, CStrCompare> component_stats_;
|
120
|
-
std::map<Component *, const char *> component_names_cache_;
|
112
|
+
// Map from component to its stats
|
113
|
+
// We use Component* as the key since each component is unique
|
114
|
+
std::map<Component *, ComponentRuntimeStats> component_stats_;
|
121
115
|
uint32_t log_interval_;
|
122
116
|
uint32_t next_log_time_;
|
123
117
|
};
|
@@ -10,7 +10,7 @@ from esphome.const import (
|
|
10
10
|
CONF_TRIGGER_ID,
|
11
11
|
KEY_PAST_SAFE_MODE,
|
12
12
|
)
|
13
|
-
from esphome.core import CORE, coroutine_with_priority
|
13
|
+
from esphome.core import CORE, CoroPriority, coroutine_with_priority
|
14
14
|
from esphome.cpp_generator import RawExpression
|
15
15
|
|
16
16
|
CODEOWNERS = ["@paulmonigatti", "@jsuanet", "@kbx81"]
|
@@ -53,7 +53,7 @@ CONFIG_SCHEMA = cv.All(
|
|
53
53
|
)
|
54
54
|
|
55
55
|
|
56
|
-
@coroutine_with_priority(
|
56
|
+
@coroutine_with_priority(CoroPriority.APPLICATION)
|
57
57
|
async def to_code(config):
|
58
58
|
if not config[CONF_DISABLED]:
|
59
59
|
var = cg.new_Pvariable(config[CONF_ID])
|