Skip to content

Commit

Permalink
Home Accessory Architect v0.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenSystem committed Dec 14, 2019
1 parent 5b2e94c commit d53fdde
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
5 changes: 4 additions & 1 deletion devices/HAA/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ EXTRA_CFLAGS += -DHOMEKIT_OVERCLOCK_PAIR_VERIFY
EXTRA_CFLAGS += -DHOMEKIT_OVERCLOCK_PAIR_SETUP
EXTRA_CFLAGS += -DLWIP_NETIF_HOSTNAME=1

## DEBUG
## HAA_DEBUG
#EXTRA_CFLAGS += -DHAA_DEBUG

## HOMEKIT DEBUG
#EXTRA_CFLAGS += -DHOMEKIT_DEBUG=1

include $(abspath ../../sdk/esp-open-rtos/common.mk)
Expand Down
26 changes: 14 additions & 12 deletions devices/HAA/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Home Accessory Architect
*
* v0.8.3
* v0.8.4
*
* Copyright 2019 José Antonio Jiménez Campos (@RavenSystem)
*
Expand Down Expand Up @@ -46,8 +46,8 @@
#include <cJSON.h>

// Version
#define FIRMWARE_VERSION "0.8.3"
#define FIRMWARE_VERSION_OCTAL 001003 // Matches as example: firmware_revision 2.3.8 = 02.03.10 (octal) = config_number 020310
#define FIRMWARE_VERSION "0.8.4"
#define FIRMWARE_VERSION_OCTAL 001004 // Matches as example: firmware_revision 2.3.8 = 02.03.10 (octal) = config_number 020310

// Characteristic types (ch_type)
#define CH_TYPE_BOOL 0
Expand Down Expand Up @@ -1295,8 +1295,11 @@ void garage_door_stop(const uint8_t gpio, void *args, const uint8_t type) {

ch0->value.int_value = GARAGE_DOOR_STOPPED;

sdk_os_timer_disarm(ch_group->timer);
led_blink(1);
INFO("GD stop");

sdk_os_timer_disarm(ch_group->timer);

cJSON *json_context = ch0->context;
do_actions(json_context, 10);

Expand All @@ -1308,14 +1311,10 @@ void garage_door_obstruction(const uint8_t gpio, void *args, const uint8_t type)
ch_group_t *ch_group = ch_group_find(ch);

led_blink(1);
INFO("Garage Door obstruction: %i", type);
INFO("GD obstruction: %i", type);

ch_group->ch2->value.bool_value = (bool) type;

if ((bool) type) {
garage_door_stop(0, ch_group->ch0, 0);
}

hkc_group_notify(ch);

cJSON *json_context = ch->context;
Expand All @@ -1327,7 +1326,7 @@ void garage_door_sensor(const uint8_t gpio, void *args, const uint8_t type) {
ch_group_t *ch_group = ch_group_find(ch);

led_blink(1);
INFO("Garage Door sensor: %i", type);
INFO("GD sensor: %i", type);

ch->value.int_value = type;

Expand All @@ -1337,6 +1336,7 @@ void garage_door_sensor(const uint8_t gpio, void *args, const uint8_t type) {
} else {
ch_group->ch1->value.int_value = type;
sdk_os_timer_disarm(ch_group->timer);

if (type == 0) {
ch_group->num0 = ch_group->num1 - GARAGE_DOOR_TIME_MARGIN;
} else {
Expand All @@ -1358,13 +1358,15 @@ void hkc_garage_door_setter(homekit_characteristic_t *ch1, const homekit_value_t
ch_group_t *ch_group = ch_group_find(ch1);
if (!ch_group->ch2->value.bool_value && (!ch_group->ch_sec || ch_group->ch_sec->value.bool_value)) {
uint8_t current_door_state = ch_group->ch0->value.int_value;
if (current_door_state > 1) {
if (current_door_state == GARAGE_DOOR_STOPPED) {
current_door_state = ch_group->ch1->value.int_value;
} else if (current_door_state > 1) {
current_door_state -= 2;
}

if (value.int_value != current_door_state) {
led_blink(1);
INFO("Setter Garage Door");
INFO("Setter GD");

ch1->value = value;

Expand Down
2 changes: 1 addition & 1 deletion external_libs/wifi_config_haa/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.nonetworks{text-align:center;margin:1em 0;}
.field{margin-bottom:0.5em;}
.field.required label::before{content:"*";color:red;}
</style></head><body><div class="container"><h1>Home Accessory Architect v0.8.3</h1>
</style></head><body><div class="container"><h1>Home Accessory Architect v0.8.4</h1>
<form action="/settings" method="post">
<div class="field required conf">
<label for="conf">JSON Config:</label>
Expand Down

0 comments on commit d53fdde

Please sign in to comment.