Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
603b407df4 | |||
049463f648 | |||
d40bb7d52e |
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,9 +1,3 @@
|
|||||||
[submodule "components/zh_network"]
|
|
||||||
path = components/zh_network
|
|
||||||
url = https://github.com/aZholtikov/zh_network
|
|
||||||
[submodule "components/zh_vector"]
|
|
||||||
path = components/zh_vector
|
|
||||||
url = https://github.com/aZholtikov/zh_vector
|
|
||||||
[submodule "components/zh_espnow"]
|
[submodule "components/zh_espnow"]
|
||||||
path = components/zh_espnow
|
path = components/zh_espnow
|
||||||
url = https://github.com/aZholtikov/zh_espnow
|
url = https://github.com/aZholtikov/zh_espnow
|
||||||
|
15
README.md
15
README.md
@ -1,27 +1,24 @@
|
|||||||
# ESP-NOW led
|
# ESP-NOW led
|
||||||
|
|
||||||
ESP-NOW based led controller/light for ESP32 ESP-IDF and ESP8266 RTOS SDK. Alternate firmware for Tuya/SmartLife/eWeLink WiFi led controllers/lights.
|
ESP-NOW based led controller/light for ESP32 ESP-IDF and ESP8266 RTOS_SDK. Alternate firmware for Tuya/SmartLife/eWeLink WiFi led controllers/lights.
|
||||||
|
|
||||||
## Tested on
|
## Tested on
|
||||||
|
|
||||||
1. ESP8266 RTOS_SDK v3.4
|
1. ESP8266 RTOS_SDK v3.4
|
||||||
2. ESP32 ESP-IDF v5.2
|
2. ESP32 ESP-IDF v5.4
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
1. Saves the last state when the power is turned off.
|
1. Saves the last state when the power is turned off.
|
||||||
2. Automatically adds led configuration to Home Assistan via MQTT discovery as a light.
|
2. Automatically adds led configuration to Home Assistan via MQTT discovery as a light.
|
||||||
3. Update firmware from HTTPS server via ESP-NOW.
|
3. Update firmware from HTTPS server via ESP-NOW.
|
||||||
4. Direct or mesh work mode.
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
1. Work mode must be same with [gateway](https://github.com/aZholtikov/zh_gateway) work mode.
|
1. For initial settings use "menuconfig -> ZH ESP-NOW Led Configuration". After first boot all settings will be stored in NVS memory for prevente change during OTA firmware update.
|
||||||
2. ESP-NOW mesh network based on the [zh_network](https://github.com/aZholtikov/zh_network).
|
2. To restart the led, send the "restart" command to the root topic of the led (example - "homeassistant/espnow_led/24-62-AB-F9-1F-A8").
|
||||||
3. For initial settings use "menuconfig -> ZH ESP-NOW Led Configuration". After first boot all settings will be stored in NVS memory for prevente change during OTA firmware update.
|
3. To update the led firmware, send the "update" command to the root topic of the led (example - "homeassistant/espnow_led/70-03-9F-44-BE-F7"). The update path should be like as "https://your_server/zh_espnow_led_esp32.bin" (for ESP32) or "https://your_server/zh_espnow_led_esp8266.app1.bin + https://your_server/zh_espnow_led_esp8266.app2.bin" (for ESP8266). Average update time is up to one minute. The status of the update will be displayed in the root led topic.
|
||||||
4. To restart the led, send the "restart" command to the root topic of the led (example - "homeassistant/espnow_led/24-62-AB-F9-1F-A8").
|
4. To change initial settings of the led (except work mode), send the X1,X2,X3,X4,X5,X6 command to the hardware topic of the led (example - "homeassistant/espnow_led/70-03-9F-44-BE-F7/hardware"). The configuration will only be accepted if it does not cause errors. The current configuration status is displayed in the configuration topic of the led (example - "homeassistant/espnow_led/70-03-9F-44-BE-F7/config").
|
||||||
5. To update the led firmware, send the "update" command to the root topic of the led (example - "homeassistant/espnow_led/70-03-9F-44-BE-F7"). The update path should be like as "https://your_server/zh_espnow_led_esp32.bin" (for ESP32) or "https://your_server/zh_espnow_led_esp8266.app1.bin + https://your_server/zh_espnow_led_esp8266.app2.bin" (for ESP8266). Average update time is up to some minutes. The online status of the update will be displayed in the root led topic.
|
|
||||||
6. To change initial settings of the led (except work mode), send the X1,X2,X3,X4,X5,X6 command to the hardware topic of the led (example - "homeassistant/espnow_led/70-03-9F-44-BE-F7/hardware"). The configuration will only be accepted if it does not cause errors. The current configuration status is displayed in the configuration topic of the led (example - "homeassistant/espnow_led/70-03-9F-44-BE-F7/config").
|
|
||||||
|
|
||||||
MQTT configuration message should filled according to the template "X1,X2,X3,X4,X5,X6". Where:
|
MQTT configuration message should filled according to the template "X1,X2,X3,X4,X5,X6". Where:
|
||||||
|
|
||||||
|
Submodule components/zh_espnow updated: d066c326e3...af7fa204e1
Submodule components/zh_network deleted from ebe0b8cbf5
Submodule components/zh_vector deleted from 4e0c0a6623
@ -9,17 +9,6 @@ menu "ZH ESP-NOW Led Configuration"
|
|||||||
default 18 if IDF_TARGET_ESP32C2
|
default 18 if IDF_TARGET_ESP32C2
|
||||||
default 19 if IDF_TARGET_ESP32C3
|
default 19 if IDF_TARGET_ESP32C3
|
||||||
default 30 if IDF_TARGET_ESP32C6
|
default 30 if IDF_TARGET_ESP32C6
|
||||||
|
|
||||||
choice NETWORK_TYPE
|
|
||||||
prompt "Network type"
|
|
||||||
help
|
|
||||||
Network type.
|
|
||||||
default NETWORK_TYPE_DIRECT
|
|
||||||
config NETWORK_TYPE_DIRECT
|
|
||||||
bool "DIRECT"
|
|
||||||
config NETWORK_TYPE_MESH
|
|
||||||
bool "MESH"
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
choice LED_TYPE
|
choice LED_TYPE
|
||||||
prompt "Led type"
|
prompt "Led type"
|
||||||
|
@ -15,23 +15,13 @@ void app_main(void)
|
|||||||
wifi_init_config_t wifi_init_config = WIFI_INIT_CONFIG_DEFAULT();
|
wifi_init_config_t wifi_init_config = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&wifi_init_config);
|
esp_wifi_init(&wifi_init_config);
|
||||||
esp_wifi_set_mode(WIFI_MODE_STA);
|
esp_wifi_set_mode(WIFI_MODE_STA);
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP8266
|
|
||||||
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);
|
|
||||||
#else
|
|
||||||
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_LR);
|
|
||||||
#endif
|
|
||||||
esp_wifi_start();
|
esp_wifi_start();
|
||||||
#ifdef CONFIG_NETWORK_TYPE_DIRECT
|
|
||||||
zh_espnow_init_config_t espnow_init_config = ZH_ESPNOW_INIT_CONFIG_DEFAULT();
|
zh_espnow_init_config_t espnow_init_config = ZH_ESPNOW_INIT_CONFIG_DEFAULT();
|
||||||
zh_espnow_init(&espnow_init_config);
|
zh_espnow_init(&espnow_init_config);
|
||||||
#else
|
|
||||||
zh_network_init_config_t network_init_config = ZH_NETWORK_INIT_CONFIG_DEFAULT();
|
|
||||||
zh_network_init(&network_init_config);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP8266
|
#ifdef CONFIG_IDF_TARGET_ESP8266
|
||||||
esp_event_handler_register(ZH_EVENT, ESP_EVENT_ANY_ID, &zh_espnow_event_handler, led_config);
|
esp_event_handler_register(ZH_ESPNOW, ESP_EVENT_ANY_ID, &zh_espnow_event_handler, led_config);
|
||||||
#else
|
#else
|
||||||
esp_event_handler_instance_register(ZH_EVENT, ESP_EVENT_ANY_ID, &zh_espnow_event_handler, led_config, NULL);
|
esp_event_handler_instance_register(ZH_ESPNOW, ESP_EVENT_ANY_ID, &zh_espnow_event_handler, led_config, NULL);
|
||||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||||
esp_ota_img_states_t ota_state = {0};
|
esp_ota_img_states_t ota_state = {0};
|
||||||
esp_ota_get_state_partition(running, &ota_state);
|
esp_ota_get_state_partition(running, &ota_state);
|
||||||
@ -50,7 +40,6 @@ void zh_load_config(led_config_t *led_config)
|
|||||||
uint8_t config_is_present = 0;
|
uint8_t config_is_present = 0;
|
||||||
if (nvs_get_u8(nvs_handle, "present", &config_is_present) == ESP_ERR_NVS_NOT_FOUND)
|
if (nvs_get_u8(nvs_handle, "present", &config_is_present) == ESP_ERR_NVS_NOT_FOUND)
|
||||||
{
|
{
|
||||||
nvs_set_u8(nvs_handle, "present", 0xFE);
|
|
||||||
nvs_close(nvs_handle);
|
nvs_close(nvs_handle);
|
||||||
SETUP_INITIAL_SETTINGS:
|
SETUP_INITIAL_SETTINGS:
|
||||||
#ifdef CONFIG_LED_TYPE_W
|
#ifdef CONFIG_LED_TYPE_W
|
||||||
@ -112,6 +101,7 @@ void zh_save_config(const led_config_t *led_config)
|
|||||||
{
|
{
|
||||||
nvs_handle_t nvs_handle = 0;
|
nvs_handle_t nvs_handle = 0;
|
||||||
nvs_open("config", NVS_READWRITE, &nvs_handle);
|
nvs_open("config", NVS_READWRITE, &nvs_handle);
|
||||||
|
nvs_set_u8(nvs_handle, "present", 0xFE);
|
||||||
nvs_set_u8(nvs_handle, "led_type", led_config->hardware_config.led_type);
|
nvs_set_u8(nvs_handle, "led_type", led_config->hardware_config.led_type);
|
||||||
nvs_set_u8(nvs_handle, "frs_white_pin", led_config->hardware_config.first_white_pin);
|
nvs_set_u8(nvs_handle, "frs_white_pin", led_config->hardware_config.first_white_pin);
|
||||||
nvs_set_u8(nvs_handle, "sec_white_pin", led_config->hardware_config.second_white_pin);
|
nvs_set_u8(nvs_handle, "sec_white_pin", led_config->hardware_config.second_white_pin);
|
||||||
@ -130,7 +120,6 @@ void zh_load_status(led_config_t *led_config)
|
|||||||
uint8_t status_is_present = 0;
|
uint8_t status_is_present = 0;
|
||||||
if (nvs_get_u8(nvs_handle, "present", &status_is_present) == ESP_ERR_NVS_NOT_FOUND)
|
if (nvs_get_u8(nvs_handle, "present", &status_is_present) == ESP_ERR_NVS_NOT_FOUND)
|
||||||
{
|
{
|
||||||
nvs_set_u8(nvs_handle, "present", 0xFE);
|
|
||||||
nvs_close(nvs_handle);
|
nvs_close(nvs_handle);
|
||||||
zh_save_status(led_config);
|
zh_save_status(led_config);
|
||||||
return;
|
return;
|
||||||
@ -149,6 +138,7 @@ void zh_save_status(const led_config_t *led_config)
|
|||||||
{
|
{
|
||||||
nvs_handle_t nvs_handle = 0;
|
nvs_handle_t nvs_handle = 0;
|
||||||
nvs_open("status", NVS_READWRITE, &nvs_handle);
|
nvs_open("status", NVS_READWRITE, &nvs_handle);
|
||||||
|
nvs_set_u8(nvs_handle, "present", 0xFE);
|
||||||
nvs_set_u8(nvs_handle, "led_state", led_config->status.status);
|
nvs_set_u8(nvs_handle, "led_state", led_config->status.status);
|
||||||
nvs_set_u8(nvs_handle, "bright_state", led_config->status.brightness);
|
nvs_set_u8(nvs_handle, "bright_state", led_config->status.brightness);
|
||||||
nvs_set_u16(nvs_handle, "temp_state", led_config->status.temperature);
|
nvs_set_u16(nvs_handle, "temp_state", led_config->status.temperature);
|
||||||
@ -429,14 +419,15 @@ void zh_send_led_attributes_message_task(void *pvParameter)
|
|||||||
data.payload_data.attributes_message.heap_size = esp_get_free_heap_size();
|
data.payload_data.attributes_message.heap_size = esp_get_free_heap_size();
|
||||||
data.payload_data.attributes_message.min_heap_size = esp_get_minimum_free_heap_size();
|
data.payload_data.attributes_message.min_heap_size = esp_get_minimum_free_heap_size();
|
||||||
data.payload_data.attributes_message.uptime = esp_timer_get_time() / 1000000;
|
data.payload_data.attributes_message.uptime = esp_timer_get_time() / 1000000;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
vTaskDelay(ZH_LED_ATTRIBUTES_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
vTaskDelay(ZH_LED_ATTRIBUTES_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zh_send_led_config_message(const led_config_t *led_config)
|
void zh_send_led_config_message_task(void *pvParameter)
|
||||||
{
|
{
|
||||||
|
led_config_t *led_config = pvParameter;
|
||||||
zh_espnow_data_t data = {0};
|
zh_espnow_data_t data = {0};
|
||||||
data.device_type = ZHDT_LED;
|
data.device_type = ZHDT_LED;
|
||||||
data.payload_type = ZHPT_CONFIG;
|
data.payload_type = ZHPT_CONFIG;
|
||||||
@ -448,11 +439,17 @@ void zh_send_led_config_message(const led_config_t *led_config)
|
|||||||
data.payload_data.config_message.led_config_message.optimistic = false;
|
data.payload_data.config_message.led_config_message.optimistic = false;
|
||||||
data.payload_data.config_message.led_config_message.qos = 2;
|
data.payload_data.config_message.led_config_message.qos = 2;
|
||||||
data.payload_data.config_message.led_config_message.retain = true;
|
data.payload_data.config_message.led_config_message.retain = true;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
for (;;)
|
||||||
|
{
|
||||||
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
|
vTaskDelay(ZH_LED_CONFIG_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zh_send_led_hardware_config_message(const led_config_t *led_config)
|
void zh_send_led_hardware_config_message_task(void *pvParameter)
|
||||||
{
|
{
|
||||||
|
led_config_t *led_config = pvParameter;
|
||||||
zh_espnow_data_t data = {0};
|
zh_espnow_data_t data = {0};
|
||||||
data.device_type = ZHDT_LED;
|
data.device_type = ZHDT_LED;
|
||||||
data.payload_type = ZHPT_HARDWARE;
|
data.payload_type = ZHPT_HARDWARE;
|
||||||
@ -462,7 +459,12 @@ void zh_send_led_hardware_config_message(const led_config_t *led_config)
|
|||||||
data.payload_data.config_message.led_hardware_config_message.red_pin = led_config->hardware_config.red_pin;
|
data.payload_data.config_message.led_hardware_config_message.red_pin = led_config->hardware_config.red_pin;
|
||||||
data.payload_data.config_message.led_hardware_config_message.green_pin = led_config->hardware_config.green_pin;
|
data.payload_data.config_message.led_hardware_config_message.green_pin = led_config->hardware_config.green_pin;
|
||||||
data.payload_data.config_message.led_hardware_config_message.blue_pin = led_config->hardware_config.blue_pin;
|
data.payload_data.config_message.led_hardware_config_message.blue_pin = led_config->hardware_config.blue_pin;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
for (;;)
|
||||||
|
{
|
||||||
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
|
vTaskDelay(ZH_LED_HARDWARE_CONFIG_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zh_send_led_keep_alive_message_task(void *pvParameter)
|
void zh_send_led_keep_alive_message_task(void *pvParameter)
|
||||||
@ -475,12 +477,33 @@ void zh_send_led_keep_alive_message_task(void *pvParameter)
|
|||||||
data.payload_data.keep_alive_message.message_frequency = ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY;
|
data.payload_data.keep_alive_message.message_frequency = ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
vTaskDelay(ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
vTaskDelay(ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void zh_send_led_status_message_task(void *pvParameter)
|
||||||
|
{
|
||||||
|
led_config_t *led_config = pvParameter;
|
||||||
|
zh_espnow_data_t data = {0};
|
||||||
|
data.device_type = ZHDT_LED;
|
||||||
|
data.payload_type = ZHPT_STATE;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
data.payload_data.status_message.led_status_message.status = led_config->status.status;
|
||||||
|
data.payload_data.status_message.led_status_message.brightness = led_config->status.brightness;
|
||||||
|
data.payload_data.status_message.led_status_message.temperature = led_config->status.temperature;
|
||||||
|
data.payload_data.status_message.led_status_message.red = led_config->status.red;
|
||||||
|
data.payload_data.status_message.led_status_message.green = led_config->status.green;
|
||||||
|
data.payload_data.status_message.led_status_message.blue = led_config->status.blue;
|
||||||
|
data.payload_data.status_message.led_status_message.effect = led_config->status.effect;
|
||||||
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
|
vTaskDelay(ZH_LED_STATUS_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void zh_send_led_status_message(const led_config_t *led_config)
|
void zh_send_led_status_message(const led_config_t *led_config)
|
||||||
{
|
{
|
||||||
zh_espnow_data_t data = {0};
|
zh_espnow_data_t data = {0};
|
||||||
@ -493,7 +516,7 @@ void zh_send_led_status_message(const led_config_t *led_config)
|
|||||||
data.payload_data.status_message.led_status_message.green = led_config->status.green;
|
data.payload_data.status_message.led_status_message.green = led_config->status.green;
|
||||||
data.payload_data.status_message.led_status_message.blue = led_config->status.blue;
|
data.payload_data.status_message.led_status_message.blue = led_config->status.blue;
|
||||||
data.payload_data.status_message.led_status_message.effect = led_config->status.effect;
|
data.payload_data.status_message.led_status_message.effect = led_config->status.effect;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
|
void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
|
||||||
@ -501,21 +524,12 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
led_config_t *led_config = arg;
|
led_config_t *led_config = arg;
|
||||||
switch (event_id)
|
switch (event_id)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NETWORK_TYPE_DIRECT
|
|
||||||
case ZH_ESPNOW_ON_RECV_EVENT:;
|
case ZH_ESPNOW_ON_RECV_EVENT:;
|
||||||
zh_espnow_event_on_recv_t *recv_data = event_data;
|
zh_espnow_event_on_recv_t *recv_data = event_data;
|
||||||
if (recv_data->data_len != sizeof(zh_espnow_data_t))
|
if (recv_data->data_len != sizeof(zh_espnow_data_t))
|
||||||
{
|
{
|
||||||
goto ZH_ESPNOW_EVENT_HANDLER_EXIT;
|
goto ZH_ESPNOW_EVENT_HANDLER_EXIT;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
case ZH_NETWORK_ON_RECV_EVENT:;
|
|
||||||
zh_network_event_on_recv_t *recv_data = event_data;
|
|
||||||
if (recv_data->data_len != sizeof(zh_espnow_data_t))
|
|
||||||
{
|
|
||||||
goto ZH_NETWORK_EVENT_HANDLER_EXIT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
zh_espnow_data_t *data = (zh_espnow_data_t *)recv_data->data;
|
zh_espnow_data_t *data = (zh_espnow_data_t *)recv_data->data;
|
||||||
switch (data->device_type)
|
switch (data->device_type)
|
||||||
{
|
{
|
||||||
@ -523,42 +537,15 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
switch (data->payload_type)
|
switch (data->payload_type)
|
||||||
{
|
{
|
||||||
case ZHPT_KEEP_ALIVE:
|
case ZHPT_KEEP_ALIVE:
|
||||||
if (data->payload_data.keep_alive_message.online_status == ZH_ONLINE)
|
memcpy(led_config->gateway_mac, recv_data->mac_addr, 6);
|
||||||
|
if (is_first_boot == false)
|
||||||
{
|
{
|
||||||
if (led_config->gateway_is_available == false)
|
is_first_boot = true;
|
||||||
{
|
xTaskCreatePinnedToCore(&zh_send_led_attributes_message_task, "led_attributes_message_task", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, NULL, tskNO_AFFINITY);
|
||||||
led_config->gateway_is_available = true;
|
xTaskCreatePinnedToCore(&zh_send_led_keep_alive_message_task, "led_keep_alive_message_task", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, NULL, tskNO_AFFINITY);
|
||||||
memcpy(led_config->gateway_mac, recv_data->mac_addr, 6);
|
xTaskCreatePinnedToCore(&zh_send_led_config_message_task, "led_config_message_task", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, NULL, tskNO_AFFINITY);
|
||||||
zh_send_led_hardware_config_message(led_config);
|
xTaskCreatePinnedToCore(&zh_send_led_hardware_config_message_task, "led_hardware_config_message_task", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, NULL, tskNO_AFFINITY);
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
xTaskCreatePinnedToCore(&zh_send_led_status_message_task, "led_status_message_task", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, NULL, tskNO_AFFINITY);
|
||||||
{
|
|
||||||
zh_send_led_config_message(led_config);
|
|
||||||
zh_send_led_status_message(led_config);
|
|
||||||
if (led_config->is_first_connection == false)
|
|
||||||
{
|
|
||||||
xTaskCreatePinnedToCore(&zh_send_led_attributes_message_task, "NULL", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, (TaskHandle_t *)&led_config->attributes_message_task, tskNO_AFFINITY);
|
|
||||||
xTaskCreatePinnedToCore(&zh_send_led_keep_alive_message_task, "NULL", ZH_MESSAGE_STACK_SIZE, led_config, ZH_MESSAGE_TASK_PRIORITY, (TaskHandle_t *)&led_config->keep_alive_message_task, tskNO_AFFINITY);
|
|
||||||
led_config->is_first_connection = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vTaskResume(led_config->attributes_message_task);
|
|
||||||
vTaskResume(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (led_config->gateway_is_available == true)
|
|
||||||
{
|
|
||||||
led_config->gateway_is_available = false;
|
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskSuspend(led_config->attributes_message_task);
|
|
||||||
vTaskSuspend(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZHPT_SET:
|
case ZHPT_SET:
|
||||||
@ -595,30 +582,9 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
led_config->hardware_config.green_pin = data->payload_data.config_message.led_hardware_config_message.green_pin;
|
led_config->hardware_config.green_pin = data->payload_data.config_message.led_hardware_config_message.green_pin;
|
||||||
led_config->hardware_config.blue_pin = data->payload_data.config_message.led_hardware_config_message.blue_pin;
|
led_config->hardware_config.blue_pin = data->payload_data.config_message.led_hardware_config_message.blue_pin;
|
||||||
zh_save_config(led_config);
|
zh_save_config(led_config);
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskDelete(led_config->attributes_message_task);
|
|
||||||
vTaskDelete(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
data->device_type = ZHDT_LED;
|
|
||||||
data->payload_type = ZHPT_KEEP_ALIVE;
|
|
||||||
data->payload_data.keep_alive_message.online_status = ZH_OFFLINE;
|
|
||||||
data->payload_data.keep_alive_message.message_frequency = ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY;
|
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
esp_restart();
|
esp_restart();
|
||||||
break;
|
break;
|
||||||
case ZHPT_UPDATE:;
|
case ZHPT_UPDATE:;
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskSuspend(led_config->attributes_message_task);
|
|
||||||
vTaskSuspend(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
data->device_type = ZHDT_LED;
|
|
||||||
data->payload_type = ZHPT_KEEP_ALIVE;
|
|
||||||
data->payload_data.keep_alive_message.online_status = ZH_OFFLINE;
|
|
||||||
data->payload_data.keep_alive_message.message_frequency = ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY;
|
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
|
||||||
const esp_app_desc_t *app_info = get_app_description();
|
const esp_app_desc_t *app_info = get_app_description();
|
||||||
led_config->update_partition = esp_ota_get_next_update_partition(NULL);
|
led_config->update_partition = esp_ota_get_next_update_partition(NULL);
|
||||||
strcpy(data->payload_data.ota_message.espnow_ota_data.app_version, app_info->version);
|
strcpy(data->payload_data.ota_message.espnow_ota_data.app_version, app_info->version);
|
||||||
@ -632,7 +598,7 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
strcpy(data->payload_data.ota_message.espnow_ota_data.app_name, app_info->project_name);
|
strcpy(data->payload_data.ota_message.espnow_ota_data.app_name, app_info->project_name);
|
||||||
#endif
|
#endif
|
||||||
data->payload_type = ZHPT_UPDATE;
|
data->payload_type = ZHPT_UPDATE;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
||||||
break;
|
break;
|
||||||
case ZHPT_UPDATE_BEGIN:
|
case ZHPT_UPDATE_BEGIN:
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP8266
|
#ifdef CONFIG_IDF_TARGET_ESP8266
|
||||||
@ -643,7 +609,7 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
led_config->ota_message_part_number = 1;
|
led_config->ota_message_part_number = 1;
|
||||||
data->device_type = ZHDT_LED;
|
data->device_type = ZHDT_LED;
|
||||||
data->payload_type = ZHPT_UPDATE_PROGRESS;
|
data->payload_type = ZHPT_UPDATE_PROGRESS;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
||||||
break;
|
break;
|
||||||
case ZHPT_UPDATE_PROGRESS:
|
case ZHPT_UPDATE_PROGRESS:
|
||||||
if (led_config->ota_message_part_number == data->payload_data.ota_message.espnow_ota_message.part)
|
if (led_config->ota_message_part_number == data->payload_data.ota_message.espnow_ota_message.part)
|
||||||
@ -653,48 +619,27 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
}
|
}
|
||||||
data->device_type = ZHDT_LED;
|
data->device_type = ZHDT_LED;
|
||||||
data->payload_type = ZHPT_UPDATE_PROGRESS;
|
data->payload_type = ZHPT_UPDATE_PROGRESS;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
||||||
break;
|
break;
|
||||||
case ZHPT_UPDATE_ERROR:
|
case ZHPT_UPDATE_ERROR:
|
||||||
esp_ota_end(led_config->update_handle);
|
esp_ota_end(led_config->update_handle);
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskResume(led_config->attributes_message_task);
|
|
||||||
vTaskResume(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ZHPT_UPDATE_END:
|
case ZHPT_UPDATE_END:
|
||||||
if (esp_ota_end(led_config->update_handle) != ESP_OK)
|
if (esp_ota_end(led_config->update_handle) != ESP_OK)
|
||||||
{
|
{
|
||||||
data->device_type = ZHDT_LED;
|
data->device_type = ZHDT_LED;
|
||||||
data->payload_type = ZHPT_UPDATE_FAIL;
|
data->payload_type = ZHPT_UPDATE_FAIL;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskResume(led_config->attributes_message_task);
|
|
||||||
vTaskResume(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
esp_ota_set_boot_partition(led_config->update_partition);
|
esp_ota_set_boot_partition(led_config->update_partition);
|
||||||
data->device_type = ZHDT_LED;
|
data->device_type = ZHDT_LED;
|
||||||
data->payload_type = ZHPT_UPDATE_SUCCESS;
|
data->payload_type = ZHPT_UPDATE_SUCCESS;
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
zh_espnow_send(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
break;
|
break;
|
||||||
case ZHPT_RESTART:
|
case ZHPT_RESTART:
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskDelete(led_config->attributes_message_task);
|
|
||||||
vTaskDelete(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
data->device_type = ZHDT_LED;
|
|
||||||
data->payload_type = ZHPT_KEEP_ALIVE;
|
|
||||||
data->payload_data.keep_alive_message.online_status = ZH_OFFLINE;
|
|
||||||
data->payload_data.keep_alive_message.message_frequency = ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY;
|
|
||||||
zh_send_message(led_config->gateway_mac, (uint8_t *)data, sizeof(zh_espnow_data_t));
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
esp_restart();
|
esp_restart();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -704,39 +649,11 @@ void zh_espnow_event_handler(void *arg, esp_event_base_t event_base, int32_t eve
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NETWORK_TYPE_DIRECT
|
|
||||||
ZH_ESPNOW_EVENT_HANDLER_EXIT:
|
ZH_ESPNOW_EVENT_HANDLER_EXIT:
|
||||||
heap_caps_free(recv_data->data);
|
heap_caps_free(recv_data->data);
|
||||||
break;
|
break;
|
||||||
case ZH_ESPNOW_ON_SEND_EVENT:;
|
case ZH_ESPNOW_ON_SEND_EVENT:
|
||||||
zh_espnow_event_on_send_t *send_data = event_data;
|
|
||||||
if (send_data->status == ZH_ESPNOW_SEND_FAIL && led_config->gateway_is_available == true)
|
|
||||||
{
|
|
||||||
led_config->gateway_is_available = false;
|
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskSuspend(led_config->attributes_message_task);
|
|
||||||
vTaskSuspend(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#else
|
|
||||||
ZH_NETWORK_EVENT_HANDLER_EXIT:
|
|
||||||
heap_caps_free(recv_data->data);
|
|
||||||
break;
|
|
||||||
case ZH_NETWORK_ON_SEND_EVENT:;
|
|
||||||
zh_network_event_on_send_t *send_data = event_data;
|
|
||||||
if (send_data->status == ZH_NETWORK_SEND_FAIL && led_config->gateway_is_available == true)
|
|
||||||
{
|
|
||||||
led_config->gateway_is_available = false;
|
|
||||||
if (led_config->hardware_config.led_type != HALT_NONE)
|
|
||||||
{
|
|
||||||
vTaskSuspend(led_config->attributes_message_task);
|
|
||||||
vTaskSuspend(led_config->keep_alive_message_task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,8 @@
|
|||||||
#include "driver/ledc.h"
|
#include "driver/ledc.h"
|
||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
#include "esp_ota_ops.h"
|
#include "esp_ota_ops.h"
|
||||||
#include "zh_config.h"
|
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORK_TYPE_DIRECT
|
|
||||||
#include "zh_espnow.h"
|
#include "zh_espnow.h"
|
||||||
#define zh_send_message(a, b, c) zh_espnow_send(a, b, c)
|
#include "zh_config.h"
|
||||||
#define ZH_EVENT ZH_ESPNOW
|
|
||||||
#else
|
|
||||||
#include "zh_network.h"
|
|
||||||
#define zh_send_message(a, b, c) zh_network_send(a, b, c)
|
|
||||||
#define ZH_EVENT ZH_NETWORK
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP8266
|
#ifdef CONFIG_IDF_TARGET_ESP8266
|
||||||
#define ZH_CHIP_TYPE HACHT_ESP8266
|
#define ZH_CHIP_TYPE HACHT_ESP8266
|
||||||
@ -45,12 +36,17 @@
|
|||||||
#define get_app_description() esp_app_get_description()
|
#define get_app_description() esp_app_get_description()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY 10 // Frequency of sending a led keep alive message to the gateway (in seconds).
|
#define ZH_LED_KEEP_ALIVE_MESSAGE_FREQUENCY 10 // Frequency of sending a led keep alive message to the gateway (in seconds).
|
||||||
#define ZH_LED_ATTRIBUTES_MESSAGE_FREQUENCY 60 // Frequency of sending a led attributes message to the gateway (in seconds).
|
#define ZH_LED_ATTRIBUTES_MESSAGE_FREQUENCY 60 // Frequency of sending a led attributes message to the gateway (in seconds).
|
||||||
|
#define ZH_LED_HARDWARE_CONFIG_MESSAGE_FREQUENCY 60 // Frequency of sending a led hardware config message to the gateway (in seconds).
|
||||||
|
#define ZH_LED_CONFIG_MESSAGE_FREQUENCY 60 // Frequency of sending a led config message to the gateway (in seconds).
|
||||||
|
#define ZH_LED_STATUS_MESSAGE_FREQUENCY 60 // Frequency of sending a led status message to the gateway (in seconds).
|
||||||
|
|
||||||
#define ZH_MESSAGE_TASK_PRIORITY 2 // Prioritize the task of sending messages to the gateway.
|
#define ZH_MESSAGE_TASK_PRIORITY 5 // Prioritize the task of sending messages to the gateway.
|
||||||
#define ZH_MESSAGE_STACK_SIZE 2048 // The stack size of the task of sending messages to the gateway.
|
#define ZH_MESSAGE_STACK_SIZE 2048 // The stack size of the task of sending messages to the gateway.
|
||||||
|
|
||||||
|
static bool is_first_boot = false;
|
||||||
|
|
||||||
typedef struct // Structure of data exchange between tasks, functions and event handlers.
|
typedef struct // Structure of data exchange between tasks, functions and event handlers.
|
||||||
{
|
{
|
||||||
struct // Storage structure of led hardware configuration data.
|
struct // Storage structure of led hardware configuration data.
|
||||||
@ -80,11 +76,7 @@ typedef struct // Structure of data exchange between tasks, functions and event
|
|||||||
uint8_t green; // Green color channel.
|
uint8_t green; // Green color channel.
|
||||||
uint8_t blue; // Blue color channel.
|
uint8_t blue; // Blue color channel.
|
||||||
} channel;
|
} channel;
|
||||||
volatile bool gateway_is_available; // Gateway availability status flag. @note Used to control the tasks when the gateway connection is established / lost.
|
|
||||||
volatile bool is_first_connection; // First connection status flag. @note Used to control the tasks when the gateway connection is established / lost.
|
|
||||||
uint8_t gateway_mac[6]; // Gateway MAC address.
|
uint8_t gateway_mac[6]; // Gateway MAC address.
|
||||||
TaskHandle_t attributes_message_task; // Unique task handle for zh_send_led_attributes_message_task().
|
|
||||||
TaskHandle_t keep_alive_message_task; // Unique task handle for zh_send_led_keep_alive_message_task().
|
|
||||||
const esp_partition_t *update_partition; // Next update partition.
|
const esp_partition_t *update_partition; // Next update partition.
|
||||||
esp_ota_handle_t update_handle; // Unique OTA handle.
|
esp_ota_handle_t update_handle; // Unique OTA handle.
|
||||||
uint16_t ota_message_part_number; // The sequence number of the firmware upgrade part. @note Used to verify that all parts have been received.
|
uint16_t ota_message_part_number; // The sequence number of the firmware upgrade part. @note Used to verify that all parts have been received.
|
||||||
@ -148,23 +140,23 @@ int32_t zh_map(int32_t value, int32_t in_min, int32_t in_max, int32_t out_min, i
|
|||||||
/**
|
/**
|
||||||
* @brief Task for prepare the led attributes message and sending it to the gateway.
|
* @brief Task for prepare the led attributes message and sending it to the gateway.
|
||||||
*
|
*
|
||||||
* @param[in,out] pvParameter Pointer to structure of data exchange between tasks, functions and event handlers.
|
* @param[in] pvParameter Pointer to structure of data exchange between tasks, functions and event handlers.
|
||||||
*/
|
*/
|
||||||
void zh_send_led_attributes_message_task(void *pvParameter);
|
void zh_send_led_attributes_message_task(void *pvParameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for prepare the led configuration message and sending it to the gateway.
|
* @brief Task for prepare the led configuration message and sending it to the gateway.
|
||||||
*
|
*
|
||||||
* @param[in] led_config Pointer to the structure of data exchange between tasks, functions and event handlers.
|
* @param[in] pvParameter Pointer to the structure of data exchange between tasks, functions and event handlers.
|
||||||
*/
|
*/
|
||||||
void zh_send_led_config_message(const led_config_t *led_config);
|
void zh_send_led_config_message_task(void *pvParameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for prepare the led hardware configuration message and sending it to the gateway.
|
* @brief Task for prepare the led hardware configuration message and sending it to the gateway.
|
||||||
*
|
*
|
||||||
* @param[in] led_config Pointer to the structure of data exchange between tasks, functions and event handlers.
|
* @param[in] pvParameter Pointer to the structure of data exchange between tasks, functions and event handlers.
|
||||||
*/
|
*/
|
||||||
void zh_send_led_hardware_config_message(const led_config_t *led_config);
|
void zh_send_led_hardware_config_message_task(void *pvParameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Task for prepare the led keep alive message and sending it to the gateway.
|
* @brief Task for prepare the led keep alive message and sending it to the gateway.
|
||||||
@ -173,6 +165,13 @@ void zh_send_led_hardware_config_message(const led_config_t *led_config);
|
|||||||
*/
|
*/
|
||||||
void zh_send_led_keep_alive_message_task(void *pvParameter);
|
void zh_send_led_keep_alive_message_task(void *pvParameter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Task for prepare the sled status message and sending it to the gateway.
|
||||||
|
*
|
||||||
|
* @param[in] pvParameter Pointer to the structure of data exchange between tasks, functions and event handlers.
|
||||||
|
*/
|
||||||
|
void zh_send_led_status_message_task(void *pvParameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for prepare the led status message and sending it to the gateway.
|
* @brief Function for prepare the led status message and sending it to the gateway.
|
||||||
*
|
*
|
||||||
|
7
partitions_esp32c2.csv
Normal file
7
partitions_esp32c2.csv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
||||||
|
nvs, data, nvs, , 0x4000,
|
||||||
|
otadata, data, ota, , 0x2000,
|
||||||
|
phy_init, data, phy, , 0x1000,
|
||||||
|
ota_0, app, ota_0, , 900K,
|
||||||
|
ota_1, app, ota_1, , 900K,
|
|
7
partitions_esp32c3.csv
Normal file
7
partitions_esp32c3.csv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
||||||
|
nvs, data, nvs, , 0x4000,
|
||||||
|
otadata, data, ota, , 0x2000,
|
||||||
|
phy_init, data, phy, , 0x1000,
|
||||||
|
ota_0, app, ota_0, , 1500K,
|
||||||
|
ota_1, app, ota_1, , 1500K,
|
|
7
partitions_esp32c6.csv
Normal file
7
partitions_esp32c6.csv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
||||||
|
nvs, data, nvs, , 0x4000,
|
||||||
|
otadata, data, ota, , 0x2000,
|
||||||
|
phy_init, data, phy, , 0x1000,
|
||||||
|
ota_0, app, ota_0, , 1500K,
|
||||||
|
ota_1, app, ota_1, , 1500K,
|
|
7
partitions_esp32s2.csv
Normal file
7
partitions_esp32s2.csv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
||||||
|
nvs, data, nvs, , 0x4000,
|
||||||
|
otadata, data, ota, , 0x2000,
|
||||||
|
phy_init, data, phy, , 0x1000,
|
||||||
|
ota_0, app, ota_0, , 1500K,
|
||||||
|
ota_1, app, ota_1, , 1500K,
|
|
7
partitions_esp32s3.csv
Normal file
7
partitions_esp32s3.csv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
||||||
|
nvs, data, nvs, , 0x4000,
|
||||||
|
otadata, data, ota, , 0x2000,
|
||||||
|
phy_init, data, phy, , 0x1000,
|
||||||
|
ota_0, app, ota_0, , 1500K,
|
||||||
|
ota_1, app, ota_1, , 1500K,
|
|
18
sdkconfig.defaults.esp32c2
Normal file
18
sdkconfig.defaults.esp32c2
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL=0
|
||||||
|
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||||
|
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
|
||||||
|
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32c2.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_esp32c2.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
|
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=0
|
18
sdkconfig.defaults.esp32c3
Normal file
18
sdkconfig.defaults.esp32c3
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL=0
|
||||||
|
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||||
|
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
|
||||||
|
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32c3.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_esp32c3.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
|
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=0
|
18
sdkconfig.defaults.esp32c6
Normal file
18
sdkconfig.defaults.esp32c6
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL=0
|
||||||
|
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||||
|
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
|
||||||
|
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32c6.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_esp32c6.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
|
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=0
|
18
sdkconfig.defaults.esp32s2
Normal file
18
sdkconfig.defaults.esp32s2
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL=0
|
||||||
|
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||||
|
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
|
||||||
|
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32s2.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_esp32s2.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
|
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=0
|
18
sdkconfig.defaults.esp32s3
Normal file
18
sdkconfig.defaults.esp32s3
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000
|
||||||
|
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
|
||||||
|
CONFIG_BOOTLOADER_LOG_LEVEL=0
|
||||||
|
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||||
|
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
|
||||||
|
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32s3.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_FILENAME="partitions_esp32s3.csv"
|
||||||
|
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||||
|
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
|
||||||
|
CONFIG_LOG_DEFAULT_LEVEL=0
|
@ -1 +1 @@
|
|||||||
1.0.3
|
2.1.0
|
Reference in New Issue
Block a user