Skip to content

Commit

Permalink
Home Accessory Architect v12.3.0 Merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed May 17, 2023
1 parent a1889e5 commit acf9db4
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 213 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 @@ -10,6 +10,6 @@

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

#define INSTALLER_VERSION "7.1.0"
#define INSTALLER_VERSION "7.2.0"

#endif // __HAA_OTA_HEADER_H__
2 changes: 1 addition & 1 deletion HAA/HAA_Installer/main/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static char last_location[LOCATION_LEN];
#ifdef DEBUG_WOLFSSL
void MyLoggingCallback(const int logLevel, const char* const logMessage) {
/*custom logging function*/
INFO("loglevel: %d - %s", logLevel, logMessage);
INFO("loglevel: %i - %s", logLevel, logMessage);
}
#endif

Expand Down
37 changes: 19 additions & 18 deletions HAA/HAA_Installer/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef struct {
TaskHandle_t ota_task;

wifi_network_info_t* wifi_networks;
SemaphoreHandle_t wifi_networks_mutex;
SemaphoreHandle_t wifi_networks_semaph;

uint8_t check_counter;

Expand Down Expand Up @@ -462,7 +462,7 @@ static void wifi_networks_free() {

#ifdef ESP_PLATFORM
static void wifi_scan_done_cb() {
xSemaphoreTake(context->wifi_networks_mutex, portMAX_DELAY);
xSemaphoreTake(context->wifi_networks_semaph, portMAX_DELAY);

wifi_networks_free();

Expand Down Expand Up @@ -497,7 +497,7 @@ static void wifi_scan_done_cb() {
}
}

xSemaphoreGive(context->wifi_networks_mutex);
xSemaphoreGive(context->wifi_networks_semaph);
}
#else
static void wifi_scan_done_cb(void *arg, sdk_scan_status_t status) {
Expand All @@ -506,7 +506,7 @@ static void wifi_scan_done_cb(void *arg, sdk_scan_status_t status) {
return;
}

xSemaphoreTake(context->wifi_networks_mutex, portMAX_DELAY);
xSemaphoreTake(context->wifi_networks_semaph, portMAX_DELAY);

wifi_networks_free();

Expand Down Expand Up @@ -541,7 +541,7 @@ static void wifi_scan_done_cb(void *arg, sdk_scan_status_t status) {
bss = bss->next.stqe_next;
}

xSemaphoreGive(context->wifi_networks_mutex);
xSemaphoreGive(context->wifi_networks_semaph);
}
#endif

Expand Down Expand Up @@ -681,7 +681,7 @@ static void wifi_config_server_on_settings(client_t *client) {
// Wifi Networks
char buffer[150];
char bssid[13];
if (xSemaphoreTake(context->wifi_networks_mutex, MS_TO_TICKS(4000))) {
if (xSemaphoreTake(context->wifi_networks_semaph, MS_TO_TICKS(4000))) {
wifi_network_info_t* net = context->wifi_networks;
while (net) {
snprintf(bssid, sizeof(bssid), "%02x%02x%02x%02x%02x%02x", net->bssid[0], net->bssid[1], net->bssid[2], net->bssid[3], net->bssid[4], net->bssid[5]);
Expand All @@ -695,7 +695,7 @@ static void wifi_config_server_on_settings(client_t *client) {
net = net->next;
}

xSemaphoreGive(context->wifi_networks_mutex);
xSemaphoreGive(context->wifi_networks_semaph);
}

client_send_chunk(client, html_settings_wifi);
Expand Down Expand Up @@ -1100,11 +1100,13 @@ static void wifi_config_softap_start() {

uint8_t macaddr[6];
sdk_wifi_get_macaddr(STATION_IF, macaddr);


const uint8_t wifi_channel = ((hwrand() % 3) * 5) + 1;

#ifdef ESP_PLATFORM
wifi_config_t softap_config = {
.ap = {
.channel = 6,
.channel = wifi_channel,
.authmode = WIFI_AUTH_OPEN,
.max_connection = 2,
.ssid_hidden = 0,
Expand All @@ -1116,7 +1118,7 @@ static void wifi_config_softap_start() {
"%s-%02X%02X%02X", context->ssid_prefix, macaddr[3], macaddr[4], macaddr[5]
);

INFO("Start AP %s", softap_config.ap.ssid);
INFO("Wifi AP %s Ch%i", softap_config.ap.ssid, softap_config.ap.channel);

esp_netif_t* ap_netif = esp_netif_create_default_wifi_ap();
assert(ap_netif);
Expand All @@ -1126,12 +1128,12 @@ static void wifi_config_softap_start() {
IP4_ADDR(&ap_ip.gw, 0, 0, 0, 0);
esp_netif_set_ip_info(ap_netif, &ap_ip);

INFO("Start DHCP");
esp_wifi_set_config(WIFI_IF_AP, &softap_config);
esp_wifi_set_bandwidth(WIFI_IF_AP, WIFI_BW_HT20);
#else
struct sdk_softap_config softap_config;
softap_config.ssid_hidden = 0;
softap_config.channel = 6;
softap_config.channel = wifi_channel;
softap_config.authmode = AUTH_OPEN;
softap_config.max_connection = 2;
softap_config.beacon_interval = 100;
Expand All @@ -1140,8 +1142,8 @@ static void wifi_config_softap_start() {
(char*) softap_config.ssid, sizeof(softap_config.ssid),
"%s-%02X%02X%02X", context->ssid_prefix, macaddr[3], macaddr[4], macaddr[5]
);

INFO("Start AP %s", softap_config.ssid);
INFO("Wifi AP %s Ch%i", softap_config.ssid, softap_config.channel);

struct ip_info ap_ip;
IP4_ADDR(&ap_ip.ip, 192, 168, 4, 1);
Expand All @@ -1154,12 +1156,11 @@ static void wifi_config_softap_start() {
ip4_addr_t first_client_ip;
first_client_ip.addr = ap_ip.ip.addr + htonl(1);

INFO("Start DHCP");
dhcpserver_start(&first_client_ip, 4);
#endif

context->wifi_networks_mutex = xSemaphoreCreateBinary();
xSemaphoreGive(context->wifi_networks_mutex);
context->wifi_networks_semaph = xSemaphoreCreateBinary();
xSemaphoreGive(context->wifi_networks_semaph);

xTaskCreate(http_task, "WEB", (TASK_SIZE_FACTOR * 640), NULL, (tskIDLE_PRIORITY + 1), NULL);
}
Expand Down Expand Up @@ -1264,7 +1265,7 @@ static uint8_t wifi_config_connect(const uint8_t phy) {
};

sdk_wifi_station_set_config(&sta_config);

esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20);
esp_wifi_set_ps(WIFI_PS_NONE);
#endif

Expand Down
10 changes: 5 additions & 5 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.2.3"
#define HAA_FIRMWARE_VERSION "12.3.0"
#define HAA_FIRMWARE_BETA_REVISION ""
#define HAA_FIRMWARE_CODENAME "Merlin"

Expand Down Expand Up @@ -123,7 +123,6 @@
#define ACCESSORIES_ARRAY "a"
#define EXTRA_SERVICES_ARRAY "es"
#define BUTTONS_ARRAY "b"
#define BUTTONS_ARRAY_1 "b1"
#define FIXED_BUTTONS_ARRAY_0 "f0"
#define FIXED_BUTTONS_ARRAY_1 "f1"
#define FIXED_BUTTONS_ARRAY_2 "f2"
Expand Down Expand Up @@ -750,7 +749,7 @@
#define SETUP_MODE_ACTIVATE_COUNT "z"
#define SETUP_MODE_DEFAULT_ACTIVATE_COUNT (8)
#define SETUP_MODE_TOGGLE_TIME_MS (1050)
#define CUSTOM_HAA_COMMAND "io"
#define CUSTOM_HAA_COMMAND "zc"
#define HAA_SETUP_ACCESSORY_SET "s"

#define ACTION_TASK_TYPE_UART (0)
Expand All @@ -766,13 +765,14 @@
#define WIFI_STATUS_CONNECTED (3)
#define WIFI_PING_ERRORS "w"
#define WIFI_SLEEP_MODE_SET "d"
#define WIFI_BANDWIDTH_40_SET "dt"

#define WIFI_RECONNECTION_POLL_PERIOD_MS (5000)
#define WIFI_DISCONNECTED_LONG_TIME (60) // * WIFI_RECONNECTION_POLL_PERIOD_MS

#define WIFI_WATCHDOG_POLL_PERIOD_MS (1500)
#define WIFI_WATCHDOG_ARP_PERIOD_SET "e"
#define WIFI_WATCHDOG_ARP_PERIOD_DEFAULT (40) // * WIFI_WATCHDOG_POLL_PERIOD_MS
#define WIFI_WATCHDOG_ARP_PERIOD_DEFAULT (190) // * WIFI_WATCHDOG_POLL_PERIOD_MS
#define WIFI_WATCHDOG_ROAMING_PERIOD (1234) // * WIFI_WATCHDOG_POLL_PERIOD_MS

#define HAA_RMT_LED_STRIP_BLOCK_SYMBOLS (256)
Expand All @@ -783,7 +783,7 @@
#define STATUS_LED_DURATION_OFF (120)

#define SAVE_STATES_DELAY_MS (3000)
#define RANDOM_DELAY_MS (4000)
#define RANDOM_DELAY_MS (4500)

#define HOMEKIT_RE_PAIR_TIME_MS (300000)

Expand Down
Loading

0 comments on commit acf9db4

Please sign in to comment.