Skip to content

Commit

Permalink
Home Accessory Architect v12.6.1 Merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed Jul 4, 2023
1 parent 1c8d135 commit 8693ec8
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 27 deletions.
21 changes: 12 additions & 9 deletions HAA/HAA_Installer/main/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,21 @@ EXTRA_CFLAGS += $(EXTRA_WOLFSSL_CFLAGS)

# Max HAA OTA MAIN Installer firmware size is 397296 bytes

EXTRA_CFLAGS += -DSPIFLASH_HOMEKIT_BASE_ADDR=0xF2000
EXTRA_CFLAGS += -DHAA_CHIP_NAME=\"esp8266\"

EXTRA_CFLAGS += -DTCP_MSS=1460
EXTRA_CFLAGS += -DTCP_WND=2920
EXTRA_CFLAGS += -DTCP_SND_BUF=2920
EXTRA_CFLAGS += -DLWIP_WND_SCALE=1 -DTCP_RCV_SCALE=0

EXTRA_CFLAGS += -Os

EXTRA_CFLAGS += -Wall -std=gnu99
EXTRA_CFLAGS += -Wextra -Wno-unused-parameter
#EXTRA_CFLAGS += -Wpedantic

EXTRA_CFLAGS += -DWIFI_PARAM_SAVE=0
EXTRA_CFLAGS += -DSPIFLASH_HOMEKIT_BASE_ADDR=0xF2000
EXTRA_CFLAGS += -DHAA_CHIP_NAME=\"esp8266\"

EXTRA_CFLAGS += -DTCP_MSS=1460
EXTRA_CFLAGS += -DTCP_WND=5840
EXTRA_CFLAGS += -DTCP_SND_BUF=5840
EXTRA_CFLAGS += -DLWIP_WND_SCALE=1 -DTCP_RCV_SCALE=0

EXTRA_CFLAGS += -DLWIP_NETIF_HOSTNAME=1
EXTRA_CFLAGS += -DARP_TABLE_SIZE=10
EXTRA_CFLAGS += -DDNS_TABLE_SIZE=4
EXTRA_CFLAGS += -DDNS_MAX_SERVERS=2
Expand All @@ -97,6 +96,10 @@ EXTRA_CFLAGS += -DDHCP_DOES_ARP_CHECK=0
EXTRA_CFLAGS += -DLWIP_DHCP_AGGRESSIVE
#EXTRA_CFLAGS += -DCHECKSUM_CHECK_UDP=0

EXTRA_CFLAGS += -DDHCP_SERVER_MAX_LEASES=2

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
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 @@ -10,6 +10,6 @@

#include "../../common/common_headers.h"

#define INSTALLER_VERSION "7.4.0"
#define INSTALLER_VERSION "7.4.1"

#endif // __HAA_OTA_HEADER_H__
21 changes: 14 additions & 7 deletions HAA/HAA_Installer/main/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,13 @@ static int ota_connect(char* host, uint16_t port, int *socket, WOLFSSL** ssl, co
.ai_family = AF_UNSPEC,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo* res;


struct addrinfo* res = NULL;

void print_error() {
freeaddrinfo(res);
if (res) {
freeaddrinfo(res);
}
INFO("!");
}

Expand Down Expand Up @@ -460,10 +463,14 @@ static int ota_get_final_location(char* repo, char* file, uint16_t port, const b
}
case -2:
lwip_close(socket);
case -3:
//case -3:
default:
;
}

if (ota_conn_result < 0) {
vTaskDelay(5000 / portTICK_PERIOD_MS);
}
}

if (error < 0) {
Expand Down Expand Up @@ -531,12 +538,12 @@ static int ota_get_file_ex(char* repo, char* file, int sector, uint8_t* buffer,
}
case -2:
lwip_close(socket);
case -3:
//case -3:
default:
;
}

vTaskDelay(1000 / portTICK_PERIOD_MS);
vTaskDelay(5000 / portTICK_PERIOD_MS);
}

if (result >= 0) {
Expand Down Expand Up @@ -763,7 +770,7 @@ static int ota_get_file_ex(char* repo, char* file, int sector, uint8_t* buffer,
}
case -2:
lwip_close(socket);
case -3:
//case -3:
default:
;
}
Expand Down
4 changes: 2 additions & 2 deletions HAA/HAA_Installer/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static void client_send_redirect(client_t *client, int code, const char *redirec
client_send(client, buffer, len);
}

bool wifi_config_got_ip() {
static bool wifi_config_got_ip() {
#ifdef ESP_PLATFORM
return got_ip;
#else
Expand Down Expand Up @@ -1149,7 +1149,7 @@ static void wifi_config_softap_start() {
ip4_addr_t first_client_ip;
first_client_ip.addr = ap_ip.ip.addr + htonl(1);

dhcpserver_start(&first_client_ip, 4);
dhcpserver_start(&first_client_ip, DHCP_SERVER_MAX_LEASES);
#endif

context->wifi_networks_semaph = xSemaphoreCreateBinary();
Expand Down
5 changes: 3 additions & 2 deletions HAA/HAA_Main/main/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ EXTRA_CFLAGS += -DHOMEKIT_DISABLE_VALUE_RANGES
EXTRA_CFLAGS += -DHAA_CHIP_NAME=\"esp8266\"

EXTRA_CFLAGS += -DTCP_MSS=1460
EXTRA_CFLAGS += -DTCP_WND=2920
EXTRA_CFLAGS += -DTCP_SND_BUF=2920
EXTRA_CFLAGS += -DTCP_WND=5840
EXTRA_CFLAGS += -DTCP_SND_BUF=5840
EXTRA_CFLAGS += -DLWIP_WND_SCALE=1 -DTCP_RCV_SCALE=0

EXTRA_CFLAGS += -DLWIP_NETIF_HOSTNAME=1
Expand All @@ -77,6 +77,7 @@ EXTRA_CFLAGS += -DMEMP_NUM_NETCONN=16
#EXTRA_CFLAGS += -DMEMP_NUM_TCP_PCB=9
#EXTRA_CFLAGS += -DMEMP_NUM_TCP_PCB_LISTEN=1

EXTRA_CFLAGS += -DDHCP_SERVER_MAX_LEASES=2

EXTRA_CFLAGS += -DWIFI_PARAM_SAVE=0

Expand Down
2 changes: 1 addition & 1 deletion 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.6.0"
#define HAA_FIRMWARE_VERSION "12.6.1"
#define HAA_FIRMWARE_BETA_REVISION ""
#define HAA_FIRMWARE_CODENAME "Merlin"

Expand Down
9 changes: 6 additions & 3 deletions HAA/HAA_Main/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ const char http_header2[] = "\r\nUser-Agent: HAA/"HAA_FIRMWARE_VERSION"\r\nConne
const char http_header_len[] = "Content-length: ";

int new_net_con(char* host, uint16_t port_n, bool is_udp, uint8_t* payload, size_t payload_len, int* s, uint8_t rcvtimeout_s, int rcvtimeout_us) {
struct addrinfo* res;
struct addrinfo* res = NULL;
struct addrinfo hints;
int result;
char port[8];
Expand All @@ -374,7 +374,9 @@ int new_net_con(char* host, uint16_t port_n, bool is_udp, uint8_t* payload, size
}

if (getaddrinfo(host, port, &hints, &res) != 0) {
free(res);
if (res) {
free(res);
}
return -3;
}

Expand Down Expand Up @@ -736,7 +738,8 @@ int ping_host(char* host) {
.ai_family = AF_UNSPEC,
.ai_socktype = SOCK_RAW
};
struct addrinfo* res;

struct addrinfo* res = NULL;

int err = getaddrinfo(host, NULL, &hints, &res);

Expand Down
6 changes: 5 additions & 1 deletion HAA/HAA_Main/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ static void setup_announcer_task() {
};

while (getaddrinfo(SETUP_ANNOUNCER_DESTINATION, SETUP_ANNOUNCER_PORT, &hints, &context->res) != 0) {
if (context->res) {
free(context->res);
context->res = NULL;
}
vTaskDelay(MS_TO_TICKS(200));
}

Expand Down Expand Up @@ -1192,7 +1196,7 @@ static void wifi_config_softap_start() {
ip4_addr_t first_client_ip;
first_client_ip.addr = ap_ip.ip.addr + htonl(1);

dhcpserver_start(&first_client_ip, 4);
dhcpserver_start(&first_client_ip, DHCP_SERVER_MAX_LEASES);
#endif

context->wifi_networks_semaph = xSemaphoreCreateBinary();
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<p align="center"><img width="300" src="https://raw.githubusercontent.com/RavenSystem/ravensystem-media/master/works-with-apple-home.svg"></p>

Firmware to bring native Apple HomeKit support to any device based on ESP32 and ESP8266 microcontrollers.
Firmware to bring native Apple HomeKit support and custom configurations to any device based on ESP32, including all ESP-IDF WiFi compatible chips, and ESP8266 microcontrollers.

HAA supports many different [HomeKit service types](https://github.com/RavenSystem/esp-homekit-devices/wiki/Service-Types), with a lot of possibilities and customizations.

Expand Down

0 comments on commit 8693ec8

Please sign in to comment.