summaryrefslogtreecommitdiffstats
path: root/lock/bend.c
diff options
context:
space:
mode:
Diffstat (limited to 'lock/bend.c')
-rw-r--r--lock/bend.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lock/bend.c b/lock/bend.c
index 077bd83..f70b6be 100644
--- a/lock/bend.c
+++ b/lock/bend.c
@@ -37,7 +37,7 @@ static char tab[] = {
'P', 'f', ':', 'B', ']', 'Y', '^', 'F', '%', 'C', 'x'
};
-static uint8_t syn = 0;
+static uint8_t synced = 0;
static volatile uint8_t rxd = 0;
static volatile uint8_t islock = 0;
static volatile uint8_t isunlock = 0;
@@ -133,16 +133,15 @@ int main(void)
if (rxd) {
n = radio_recv(buf, WDLEN);
buf[n] = '\0';
- if (!syn) {
+ if (!synced) {
xor(KEY, buf, msg, WDLEN);
if (strncmp(msg, SYN, WDLEN) == 0) {
- syn = 1;
keygen(key, WDLEN + 1);
xor(KEY, key, buf, WDLEN);
- radio_sendto(txaddr, buf, WDLEN);
+ synced = radio_sendto(txaddr, buf, WDLEN);
}
} else {
- syn = 0;
+ synced = 0;
xor(key, buf, msg, WDLEN);
if (strncmp(msg, LOCK, WDLEN) == 0)
lock();