Skip to content

Commit

Permalink
Home Accessory Architect v12.13.3 Merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed Oct 5, 2024
1 parent faf46b1 commit 9ba653d
Show file tree
Hide file tree
Showing 27 changed files with 428 additions and 397 deletions.
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.12.1"INSTALLER_BETA_REVISION
#define INSTALLER_VERSION "7.12.2"INSTALLER_BETA_REVISION

#endif // __HAA_OTA_HEADER_H__
6 changes: 2 additions & 4 deletions HAA/HAA_Installer/main/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ static int ota_get_final_location(char* repo, char* file, uint16_t port, const b
const struct timeval rcvtimeout = { 2, 0 };
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &rcvtimeout, sizeof(rcvtimeout));

recv_buf = malloc(RECV_BUF_LEN);
memset(recv_buf, 0, RECV_BUF_LEN);
recv_buf = calloc(1, RECV_BUF_LEN);

strcat(strcat(strcat(strcat(strcat(strcat(strcpy(recv_buf,
REQUESTHEAD),
Expand Down Expand Up @@ -799,8 +798,7 @@ int ota_get_file(char* repo, char* file, int sector, uint16_t port, const bool i
char* ota_get_version(char* repo, char* version_file, uint16_t port, const bool is_ssl) {
INFO(">>> Version from %s", repo);

uint8_t* version = malloc(VERSIONSTRINGLEN + 1);
memset(version, 0, VERSIONSTRINGLEN + 1);
uint8_t* version = calloc(1, VERSIONSTRINGLEN + 1);

if (ota_get_file_ex(repo, version_file, 0, version, VERSIONSTRINGLEN, port, is_ssl, NULL) == 0) {
INFO("**** %s v%s", version_file, (char*) version);
Expand Down
14 changes: 6 additions & 8 deletions HAA/HAA_Installer/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ void setup_mode_reset_sysparam() {
}

static client_t *client_new() {
client_t *client = malloc(sizeof(client_t));
memset(client, 0, sizeof(client_t));
client_t *client = calloc(1, sizeof(client_t));

context->max_body_size = MAX_SETUP_BODY_LEN;

Expand Down Expand Up @@ -487,8 +486,8 @@ static void wifi_scan_done_cb() {
}

if (!net) {
wifi_network_info_t *net = malloc(sizeof(wifi_network_info_t));
memset(net, 0, sizeof(*net));
wifi_network_info_t *net = calloc(1, sizeof(wifi_network_info_t));

strncpy(net->ssid, (char*) ap_records[i].ssid, sizeof(net->ssid) - 1);
memcpy(net->bssid, ap_records[i].bssid, 6);
itoa(ap_records[i].rssi, net->rssi, 10);
Expand Down Expand Up @@ -529,8 +528,8 @@ static void wifi_scan_done_cb(void *arg, sdk_scan_status_t status) {
}

if (!net) {
wifi_network_info_t *net = malloc(sizeof(wifi_network_info_t));
memset(net, 0, sizeof(*net));
wifi_network_info_t *net = calloc(1, sizeof(wifi_network_info_t));

strncpy(net->ssid, (char *)bss->ssid, sizeof(net->ssid) - 1);
memcpy(net->bssid, bss->bssid, 6);
itoa(bss->rssi, net->rssi, 10);
Expand Down Expand Up @@ -1460,8 +1459,7 @@ static void wifi_config_station_connect() {
void wifi_config_init(TaskHandle_t xHandle) {
INFO("Wifi init");

context = malloc(sizeof(wifi_config_context_t));
memset(context, 0, sizeof(*context));
context = calloc(1, sizeof(wifi_config_context_t));

#ifdef ESP_PLATFORM
uint8_t macaddr[6];
Expand Down
14 changes: 12 additions & 2 deletions HAA/HAA_Main/main/extra_characteristics.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,23 @@
#define HOMEKIT_SERVICE_CUSTOM_SETUP_OPTIONS HOMEKIT_CUSTOM_UUID("F0000100")

#define HOMEKIT_CHARACTERISTIC_CUSTOM_SETUP_OPTION HOMEKIT_CUSTOM_UUID("F0000101")
#define HOMEKIT_DECLARE_CHARACTERISTIC_CUSTOM_SETUP_OPTION(_value, ...) \
#define HOMEKIT_DECLARE_CHARACTERISTIC_CUSTOM_SETUP_OPTION(...) \
.type = HOMEKIT_CHARACTERISTIC_CUSTOM_SETUP_OPTION, \
.format = HOMEKIT_FORMAT_STRING, \
.permissions = HOMEKIT_PERMISSIONS_PAIRED_READ \
| HOMEKIT_PERMISSIONS_PAIRED_WRITE \
| HOMEKIT_PERMISSIONS_HIDDEN, \
.value = HOMEKIT_STRING_(_value), \
.value = HOMEKIT_STRING_(""), \
##__VA_ARGS__

#define HOMEKIT_CHARACTERISTIC_CUSTOM_SETUP_ADVANCED_OPTION HOMEKIT_CUSTOM_UUID("F0000102")
#define HOMEKIT_DECLARE_CHARACTERISTIC_CUSTOM_SETUP_ADVANCED_OPTION(...) \
.type = HOMEKIT_CHARACTERISTIC_CUSTOM_SETUP_ADVANCED_OPTION, \
.format = HOMEKIT_FORMAT_DATA, \
.permissions = HOMEKIT_PERMISSIONS_PAIRED_READ \
| HOMEKIT_PERMISSIONS_PAIRED_WRITE \
| HOMEKIT_PERMISSIONS_HIDDEN, \
.value = HOMEKIT_DATA_(NULL, 0, .is_null=true), \
##__VA_ARGS__

// HAA DATA HISTORY
Expand Down
24 changes: 13 additions & 11 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.13.2"
#define HAA_FIRMWARE_VERSION "12.13.3"
#define HAA_FIRMWARE_BETA_REVISION "" // Format: "b01"
#define HAA_FIRMWARE_CODENAME "Merlin"

Expand Down Expand Up @@ -194,7 +194,7 @@
#define BINARY_SENSOR_EXTRA_DATA_SET "dt"

#define THERMOSTAT_TYPE "w"
#define TH_TYPE ch_group->num_i[4]
#define TH_TYPE ch_group->num_i[5]
#define THERMOSTAT_TYPE_HEATER (1)
#define THERMOSTAT_TYPE_COOLER (2)
#define THERMOSTAT_TYPE_HEATERCOOLER (3)
Expand Down Expand Up @@ -223,10 +223,10 @@
#define THERMOSTAT_TARGET_TEMP_STEP "st"
#define TH_IAIRZONING_CONTROLLER_SET "ia"
#define TH_IAIRZONING_GATE_ALL_OFF_STATE_SET "it"
#define THERMOSTAT_CURRENT_ACTION ch_group->num_i[5]
#define TH_IAIRZONING_CONTROLLER ch_group->num_i[6]
#define TH_IAIRZONING_GATE_CURRENT_STATE ch_group->num_i[7]
#define TH_IAIRZONING_GATE_ALL_OFF_STATE ch_group->num_i[8]
#define THERMOSTAT_CURRENT_ACTION ch_group->num_i[6]
#define TH_IAIRZONING_CONTROLLER ch_group->num_i[7]
#define TH_IAIRZONING_GATE_CURRENT_STATE ch_group->num_i[8]
#define TH_IAIRZONING_GATE_ALL_OFF_STATE ch_group->num_i[9]
#define TH_IAIRZONING_GATE_CLOSE (0)
#define TH_IAIRZONING_GATE_OPEN (1)
#define THERMOSTAT_MODE_OFF (0)
Expand Down Expand Up @@ -274,10 +274,11 @@

#define TEMPERATURE_SENSOR_GPIO "g"
#define TH_SENSOR_GPIO ch_group->num_i[0]
#define TH_SENSOR_GPIO_OUTPUT ch_group->num_i[1]
#define TEMPERATURE_SENSOR_TYPE "n"
#define TH_SENSOR_TYPE ch_group->num_i[1]
#define TH_SENSOR_TYPE ch_group->num_i[2]
#define TEMPERATURE_SENSOR_INDEX "u"
#define TH_SENSOR_INDEX ch_group->num_i[2]
#define TH_SENSOR_INDEX ch_group->num_i[3]
#define TEMPERATURE_SENSOR_POLL_PERIOD "j"
#define TH_SENSOR_POLL_PERIOD_DEFAULT (30)
#define TH_SENSOR_POLL_PERIOD_MIN (0.1f)
Expand All @@ -287,12 +288,12 @@
#define TH_SENSOR_HUM_OFFSET ch_group->num_f[1]
#define SENSOR_TEMPERATURE_FLOAT ch_group->ch[0]->value.float_value
#define SENSOR_HUMIDITY_FLOAT ch_group->ch[1]->value.float_value
#define TH_SENSOR_ERROR_COUNT ch_group->num_i[3]
#define TH_SENSOR_ERROR_COUNT ch_group->num_i[4]
#define TH_SENSOR_MAX_ALLOWED_ERRORS (3)
#define TH_SENSOR_TEMP_VALUE_WHEN_ERROR (-99.f)

#define HUMIDIF_TYPE "w"
#define HM_TYPE ch_group->num_i[4]
#define HM_TYPE ch_group->num_i[5]
#define HUMIDIF_TYPE_HUM (1)
#define HUMIDIF_TYPE_DEHUM (2)
#define HUMIDIF_TYPE_HUMDEHUM (3)
Expand All @@ -307,7 +308,7 @@
#define HM_DEADBAND_SOFT_ON ch_group->num_f[4]
#define HUMIDIF_DEADBAND_OFFSET "o"
#define HM_DEADBAND_OFFSET ch_group->num_f[5]
#define HUMIDIF_CURRENT_ACTION ch_group->num_i[5]
#define HUMIDIF_CURRENT_ACTION ch_group->num_i[6]
#define HUMIDIF_MODE_OFF (0)
#define HUMIDIF_MODE_IDLE (1)
#define HUMIDIF_MODE_HUM (2)
Expand Down Expand Up @@ -777,6 +778,7 @@
#define SETUP_MODE_DEFAULT_ACTIVATE_COUNT (8)
#define SETUP_MODE_TOGGLE_TIME_MS (1050)
#define CUSTOM_HAA_COMMAND "io"
#define CUSTOM_HAA_ADVANCED_COMMAND_LEN (2)
#define HAA_SETUP_ACCESSORY_SET "s"

#define IRRF_CAPTURE_BUFFER_SIZE (2048)
Expand Down
Loading

0 comments on commit 9ba653d

Please sign in to comment.