From 7be9084b27e3385f27f7ac5d0e946f4dcaa94d1e Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 17 Nov 2025 20:06:42 +0800
Subject: [PATCH] update lightd program and test auto light ok

---
 project/lightd/lightd.c   |    4 ++--
 project/lightd/hal/gpio.c |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/project/lightd/hal/gpio.c b/project/lightd/hal/gpio.c
index d0e781c..45e1429 100644
--- a/project/lightd/hal/gpio.c
+++ b/project/lightd/hal/gpio.c
@@ -93,7 +93,7 @@
             goto failed;
         }
 
-        if( gpio->output[i].active_level )
+        if( gpio->input[i].active_level )
             rv = gpiod_line_request_rising_edge_events(gpio->input[i].line, gpio->input[i].name) ;
         else
             rv = gpiod_line_request_falling_edge_events(gpio->input[i].line, gpio->input[i].name) ;
@@ -101,14 +101,14 @@
         if( rv < 0 )
         {
             log_error("gpiod request '%s' pin[#%d] event edge [%s] failure: %s\n",
-                    gpio->input[i].name, gpio->input[i].pin, gpio->output[i].active_level?"rising":"falling", strerror(errno));
+                    gpio->input[i].name, gpio->input[i].pin, gpio->input[i].active_level?"rising":"falling", strerror(errno));
             rv = -4;
             goto failed;
         }
         else
         {
             log_info("gpiod request '%s' pin[#%d] event edge [%s] ok\n",
-                    gpio->input[i].name, gpio->input[i].pin, gpio->output[i].active_level?"rising":"falling");
+                    gpio->input[i].name, gpio->input[i].pin, gpio->input[i].active_level?"rising":"falling");
         }
     }
 
diff --git a/project/lightd/lightd.c b/project/lightd/lightd.c
index 9430c5a..158a3dd 100644
--- a/project/lightd/lightd.c
+++ b/project/lightd/lightd.c
@@ -178,8 +178,8 @@
 
             sleep(hwinfo->light_intval);
 
-            turn_light("indoor", ON);
-            turn_light("hallway", ON);
+            turn_light("indoor", OFF);
+            turn_light("hallway", OFF);
         }
 
         msleep(100);

--
Gitblit v1.9.1