Skip to content

Commit

Permalink
Home Accessory Architect v12.7.1 Merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed Jul 23, 2023
1 parent 0be42bd commit abfabef
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 33 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.5.0"
#define INSTALLER_VERSION "7.5.1"

#endif // __HAA_OTA_HEADER_H__
44 changes: 37 additions & 7 deletions HAA/HAA_Installer/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,16 @@ static void wifi_config_server_on_settings(client_t *client) {
client_send_chunk(client, html_settings_header);

sysparam_status_t status;
char *text = NULL;
char* text = NULL;

#ifdef HAABOOT
client_send_chunk(client, html_settings_script_start);

status = sysparam_get_string(HAA_SCRIPT_SYSPARAM, &text);
if (status == SYSPARAM_OK) {
sysparam_get_string(HAA_SCRIPT_SYSPARAM, &text);
if (text) {
client_send_chunk(client, text);
free(text);
text = NULL;
}
client_send_chunk(client, html_settings_middle);
#endif
Expand Down Expand Up @@ -673,6 +674,29 @@ static void wifi_config_server_on_settings(client_t *client) {

client_send_chunk(client, html_settings_flash_mode);

sysparam_get_string(WIFI_STA_SSID_SYSPARAM, &text);
if (text) {
client_send_chunk(client, text);
free(text);
text = NULL;

uint8_t* wifi_bssid = NULL;
sysparam_get_blob(WIFI_STA_BSSID_SYSPARAM, &wifi_bssid, NULL);
if (wifi_bssid) {
text = malloc(16);
snprintf(text, 16, " (%02x%02x%02x%02x%02x%02x)", wifi_bssid[0], wifi_bssid[1], wifi_bssid[2], wifi_bssid[3], wifi_bssid[4], wifi_bssid[5]);
free(wifi_bssid);

client_send_chunk(client, text);
free(text);
text = NULL;
}

} else {
client_send_chunk(client, "NONE");
}
client_send_chunk(client, html_settings_current_wifi);

// Wifi Networks
char buffer[150];
char bssid[13];
Expand All @@ -696,8 +720,8 @@ static void wifi_config_server_on_settings(client_t *client) {
client_send_chunk(client, html_settings_wifi);

// Custom repo server
status = sysparam_get_string(CUSTOM_REPO_SYSPARAM, &text);
if (status == SYSPARAM_OK) {
sysparam_get_string(CUSTOM_REPO_SYSPARAM, &text);
if (text) {
client_send_chunk(client, text);
free(text);
}
Expand Down Expand Up @@ -907,9 +931,15 @@ static void wifi_config_server_on_settings_update_task(void* args) {
#ifdef HAABOOT
if (wifimode_param && wifimode_param->value) {
int8_t current_wifi_mode = 0;
int8_t new_wifi_mode = strtol(wifimode_param->value, NULL, 10);
sysparam_get_int8(WIFI_STA_MODE_SYSPARAM, &current_wifi_mode);
sysparam_set_int8(WIFI_STA_MODE_SYSPARAM, new_wifi_mode);

int8_t new_wifi_mode = strtol(wifimode_param->value, NULL, 10);

if (current_wifi_mode != new_wifi_mode) {
sysparam_set_int8(WIFI_STA_MODE_SYSPARAM, new_wifi_mode);
sysparam_set_int8(WIFI_AP_ENABLE_SYSPARAM, 1);
sysparam_erase(WIFI_AP_PASSWORD_SYSPARAM);
}
}
#endif

Expand Down
15 changes: 8 additions & 7 deletions HAA/HAA_Installer/main/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
input[type=button]#refresh{background-color: #44bbe3;}
input[type=submit]#join{background-color: #4caf50;}
input[type=submit][disabled]{color:#aaaaaa;background-color:#eeeeee !important;}
.networkheader{font-size:75%;font-weight:bold;margin:0.25em 0 0 0;padding:0;border-bottom:2px solid #aaa;text-align:center;}
.netheader{font-size:75%;font-weight:bold;margin:0.25em 0 0 0;padding:0;border-bottom:2px solid #aaa;text-align:center;}
.networks{font-size:75%;list-style:none;margin:0.4em 0.4em;padding:0;}
.networks li{cursor:pointer;padding:0.25em;margin-bottom:0.25em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;padding-left:1.1em;}
.networks li.secure::before{content:"🔒";position:absolute;left:0;}
Expand Down Expand Up @@ -46,21 +46,18 @@ <h2>Please, support this project by <a href="https://paypal.me/ravensystem">dona
<option value="2">DIO</option>
<option value="3">DOUT</option>
</select></label></div>
<input type="submit" id="join" value="Save" /><br><br>
<input type="submit" id="join" value="Save"/><br><br>
<input type="button" id="refresh" value="⟲ Search WiFi" onClick="window.location.reload(true)"/>
Current: <!-- part HTML_SETTINGS_CURRENT_WIFI --><br>
<div class="nonetworks" style="display:none;">
None found
</div>
<label class="networkheader">WiFi SSID (RSSI Channel) BSSID</label><ul id="networks" class="networks">
<label class="netheader">WiFi SSID (RSSI Channel) BSSID</label><ul id="networks" class="networks">
<!-- part HTML_NETWORK_ITEM -->{% for network in networks %}
<li class="{{ network.secure | ternary('secure', 'unsecure') }}" id="{{ network.bssid }}" title="{{ network.ssid }}">{{ network.ssid }} ({{ network.rssi }} Ch{{ network.channel }}) {{ network.bssid }}</li>
{% endfor %}
<!-- part HTML_SETTINGS_WIFI --><li class="other">Enter WiFi manually</li>
</ul>
<div class="field bssid" style="display:none;">
<label for="bssid">BSSID</label>
<input type="text" id="bssid" name="bid" maxlength="12"/>
</div>
<div class="field required ssid" style="display:none;">
<label for="ssid">SSID</label>
<input type="text" id="ssid" name="sid" maxlength="63"/>
Expand All @@ -69,6 +66,10 @@ <h2>Please, support this project by <a href="https://paypal.me/ravensystem">dona
<label for="pass">Password</label>
<input type="password" id="pass" name="psw" maxlength="63"/>
</div>
<div class="field bssid" style="display:none;">
<label for="bssid">BSSID</label>
<input type="text" id="bssid" name="bid" maxlength="12"/>
</div>
<div class="field">
<label>Update Server</label>
<input type="text" name="ser" value="<!-- part HTML_SETTINGS_REPOSERVER -->" />
Expand Down
4 changes: 2 additions & 2 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.7.0"
#define HAA_FIRMWARE_VERSION "12.7.1"
#define HAA_FIRMWARE_BETA_REVISION ""
#define HAA_FIRMWARE_CODENAME "Merlin"

Expand Down Expand Up @@ -103,7 +103,7 @@
#define PWMS_FREQ "q"
#define PWMH_FREQ_ARRAY "y"
#define PWMH_FREQ_DEFAULT (5000)
#define PWMH_BITS_DIVISOR (3)
#define PWMH_BITS_DIVISOR (6)
#define PWM_ZEROCROSSING_ARRAY_SET "zc"
#define ENABLE_HOMEKIT "h"
#define HOMEKIT_SERVER_MAX_CLIENTS "h"
Expand Down
2 changes: 1 addition & 1 deletion HAA/HAA_Main/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8777,7 +8777,7 @@ void normal_mode_init() {
ledc_timer_config_t ledc_timer = {
.speed_mode = LEDC_LOW_SPEED_MODE,
.timer_num = IO_GPIO_PWMH_TIMER,
.duty_resolution = LEDC_TIMER_13_BIT,
.duty_resolution = LEDC_TIMER_10_BIT,
.freq_hz = pwmh_freq,
.clk_cfg = LEDC_AUTO_CLK,
};
Expand Down
46 changes: 38 additions & 8 deletions HAA/HAA_Main/main/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static void wifi_config_server_on_settings(client_t *client) {
client_send(client, http_prologue, sizeof(http_prologue) - 1);
client_send_chunk(client, html_settings_header);

char *text = NULL;
char* text = NULL;
sysparam_get_string(INSTALLER_VERSION_SYSPARAM, &text);
if (text) {
client_send_chunk(client, text);
Expand All @@ -663,8 +663,8 @@ static void wifi_config_server_on_settings(client_t *client) {
}
client_send_chunk(client, html_settings_installer_version);

sysparam_status_t status = sysparam_get_string(HAA_SCRIPT_SYSPARAM, &text);
if (status == SYSPARAM_OK) {
sysparam_get_string(HAA_SCRIPT_SYSPARAM, &text);
if (text) {
client_send_chunk(client, text);
free(text);
text = NULL;
Expand Down Expand Up @@ -702,7 +702,7 @@ static void wifi_config_server_on_settings(client_t *client) {

client_send_chunk(client, html_settings_reset_homekit_id);

int8_value = 0;
int8_value = 1;
sysparam_get_int8(WIFI_AP_ENABLE_SYSPARAM, &int8_value);
if (int8_value == 1) {
client_send_chunk(client, "checked");
Expand Down Expand Up @@ -737,6 +737,28 @@ static void wifi_config_server_on_settings(client_t *client) {
}
client_send_chunk(client, html_wifi_mode_4);

sysparam_get_string(WIFI_STA_SSID_SYSPARAM, &text);
if (text) {
client_send_chunk(client, text);
free(text);
text = NULL;

uint8_t *wifi_bssid = NULL;
sysparam_get_blob(WIFI_STA_BSSID_SYSPARAM, &wifi_bssid, NULL);
if (wifi_bssid) {
text = malloc(16);
snprintf(text, 16, " (%02x%02x%02x%02x%02x%02x)", wifi_bssid[0], wifi_bssid[1], wifi_bssid[2], wifi_bssid[3], wifi_bssid[4], wifi_bssid[5]);
free(wifi_bssid);

client_send_chunk(client, text);
free(text);
}

} else {
client_send_chunk(client, "NONE");
}
client_send_chunk(client, html_settings_current_wifi);

// Wifi Networks
char buffer[150];
char bssid[13];
Expand Down Expand Up @@ -973,9 +995,15 @@ static void wifi_config_server_on_settings_update_task(void* args) {

if (wifimode_param && wifimode_param->value) {
int8_t current_wifi_mode = 0;
int8_t new_wifi_mode = strtol(wifimode_param->value, NULL, 10);
sysparam_get_int8(WIFI_STA_MODE_SYSPARAM, &current_wifi_mode);
sysparam_set_int8(WIFI_STA_MODE_SYSPARAM, new_wifi_mode);

int8_t new_wifi_mode = strtol(wifimode_param->value, NULL, 10);

if (current_wifi_mode != new_wifi_mode) {
sysparam_set_int8(WIFI_STA_MODE_SYSPARAM, new_wifi_mode);
sysparam_set_int8(WIFI_AP_ENABLE_SYSPARAM, 1);
sysparam_erase(WIFI_AP_PASSWORD_SYSPARAM);
}
}

#ifndef ESP_PLATFORM
Expand Down Expand Up @@ -1195,6 +1223,7 @@ static void wifi_config_softap_start(const int8_t wifi_ap_enable) {
strncpy((char*) softap_config.ap.password,
wifi_ap_password, sizeof(softap_config.ap.password) - 1
);
free(wifi_ap_password);
}

INFO("Wifi AP %s Ch%i", softap_config.ap.ssid, softap_config.ap.channel);
Expand Down Expand Up @@ -1227,6 +1256,7 @@ static void wifi_config_softap_start(const int8_t wifi_ap_enable) {
strncpy((char*) softap_config.password,
wifi_ap_password, sizeof(softap_config.password) - 1
);
free(wifi_ap_password);
}

INFO("Wifi AP %s Ch%i", softap_config.ssid, softap_config.channel);
Expand Down Expand Up @@ -1319,7 +1349,7 @@ static void wifi_config_sta_connect_timeout_task() {
wifi_config_context_free(context);

} else {
int8_t wifi_ap_enable = 0;
int8_t wifi_ap_enable = 1;
sysparam_get_int8(WIFI_AP_ENABLE_SYSPARAM, &wifi_ap_enable);

if (wifi_ap_enable) {
Expand Down Expand Up @@ -1564,7 +1594,7 @@ static void wifi_config_station_connect() {
context->param += 100;
}

int8_t wifi_ap_enable = 0;
int8_t wifi_ap_enable = 1;
sysparam_get_int8(WIFI_AP_ENABLE_SYSPARAM, &wifi_ap_enable);

wifi_config_softap_start(wifi_ap_enable);
Expand Down
15 changes: 8 additions & 7 deletions HAA/HAA_Main/main/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
input[type=button]#refresh{background-color: #44bbe3;}
input[type=submit]#join{background-color: #4caf50;}
input[type=submit][disabled]{color:#aaaaaa;background-color:#eeeeee !important;}
.networkheader{font-size:75%;font-weight:bold;margin:0.25em 0 0 0;padding:0;border-bottom:2px solid #aaa;text-align:center;}
.netheader{font-size:75%;font-weight:bold;margin:0.25em 0 0 0;padding:0;border-bottom:2px solid #aaa;text-align:center;}
.networks{font-size:75%;list-style:none;margin:0.4em 0.4em;padding:0;}
.networks li{cursor:pointer;padding:0.25em;margin-bottom:0.25em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;padding-left:1.1em;}
.networks li.secure::before{content:"🔒";position:absolute;left:0;}
Expand Down Expand Up @@ -94,28 +94,29 @@ <h2>Please, support this project by <a href="https://paypal.me/ravensystem">dona
<option value="48">48</option>
@@@#endif
</select></label></div>
<input type="submit" id="join" value="Save" /><br><br>
<input type="submit" id="join" value="Save"/><br><br>
<input type="button" id="refresh" value="⟲ Search WiFi" onClick="window.location.reload(true)"/>
Current: <!-- part HTML_SETTINGS_CURRENT_WIFI --><br>
<div class="nonetworks" style="display:none;">
None found
</div>
<label class="networkheader">WiFi SSID (RSSI Channel) BSSID</label><ul id="networks" class="networks">
<label class="netheader">WiFi SSID (RSSI Channel) BSSID</label><ul id="networks" class="networks">
<!-- part HTML_NETWORK_ITEM -->{% for network in networks %}
<li class="{{ network.secure | ternary('secure', 'unsecure') }}" id="{{ network.bssid }}" title="{{ network.ssid }}">{{ network.ssid }} ({{ network.rssi }} Ch{{ network.channel }}) {{ network.bssid }}</li>
{% endfor %}
<!-- part HTML_SETTINGS_FOOTER --><li class="other">Enter WiFi manually</li>
</ul>
<div class="field bssid" style="display:none;">
<label for="bssid">BSSID</label>
<input type="text" id="bssid" name="bid" maxlength="12"/>
</div>
<div class="field required ssid" style="display:none;">
<label for="ssid">SSID</label>
<input type="text" id="ssid" name="sid" maxlength="63"/>
</div>
<div class="field required pass" style="display:none;">
<label for="pass">Password</label>
<input type="password" id="pass" name="psw" maxlength="63"/>
</div>
<div class="field bssid" style="display:none;">
<label for="bssid">BSSID</label>
<input type="text" id="bssid" name="bid" maxlength="12"/>
</div></form>
<center>© 2018-2023 Jos&eacute; A. Jim&eacute;nez Campos</center>
<h2>If you have paid for this firmware or for a device with it installed, you have been scammed. You must report the fraud to the authorities and claim the amount paid. <a href="https://raw.githubusercontent.com/RavenSystem/esp-homekit-devices/master/LICENSE">LICENSE</a></h2>
Expand Down

0 comments on commit abfabef

Please sign in to comment.