From 0dedfe7f309f0c0f99b41e2b93cecabacca1cd83 Mon Sep 17 00:00:00 2001 From: RavenSystem Date: Thu, 14 Sep 2023 21:05:51 +0200 Subject: [PATCH] Home Accessory Architect v12.8.1 Merlin --- HAA/HAA_Main/main/header.h | 4 +- HAA/HAA_Main/main/main.c | 91 +++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/HAA/HAA_Main/main/header.h b/HAA/HAA_Main/main/header.h index ced1b18e..f227cd99 100644 --- a/HAA/HAA_Main/main/header.h +++ b/HAA/HAA_Main/main/header.h @@ -11,7 +11,7 @@ #include "../../common/common_headers.h" // Version -#define HAA_FIRMWARE_VERSION "12.8.0" +#define HAA_FIRMWARE_VERSION "12.8.1" #define HAA_FIRMWARE_BETA_REVISION "" #define HAA_FIRMWARE_CODENAME "Merlin" @@ -34,7 +34,6 @@ #define IRRF_TX_TASK_SIZE (TASK_SIZE_FACTOR * (456)) #define UART_ACTION_TASK_SIZE (TASK_SIZE_FACTOR * (384)) #define NETWORK_ACTION_TASK_SIZE (TASK_SIZE_FACTOR * (544)) -#define DELAYED_SENSOR_START_TASK_SIZE GLOBAL_TASK_SIZE #define TEMPERATURE_TASK_SIZE GLOBAL_TASK_SIZE #define PROCESS_TH_TASK_SIZE GLOBAL_TASK_SIZE #define PROCESS_HUMIDIF_TASK_SIZE GLOBAL_TASK_SIZE @@ -58,7 +57,6 @@ #define IRRF_TX_TASK_PRIORITY (tskIDLE_PRIORITY + 1) #define UART_ACTION_TASK_PRIORITY (tskIDLE_PRIORITY + 1) #define NETWORK_ACTION_TASK_PRIORITY (tskIDLE_PRIORITY + 1) -#define DELAYED_SENSOR_START_TASK_PRIORITY (tskIDLE_PRIORITY + 1) #define TEMPERATURE_TASK_PRIORITY (tskIDLE_PRIORITY + 1) #define PROCESS_TH_TASK_PRIORITY (tskIDLE_PRIORITY + 1) #define PROCESS_HUMIDIF_TASK_PRIORITY (tskIDLE_PRIORITY + 1) diff --git a/HAA/HAA_Main/main/main.c b/HAA/HAA_Main/main/main.c index 1bbae047..dbaa4352 100644 --- a/HAA/HAA_Main/main/main.c +++ b/HAA/HAA_Main/main/main.c @@ -6327,7 +6327,7 @@ void net_action_task(void* pvParameters) { action_network = action_network->next; } - free(pvParameters); + free(action_task); vTaskDelete(NULL); } @@ -6703,7 +6703,7 @@ void irrf_tx_task(void* pvParameters) { action_irrf_tx = action_irrf_tx->next; } - free(pvParameters); + free(action_task); vTaskDelete(NULL); } @@ -6743,7 +6743,7 @@ void uart_action_task(void* pvParameters) { action_uart = action_uart->next; } - free(pvParameters); + free(action_task); vTaskDelete(NULL); } @@ -6761,12 +6761,14 @@ void action_task_timer(TimerHandle_t xTimer) { action_task_t* action_task = (action_task_t*) pvTimerGetTimerID(xTimer); if (!action_task->done && - ((action_task->type == ACTION_TASK_TYPE_UART && - xTaskCreate(uart_action_task, "UA", UART_ACTION_TASK_SIZE, xTimer, UART_ACTION_TASK_PRIORITY, NULL) != pdPASS) || - (action_task->type == ACTION_TASK_TYPE_IRRF && - xTaskCreate(irrf_tx_task, "IR", IRRF_TX_TASK_SIZE, xTimer, IRRF_TX_TASK_PRIORITY, NULL) != pdPASS) || - (action_task->type == ACTION_TASK_TYPE_NETWORK && - xTaskCreate(net_action_task, "NET", NETWORK_ACTION_TASK_SIZE, xTimer, NETWORK_ACTION_TASK_PRIORITY, NULL) != pdPASS))) { + ( + (action_task->type == ACTION_TASK_TYPE_UART && + xTaskCreate(uart_action_task, "UA", UART_ACTION_TASK_SIZE, xTimer, UART_ACTION_TASK_PRIORITY, NULL) != pdPASS) || + (action_task->type == ACTION_TASK_TYPE_IRRF && + xTaskCreate(irrf_tx_task, "IR", IRRF_TX_TASK_SIZE, xTimer, IRRF_TX_TASK_PRIORITY, NULL) != pdPASS) || + (action_task->type == ACTION_TASK_TYPE_NETWORK && + xTaskCreate(net_action_task, "NET", NETWORK_ACTION_TASK_SIZE, xTimer, NETWORK_ACTION_TASK_PRIORITY, NULL) != pdPASS) + )) { action_task->errors++; homekit_remove_oldest_client(); @@ -7373,40 +7375,6 @@ void identify(homekit_characteristic_t* ch, const homekit_value_t value) { // --------- -void delayed_sensor_task() { - ch_group_t* ch_group = main_config.ch_groups; - while (ch_group) { - if (ch_group->timer && - ch_group->serv_type >= SERV_TYPE_THERMOSTAT && - ch_group->serv_type <= SERV_TYPE_HUMIDIFIER_WITH_TEMP) { - vTaskDelay(MS_TO_TICKS(3500)); - - INFO("<%i> Start TH", ch_group->serv_index); - - temperature_timer_worker(ch_group->timer); - rs_esp_timer_start_forced(ch_group->timer); - } - - ch_group = ch_group->next; - } - - ch_group = main_config.ch_groups; - while (ch_group) { - if (ch_group->serv_type == SERV_TYPE_IAIRZONING) { - vTaskDelay(MS_TO_TICKS(9500)); - - INFO("<%i> Start iAZ", ch_group->serv_index); - - temperature_timer_worker(ch_group->timer); - rs_esp_timer_start_forced(ch_group->timer); - } - - ch_group = ch_group->next; - } - - vTaskDelete(NULL); -} - homekit_characteristic_t name = HOMEKIT_CHARACTERISTIC_(NAME, NULL); homekit_characteristic_t manufacturer = HOMEKIT_CHARACTERISTIC_(MANUFACTURER, "José A. Jiménez Campos"); homekit_characteristic_t model = HOMEKIT_CHARACTERISTIC_(MODEL, "RavenSystem HAA "HAA_FIRMWARE_CODENAME); @@ -12835,8 +12803,6 @@ void normal_mode_init() { unistring_destroy(unistrings); - xTaskCreate(delayed_sensor_task, "DS", DELAYED_SENSOR_START_TASK_SIZE, NULL, DELAYED_SENSOR_START_TASK_PRIORITY, NULL); - //set_unused_gpios(); config.accessories = accessories; @@ -12872,6 +12838,41 @@ void normal_mode_init() { } main_config.wifi_mode = (uint8_t) wifi_mode; + // Delayed TH Sensors + ch_group_t* th_ch_group = main_config.ch_groups; + while (th_ch_group) { + if (th_ch_group->serv_type >= SERV_TYPE_THERMOSTAT && + th_ch_group->serv_type <= SERV_TYPE_HUMIDIFIER_WITH_TEMP && + th_ch_group->timer) { + + INFO("<%i> Start TH", th_ch_group->serv_index); + + temperature_timer_worker(th_ch_group->timer); + rs_esp_timer_start_forced(th_ch_group->timer); + } + + th_ch_group = th_ch_group->next; + + if (th_ch_group) { + vTaskDelay(MS_TO_TICKS(2800)); + } + } + + // Delayed iAirZoning + th_ch_group = main_config.ch_groups; + while (th_ch_group) { + if (th_ch_group->serv_type == SERV_TYPE_IAIRZONING) { + vTaskDelay(MS_TO_TICKS(2800)); + + INFO("<%i> Start iAZ", th_ch_group->serv_index); + + temperature_timer_worker(th_ch_group->timer); + rs_esp_timer_start_forced(th_ch_group->timer); + } + + th_ch_group = th_ch_group->next; + } + random_task_long_delay(); //main_config.wifi_status = WIFI_STATUS_CONNECTING; // Not needed