esphome 2025.9.3__py3-none-any.whl → 2025.10.0b1__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 +87 -31
- esphome/address_cache.py +142 -0
- esphome/automation.py +130 -32
- esphome/build_gen/platformio.py +1 -3
- esphome/codegen.py +1 -0
- esphome/components/animation/animation.cpp +2 -2
- esphome/components/api/__init__.py +166 -3
- esphome/components/api/api_connection.cpp +84 -41
- esphome/components/api/api_connection.h +22 -16
- esphome/components/api/api_frame_helper.cpp +33 -19
- esphome/components/api/api_frame_helper.h +19 -4
- esphome/components/api/api_frame_helper_noise.cpp +41 -53
- esphome/components/api/api_frame_helper_noise.h +1 -1
- esphome/components/api/api_frame_helper_plaintext.cpp +22 -31
- esphome/components/api/api_frame_helper_plaintext.h +1 -1
- esphome/components/api/api_pb2.cpp +189 -15
- esphome/components/api/api_pb2.h +132 -20
- esphome/components/api/api_pb2_dump.cpp +97 -9
- esphome/components/api/api_pb2_service.cpp +118 -160
- esphome/components/api/api_pb2_service.h +31 -3
- esphome/components/api/api_server.cpp +68 -10
- esphome/components/api/api_server.h +32 -4
- esphome/components/api/custom_api_device.h +8 -8
- esphome/components/api/homeassistant_service.h +123 -6
- esphome/components/api/proto.h +6 -2
- esphome/components/api/user_services.h +2 -2
- esphome/components/as7341/sensor.py +1 -1
- esphome/components/audio/__init__.py +1 -1
- esphome/components/audio/audio.cpp +1 -1
- esphome/components/audio/audio_decoder.cpp +9 -9
- esphome/components/bl0906/bl0906.cpp +2 -2
- esphome/components/bl0942/bl0942.cpp +2 -2
- esphome/components/ble_client/__init__.py +1 -1
- esphome/components/bluetooth_proxy/__init__.py +4 -30
- esphome/components/bluetooth_proxy/bluetooth_connection.cpp +11 -4
- esphome/components/bluetooth_proxy/bluetooth_connection.h +2 -2
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +2 -2
- esphome/components/camera_encoder/__init__.py +2 -4
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.cpp +4 -2
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.h +3 -1
- esphome/components/canbus/canbus.cpp +7 -5
- esphome/components/canbus/canbus.h +4 -4
- esphome/components/captive_portal/__init__.py +18 -1
- esphome/components/captive_portal/captive_portal.cpp +40 -46
- esphome/components/captive_portal/captive_portal.h +20 -22
- esphome/components/captive_portal/dns_server_esp32_idf.cpp +205 -0
- esphome/components/captive_portal/dns_server_esp32_idf.h +27 -0
- esphome/components/ccs811/ccs811.cpp +1 -1
- esphome/components/climate/climate.cpp +10 -7
- esphome/components/cm1106/cm1106.cpp +1 -1
- esphome/components/copy/lock/copy_lock.cpp +1 -1
- esphome/components/cover/cover.cpp +1 -0
- esphome/components/daikin_arc/daikin_arc.cpp +19 -12
- esphome/components/deep_sleep/__init__.py +9 -2
- esphome/components/deep_sleep/deep_sleep_component.h +11 -9
- esphome/components/deep_sleep/deep_sleep_esp32.cpp +51 -27
- esphome/components/ektf2232/touchscreen/__init__.py +8 -5
- esphome/components/ektf2232/touchscreen/ektf2232.cpp +4 -4
- esphome/components/ektf2232/touchscreen/ektf2232.h +2 -2
- esphome/components/epaper_spi/__init__.py +1 -0
- esphome/components/epaper_spi/display.py +80 -0
- esphome/components/epaper_spi/epaper_spi.cpp +227 -0
- esphome/components/epaper_spi/epaper_spi.h +93 -0
- esphome/components/epaper_spi/epaper_spi_model_7p3in_spectra_e6.cpp +42 -0
- esphome/components/epaper_spi/epaper_spi_model_7p3in_spectra_e6.h +45 -0
- esphome/components/epaper_spi/epaper_spi_spectra_e6.cpp +135 -0
- esphome/components/epaper_spi/epaper_spi_spectra_e6.h +23 -0
- esphome/components/es7210/es7210.cpp +3 -3
- esphome/components/esp32/__init__.py +254 -339
- esphome/components/esp32/boards.py +81 -0
- esphome/components/esp32/preferences.cpp +23 -17
- esphome/components/esp32_ble/__init__.py +159 -44
- esphome/components/esp32_ble/ble.cpp +47 -3
- esphome/components/esp32_ble/ble.h +18 -0
- esphome/components/esp32_ble/ble_advertising.cpp +7 -3
- esphome/components/esp32_ble/ble_advertising.h +4 -0
- esphome/components/esp32_ble/ble_uuid.cpp +16 -42
- esphome/components/esp32_ble_beacon/__init__.py +3 -4
- esphome/components/esp32_ble_client/ble_client_base.cpp +14 -12
- esphome/components/esp32_ble_server/__init__.py +28 -14
- esphome/components/esp32_ble_server/ble_characteristic.cpp +67 -57
- esphome/components/esp32_ble_server/ble_characteristic.h +27 -16
- esphome/components/esp32_ble_server/ble_descriptor.cpp +4 -3
- esphome/components/esp32_ble_server/ble_descriptor.h +13 -9
- esphome/components/esp32_ble_server/ble_server.cpp +59 -24
- esphome/components/esp32_ble_server/ble_server.h +38 -20
- esphome/components/esp32_ble_server/ble_server_automations.cpp +49 -33
- esphome/components/esp32_ble_server/ble_server_automations.h +39 -24
- esphome/components/esp32_ble_tracker/__init__.py +25 -80
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +2 -4
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +0 -3
- esphome/components/esp32_camera/__init__.py +1 -3
- esphome/components/esp32_can/esp32_can.cpp +22 -4
- esphome/components/esp32_can/esp32_can.h +3 -0
- esphome/components/esp32_hosted/__init__.py +2 -1
- esphome/components/esp32_improv/esp32_improv_component.cpp +102 -44
- esphome/components/esp32_improv/esp32_improv_component.h +6 -1
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +1 -1
- esphome/components/esp8266/__init__.py +3 -3
- esphome/components/esphome/ota/__init__.py +21 -2
- esphome/components/esphome/ota/ota_esphome.cpp +455 -145
- esphome/components/esphome/ota/ota_esphome.h +49 -2
- esphome/components/ethernet/__init__.py +39 -22
- esphome/components/ethernet/ethernet_component.cpp +28 -5
- esphome/components/ethernet/ethernet_component.h +5 -1
- esphome/components/external_components/__init__.py +8 -6
- esphome/components/fingerprint_grow/fingerprint_grow.cpp +1 -1
- esphome/components/fingerprint_grow/fingerprint_grow.h +2 -1
- esphome/components/font/__init__.py +5 -5
- esphome/components/graph/graph.cpp +1 -1
- esphome/components/graphical_display_menu/graphical_display_menu.cpp +3 -2
- esphome/components/haier/hon_climate.cpp +2 -2
- esphome/components/haier/hon_climate.h +1 -1
- esphome/components/hdc1080/hdc1080.cpp +42 -34
- esphome/components/hdc1080/hdc1080.h +1 -3
- esphome/components/homeassistant/number/homeassistant_number.cpp +2 -2
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +2 -2
- esphome/components/http_request/__init__.py +3 -3
- esphome/components/htu21d/htu21d.cpp +13 -18
- esphome/components/htu21d/htu21d.h +1 -1
- esphome/components/i2s_audio/__init__.py +1 -2
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +1 -1
- esphome/components/ili9xxx/ili9xxx_display.cpp +2 -2
- esphome/components/improv_serial/improv_serial_component.cpp +12 -15
- esphome/components/improv_serial/improv_serial_component.h +6 -8
- esphome/components/json/json_util.cpp +35 -43
- esphome/components/json/json_util.h +57 -0
- esphome/components/kamstrup_kmp/kamstrup_kmp.cpp +2 -2
- esphome/components/key_collector/key_collector.h +4 -4
- esphome/components/libretiny/__init__.py +6 -6
- esphome/components/libretiny/preferences.cpp +23 -16
- esphome/components/light/light_call.cpp +98 -120
- esphome/components/light/light_call.h +17 -7
- esphome/components/lm75b/__init__.py +0 -0
- esphome/components/lm75b/lm75b.cpp +39 -0
- esphome/components/lm75b/lm75b.h +19 -0
- esphome/components/lm75b/sensor.py +34 -0
- esphome/components/lock/lock.h +12 -6
- esphome/components/logger/__init__.py +15 -27
- esphome/components/logger/logger.cpp +10 -20
- esphome/components/logger/logger.h +105 -62
- esphome/components/logger/logger_esp32.cpp +0 -48
- esphome/components/logger/logger_zephyr.cpp +2 -3
- esphome/components/logger/select/logger_level_select.cpp +6 -7
- esphome/components/logger/select/logger_level_select.h +7 -0
- esphome/components/ltr501/ltr501.cpp +7 -6
- esphome/components/ltr_als_ps/ltr_als_ps.cpp +7 -6
- esphome/components/matrix_keypad/matrix_keypad.h +4 -4
- esphome/components/max7219digit/max7219digit.cpp +1 -1
- esphome/components/mcp2515/mcp2515.cpp +31 -3
- esphome/components/mcp2515/mcp2515_defs.h +3 -1
- esphome/components/md5/md5.cpp +0 -26
- esphome/components/md5/md5.h +10 -20
- esphome/components/mdns/__init__.py +19 -6
- esphome/components/mdns/mdns_component.cpp +27 -59
- esphome/components/mdns/mdns_component.h +23 -10
- esphome/components/mdns/mdns_esp32.cpp +7 -7
- esphome/components/mdns/mdns_esp8266.cpp +6 -6
- esphome/components/mdns/mdns_libretiny.cpp +3 -3
- esphome/components/mdns/mdns_rp2040.cpp +3 -3
- esphome/components/mipi/__init__.py +1 -5
- esphome/components/mipi_spi/display.py +24 -8
- esphome/components/mipi_spi/mipi_spi.h +3 -3
- esphome/components/mixer/speaker/mixer_speaker.cpp +3 -3
- esphome/components/mmc5603/mmc5603.cpp +3 -3
- esphome/components/modbus/modbus.cpp +27 -13
- esphome/components/modbus/modbus.h +5 -3
- esphome/components/modbus/modbus_definitions.h +86 -0
- esphome/components/modbus_controller/__init__.py +29 -1
- esphome/components/modbus_controller/const.py +4 -0
- esphome/components/modbus_controller/modbus_controller.cpp +38 -13
- esphome/components/modbus_controller/modbus_controller.h +18 -29
- esphome/components/mpr121/mpr121.cpp +41 -42
- esphome/components/mpr121/mpr121.h +0 -1
- esphome/components/nau7802/nau7802.cpp +2 -2
- esphome/components/network/__init__.py +7 -3
- esphome/components/nextion/display.py +4 -4
- esphome/components/nextion/nextion.cpp +8 -8
- esphome/components/number/__init__.py +2 -0
- esphome/components/number/number_call.cpp +23 -12
- esphome/components/number/number_call.h +5 -0
- esphome/components/online_image/bmp_image.cpp +2 -1
- esphome/components/online_image/jpeg_image.cpp +4 -2
- esphome/components/openthread/openthread.cpp +6 -7
- esphome/components/openthread/openthread.h +0 -1
- esphome/components/ota/ota_backend.h +1 -0
- esphome/components/packages/__init__.py +10 -8
- esphome/components/packet_transport/packet_transport.cpp +2 -0
- esphome/components/pid/pid_controller.cpp +1 -1
- esphome/components/prometheus/prometheus_handler.cpp +239 -239
- esphome/components/psram/__init__.py +30 -28
- esphome/components/qmc5883l/qmc5883l.cpp +15 -0
- esphome/components/qmc5883l/qmc5883l.h +3 -0
- esphome/components/qmc5883l/sensor.py +31 -12
- esphome/components/remote_base/gobox_protocol.cpp +3 -3
- esphome/components/remote_receiver/__init__.py +14 -2
- esphome/components/remote_receiver/{remote_receiver_esp8266.cpp → remote_receiver.cpp} +2 -2
- esphome/components/remote_receiver/remote_receiver.h +4 -0
- esphome/components/remote_receiver/remote_receiver_esp32.cpp +18 -1
- esphome/components/remote_transmitter/__init__.py +2 -2
- esphome/components/remote_transmitter/remote_transmitter.cpp +103 -0
- esphome/components/rp2040/__init__.py +11 -11
- esphome/components/rtttl/rtttl.cpp +2 -2
- esphome/components/scd30/sensor.py +1 -1
- esphome/components/script/__init__.py +1 -1
- esphome/components/script/script.h +7 -7
- esphome/components/select/select.cpp +5 -4
- esphome/components/select/select_call.cpp +1 -1
- esphome/components/sensirion_common/i2c_sensirion.cpp +2 -1
- esphome/components/sensor/__init__.py +2 -0
- esphome/components/sha256/__init__.py +22 -0
- esphome/components/sha256/sha256.cpp +116 -0
- esphome/components/sha256/sha256.h +60 -0
- esphome/components/socket/lwip_raw_tcp_impl.cpp +34 -6
- esphome/components/sonoff_d1/sonoff_d1.cpp +1 -1
- esphome/components/spi/__init__.py +0 -3
- esphome/components/split_buffer/__init__.py +5 -0
- esphome/components/split_buffer/split_buffer.cpp +133 -0
- esphome/components/split_buffer/split_buffer.h +40 -0
- esphome/components/sps30/sps30.cpp +14 -10
- esphome/components/sps30/sps30.h +2 -0
- esphome/components/st7567_i2c/st7567_i2c.cpp +3 -1
- esphome/components/st7789v/st7789v.cpp +3 -2
- esphome/components/statsd/statsd.cpp +1 -1
- esphome/components/substitutions/__init__.py +3 -1
- esphome/components/substitutions/jinja.py +13 -3
- esphome/components/sx126x/__init__.py +16 -0
- esphome/components/sx126x/sx126x.cpp +15 -1
- esphome/components/sx126x/sx126x.h +9 -1
- esphome/components/sx126x/sx126x_reg.h +2 -0
- esphome/components/text_sensor/text_sensor.cpp +16 -0
- esphome/components/text_sensor/text_sensor.h +3 -10
- esphome/components/tormatic/tormatic_cover.cpp +1 -1
- esphome/components/tuya/select/tuya_select.cpp +1 -1
- esphome/components/tuya/tuya.cpp +29 -4
- esphome/components/uart/__init__.py +36 -26
- esphome/components/uart/uart.h +6 -0
- esphome/components/uart/uart_component.cpp +8 -0
- esphome/components/uart/uart_component.h +28 -0
- esphome/components/uart/uart_component_esp_idf.cpp +64 -10
- esphome/components/uart/uart_component_esp_idf.h +5 -2
- esphome/components/uponor_smatrix/climate/uponor_smatrix_climate.cpp +1 -1
- esphome/components/uponor_smatrix/sensor/uponor_smatrix_sensor.cpp +1 -1
- esphome/components/uponor_smatrix/uponor_smatrix.cpp +3 -3
- esphome/components/usb_host/__init__.py +2 -1
- esphome/components/usb_host/usb_host.h +82 -13
- esphome/components/usb_host/usb_host_client.cpp +180 -24
- esphome/components/usb_host/usb_host_component.cpp +1 -1
- esphome/components/usb_uart/__init__.py +0 -1
- esphome/components/usb_uart/ch34x.cpp +4 -4
- esphome/components/usb_uart/cp210x.cpp +3 -3
- esphome/components/usb_uart/usb_uart.cpp +88 -32
- esphome/components/usb_uart/usb_uart.h +30 -6
- esphome/components/valve/valve.cpp +1 -0
- esphome/components/veml7700/veml7700.cpp +7 -6
- esphome/components/version/version_text_sensor.cpp +2 -1
- esphome/components/voice_assistant/voice_assistant.cpp +3 -2
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +4 -4
- esphome/components/web_server/list_entities.cpp +3 -4
- esphome/components/web_server/list_entities.h +8 -10
- esphome/components/web_server/ota/__init__.py +1 -1
- esphome/components/web_server/ota/ota_web_server.cpp +9 -3
- esphome/components/web_server/web_server.cpp +509 -404
- esphome/components/web_server/web_server.h +5 -6
- esphome/components/web_server/web_server_v1.cpp +21 -19
- esphome/components/web_server_base/__init__.py +5 -2
- esphome/components/web_server_base/web_server_base.h +27 -7
- esphome/components/web_server_idf/__init__.py +1 -1
- esphome/components/web_server_idf/multipart.cpp +2 -2
- esphome/components/web_server_idf/multipart.h +2 -2
- esphome/components/web_server_idf/utils.cpp +2 -2
- esphome/components/web_server_idf/utils.h +2 -2
- esphome/components/web_server_idf/web_server_idf.cpp +118 -26
- esphome/components/web_server_idf/web_server_idf.h +12 -10
- esphome/components/wifi/__init__.py +13 -11
- esphome/components/wifi/wifi_component.cpp +73 -56
- esphome/components/wifi/wifi_component.h +4 -4
- esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
- esphome/components/wifi/wifi_component_esp_idf.cpp +24 -4
- esphome/components/wireguard/__init__.py +1 -1
- esphome/components/wts01/__init__.py +0 -0
- esphome/components/wts01/sensor.py +41 -0
- esphome/components/wts01/wts01.cpp +91 -0
- esphome/components/wts01/wts01.h +27 -0
- esphome/components/zephyr/__init__.py +5 -5
- esphome/components/zwave_proxy/__init__.py +43 -0
- esphome/components/zwave_proxy/zwave_proxy.cpp +346 -0
- esphome/components/zwave_proxy/zwave_proxy.h +93 -0
- esphome/config.py +79 -24
- esphome/config_validation.py +13 -15
- esphome/const.py +9 -2
- esphome/core/__init__.py +31 -22
- esphome/core/component.cpp +28 -18
- esphome/core/component_iterator.h +2 -1
- esphome/core/config.py +15 -15
- esphome/core/defines.h +19 -0
- esphome/core/hash_base.h +56 -0
- esphome/core/helpers.cpp +19 -3
- esphome/core/helpers.h +26 -0
- esphome/core/scheduler.cpp +5 -21
- esphome/core/scheduler.h +19 -8
- esphome/core/string_ref.h +1 -1
- esphome/core/time.cpp +5 -5
- esphome/cpp_generator.py +4 -29
- esphome/dashboard/const.py +21 -4
- esphome/dashboard/core.py +10 -8
- esphome/dashboard/dns.py +15 -0
- esphome/dashboard/entries.py +15 -21
- esphome/dashboard/models.py +76 -0
- esphome/dashboard/settings.py +7 -7
- esphome/dashboard/status/mdns.py +46 -2
- esphome/dashboard/web_server.py +367 -93
- esphome/espota2.py +111 -31
- esphome/external_files.py +6 -7
- esphome/git.py +8 -0
- esphome/helpers.py +124 -77
- esphome/loader.py +8 -9
- esphome/platformio_api.py +25 -18
- esphome/storage_json.py +26 -21
- esphome/types.py +30 -2
- esphome/util.py +32 -16
- esphome/vscode.py +8 -8
- esphome/wizard.py +10 -10
- esphome/writer.py +50 -15
- esphome/yaml_util.py +37 -31
- esphome/zeroconf.py +12 -3
- {esphome-2025.9.3.dist-info → esphome-2025.10.0b1.dist-info}/METADATA +11 -11
- {esphome-2025.9.3.dist-info → esphome-2025.10.0b1.dist-info}/RECORD +332 -312
- esphome/components/event_emitter/__init__.py +0 -5
- esphome/components/event_emitter/event_emitter.cpp +0 -14
- esphome/components/event_emitter/event_emitter.h +0 -63
- esphome/components/remote_receiver/remote_receiver_libretiny.cpp +0 -125
- esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +0 -107
- esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +0 -110
- esphome/components/uart/uart_component_esp32_arduino.cpp +0 -214
- esphome/components/uart/uart_component_esp32_arduino.h +0 -60
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +0 -860
- esphome/core/string_ref.cpp +0 -12
- esphome/dashboard/util/file.py +0 -63
- {esphome-2025.9.3.dist-info → esphome-2025.10.0b1.dist-info}/WHEEL +0 -0
- {esphome-2025.9.3.dist-info → esphome-2025.10.0b1.dist-info}/entry_points.txt +0 -0
- {esphome-2025.9.3.dist-info → esphome-2025.10.0b1.dist-info}/licenses/LICENSE +0 -0
- {esphome-2025.9.3.dist-info → esphome-2025.10.0b1.dist-info}/top_level.txt +0 -0
@@ -20,6 +20,23 @@ bool MCP2515::setup_internal() {
|
|
20
20
|
return false;
|
21
21
|
if (this->set_bitrate_(this->bit_rate_, this->mcp_clock_) != canbus::ERROR_OK)
|
22
22
|
return false;
|
23
|
+
|
24
|
+
// setup hardware filter RXF0 accepting all standard CAN IDs
|
25
|
+
if (this->set_filter_(RXF::RXF0, false, 0) != canbus::ERROR_OK) {
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
if (this->set_filter_mask_(MASK::MASK0, false, 0) != canbus::ERROR_OK) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
|
32
|
+
// setup hardware filter RXF1 accepting all extended CAN IDs
|
33
|
+
if (this->set_filter_(RXF::RXF1, true, 0) != canbus::ERROR_OK) {
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
if (this->set_filter_mask_(MASK::MASK1, true, 0) != canbus::ERROR_OK) {
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
|
23
40
|
if (this->set_mode_(this->mcp_mode_) != canbus::ERROR_OK)
|
24
41
|
return false;
|
25
42
|
uint8_t err_flags = this->get_error_flags_();
|
@@ -155,7 +172,7 @@ void MCP2515::prepare_id_(uint8_t *buffer, const bool extended, const uint32_t i
|
|
155
172
|
canid = (uint16_t) (id >> 16);
|
156
173
|
buffer[MCP_SIDL] = (uint8_t) (canid & 0x03);
|
157
174
|
buffer[MCP_SIDL] += (uint8_t) ((canid & 0x1C) << 3);
|
158
|
-
buffer[MCP_SIDL] |=
|
175
|
+
buffer[MCP_SIDL] |= SIDL_EXIDE_MASK;
|
159
176
|
buffer[MCP_SIDH] = (uint8_t) (canid >> 5);
|
160
177
|
} else {
|
161
178
|
buffer[MCP_SIDH] = (uint8_t) (canid >> 3);
|
@@ -258,7 +275,7 @@ canbus::Error MCP2515::send_message(struct canbus::CanFrame *frame) {
|
|
258
275
|
}
|
259
276
|
}
|
260
277
|
|
261
|
-
return canbus::
|
278
|
+
return canbus::ERROR_ALLTXBUSY;
|
262
279
|
}
|
263
280
|
|
264
281
|
canbus::Error MCP2515::read_message_(RXBn rxbn, struct canbus::CanFrame *frame) {
|
@@ -272,7 +289,7 @@ canbus::Error MCP2515::read_message_(RXBn rxbn, struct canbus::CanFrame *frame)
|
|
272
289
|
bool use_extended_id = false;
|
273
290
|
bool remote_transmission_request = false;
|
274
291
|
|
275
|
-
if ((tbufdata[MCP_SIDL] &
|
292
|
+
if ((tbufdata[MCP_SIDL] & SIDL_EXIDE_MASK) == SIDL_EXIDE_MASK) {
|
276
293
|
id = (id << 2) + (tbufdata[MCP_SIDL] & 0x03);
|
277
294
|
id = (id << 8) + tbufdata[MCP_EID8];
|
278
295
|
id = (id << 8) + tbufdata[MCP_EID0];
|
@@ -315,6 +332,17 @@ canbus::Error MCP2515::read_message(struct canbus::CanFrame *frame) {
|
|
315
332
|
rc = canbus::ERROR_NOMSG;
|
316
333
|
}
|
317
334
|
|
335
|
+
#ifdef ESPHOME_LOG_HAS_DEBUG
|
336
|
+
uint8_t err = get_error_flags_();
|
337
|
+
// The receive flowchart in the datasheet says that if rollover is set (BUKT), RX1OVR flag will be set
|
338
|
+
// once both buffers are full. However, the RX0OVR flag is actually set instead.
|
339
|
+
// We can just check for both though because it doesn't break anything.
|
340
|
+
if (err & (EFLG_RX0OVR | EFLG_RX1OVR)) {
|
341
|
+
ESP_LOGD(TAG, "receive buffer overrun");
|
342
|
+
clear_rx_n_ovr_flags_();
|
343
|
+
}
|
344
|
+
#endif
|
345
|
+
|
318
346
|
return rc;
|
319
347
|
}
|
320
348
|
|
@@ -130,7 +130,9 @@ static const uint8_t CANSTAT_ICOD = 0x0E;
|
|
130
130
|
|
131
131
|
static const uint8_t CNF3_SOF = 0x80;
|
132
132
|
|
133
|
-
|
133
|
+
// applies to RXBn_SIDL, TXBn_SIDL and RXFn_SIDL
|
134
|
+
static const uint8_t SIDL_EXIDE_MASK = 0x08;
|
135
|
+
|
134
136
|
static const uint8_t DLC_MASK = 0x0F;
|
135
137
|
static const uint8_t RTR_MASK = 0x40;
|
136
138
|
|
esphome/components/md5/md5.cpp
CHANGED
@@ -39,32 +39,6 @@ void MD5Digest::add(const uint8_t *data, size_t len) { br_md5_update(&this->ctx_
|
|
39
39
|
void MD5Digest::calculate() { br_md5_out(&this->ctx_, this->digest_); }
|
40
40
|
#endif // USE_RP2040
|
41
41
|
|
42
|
-
void MD5Digest::get_bytes(uint8_t *output) { memcpy(output, this->digest_, 16); }
|
43
|
-
|
44
|
-
void MD5Digest::get_hex(char *output) {
|
45
|
-
for (size_t i = 0; i < 16; i++) {
|
46
|
-
uint8_t byte = this->digest_[i];
|
47
|
-
output[i * 2] = format_hex_char(byte >> 4);
|
48
|
-
output[i * 2 + 1] = format_hex_char(byte & 0x0F);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
bool MD5Digest::equals_bytes(const uint8_t *expected) {
|
53
|
-
for (size_t i = 0; i < 16; i++) {
|
54
|
-
if (expected[i] != this->digest_[i]) {
|
55
|
-
return false;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
return true;
|
59
|
-
}
|
60
|
-
|
61
|
-
bool MD5Digest::equals_hex(const char *expected) {
|
62
|
-
uint8_t parsed[16];
|
63
|
-
if (!parse_hex(expected, parsed, 16))
|
64
|
-
return false;
|
65
|
-
return equals_bytes(parsed);
|
66
|
-
}
|
67
|
-
|
68
42
|
} // namespace md5
|
69
43
|
} // namespace esphome
|
70
44
|
#endif
|
esphome/components/md5/md5.h
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
#include "esphome/core/defines.h"
|
4
4
|
#ifdef USE_MD5
|
5
5
|
|
6
|
+
#include "esphome/core/hash_base.h"
|
7
|
+
|
6
8
|
#ifdef USE_ESP32
|
7
9
|
#include "esp_rom_md5.h"
|
8
10
|
#define MD5_CTX_TYPE md5_context_t
|
@@ -26,38 +28,26 @@
|
|
26
28
|
namespace esphome {
|
27
29
|
namespace md5 {
|
28
30
|
|
29
|
-
class MD5Digest {
|
31
|
+
class MD5Digest : public HashBase {
|
30
32
|
public:
|
31
33
|
MD5Digest() = default;
|
32
|
-
~MD5Digest() = default;
|
34
|
+
~MD5Digest() override = default;
|
33
35
|
|
34
36
|
/// Initialize a new MD5 digest computation.
|
35
|
-
void init();
|
37
|
+
void init() override;
|
36
38
|
|
37
39
|
/// Add bytes of data for the digest.
|
38
|
-
void add(const uint8_t *data, size_t len);
|
39
|
-
|
40
|
+
void add(const uint8_t *data, size_t len) override;
|
41
|
+
using HashBase::add; // Bring base class overload into scope
|
40
42
|
|
41
43
|
/// Compute the digest, based on the provided data.
|
42
|
-
void calculate();
|
43
|
-
|
44
|
-
/// Retrieve the MD5 digest as bytes.
|
45
|
-
/// The output must be able to hold 16 bytes or more.
|
46
|
-
void get_bytes(uint8_t *output);
|
47
|
-
|
48
|
-
/// Retrieve the MD5 digest as hex characters.
|
49
|
-
/// The output must be able to hold 32 bytes or more.
|
50
|
-
void get_hex(char *output);
|
51
|
-
|
52
|
-
/// Compare the digest against a provided byte-encoded digest (16 bytes).
|
53
|
-
bool equals_bytes(const uint8_t *expected);
|
44
|
+
void calculate() override;
|
54
45
|
|
55
|
-
///
|
56
|
-
|
46
|
+
/// Get the size of the hash in bytes (16 for MD5)
|
47
|
+
size_t get_size() const override { return 16; }
|
57
48
|
|
58
49
|
protected:
|
59
50
|
MD5_CTX_TYPE ctx_{};
|
60
|
-
uint8_t digest_[16];
|
61
51
|
};
|
62
52
|
|
63
53
|
} // namespace md5
|
@@ -17,6 +17,11 @@ from esphome.coroutine import CoroPriority
|
|
17
17
|
CODEOWNERS = ["@esphome/core"]
|
18
18
|
DEPENDENCIES = ["network"]
|
19
19
|
|
20
|
+
# Components that create mDNS services at runtime
|
21
|
+
# IMPORTANT: If you add a new component here, you must also update the corresponding
|
22
|
+
# #ifdef blocks in mdns_component.cpp compile_records_() method
|
23
|
+
COMPONENTS_WITH_MDNS_SERVICES = ("api", "prometheus", "web_server")
|
24
|
+
|
20
25
|
mdns_ns = cg.esphome_ns.namespace("mdns")
|
21
26
|
MDNSComponent = mdns_ns.class_("MDNSComponent", cg.Component)
|
22
27
|
MDNSTXTRecord = mdns_ns.struct("MDNSTXTRecord")
|
@@ -56,7 +61,7 @@ CONFIG_SCHEMA = cv.All(
|
|
56
61
|
def mdns_txt_record(key: str, value: str):
|
57
62
|
return cg.StructInitializer(
|
58
63
|
MDNSTXTRecord,
|
59
|
-
("key", key),
|
64
|
+
("key", cg.RawExpression(f"MDNS_STR({cg.safe_exp(key)})")),
|
60
65
|
("value", value),
|
61
66
|
)
|
62
67
|
|
@@ -66,8 +71,8 @@ def mdns_service(
|
|
66
71
|
):
|
67
72
|
return cg.StructInitializer(
|
68
73
|
MDNSService,
|
69
|
-
("service_type", service),
|
70
|
-
("proto", proto),
|
74
|
+
("service_type", cg.RawExpression(f"MDNS_STR({cg.safe_exp(service)})")),
|
75
|
+
("proto", cg.RawExpression(f"MDNS_STR({cg.safe_exp(proto)})")),
|
71
76
|
("port", port),
|
72
77
|
("txt_records", txt_records),
|
73
78
|
)
|
@@ -91,17 +96,25 @@ async def to_code(config):
|
|
91
96
|
|
92
97
|
cg.add_define("USE_MDNS")
|
93
98
|
|
94
|
-
|
95
|
-
|
99
|
+
# Calculate compile-time service count
|
100
|
+
service_count = sum(
|
101
|
+
1 for key in COMPONENTS_WITH_MDNS_SERVICES if key in CORE.config
|
102
|
+
) + len(config[CONF_SERVICES])
|
96
103
|
|
97
104
|
if config[CONF_SERVICES]:
|
98
105
|
cg.add_define("USE_MDNS_EXTRA_SERVICES")
|
99
106
|
|
107
|
+
# Ensure at least 1 service (fallback service)
|
108
|
+
cg.add_define("MDNS_SERVICE_COUNT", max(1, service_count))
|
109
|
+
|
110
|
+
var = cg.new_Pvariable(config[CONF_ID])
|
111
|
+
await cg.register_component(var, config)
|
112
|
+
|
100
113
|
for service in config[CONF_SERVICES]:
|
101
114
|
txt = [
|
102
115
|
cg.StructInitializer(
|
103
116
|
MDNSTXTRecord,
|
104
|
-
("key", txt_key),
|
117
|
+
("key", cg.RawExpression(f"MDNS_STR({cg.safe_exp(txt_key)})")),
|
105
118
|
("value", await cg.templatable(txt_value, [], cg.std_string)),
|
106
119
|
)
|
107
120
|
for txt_key, txt_value in service[CONF_TXT].items()
|
@@ -9,24 +9,21 @@
|
|
9
9
|
#include <pgmspace.h>
|
10
10
|
// Macro to define strings in PROGMEM on ESP8266, regular memory on other platforms
|
11
11
|
#define MDNS_STATIC_CONST_CHAR(name, value) static const char name[] PROGMEM = value
|
12
|
-
// Helper to
|
12
|
+
// Helper to convert PROGMEM string to std::string for TemplatableValue
|
13
13
|
// Only define this function if we have services that will use it
|
14
14
|
#if defined(USE_API) || defined(USE_PROMETHEUS) || defined(USE_WEBSERVER) || defined(USE_MDNS_EXTRA_SERVICES)
|
15
|
-
static std::string
|
15
|
+
static std::string mdns_str_value(PGM_P str) {
|
16
16
|
char buf[64];
|
17
|
-
strncpy_P(buf,
|
17
|
+
strncpy_P(buf, str, sizeof(buf) - 1);
|
18
18
|
buf[sizeof(buf) - 1] = '\0';
|
19
19
|
return std::string(buf);
|
20
20
|
}
|
21
|
-
#define
|
22
|
-
#else
|
23
|
-
// If no services are configured, we still need the fallback service but it uses string literals
|
24
|
-
#define MDNS_STR(name) std::string(name)
|
21
|
+
#define MDNS_STR_VALUE(name) mdns_str_value(name)
|
25
22
|
#endif
|
26
23
|
#else
|
27
24
|
// On non-ESP8266 platforms, use regular const char*
|
28
|
-
#define MDNS_STATIC_CONST_CHAR(name, value) static constexpr const char
|
29
|
-
#define
|
25
|
+
#define MDNS_STATIC_CONST_CHAR(name, value) static constexpr const char name[] = value
|
26
|
+
#define MDNS_STR_VALUE(name) std::string(name)
|
30
27
|
#endif
|
31
28
|
|
32
29
|
#ifdef USE_API
|
@@ -74,32 +71,12 @@ MDNS_STATIC_CONST_CHAR(NETWORK_THREAD, "thread");
|
|
74
71
|
void MDNSComponent::compile_records_() {
|
75
72
|
this->hostname_ = App.get_name();
|
76
73
|
|
77
|
-
//
|
78
|
-
|
79
|
-
#ifdef USE_API
|
80
|
-
if (api::global_api_server != nullptr) {
|
81
|
-
services_count++;
|
82
|
-
}
|
83
|
-
#endif
|
84
|
-
#ifdef USE_PROMETHEUS
|
85
|
-
services_count++;
|
86
|
-
#endif
|
87
|
-
#ifdef USE_WEBSERVER
|
88
|
-
services_count++;
|
89
|
-
#endif
|
90
|
-
#ifdef USE_MDNS_EXTRA_SERVICES
|
91
|
-
services_count += this->services_extra_.size();
|
92
|
-
#endif
|
93
|
-
// Reserve for fallback service if needed
|
94
|
-
if (services_count == 0) {
|
95
|
-
services_count = 1;
|
96
|
-
}
|
97
|
-
this->services_.reserve(services_count);
|
74
|
+
// IMPORTANT: The #ifdef blocks below must match COMPONENTS_WITH_MDNS_SERVICES
|
75
|
+
// in mdns/__init__.py. If you add a new service here, update both locations.
|
98
76
|
|
99
77
|
#ifdef USE_API
|
100
78
|
if (api::global_api_server != nullptr) {
|
101
|
-
this->services_.
|
102
|
-
auto &service = this->services_.back();
|
79
|
+
auto &service = this->services_.emplace_next();
|
103
80
|
service.service_type = MDNS_STR(SERVICE_ESPHOMELIB);
|
104
81
|
service.proto = MDNS_STR(SERVICE_TCP);
|
105
82
|
service.port = api::global_api_server->get_port();
|
@@ -138,31 +115,31 @@ void MDNSComponent::compile_records_() {
|
|
138
115
|
txt_records.push_back({MDNS_STR(TXT_MAC), get_mac_address()});
|
139
116
|
|
140
117
|
#ifdef USE_ESP8266
|
141
|
-
txt_records.push_back({MDNS_STR(TXT_PLATFORM),
|
118
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), MDNS_STR_VALUE(PLATFORM_ESP8266)});
|
142
119
|
#elif defined(USE_ESP32)
|
143
|
-
txt_records.push_back({MDNS_STR(TXT_PLATFORM),
|
120
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), MDNS_STR_VALUE(PLATFORM_ESP32)});
|
144
121
|
#elif defined(USE_RP2040)
|
145
|
-
txt_records.push_back({MDNS_STR(TXT_PLATFORM),
|
122
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), MDNS_STR_VALUE(PLATFORM_RP2040)});
|
146
123
|
#elif defined(USE_LIBRETINY)
|
147
|
-
txt_records.
|
124
|
+
txt_records.push_back({MDNS_STR(TXT_PLATFORM), lt_cpu_get_model_name()});
|
148
125
|
#endif
|
149
126
|
|
150
127
|
txt_records.push_back({MDNS_STR(TXT_BOARD), ESPHOME_BOARD});
|
151
128
|
|
152
129
|
#if defined(USE_WIFI)
|
153
|
-
txt_records.push_back({MDNS_STR(TXT_NETWORK),
|
130
|
+
txt_records.push_back({MDNS_STR(TXT_NETWORK), MDNS_STR_VALUE(NETWORK_WIFI)});
|
154
131
|
#elif defined(USE_ETHERNET)
|
155
|
-
txt_records.push_back({MDNS_STR(TXT_NETWORK),
|
132
|
+
txt_records.push_back({MDNS_STR(TXT_NETWORK), MDNS_STR_VALUE(NETWORK_ETHERNET)});
|
156
133
|
#elif defined(USE_OPENTHREAD)
|
157
|
-
txt_records.push_back({MDNS_STR(TXT_NETWORK),
|
134
|
+
txt_records.push_back({MDNS_STR(TXT_NETWORK), MDNS_STR_VALUE(NETWORK_THREAD)});
|
158
135
|
#endif
|
159
136
|
|
160
137
|
#ifdef USE_API_NOISE
|
161
138
|
MDNS_STATIC_CONST_CHAR(NOISE_ENCRYPTION, "Noise_NNpsk0_25519_ChaChaPoly_SHA256");
|
162
139
|
if (api::global_api_server->get_noise_ctx()->has_psk()) {
|
163
|
-
txt_records.push_back({MDNS_STR(TXT_API_ENCRYPTION),
|
140
|
+
txt_records.push_back({MDNS_STR(TXT_API_ENCRYPTION), MDNS_STR_VALUE(NOISE_ENCRYPTION)});
|
164
141
|
} else {
|
165
|
-
txt_records.push_back({MDNS_STR(TXT_API_ENCRYPTION_SUPPORTED),
|
142
|
+
txt_records.push_back({MDNS_STR(TXT_API_ENCRYPTION_SUPPORTED), MDNS_STR_VALUE(NOISE_ENCRYPTION)});
|
166
143
|
}
|
167
144
|
#endif
|
168
145
|
|
@@ -178,34 +155,27 @@ void MDNSComponent::compile_records_() {
|
|
178
155
|
#endif // USE_API
|
179
156
|
|
180
157
|
#ifdef USE_PROMETHEUS
|
181
|
-
this->services_.
|
182
|
-
auto &prom_service = this->services_.back();
|
158
|
+
auto &prom_service = this->services_.emplace_next();
|
183
159
|
prom_service.service_type = MDNS_STR(SERVICE_PROMETHEUS);
|
184
160
|
prom_service.proto = MDNS_STR(SERVICE_TCP);
|
185
161
|
prom_service.port = USE_WEBSERVER_PORT;
|
186
162
|
#endif
|
187
163
|
|
188
164
|
#ifdef USE_WEBSERVER
|
189
|
-
this->services_.
|
190
|
-
auto &web_service = this->services_.back();
|
165
|
+
auto &web_service = this->services_.emplace_next();
|
191
166
|
web_service.service_type = MDNS_STR(SERVICE_HTTP);
|
192
167
|
web_service.proto = MDNS_STR(SERVICE_TCP);
|
193
168
|
web_service.port = USE_WEBSERVER_PORT;
|
194
169
|
#endif
|
195
170
|
|
196
|
-
#ifdef USE_MDNS_EXTRA_SERVICES
|
197
|
-
this->services_.insert(this->services_.end(), this->services_extra_.begin(), this->services_extra_.end());
|
198
|
-
#endif
|
199
|
-
|
200
171
|
#if !defined(USE_API) && !defined(USE_PROMETHEUS) && !defined(USE_WEBSERVER) && !defined(USE_MDNS_EXTRA_SERVICES)
|
201
172
|
// Publish "http" service if not using native API or any other services
|
202
173
|
// This is just to have *some* mDNS service so that .local resolution works
|
203
|
-
this->services_.
|
204
|
-
|
205
|
-
fallback_service.
|
206
|
-
fallback_service.proto = "_tcp";
|
174
|
+
auto &fallback_service = this->services_.emplace_next();
|
175
|
+
fallback_service.service_type = MDNS_STR(SERVICE_HTTP);
|
176
|
+
fallback_service.proto = MDNS_STR(SERVICE_TCP);
|
207
177
|
fallback_service.port = USE_WEBSERVER_PORT;
|
208
|
-
fallback_service.txt_records.
|
178
|
+
fallback_service.txt_records.push_back({MDNS_STR(TXT_VERSION), ESPHOME_VERSION});
|
209
179
|
#endif
|
210
180
|
}
|
211
181
|
|
@@ -214,21 +184,19 @@ void MDNSComponent::dump_config() {
|
|
214
184
|
"mDNS:\n"
|
215
185
|
" Hostname: %s",
|
216
186
|
this->hostname_.c_str());
|
217
|
-
#if ESPHOME_LOG_LEVEL >=
|
187
|
+
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
|
218
188
|
ESP_LOGV(TAG, " Services:");
|
219
189
|
for (const auto &service : this->services_) {
|
220
|
-
ESP_LOGV(TAG, " - %s, %s, %d", service.service_type
|
190
|
+
ESP_LOGV(TAG, " - %s, %s, %d", MDNS_STR_ARG(service.service_type), MDNS_STR_ARG(service.proto),
|
221
191
|
const_cast<TemplatableValue<uint16_t> &>(service.port).value());
|
222
192
|
for (const auto &record : service.txt_records) {
|
223
|
-
ESP_LOGV(TAG, " TXT: %s = %s", record.key
|
193
|
+
ESP_LOGV(TAG, " TXT: %s = %s", MDNS_STR_ARG(record.key),
|
224
194
|
const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
|
225
195
|
}
|
226
196
|
}
|
227
197
|
#endif
|
228
198
|
}
|
229
199
|
|
230
|
-
std::vector<MDNSService> MDNSComponent::get_services() { return this->services_; }
|
231
|
-
|
232
200
|
} // namespace mdns
|
233
201
|
} // namespace esphome
|
234
202
|
#endif
|
@@ -2,25 +2,41 @@
|
|
2
2
|
#include "esphome/core/defines.h"
|
3
3
|
#ifdef USE_MDNS
|
4
4
|
#include <string>
|
5
|
-
#include <vector>
|
6
5
|
#include "esphome/core/automation.h"
|
7
6
|
#include "esphome/core/component.h"
|
7
|
+
#include "esphome/core/helpers.h"
|
8
8
|
|
9
9
|
namespace esphome {
|
10
10
|
namespace mdns {
|
11
11
|
|
12
|
+
// Helper struct that identifies strings that may be stored in flash storage (similar to LogString)
|
13
|
+
struct MDNSString;
|
14
|
+
|
15
|
+
// Macro to cast string literals to MDNSString* (works on all platforms)
|
16
|
+
#define MDNS_STR(name) (reinterpret_cast<const esphome::mdns::MDNSString *>(name))
|
17
|
+
|
18
|
+
#ifdef USE_ESP8266
|
19
|
+
#include <pgmspace.h>
|
20
|
+
#define MDNS_STR_ARG(s) ((PGM_P) (s))
|
21
|
+
#else
|
22
|
+
#define MDNS_STR_ARG(s) (reinterpret_cast<const char *>(s))
|
23
|
+
#endif
|
24
|
+
|
25
|
+
// Service count is calculated at compile time by Python codegen
|
26
|
+
// MDNS_SERVICE_COUNT will always be defined
|
27
|
+
|
12
28
|
struct MDNSTXTRecord {
|
13
|
-
|
29
|
+
const MDNSString *key;
|
14
30
|
TemplatableValue<std::string> value;
|
15
31
|
};
|
16
32
|
|
17
33
|
struct MDNSService {
|
18
34
|
// service name _including_ underscore character prefix
|
19
35
|
// as defined in RFC6763 Section 7
|
20
|
-
|
36
|
+
const MDNSString *service_type;
|
21
37
|
// second label indicating protocol _including_ underscore character prefix
|
22
38
|
// as defined in RFC6763 Section 7, like "_tcp" or "_udp"
|
23
|
-
|
39
|
+
const MDNSString *proto;
|
24
40
|
TemplatableValue<uint16_t> port;
|
25
41
|
std::vector<MDNSTXTRecord> txt_records;
|
26
42
|
};
|
@@ -36,18 +52,15 @@ class MDNSComponent : public Component {
|
|
36
52
|
float get_setup_priority() const override { return setup_priority::AFTER_CONNECTION; }
|
37
53
|
|
38
54
|
#ifdef USE_MDNS_EXTRA_SERVICES
|
39
|
-
void add_extra_service(MDNSService service) {
|
55
|
+
void add_extra_service(MDNSService service) { this->services_.emplace_next() = std::move(service); }
|
40
56
|
#endif
|
41
57
|
|
42
|
-
|
58
|
+
const StaticVector<MDNSService, MDNS_SERVICE_COUNT> &get_services() const { return this->services_; }
|
43
59
|
|
44
60
|
void on_shutdown() override;
|
45
61
|
|
46
62
|
protected:
|
47
|
-
|
48
|
-
std::vector<MDNSService> services_extra_{};
|
49
|
-
#endif
|
50
|
-
std::vector<MDNSService> services_{};
|
63
|
+
StaticVector<MDNSService, MDNS_SERVICE_COUNT> services_{};
|
51
64
|
std::string hostname_;
|
52
65
|
void compile_records_();
|
53
66
|
};
|
@@ -29,23 +29,23 @@ void MDNSComponent::setup() {
|
|
29
29
|
std::vector<mdns_txt_item_t> txt_records;
|
30
30
|
for (const auto &record : service.txt_records) {
|
31
31
|
mdns_txt_item_t it{};
|
32
|
-
//
|
33
|
-
it.key =
|
32
|
+
// key is a compile-time string literal in flash, no need to strdup
|
33
|
+
it.key = MDNS_STR_ARG(record.key);
|
34
|
+
// value is a temporary from TemplatableValue, must strdup to keep it alive
|
34
35
|
it.value = strdup(const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
|
35
36
|
txt_records.push_back(it);
|
36
37
|
}
|
37
38
|
uint16_t port = const_cast<TemplatableValue<uint16_t> &>(service.port).value();
|
38
|
-
err = mdns_service_add(nullptr, service.service_type
|
39
|
-
txt_records.size());
|
39
|
+
err = mdns_service_add(nullptr, MDNS_STR_ARG(service.service_type), MDNS_STR_ARG(service.proto), port,
|
40
|
+
txt_records.data(), txt_records.size());
|
40
41
|
|
41
42
|
// free records
|
42
43
|
for (const auto &it : txt_records) {
|
43
|
-
|
44
|
-
delete it.value; // NOLINT(cppcoreguidelines-owning-memory)
|
44
|
+
free((void *) it.value); // NOLINT(cppcoreguidelines-no-malloc)
|
45
45
|
}
|
46
46
|
|
47
47
|
if (err != ESP_OK) {
|
48
|
-
ESP_LOGW(TAG, "Failed to register service %s: %s", service.service_type
|
48
|
+
ESP_LOGW(TAG, "Failed to register service %s: %s", MDNS_STR_ARG(service.service_type), esp_err_to_name(err));
|
49
49
|
}
|
50
50
|
}
|
51
51
|
}
|
@@ -21,18 +21,18 @@ void MDNSComponent::setup() {
|
|
21
21
|
// part of the wire protocol to have an underscore, and for example ESP-IDF
|
22
22
|
// expects the underscore to be there, the ESP8266 implementation always adds
|
23
23
|
// the underscore itself.
|
24
|
-
auto *proto = service.proto
|
25
|
-
while (*proto == '_') {
|
24
|
+
auto *proto = MDNS_STR_ARG(service.proto);
|
25
|
+
while (progmem_read_byte((const uint8_t *) proto) == '_') {
|
26
26
|
proto++;
|
27
27
|
}
|
28
|
-
auto *service_type = service.service_type
|
29
|
-
while (*service_type == '_') {
|
28
|
+
auto *service_type = MDNS_STR_ARG(service.service_type);
|
29
|
+
while (progmem_read_byte((const uint8_t *) service_type) == '_') {
|
30
30
|
service_type++;
|
31
31
|
}
|
32
32
|
uint16_t port = const_cast<TemplatableValue<uint16_t> &>(service.port).value();
|
33
|
-
MDNS.addService(service_type, proto, port);
|
33
|
+
MDNS.addService(FPSTR(service_type), FPSTR(proto), port);
|
34
34
|
for (const auto &record : service.txt_records) {
|
35
|
-
MDNS.addServiceTxt(service_type, proto, record.key
|
35
|
+
MDNS.addServiceTxt(FPSTR(service_type), FPSTR(proto), FPSTR(MDNS_STR_ARG(record.key)),
|
36
36
|
const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
|
37
37
|
}
|
38
38
|
}
|
@@ -21,18 +21,18 @@ void MDNSComponent::setup() {
|
|
21
21
|
// part of the wire protocol to have an underscore, and for example ESP-IDF
|
22
22
|
// expects the underscore to be there, the ESP8266 implementation always adds
|
23
23
|
// the underscore itself.
|
24
|
-
auto *proto = service.proto
|
24
|
+
auto *proto = MDNS_STR_ARG(service.proto);
|
25
25
|
while (*proto == '_') {
|
26
26
|
proto++;
|
27
27
|
}
|
28
|
-
auto *service_type = service.service_type
|
28
|
+
auto *service_type = MDNS_STR_ARG(service.service_type);
|
29
29
|
while (*service_type == '_') {
|
30
30
|
service_type++;
|
31
31
|
}
|
32
32
|
uint16_t port_ = const_cast<TemplatableValue<uint16_t> &>(service.port).value();
|
33
33
|
MDNS.addService(service_type, proto, port_);
|
34
34
|
for (const auto &record : service.txt_records) {
|
35
|
-
MDNS.addServiceTxt(service_type, proto, record.key
|
35
|
+
MDNS.addServiceTxt(service_type, proto, MDNS_STR_ARG(record.key),
|
36
36
|
const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
|
37
37
|
}
|
38
38
|
}
|
@@ -21,18 +21,18 @@ void MDNSComponent::setup() {
|
|
21
21
|
// part of the wire protocol to have an underscore, and for example ESP-IDF
|
22
22
|
// expects the underscore to be there, the ESP8266 implementation always adds
|
23
23
|
// the underscore itself.
|
24
|
-
auto *proto = service.proto
|
24
|
+
auto *proto = MDNS_STR_ARG(service.proto);
|
25
25
|
while (*proto == '_') {
|
26
26
|
proto++;
|
27
27
|
}
|
28
|
-
auto *service_type = service.service_type
|
28
|
+
auto *service_type = MDNS_STR_ARG(service.service_type);
|
29
29
|
while (*service_type == '_') {
|
30
30
|
service_type++;
|
31
31
|
}
|
32
32
|
uint16_t port = const_cast<TemplatableValue<uint16_t> &>(service.port).value();
|
33
33
|
MDNS.addService(service_type, proto, port);
|
34
34
|
for (const auto &record : service.txt_records) {
|
35
|
-
MDNS.addServiceTxt(service_type, proto, record.key
|
35
|
+
MDNS.addServiceTxt(service_type, proto, MDNS_STR_ARG(record.key),
|
36
36
|
const_cast<TemplatableValue<std::string> &>(record.value).value().c_str());
|
37
37
|
}
|
38
38
|
}
|
@@ -343,11 +343,7 @@ class DriverChip:
|
|
343
343
|
)
|
344
344
|
offset_height = native_height - height - offset_height
|
345
345
|
# Swap default dimensions if swap_xy is set, or if rotation is 90/270 and we are not using a buffer
|
346
|
-
|
347
|
-
90,
|
348
|
-
270,
|
349
|
-
)
|
350
|
-
if transform.get(CONF_SWAP_XY) is True or rotated:
|
346
|
+
if transform.get(CONF_SWAP_XY) is True:
|
351
347
|
width, height = height, width
|
352
348
|
offset_height, offset_width = offset_width, offset_height
|
353
349
|
return width, height, offset_width, offset_height
|
@@ -380,25 +380,41 @@ def get_instance(config):
|
|
380
380
|
bus_type = BusTypes[bus_type]
|
381
381
|
buffer_type = cg.uint8 if color_depth == 8 else cg.uint16
|
382
382
|
frac = denominator(config)
|
383
|
-
rotation =
|
383
|
+
rotation = (
|
384
384
|
0 if model.rotation_as_transform(config) else config.get(CONF_ROTATION, 0)
|
385
|
-
|
385
|
+
)
|
386
386
|
templateargs = [
|
387
387
|
buffer_type,
|
388
388
|
bufferpixels,
|
389
389
|
config[CONF_BYTE_ORDER] == "big_endian",
|
390
390
|
display_pixel_mode,
|
391
391
|
bus_type,
|
392
|
-
width,
|
393
|
-
height,
|
394
|
-
offset_width,
|
395
|
-
offset_height,
|
396
392
|
]
|
397
393
|
# If a buffer is required, use MipiSpiBuffer, otherwise use MipiSpi
|
398
394
|
if requires_buffer(config):
|
399
|
-
templateargs.
|
400
|
-
|
395
|
+
templateargs.extend(
|
396
|
+
[
|
397
|
+
width,
|
398
|
+
height,
|
399
|
+
offset_width,
|
400
|
+
offset_height,
|
401
|
+
DISPLAY_ROTATIONS[rotation],
|
402
|
+
frac,
|
403
|
+
]
|
404
|
+
)
|
401
405
|
return MipiSpiBuffer, templateargs
|
406
|
+
# Swap height and width if the display is rotated 90 or 270 degrees in software
|
407
|
+
if rotation in (90, 270):
|
408
|
+
width, height = height, width
|
409
|
+
offset_width, offset_height = offset_height, offset_width
|
410
|
+
templateargs.extend(
|
411
|
+
[
|
412
|
+
width,
|
413
|
+
height,
|
414
|
+
offset_width,
|
415
|
+
offset_height,
|
416
|
+
]
|
417
|
+
)
|
402
418
|
return MipiSpi, templateargs
|
403
419
|
|
404
420
|
|
@@ -340,7 +340,7 @@ class MipiSpi : public display::Display,
|
|
340
340
|
this->write_cmd_addr_data(0, 0, 0, 0, ptr, w * h, 8);
|
341
341
|
}
|
342
342
|
} else {
|
343
|
-
for (size_t y = 0; y != h; y++) {
|
343
|
+
for (size_t y = 0; y != static_cast<size_t>(h); y++) {
|
344
344
|
if constexpr (BUS_TYPE == BUS_TYPE_SINGLE || BUS_TYPE == BUS_TYPE_SINGLE_16) {
|
345
345
|
this->write_array(ptr, w);
|
346
346
|
} else if constexpr (BUS_TYPE == BUS_TYPE_QUAD) {
|
@@ -372,8 +372,8 @@ class MipiSpi : public display::Display,
|
|
372
372
|
uint8_t dbuffer[DISPLAYPIXEL * 48];
|
373
373
|
uint8_t *dptr = dbuffer;
|
374
374
|
auto stride = x_offset + w + x_pad; // stride in pixels
|
375
|
-
for (size_t y = 0; y != h; y++) {
|
376
|
-
for (size_t x = 0; x != w; x++) {
|
375
|
+
for (size_t y = 0; y != static_cast<size_t>(h); y++) {
|
376
|
+
for (size_t x = 0; x != static_cast<size_t>(w); x++) {
|
377
377
|
auto color_val = ptr[y * stride + x];
|
378
378
|
if constexpr (DISPLAYPIXEL == PIXEL_MODE_18 && BUFFERPIXEL == PIXEL_MODE_16) {
|
379
379
|
// 16 to 18 bit conversion
|