From edcdb8b7e2b21a4e4ec46f39f13a8601852d5957 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Tue, 19 Apr 2022 09:24:19 +0800 Subject: [PATCH] add list.h --- iotd/main.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/iotd/main.c b/iotd/main.c index ed29b06..53cdf9c 100644 --- a/iotd/main.c +++ b/iotd/main.c @@ -194,26 +194,31 @@ if( lux > hal_ctx->lux_threshold ) { - log_nrml("Lux[%.3f] > Treshold[%.3f], don't need light on.\n", lux, hal_ctx->lux_threshold); - sleep(30); + log_nrml("Lux[%.3f] > Treshold[%.3f], don't need light on and sleep now.\n", lux, hal_ctx->lux_threshold); + if( hal_ctx->gpio.light_intval > 0) + sleep( hal_ctx->gpio.light_intval ); + else + sleep(30); + continue; } } - rv = infrared_detect(250); - + rv = infrared_detect(); if( rv & FLAG_INFRARED_INDOOR ) { log_nrml("Someone incoming detected by indoor infrared\n"); + thread_start(NULL, light_on_worker, "indoor" ); } if( rv & FLAG_INFRARED_HALLWAY ) { log_nrml("Someone incoming detected by hallway infrared\n"); + thread_start(NULL, light_on_worker, "hallway" ); } } - msleep(500); + msleep(100); } } -- Gitblit v1.9.1