From 2e84abfd073ec3047c7b3295c47f109007f3bd80 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 02 Feb 2026 16:34:56 +0800
Subject: [PATCH] Update lightd code to get lux value without timeout

---
 project/lightd/lightd.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/project/lightd/lightd.c b/project/lightd/lightd.c
index 9d5b03d..a025598 100644
--- a/project/lightd/lightd.c
+++ b/project/lightd/lightd.c
@@ -60,7 +60,6 @@
 
     int                rv;
     float              lux = 0.0;
-    time_t             last_time = 0;
     iotd_ctx_t         ctx;
     hwinfo_t          *hwinfo = &ctx.hwinfo;
 
@@ -156,14 +155,11 @@
             goto nextloop;
         }
 
-        /* TSL2561 update lux in every 10 minutes  */
-        if(check_timeout(&last_time, 600))
+        /* TSL2561 update lux value now */
+        if( tsl2561_get_lux(&lux) < 0 )
         {
-            if( tsl2561_get_lux(&lux) < 0 )
-            {
-                log_error("TSL2561 sample failed, do not turn on the light\n");
-                goto nextloop;
-            }
+            log_error("TSL2561 sample failed, do not turn on the light\n");
+            goto nextloop;
         }
 
         /* Check need auto light or not */

--
Gitblit v1.9.1