Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDF release/v5.3 #10599

Merged
merged 10 commits into from
Nov 13, 2024
8 changes: 5 additions & 3 deletions idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ dependencies:
espressif/esp_modem:
version: "^1.1.0"
espressif/esp-zboss-lib:
version: "^1.0.1"
version: "==1.6.0"
require: public
rules:
- if: "target not in [esp32c2, esp32p4]"
espressif/esp-zigbee-lib:
version: "^1.0.1"
version: "==1.6.0"
require: public
rules:
- if: "target not in [esp32c2, esp32p4]"
espressif/esp-dsp:
Expand Down Expand Up @@ -101,7 +103,7 @@ dependencies:
rules:
- if: "target in [esp32s3]"
espressif/esp_hosted:
version: "^0.0.22"
version: "^0.0.25"
rules:
- if: "target == esp32p4"
espressif/esp_wifi_remote:
Expand Down
35 changes: 29 additions & 6 deletions libraries/WiFi/src/WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,34 @@ extern "C" void phy_bbpll_en_usb(bool en);
#endif

#if CONFIG_ESP_WIFI_REMOTE_ENABLED
extern "C" esp_err_t esp_hosted_init(void *);
extern "C" {
//#include "esp_hosted.h"
#include "esp_hosted_transport_config.h"
extern esp_err_t esp_hosted_init();
extern esp_err_t esp_hosted_deinit();
};
static bool hosted_initialized = false;

static bool wifiHostedInit() {
static bool initialized = false;
if (!initialized) {
initialized = true;
if (esp_hosted_init(NULL) != ESP_OK) {
if (!hosted_initialized) {
hosted_initialized = true;
struct esp_hosted_sdio_config conf = INIT_DEFAULT_HOST_SDIO_CONFIG();
conf.pin_clk.pin = CONFIG_ESP_SDIO_PIN_CLK;
conf.pin_cmd.pin = CONFIG_ESP_SDIO_PIN_CMD;
conf.pin_d0.pin = CONFIG_ESP_SDIO_PIN_D0;
conf.pin_d1.pin = CONFIG_ESP_SDIO_PIN_D1;
conf.pin_d2.pin = CONFIG_ESP_SDIO_PIN_D2;
conf.pin_d3.pin = CONFIG_ESP_SDIO_PIN_D3;
//conf.pin_rst.pin = CONFIG_ESP_SDIO_GPIO_RESET_SLAVE;
// esp_hosted_sdio_set_config() will fail on second attempt but here temporarily to not cause exception on reinit
if (esp_hosted_sdio_set_config(&conf) != ESP_OK || esp_hosted_init() != ESP_OK) {
log_e("esp_hosted_init failed!");
hosted_initialized = false;
return false;
}
log_v("ESP-HOSTED initialized!");
}
// Attach pins to periman here
// Attach pins to PeriMan here
// Slave chip model is CONFIG_IDF_SLAVE_TARGET
// CONFIG_ESP_SDIO_PIN_CMD
// CONFIG_ESP_SDIO_PIN_CLK
Expand Down Expand Up @@ -337,6 +353,13 @@ static bool wifiLowLevelDeinit() {
arduino_event_t arduino_event;
arduino_event.event_id = ARDUINO_EVENT_WIFI_OFF;
Network.postEvent(&arduino_event);
#if CONFIG_ESP_WIFI_REMOTE_ENABLED
if (hosted_initialized && esp_hosted_deinit() == ESP_OK) {
hosted_initialized = false;
log_v("ESP-HOSTED uninitialized!");
// detach SDIO pins from PeriMan
}
#endif
}
}
return !lowLevelInitDone;
Expand Down
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ZigbeeCore.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Zigbee Core Functions */

#include "ZigbeeCore.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeHandlers.cpp"
#include "Arduino.h"
Expand Down Expand Up @@ -407,4 +407,4 @@ const char *ZigbeeCore::getDeviceTypeString(esp_zb_ha_standard_devices_t deviceI

ZigbeeCore Zigbee = ZigbeeCore();

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ZigbeeCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "esp_zigbee_core.h"
#include "zdo/esp_zigbee_zdo_common.h"
Expand Down Expand Up @@ -122,4 +123,4 @@ class ZigbeeCore {

extern ZigbeeCore Zigbee;

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 2 additions & 3 deletions libraries/Zigbee/src/ZigbeeEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "ZigbeeEP.h"

#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "esp_zigbee_cluster.h"
#include "zcl/esp_zigbee_zcl_power_config.h"
Expand Down Expand Up @@ -104,7 +104,6 @@ void ZigbeeEP::reportBatteryPercentage() {
esp_zb_zcl_report_attr_cmd_t report_attr_cmd;
report_attr_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
report_attr_cmd.attributeID = ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_REMAINING_ID;
report_attr_cmd.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
report_attr_cmd.clusterID = ESP_ZB_ZCL_CLUSTER_ID_POWER_CONFIG;
report_attr_cmd.zcl_basic_cmd.src_endpoint = _endpoint;

Expand Down Expand Up @@ -210,4 +209,4 @@ void ZigbeeEP::zbIdentify(const esp_zb_zcl_set_attr_value_message_t *message) {
}
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ZigbeeEP.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma once

#include "ZigbeeCore.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include <Arduino.h>

Expand Down Expand Up @@ -126,4 +126,4 @@ class ZigbeeEP {
friend class ZigbeeCore;
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ZigbeeHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "ZigbeeCore.h"
#include "Arduino.h"

#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

// forward declaration of all implemented handlers
static esp_err_t zb_attribute_set_handler(const esp_zb_zcl_set_attr_value_message_t *message);
Expand Down Expand Up @@ -138,4 +138,4 @@ static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_m
return ESP_OK;
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ZigbeeColorDimmableLight.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

ZigbeeColorDimmableLight::ZigbeeColorDimmableLight(uint8_t endpoint) : ZigbeeEP(endpoint) {
_device_id = ESP_ZB_HA_COLOR_DIMMABLE_LIGHT_DEVICE_ID;
Expand Down Expand Up @@ -109,4 +109,4 @@ void ZigbeeColorDimmableLight::lightChanged() {
}
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
Expand Down Expand Up @@ -38,4 +39,4 @@ class ZigbeeColorDimmableLight : public ZigbeeEP {
uint16_t _current_blue;
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ZigbeeColorDimmerSwitch.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

// Initialize the static instance pointer
ZigbeeColorDimmerSwitch *ZigbeeColorDimmerSwitch::_instance = nullptr;
Expand Down Expand Up @@ -400,4 +400,4 @@ void ZigbeeColorDimmerSwitch::setLightColor(uint8_t red, uint8_t green, uint8_t
}
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
Expand Down Expand Up @@ -57,4 +58,4 @@ class ZigbeeColorDimmerSwitch : public ZigbeeEP {
void calculateXY(uint8_t red, uint8_t green, uint8_t blue, uint16_t &x, uint16_t &y);
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeLight.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ZigbeeLight.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

ZigbeeLight::ZigbeeLight(uint8_t endpoint) : ZigbeeEP(endpoint) {
_device_id = ESP_ZB_HA_ON_OFF_LIGHT_DEVICE_ID;
Expand Down Expand Up @@ -33,4 +33,4 @@ void ZigbeeLight::lightChanged() {
}
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
Expand All @@ -30,4 +31,4 @@ class ZigbeeLight : public ZigbeeEP {
bool _current_state;
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeSwitch.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ZigbeeSwitch.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

// Initialize the static instance pointer
ZigbeeSwitch *ZigbeeSwitch::_instance = nullptr;
Expand Down Expand Up @@ -230,4 +230,4 @@ void ZigbeeSwitch::lightOnWithTimedOff(uint8_t on_off_control, uint16_t time_on,
}
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeSwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
Expand Down Expand Up @@ -39,4 +40,4 @@ class ZigbeeSwitch : public ZigbeeEP {
static void findCb(esp_zb_zdp_status_t zdo_status, uint16_t addr, uint8_t endpoint, void *user_ctx);
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
6 changes: 2 additions & 4 deletions libraries/Zigbee/src/ep/ZigbeeTempSensor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ZigbeeTempSensor.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

ZigbeeTempSensor::ZigbeeTempSensor(uint8_t endpoint) : ZigbeeEP(endpoint) {
_device_id = ESP_ZB_HA_TEMPERATURE_SENSOR_DEVICE_ID;
Expand Down Expand Up @@ -80,7 +80,6 @@ void ZigbeeTempSensor::reportTemperature() {
esp_zb_zcl_report_attr_cmd_t report_attr_cmd;
report_attr_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
report_attr_cmd.attributeID = ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID;
report_attr_cmd.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
report_attr_cmd.clusterID = ESP_ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;
report_attr_cmd.zcl_basic_cmd.src_endpoint = _endpoint;

Expand Down Expand Up @@ -121,7 +120,6 @@ void ZigbeeTempSensor::reportHumidity() {
esp_zb_zcl_report_attr_cmd_t report_attr_cmd;
report_attr_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
report_attr_cmd.attributeID = ESP_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID;
report_attr_cmd.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
report_attr_cmd.clusterID = ESP_ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT;
report_attr_cmd.zcl_basic_cmd.src_endpoint = _endpoint;

Expand Down Expand Up @@ -161,4 +159,4 @@ void ZigbeeTempSensor::setHumidityReporting(uint16_t min_interval, uint16_t max_
esp_zb_zcl_update_reporting_info(&reporting_info);
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeTempSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
Expand Down Expand Up @@ -41,4 +42,4 @@ class ZigbeeTempSensor : public ZigbeeEP {
void reportHumidity();
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
6 changes: 3 additions & 3 deletions libraries/Zigbee/src/ep/ZigbeeThermostat.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ZigbeeThermostat.h"
#if SOC_IEEE802154_SUPPORTED
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

static float zb_s16_to_temperature(int16_t value) {
return 1.0 * value / 100;
Expand Down Expand Up @@ -185,7 +185,7 @@ void ZigbeeThermostat::setTemperatureReporting(uint16_t min_interval, uint16_t m
int16_t report_change = (int16_t)delta * 100;
esp_zb_zcl_config_report_record_t records[] = {
{
.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV,
.direction = ESP_ZB_ZCL_REPORT_DIRECTION_SEND,
.attributeID = ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID,
.attrType = ESP_ZB_ZCL_ATTR_TYPE_S16,
.min_interval = min_interval,
Expand All @@ -202,4 +202,4 @@ void ZigbeeThermostat::setTemperatureReporting(uint16_t min_interval, uint16_t m
esp_zb_lock_release();
}

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
5 changes: 3 additions & 2 deletions libraries/Zigbee/src/ep/ZigbeeThermostat.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#pragma once

#include "soc/soc_caps.h"
#if SOC_IEEE802154_SUPPORTED
#include "sdkconfig.h"
#if SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED

#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
Expand Down Expand Up @@ -61,4 +62,4 @@ class ZigbeeThermostat : public ZigbeeEP {
void zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute) override;
};

#endif //SOC_IEEE802154_SUPPORTED
#endif //SOC_IEEE802154_SUPPORTED && CONFIG_ZB_ENABLED
Loading
Loading