Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new device ID on HomeKit topology change #212

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Fix incorrect access of global var
  • Loading branch information
paullj1 committed Feb 25, 2023
commit d803adfa9e1ddd62c5cb588511bcb9ffb67541ee
2 changes: 1 addition & 1 deletion src/homekit_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef unsigned char byte;
#define HOMEKIT_LOG_DEBUG 3

#ifndef HOMEKIT_LOG_LEVEL
#define HOMEKIT_LOG_LEVEL HOMEKIT_LOG_DEBUG
#define HOMEKIT_LOG_LEVEL HOMEKIT_NO_LOG
#endif

#define HOMEKIT_PRINTF XPGM_PRINTF
Expand Down
5 changes: 4 additions & 1 deletion src/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ bool homekit_storage_magic_valid() {
}

bool homekit_storage_set_magic() {
if (!spiflash_write(MAGIC_ADDR, (byte *)hap_magic, sizeof(hap_magic))) {
char magic[sizeof(hap_magic)];
memcpy(magic, hap_magic, sizeof(magic));

if (!spiflash_write(MAGIC_ADDR, (byte *)magic, sizeof(magic))) {
ERROR("Failed to write HomeKit storage magic");
return false;
}
Expand Down