From be94a6cac84a645e3e962c05f3ee36c7de49dd6b Mon Sep 17 00:00:00 2001 From: anishsane Date: Sun, 29 Oct 2023 21:44:44 +0530 Subject: [PATCH] Fix for CmndHDMIAddr function. (#19866) * Fix for CmndHDMIAddr function. 1. Typical values for XdrvMailbox.payload are 0x1000...0x4000. Hence the check should be (value > 0). 2. Don't overwrite the user supplied value with value read from the hardware. * Correct the condition in CEC_Device::OnReady. We should check for _on_ready_cb before calling _on_ready_cb. --- tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino | 2 +- tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino b/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino index dcc05fbaa..0581fba71 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_70_0_hdmi_cec.ino @@ -1116,7 +1116,7 @@ bool IRAM_ATTR CEC_Device::setLineState(bool state, bool check) // manage callbacks void CEC_Device::OnReady(int logical_address) { - if (_on_rx_cb) { _on_ready_cb(this, logical_address); } + if (_on_ready_cb) { _on_ready_cb(this, logical_address); } // This is called after the logical address has been allocated int physical_address = getPhysicalAddress(); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino b/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino index 346138199..e77e1a5b0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_70_1_hdmi_cec.ino @@ -284,13 +284,13 @@ uint16_t HDMIGetPhysicalAddress(void) { void CmndHDMIAddr(void) { if (XdrvMailbox.data_len > 0) { - if ((XdrvMailbox.payload < 1)) { + if ((XdrvMailbox.payload > 0)) { uint16_t hdmi_addr = XdrvMailbox.payload; Settings->hdmi_addr[0] = (hdmi_addr) & 0xFF; Settings->hdmi_addr[1] = (hdmi_addr >> 8) & 0xFF; } } - uint16_t hdmi_addr = HDMIGetPhysicalAddress(); + uint16_t hdmi_addr = HDMI_CEC_device->discoverPhysicalAddress(); Response_P(PSTR("{\"%s\":\"0x%04X\"}"), XdrvMailbox.command, hdmi_addr); }