Skip to content

Commit

Permalink
Home Accessory Architect v12.12.1 Merlin
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed Feb 24, 2024
1 parent a3a7c66 commit 4d21e3c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 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.10.0"INSTALLER_BETA_REVISION
#define INSTALLER_VERSION "7.10.1"INSTALLER_BETA_REVISION

#endif // __HAA_OTA_HEADER_H__
19 changes: 5 additions & 14 deletions HAA/HAA_Installer/main/ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@
#include "errno.h"
#include "esp32_port.h"

#define sdk_system_overclock()
#define sdk_system_restoreclock()

#else // ESP_OPEN_RTOS

#include <esp8266.h>
#include <esplibs/libmain.h>
#include <sysparam.h>
#include <spiflash.h>
#include <rboot-api.h>
Expand Down Expand Up @@ -293,12 +289,11 @@ static int ota_connect(char* host, uint16_t port, int *socket, WOLFSSL** ssl, co

//wolfSSL_Debugging_OFF();

sdk_system_overclock();

INFO_NNL("OK\nSSLConnect..");
ret = wolfSSL_connect(*ssl);

sdk_system_restoreclock();
vTaskDelay(50 / portTICK_PERIOD_MS);
ret = wolfSSL_connect(*ssl);
vTaskDelay(50 / portTICK_PERIOD_MS);

if (ret != SSL_SUCCESS) {
freeaddrinfo(res);
Expand Down Expand Up @@ -592,9 +587,9 @@ static int ota_get_file_ex(char* repo, char* file, int sector, uint8_t* buffer,
//wolfSSL_Debugging_ON();
do {
if (is_ssl) {
sdk_system_overclock();
vTaskDelay(50 / portTICK_PERIOD_MS);
ret = wolfSSL_read(ssl, recv_buf, RECV_BUF_LEN - 1);
sdk_system_restoreclock();
vTaskDelay(50 / portTICK_PERIOD_MS);
} else {
ret = lwip_read(socket, recv_buf, RECV_BUF_LEN - 1);
}
Expand Down Expand Up @@ -843,8 +838,6 @@ int ota_get_sign(char* repo, char* file, uint8_t* signature, uint16_t port, bool
int ota_verify_sign(int start_sector, int filesize, uint8_t* signature) {
INFO(">>> Verifying");

sdk_system_overclock();

int bytes;
uint8_t hash[HASHSIZE];
uint8_t* buffer = malloc(1024);
Expand Down Expand Up @@ -886,8 +879,6 @@ int ota_verify_sign(int start_sector, int filesize, uint8_t* signature) {
int verify = 0;
wc_ecc_verify_hash(signature, SIGNSIZE, hash, HASHSIZE, &verify, &public_key);

sdk_system_restoreclock();

INFO(">>> Result %s", verify == 1 ? "OK" : "ERROR");

return verify - 1;
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.12.0"
#define HAA_FIRMWARE_VERSION "12.12.1"
#define HAA_FIRMWARE_BETA_REVISION "" // Format: "b01"
#define HAA_FIRMWARE_CODENAME "Merlin"

Expand Down
37 changes: 24 additions & 13 deletions libs/adv_button/adv_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,17 @@ static void IRAM_ATTR adv_button_interrupt_pulse(void* args) {
static void IRAM adv_button_interrupt_pulse(const uint8_t gpio) {
#endif

const unsigned int read_value = gpio_read(gpio);
adv_button_t *button = button_find_by_gpio(gpio);
if (button->pulse_max_duration_time_us == 0) {
if (!read_value && button->value < button->max_eval) {
if (button->value < button->max_eval) {
button->value++;
}

return;
}

const unsigned int read_value = gpio_read(gpio);

const uint32_t now = sdk_system_get_time_raw();

if (read_value) {
Expand Down Expand Up @@ -449,29 +450,31 @@ static void button_evaluate_fn() {
}

} else { // button->mode == ADV_BUTTON_PULSE_MODE
unsigned int my_button_value = button->value;
if (button->pulse_max_duration_time_us == 0) {
if (button->value == button->max_eval) {
button->value = button->value >> 1;
if (my_button_value == button->max_eval) {
my_button_value = my_button_value >> 1;
button->state = true;
} else if (button->value > 0) {
button->value--;
} else if (my_button_value > 0) {
my_button_value--;
}
} else {
if (button->value == button->max_eval && !button->pulse_low_detected) {
if (my_button_value == button->max_eval && !button->pulse_low_detected) {
button->state = true;
}

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

button->pulse_low_detected = false;
}

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

button->value = my_button_value;
}

if (button->state != button->old_state) {
Expand Down Expand Up @@ -625,10 +628,18 @@ int adv_button_create(const uint16_t gpio, const bool inverted, const uint8_t mo

#ifdef ESP_PLATFORM
gpio_install_isr_service(0);
gpio_set_intr_type(gpio, GPIO_INTR_ANYEDGE);
if (extra_data == 0) {
gpio_set_intr_type(gpio, GPIO_INTR_NEGEDGE);
} else {
gpio_set_intr_type(gpio, GPIO_INTR_ANYEDGE);
}
ret = gpio_isr_handler_add(gpio, adv_button_interrupt_pulse, (void*) ((uint32_t) gpio));
#else
gpio_set_interrupt(gpio, GPIO_INTTYPE_EDGE_ANY, adv_button_interrupt_pulse);
if (extra_data == 0) {
gpio_set_interrupt(gpio, GPIO_INTTYPE_EDGE_NEG, adv_button_interrupt_pulse);
} else {
gpio_set_interrupt(gpio, GPIO_INTTYPE_EDGE_ANY, adv_button_interrupt_pulse);
}
#endif

} else { // MCP23017
Expand Down

0 comments on commit 4d21e3c

Please sign in to comment.