Skip to content

Commit

Permalink
updated common functions
Browse files Browse the repository at this point in the history
  • Loading branch information
maccoylton committed Jan 9, 2020
1 parent 1a1b7e7 commit 00a5224
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/UDPlogger
2 changes: 1 addition & 1 deletion components/esp-adv-button
Submodule esp-adv-button updated 3 files
+13 −13 README.md
+107 −100 adv_button.c
+9 −2 adv_button.h
2 changes: 1 addition & 1 deletion components/esp-homekit
2 changes: 1 addition & 1 deletion components/esp-wifi-config
2 changes: 1 addition & 1 deletion components/esp-wolfssl
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ EXTRA_CFLAGS += -DHOMEKIT_OVERCLOCK_PAIR_VERIFY
EXTRA_CFLAGS += -DHOMEKIT_OVERCLOCK_PAIR_SETUP
EXTRA_CFLAGS += -DUDPLOG_PRINTF_TO_UDP
EXTRA_CFLAGS += -DUDPLOG_PRINTF_ALSO_SERIAL
EXTRA_CFLAGS += -DconfigUSE_TRACE_FACILITY



Expand Down
17 changes: 16 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,28 @@ homekit_accessory_t *accessories[] = {
};


void recover_from_reset (int reason){
/* called if we restarted abnormally */
printf ("%s: reason %d\n", __func__, reason);
load_characteristic_from_flash(&switch_on);
relay_write(switch_on.value.bool_value, relay_gpio);
}

void save_characteristics ( ){
/* called on a timer to save an values yuo want save after update */
printf ("%s:\n", __func__);
/* save_characteristic_to_flash(&switch_on, switch_on.value); don't reall need to sabve state of a light switch */
save_characteristic_to_flash(&wifi_check_interval, wifi_check_interval.value);
}


void accessory_init_not_paired (void) {
/* initalise anything you don't want started until wifi and homekit imitialisation is confirmed, but not paired */
}

void accessory_init (void ){
/* initalise anything you don't want started until wifi and pairing is confirmed */

homekit_characteristic_notify(&switch_on, switch_on.value);
}

homekit_server_config_t config = {
Expand Down

0 comments on commit 00a5224

Please sign in to comment.