From 49a833a87794bd607e10f70e4df9d1f8ff24f42e Mon Sep 17 00:00:00 2001 From: HomeACcessoryKid Date: Sat, 27 Oct 2018 14:51:43 +0200 Subject: [PATCH] 0.0.2 first attempt at reportQueue --- Makefile | 4 ++++ main.c | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3afafbc..fa6eec7 100644 --- a/Makefile +++ b/Makefile @@ -16,3 +16,7 @@ include $(SDK_PATH)/common.mk monitor: $(FILTEROUTPUT) --port $(ESPPORT) --baud $(ESPBAUD) --elf $(PROGRAM_OUT) + +signature: + $(openssl sha384 -binary -out firmware/main.bin.sig firmware/main.bin) + $(printf "%08x" `cat firmware/main.bin | wc -c`| xxd -r -p >>firmware/main.bin.sig) \ No newline at end of file diff --git a/main.c b/main.c index 57bf515..faa301b 100644 --- a/main.c +++ b/main.c @@ -129,7 +129,29 @@ void reverse_set(homekit_value_t value) { homekit_characteristic_t reversed = HOMEKIT_CHARACTERISTIC_(CUSTOM_REVERSED, 0, .setter=reverse_set, .getter=reverse_get); - +struct _report { + int position; + int direction; + //int data4; + int status; + //int data6; + //int data7; + //int data8; + int calibr; +} report; + +QueueHandle_t reportQueue = NULL; +void report_track(void *pvParameters){ + struct _report rep; + if( reportQueue == 0 ) {LOG("NO QUEUE!\n");vTaskDelete(NULL);} + while(1) { + if( xQueueReceive( reportQueue, (void*)&rep, (TickType_t) 100 ) ) { + //do things + LOG("pos=%02x,dir=%02x,sta=%02x,cal=%02x\n",rep.position,rep.direction,rep.status,rep.calibr); + } + //send a position request + } +} void uart_send_output(void *pvParameters){ int i; @@ -138,9 +160,9 @@ void uart_send_output(void *pvParameters){ char pause[]={0x55,0xfe,0xfe,0x03,0x03,0x38,0xe5}; vTaskDelay(1000); //wait 10 seconds while(1) { - LOG(" open\n");for (i=0;i<7;i++) uart_putc(1, open[i]);uart_flush_txfifo(1);vTaskDelay(500); - LOG("close\n");for (i=0;i<7;i++) uart_putc(1,close[i]);uart_flush_txfifo(1);vTaskDelay(500); - LOG("pause\n");for (i=0;i<7;i++) uart_putc(1,pause[i]);uart_flush_txfifo(1);vTaskDelay(500); + LOG(" open\n");for (i=0;i<7;i++) uart_putc(1, open[i]);uart_flush_txfifo(1);vTaskDelay(1000); + LOG("close\n");for (i=0;i<7;i++) uart_putc(1,close[i]);uart_flush_txfifo(1);vTaskDelay(1000); + LOG("pause\n");for (i=0;i<7;i++) uart_putc(1,pause[i]);uart_flush_txfifo(1);vTaskDelay(1000); } } @@ -162,6 +184,13 @@ void parse(int positions) { else { for (i=3;i