From 4d21e3c37c985e0d4d73238b123cd48163d58652 Mon Sep 17 00:00:00 2001 From: RavenSystem Date: Sat, 24 Feb 2024 15:07:42 +0100 Subject: [PATCH] Home Accessory Architect v12.12.1 Merlin --- HAA/HAA_Installer/main/header.h | 2 +- HAA/HAA_Installer/main/ota.c | 19 +++++------------ HAA/HAA_Main/main/header.h | 2 +- libs/adv_button/adv_button.c | 37 +++++++++++++++++++++------------ 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/HAA/HAA_Installer/main/header.h b/HAA/HAA_Installer/main/header.h index b5a4248d..445ce01e 100644 --- a/HAA/HAA_Installer/main/header.h +++ b/HAA/HAA_Installer/main/header.h @@ -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__ diff --git a/HAA/HAA_Installer/main/ota.c b/HAA/HAA_Installer/main/ota.c index d238e8c1..a91e5576 100644 --- a/HAA/HAA_Installer/main/ota.c +++ b/HAA/HAA_Installer/main/ota.c @@ -25,13 +25,9 @@ #include "errno.h" #include "esp32_port.h" -#define sdk_system_overclock() -#define sdk_system_restoreclock() - #else // ESP_OPEN_RTOS #include -#include #include #include #include @@ -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); @@ -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); } @@ -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); @@ -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; diff --git a/HAA/HAA_Main/main/header.h b/HAA/HAA_Main/main/header.h index e4f96417..39fb020f 100644 --- a/HAA/HAA_Main/main/header.h +++ b/HAA/HAA_Main/main/header.h @@ -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" diff --git a/libs/adv_button/adv_button.c b/libs/adv_button/adv_button.c index 9fa7890f..9c8b92a5 100644 --- a/libs/adv_button/adv_button.c +++ b/libs/adv_button/adv_button.c @@ -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) { @@ -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) { @@ -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