From faf46b1ec395ae08891b7b7db5198385a0cff69e Mon Sep 17 00:00:00 2001 From: RavenSystem Date: Sat, 7 Sep 2024 19:09:55 +0200 Subject: [PATCH] Home Accessory Architect v12.13.2 Merlin --- HAA/HAA_Installer/main/header.h | 2 +- HAA/HAA_Main/main/Makefile | 2 ++ HAA/HAA_Main/main/header.h | 2 +- HAA/HAA_Main/main/main.c | 5 ++--- libs/homekit-rsf/include/homekit/types.h | 3 +-- libs/homekit-rsf/src/server.c | 20 ++++++++++++++++++-- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/HAA/HAA_Installer/main/header.h b/HAA/HAA_Installer/main/header.h index 756e075d..312bc51e 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.12.0"INSTALLER_BETA_REVISION +#define INSTALLER_VERSION "7.12.1"INSTALLER_BETA_REVISION #endif // __HAA_OTA_HEADER_H__ diff --git a/HAA/HAA_Main/main/Makefile b/HAA/HAA_Main/main/Makefile index e7922a67..16a44b91 100644 --- a/HAA/HAA_Main/main/Makefile +++ b/HAA/HAA_Main/main/Makefile @@ -30,6 +30,7 @@ FLASH_SPEED = 40 # Max HAA firmware size is 585728 bytes +EXTRA_CFLAGS += -Os #EXTRA_CFLAGS += -O2 \ # -fpredictive-commoning \ # -ftree-slp-vectorize \ @@ -107,6 +108,7 @@ EXTRA_CFLAGS += -DconfigTIMER_TASK_STACK_DEPTH=736 ## HOMEKIT DEBUG #EXTRA_CFLAGS += -DHOMEKIT_DEBUG +#EXTRA_CFLAGS += -DHOMEKIT_PAIR_VERIFY_TIME_DEBUG ## mDNS Responder DEBUG #EXTRA_CFLAGS += -DqDebugLog -DqLogIncoming -DqLogAllTraffic diff --git a/HAA/HAA_Main/main/header.h b/HAA/HAA_Main/main/header.h index 1c18392d..27c74ec8 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.13.1" +#define HAA_FIRMWARE_VERSION "12.13.2" #define HAA_FIRMWARE_BETA_REVISION "" // Format: "b01" #define HAA_FIRMWARE_CODENAME "Merlin" diff --git a/HAA/HAA_Main/main/main.c b/HAA/HAA_Main/main/main.c index 38d6aefa..07a42cb6 100644 --- a/HAA/HAA_Main/main/main.c +++ b/HAA/HAA_Main/main/main.c @@ -3416,7 +3416,7 @@ void hsi2rgbw(uint16_t h, float s, uint8_t v, ch_group_t* ch_group) { L_DEBUG("d: [%g, %g]", d[0], d[1]); float mat2[2][2], p5[2], p6[2]; -// array_subtract(p5, (LED_RGB + k), d); THIS DOES NOT WORK for this matrix, idk why + array_subtract(p5, *(LED_RGB + k), d); float new_vertex[2] = { myRGB[k][0], myRGB[k][1] }; array_subtract(p5, new_vertex, d); array_subtract(p6, vertex, d); @@ -3428,10 +3428,9 @@ void hsi2rgbw(uint16_t h, float s, uint8_t v, ch_group_t* ch_group) { L_DEBUG("p5: [%g, %g]", p5[0], p5[1]); L_DEBUG("p6: [%g, %g]", p6[0], p6[1]); L_DEBUG("mat2 = { {%g, %g}, {%g, %g} }", mat2[0][0], mat2[0][1], mat2[1][0], mat2[1][1]); - } - INFO("Chrom %g, %g", p[0], p[1]); + L_DEBUG("Chrom %g, %g", p[0], p[1]); } float targetRGB[3]; diff --git a/libs/homekit-rsf/include/homekit/types.h b/libs/homekit-rsf/include/homekit/types.h index f171c593..5332df61 100644 --- a/libs/homekit-rsf/include/homekit/types.h +++ b/libs/homekit-rsf/include/homekit/types.h @@ -85,8 +85,7 @@ typedef struct { bool is_null: 1; bool is_static: 1; homekit_format_t format: 4; - int _align: 10; - uint16_t data_size; + uint32_t data_size: 26; union { bool bool_value; int int_value; diff --git a/libs/homekit-rsf/src/server.c b/libs/homekit-rsf/src/server.c index 711c5cfd..b3c98d2b 100644 --- a/libs/homekit-rsf/src/server.c +++ b/libs/homekit-rsf/src/server.c @@ -673,7 +673,7 @@ void write_characteristic_json(json_stream *json, client_context_t *client, cons size_t encoded_data_size = base64_encoded_size(v.data_value, v.data_size); byte* encoded_data = malloc(encoded_data_size + 1); if (!encoded_data) { - CLIENT_ERROR(client, "Allocate %d bytes for encoding data", encoded_data_size + 1); + CLIENT_ERROR(client, "Allocate %d bytes for encoding", encoded_data_size + 1); json_string(json, ""); break; } @@ -1648,6 +1648,10 @@ void homekit_server_on_pair_setup(client_context_t *context, const byte *data, s } void homekit_server_on_pair_verify(client_context_t *context, const byte *data, size_t size) { +#ifdef HOMEKIT_PAIR_VERIFY_TIME_DEBUG + uint32_t function_time = sdk_system_get_time_raw(); +#endif + HOMEKIT_DEBUG_LOG("Pair Verify"); DEBUG_HEAP(); @@ -2073,6 +2077,10 @@ void homekit_server_on_pair_verify(client_context_t *context, const byte *data, #endif // HOMEKIT_OVERCLOCK_PAIR_VERIFY tlv_free(message); + +#ifdef HOMEKIT_PAIR_VERIFY_TIME_DEBUG + CLIENT_INFO(context, "Verify Time %d", sdk_system_get_time_raw() - function_time); +#endif } @@ -2691,7 +2699,7 @@ void homekit_server_on_update_characteristics(client_context_t *context, const b // Default max data len = 2,097,152 but that does not make sense // for this accessory #ifndef HOMEKIT_DISABLE_MAXLEN_CHECK - unsigned int max_len = (ch->max_data_len) ? *ch->max_data_len : 4096; + unsigned int max_len = (ch->max_data_len) ? *ch->max_data_len : 16384; #endif //HOMEKIT_DISABLE_MAXLEN_CHECK char *value = j_value->valuestring; @@ -2720,6 +2728,14 @@ void homekit_server_on_update_characteristics(client_context_t *context, const b CLIENT_DEBUG(context, "for %d.%d", aid, iid); h_value = HOMEKIT_DATA(data, data_size); + if (ch->setter_ex) { + ch->setter_ex(ch, h_value); + } else { + homekit_value_destruct(&ch->value); + homekit_value_copy(&ch->value, &h_value); + } + + free(data); break; } default: {