esphome 2024.8.2__py3-none-any.whl → 2024.9.0__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 +6 -2
- esphome/components/api/api_connection.cpp +53 -0
- esphome/components/api/api_connection.h +4 -0
- esphome/components/api/api_pb2.cpp +280 -0
- esphome/components/api/api_pb2.h +91 -0
- esphome/components/api/api_pb2_service.cpp +85 -0
- esphome/components/api/api_pb2_service.h +28 -0
- esphome/components/async_tcp/__init__.py +3 -3
- esphome/components/atm90e26/sensor.py +10 -10
- esphome/components/atm90e32/sensor.py +1 -1
- esphome/components/bl0906/__init__.py +1 -0
- esphome/components/bl0906/bl0906.cpp +238 -0
- esphome/components/bl0906/bl0906.h +96 -0
- esphome/components/bl0906/const.py +4 -0
- esphome/components/bl0906/constants.h +122 -0
- esphome/components/bl0906/sensor.py +184 -0
- esphome/components/bl0942/__init__.py +1 -1
- esphome/components/bl0942/bl0942.cpp +127 -34
- esphome/components/bl0942/bl0942.h +87 -3
- esphome/components/bl0942/sensor.py +46 -8
- esphome/components/ble_client/__init__.py +1 -3
- esphome/components/ble_presence/binary_sensor.py +2 -2
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
- esphome/components/bmp280/sensor.py +2 -93
- esphome/components/bmp280_base/__init__.py +88 -0
- esphome/components/{bmp280/bmp280.cpp → bmp280_base/bmp280_base.cpp} +11 -4
- esphome/components/{bmp280/bmp280.h → bmp280_base/bmp280_base.h} +9 -5
- esphome/components/bmp280_i2c/__init__.py +0 -0
- esphome/components/bmp280_i2c/bmp280_i2c.cpp +27 -0
- esphome/components/bmp280_i2c/bmp280_i2c.h +22 -0
- esphome/components/bmp280_i2c/sensor.py +22 -0
- esphome/components/bmp280_spi/__init__.py +0 -0
- esphome/components/bmp280_spi/bmp280_spi.cpp +65 -0
- esphome/components/bmp280_spi/bmp280_spi.h +20 -0
- esphome/components/bmp280_spi/sensor.py +22 -0
- esphome/components/captive_portal/captive_portal.cpp +2 -0
- esphome/components/captive_portal/captive_portal.h +3 -1
- esphome/components/ch422g/__init__.py +67 -0
- esphome/components/ch422g/ch422g.cpp +122 -0
- esphome/components/ch422g/ch422g.h +70 -0
- esphome/components/debug/debug_esp32.cpp +3 -1
- esphome/components/display/__init__.py +5 -4
- esphome/components/dsmr/dsmr.cpp +6 -0
- esphome/components/dsmr/dsmr.h +6 -0
- esphome/components/dsmr/text_sensor.py +7 -2
- esphome/components/e131/e131.cpp +2 -0
- esphome/components/e131/e131.h +3 -1
- esphome/components/e131/e131_addressable_light_effect.cpp +2 -0
- esphome/components/e131/e131_addressable_light_effect.h +2 -1
- esphome/components/e131/e131_packet.cpp +2 -0
- esphome/components/esp32_ble/ble_uuid.cpp +7 -0
- esphome/components/esp32_ble/ble_uuid.h +1 -0
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -9
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +3 -3
- esphome/components/esp32_camera/__init__.py +4 -0
- esphome/components/esp32_camera/esp32_camera.cpp +9 -1
- esphome/components/esp32_camera/esp32_camera.h +3 -0
- esphome/components/esp32_can/canbus.py +18 -7
- esphome/components/esp32_can/esp32_can.cpp +8 -0
- esphome/components/esp32_can/esp32_can.h +4 -0
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +14 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +3 -2
- esphome/components/esp32_rmt_led_strip/light.py +21 -4
- esphome/components/esphome/ota/ota_esphome.cpp +2 -1
- esphome/components/esphome/ota/ota_esphome.h +2 -0
- esphome/components/font/__init__.py +11 -22
- esphome/components/font/font.cpp +3 -2
- esphome/components/font/font.h +12 -3
- esphome/components/gree/climate.py +2 -1
- esphome/components/gree/gree.cpp +54 -3
- esphome/components/gree/gree.h +10 -2
- esphome/components/gt911/touchscreen/__init__.py +6 -4
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +17 -0
- esphome/components/gt911/touchscreen/gt911_touchscreen.h +2 -0
- esphome/components/hmac_md5/__init__.py +2 -0
- esphome/components/hmac_md5/hmac_md5.cpp +56 -0
- esphome/components/hmac_md5/hmac_md5.h +48 -0
- esphome/components/homeassistant/__init__.py +13 -0
- esphome/components/homeassistant/switch/__init__.py +15 -2
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +2 -2
- esphome/components/i2s_audio/__init__.py +88 -9
- esphome/components/i2s_audio/i2s_audio.h +20 -2
- esphome/components/i2s_audio/media_player/__init__.py +8 -4
- esphome/components/i2s_audio/media_player/i2s_audio_media_player.h +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +19 -51
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +18 -15
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.h +0 -12
- esphome/components/i2s_audio/speaker/__init__.py +39 -27
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +49 -37
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +3 -4
- esphome/components/ili9xxx/display.py +16 -17
- esphome/components/ili9xxx/ili9xxx_display.cpp +1 -1
- esphome/components/ili9xxx/ili9xxx_display.h +18 -18
- esphome/components/ili9xxx/ili9xxx_init.h +0 -3
- esphome/components/improv_serial/improv_serial_component.cpp +2 -1
- esphome/components/improv_serial/improv_serial_component.h +2 -1
- esphome/components/ledc/ledc_output.cpp +11 -7
- esphome/components/libretiny/__init__.py +8 -13
- esphome/components/ltr501/__init__.py +1 -0
- esphome/components/ltr501/ltr501.cpp +542 -0
- esphome/components/ltr501/ltr501.h +184 -0
- esphome/components/ltr501/ltr_definitions_501.h +260 -0
- esphome/components/ltr501/sensor.py +274 -0
- esphome/components/ltr_als_ps/sensor.py +2 -2
- esphome/components/lvgl/__init__.py +19 -16
- esphome/components/lvgl/automation.py +90 -9
- esphome/components/lvgl/defines.py +29 -2
- esphome/components/lvgl/gradient.py +61 -0
- esphome/components/lvgl/lv_validation.py +45 -27
- esphome/components/lvgl/lvcode.py +8 -3
- esphome/components/lvgl/lvgl_esphome.cpp +54 -0
- esphome/components/lvgl/lvgl_esphome.h +9 -3
- esphome/components/lvgl/number/__init__.py +1 -0
- esphome/components/lvgl/number/lvgl_number.h +3 -1
- esphome/components/lvgl/schemas.py +16 -11
- esphome/components/lvgl/select/__init__.py +1 -0
- esphome/components/lvgl/select/lvgl_select.h +3 -1
- esphome/components/lvgl/switch/__init__.py +2 -1
- esphome/components/lvgl/switch/lvgl_switch.h +3 -1
- esphome/components/lvgl/text/__init__.py +1 -0
- esphome/components/lvgl/text/lvgl_text.h +3 -1
- esphome/components/lvgl/trigger.py +3 -2
- esphome/components/lvgl/types.py +2 -1
- esphome/components/lvgl/widgets/__init__.py +23 -8
- esphome/components/lvgl/widgets/arc.py +5 -1
- esphome/components/lvgl/widgets/buttonmatrix.py +5 -1
- esphome/components/lvgl/widgets/checkbox.py +8 -3
- esphome/components/lvgl/widgets/meter.py +8 -1
- esphome/components/lvgl/widgets/msgbox.py +26 -15
- esphome/components/lvgl/widgets/page.py +51 -7
- esphome/components/lvgl/widgets/tileview.py +2 -8
- esphome/components/max31856/max31856.cpp +12 -1
- esphome/components/max31856/max31856.h +5 -2
- esphome/components/max31856/sensor.py +20 -0
- esphome/components/mcp9600/sensor.py +2 -2
- esphome/components/mdns/__init__.py +6 -6
- esphome/components/media_player/media_player.h +16 -0
- esphome/components/micro_wake_word/__init__.py +2 -25
- esphome/components/microphone/microphone.h +1 -1
- esphome/components/mics_4514/mics_4514.cpp +26 -36
- esphome/components/modbus_controller/__init__.py +6 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +30 -27
- esphome/components/modbus_controller/modbus_controller.h +22 -4
- esphome/components/network/__init__.py +11 -8
- esphome/components/pipsolar/pipsolar.cpp +3 -0
- esphome/components/pipsolar/pipsolar.h +1 -0
- esphome/components/pipsolar/switch/__init__.py +2 -0
- esphome/components/prometheus/prometheus_handler.cpp +2 -0
- esphome/components/prometheus/prometheus_handler.h +3 -1
- esphome/components/rp2040/__init__.py +7 -8
- esphome/components/rpi_dpi_rgb/display.py +20 -17
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.cpp +36 -6
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.h +4 -0
- esphome/components/socket/socket.cpp +2 -0
- esphome/components/socket/socket.h +2 -0
- esphome/components/speaker/speaker.h +1 -1
- esphome/components/st7701s/display.py +35 -37
- esphome/components/st7701s/st7701s.cpp +11 -6
- esphome/components/st7701s/st7701s.h +1 -0
- esphome/components/statsd/__init__.py +65 -0
- esphome/components/statsd/statsd.cpp +156 -0
- esphome/components/statsd/statsd.h +86 -0
- esphome/components/tuya/__init__.py +1 -0
- esphome/components/tuya/number/__init__.py +39 -2
- esphome/components/tuya/number/tuya_number.cpp +58 -2
- esphome/components/tuya/number/tuya_number.h +12 -3
- esphome/components/udp/__init__.py +158 -0
- esphome/components/udp/binary_sensor.py +27 -0
- esphome/components/udp/sensor.py +27 -0
- esphome/components/udp/udp_component.cpp +616 -0
- esphome/components/udp/udp_component.h +158 -0
- esphome/components/uponor_smatrix/uponor_smatrix.cpp +4 -6
- esphome/components/uponor_smatrix/uponor_smatrix.h +0 -1
- esphome/components/veml7700/sensor.py +2 -2
- esphome/components/voice_assistant/__init__.py +6 -0
- esphome/components/voice_assistant/voice_assistant.cpp +24 -2
- esphome/components/voice_assistant/voice_assistant.h +20 -0
- esphome/components/web_server/__init__.py +11 -11
- esphome/components/web_server/list_entities.cpp +2 -0
- esphome/components/web_server/list_entities.h +3 -1
- esphome/components/web_server/web_server.cpp +2 -1
- esphome/components/web_server/web_server.h +2 -0
- esphome/components/web_server_base/web_server_base.cpp +2 -0
- esphome/components/web_server_base/web_server_base.h +3 -1
- esphome/components/wifi/wifi_component_libretiny.cpp +15 -1
- esphome/components/wireguard/__init__.py +9 -6
- esphome/components/wireguard/wireguard.cpp +2 -1
- esphome/components/wireguard/wireguard.h +3 -1
- esphome/config_validation.py +8 -0
- esphome/const.py +8 -1
- esphome/core/bytebuffer.cpp +117 -84
- esphome/core/bytebuffer.h +69 -21
- esphome/core/config.py +0 -3
- esphome/core/defines.h +2 -0
- esphome/core/ring_buffer.cpp +13 -2
- esphome/core/ring_buffer.h +56 -0
- esphome/external_files.py +5 -3
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/METADATA +1 -1
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/RECORD +204 -169
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/LICENSE +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/WHEEL +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
#include "ch422g.h"
|
2
|
+
#include "esphome/core/log.h"
|
3
|
+
|
4
|
+
namespace esphome {
|
5
|
+
namespace ch422g {
|
6
|
+
|
7
|
+
const uint8_t CH422G_REG_IN = 0x26;
|
8
|
+
const uint8_t CH422G_REG_OUT = 0x38;
|
9
|
+
const uint8_t OUT_REG_DEFAULT_VAL = 0xdf;
|
10
|
+
|
11
|
+
static const char *const TAG = "ch422g";
|
12
|
+
|
13
|
+
void CH422GComponent::setup() {
|
14
|
+
ESP_LOGCONFIG(TAG, "Setting up CH422G...");
|
15
|
+
// Test to see if device exists
|
16
|
+
if (!this->read_inputs_()) {
|
17
|
+
ESP_LOGE(TAG, "CH422G not detected at 0x%02X", this->address_);
|
18
|
+
this->mark_failed();
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
|
22
|
+
// restore defaults over whatever got saved on last boot
|
23
|
+
if (!this->restore_value_) {
|
24
|
+
this->write_output_(OUT_REG_DEFAULT_VAL);
|
25
|
+
}
|
26
|
+
|
27
|
+
ESP_LOGD(TAG, "Initialization complete. Warning: %d, Error: %d", this->status_has_warning(),
|
28
|
+
this->status_has_error());
|
29
|
+
}
|
30
|
+
|
31
|
+
void CH422GComponent::loop() {
|
32
|
+
// Clear all the previously read flags.
|
33
|
+
this->pin_read_cache_ = 0x00;
|
34
|
+
}
|
35
|
+
|
36
|
+
void CH422GComponent::dump_config() {
|
37
|
+
ESP_LOGCONFIG(TAG, "CH422G:");
|
38
|
+
LOG_I2C_DEVICE(this)
|
39
|
+
if (this->is_failed()) {
|
40
|
+
ESP_LOGE(TAG, "Communication with CH422G failed!");
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
// ch422g doesn't have any flag support (needs docs?)
|
45
|
+
void CH422GComponent::pin_mode(uint8_t pin, gpio::Flags flags) {}
|
46
|
+
|
47
|
+
bool CH422GComponent::digital_read(uint8_t pin) {
|
48
|
+
if (this->pin_read_cache_ == 0 || this->pin_read_cache_ & (1 << pin)) {
|
49
|
+
// Read values on first access or in case it's being read again in the same loop
|
50
|
+
this->read_inputs_();
|
51
|
+
}
|
52
|
+
|
53
|
+
this->pin_read_cache_ |= (1 << pin);
|
54
|
+
return this->state_mask_ & (1 << pin);
|
55
|
+
}
|
56
|
+
|
57
|
+
void CH422GComponent::digital_write(uint8_t pin, bool value) {
|
58
|
+
if (value) {
|
59
|
+
this->write_output_(this->state_mask_ | (1 << pin));
|
60
|
+
} else {
|
61
|
+
this->write_output_(this->state_mask_ & ~(1 << pin));
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
bool CH422GComponent::read_inputs_() {
|
66
|
+
if (this->is_failed()) {
|
67
|
+
return false;
|
68
|
+
}
|
69
|
+
|
70
|
+
uint8_t temp = 0;
|
71
|
+
if ((this->last_error_ = this->read(&temp, 1)) != esphome::i2c::ERROR_OK) {
|
72
|
+
this->status_set_warning(str_sprintf("read_inputs_(): I2C I/O error: %d", (int) this->last_error_).c_str());
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
|
76
|
+
uint8_t output = 0;
|
77
|
+
if ((this->last_error_ = this->bus_->read(CH422G_REG_IN, &output, 1)) != esphome::i2c::ERROR_OK) {
|
78
|
+
this->status_set_warning(str_sprintf("read_inputs_(): I2C I/O error: %d", (int) this->last_error_).c_str());
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
|
82
|
+
this->state_mask_ = output;
|
83
|
+
this->status_clear_warning();
|
84
|
+
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
|
88
|
+
bool CH422GComponent::write_output_(uint8_t value) {
|
89
|
+
const uint8_t temp = 1;
|
90
|
+
if ((this->last_error_ = this->write(&temp, 1, false)) != esphome::i2c::ERROR_OK) {
|
91
|
+
this->status_set_warning(str_sprintf("write_output_(): I2C I/O error: %d", (int) this->last_error_).c_str());
|
92
|
+
return false;
|
93
|
+
}
|
94
|
+
|
95
|
+
uint8_t write_mask = value;
|
96
|
+
if ((this->last_error_ = this->bus_->write(CH422G_REG_OUT, &write_mask, 1)) != esphome::i2c::ERROR_OK) {
|
97
|
+
this->status_set_warning(
|
98
|
+
str_sprintf("write_output_(): I2C I/O error: %d for write_mask: %d", (int) this->last_error_, (int) write_mask)
|
99
|
+
.c_str());
|
100
|
+
return false;
|
101
|
+
}
|
102
|
+
|
103
|
+
this->state_mask_ = value;
|
104
|
+
this->status_clear_warning();
|
105
|
+
return true;
|
106
|
+
}
|
107
|
+
|
108
|
+
float CH422GComponent::get_setup_priority() const { return setup_priority::IO; }
|
109
|
+
|
110
|
+
// Run our loop() method very early in the loop, so that we cache read values
|
111
|
+
// before other components call our digital_read() method.
|
112
|
+
float CH422GComponent::get_loop_priority() const { return 9.0f; } // Just after WIFI
|
113
|
+
|
114
|
+
void CH422GGPIOPin::setup() { pin_mode(flags_); }
|
115
|
+
void CH422GGPIOPin::pin_mode(gpio::Flags flags) { this->parent_->pin_mode(this->pin_, flags); }
|
116
|
+
bool CH422GGPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; }
|
117
|
+
|
118
|
+
void CH422GGPIOPin::digital_write(bool value) { this->parent_->digital_write(this->pin_, value != this->inverted_); }
|
119
|
+
std::string CH422GGPIOPin::dump_summary() const { return str_sprintf("EXIO%u via CH422G", pin_); }
|
120
|
+
|
121
|
+
} // namespace ch422g
|
122
|
+
} // namespace esphome
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/core/component.h"
|
4
|
+
#include "esphome/core/hal.h"
|
5
|
+
#include "esphome/components/i2c/i2c.h"
|
6
|
+
|
7
|
+
namespace esphome {
|
8
|
+
namespace ch422g {
|
9
|
+
|
10
|
+
class CH422GComponent : public Component, public i2c::I2CDevice {
|
11
|
+
public:
|
12
|
+
CH422GComponent() = default;
|
13
|
+
|
14
|
+
/// Check i2c availability and setup masks
|
15
|
+
void setup() override;
|
16
|
+
/// Poll for input changes periodically
|
17
|
+
void loop() override;
|
18
|
+
/// Helper function to read the value of a pin.
|
19
|
+
bool digital_read(uint8_t pin);
|
20
|
+
/// Helper function to write the value of a pin.
|
21
|
+
void digital_write(uint8_t pin, bool value);
|
22
|
+
/// Helper function to set the pin mode of a pin.
|
23
|
+
void pin_mode(uint8_t pin, gpio::Flags flags);
|
24
|
+
|
25
|
+
float get_setup_priority() const override;
|
26
|
+
|
27
|
+
float get_loop_priority() const override;
|
28
|
+
|
29
|
+
void dump_config() override;
|
30
|
+
|
31
|
+
void set_restore_value(bool restore_value) { this->restore_value_ = restore_value; }
|
32
|
+
|
33
|
+
protected:
|
34
|
+
bool read_inputs_();
|
35
|
+
|
36
|
+
bool write_output_(uint8_t value);
|
37
|
+
|
38
|
+
/// The mask to write as output state - 1 means HIGH, 0 means LOW
|
39
|
+
uint8_t state_mask_{0x00};
|
40
|
+
/// Flags to check if read previously during this loop
|
41
|
+
uint8_t pin_read_cache_ = {0x00};
|
42
|
+
/// Storage for last I2C error seen
|
43
|
+
esphome::i2c::ErrorCode last_error_;
|
44
|
+
/// Whether we want to override stored values on expander
|
45
|
+
bool restore_value_{false};
|
46
|
+
};
|
47
|
+
|
48
|
+
/// Helper class to expose a CH422G pin as an internal input GPIO pin.
|
49
|
+
class CH422GGPIOPin : public GPIOPin {
|
50
|
+
public:
|
51
|
+
void setup() override;
|
52
|
+
void pin_mode(gpio::Flags flags) override;
|
53
|
+
bool digital_read() override;
|
54
|
+
void digital_write(bool value) override;
|
55
|
+
std::string dump_summary() const override;
|
56
|
+
|
57
|
+
void set_parent(CH422GComponent *parent) { parent_ = parent; }
|
58
|
+
void set_pin(uint8_t pin) { pin_ = pin; }
|
59
|
+
void set_inverted(bool inverted) { inverted_ = inverted; }
|
60
|
+
void set_flags(gpio::Flags flags) { flags_ = flags; }
|
61
|
+
|
62
|
+
protected:
|
63
|
+
CH422GComponent *parent_;
|
64
|
+
uint8_t pin_;
|
65
|
+
bool inverted_;
|
66
|
+
gpio::Flags flags_;
|
67
|
+
};
|
68
|
+
|
69
|
+
} // namespace ch422g
|
70
|
+
} // namespace esphome
|
@@ -16,6 +16,8 @@
|
|
16
16
|
#include <esp32s2/rom/rtc.h>
|
17
17
|
#elif defined(USE_ESP32_VARIANT_ESP32S3)
|
18
18
|
#include <esp32s3/rom/rtc.h>
|
19
|
+
#elif defined(USE_ESP32_VARIANT_ESP32H2)
|
20
|
+
#include <esp32h2/rom/rtc.h>
|
19
21
|
#endif
|
20
22
|
#ifdef USE_ARDUINO
|
21
23
|
#include <Esp.h>
|
@@ -61,7 +63,7 @@ std::string DebugComponent::get_reset_reason_() {
|
|
61
63
|
case RTCWDT_SYS_RESET:
|
62
64
|
reset_reason = "RTC Watch Dog Reset Digital Core";
|
63
65
|
break;
|
64
|
-
#if !defined(USE_ESP32_VARIANT_ESP32C6)
|
66
|
+
#if !defined(USE_ESP32_VARIANT_ESP32C6) && !defined(USE_ESP32_VARIANT_ESP32H2)
|
65
67
|
case INTRUSION_RESET:
|
66
68
|
reset_reason = "Intrusion Reset CPU";
|
67
69
|
break;
|
@@ -1,15 +1,15 @@
|
|
1
|
+
from esphome import automation, core
|
2
|
+
from esphome.automation import maybe_simple_id
|
1
3
|
import esphome.codegen as cg
|
2
4
|
import esphome.config_validation as cv
|
3
|
-
from esphome import core, automation
|
4
|
-
from esphome.automation import maybe_simple_id
|
5
5
|
from esphome.const import (
|
6
6
|
CONF_AUTO_CLEAR_ENABLED,
|
7
|
+
CONF_FROM,
|
7
8
|
CONF_ID,
|
8
9
|
CONF_LAMBDA,
|
9
|
-
CONF_PAGES,
|
10
10
|
CONF_PAGE_ID,
|
11
|
+
CONF_PAGES,
|
11
12
|
CONF_ROTATION,
|
12
|
-
CONF_FROM,
|
13
13
|
CONF_TO,
|
14
14
|
CONF_TRIGGER_ID,
|
15
15
|
)
|
@@ -195,3 +195,4 @@ async def display_is_displaying_page_to_code(config, condition_id, template_arg,
|
|
195
195
|
@coroutine_with_priority(100.0)
|
196
196
|
async def to_code(config):
|
197
197
|
cg.add_global(display_ns.using)
|
198
|
+
cg.add_define("USE_DISPLAY")
|
esphome/components/dsmr/dsmr.cpp
CHANGED
@@ -256,6 +256,7 @@ bool Dsmr::parse_telegram() {
|
|
256
256
|
MyData data;
|
257
257
|
ESP_LOGV(TAG, "Trying to parse telegram");
|
258
258
|
this->stop_requesting_data_();
|
259
|
+
|
259
260
|
::dsmr::ParseResult<void> res =
|
260
261
|
::dsmr::P1Parser::parse(&data, this->telegram_, this->bytes_read_, false,
|
261
262
|
this->crc_check_); // Parse telegram according to data definition. Ignore unknown values.
|
@@ -267,6 +268,11 @@ bool Dsmr::parse_telegram() {
|
|
267
268
|
} else {
|
268
269
|
this->status_clear_warning();
|
269
270
|
this->publish_sensors(data);
|
271
|
+
|
272
|
+
// publish the telegram, after publishing the sensors so it can also trigger action based on latest values
|
273
|
+
if (this->s_telegram_ != nullptr) {
|
274
|
+
this->s_telegram_->publish_state(std::string(this->telegram_, this->bytes_read_));
|
275
|
+
}
|
270
276
|
return true;
|
271
277
|
}
|
272
278
|
}
|
esphome/components/dsmr/dsmr.h
CHANGED
@@ -85,6 +85,9 @@ class Dsmr : public Component, public uart::UARTDevice {
|
|
85
85
|
void set_##s(text_sensor::TextSensor *sensor) { s_##s##_ = sensor; }
|
86
86
|
DSMR_TEXT_SENSOR_LIST(DSMR_SET_TEXT_SENSOR, )
|
87
87
|
|
88
|
+
// handled outside dsmr
|
89
|
+
void set_telegram(text_sensor::TextSensor *sensor) { s_telegram_ = sensor; }
|
90
|
+
|
88
91
|
protected:
|
89
92
|
void receive_telegram_();
|
90
93
|
void receive_encrypted_telegram_();
|
@@ -124,6 +127,9 @@ class Dsmr : public Component, public uart::UARTDevice {
|
|
124
127
|
bool header_found_{false};
|
125
128
|
bool footer_found_{false};
|
126
129
|
|
130
|
+
// handled outside dsmr
|
131
|
+
text_sensor::TextSensor *s_telegram_{nullptr};
|
132
|
+
|
127
133
|
// Sensor member pointers
|
128
134
|
#define DSMR_DECLARE_SENSOR(s) sensor::Sensor *s_##s##_{nullptr};
|
129
135
|
DSMR_SENSOR_LIST(DSMR_DECLARE_SENSOR, )
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import esphome.codegen as cg
|
2
2
|
import esphome.config_validation as cv
|
3
3
|
from esphome.components import text_sensor
|
4
|
-
|
4
|
+
from esphome.const import CONF_INTERNAL
|
5
5
|
from . import Dsmr, CONF_DSMR_ID
|
6
6
|
|
7
7
|
AUTO_LOAD = ["dsmr"]
|
@@ -22,6 +22,9 @@ CONFIG_SCHEMA = cv.Schema(
|
|
22
22
|
cv.Optional("water_equipment_id"): text_sensor.text_sensor_schema(),
|
23
23
|
cv.Optional("sub_equipment_id"): text_sensor.text_sensor_schema(),
|
24
24
|
cv.Optional("gas_delivered_text"): text_sensor.text_sensor_schema(),
|
25
|
+
cv.Optional("telegram"): text_sensor.text_sensor_schema().extend(
|
26
|
+
{cv.Optional(CONF_INTERNAL, default=True): cv.boolean}
|
27
|
+
),
|
25
28
|
}
|
26
29
|
).extend(cv.COMPONENT_SCHEMA)
|
27
30
|
|
@@ -37,7 +40,9 @@ async def to_code(config):
|
|
37
40
|
if id and id.type == text_sensor.TextSensor:
|
38
41
|
var = await text_sensor.new_text_sensor(conf)
|
39
42
|
cg.add(getattr(hub, f"set_{key}")(var))
|
40
|
-
|
43
|
+
if key != "telegram":
|
44
|
+
# telegram is not handled by dsmr
|
45
|
+
text_sensors.append(f"F({key})")
|
41
46
|
|
42
47
|
if text_sensors:
|
43
48
|
cg.add_define(
|
esphome/components/e131/e131.cpp
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "e131.h"
|
2
|
+
#ifdef USE_NETWORK
|
2
3
|
#include "e131_addressable_light_effect.h"
|
3
4
|
#include "esphome/core/log.h"
|
4
5
|
|
@@ -118,3 +119,4 @@ bool E131Component::process_(int universe, const E131Packet &packet) {
|
|
118
119
|
|
119
120
|
} // namespace e131
|
120
121
|
} // namespace esphome
|
122
|
+
#endif
|
esphome/components/e131/e131.h
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#pragma once
|
2
|
-
|
2
|
+
#include "esphome/core/defines.h"
|
3
|
+
#ifdef USE_NETWORK
|
3
4
|
#include "esphome/components/socket/socket.h"
|
4
5
|
#include "esphome/core/component.h"
|
5
6
|
|
@@ -53,3 +54,4 @@ class E131Component : public esphome::Component {
|
|
53
54
|
|
54
55
|
} // namespace e131
|
55
56
|
} // namespace esphome
|
57
|
+
#endif
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#include "e131_addressable_light_effect.h"
|
2
2
|
#include "e131.h"
|
3
|
+
#ifdef USE_NETWORK
|
3
4
|
#include "esphome/core/log.h"
|
4
5
|
|
5
6
|
namespace esphome {
|
@@ -90,3 +91,4 @@ bool E131AddressableLightEffect::process_(int universe, const E131Packet &packet
|
|
90
91
|
|
91
92
|
} // namespace e131
|
92
93
|
} // namespace esphome
|
94
|
+
#endif
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
#include "esphome/core/component.h"
|
4
4
|
#include "esphome/components/light/addressable_light_effect.h"
|
5
|
-
|
5
|
+
#ifdef USE_NETWORK
|
6
6
|
namespace esphome {
|
7
7
|
namespace e131 {
|
8
8
|
|
@@ -42,3 +42,4 @@ class E131AddressableLightEffect : public light::AddressableLightEffect {
|
|
42
42
|
|
43
43
|
} // namespace e131
|
44
44
|
} // namespace esphome
|
45
|
+
#endif
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#include <cstring>
|
2
2
|
#include "e131.h"
|
3
|
+
#ifdef USE_NETWORK
|
3
4
|
#include "esphome/components/network/ip_address.h"
|
4
5
|
#include "esphome/core/log.h"
|
5
6
|
#include "esphome/core/util.h"
|
@@ -137,3 +138,4 @@ bool E131Component::packet_(const std::vector<uint8_t> &data, int &universe, E13
|
|
137
138
|
|
138
139
|
} // namespace e131
|
139
140
|
} // namespace esphome
|
141
|
+
#endif
|
@@ -31,6 +31,13 @@ ESPBTUUID ESPBTUUID::from_raw(const uint8_t *data) {
|
|
31
31
|
memcpy(ret.uuid_.uuid.uuid128, data, ESP_UUID_LEN_128);
|
32
32
|
return ret;
|
33
33
|
}
|
34
|
+
ESPBTUUID ESPBTUUID::from_raw_reversed(const uint8_t *data) {
|
35
|
+
ESPBTUUID ret;
|
36
|
+
ret.uuid_.len = ESP_UUID_LEN_128;
|
37
|
+
for (int i = 0; i < ESP_UUID_LEN_128; i++)
|
38
|
+
ret.uuid_.uuid.uuid128[ESP_UUID_LEN_128 - 1 - i] = data[i];
|
39
|
+
return ret;
|
40
|
+
}
|
34
41
|
ESPBTUUID ESPBTUUID::from_raw(const std::string &data) {
|
35
42
|
ESPBTUUID ret;
|
36
43
|
if (data.length() == 4) {
|
@@ -462,14 +462,16 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e
|
|
462
462
|
ESP_LOGVV(TAG, " Service UUID: %s", uuid.to_string().c_str());
|
463
463
|
}
|
464
464
|
for (auto &data : this->manufacturer_datas_) {
|
465
|
-
|
466
|
-
if (
|
467
|
-
|
468
|
-
ESP_LOGVV(TAG, "
|
469
|
-
ESP_LOGVV(TAG, "
|
470
|
-
ESP_LOGVV(TAG, "
|
471
|
-
ESP_LOGVV(TAG, "
|
472
|
-
|
465
|
+
auto ibeacon = ESPBLEiBeacon::from_manufacturer_data(data);
|
466
|
+
if (ibeacon.has_value()) {
|
467
|
+
ESP_LOGVV(TAG, " Manufacturer iBeacon:");
|
468
|
+
ESP_LOGVV(TAG, " UUID: %s", ibeacon.value().get_uuid().to_string().c_str());
|
469
|
+
ESP_LOGVV(TAG, " Major: %u", ibeacon.value().get_major());
|
470
|
+
ESP_LOGVV(TAG, " Minor: %u", ibeacon.value().get_minor());
|
471
|
+
ESP_LOGVV(TAG, " TXPower: %d", ibeacon.value().get_signal_power());
|
472
|
+
} else {
|
473
|
+
ESP_LOGVV(TAG, " Manufacturer ID: %s, data: %s", data.uuid.to_string().c_str(),
|
474
|
+
format_hex_pretty(data.data).c_str());
|
473
475
|
}
|
474
476
|
}
|
475
477
|
for (auto &data : this->service_datas_) {
|
@@ -478,7 +480,7 @@ void ESPBTDevice::parse_scan_rst(const esp_ble_gap_cb_param_t::ble_scan_result_e
|
|
478
480
|
ESP_LOGVV(TAG, " Data: %s", format_hex_pretty(data.data).c_str());
|
479
481
|
}
|
480
482
|
|
481
|
-
ESP_LOGVV(TAG, "Adv data: %s", format_hex_pretty(param.ble_adv, param.adv_data_len + param.scan_rsp_len).c_str());
|
483
|
+
ESP_LOGVV(TAG, " Adv data: %s", format_hex_pretty(param.ble_adv, param.adv_data_len + param.scan_rsp_len).c_str());
|
482
484
|
#endif
|
483
485
|
}
|
484
486
|
void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_param ¶m) {
|
@@ -44,10 +44,10 @@ class ESPBLEiBeacon {
|
|
44
44
|
ESPBLEiBeacon(const uint8_t *data);
|
45
45
|
static optional<ESPBLEiBeacon> from_manufacturer_data(const ServiceData &data);
|
46
46
|
|
47
|
-
uint16_t get_major() { return (
|
48
|
-
uint16_t get_minor() { return (
|
47
|
+
uint16_t get_major() { return byteswap(this->beacon_data_.major); }
|
48
|
+
uint16_t get_minor() { return byteswap(this->beacon_data_.minor); }
|
49
49
|
int8_t get_signal_power() { return this->beacon_data_.signal_power; }
|
50
|
-
ESPBTUUID get_uuid() { return ESPBTUUID::
|
50
|
+
ESPBTUUID get_uuid() { return ESPBTUUID::from_raw_reversed(this->beacon_data_.proximity_uuid); }
|
51
51
|
|
52
52
|
protected:
|
53
53
|
struct {
|
@@ -140,6 +140,8 @@ CONF_TEST_PATTERN = "test_pattern"
|
|
140
140
|
# framerates
|
141
141
|
CONF_MAX_FRAMERATE = "max_framerate"
|
142
142
|
CONF_IDLE_FRAMERATE = "idle_framerate"
|
143
|
+
# frame buffer
|
144
|
+
CONF_FRAME_BUFFER_COUNT = "frame_buffer_count"
|
143
145
|
|
144
146
|
# stream trigger
|
145
147
|
CONF_ON_STREAM_START = "on_stream_start"
|
@@ -213,6 +215,7 @@ CONFIG_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(
|
|
213
215
|
cv.Optional(CONF_IDLE_FRAMERATE, default="0.1 fps"): cv.All(
|
214
216
|
cv.framerate, cv.Range(min=0, max=1)
|
215
217
|
),
|
218
|
+
cv.Optional(CONF_FRAME_BUFFER_COUNT, default=1): cv.int_range(min=1, max=2),
|
216
219
|
cv.Optional(CONF_ON_STREAM_START): automation.validate_automation(
|
217
220
|
{
|
218
221
|
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(
|
@@ -285,6 +288,7 @@ async def to_code(config):
|
|
285
288
|
cg.add(var.set_idle_update_interval(0))
|
286
289
|
else:
|
287
290
|
cg.add(var.set_idle_update_interval(1000 / config[CONF_IDLE_FRAMERATE]))
|
291
|
+
cg.add(var.set_frame_buffer_count(config[CONF_FRAME_BUFFER_COUNT]))
|
288
292
|
cg.add(var.set_frame_size(config[CONF_RESOLUTION]))
|
289
293
|
|
290
294
|
cg.add_define("USE_ESP32_CAMERA")
|
@@ -127,7 +127,7 @@ void ESP32Camera::dump_config() {
|
|
127
127
|
sensor_t *s = esp_camera_sensor_get();
|
128
128
|
auto st = s->status;
|
129
129
|
ESP_LOGCONFIG(TAG, " JPEG Quality: %u", st.quality);
|
130
|
-
|
130
|
+
ESP_LOGCONFIG(TAG, " Framebuffer Count: %u", conf.fb_count);
|
131
131
|
ESP_LOGCONFIG(TAG, " Contrast: %d", st.contrast);
|
132
132
|
ESP_LOGCONFIG(TAG, " Brightness: %d", st.brightness);
|
133
133
|
ESP_LOGCONFIG(TAG, " Saturation: %d", st.saturation);
|
@@ -212,6 +212,8 @@ ESP32Camera::ESP32Camera() {
|
|
212
212
|
this->config_.frame_size = FRAMESIZE_VGA; // 640x480
|
213
213
|
this->config_.jpeg_quality = 10;
|
214
214
|
this->config_.fb_count = 1;
|
215
|
+
this->config_.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
|
216
|
+
this->config_.fb_location = CAMERA_FB_IN_PSRAM;
|
215
217
|
|
216
218
|
global_esp32_camera = this;
|
217
219
|
}
|
@@ -333,6 +335,12 @@ void ESP32Camera::set_max_update_interval(uint32_t max_update_interval) {
|
|
333
335
|
void ESP32Camera::set_idle_update_interval(uint32_t idle_update_interval) {
|
334
336
|
this->idle_update_interval_ = idle_update_interval;
|
335
337
|
}
|
338
|
+
/* set frame buffer parameters */
|
339
|
+
void ESP32Camera::set_frame_buffer_mode(camera_grab_mode_t mode) { this->config_.grab_mode = mode; }
|
340
|
+
void ESP32Camera::set_frame_buffer_count(uint8_t fb_count) {
|
341
|
+
this->config_.fb_count = fb_count;
|
342
|
+
this->set_frame_buffer_mode(fb_count > 1 ? CAMERA_GRAB_LATEST : CAMERA_GRAB_WHEN_EMPTY);
|
343
|
+
}
|
336
344
|
|
337
345
|
/* ---------------- public API (specific) ---------------- */
|
338
346
|
void ESP32Camera::add_image_callback(std::function<void(std::shared_ptr<CameraImage>)> &&callback) {
|
@@ -145,6 +145,9 @@ class ESP32Camera : public Component, public EntityBase {
|
|
145
145
|
/* -- framerates */
|
146
146
|
void set_max_update_interval(uint32_t max_update_interval);
|
147
147
|
void set_idle_update_interval(uint32_t idle_update_interval);
|
148
|
+
/* -- frame buffer */
|
149
|
+
void set_frame_buffer_mode(camera_grab_mode_t mode);
|
150
|
+
void set_frame_buffer_count(uint8_t fb_count);
|
148
151
|
|
149
152
|
/* public API (derivated) */
|
150
153
|
void setup() override;
|
@@ -1,18 +1,23 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
|
-
import esphome.config_validation as cv
|
3
1
|
from esphome import pins
|
2
|
+
import esphome.codegen as cg
|
4
3
|
from esphome.components import canbus
|
5
|
-
from esphome.
|
6
|
-
from esphome.components.canbus import CanbusComponent, CanSpeed, CONF_BIT_RATE
|
7
|
-
|
4
|
+
from esphome.components.canbus import CONF_BIT_RATE, CanbusComponent, CanSpeed
|
8
5
|
from esphome.components.esp32 import get_esp32_variant
|
9
6
|
from esphome.components.esp32.const import (
|
10
7
|
VARIANT_ESP32,
|
11
|
-
VARIANT_ESP32S2,
|
12
|
-
VARIANT_ESP32S3,
|
13
8
|
VARIANT_ESP32C3,
|
14
9
|
VARIANT_ESP32C6,
|
15
10
|
VARIANT_ESP32H2,
|
11
|
+
VARIANT_ESP32S2,
|
12
|
+
VARIANT_ESP32S3,
|
13
|
+
)
|
14
|
+
import esphome.config_validation as cv
|
15
|
+
from esphome.const import (
|
16
|
+
CONF_ID,
|
17
|
+
CONF_RX_PIN,
|
18
|
+
CONF_RX_QUEUE_LEN,
|
19
|
+
CONF_TX_PIN,
|
20
|
+
CONF_TX_QUEUE_LEN,
|
16
21
|
)
|
17
22
|
|
18
23
|
CODEOWNERS = ["@Sympatron"]
|
@@ -77,6 +82,8 @@ CONFIG_SCHEMA = canbus.CANBUS_SCHEMA.extend(
|
|
77
82
|
cv.Optional(CONF_BIT_RATE, default="125KBPS"): validate_bit_rate,
|
78
83
|
cv.Required(CONF_RX_PIN): pins.internal_gpio_input_pin_number,
|
79
84
|
cv.Required(CONF_TX_PIN): pins.internal_gpio_output_pin_number,
|
85
|
+
cv.Optional(CONF_RX_QUEUE_LEN): cv.uint32_t,
|
86
|
+
cv.Optional(CONF_TX_QUEUE_LEN): cv.uint32_t,
|
80
87
|
}
|
81
88
|
)
|
82
89
|
|
@@ -87,3 +94,7 @@ async def to_code(config):
|
|
87
94
|
|
88
95
|
cg.add(var.set_rx(config[CONF_RX_PIN]))
|
89
96
|
cg.add(var.set_tx(config[CONF_TX_PIN]))
|
97
|
+
if (rx_queue_len := config.get(CONF_RX_QUEUE_LEN)) is not None:
|
98
|
+
cg.add(var.set_rx_queue_len(rx_queue_len))
|
99
|
+
if (tx_queue_len := config.get(CONF_TX_QUEUE_LEN)) is not None:
|
100
|
+
cg.add(var.set_tx_queue_len(tx_queue_len))
|
@@ -69,6 +69,13 @@ static bool get_bitrate(canbus::CanSpeed bitrate, twai_timing_config_t *t_config
|
|
69
69
|
bool ESP32Can::setup_internal() {
|
70
70
|
twai_general_config_t g_config =
|
71
71
|
TWAI_GENERAL_CONFIG_DEFAULT((gpio_num_t) this->tx_, (gpio_num_t) this->rx_, TWAI_MODE_NORMAL);
|
72
|
+
if (this->tx_queue_len_.has_value()) {
|
73
|
+
g_config.tx_queue_len = this->tx_queue_len_.value();
|
74
|
+
}
|
75
|
+
if (this->rx_queue_len_.has_value()) {
|
76
|
+
g_config.rx_queue_len = this->rx_queue_len_.value();
|
77
|
+
}
|
78
|
+
|
72
79
|
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
73
80
|
twai_timing_config_t t_config;
|
74
81
|
|
@@ -111,6 +118,7 @@ canbus::Error ESP32Can::send_message(struct canbus::CanFrame *frame) {
|
|
111
118
|
.flags = flags,
|
112
119
|
.identifier = frame->can_id,
|
113
120
|
.data_length_code = frame->can_data_length_code,
|
121
|
+
.data = {}, // to suppress warning, data is initialized properly below
|
114
122
|
};
|
115
123
|
if (!frame->remote_transmission_request) {
|
116
124
|
memcpy(message.data, frame->data, frame->can_data_length_code);
|
@@ -12,6 +12,8 @@ class ESP32Can : public canbus::Canbus {
|
|
12
12
|
public:
|
13
13
|
void set_rx(int rx) { rx_ = rx; }
|
14
14
|
void set_tx(int tx) { tx_ = tx; }
|
15
|
+
void set_tx_queue_len(uint32_t tx_queue_len) { this->tx_queue_len_ = tx_queue_len; }
|
16
|
+
void set_rx_queue_len(uint32_t rx_queue_len) { this->rx_queue_len_ = rx_queue_len; }
|
15
17
|
ESP32Can(){};
|
16
18
|
|
17
19
|
protected:
|
@@ -21,6 +23,8 @@ class ESP32Can : public canbus::Canbus {
|
|
21
23
|
|
22
24
|
int rx_{-1};
|
23
25
|
int tx_{-1};
|
26
|
+
optional<uint32_t> tx_queue_len_{};
|
27
|
+
optional<uint32_t> rx_queue_len_{};
|
24
28
|
};
|
25
29
|
|
26
30
|
} // namespace esp32_can
|
@@ -38,7 +38,8 @@ void ESP32RMTLEDStripLightOutput::setup() {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
ExternalRAMAllocator<rmt_item32_t> rmt_allocator(ExternalRAMAllocator<rmt_item32_t>::ALLOW_FAILURE);
|
41
|
-
this->rmt_buf_ = rmt_allocator.allocate(buffer_size * 8
|
41
|
+
this->rmt_buf_ = rmt_allocator.allocate(buffer_size * 8 +
|
42
|
+
1); // 8 bits per byte, 1 rmt_item32_t per bit + 1 rmt_item32_t for reset
|
42
43
|
|
43
44
|
rmt_config_t config;
|
44
45
|
memset(&config, 0, sizeof(config));
|
@@ -66,7 +67,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
|
|
66
67
|
}
|
67
68
|
|
68
69
|
void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bit0_low, uint32_t bit1_high,
|
69
|
-
uint32_t bit1_low) {
|
70
|
+
uint32_t bit1_low, uint32_t reset_time_high, uint32_t reset_time_low) {
|
70
71
|
float ratio = (float) RMT_CLK_FREQ / RMT_CLK_DIV / 1e09f;
|
71
72
|
|
72
73
|
// 0-bit
|
@@ -79,6 +80,11 @@ void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bi
|
|
79
80
|
this->bit1_.level0 = 1;
|
80
81
|
this->bit1_.duration1 = (uint32_t) (ratio * bit1_low);
|
81
82
|
this->bit1_.level1 = 0;
|
83
|
+
// reset
|
84
|
+
this->reset_.duration0 = (uint32_t) (ratio * reset_time_high);
|
85
|
+
this->reset_.level0 = 1;
|
86
|
+
this->reset_.duration1 = (uint32_t) (ratio * reset_time_low);
|
87
|
+
this->reset_.level1 = 0;
|
82
88
|
}
|
83
89
|
|
84
90
|
void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
|
@@ -118,6 +124,12 @@ void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
|
|
118
124
|
psrc++;
|
119
125
|
}
|
120
126
|
|
127
|
+
if (this->reset_.duration0 > 0 || this->reset_.duration1 > 0) {
|
128
|
+
pdest->val = this->reset_.val;
|
129
|
+
pdest++;
|
130
|
+
len++;
|
131
|
+
}
|
132
|
+
|
121
133
|
if (rmt_write_items(this->channel_, this->rmt_buf_, len, false) != ESP_OK) {
|
122
134
|
ESP_LOGE(TAG, "RMT TX error");
|
123
135
|
this->status_set_warning();
|
@@ -49,7 +49,8 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
|
|
49
49
|
/// Set a maximum refresh rate in µs as some lights do not like being updated too often.
|
50
50
|
void set_max_refresh_rate(uint32_t interval_us) { this->max_refresh_rate_ = interval_us; }
|
51
51
|
|
52
|
-
void set_led_params(uint32_t bit0_high, uint32_t bit0_low, uint32_t bit1_high, uint32_t bit1_low
|
52
|
+
void set_led_params(uint32_t bit0_high, uint32_t bit0_low, uint32_t bit1_high, uint32_t bit1_low,
|
53
|
+
uint32_t reset_time_high, uint32_t reset_time_low);
|
53
54
|
|
54
55
|
void set_rgb_order(RGBOrder rgb_order) { this->rgb_order_ = rgb_order; }
|
55
56
|
void set_rmt_channel(rmt_channel_t channel) { this->channel_ = channel; }
|
@@ -75,7 +76,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
|
|
75
76
|
bool is_rgbw_;
|
76
77
|
bool is_wrgb_;
|
77
78
|
|
78
|
-
rmt_item32_t bit0_, bit1_;
|
79
|
+
rmt_item32_t bit0_, bit1_, reset_;
|
79
80
|
RGBOrder rgb_order_;
|
80
81
|
rmt_channel_t channel_;
|
81
82
|
|