Skip to content

Commit

Permalink
Home Accessory Architect v12.10.4 Merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed Jan 15, 2024
1 parent 85f9826 commit 44982f9
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion HAA/HAA_Installer/main/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ EXTRA_CFLAGS += -DWIFI_PARAM_SAVE=0
EXTRA_CFLAGS += -DconfigMAX_TASK_NAME_LEN=7
EXTRA_CFLAGS += -DconfigCHECK_FOR_STACK_OVERFLOW=2
EXTRA_CFLAGS += -DconfigMINIMAL_STACK_SIZE=256
EXTRA_CFLAGS += -DconfigTIMER_TASK_PRIORITY=\(tskIDLE_PRIORITY+5\)
EXTRA_CFLAGS += -DconfigTIMER_TASK_PRIORITY=\(configMAX_PRIORITIES-3\)
EXTRA_CFLAGS += -DconfigTIMER_QUEUE_LENGTH=10
EXTRA_CFLAGS += -DconfigTIMER_TASK_STACK_DEPTH=600

Expand Down
2 changes: 1 addition & 1 deletion HAA/HAA_Installer/main/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
#include "../../common/common_headers.h"

#define INSTALLER_BETA_REVISION "" // Format: "b01"
#define INSTALLER_VERSION "7.8.2"INSTALLER_BETA_REVISION
#define INSTALLER_VERSION "7.8.3"INSTALLER_BETA_REVISION

#endif // __HAA_OTA_HEADER_H__
2 changes: 1 addition & 1 deletion HAA/HAA_Main/main/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ EXTRA_CFLAGS += -DWIFI_PARAM_SAVE=0
EXTRA_CFLAGS += -DconfigMAX_TASK_NAME_LEN=7
EXTRA_CFLAGS += -DconfigCHECK_FOR_STACK_OVERFLOW=2
EXTRA_CFLAGS += -DconfigMINIMAL_STACK_SIZE=256
EXTRA_CFLAGS += -DconfigTIMER_TASK_PRIORITY=\(tskIDLE_PRIORITY+5\)
EXTRA_CFLAGS += -DconfigTIMER_TASK_PRIORITY=\(configMAX_PRIORITIES-3\)
EXTRA_CFLAGS += -DconfigTIMER_QUEUE_LENGTH=15
EXTRA_CFLAGS += -DconfigTIMER_TASK_STACK_DEPTH=736

Expand Down
9 changes: 5 additions & 4 deletions HAA/HAA_Main/main/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "../../common/common_headers.h"

// Version
#define HAA_FIRMWARE_VERSION "12.10.3"
#define HAA_FIRMWARE_VERSION "12.10.4"
#define HAA_FIRMWARE_BETA_REVISION "" // Format: "b01"
#define HAA_FIRMWARE_CODENAME "Merlin"

Expand Down Expand Up @@ -67,7 +67,7 @@
#define FREE_MONITOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
#define LIGHT_SENSOR_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
#define WIFI_PING_GW_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
#define WIFI_RECONNECTION_TASK_PRIORITY (tskIDLE_PRIORITY + 3)
#define WIFI_RECONNECTION_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
#define RECV_UART_TASK_PRIORITY (tskIDLE_PRIORITY + 4)
#define REBOOT_TASK_PRIORITY (tskIDLE_PRIORITY + 3)
#define IRRF_CAPTURE_TASK_PRIORITY (configMAX_PRIORITIES - 2)
Expand Down Expand Up @@ -256,6 +256,7 @@
#define TH_TARGET_MODE_INT ch_group->ch[4]->value.int_value
#define TH_HEATER_TARGET_TEMP_FLOAT ch_group->ch[5]->value.float_value
#define TH_COOLER_TARGET_TEMP_FLOAT ch_group->ch[6]->value.float_value
#define SAFE_TEMPERATURE_MARGIN (3.f)

#define IAIRZONING_LAST_ACTION iairzoning_group->num_i[0]
#define IAIRZONING_MAIN_MODE iairzoning_group->num_i[1]
Expand Down Expand Up @@ -791,8 +792,8 @@
#define WIFI_SLEEP_MODE_SET "d"
#define WIFI_BANDWIDTH_40_SET "dt"

#define WIFI_RECONNECTION_POLL_PERIOD_MS (1000)
#define WIFI_DISCONNECTED_LONG_TIME (254) // * WIFI_RECONNECTION_POLL_PERIOD_MS
#define WIFI_RECONNECTION_POLL_PERIOD_MS (1500)
#define WIFI_DISCONNECTED_LONG_TIME (170) // * WIFI_RECONNECTION_POLL_PERIOD_MS

#define WIFI_WATCHDOG_POLL_PERIOD_MS (1500)
#define WIFI_WATCHDOG_ARP_PERIOD_SET "e"
Expand Down
24 changes: 22 additions & 2 deletions HAA/HAA_Main/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,10 @@ void wifi_reconnection_task() {
} else if (new_ip >= 0) {
vTaskDelay(MS_TO_TICKS(WIFI_RECONNECTION_POLL_PERIOD_MS));

if (wifi_config_get_ip() < 0) {
continue;
}

main_config.wifi_status = WIFI_STATUS_CONNECTED;
main_config.wifi_error_count = 0;
main_config.wifi_arp_count = 0;
Expand Down Expand Up @@ -2093,7 +2097,15 @@ void process_th_task(void* args) {
unsigned int mode_has_changed = false;

void heating(const float deadband, const float deadband_soft_on, const float deadband_force_idle) {
INFO("<%i> Heating", ch_group->serv_index);
INFO("<%i> Heat", ch_group->serv_index);

// Security measure
if (SENSOR_TEMPERATURE_FLOAT > (TH_HEATER_TARGET_TEMP_FLOAT + deadband + deadband_force_idle + SAFE_TEMPERATURE_MARGIN)) {
THERMOSTAT_CURRENT_ACTION = THERMOSTAT_ACTION_HEATER_ON;
} else if (SENSOR_TEMPERATURE_FLOAT < (TH_HEATER_TARGET_TEMP_FLOAT - deadband - deadband_soft_on - SAFE_TEMPERATURE_MARGIN)) {
THERMOSTAT_CURRENT_ACTION = THERMOSTAT_ACTION_HEATER_IDLE;
}

if (SENSOR_TEMPERATURE_FLOAT < (TH_HEATER_TARGET_TEMP_FLOAT - deadband - deadband_soft_on)) {
TH_MODE_INT = THERMOSTAT_MODE_HEATER;
if (th_current_action != THERMOSTAT_ACTION_HEATER_ON) {
Expand Down Expand Up @@ -2158,7 +2170,15 @@ void process_th_task(void* args) {
}

void cooling(const float deadband, const float deadband_soft_on, const float deadband_force_idle) {
INFO("<%i> Cooling", ch_group->serv_index);
INFO("<%i> Cool", ch_group->serv_index);

// Security measure
if (SENSOR_TEMPERATURE_FLOAT > (TH_COOLER_TARGET_TEMP_FLOAT + deadband + deadband_soft_on + SAFE_TEMPERATURE_MARGIN)) {
THERMOSTAT_CURRENT_ACTION = THERMOSTAT_ACTION_COOLER_IDLE;
} else if (SENSOR_TEMPERATURE_FLOAT < (TH_COOLER_TARGET_TEMP_FLOAT - deadband- deadband_force_idle - SAFE_TEMPERATURE_MARGIN)) {
THERMOSTAT_CURRENT_ACTION = THERMOSTAT_ACTION_COOLER_ON;
}

if (SENSOR_TEMPERATURE_FLOAT > (TH_COOLER_TARGET_TEMP_FLOAT + deadband + deadband_soft_on)) {
TH_MODE_INT = THERMOSTAT_MODE_COOLER;
if (th_current_action != THERMOSTAT_ACTION_COOLER_ON) {
Expand Down
3 changes: 2 additions & 1 deletion HAA/HAA_Main/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,13 @@ static void client_send_redirect(client_t *client, int code, const char *redirec
client_send(client, buffer, len);
}

int wifi_config_get_ip() {
#ifdef ESP_PLATFORM
int wifi_config_get_ip() {
if (ip_addr.addr != 0) {
return ip4_addr4_16(&ip_addr);
}
#else
int IRAM wifi_config_get_ip() {
if (sdk_wifi_station_get_connect_status() == STATION_GOT_IP) {
struct ip_info info;
if (sdk_wifi_get_ip_info(STATION_IF, &info) && info.ip.addr != 0) {
Expand Down
3 changes: 2 additions & 1 deletion HAA/HAA_Main/main/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

void wifi_config_smart_connect();
void wifi_config_reset();
int wifi_config_get_ip();
uint32_t wifi_config_get_full_gw();

#ifdef ESP_PLATFORM

int wifi_config_get_ip();
void wifi_config_init(const char* ssid_prefix, void (*on_wifi_ready)(), const char* custom_hostname, const int param, const uint8_t wifi_sleep_mode, const bool bandwidth_40);
void setup_set_esp_netif(esp_netif_t* esp_net_if);
esp_netif_t* setup_get_esp_netif();
Expand All @@ -16,6 +16,7 @@ void wifi_config_connect(const uint8_t mode, const bool with_reset);

#else

int IRAM wifi_config_get_ip();
void wifi_config_init(const char* ssid_prefix, void (*on_wifi_ready)(), const char* custom_hostname, const int param);
void wifi_config_connect(const uint8_t mode, const uint8_t phy, const bool with_reset);
void save_last_working_phy();
Expand Down
10 changes: 6 additions & 4 deletions libs/adv_button/adv_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,18 @@ static void button_evaluate_fn() {
} else { // button->mode == ADV_BUTTON_PULSE_MODE
if (button->value == button->max_eval && !button->pulse_low_detected) {
button->state = true;

} else if (button->value > 0) {
}

if ((button->pulse_low_detected || button->pulse_max_duration_time_us == 0)
&& button->value > 0) {
button->value--;
}

button->pulse_low_detected = false;

if (button->value == 0) {
button->state = false;
}

button->pulse_low_detected = false;
}

if (button->state != button->old_state) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/esp-open-rtos-rsf/core/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ static __attribute__((noinline)) void user_start_phase2(void) {

tcpip_init(NULL, NULL);
sdk_wdt_init();
xTaskCreate(sdk_user_init_task, NULL, configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, &sdk_xUserTaskHandle);
xTaskCreate(sdk_user_init_task, NULL, configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, &sdk_xUserTaskHandle);
vTaskStartScheduler();
}
/*
Expand Down

0 comments on commit 44982f9

Please sign in to comment.