From d0a1a87fc922734462d0caecf4b6bba8b936ee8b Mon Sep 17 00:00:00 2001
From: guowenxue@gmail.com <guowenxue>
Date: Tue, 07 Jul 2026 11:23:00 +0800
Subject: [PATCH] Fix leds active level bug

---
 ex1.auto-light/Board/miscdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ex1.auto-light/Board/miscdev.c b/ex1.auto-light/Board/miscdev.c
index b295827..e2cf754 100644
--- a/ex1.auto-light/Board/miscdev.c
+++ b/ex1.auto-light/Board/miscdev.c
@@ -79,7 +79,7 @@
     if( which >= LedMax )
         return ;
 
-    level = status==OFF ? GPIO_PIN_SET : GPIO_PIN_RESET;
+    level = status==ON ? leds[which].active : !leds[which].active;
     HAL_GPIO_WritePin(leds[which].group, leds[which].pin, level);
 }
 

--
Gitblit v1.10.0